diff -urN binutils-2.7/COPYING binutils-2.8/COPYING --- binutils-2.7/COPYING Thu Jul 4 12:21:54 1996 +++ binutils-2.8/COPYING Wed Apr 30 12:57:43 1997 @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -279,7 +279,7 @@ END OF TERMS AND CONDITIONS - Appendix: How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -305,7 +305,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Also add information on how to contact you by electronic and paper mail. diff -urN binutils-2.7/Makefile.in binutils-2.8/Makefile.in --- binutils-2.7/Makefile.in Mon Jul 15 15:08:34 1996 +++ binutils-2.8/Makefile.in Wed Apr 30 13:06:20 1997 @@ -1,6 +1,6 @@ # # Makefile for directory with subdirs to build. -# Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation +# Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 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 @@ -45,7 +45,7 @@ SHELL = /bin/sh -INSTALL = $${srcroot}/install.sh -c +INSTALL = $$s/install.sh -c INSTALL_PROGRAM = $(INSTALL) INSTALL_DATA = $(INSTALL) -m 644 INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)' @@ -68,6 +68,7 @@ CFLAGS = -g LIBCFLAGS = $(CFLAGS) CFLAGS_FOR_TARGET = $(CFLAGS) +LDFLAGS_FOR_TARGET = LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) PICFLAG = PICFLAG_FOR_TARGET = @@ -101,7 +102,7 @@ then echo $$r/m4/m4 ; \ else echo m4 ; fi` -MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \ +MAKEINFO = `if [ -f $$r/texinfo/makeinfo/Makefile ] ; \ then echo $$r/texinfo/makeinfo/makeinfo ; \ else echo makeinfo ; fi` @@ -114,8 +115,8 @@ then echo $$r/expect/expect ; \ else echo expect ; fi` -RUNTEST = `if [ -f $${srcroot}/dejagnu/runtest ] ; \ - then echo $${srcroot}/dejagnu/runtest ; \ +RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \ + then echo $$s/dejagnu/runtest ; \ else echo runtest ; fi` @@ -161,9 +162,13 @@ CC_FOR_TARGET = ` \ - if [ -f $$r/gcc/Makefile ] ; then \ + if [ -f $$r/gcc/xgcc ] ; then \ if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \ - echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $${srcroot}/newlib/libc/include -nostdinc; \ + if [ -f $$r/$(TARGET_SUBDIR)/winsup/Makefile ] ; then \ + echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/newlib/ -L$$r/winsup -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \ + else \ + echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \ + fi; \ else \ echo $$r/gcc/xgcc -B$$r/gcc/; \ fi; \ @@ -175,11 +180,21 @@ fi; \ fi` +# If CC_FOR_TARGET is not overriden on the command line, then this +# variable is passed down to the gcc Makefile, where it is used to +# build libgcc2.a. We define it here so that it can itself be +# overridden on the command line. +GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/ + CXX_FOR_TARGET = ` \ - if [ -f $$r/gcc/Makefile ] ; then \ + if [ -f $$r/gcc/xgcc ] ; then \ if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \ - echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $${srcroot}/newlib/libc/include -nostdinc; \ + if [ -f $$r/$(TARGET_SUBDIR)/winsup/Makefile ] ; then \ + echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/newlib/ -L$$r/winsup -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \ + else \ + echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \ + fi; \ else \ echo $$r/gcc/xgcc -B$$r/gcc/; \ fi; \ @@ -276,7 +291,6 @@ "CXXFLAGS_FOR_TARGET=$(CXXFLAGS_FOR_TARGET)" \ "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \ "DLLTOOL_FOR_TARGET=$(DLLTOOL_FOR_TARGET)" \ - "GCC_FOR_TARGET=$(CC_FOR_TARGET)" \ "INSTALL=$(INSTALL)" \ "INSTALL_DATA=$(INSTALL_DATA)" \ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ @@ -369,11 +383,13 @@ 'HOST_PREFIX_1=$(HOST_PREFIX_1)' \ 'NM=$(NM)' \ 'RANLIB=$$(RANLIB_FOR_TARGET)' \ + "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \ `if test x"$(LANGUAGES)" != x; then echo "LANGUAGES=$(LANGUAGES)"; fi` \ `if test x"$(STMP_FIXPROTO)" != x; then echo "STMP_FIXPROTO=$(STMP_FIXPROTO)"; fi` \ `if test x"$(LIMITS_H_TEST)" != x; then echo "LIMITS_H_TEST=$(LIMITS_H_TEST)"; fi` \ `if test x"$(LIBGCC1_TEST)" != x; then echo "LIBGCC1_TEST=$(LIBGCC1_TEST)"; fi` \ `if test x"$(LIBGCC2_CFLAGS)" != x; then echo "LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)"; fi` \ + `if test x"$(LIBGCC2_DEBUG_CFLAGS)" != x; then echo "LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)"; fi` \ `if test x"$(LIBGCC2_INCLUDES)" != x; then echo "LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)"; fi` \ `if test x"$(ENQUIRE)" != x; then echo "ENQUIRE=$(ENQUIRE)"; fi` \ `if test x"$(BOOT_CFLAGS)" != x; then echo "BOOT_CFLAGS=$(BOOT_CFLAGS)"; fi` @@ -385,15 +401,18 @@ ALL_MODULES = \ all-apache \ all-autoconf \ + all-bash \ all-bfd \ all-binutils \ all-byacc \ all-cvs \ + all-db \ all-dejagnu \ all-diff \ all-dosutils \ all-etc \ all-fileutils \ + all-findutils \ all-find \ all-flex \ all-gas \ @@ -406,6 +425,7 @@ all-indent \ all-inet \ all-ispell \ + all-itcl \ all-ld \ all-libiberty \ all-m4 \ @@ -423,6 +443,7 @@ all-send-pr \ all-shellutils \ all-sim \ + all-sn \ all-tar \ all-tcl \ all-texinfo \ @@ -434,8 +455,6 @@ # This is a list of the check targets for all of the modules which are # compiled using $(FLAGS_TO_PASS). -# This is a list of the check targets for all of the modules which are -# compiled using $(FLAGS_TO_PASS). # # The list is in two parts. The first lists those tools which # are tested as part of the host's native tool-chain, and not @@ -447,13 +466,16 @@ CROSS_CHECK_MODULES = \ check-apache \ check-autoconf \ + check-bash \ check-bfd \ check-binutils \ check-cvs \ + check-db \ check-dejagnu \ check-diff \ check-etc \ check-fileutils \ + check-findutils \ check-find \ check-gas \ check-gawk \ @@ -464,6 +486,7 @@ check-indent \ check-inet \ check-ispell \ + check-itcl \ check-ld \ check-libiberty \ check-m4 \ @@ -479,6 +502,7 @@ check-sed \ check-send-pr \ check-shellutils \ + check-sn \ check-sim \ check-tar \ check-tcl \ @@ -496,15 +520,18 @@ INSTALL_MODULES = \ install-apache \ install-autoconf \ + install-bash \ install-bfd \ install-binutils \ install-byacc \ install-cvs \ + install-db \ install-dejagnu \ install-diff \ install-dosutils \ install-etc \ install-fileutils \ + install-findutils \ install-find \ install-flex \ install-gas \ @@ -517,6 +544,7 @@ install-indent \ install-inet \ install-ispell \ + install-itcl \ install-ld \ install-libiberty \ install-m4 \ @@ -533,6 +561,7 @@ install-send-pr \ install-shellutils \ install-sim \ + install-sn \ install-tar \ install-tcl \ install-textutils \ @@ -561,8 +590,7 @@ check-guile \ check-expect \ check-gash \ - check-tclX \ - check-tk + check-tclX # This is a list of the install targets for all the modules which are # compiled using $(X11_FLAGS_TO_PASS). @@ -627,15 +655,18 @@ CLEAN_MODULES = \ clean-apache \ clean-autoconf \ + clean-bash \ clean-bfd \ clean-binutils \ clean-byacc \ clean-cvs \ + clean-db \ clean-dejagnu \ clean-diff \ clean-dosutils \ clean-etc \ clean-fileutils \ + clean-findutils \ clean-find \ clean-flex \ clean-gas \ @@ -648,6 +679,7 @@ clean-indent \ clean-inet \ clean-ispell \ + clean-itcl \ clean-ld \ clean-libiberty \ clean-m4 \ @@ -665,6 +697,7 @@ clean-send-pr \ clean-shellutils \ clean-sim \ + clean-sn \ clean-tar \ clean-tcl \ clean-texinfo \ @@ -730,7 +763,7 @@ $(DO_X): @target=`echo $@ | sed -e 's/^do-//'`; \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ for i in $(SUBDIRS) -dummy-; do \ if [ -f ./$$i/Makefile ]; then \ @@ -758,7 +791,7 @@ done @target=`echo $@ | sed -e 's/^do-//'`; \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ for i in $(TARGET_CONFIGDIRS) -dummy-; do \ if [ -f $(TARGET_SUBDIR)/$$i/Makefile ]; then \ @@ -785,8 +818,11 @@ installcheck: do-installcheck dvi: do-dvi +# Make sure makeinfo is built before we do a `make info'. +do-info: all-texinfo + install-info: do-install-info dir.info - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ if [ -f dir.info ] ; then \ $(INSTALL_DATA) dir.info $(infodir)/dir.info ; \ else true ; fi @@ -795,7 +831,7 @@ -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E local-distclean: - -rm -f Makefile config.status + -rm -f Makefile config.status config.cache -if [ "$(TARGET_SUBDIR)" != "." ]; then \ rm -rf $(TARGET_SUBDIR); \ else true; fi @@ -817,7 +853,7 @@ @dir=`echo $@ | sed -e 's/clean-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) clean); \ else \ @@ -827,9 +863,10 @@ .PHONY: $(CLEAN_TARGET_MODULES) $(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; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) clean); \ else \ @@ -849,7 +886,7 @@ # Installation targets. .PHONY: install uninstall source-vault binary-vault vault-install -install: $(INSTALL_TARGET) +install: $(INSTALL_TARGET) install-info uninstall: @echo "the uninstall target is not supported in this tree" @@ -881,9 +918,9 @@ fi # inet-install is used because the I*Net wants DejaGNU installed but -# not built. +# not built. Similarly, gzip is built but not installed. inet-install: - $(MAKE) INSTALL_MODULES="`echo $(INSTALL_MODULES) | sed -e 's/install-dejagnu//'`" install + $(MAKE) INSTALL_MODULES="`echo $(INSTALL_MODULES) | sed -e 's/install-dejagnu//' -e 's/install-gzip//'`" install # install-no-fixedincludes is used because Cygnus can not distribute # the fixed header files. @@ -908,7 +945,7 @@ touch gcc/stmp-fixinc gcc/include/fixed; \ rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd` ; export srcroot; \ + s=`cd $(srcdir); pwd` ; export s; \ $(SET_LIB_PATH) \ (cd ./gcc; \ $(MAKE) $(GCC_FLAGS_TO_PASS) install); \ @@ -927,7 +964,7 @@ @dir=`echo $@ | sed -e 's/all-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) all); \ else \ @@ -944,7 +981,7 @@ dir=`echo $@ | sed -e 's/check-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \ else \ @@ -956,7 +993,7 @@ @dir=`echo $@ | sed -e 's/check-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \ else \ @@ -970,7 +1007,7 @@ @dir=`echo $@ | sed -e 's/install-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \ else \ @@ -982,13 +1019,33 @@ .PHONY: $(CONFIGURE_TARGET_MODULES) $(CONFIGURE_TARGET_MODULES): @dir=`echo $@ | sed -e 's/configure-target-//'`; \ - if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \ + if [ -d $(TARGET_SUBDIR)/$${dir} ]; then \ + 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 \ + if cmp $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/tmpmulti.out > /dev/null; then \ + rm -f $(TARGET_SUBDIR)/$${dir}/tmpmulti.out; \ + else \ + echo "Multilibs changed for $${dir}, reconfiguring"; \ + rm -f $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/Makefile; \ + mv $(TARGET_SUBDIR)/$${dir}/tmpmulti.out $(TARGET_SUBDIR)/$${dir}/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/$${dir}/tmpmulti.out $(TARGET_SUBDIR)/$${dir}/multilib.out; \ + fi; \ + fi; \ + fi; exit 0 # break command into two pieces + @dir=`echo $@ | sed -e 's/configure-target-//'`; \ + if [ ! -d $(TARGET_SUBDIR) ]; then \ + true; \ + elif [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \ true; \ 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; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ AR="$(AR_FOR_TARGET)"; export AR; \ AS="$(AS_FOR_TARGET)"; export AS; \ @@ -998,6 +1055,7 @@ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ LD="$(LD_FOR_TARGET)"; export LD; \ + LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ NM="$(NM_FOR_TARGET)"; export NM; \ RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ echo Configuring in $(TARGET_SUBDIR)/$${dir}; \ @@ -1013,7 +1071,7 @@ esac; \ if [ "$(srcdir)" = "." ] ; then \ if [ "$(TARGET_SUBDIR)" != "." ] ; then \ - if $(SHELL) $${srcroot}/symlink-tree $${topdir}/$${dir} "no-such-file" ; then \ + if $(SHELL) $$s/symlink-tree $${topdir}/$${dir} "no-such-file" ; then \ if [ -f Makefile ]; then \ if $(MAKE) distclean; then \ true; \ @@ -1033,14 +1091,14 @@ libsrcdir="."; \ else \ srcdiroption="--srcdir=$${topdir}/$${dir}"; \ - libsrcdir="$${srcroot}/$${dir}"; \ + libsrcdir="$$s/$${dir}"; \ fi; \ if [ -f $${libsrcdir}/configure ] ; then \ $(SHELL) $${libsrcdir}/configure \ $(CONFIG_ARGUMENTS) $${srcdiroption} \ --with-target-subdir="$(TARGET_SUBDIR)"; \ else \ - $(SHELL) $${srcroot}/configure \ + $(SHELL) $$s/configure \ $(CONFIG_ARGUMENTS) $${srcdiroption} \ --with-target-subdir="$(TARGET_SUBDIR)"; \ fi; \ @@ -1058,7 +1116,7 @@ @dir=`echo $@ | sed -e 's/all-target-//'`; \ if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) all); \ else \ @@ -1072,7 +1130,7 @@ @dir=`echo $@ | sed -e 's/check-target-//'`; \ if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $(TARGET_SUBDIR)/$${dir};$(MAKE) $(TARGET_FLAGS_TO_PASS) check);\ else \ @@ -1087,7 +1145,7 @@ @dir=`echo $@ | sed -e 's/install-target-//'`; \ if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $(TARGET_SUBDIR)/$${dir}; \ $(MAKE) $(TARGET_FLAGS_TO_PASS) install); \ @@ -1102,7 +1160,7 @@ @dir=`echo $@ | sed -e 's/all-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; \ $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all); \ @@ -1117,7 +1175,7 @@ @dir=`echo $@ | sed -e 's/check-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; \ $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check); \ @@ -1132,7 +1190,7 @@ @dir=`echo $@ | sed -e 's/install-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; \ $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install); \ @@ -1145,7 +1203,7 @@ all-gcc: @if [ -f ./gcc/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) all); \ else \ @@ -1156,7 +1214,7 @@ all-bootstrap: @if [ -f ./gcc/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) bootstrap); \ else \ @@ -1167,7 +1225,7 @@ check-gcc: @if [ -f ./gcc/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) check); \ else \ @@ -1178,7 +1236,7 @@ install-gcc: @if [ -f ./gcc/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) install); \ else \ @@ -1194,7 +1252,7 @@ @dir=`echo $@ | sed -e 's/install-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ - srcroot=`cd $(srcdir); pwd`; export srcroot; \ + s=`cd $(srcdir); pwd`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \ else \ @@ -1207,10 +1265,12 @@ # This is a list of inter-dependencies among modules. all-apache: all-autoconf: all-m4 +all-bash: all-bfd: all-binutils: all-libiberty all-opcodes all-bfd all-flex all-byacc all-byacc: all-cvs: +all-db: all-dejagnu: all-tcl all-expect all-tk all-diff: all-libiberty all-emacs: @@ -1220,6 +1280,7 @@ all-target-examples: configure-target-examples all-expect: all-tcl all-tk all-fileutils: all-libiberty +all-findutils: all-find: all-flex: all-libiberty all-byacc all-gas: all-libiberty all-opcodes all-bfd @@ -1240,6 +1301,7 @@ all-indent: all-inet: all-tcl all-send-pr all-perl all-ispell: all-emacs19 +all-itcl: all-tcl all-tk all-ld: all-libiberty all-bfd all-opcodes all-byacc all-flex configure-target-libg++: $(ALL_GCC) configure-target-librx all-target-libg++: configure-target-libg++ all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio all-target-librx all-target-libstdc++ @@ -1268,6 +1330,7 @@ all-send-pr: all-prms all-shellutils: all-sim: all-libiberty all-bfd all-opcodes +all-sn: all-tcl all-tk all-itcl all-db all-tar: all-libiberty all-tcl: all-tclX: all-tcl all-tk @@ -1277,7 +1340,7 @@ all-tgas: all-libiberty all-bfd all-opcodes all-time: all-wdiff: -all-target-winsup: all-target-newlib all-target-libiberty configure-target-winsup +all-target-winsup: all-target-newlib all-target-libiberty all-target-librx all-target-libio configure-target-winsup configure-target-winsup: configure-target-newlib all-uudecode: all-libiberty configure-target-libiberty: $(ALL_GCC) @@ -1292,7 +1355,8 @@ $(exec_prefix) .PHONY: install-dirs install-dirs: - @for i in $(MAKEDIRS) ; do \ + @for i in .. $(MAKEDIRS) ; do \ + if [ x$$i != x.. ]; then \ echo Making $$i... ; \ parent=`echo $$i | sed -e 's@/[^/]*$$@@' | sed -e 's@^$$@/@'`; \ if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi ; \ @@ -1305,9 +1369,9 @@ else \ true ; \ fi ; \ + else true; fi; \ done - dir.info: do-install-info if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \ $(srcdir)/texinfo/gen-info-dir $(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \ @@ -1342,13 +1406,13 @@ # distribution (perhaps it would be better to include it anyway). DEVO_SUPPORT= README Makefile.in configure configure.in \ config.guess config.sub config move-if-change \ - mpw-README mpw-build.in mpw-config.in mpw-configure \ + mpw-README mpw-build.in mpw-config.in mpw-configure mpw-install \ COPYING COPYING.LIB install.sh config-ml.in symlink-tree # Files in devo/etc used in any net release. # ChangeLog omitted because it may refer to files which are not in this # distribution (perhaps it would be better to include it anyway). -ETC_SUPPORT= Makefile.in cfg-paper.texi configure.in configure.man \ +ETC_SUPPORT= Makefile.in cfg-paper.texi configure configure.in configure.man \ configure.texi standards.texi make-stds.texi \ configure.info* standards.info* cfg-paper.info* @@ -1356,7 +1420,7 @@ # this macro. SUPPORT_FILES = list-of-support-files-for-tool-in-question # Files where "byacc" (Cygnus version) should be changed to "bison -y" (FSF). -DISTBISONFILES= binutils/Makefile.in gas/Makefile.in gdb/Makefile.in +DISTBISONFILES= binutils/Makefile.in gas/Makefile.in gdb/Makefile.in ld/Makefile.in .PHONY: taz @@ -1422,24 +1486,28 @@ ln -s ../../../texinfo/util/tex3patch proto-toplev/texinfo/util ; \ else true; fi chmod og=u `find . -print` - (VER=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'`; \ - echo "==> Making $(TOOL)-$$VER.tar.gz"; \ - rm -f $(TOOL)-$$VER; ln -s proto-toplev $(TOOL)-$$VER; \ - tar cfh - $(TOOL)-$$VER \ - | $(GZIPPROG) -v -9 >$(TOOL)-$$VER.tar.gz ) + $(MAKE) -f Makefile.in do-tar-gz TOOL=$(TOOL) \ + VER=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'` + +do-tar-gz: + echo "==> Making $(TOOL)-$(VER).tar.gz" + -rm -f $(TOOL)-$(VER) + ln -s proto-toplev $(TOOL)-$(VER) + tar cfh $(TOOL)-$(VER).tar $(TOOL)-$(VER) + $(GZIPPROG) -v -9 $(TOOL)-$(VER).tar TEXINFO_SUPPORT= texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT) .PHONY: gas.tar.gz -GAS_SUPPORT_DIRS= bfd include libiberty opcodes make-all.com setup.com +GAS_SUPPORT_DIRS= bfd include libiberty opcodes setup.com makefile.vms gas.tar.gz: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas $(MAKE) -f Makefile.in taz TOOL=gas \ SUPPORT_FILES="$(GAS_SUPPORT_DIRS)" # The FSF "binutils" release includes gprof and ld. .PHONY: binutils.tar.gz -BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof make-all.com setup.com +BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof setup.com makefile.vms binutils.tar.gz: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils $(MAKE) -f Makefile.in taz TOOL=binutils \ SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS) makeall.bat configure.bat" diff -urN binutils-2.7/README binutils-2.8/README --- binutils-2.7/README Thu Jul 4 12:21:53 1996 +++ binutils-2.8/README Wed Apr 30 12:57:43 1997 @@ -4,7 +4,7 @@ debuggers, etc., plus their support routines, definitions, and documentation. If you are receiving this as part of a GDB release, see the file gdb/README. -If with a gas release, see gas/README; if with a libg++ release, +If with a binutils release, see binutils/README; if with a libg++ release, see libg++/README, etc. That'll give you info about this package -- supported targets, how to use it, how to report bugs, etc. @@ -19,7 +19,7 @@ then do: make install -If the configure script can't determine your type of computer, give it +(If the configure script can't determine your type of computer, give it the name as an argument, for instance ``./configure sun4''. You can use the script ``config.sub'' to test whether a name is recognized; if it is, config.sub translates it to a triplet specifying CPU, vendor, @@ -46,5 +46,5 @@ COPYING.LIB in the various directories, for a description of the GNU General Public License terms under which you can copy the files. -REPORTING BUGS: Again, see gdb/README, gas/README, etc., for info on where and -how to report problems. +REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info +on where and how to report problems. diff -urN binutils-2.7/bfd/COPYING binutils-2.8/bfd/COPYING --- binutils-2.7/bfd/COPYING Thu Jul 4 12:16:46 1996 +++ binutils-2.8/bfd/COPYING Wed Apr 30 12:55:43 1997 @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -279,7 +279,7 @@ END OF TERMS AND CONDITIONS - Appendix: How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -305,7 +305,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Also add information on how to contact you by electronic and paper mail. diff -urN binutils-2.7/bfd/ChangeLog binutils-2.8/bfd/ChangeLog --- binutils-2.7/bfd/ChangeLog Wed Jul 10 12:47:14 1996 +++ binutils-2.8/bfd/ChangeLog Wed Apr 30 12:55:44 1997 @@ -1,6 +1,2257 @@ -Wed Jul 10 11:19:43 1996 Ian Lance Taylor +Wed Apr 30 12:27:03 1997 Ian Lance Taylor - * Released binutils 2.7. + * elf.c (copy_private_bfd_data): Cast csecs to avoid sign + extension problems. + +Tue Apr 22 12:06:08 1997 Ian Lance Taylor + + * Makefile.in (do_maintainer_clean): Don't remove bfd-in2.h. + +Mon Apr 21 11:21:31 1997 Andreas Schwab + + * elf32-m68k.c: Follow the last changes in elf32-i386.c: + (struct elf_m68k_pcrel_relocs_copied, struct + elf_m68k_link_hash_entry, struct elf_m68k_link_hash_table, + elf_m68k_link_hash_traverse, elf_m68k_hash_table, + elf_m68k_link_hash_newfunc, elf_m68k_link_hash_table_create, + elf_m68k_discard_copies, bfd_elf32_bfd_link_hash_table_create): + New definitions. + (elf_m68k_check_relocs): If linking with -Bsymbolic, don't copy + PC relative relocs for a global symbol defined in a regular + object, and count the number of PC relative relocs copied for any + global symbol. + (elf_m68k_size_dynamic_sections): If linking with -Bsymbolic, + traverse with elf_m68k_discard_copies. + +Sat Apr 19 22:50:14 1997 Ian Lance Taylor + + * elf32-i386.c (elf_i386_check_relocs): Only count PC relative + relocs. From Jamie Lokier . + +Thu Apr 17 13:46:56 1997 Per Fogelstrom + + * configure.host (mips*-*-openbsd*): New target. + +Thu Apr 17 11:10:54 1997 Ian Lance Taylor + + * elflink.h (elf_link_add_object_symbols): Only subtract the + section VMA from the symbol value if this is a fully linked file. + + * elf32-i386.c (struct elf_i386_pcrel_relocs_copied): Define. + (struct elf_i386_link_hash_entry): Define. + (struct elf_i386_link_hash_table): Define. + (elf_i386_link_hash_traverse): Define. + (elf_i386_hash_table): Define. + (elf_i386_link_hash_newfunc): New static function. + (elf_i386_link_hash_table_create): New static function. + (elf_i386_check_relocs): If linking with -Bsymbolic, don't copy + PC relative relocs for a global symbol defined in a regular + object, and count the number of PC relative relocs copied for any + global symbol. + (elf_i386_size_dynamic_sections): If linking with -Bsymbolic, + traverse with elf_i386_discard_copies. + (elf_i386_discard_copies): New static function. + (bfd_elf32_bfd_link_hash_table_create): Define. + + From Gordon W. Ross : + * aoutf1.h (MY_entry_is_text_address): Define if not defined. + (sunos4_aout_backend): Use MY_entry_is_text_address. + +Wed Apr 16 14:02:29 1997 Ian Lance Taylor + + From Gordon W. Ross : + * netbsd.h (N_SHARED_LIB): Define. + (SEGMENT_SIZE): Don't define. + * m68knetbsd.c (SEGMENT_SIZE): Don't define (revert change of + April 11). + * sparcnetbsd.c (TARGET_PAGE_SIZE): Define as 0x2000. + (SEGMENT_SIZE): Don't define. + + * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Set .rela.bss size + to sizeof Rela structure, not sizeof Rel structure. From Gary + Thomas . + +Tue Apr 15 11:50:37 1997 Ian Lance Taylor + + * aout-target.h (MY(callback)): If entry_is_text_address, adjust + whenever entry is larger than text address, but only by whole + pages. From Gordon W. Ross . + + * elflink.h (elf_link_add_object_symbols): Don't call check_relocs + if this is a debugging section which we are stripping. + +Mon Apr 14 12:39:30 1997 Richard Henderson + + * elf64-alpha.c (elf64_alpha_object_p): Allocate the + alpha-specific target data struct. + +Mon Apr 14 11:45:46 1997 Ian Lance Taylor + + From Thomas Graichen : + * Makefile.in: Always use $(SHELL) when running move-if-change. + * configure.in: Use ${CONFIG_SHELL} when running $ac_config_sub. + * configure: Rebuild. + +Fri Apr 11 15:43:24 1997 Ian Lance Taylor + + * elfcode.h (elf_slurp_symbol_table): Only subtract the section + VMA if this is an executable file or a shared object. + + * targets.c (netbsd_core_vec): Declare. From Gordon W. Ross + . + + * libaout.h (struct aout_backend_data): Add entry_is_text_address + field. + * aout-target.h (SEGMENT_SIZE): Define to TARGET_PAGE_SIZE at the + start of the file. Remove uses later on which switch using + ifdef. + (MY(callback)): Handle entry_is_text_address. + (MY_entry_is_text_address): Define if not defined. + (MY(backend_data)): Initialize new field. + * aoutf1.h (sunos4_aout_backend): Likewise. + * i386aout.c (MY(backend_data)): Likewise. + * i386mach3.c (MY(backend_data)): Likewise. + * mipsbsd.c (MY(backend_data)): Likewise. + * sparclynx.c (sparclynx_aout_backend): Likewise. + * netbsd.h (SEGMENT_SIZE): Define if not defined. + (MY_entry_is_text_address): Define. + * m68knetbsd.c (SEGMENT_SIZE): Define as 0x20000. + +Fri Apr 11 11:57:15 1997 Niklas Hallqvist + + * config.bfd: (i[3456]86-*-openbsd*, m68*-*-openbsd*, + mips*el*-*-openbsd*, mips*-*-openbsd*, ns32k-*-openbsd*, + powerpc-*-*bsd*, sparc-*-openbsd*): New targets. + * configure.in (i[3456]86-*-openbsd*, mips*-*-openbsd*, + m68*-*-openbsd*, ns32k-*-openbsd*, powerpc-*-*bsd*, + sparc-*-openbsd*): New targets. + * configure: Rebuild. + +Tue Apr 8 18:09:29 1997 Jamie Lokier + + * stabs.c (struct stab_section_info): New field + `cumulative_skips'. + (_bfd_link_section_stabs): Fill the above array. + (_bfd_stab_section_offset): Use `cumulative_skips' to + speed up offset calculation. + +Mon Apr 7 16:47:09 1997 Ian Lance Taylor + + * configure.host: Set SHLIB_LIBS. + * configure.in: Substitute SHLIB_LIBS. + * configure: Rebuild. + * Makefile.in (SHLIB_LIBS): New variable. + ($(SHLIB)): Use $(SHLIB_LIBS). + +Fri Apr 4 11:37:15 1997 Ian Lance Taylor + + * configure.in: Update file names for bfd_elf32_mn10[23]00_vec. + Correct CPU file names for mn10[23]00. + * configure: Rebuild. + + * bfd.c (bfd_record_phdr): Cast count to size_t before + subtraction. + + * ppcboot.c (ppcboot_set_arch_mach): Make static. + (ppcboot_bfd_print_private_bfd_data): Likewise. + +Thu Apr 3 11:51:54 1997 Ian Lance Taylor + + * VERSION: Set to 2.8. + + * elf32-ppc.c (ppc_elf_check_relocs): Don't check SEC_ALLOC when + deciding whether to copy a reloc into a shared object. + (ppc_elf_relocate_section): Likewise. Relocate R_PPC_RELATIVE + relocs in unallocated sections. + * elf32-sparc.c (elf32_sparc_relocate_section): Relocate + R_SPARC_RELATIVE relocs in unallocated sections. + +Wed Apr 2 16:19:41 1997 Mike Meissner + + * elf32-ppc.c (ppc_elf_check_relocs): Undo March 26 change and + always create got section so that the _GLOBAL_OFFSET_TABLE_ label + is always created. + +Wed Apr 2 10:49:07 1997 Ian Lance Taylor + + * elflink.h (elf_link_add_object_symbols): Let a common symbol + override an uninitialized symbol from a shared library with a + smaller size. + + * elf-m10200.c: Rename from elf32-mn10200.c. + * elf-m10300.c: Rename from elf32-mn10300.c. + * cpu-m10200.c: Rename from cpu-mn10200.c + * cpu-m10300.c: Rename from cpu-mn10300.c + * Makefile.in: Update accordingly. + + * elf32-mips.c (elf_mips_ctor64_howto): New static variable. + (elf_mips_isa): Move to earlier in file. + (mips_reloc_map): Remove BFD_RELOC_CTOR entry. + (bfd_elf32_bfd_reloc_type_lookup): Handle BFD_RELOC_CTOR + specially. + + * elf32-mips.c (mips16_jump_reloc): Print a warning rather than + calling abort. + +Tue Apr 1 16:18:05 1997 Klaus Kaempf + + * configure.com: New file. + * config.h-vms: Remove file. + * makefile.vms: Update for new configure scheme. + +Mon Mar 31 23:28:39 1997 H.J. Lu + + * libcoff-in.h (ppc_allocate_toc_section): Declare. + (ppc_process_before_allocation): Declare. + * libcoff.h: Rebuild. + + * coffcode.h (coff_mkobject_hook): Declare if not a macro. + +Mon Mar 31 16:29:50 1997 Joel Sherrill + + * config.bfd (hppa*-*-rtems*): New target, like hppa-*-*elf*. + +Mon Mar 31 16:11:35 1997 Ian Lance Taylor + + * coff-a29k.c (coff_a29k_relocate_section): Don't use symndx as a + symbol index for a R_IHCONST reloc. + +Mon Mar 31 15:40:59 1997 Philippe De Muyter + + * targmatch.sed: Do not use \(\) recursively. + +Fri Mar 28 14:44:08 1997 H.J. Lu + + * m68klinux.c (MACHTYPE_OK): Define. + * i386linux.c (MACHTYPE_OK): Define. + +Fri Mar 28 11:56:15 1997 Ian Lance Taylor + + From David S. Miller and H.J. Lu + : + * sparclinux.c: New file. + * bfd-in.h (bfd_sparclinux_size_dynamic_sections): Declare. + * bfd-in2.h: Rebuild. + * config.bfd (sparc-*-linuxaout*, sparc-*-linux*): New targets. + * configure.in (sparclinux_vec): Add to list of vectors. + * configure: Rebuild. + * targets.c (sparclinux_vec): Declare. + (bfd_target_vector): Add sparclinux_vec. + * Makefile.in: Rebuild dependencies. + (BFD32_BACKENDS): Add sparclinux.o. + (BFD32_BACKENDS_CFILES): Add sparclinux.c. + + * coff-mips.c (mips_ecoff_backend_data): Initialize new + bfd_coff_backend_data field. + * coff-alpha.c (alpha_ecoff_backend_data): Likewise. + + * config.bfd: Add bfd_elf64_{big,little}mips_vec to targ_selvecs + for mips*el*-*-linux* and mips*-*-linux*. From H.J. Lu + and Ralf Baechle . + + * bfd.c: Include "libiberty.h". + (strerror): Don't declare. + (bfd_errmsg): Call xstrerror rather than strerror. + +Thu Mar 27 12:55:42 1997 Ian Lance Taylor + + * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Generate a COPY + reloc even if the symbol is in the .bss section. + * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise. + * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise. + * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise. + + * coffcode.h (bfd_coff_backend_data): Add new field + _bfd_coff_default_section_alignment_power. + (bfd_coff_default_section_alignment_power): Define. + (bfd_coff_std_swap_table): Initialize new field. + * libcoff.h: Rebuild. + * cofflink.c (coff_link_add_symbols): Limit alignment of a common + symbol to the default section alignment. + + * COPYING: Update FSF address. + +Wed Mar 26 14:50:20 1997 Ian Lance Taylor + + * elflink.c (_bfd_elf_create_linker_section): Don't set + bss_section and rel_section from existing sections. + + * elf32-ppc.c (ppc_elf_check_relocs): Only create the got section + if it is needed. + +Tue Mar 25 22:26:56 1997 Stu Grossman (grossman@critters.cygnus.com) + + * aoutx.h (some_aout_object_p): Change executable test to fix + problems with embedded a.out systems. + +Tue Mar 25 14:35:37 1997 Ian Lance Taylor + + * stabs.c (_bfd_stab_section_offset): New function. + * libbfd-in.h (_bfd_stab_section_offset): Declare. + * libbfd.h: Rebuild. + * elf32-i386.c (elf_i386_relocate_section): Adjust the offset of a + stab reloc. + * elf32-m68k.c (elf_m68k_relocate_section): Likewise. + * elf32-mips.c (mips_elf_relocate_section): Likewise. + * elf32-ppc.c (ppc_elf_relocate_section): Likewise. + * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. + * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. + + * stabs.c (_bfd_link_section_stabs): Copy over the first header + symbol. Check for memory allocation failure of *psinfo. + (_bfd_write_section_stabs): Add psinfo parameter. Change all + callers. Set the value of the header symbol. + * libbfd-in.h (_bfd_write_section_stabs): Update declaration. + * libbfd.h: Rebuild. + +Mon Mar 24 13:41:00 1997 Ian Lance Taylor + + * targmatch.sed: Use the hold space to put the #ifdef around the + the string constant. + * targets.c (UNSUPPORTED_TARGET): Don't define. + (find_target): Don't check for UNSUPPORTED_TARGET. + (bfd_set_default_target): Don't try to optimize by checking for + default. + + * Makefile.in: Rebuild dependencies. + (ALL_MACHINES_CFILES): Add cpu-m32r.c. + (BFD32_BACKENDS_CFILES): Add elf32-m32r.c. + (elf32-m32r.o): Remove explicit target. + + * config.bfd: Don't set targ_underscore for i[3456]86-*-gnu* or + i[3456]86-*-linux*. + + * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Don't + count section symbols for sections that were created by the + linker, or are not allocatable or not loadable. + (elf32_sparc_finish_dynamic_sections): Output output section + symbols for section for which we made space for them. + +Fri Mar 21 13:08:26 1997 Ian Lance Taylor + + * elf32-sparc.c (elf32_sparc_size_dynamic_sections): If there is + no .rela.plt section, don't output a DT_PLTGOT dynamic entry. + +Fri Mar 21 12:36:46 1997 Doug Evans + + * elf32-m32r.c (m32r_elf_howto_table): Use special function for LO16. + (m32r_hi16_list): New static local. + (m32r_elf_hi16_reloc): Don't perform reloc, just queue it up. + (m32r_elf_do_hi16_reloc): Delete. + (m32r_elf_relocate_hi16): New function. + (m32r_elf_lo16_reloc): New function. + (m32r_elf_relocate_section): For HI16 relocs, scan for corresponding + LO16 reloc. + + Mon Mar 10 16:03:31 1997 Doug Evans + + * elf32-m32r.c (m32r_elf_create_linker_section): Delete. + (m32r_elf_add_symbol_hook): Rewrite _SDA_BASE_ support. + (m32r_elf_final_sda_base): New function. + (m32r_elf_relocate_section): Rewrite sdata support. + (m32r_elf_finish_dynamic_sections): Delete. + +Thu Mar 20 12:39:02 1997 Ian Lance Taylor + + Based on patches from Philippe De Muyter . + * coff-svm68k.c: New file. Just defines some macros and includes + coff-m68k.c. + * coff-m68k.c: Add functions to handle common addends, moved in + from cf-m68klynx.c. Control them using COFF_COMMON_ADDEND macro. + Control whether relocs are visible using STATIC_RELOCS. + * cf-m68klynx.c: Simplify greatly: just define macros to control + coff-m68k.c. + * coff-aux.c: Likewise. Just leave add_one_symbol routine. + * targets. (m68ksysvcoff_vec): Declare. + (bfd_target_vector): Add m68ksysvcoff_vec. + * config.bfd (m68*-motorola-sysv*): New target. + * configure.in (m68ksysvcoff_vec): New vector. + * configure: Rebuild. + * Makefile.in: Rebuild dependencies. + (BFD32_BACKENDS): Add coff-svm68k.o. + (BFD32_BACKENDS_CFILES): Add coff-svm68k.c. + + * binary.c (binary_set_section_contents): Don't get misled if the + first section is not loadable. From Matthew L. Martin + . + + * elflink.h (elf_bfd_final_link): Set the value of a section + symbol to the section address unless doing a relocateable link. + +Tue Mar 18 23:03:17 1997 Richard Henderson + + * elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Don't create + .plt entry if we've taken the function's address. + (elf64_alpha_merge_gots): Merge collected flags info as well. + +Tue Mar 18 22:40:09 1997 H.J. Lu + + * Many files: Add function prototypes. + * cpu-m68k.c (bfd_default_scan_num_mach): Don't declare. + * ecofflink.c: Include "libcoff.h" and "libecoff.h". + * elf32-ppc.c (ppc_elf_fake_sections): Make static. + * opncls.c (bfd_openstreamr): Change stream parameter to PTR. + * peicode.h: Change several void * parameters to PTR. + * srec.c (srec_get_symbol_info): Make static. + * syms.c (bfd_symbol_is_absolute): Remove. + * Makefile.in: Rebuild dependencies. + +Tue Mar 18 12:58:08 1997 Ian Lance Taylor + + * elf32-m32r.c (m32r_elf_is_local_label_name): Remove. + (bfd_elf32_bfd_is_local_label): Don't define. + + * xcofflink.c (_bfd_xcoff_bfd_final_link): Call bfd_malloc rather + than malloc. + +Mon Mar 17 11:32:53 1997 Ian Lance Taylor + + * bfd-in.h: Don't include obstack.h. + (struct bfd_hash_table): Change memory field to PTR. + * bfd.c (struct _bfd): Change memory field to PTR. + * bfd-in2.h: Rebuild. + * libbfd-in.h (bfd_release): Declare as function, don't define as + macro. + * libbfd.h: Rebuild. + * opncls.c: Include "objalloc.h" rather than "obstack.h". Use + objalloc routines rather than obstack routines. + (obstack_chunk_alloc, obstack_chunk_free): Don't define. + (getpagesize): Don't define. + (_bfd_new_bfd): Don't set _bfd_chunksize. + (bfd_openr): Free new bfd and objalloc on failure. + (bfd_fdopenr, bfd_openstreamr, bfd_openw): Likewise. + (bfd_alloc_size): Remove. + (bfd_release): New function. + * hash.c: Include "objalloc.h" rather than "obstack.h". Use + objalloc routines rather than obstack routines. + (obstack_chunk_alloc, obstack_chunk_free): Don't define. + * ecofflink.c: Include "objalloc.h" rather than "obstack.h". Use + objalloc routines rather than obstack routines. + (obstack_chunk_alloc, obstack_chunk_free): Don't define. + (struct accumulate): Change memory to struct objalloc *. + * liboasys.h (oasys_data_type): Remove oasys_obstack field. + * dep-in.sed: Don't remove obstack.h from dependency list. + * Makefile.in: Rebuild dependencies. + (BFD_H_DEPS): Remove obstack.h. + (install): Don't install obstack.h. + * Many files: Don't include "obstack.h". + * VERSION: Bump. + + * opncls.c (bfd_alloc_grow, bfd_alloc_finish): Remove. + * libbfd-in.h (bfd_alloc_grow, bfd_alloc_finish): Don't declare. + * libbfd.h: Rebuild. + * ieee.c (ieee_archive_p): Rewrite to not use bfd_alloc_grow. + * sunos.c (sunos_add_dynamic_symbols): Likewise. + * srec.c (srec_scan): Rewrite to not use obstack_1grow. + + * opncls.c (bfd_alloc): Rename from bfd_alloc_by_size_t. Remove + old version of bfd_alloc. + * libbfd-in.h (bfd_alloc_by_size_t): Don't declare. + * libbfd.h: Rebuild. + * Several files: Call bfd_alloc rather than bfd_alloc_by_size_t. + +Sat Mar 15 15:24:18 1997 Ian Lance Taylor + + * elf32-mips.c (mips_elf_is_local_label_name): Accept the generic + ELF local label syntax as well. + +Sat Mar 15 10:16:42 1997 Fred Fish + + * config.bfd (powerpc-*-beos*): New target. + * configure.in (powerpc-*-beos*): Add case that explicitly + does not set COREFILE for now. A future BeOS version is + expected to support core files. + * configure: Regenerate with autoconf. + +Fri Mar 14 16:43:22 1997 Ian Lance Taylor + + * elf32-mips.c (mips_elf_check_relocs): Give an error if CALL16 is + seen with a local symbol, rather than crashing. + + * elfcode.h (elf_slurp_symbol_table): Don't try to read the + version symbols if there aren't any. + +Thu Mar 13 14:08:53 1997 Ian Lance Taylor + + * elflink.h (elf_link_add_object_symbols): Don't warn about type + or size changes because of a weak symbol. + + * cisco-core.c (SIGEMT): Define if not defined. + +Wed Mar 12 21:36:05 1997 Ian Lance Taylor + + * elflink.h (elf_link_add_object_symbols): Use extsymoff when + setting ever. Sanity check the version number. Sort out copying + flags and other information when adding an indirect symbol. + (NAME(bfd_elf,size_dynamic_sections)): Preserve any dynamic + symbols added by the backend. Clear the entire contents of the + versym section. + (elf_export_symbol): Ignore indirect symbols. + (elf_link_output_extsym): Accept a section without an owner in an + assert. + * elfcode.h (elf_slurp_symbol_table): Add a sanity check on the + version count. Correct the allocation of x_versymp. + + * elf32-mips.c (mips_elf_add_symbol_hook): Don't set the owner of + the magic sections used for SHN_MIPS_TEXT and SHN_MIPS_DATA. + Don't return bfd_und_section_ptr when info->shared. + (mips_elf_final_link): Set the alignment of .rtproc to 4, not 12. + (mips_elf_create_dynamic_sections): Correct type: ^= for &=. + (mips_elf_check_relocs): Resolve an indirect symbol in + sym_hashes. + (mips_elf_finish_dynamic_symbol): Don't change SHN_ABS into + SHN_MIPS_TEXT or SHN_MIPS_DATA. + + * elf.c (bfd_elf_print_symbol): Tweak version output slightly. + +Tue Mar 11 01:38:36 1997 Ian Lance Taylor + + From Eric Youngdale : + * elf-bfd.h (ELF_LINK_FORCED_LOCAL): Define. + * elf.c (bfd_elf_print_symbol): Correct errors in last change. + * elflink.h (elf_link_add_object_symbols): Handle cases in which a + versioned symbol appears in both a regular and a shared object. + (elf_link_assign_sym_version): Set ELF_LINK_FORCED_LOCAL when + appropriate. Improve error message. + (struct elf_outext_info): Rename from elf_finfo_failed. Change + all uses. Add localsyms field. + (elf_bfd_final_link): When generating a shared library, call + elf_link_output_extsym to output all local symbols. + (elf_link_output_extsym): Handle symbols which were forced to + become local. + +Sun Mar 9 23:08:49 1997 Ian Lance Taylor + + From Eric Youngdale : + * elf-bfd.h (elf_symbol_type): Add version field. + * elfcode.h (elf_slurp_symbol_table): Set version field. + * elflink.h (elf_link_add_object_symbols): When creating an + indirect symbol for a default version symbol, set DEF_DYNAMIC if + appropriate. Set up an indirection from the nondefault version of + the symbol as well. + (NAME(bfd_elf,size_dynamic_sections)): Call + elf_link_assign_sym_version before checking whether there are any + versions. Always record the version name as a dynamic symbol. + Initialize counters. + (elf_link_assign_sym_version): After finding a version, see if a + symbol should be forced to local scope. Create a new version + definition if appropriate. + (elf_link_output_extsym): Correct indirect symbol handling. + * elf.c (bfd_elf_print_symbol): Print version information. + (bfd_section_from_shdr): Turn version sections into BFD sections. + (elf_fake_sections): Only copy cverdefs and cverrefs into sh_info + if sh_info is not already set. + (_bfd_elf_copy_private_section_data): Copy sh_info for version + sections. + * elflink.c (_bfd_elf_link_record_dynamic_symbol): Tell + _bfd_stringtab_add to copy the name into permanent memory if + appropriate. + +Fri Mar 7 11:55:31 1997 H.J. Lu + + * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Fully parenthesize. + +Fri Mar 7 10:37:30 1997 Ian Lance Taylor + + * coffcode.h (bfd_coff_backend_data): Change + _bfd_coff_compute_section_file_positions to return a boolean + value. Change all callers. + (coff_compute_section_file_positions): Change return type to + boolean. If the size of the last section changed, then output a + zero byte at the end of the file. + * libcoff.h: Rebuild. + + * xcofflink.c (_bfd_xcoff_bfd_final_link): Always allocate space + for at least 6 output symbols. + (xcoff_write_global_symbol): When emitting TOC entry relocs, also + emit a TC csect to represent the space they take up. For an XO + symbol, just emit a reference, not a csect. + + * Makefile.in ($(SHLINK)): Just use ln -s, not ln -sf, since + Solaris doesn't like the combined options, and the -f is + unnecessary. + (stamp-tshlink, install): Likewise. + + * elf32-mips.c (mips_elf_relocate_section): Correct R_MIPS16_26 + handling when little endian. + +Thu Mar 6 13:51:51 1997 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10300.c (mn10300_elf_final_link_relocate): New function. + (mn10300_elf_relocate_section): Likewise. + (elf_backend_relocate_section): Define. + + * elf32-mn10300.c (reloc_type): Remove PCREL{8,16,32}_{1,2}BYTE + relocs. Replace them with generic PCREL_{8,16,32} relocs. + (elf32_mn10300_howto_table): Likewise. + (elf32_mn10300_reloc_map): Likewise. + (bfd_elf32_mn10300_reloc): Delete unused function. + +Thu Mar 6 12:19:59 1997 Fred Fish + + * coffcode.h (coff_slurp_reloc_table): Pull duplicate declarations and + code fragment out of both legs of #ifdef RELOC_PROCESSING ... #endif + block. Use NULL for initializations of "ptr" rather than bare 0. + * coff-h8300.c: Fix typo in comment. + * coff-h8500.c: Ditto. + * coff-w65.c: Ditto + * coff-z8k.c: Ditto. + +Wed Mar 5 13:59:09 1997 Doug Evans + + * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc): Fix overflow calc. + (m32r_elf_relax_section, m32r_elf_relax_delete_bytes, + m32r_elf_get_relocated_section_contents): First pass at relax support. + +Mon Mar 3 13:27:09 1997 Ulrich Drepper + + * elflink.h (elf_link_add_object_symbols): Use correct sh_size + entry for reading verdef records. + Use correct braces for computing increments of extverdaux and + exteverdef record pointers. + +Sun Mar 2 16:25:35 1997 Ian Lance Taylor + + * elflink.h (elf_link_find_version_dependencies): Check that + DEF_REGULAR is not set as well as checking that DEF_DYNAMIC is + set. + +Fri Feb 28 15:06:45 1997 Ian Lance Taylor + + * targets.c (bfd_default_vector): Make non-const. + (find_target): New static function, broken out of + bfd_find_target. + (bfd_set_default_target): New function. + (bfd_find_target): Call find_target. When defaulting, use + bfd_default_vector[0] if it is not NULL. + * libbfd-in.h (bfd_default_vector): Adjust declaration. + * bfd-in2.h, libbfd.h: Rebuild. + + * syms.c (bfd_is_local_label): Return false if the symbol has no + name. + * coff-i960.c (coff_i960_is_local_label_name): New function. + (coff_bfd_is_local_label_name): Define. + * coff-m68k.c (m68k_coff_is_local_label_name): New function. + (coff_bfd_is_local_label_name): Define. + * coff-rs6000.c (xcoff_is_local_label_name): New function. + (coff_bfd_is_local_label_name): Define. + * elf.c (_bfd_elf_is_local_label_name): Treat symbols beginning + with .. or _.L_ as local. + * elf32-i386.c (elf_i386_is_local_label_name): New function. + (bfd_elf32_bfd_is_local_label_name): Define. + * evax-alpha.c (evax_bfd_is_local_label_name): Treat symbols + beginning with $ as local. + +Thu Feb 27 18:36:23 1997 Ian Lance Taylor + + * aoutx.h (aout_link_write_symbols): Use bfd_is_local_label_name + rather than comparing against info->lprefix. + * cofflink.c (_bfd_coff_link_input_bfd): Likewise. + * elflink.h (elf_link_input_bfd): Likewise. + * linker.c (_bfd_generic_link_output_symbols): Likewise. + * xcofflink.c (xcoff_link_input_bfd): Likewise. + + * elfxx-target.h (bfd_elfNN_bfd_is_local_label_name): Define as + _bfd_elf_is_local_label_name if not already defined. + * elf.c (_bfd_elf_is_local_label_name): New function. + * elf-bfd.h (_bfd_elf_is_local_label_name): Declare. + + * coff-m88k.c (coff_bfd_is_local_label_name): Define. + (m88k_is_local_label_name): New static function. + + * coffcode.h (coff_bfd_is_local_label_name): Define as + _bfd_coff_is_local_label_name if not already defined. + * coffgen.c (_bfd_coff_is_local_label_name): New function. + * libcoff-in.h (_bfd_coff_is_local_label_name): Declare. + * libcoff.h: Rebuild. + + * targets.c (BFD_JUMP_TABLE_SYMBOLS): Change _bfd_is_local_label + to _bfd_is_local_label_name. + (bfd_target): Likewise. + * syms.c (bfd_is_local_label): Define as function, not macro. + (bfd_is_local_name): Define. + * libbfd.c (bfd_generic_is_local_label_name): Rename from + bfd_generic_is_local_label, and take a string rather than a + symbol. + * libbfd-in.h (_bfd_nosymbols_bfd_is_local_label): Don't define. + (_bfd_nosymbols_bfd_is_local_label_name): Define. + (bfd_generic_is_local_label): Don't declare. + (bfd_generic_is_local_label_name): Declare. + * bfd-in2.h, libbfd.h: Rebuild. + * All backends: Change local_label to local_label_name. + + * elf32-mips.c (struct mips_got_info): Add assigned_gotno field. + (mips_elf_relocate_got_local): Change return type to boolean. + Don't assume that the first zero entry is unassigned; instead, use + assigned_gotno. + (mips_elf_relocate_section): Check return value of + mips_elf_relocate_got_local. + (mips_elf_create_got_section): Initialize assigned_gotno field. + +Wed Feb 26 13:33:03 1997 Ian Lance Taylor + + * elflink.h (elf_link_input_bfd): Don't skip symbols from sections + that have no contents merely because linker_mark is not set. + +Tue Feb 25 18:51:35 1997 Stan Shebs + + * config.bfd (mips*-*-lnews*): New target. + * coff-mips.c (mips_relocate_section): Make assert compare + content byteorder instead of header byteorder. + (ecoff_biglittle_vec): New BFD, big-endian headers, little-endian + data. + * targets.c (bfd_target_vector): Add ecoff_biglittle_vec. + * configure.in (ecoff_biglittle_vec): Add case. + * configure: Update. + +Tue Feb 25 00:32:49 1997 Ian Lance Taylor + + * elf.c (elf_fake_sections): Use SHT_NOTE for any section whose + name begins with ".note". + (map_sections_to_segments): Add a PT_NOTE segment for any loadable + section whose name begins with ".note". + (get_program_header_size): Corresponding change. + + * elf32-mips.c (mips_elf_relocate_section): Check for misaligned + jal and for jal overflow. + +Mon Feb 24 17:53:14 1997 Ian Lance Taylor + + From Eric Youngdale : + * elflink.h (elf_link_add_archive_symbols): If a default symbol is + not found, try looking it up again without the version name. + (elf_link_add_object_symbols): Always link against the dynamic + symbol table of a dynamic object. When linking against a dynamic + object, include version strings in symbol names, and set up + version information. Add indirect symbols for default versions. + (elf_link_create_dynamic_sections): Add special version sections. + (struct elf_assign_sym_version_info): Define. + (struct elf_find_verdep_info): Define. + (NAME(bfd_elf,size_dynamic_sections)): Add verdefs parameter. Set + up version sections. + (elf_adjust_dynamic_symbol): Ignore indirect symbols. + (elf_link_find_version_dependencies): New static function. + (elf_link_assign_sym_version): New static function. + (elf_link_renumber_dynsyms): New static function. + (struct elf_final_link_info): Add symver_sec field. + (elf_bfd_final_link): Initialize finfo.symver_sec. Don't count + local symbols of a dynamic object. Handle DT_VER* constants. + (elf_link_output_extsym): Simplify BFD_ASSERT checking for a + dynamic object. Skip indirect symbols from ELF objects. Remove + the version name before choosing a hash bucket. Write out the + version information if appropriate. + (elf_link_input_bfd): Check for DYNAMIC, not ET_DYN. + * bfd-in.h (bfd_elf32_size_dynamic_sections): Update declaration. + (bfd_elf64_size_dynamic_sections): Likewise. + * bfd-in2.h: Rebuild. + * elf-bfd.h (struct elf_link_hash_entry): Add verinfo field. + Change elf_link_hash_flags to unsigned short. + (ELF_LINK_HIDDEN): Define. + (struct elf_obj_tdata): Add fields dynversym_hdr, dynverref_hdr, + dynverdef_hdr, dynversym_section, dynverdef_section, + dynverref_section, cverdefs, cverrefs, verdef, verref. + (elf_dynversym, elf_dynverdef, elf_dynverref): Define. + (_bfd_elf_swap_verdef_in, _bfd_elf_swap_verdef_out): Declare. + (_bfd_elf_swap_verdaux_in, _bfd_elf_swap_verdaux_out): Declare. + (_bfd_elf_swap_verneed_in, _bfd_elf_swap_verneed_out): Declare. + (_bfd_elf_swap_vernaux_in, _bfd_elf_swap_vernaux_out): Declare. + (_bfd_elf_swap_versym_in, _bfd_elf_swap_versym_out): Declare. + (_bfd_elf_slurp_version_tables): Declare. + * elf.c (_bfd_elf_swap_verdef_in): New function. + (_bfd_elf_swap_verdef_out): Likewise. + (_bfd_elf_swap_verdaux_in, _bfd_elf_swap_verdaux_out): Likewise. + (_bfd_elf_swap_verneed_in, _bfd_elf_swap_verneed_out): Likewise. + (_bfd_elf_swap_vernaux_in, _bfd_elf_swap_vernaux_out): Likewise. + (_bfd_elf_swap_versym_in, _bfd_elf_swap_versym_out): Likewise. + (_bfd_elf_print_private_bfd_data): Add DT_VER* constants. Print + version information if there is any. + (_bfd_elf_link_hash_newfunc): Initialize verinfo field. + (bfd_section_from_shdr): Handle SHT_GNU_ver* section types. + (elf_fake_sections): Handle .gnu.version* section names. + (assign_section_numbers): Handle SHT_GNU_ver* section types. + (_bfd_elf_slurp_version_tables): New function. + * elflink.c (_bfd_elf_link_record_dynamic_symbol): Don't include + version name in string entered in dynamic hash table. + * elfcode.h: Include fnmatch.h. + * elf32-i386.c (elf_i386_relocate_section): Handle a dynamic + symbol which was forced to become local. + * elf32-m68k.c (elf_m68k_relocate_section): Likewise. + * elf32-ppc.c (ppc_elf_relocate_section): Likewise. + * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. + * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Likewise. + +Fri Feb 21 16:15:18 1997 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10200.c (mn10200_elf_final_link_relocate): Simplify + somewhat. + (mn10200_elf_relax_section): Correctly compute a symbol's value + when the symbol is local, but not in the same section as we are + relaxing. Implement abs24 -> abs16, imm24 -> imm16 and d24 -> d16 + relaxing. + +Fri Feb 21 13:55:14 1997 Doug Evans + + * elf32-m32r.c: Rewrite to use ELF backend linker. + Store lower 16 bits of addend in R_M32R_HI16_[SU]LO insns. + Add small data area support (R_M32R_SDA16). + * reloc.c: Document BFD_RELOC_M32R_SDA16. + * bfd-in2.h,libbfd.h: Regenerated. + +Thu Feb 20 23:50:31 1997 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10200.c (mn10200_elf_relax_section): New function. + (mn10200_elf_relax_delete_bytes): Likewise. + (mn10200_elf_symbol_address_p): Likewise. + (mn10200_elf_get_relocated_section_contents): Likewise. + (bfd_elf32_bfd_relax_section): Define. + (bfd_elf32_bfd_get_relocated_section_contents): Likewise. + + * elf32-mn10200.c (mn10200_elf_final_link_relocate): New function. + (mn10200_elf_relocate_section): Likewise. + (elf_backend_relocate_section): Define. + +Tue Feb 18 15:31:48 1997 Fred Fish + + * reloc.c (struct reloc_howto_struct): Fix typo in comment. + * bfd-in2.h: Regenerated. + +Tue Feb 18 11:41:00 1996 Dawn Perchik + + * sysdep.h: Don't define errno in MSVC if error.h is included. + +Mon Feb 17 11:28:40 1997 Ian Lance Taylor + + * hp300hpux.c (convert_sym_type): Don't convert a secondary common + symbol into a weak undefined symbol; leave it as a common symbol. + +Fri Feb 14 19:08:03 1997 Ian Lance Taylor + + * elflink.h (elf_link_add_object_symbols): Don't issue a warning + about a symbol defined in a dynamic object if it has already been + defined in a regular object. + +Thu Feb 13 20:53:22 1997 Klaus Kaempf (kkaempf@progis.de) + + * makefile.vms: Add gcc flags to allow compiling with current gcc + snapshot + (targmatch.h): New dependency. + + * reloc.c (BFD_RELOC_ALPHA_CODEADDR): New relocation for + openVMS/Alpha. + * evax.h (ALPHA_R_CODEADDR): New relocation. + * evax-alpha.c (ALPHA_R_CODEADDR): 64 bit procedure relocation for + openVMS/Alpha. + * evax-etir.c (ALPHA_R_CODEADDR): Output object code for this + relocation. + * bfd-in2.h, libbfd.h: Rebuild. + + Restrict symbol length to 64 bytes, case preserving: + * evax-emh.c (_bfd_evax_write_emh): Remove case hacking. + * evax-misc.c (_bfd_evax_case_hack_symbol): Remove. + (_bfd_evax_length_hash_symbol): Added. + * evax-etir.c (_bfd_evax_write_etir): Call + _bfd_evax_length_hash_symbol before output of symbol. + * evax-egsd.c (_bfd_evax_write_egsd): Likewise. + * evax.h (flag_hash_long_names, flag_show_after_trunc): Remove. + + * evax-emh.c: Output filename to object file without path. + + * evax-egsd.c: New sections for local and global commons. + + * evax-alpha.c, evax-emh.c, evax-egsd.c, evax-etir.c, + evax-misc.c, evax.h: Remove 8 bit characters from copyright + notices. Replace AXP with Alpha. + +Wed Feb 12 18:10:30 1997 Ian Lance Taylor + + * sunos.c (sunos_create_dynamic_sections): We need the dynamic + sections if we are creating a shared library. + +Tue Feb 11 15:45:43 1997 Doug Evans + + * configure.host (i386-windows): Don't set host64=true. + +Tue Feb 11 15:27:32 1997 Ian Lance Taylor + + * elf32-mips.c (reloc_type): Add R_MIPS16_GPREL. + (elf_mips16_gprel_howto): New static variable. + (mips16_gprel_reloc): New static function. + (bfd_elf32_bfd_reloc_type_lookup): Handle BFD_RELOC_MIPS16_GPREL. + (mips_info_to_howto_rel): Handle R_MIPS16_GPREL. + (mips_elf_relocate_section): Handle R_MIPS16_GPREL. + * reloc.c (BFD_RELOC_MIPS16_GPREL): Define. + * bfd-in2.h, libbfd.h: Rebuild. + +Mon Feb 10 23:25:00 1997 Doug Evans + + * elf32-m32r.c (elf_m32r_howto_table): Change partial_inplace to true + for R_M32R_{16,32,24,HI16_ULO,HI16_SLO,LO16}. + +Fri Feb 7 12:39:11 1997 Ian Lance Taylor + + * elflink.h (elf_link_input_bfd): If we've discarded a section, + the output section will be the absolute section; don't print an + assertion message for that case when doing a relocateable link. + +Thu Feb 6 16:55:43 1997 Ian Lance Taylor + + * elf32-mips.c (FN_STUB, CALL_STUB, CALL_FP_STUB): Define. + (struct mips_elf_link_hash_entry): Add new fields fn_stub, + need_fn_sub, call_stub, and call_fp_stub. + (struct mips_elf_link_hash_table): Add field mips16_stubs_seen. + (mips_elf_link_hash_newfunc): Initialize new fields. + (mips_elf_link_hash_table_create): Likewise. + (mips_elf_relocate_section): Redirect relocations to use mips16 + stubs when appropriate. + (mips_elf_check_relocs): Attach stub sections to the appropriate + symbol. Set need_fn_stub when appropriate. + (mips_elf_always_size_sections): New static function. + (mips_elf_check_mips16_stubs): New static function. + (elf_backend_always_size_sections): Define. + * elf-bfd.h (struct elf_obj_tdata): Add local_stubs field. + + * elflink.h (elf_link_input_bfd): Discard local symbols that are + attached to sections which are not being included in the link. + +Wed Feb 5 13:20:17 1997 Ian Lance Taylor + + * cofflink.c (_bfd_coff_generic_relocate_section): Ignore the + symbol value when computing the addend for a pc_relative + pcrel_offset reloc. + +Mon Feb 3 11:54:06 1997 Ian Lance Taylor + + * cofflink.c (_bfd_coff_generic_relocate_section): If doing a + relocateable link, just skip pc_relative pcrel_offset relocs. + * coff-arm.c (coff_arm_rtype_to_howto): Return a different howto + structure for an ARM26 reloc which can be resolved. + (coff_arm_adjust_symndx): Only convert ARM26 to ARM26D if the + reloc can be resolved. + + * coff-h8300.c (h8300_reloc16_extra_cases): Correct off by one + error in overflow check for R_RELBYTE. + +Fri Jan 31 14:07:27 1997 Ian Lance Taylor + + * ieee.c (ieee_slurp_section_data): Pick up the start address. + From Mark Rasin . + + * aoutx.h (aout_link_write_symbols): Don't apply discard_l to + debugging symbols. + +Wed Jan 29 00:00:49 1997 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10200.c (reloc_type): Add 16bit pc-relative reloc. + (elf_mn10200_howto_table): Likewise. + (mn10200_reloc_map): Likewise. + +Mon Jan 27 12:07:35 1997 Doug Evans + + * reloc.c: Add relocs BFD_RELOC_M32R_{HI16_[US]LO,LO16}. + * bfd-in2.h, libbfd.h: Regenerated. + * elf32-m32r.c: Add support for them. + +Mon Jan 27 12:25:02 1997 Ian Lance Taylor + + * aout-arm.c (MY_swap_std_reloc_in): Remove unused r_length. + * elf32-ppc.c (ppc_elf_check_relocs): Remove unused plt. + * riscix.c (MY_final_link_callback): Define to dummy value. + + * elf32-i386.c (elf_i386_size_dynamic_sections): When checking for + relocations against the text segment, look up the output name of + the reloc section. + * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise. + * elf32-mips.c (mips_elf_size_dynamic_sections): Likewise. + * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise. + * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise. + * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise. + +Thu Jan 16 17:45:57 1997 Ian Lance Taylor + + * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Change type of + auxiliary_filters parameter to be const char * const *. Accept a + NULL terminated array. + * bfd-in.h (bfd_elf32_size_dynamic_sections): Update declaration. + (bfd_elf32_size_dynamic_sections): Update declaration. + * bfd-in2.h: Rebuild. + +Wed Jan 15 11:21:32 1997 Ian Lance Taylor + + * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Treat a + NOTYPE symbol in a text section as a FUNC symbol. + + * coffcode.h (coff_compute_section_file_positions): Force + relocbase to be aligned to COFF_DEFAULT_SECTION_ALIGNMENT_POWER. + +Tue Jan 14 08:46:33 1997 Doug Evans + + * libaout.h (machine_type): Reserve several values for sparclet. + +Mon Jan 6 13:28:35 1997 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10200.c (elf_mn10200_howto): Don't ever set partial-inplace. + Use bfd_elf_generic_reloc as special function for all relocs. + (bfd_elf32_mn10200_reloc): Remove unnecessary function. + + * elf32-mn10200.c (elf_mn10200_howto): Set pcrel_offset for + 24bit pc-relative reloc. + +Fri Jan 3 16:54:08 1997 Jeffrey A Law (law@cygnus.com) + + * reloc.c: Add BFD_RELOC_24. + * elf32-mn10200.c (enum reloc_type): Add 24bit and pcrel relocs. + (elf_mn10200_howto, mn10200_reloc_map): Corresponding changes. + * bfd-in2.h, libbfd.h: Rebuilt. + +Fri Jan 3 16:58:31 1997 Richard Henderson + + elf64-alpha multiple .got rewrite: + + * elf-bfd.h (struct elf_backend_data): Add always_size_sections entry. + (bfd_elf*_mkobject): Don't define here ... + * elfxx-target.h: ... but rather here. Default always_size_sections + hook to NULL. + * elf.c (elf_mkobject): Rename to bfd_elf_mkobject, since that was + what the #defines in elf-bfd.h transmuted it to anyway. + + * section.c: Add SEC_LINKER_CREATED flag. + * bfd-in2.h: Rebuild. + * elf32-i386.c (elf_i386_check_relocs): Add SEC_LINKER_CREATED to + relocation section flags. + (elf_i386_size_dynamic_sections): Use SEC_LINKER_CREATED instead of + SEC_IN_MEMORY to recognize generated bits. + * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_size_dynamic_sections): + Likewise. + * elf32-mips.c (mips_elf_final_link, mips_elf_create_dynamic_sections, + mips_elf_create_compact_rel_section, mips_elf_create_got_section, + mips_elf_check_relocs, mips_elf_size_dynamic_sections): Likewise. + * elf32-ppc.c (ppc_elf_create_linker_section, + ppc_elf_size_dynamic_sections): Likewise. + * elf32-sparc.c (elf32_sparc_check_relocs, + elf32_sparc_size_dynamic_sections): Likewise. + * elflink.c (_bfd_elf_create_got_section): Add SEC_LINKER_CREATED to + section flags. + (_bfd_elf_create_dynamic_sections): Likewise. + (_bfd_elf_make_linker_section_rela): Likewise. + * elflink.h (elf_link_create_dynamic_sections): Likewise. + (bfd_elf,size_dynamic_sections): Call the always_size_sections hook. + (elf_bfd_final_link): Use SEC_LINKER_CREATED instead of SEC_IN_MEMORY + to identify generated bits. + (elf_link_input_bfd): Likewise. + + * elf64-alpha.c: Rewrite everything touching relocations. + +Tue Dec 31 14:44:50 1996 Ian Lance Taylor + + * config.bfd (mips*el-*-linux*): New target. + (mips*-*-linux*): New target. + + * elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Clean up. + Return a useful value. + + * Makefile.in (ALL_CFLAGS): Add -D_GNU_SOURCE. + + * configure.in: Check ac_cv_func_mmap_fixed_mapped, not + ac_cv_func_mmap. + * configure: Rebuild. + * configure.host: Use ac_cv_func_mmap_fixed_mapped instead of + ac_cv_func_mmap in bfd/configure.host. + + * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Add + filter_shlib and auxiliary_filter_shlib parameters. + * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_AUXILIARY and + DT_FILTER. + * bfd-in.h (bfd_elf32_size_dynamic_sections): Update declaration. + (bfd_elf64_size_dynamic_sections): Likewise. + * bfd-in2.h: Rebuild. + +Mon Dec 30 18:48:52 1996 Ian Lance Taylor + + * xcofflink.c (xcoff_build_ldsyms): When exporting all defined + symbols, don't export a symbol which is defined by an object in an + archive which contains shared objects. + +Mon Dec 30 11:54:56 1996 Ian Lance Taylor + + * libbfd.c: Patch up the mmap code so that it is only built if BFD + is configured with --with-mmap. + +Fri Dec 27 20:56:41 1996 Fred Fish + + * TODO: Correct a misspelling. + +Fri Dec 27 11:48:12 1996 H.J. Lu + + * elflink.h (elf_buckets): Add some more values for larger + binaries. + +Thu Dec 26 18:36:54 1996 Ian Lance Taylor + + * Makefile.in (install): Move subdir_do out of conditional. From + Fred Fish . + +Wed Dec 18 10:04:30 1996 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10200.c (enum reloc_type): Enable basic 8, 16, and + 32 bit relocs. + (elf_mn10200_howto_table): Likewise. + (mn10200_reloc_map): Likewise. + +Tue Dec 17 11:09:36 1996 Ian Lance Taylor + + * elf32-mips.c (mips_elf_add_symbol_hook): Add 1 to the value of a + mips16 symbol during the link. + (mips_elf_finish_dynamic_symbol): Subtract 1 from the value of a + mips16 symbol. + (mips_elf_link_output_symbol_hook): New static function. + (elf_backend_link_output_symbol_hook): Define. + + * elf.c (bfd_elf_print_symbol): Print the st_other field if it is + not zero. + +Mon Dec 16 14:38:39 1996 Ian Lance Taylor + + * elf.c (bfd_section_from_shdr): Don't check for reloc sections + against SEC_DEBUGGING sections here (revert patch of December 5). + * elfcode.h (elf_object_p): Check for them here, instead. + +Sun Dec 15 14:46:06 1996 Ian Lance Taylor + + * elfcode.h (elf_slurp_reloc_table): Add dynamic parameter. + * elf.c (_bfd_elf_canonicalize_reloc): Pass new argument to + slurp_reloc_table. + (_bfd_elf_get_dynamic_reloc_upper_bound): New function. + (_bfd_elf_canonicalize_dynamic_reloc): New function. + * elf-bfd.h (struct elf_size_info): Update declaration of + slurp_reloc_table. + (_bfd_elf_get_dynamic_reloc_upper_bound): Declare. + (_bfd_elf_canonicalize_dynamic_reloc): Declare. + * elfxx-target.h: Use new dynamic reloc routines by default. + * elf64-mips.c (mips_elf64_slurp_reloc_table): Add dynamic + parameter. + +Fri Dec 13 13:18:49 1996 Dan Wilder + + * coffcode.h (coff_set_flags): Use MC68KBCSMAGIC for bfd_arch_m68k + if NAMES_HAVE_UNDERSCORE is defined. + +Fri Dec 13 11:13:23 1996 Doug Evans + + * libaout.h (enum machine_type): Change M_SPARCLET from 142 to 131. + +Thu Dec 12 15:07:20 1996 Michael Meissner + + * elf32-ppc.c (ppc_elf_check_relocs): Move R_PPC_PLTREL24 into the + supported relocs. + +Thu Dec 12 14:55:41 1996 Ian Lance Taylor + + * elflink.h (elf_link_add_object_symbols): Only add a weak + symbol if the real definition is in the dynamic symbol table. + After finding the real definition, then, if it is dynamic, add the + weak symbol to the dynamic symbol table. + + * coff-aux.c (coff_m68k_aux_link_add_one_symbol): Make static. + + * ppcboot.c (ppcboot_set_arch_mach): Don't define; it's a + function. + (ppcboot_bfd_print_private_bfd_data): Don't take the address of an + array. + +Tue Dec 10 23:23:52 1996 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10300.c (reloc_type): Remove big endian mn10300 reloc + variants. + (elf32_mn10300_howto_table, mn10300_reloc_map): Likewise. + (bfd_elf32_mn10300_reloc): Write data in little endian format. + * reloc.c: Remove mn10300 big endian relocs. + * bfd-in2.h, libbfd.h: Rebuilt. + + * elf32-mn10200.c: Update from elf32-mn10300.c. + +Fri Dec 6 15:18:05 1996 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10300.c (elf_symbol_leading_char): Define. + + * elf32-mn10300.c: Add some comments. + +Fri Dec 6 17:16:43 1996 Ian Lance Taylor + + * ihex.c (ihex_scan): Always initialize buf before jumping to + error_return. + (ihex_read_section): Likewise. + +Thu Dec 5 22:29:18 1996 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10300.c (elf_mn10300_howto_table): Don't set partial- + inplace for most relocs. + +Thu Dec 5 13:24:46 1996 Ian Lance Taylor + + * elflink.h (elf_link_add_object_symbols): Calling check_relocs + even if SEC_ALLOC is not set. + * elf32-i386.c (elf_i386_check_relocs): Don't check SEC_ALLOC + when deciding whether to copy a reloc into a shared object. + (elf_i386_relocate_section): Likewise. + * elf32-sparc.c (elf32_sparc_check_relocs): Likewise. + (elf32_sparc_relocate_section): Likewise. + * elf32-i386.c (elf_i386_check_relocs): Don't set SEC_ALLOC in a + reloc section if it is not set in the source section. + * elf32-sparc.c (elf32_sparc_check_relocs): Likewise. + * elf.c (bfd_section_from_shdr): Mark a reloc section associated + with a SEC_DEBUGGING section as SEC_DEBUGGING. + +Wed Dec 4 14:18:13 1996 Michael Meissner + + * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): #if 0 code that + expects a .got.plt until we actually create it. + +Mon Dec 2 12:13:51 1996 Ian Lance Taylor + + * cofflink.c (_bfd_coff_generic_relocate_section): Print an error + message for bfd_reloc_outofrange, rather than aborting. From + Philippe De Muyter . + + * cofflink.c (_bfd_coff_final_link): If there aren't any relocs in + a relocateable link, don't try to process them. From Heinz Wrobel + . + +Mon Dec 2 00:39:24 1996 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10300.c (mn10300_info_howto): Renamed from + mn10300_info_howto_rel. Tweak reloc argument to be an + Elf32_Internal_Rela. + (USE_RELA): Define instead of USE_REL. + (elf_info_to_howto, elf_info_howto_rel): Corresponding changes. + +Sun Dec 1 00:18:59 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * configure.in, configure: Handle mips*-sgi-irix6*. + * irix-core.c (irix_core_core_file_p): Accept CORE_MAGICN32 + core files. + +Wed Nov 27 12:10:25 1996 Ian Lance Taylor + + * elf32-i386.c (elf_i386_relocate_section): Warn about a + relocation against a symbol defined in a section with no output + section. + +Tue Nov 26 11:07:31 1996 Ian Lance Taylor + + * aclocal.m4 (BFD_CC_FOR_BUILD): Don't require AC_C_CROSS. + * configure, config.in: Rebuild with autoconf 2.12. + + * elf-bfd.h (struct elf_link_hash_entry): Add other field. + * elf.c (_bfd_elf_link_hash_newfunc): Initialize other field. + (swap_out_syms): Set st_other from existing st_other field. + * elflink.h (elf_link_add_object_symbols): Store st_other in hash + table other field. + (elf_link_output_extsym): Set the other field from the global hash + table entry. + * elf32-mips.c (enum reloc_type): Add R_MIPS16_26. + (elf_mips16_jump_howto): New static variable. + (mips16_jump_reloc): New static function. + (bfd_elf32_bfd_reloc_type_lookup): Handle BFD_RELOC_MIPS16_JMP. + (mips_info_to_howto_rel): Handle R_MIPS16_26. + (mips_elf_relocate_section): Handle R_MIPS16_26. Handle R_MIPS_26 + to a mips16 symbol. + * reloc.c (BFD_RELOC_MIPS16_JMP): Add to list of relocs. + * bfd-in2.h, libbfd.h: Rebuild. + * cpu-mips.c (arch_info_struct): Add mips:16 entry. + +Mon Nov 25 11:23:32 1996 Ian Lance Taylor + + * configure.host: Use long long for mips-sgi-irix6*. + + * coffswap.h (coff_swap_scnhdr_out): Make line number overflow + only a warning. From Philippe De Muyter . + +Mon Nov 25 08:52:29 1996 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10300.c (bfd_elf32_mn10300_reloc): New function. + (enum reloc_type): Add more reloc types. + (elf32_mn10300_howto_table): Update for new reloc types. + (elf32_mn10300_reloc_map): Update for new reloc types. + * reloc.c: Add some new relocs for the mn10300 series. + * bfd-in2.h, libbfd.h: Rebuilt. + +Sat Nov 23 13:26:18 1996 Jeffrey A Law (law@cygnus.com) + + * som.c (setup_sections): Don't lose for a space which has + no data, but some symbols. + +Fri Nov 22 11:32:13 1996 Ian Lance Taylor + + * sunos.c (struct sunos_link_hash_table): Add got_needed field. + (sunos_link_hash_table_create): Initialize got_needed. + (sunos_create_dynamic_sections): Only set .got section size if it + is not already set. Set got_needed. + (bfd_sunos_size_dynamic_sections): Check got_needed. Only set + sdynptr, and only handle dynamic sections, if dynamic sections are + needed. + (sunos_scan_std_relocs): Pass false to create_dynamic_sections. + Initialize .got section. + (sunos_scan_ext_relocs): Likewise. + (sunos_write_dynamic_symbol): Set up PLT entry even if this is not + a dynamic symbol. + (sunos_finish_dynamic_link): Check got_needed. Only set up + dynamic linking information if needed. + +Thu Nov 21 10:31:31 1996 Rob Savoye (rob@cygnus.com) + + * config.bfd: Added VersaDOS format to the Ericsson configuration. + +Wed Nov 20 16:31:31 1996 Jeffrey A Law (law@cygnus.com) + + * elf32-mn10300.c: Rough cut at relocs for the mn10300. + +Wed Nov 13 08:12:38 1996 Jeffrey A Law (law@cygnus.com) + + * Makefile.in (elf32-d10v.o): Don't depend on elf/d10v.h + anymore. + +Tue Nov 12 13:30:00 1996 Dawn Perchik + + * filemode.c: Include sysdep.h. + * ihex.c: Add casts to eliminate compiler warnings. + * sunos.c: Add casts to eliminate compiler warnings. + +Mon Nov 11 10:37:02 1996 Michael Meissner + + * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Create .got.plt + section. + (ppc_elf_check_relocs): Add support for R_PPC_LOCAL24PC. Make + appropriate relocations in the .so file if shared. + (ppc_elf_relocate_section): Ditto. + +Tue Oct 29 15:03:02 1996 Doug Evans + + * elf32-m32r.c (elf_m32r_howto_table, R_M32R_24): Use + complain_overflow_unsigned. + +Tue Oct 29 12:53:46 1996 Martin M. Hunt + + * elf32-d10v.c (elf_d10v_howto_table): Don't complain on + overflows for R_D10V_16 and R_D10V_18. + +Tue Oct 29 13:23:53 1996 Ian Lance Taylor + + * ieee.c (ieee_write_section_part): Use LMA rather than VMA. + (do_with_relocs): Likewise. + (do_as_repeat): Likewise. + (copy_expression): Likewise. + +Fri Oct 25 16:56:40 1996 Ian Lance Taylor + + * ieee.c (ieee_write_external_part): Correctly record whether + there is an external part. + +Thu Oct 24 09:08:47 1996 Stu Grossman (grossman@critters.cygnus.com) + + * aclocal.m4, configure: Set USE_BINARY_FOPEN for *-*-windows. + +Wed Oct 23 00:20:34 1996 Ian Lance Taylor + + * xcofflink.c (bfd_xcoff_import_symbol): Don't allocate ldsym. + Store import file index in ldindx. + (xcoff_build_ldsyms): Assume that ldsym was not previously + allocated. For an imported symbol, copy ldindx into l_ifile. + +Tue Oct 22 17:22:43 1996 Ian Lance Taylor + + * binary.c (binary_set_section_contents): Ignore sections which + don't have SEC_LOAD and SEC_ALLOC set. + +Mon Oct 21 12:13:05 1996 Jeffrey A Law (law@cygnus.com) + + * linker.c (_bfd_generic_final_link): Avoid losing static + symbols in the .bss section. + +Mon Oct 21 10:54:58 1996 Ian Lance Taylor + + * elf32-mips.c (elf_mips_howto_table): Describe R_MIPS_64. + (mips32_64bit_reloc): New static function. + (mips_reloc_map): Add entry for BFD_RELOC_64. + (mips_elf_relocate_section): Handle R_MIPS_64. + + * linker.c (default_indirect_link_order): Print an error message + when attempting to do a relocateable link with different object + file formats, rather than calling abort. + +Thu Oct 17 10:43:29 1996 Doug Evans + + * reloc.c (m32r relocs): Rename them. + * bfd-in2.h, libbfd.h: Regenerated. + * elf32-m32r.c: Update. + (m32r_elf_10_pcrel_reloc): New function. + (elf_m32r_howto_table, R_M32R_10_PCREL entry): Use it. + (elf_m32r_howto_table, R_M32R_24 entry): Fix {src,dst}_masks. + +Wed Oct 16 11:24:35 1996 Jeffrey A Law (law@cygnus.com) + + * linker.c (_bfd_generic_final_link): Set "linker_mark" for + all sections that will be included in the output file. + (_bfd_generic_link_output_symbols): Discard symbols in sections + which are being discarded. + +Tue Oct 15 12:40:41 1996 Ian Lance Taylor + + * VERSION: Bump for new relocation. + + * hosts/i386bsd.h: If NBPG is not defined, define it as + PAGE_SIZE, for recent versions of FreeBSD. + +Mon Oct 14 12:37:26 1996 Ian Lance Taylor + + * configure.host: Use `long long' as the 64 bit type on a Solaris + host, since both gcc and the SunPRO compilers support it. + +Mon Oct 14 11:17:24 1996 Richard Henderson + + * reloc.c: Create a new BFD_RELOC_ALPHA_ELF_LITERAL. It was a + mistake to have reused the ECOFF LITERAL for ELF since they have + different semantics. + * elf64-alpha.c (elf_reloc_map): Map from ELF_LITERAL. + * bfd-in2.h, libbfd.h: Rebuild. + + * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Trap .got + section overflow. + + * elf64-alpha.c (elf64_alpha_relocate_section): Do not emit a + dynamic relocation for an undefweak symbol when we are building + a static executable. + +Thu Oct 10 11:15:06 1996 Stan Shebs + + * mpw-make.sed (config.bfd, targmatch.sed): Edit references to + point explicitly to srcdir. + (targmatch.h): Edit references to point explicitly to objdir. + +Thu Oct 10 14:14:23 1996 Ian Lance Taylor + + * config.bfd: When setting targ_cpu, don't get confused by + linux-gnu. + +Tue Oct 8 08:51:19 1996 Stu Grossman (grossman@critters.cygnus.com) + + * configure.host: Add support for windows host (a build done + under the Microsoft build environment). + +Tue Oct 8 11:40:16 1996 Ian Lance Taylor + + * elflink.h (elf_link_add_object_symbols): If a symbol is a weak + definition in a dynamic object, add it to the dynamic symbol table + if any dynamic object mentions it. Reverts part of last patch. + + * sunos.c (struct sunos_link_hash_table): Add got_base field. + (sunos_link_hash_table_create): Initialize got_base. + (bfd_sunos_size_dynamic_sections): If the .got section is more + than 0x1000 bytes, set __GLOBAL_OFFSET_TABLE_ and got_base to + 0x1000. + (sunos_check_dynamic_reloc): Subtract got_base from a base + relative relocation. + + * elf32-mips.c (elf_mips_isa): New static function. + (_bfd_mips_elf_merge_private_bfd_data): Don't warn about linking + -mips1 and -mips2 code together, or -mips3 and -mips4 code. + +Mon Oct 7 11:44:17 1996 Ian Lance Taylor + + * archive.c (do_slurp_coff_armap): Only treat archive as little + endian for i960 COFF. + +Fri Oct 4 13:49:01 1996 Ian Lance Taylor + + * coffcode.h (coff_compute_section_file_positions): Adjust sofar + by the change in size of the section when EXEC_P is not set. + + * coff-m68k.c (coff_rtype_to_howto): Define if not defined. + (m68kcoff_rtype_to_howto): New static function. + * cf-m68klynx.c (coff_m68k_lynx_rtype_to_howto): Add the section + VMA to the addend for a PC relative reloc. + + * dep-in.sed: Rework backslash loop a bit to avoid bug in sed on + HP/UX 10.20. + * Makefile.in: Rebuild dependencies. + + * dep-in.sed: Remove ../bfd/sysdep.h, since it will appear when + som.h is included. + +Fri Oct 4 11:41:39 1996 Jeffrey A Law (law@cygnus.com) + + * Makefile.in: Remove explicit dependencies for mn10200 and + mn10300 files. + (ALL_MACHINE_CFILES): Add cpu-mn10200.c and cpu-mn10300.c. + (BFD32_BACKENDS_CFILES): Add elf32-mn10200.c and elf32-mn10300.c + (dependencies): Rebuilt. + +Thu Oct 3 16:57:51 1996 Ian Lance Taylor + + * cofflink.c (coff_link_add_symbols): Set obj_coff_keep_syms + during this function. + + * elflink.c (_bfd_elf_create_linker_section): Only use an existing + section if the flags are compatible. + + * configure.in: Add havevecs, and put it in tdefaults. + * mpw-config.in: Likewise. + * configure: Rebuild. + * targmatch.sed: New file; a sed script to build targmatch.h from + config.bfd. + * config.bfd: Add #if, #endif, and comments for targmatch.h. + * targets.c: Include "fnmatch.h". + (struct targmatch): Define. + (bfd_target_match): Define by including targmatch.h. + (bfd_find_target): If the target is not found by name, search for + it as a configuration triplet. + * Makefile.in: Rebuild dependencies. + (BFD32_BACKENDS): Add aout-arm.o, aout-sparcle.o, hp300bsd.o, + i386dynix.o, m68k4knetbsd.o, and riscix.o. + (BFD32_BACKENDS_CFILES): Add aout-arm.c, aout-sparcle.c, + hp300bsd.c, i386dynix.c, m68k4knetbsd.c, and riscix.c. + (HFILES): Add targmatch.h. Also, alphabetize and reindent. + (CFILES): Remove i386dynix.c and hp300bsd.c. + (targmatch.h): New target. + (do_clean): Remove targmatch.h. + + * configure.in: Add BFD_NEED_DECLARATION(getenv). + * acconfig.h: Add NEED_DECLARATION_GETENV. + * configure, config.in: Rebuild. + * sysdep.h: If NEED_DECLARATION_GETENV, declare getenv. + * aout-adobe.c (aout_adobe_object_p): Don't declare getenv. + +Thu Oct 3 09:29:09 1996 Jeffrey A Law (law@cygnus.com) + + * cpu-mn10x00.c, elf32-mn10x00: Removed. + * cpu-mn10200.c, cpu-mn10300.c: New files. + * elf32-mn10200.c, elf32-mn10300.c: New files. + * Makefile.in: Break mn10x00 support into two separate + configurations, mn10200 and mn10300. + * archures.c, config.bfd, configure.in, elf.c, targets.c: Likewise. + * bfd-in2.h, configure: Rebuilt. + +Thu Oct 3 15:38:19 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) + + * Makefile.in (do_clean): Move config.log to do_distclean. + +Wed Oct 2 21:40:55 1996 Jeffrey A Law (law@cygnus.com) + + * cpu-mn10x00.c, elf32-mn10x00.c: New files. + * Makefile.in (ALL_MACHINES): Add cpu-mn10x00.o. + (BFD32_BACKENDS): Similarly for elf32-mn10x00.o. + (elf32-mn10x00.o): Add dependencies. + * archures.c (enum bfd_architecture): Add bfd_arch_mn10x00. + (bfd_mn10x00_arch): Declare. + (bfd_archures_list): Add bfd_mn10x00_arch. + * config.bfd: Add mn10x00-*-*. + * configure.in: Add bfd_elf32_mn10x00_vec. + * elf.c (prep_headers): Handle bfd_arch_mn10x00. + * targets.c (bfd_elf32_mn10x00_vec): Declare. + (bfd_target_vector): Add bfd_elf32_mn10x00_vec. + * bfd-in2.h, configure: Rebuilt. + +Wed Oct 2 15:46:45 1996 Klaus Kaempf + + openVMS/Alpha: Provide filename and case_hack flags via + symbol table from gas. + Add case_hack code for symbol output from vax/vms. + * evax-alpha.c (evax_initialize): Remove filename handling, + filename is provided via symbol table. + (evax_get_symtab): Use local symbol count when setting up table. + * evax-egsd.c (_bfd_evax_slurp_egsd): Print correct name when + debugging. + (_bfd_evax_write_egsd): Skip file name symbol. + * evax-emh.c (get_vms_time_string): Local function now. + (_bfd_evax_write_emh): Extract source filename and case_hack flags + from symbol table. + * evax_write_etir (_bfd_evax_write_etir): Pass all symbol names + through _bfd_evax_case_hack_symbol. + * evax-misc.c (hash_string, _bfd_evax_case_hack_symbol): New + functions. + (_bfd_evax_basename): Removed. + (_bfd_get_vms_time_string): Moved to evax-emh.c. + * evax.h (evax_private_data_struct): Remove filename. + (flag_hash_long_names, flag_show_after_trunc, + flag_no_hash_mixed_case, vms_name_mapping): New flags for + vms_case_hack. + +Wed Oct 2 12:02:02 1996 Ian Lance Taylor + + * freebsd.h (N_GET_MAGIC_NET): Don't use ntohl. + (N_GETMID_NET, N_GETFLAG_NET): Likewise. + (NO_SWAP_MAGIC): Don't define. + (SWAP_MAGIC): Define. + + * cofflink.c (_bfd_coff_link_input_bfd): Don't crash if there is + no hash table entry for a global symbol. + +Tue Oct 1 16:14:22 1996 Joel Sherrill + + * config.bfd (mips*-*-rtems*): New target, like mips*-*-elf*. + +Tue Oct 1 12:31:39 1996 Ian Lance Taylor + + * cofflink.c (coff_link_add_symbols): Don't override a meaningful + symbol type with T_NULL. Warn if symbol type changes. Based on + patch from Philippe De Muyter . + + * elflink.h (elf_link_add_object_symbols): Only put a symbol from + a dynamic object in the dynamic symbol table if it is referenced + or defined by a regular object. + +Mon Sep 23 13:33:00 1996 Ian Lance Taylor + + * elf32-ppc.c (ppc_elf_add_symbol_hook): Create the .sbss section + by hand, rather than by calling bfd_make_section. + +Mon Sep 23 09:23:41 1996 Doug Evans + + * reloc.c: Rename m32r relocs. + * bfd-in2.h, libbfd.h: Rebuilt. + * elf32-m32r.c: Update. + +Fri Sep 20 11:43:43 1996 Ian Lance Taylor + + * aoutx.h (aout_link_input_section_ext): When doing a relocateable + link, adjust the symbol index of a base relative reloc. Don't + change the addend of a PC relative reloc if pcrel_offset is set. + * sunos.c (bfd_sunos_size_dynamic_sections): Don't do anything for + a relocateable link. + + * reloc.c (bfd_perform_relocation): Apply the relocation even if + it is zero, in case src_mask matters. + (bfd_install_relocation): Likewise. + +Thu Sep 19 11:03:06 1996 Ian Lance Taylor + + * xcofflink.c (xcoff_link_add_symbols): Always initialize + keep_syms. + (_bfd_xcoff_bfd_final_link): Don't set target_index + to an uninitialized value. + +Tue Sep 17 14:18:31 1996 Ian Lance Taylor + + * coffcode.h (coff_slurp_line_table): Warn about illegal symbol + indices, rather than crashing. + (coff_slurp_reloc_table): Likewise. Check whether the howto field + is NULL. + * coff-sh.c (sh_relocate_section): Check for an illegal symbol + index. + +Mon Sep 16 12:39:36 1996 Ian Lance Taylor + + * coff-arm.c (aoutarm_std_reloc_howto): Change dst_mask for ARM26D + reloc to 0. + (coff_arm_adjust_symndx): New static function. + (coff_adjust_symndx): Define. + + * srec.c (srec_scan): Accept multiple symbols on a single line. + From Pascal Martin . + + * README: New file. + +Fri Sep 13 14:32:42 1996 Doug Evans + + * aoutf1.h (MY_bfd_merge_private_bfd_data): Define. + (sunos_merge_private_bfd_data): New function. + +Fri Sep 13 15:50:57 1996 Ian Lance Taylor + + * bfd.c (bfd_copy_private_bfd_data): Switch on output BFD rather + than input BFD. + (bfd_merge_private_bfd_data): Likewise. + * section.c (bfd_copy_private_section_data): Likewise. + * syms.c (bfd_copy_private_symbol_data): Likewise. + * bfd-in2.h: Rebuild. + * aout-target.h (MY_bfd_copy_private_section_data): Check that + both BFD's are the right flavour. + * ecoff.c (_bfd_ecoff_bfd_copy_private_bfd_data): Likewise. + * elf.c (_bfd_elf_copy_private_symbol_data): Likewise. + * elf32-mips.c (_bfd_mips_elf_copy_private_bfd_data): Likewise. + (_bfd_mips_elf_merge_private_bfd_data): Likewise. + * elf32-ppc.c (ppc_elf_copy_private_bfd_data): Likewise. + (ppc_elf_merge_private_bfd_data): Likewise. + * elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Likewise. + * peicode.h (pe_bfd_copy_private_section_data): Likewise. + + * elf32-hppa.c (elf_hppa_howto_table): Fill in some fields for + R_PARISC_DIR32, so that _bfd_stab_section_find_nearest_line passes + its sanity check. + +Thu Sep 12 11:45:57 1996 Doug Evans + + * reloc.c: Add m32r relocs. + * bfd-in2.h, libbfd.h: Rebuilt. + * cpu-m32r.c,elf32-m32r.c: New files. + +Thu Sep 12 11:10:05 1996 Ian Lance Taylor + + * ieee.c (ieee_vec): Set symbol_leading_char field to '_'. + +Wed Sep 11 11:57:56 1996 Ian Lance Taylor + + * tekhex.c (first_phase): Change type parameter from char to int. + (out): Likewise. + (pass_over): Change func to expect int, not char. + + * elf.c (assign_file_positions_for_segments): Test SEC_ALLOC + rather than SEC_LOAD when aligning the file offset for the first + section in a segment. + +Tue Sep 10 16:18:30 1996 Fred Fish + + * syms.c (coff_section_type): Make arg const. + * irix-core.c (irix_core_core_file_p): Remove extraneous extra arg + to make_bfd_asection(). + * elf-bfd.h (bfd_section_from_phdr): Add prototype. + * elfcode.h (bfd_section_from_phdr): Remove prototype. + (_bfd_elf_stringtab_init): Remove prototype. + + * netbsd-core.c (swap_abort): Add prototype. + * aix386-core.c (swap_abort): Ditto & make static + * hpux-core.c (swap_abort): Ditto & make static. + * irix-core.c (swap_abort): Ditto & make static. + * ptrace-core.c (swap_abort): Ditto & make static. + * trad-core.c (swap_abort): Ditto & make static. + * coffswap.h (coff_swap_reloc_in): Ditto. + (coff_swap_reloc_out): Ditto. + (coff_swap_filehdr_in): Ditto. + (coff_swap_filehdr_out): Ditto. + (coff_swap_sym_in): Ditto. + (coff_swap_sym_out): Ditto. + (coff_swap_aux_in): Ditto. + (coff_swap_aux_out): Ditto. + (coff_swap_lineno_in): Ditto. + (coff_swap_lineno_out): Ditto. + (coff_swap_aouthdr_in): Ditto. + (coff_swap_aouthdr_out): Ditto. + (coff_swap_scnhdr_in): Ditto. + (coff_swap_scnhdr_out): Ditto. + * ihex.c (ihex_sizeof_headers): Ditto. + * tekhex.c (getsym): Ditto. + (find_chunk): Ditto & make static. + (insert_byte): Ditto. + (first_phase): Ditto. + (pass_over): Ditto. + (tekhex_get_symtab): Ditto & make static. + (tekhex_get_symtab_upper_bound): Ditto & make static. + (tekhex_mkobject): Ditto. + (tekhex_object_p): Ditto. + (move_section_contents): Ditto. + (tekhex_get_section_contents): Ditto. + (tekhex_set_arch_mach): Ditto & make static. + (tekhex_set_section_contents): Ditto. + (writevalue): Ditto. + (writesym): Ditto. + (out): Ditto. + (tekhex_write_object_contents): Ditto. + (tekhex_sizeof_headers): Ditto. + (tekhex_make_empty_symbol): Ditto. + (tekhex_get_symbol_info): Ditto. + (tekhex_print_symbol): Ditto. + * irix-core.c (make_bfd_asection): Ditto. + (irix_core_core_file_p): Ditto. + (irix_core_core_file_failing_command): Ditto. + (irix_core_core_file_failing_signal): Ditto. + (irix_core_core_file_matches_executable_p): Ditto. + (irix_core_make_empty_symbol): Ditto. + * coff-mips.c (mips_bfd_reloc_type_lookup): Ditto. + * srec.c (srec_new_symbol): Ditto. + (srec_get_section_contents): Ditto. + (srec_set_arch_mach): Ditto. + (srec_set_section_contents): Ditto. + (internal_srec_write_object_contents): Ditto. + (srec_write_object_contents): Ditto. + (symbolsrec_write_object_contents): Ditto. + (srec_sizeof_headers): Ditto. + (srec_make_empty_symbol): Ditto. + (srec_get_symtab_upper_bound): Ditto. + (srec_get_symtab): Ditto. + (srec_print_symbol): Ditto and make static. + * elf.c (elf_read): Ditto + (assign_section_numbers): Ditto. + (elf_fake_sections): Ditto. + (sym_is_global): Ditto. + (elf_map_symbols): Ditto. + (get_program_header_size): Ditto. + * coffgen.c (make_a_section_from_file): Ditto. + (coff_real_object_p): Ditto. + (fixup_symbol_value): Ditto. + (build_debug_section): Ditto. + (copy_name): Ditto. + * syms.c (coff_section_type): Ditto. + +Mon Sep 9 22:36:01 1996 Jeffrey A Law (law@cygnus.com) + + * bfd-in2.h: Rebuilt after m32r changes. + +Mon Sep 9 12:31:22 1996 Doug Evans + + * config.bfd,configure.in,configure: Add m32r support. + * Makefile.in,archures.c,elf.c,targets.c: Likewise. + * config.bfd: Keep target list alphabetically sorted. + +Fri Sep 6 17:04:39 1996 Martin M. Hunt + + * elf32-d10v.c (elf_d10v_howto_table): Modify the size of R_D10V_16 + and R_D10V_18 to be 1 (word). + +Thu Sep 5 15:23:08 1996 Ian Lance Taylor + + * stabs.c (_bfd_link_section_stabs): If the output_section field + of either section is bfd_abs_section, then the linker is + discarding the section and we should not optimize it. + +Tue Sep 3 12:16:20 1996 Doug Evans + + * Makefile.in (aout-sparcle.o): New target. + * aoutf1.h (TARGET_IS_BIG_ENDIAN_P): Don't define if little endian. + * config.bfd (sparclet-*-aout*): Add case. + * configure.in (sparcle_aout_vec): Add case. + * configure: Regenerated. + * targets.c (sparcle_aout_vec): Declare. + (bfd_target_vector): Add sparcle_aout_vec. + * aout-sparcle.c: New file. + +Mon Sep 2 12:12:34 1996 Ian Lance Taylor + + * cpu-mips.c: Add an explicit mips:3000 entry, and change the + default architecture to a machine number of 0. + * elf32-mips.c (_bfd_mips_elf_object_p): Set the machine number + for E_MIPS_ARCH_1. + (_bfd_mips_elf_merge_private_bfd_data): If the machine number of + the output BFD is the default, set it from the first input BFD. + +Sun Sep 1 15:41:08 1996 Ian Lance Taylor + + * rs6000-core.c (rs6000coff_core_file_matches_executable_p): + Rewrite to use BFD file read routines and to avoid using a fixed + length for the file name. + +Fri Aug 30 11:49:19 1996 Ian Lance Taylor + + Add SH ELF support. + * elf32-sh.c: New file. + * elf.c (prep_headers): Handle bfd_arch_sh. + * elfcode.h (write_relocs): Handle absolute symbol. + * elf-bfd.h (_bfd_elf32_link_read_relocs): Declare. + (_bfd_elf64_link_read_relocs): Declare. + * elflink.h (NAME(_bfd_elf,link_read_relocs)): Rename from + elf_link_read_relocs. Make globally visible. Change all + callers. + (elf_link_input_bfd): Get external symbols from cache in + symtab_hdr->contents. Get contents from cache in + elf_section_data. + * elfxx-target.h (bfD_elfNN_bfd_relax_section): Only define if not + already defined. + * reloc.c: Define BFD_RELOC_SH_* relocs. + * libbfd-in.h (_bfd_sh_align_load_span): Declare. + * coff-sh.c (sh_insns_conflict): Fix a return value. + (_bfd_sh_align_load_span): New globally visible function, broken + out of sh_align_load. + (sh_align_load): Call _bfd_sh_align_load_span. + (sh_swap_insns): Change relocs parameter to PTR. + * bfd-in2.h, libbfd.h: Rebuild. + * targets.c (bfd_elf32_sh_vec): Declare. + (bfd_elf32_shl_vec): Declare. + * config.bfd (sh-*-elf*): New target. + * configure.in (bfd_elf32_sh_vec): New target vector. + (bfd_elf32_shl_vec): New target vector. + * configure: Rebuild. + * Makefile.in: Rebuild dependencies. + (BFD32_BACKENDS): Add elf32-sh.o. + (BFD32_BACKENDS_CFILES): Add elf32-sh.c. + + * elf.c (map_sections_to_segments): Check that LMA does not skip a + page before checking D_PAGED. + + * ihex.c (ihex_scan): Removed unnecessary extbase variable. + (ihex_write_object_contents): Remove extbase; always use segbase + instead. + +Thu Aug 29 16:52:17 1996 Michael Meissner + + * configure.in (i[345]86-*-*): Recognize i686 for pentium pro. + * configure.host (i[345]86-*-*): Ditto. + * config.bfd (i[345]86-*-*): Ditto. + * configure: Regenerate. + + * config.bfd (i[3456]86-*-dgux*): Recognize as a synonym for x86 + elf. + +Tue Aug 27 09:18:18 1996 Jeffrey A Law (law@cygnus.com) + + * elf32-hppa.c (hppa_elf_gen_reloc_type): Add new argument. + * elf32-hppa.h (hppa_elf_gen_reloc_type): Update prototype. + * som.c (hppa_som_gen_reloc_type): Add new argument. If + we encounter an R_DATA_ONE_SYMBOL reloc against a symbol that + will have an ST_CODE type, change the symbol's type to ST_DATA. + * som.c (hppa_som_gen_reloc_type): Update prototype. + +Tue Aug 27 00:12:22 1996 Ian Lance Taylor + + * elf32-mips.c (mips_elf_check_relocs): Set dynobj if needed for + R_MIPS_32 and R_MIPS_REL32. Set sgot and g as soon as possible. + (mips_elf_size_dynamic_sections): Don't require .got to exist. + (mips_elf_finish_dynamic_sections): Likewise. + +Thu Aug 22 10:54:38 1996 Ian Lance Taylor + + * configure.host (HLDENV): New variable to set. Set it for + *-*-sysv4*, since those linkers may not support -R but they always + support LD_RUN_PATH. + + * libieee.h (NSECTIONS): Don't define. + (ieee_data_struct): Change section_table to asection **. Add + section_table_size. + * ieee.c (get_section_entry): If the table isn't big enough, make + it bigger. + (ieee_slurp_sections): Remove assertion about number of sections. + (ieee_object_p): Adjust initialization of ieee to match changes to + the structure. + + * xcofflink.c (xcoff_mark): Don't copy relocs for undefined + symbols merely because we are generating a shared library. + (xcoff_build_ldsyms): Don't set up global linkage code for an + undefined symbol merely because we are generating a shared + library. + +Fri Aug 16 16:25:35 1996 Ian Lance Taylor + + * xcofflink.c (xcoff_link_add_dynamic_symbols): Create and define + a function code symbol for an XMC_XO symbol. + +Thu Aug 15 12:33:29 1996 Stan Shebs + + * mpw-config.in: Update editing of autoconf vars to reflect + Jul 18 configure.in change. + * mpw-make.sed: Update editing of include pathnames to be + more general, add @DASH_C_FLAG@ to explicit compile rule edit. + +Thu Aug 15 10:35:13 1996 Richard Henderson + + * elf64-alpha.c (elf64_alpha_output_extsym): The section from + which to offset to get the .plt entry address is ".plt". + +Thu Aug 15 16:40:30 1996 James G. Smith + + * reloc.c: (BFD_RELOC_ARM_THUMB_ADD, BFD_RELOC_ARM_THUMB_IMM, + BFD_RELOC_ARM_THUMB_SHIFT, BFD_RELOC_ARM_THUMB_OFFSET): + Added, for internal use by the ARM gas. + * libbfd.h: Rebuilt + * bfd-in2.h: Rebuilt + +Wed Aug 14 17:02:09 1996 Richard Henderson + + * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Correct typo + in section dynidx start. + +Tue Aug 13 14:35:38 1996 Ian Lance Taylor + + * elf.c (_bfd_elf_make_section_from_shdr): Treat sections whose + name begins with .gnu.linkonce as SEC_LINK_ONCE. This is an + optimization for g++. + +Tue Aug 13 17:04:40 1996 Michael Meissner + + * elf32-ppc.c (ppc_elf_merge_private_bfd_data): If one module has + the -mrelocatable-lib bit set and the other doesn't, clear the + -mrelocatable-lib bit in the header. + +Sat Aug 10 22:59:17 1996 Ian Lance Taylor + + * elflink.h (elf_link_add_object_symbols): Do not resolve a common + symbol against a STT_FUNC symbol in a shared library. + +Fri Aug 9 12:44:57 1996 Ian Lance Taylor + + * xcofflink.c (xcoff_link_add_dynamic_symbols): If a descriptor + symbol is found, automatically define the corresponding function + code. + + * cofflink.c (coff_link_add_symbols): Only set (*sym_hash)->numaux + if sym.n_numaux is not zero. + (_bfd_coff_link_input_bfd): Permit the symbol and the hash table + entry to disagree about the number of aux entries if the symbol + has zero. + + * elf32-mips.c (mips_elf_check_relocs): Create the .rel.dyn + section if it might be needed, not just if info->shared. + (mips_elf_adjust_dynamic_symbol): Make room for a null element at + the start of .rel.dyn if we are going to use it. + (mips_elf_finish_dynamic_sections): Only clear the first element + of .rel.dyn if the size is greater than zero. + +Thu Aug 8 16:24:55 1996 Ian Lance Taylor + + * xcofflink.c (xcoff_link_input_bfd): If we already called the + undefined_symbol callback for a symbol, then don't issue any more + warnings about loader relocs. + (_bfd_ppc_xcoff_relocate_section): Don't do any further processing + after calling the undefined_symbol callback. + + * xcofflink.c (XCOFF_MULTIPLY_DEFINED): Define. + (xcoff_link_add_symbols): Permit multiple definitions of a symbol + as the AIX linker seems to do. + +Thu Aug 8 12:21:56 1996 Klaus Kaempf + + * evax-alpha.c (evax_alpha_vec): Corrected flags, cleanup. + (evax_initialize): Remove evax_reloc_table. + (evax_close_and_cleanup): Ditto. + (reloc_nil): Ditto. + (alpha_howto_table): Remove ALPHA_R_SWREL32 and ALPHA_R_SWREL64 + entries. + (evax_bfd_reloc_type_lookup): Ditto. + * evax-egsd.c (_bfd_evax_slurp_egsd): Add a few casts; set + cooked_size == raw_size. + * evax-emh.c (_bfd_evax_register_filename): Remove. + * evax-etir.c (etir_stc): Allow ETIR_S_C_STC_xx commands. + * evax-misc.c (add_new_contents): Malloc section at full size. + (_bfd_save_evax_section): Memcpy section contents directly. + * evax.h (ALPHA_R_SWREL32, ALPHA_R_SWREL64): Remove. + (evax_reloc_table): Remove. + + * hosts/alphavms.h (O_ACCMODE): Define if needed. + + * makefile.vms: Add better support for DEC C compilation + Add evax.h dependencies + + * reloc.c (bfd_get_reloc_size): Add case for 16 byte reloc. + (BFD_RELOC_SWREL32,BFD_RELOC_SWREL64): Remove. + (BFD_RELOC_ALPHA_BASEREG): Remove. + * bfd-in2.h, libbfd.h: Rebuild. + +Thu Aug 8 08:17:32 1996 Stu Grossman (grossman@critters.cygnus.com) + + * archive.c (bsd_write_armap): Ifdef around calls to getuid and + getgid if _WIN32 is defined. + * opncls.c (bfd_fdopenr): Remove unnecessary WINGDB ifdef. + +Wed Aug 7 23:19:00 1996 Stu Grossman (grossman@critters.cygnus.com) + + * aoutx.h bfd-in.h bfd-in2.h opncls.c riscix.c som.c targets.c: + Change NO_FLAGS to BFD_NO_FLAGS to avoid conflict with an HPUX + include file. + * libbfd.c: Create dummy getpagesize() macro if HAVE_GETPAGESIZE + isn't defined. + +Wed Aug 7 14:11:44 1996 Philippe De Muyter + + * configure.in: Call BFD_NEEDED_DECLARATION on strstr and + realloc. + * acconfig.h (NEED_DECLARATION_STRSTR): New macro. + (NEED_DECLARATION_REALLOC): New macro. + * configure, config.in: Rebuild. + * sysdep.h (strstr): Declare if NEED_DECLARATION_STRSTR. + (realloc): Declare if NEED_DECLARATION_REALLOC. + + * aclocal.m4 (BFD_NEED_DECLARATION): Include or + if they exist. + + * ieee.c (ieee_set_section_contents): Cast bfd_alloc return. + +Wed Aug 7 12:12:03 1996 Ian Lance Taylor + + * cpu-i386.c (i8086_arch): Architecture info for the i8086. + + Based on patches from Eric Valette : + * elf32-i386.c (enum reloc_type): Add FIRST_INVALID_RELOC, + LAST_INVALID_RELOC, R_386_16, R_386_PC16, R_386_8, R_386_PC8. + (elf_howto_table): Add entries for new relocs. + (elf_i386_reloc_type_lookup): Handle new relocs. + (elf_i386_info_to_howto): Just call abort. + (elf_i386_info_to_howto_rel): Check that the reloc type is valid. + (elf_i386_relocate_section): Likewise. + +Tue Aug 6 12:54:56 1996 Martin M. Hunt + + * elf32-d10v.c (elf_d10v_howto_table): Added R_D10V_32. + +Mon Aug 5 13:42:41 1996 Ian Lance Taylor + + * elf.c (_bfd_elf_make_section_from_shdr): For a loadable section, + only get the LMA from the phdr if they are in the same part of the + file. + + * elf.c (map_sections_to_segments): Rewrite tests for starting a + new segment to make them more comprehensible. If the relationship + between the LMA and the VMA changed, start a new segment. Don't + check dynsec when deciding whether to start a new segment for a + writeable section; -N will now handle this. + +Thu Aug 1 22:43:08 1996 Jeffrey A Law (law@cygnus.com) + + * libhppa.h: Remove "esel" changes. Not the right approach. + * som.c: Corresponding changes. + (som_bfd_derive_misc_symbol_info): Use ST_DATA for symbols + which don't have a SOM symbol type associated with them. + Reverses a 1994 change. + +Wed Jul 31 15:50:55 1996 Ian Lance Taylor + + Make ld -N more reasonable for ELF: + * elf.c (map_sections_to_segments): If D_PAGED is not set, set + phdr_in_section to false, and always use a single load segment. + (elf_sort_sections): Sort sections by LMA after VMA. + (assign_file_positions_for_segments): If D_PAGED is not set, don't + align to maxpagesize. + (assign_file_positions_except_relocs): Likewise. + * elfcode.h (elf_object_p): If a section is loaded but not page + aligned, clear D_PAGED. + +Wed Jul 31 15:00:12 1996 James G. Smith + + * reloc.c: (BFD_RELOC_ARM_OFFSETIMM8, BFD_RELOC_ARM_HWLITERAL): + Added, for internal use by the ARM gas. + * libbfd.h: Rebuilt + * bfd-in2.h: Rebuilt + +Tue Jul 30 14:14:57 1996 Jeffrey A Law (law@cygnus.com) + + * libhppa.h (R_HPPA_ESEL): New field selector. + (e_esel): Similarly. + * som.c (hppa_som_gen_reloc_type): If we encounter an e_esel, + then generate R_COMP2 (PUSH_SYM), R_DATA_EXPR fixup stream. + (som_write_fixups): Handle R_DATA_EXPR just like R_CODE_EXPR. + +Tue Jul 30 13:31:27 1996 Ian Lance Taylor + + * xcofflink.c (_bfd_xcoff_bfd_link_add_symbols): Do the regular + archive search before looking for stripped dynamic objects. + +Fri Jul 26 17:51:39 1996 Ian Lance Taylor + + * xcofflink.c (xcoff_build_ldsyms): Make exporting an undefined + symbol a warning rather than an error. + +Wed Jul 24 12:02:53 1996 Ian Lance Taylor + + * elf.c (assign_file_positions_for_segments): Track the virtual + memory position separately from the file position, and use it to + compute the alignment adjustment. + +Tue Jul 23 10:43:31 1996 Martin M. Hunt + + * elf32-d10v.c (elf_d10v_howto_table): Changed all relocs to "long" + and fixed mask on R_D10V_10_PCREL_L. + +Mon Jul 22 15:30:30 1996 Ian Lance Taylor + + * elf64-mips.c: Include "aout/ar.h". + (mips_elf64_slurp_armap): New static function. + (mips_elf64_write_armap): New static function. + (bfd_elf64_archive_*): Define. + * elfxx-target.h (bfd_elfNN_archive_p): Define if not defined. + Use instead of bfd_generic_archive_p. + (bfd_elfNN_write_archive_contents): Define if not defined. Use + instead of _bfd_write_archive_contents. + (bfd_elfNN_mkdarchive): Define if not defined. Use instead of + _bfd_generic_mkarchive. + (TARGET_BIG_SYM): If bfd_elfNN_archive_functions is defined, use + bfd_elfNN_archive in BFD_JUMP_TABLE_ARCHIVE rather than + _bfd_archive_coff. + (TARGET_LITTLE_SYM): Likewise. + * archive.c (bfd_slurp_armap): Check for and reject an archive map + name of /SYM64/. + * Makefile.in: Rebuild dependencies. + + * elf32-mips.c (_bfd_mips_elf_final_write_processing): Handle + SHT_MIPS_LIBLIST, SHT_MIPS_CONTENT, SHT_MIPS_SYMBOL_LIB, and + SHT_MIPS_EVENTS sections. + (_bfd_mips_elf_section_from_shdr): Handle SHT_MIPS_IFACE, + SHT_MIPS_CONTENT, SHT_MIPS_SYMBOL_LIB, and SHT_MIPS_EVENTS + sections. + (_bfd_mips_elf_fake_sections): Likewise. + + * libecoff.h (ecoff_data_type): Add rdata_in_text field. + * ecoff.c (ecoff_compute_section_file_positions): Copy + rdata_in_text from backend info to tdata. Clear it if any data + section comes before .rdata. + (_bfd_ecoff_write_object_contents): Use rdata_in_text field in + tdata rather than backend info. + +Fri Jul 19 18:15:51 1996 Ian Lance Taylor + + * configure.in: Fix test for whether a compiler has a 64 bit + type. From Jim Wilson . + +Thu Jul 18 15:39:10 1996 Ian Lance Taylor + + * configure.host (mips-sgi-irix6*): New host. + + * configure.in: Set and substitute VERSION, BFD_HOST_64BIT_LONG + (replacing HOST_64BITLONG), BFD_HOST_64_BIT_DEFINED, + BFD_HOST_64_BIT, and BFD_HOST_U_64_BIT. Add bfd-in2.h:bfd-in2.h + to AC_OUTPUT call. + * configure: Rebuild. + * bfd-in.h (BFD_ARCH_SIZE): Define as @wordsize@, not @WORDSIZE@. + (BFD_HOST_64_BIT): Define conditionally. + (BFD_HOST_U_64_BIT): Define when BFD_HOST_64_BIT is defined. + (bfd_vma): Typedef as BFD_HOST_U_64_BIT. + (symvalue, bfd_size_type): Likewise. + * bfd-in2.h: Rebuild. + * Makefile.in (do_clean): Remove bfd-tmp.h. + (do_distclean): Remove bfd-in3.h. + (stmp-bfd.h): Just do copy-if-change bfd-in3.h bfd.h. + (bfd-in3.h): New target. + + * config.bfd (sparc-*-sysv4*): Don't build sunos_big_vec. From + Andrew Gierth . + + * configure.host: Set INSTALL_SHLIB. + * configure.in: Call AC_SUBST (INSTALL_SHLIB). + * configure: Rebuild. + * Makefile.in (install): Use @INSTALL_SHLIB@. + + * config.bfd (mips*-*-irix6*): New target. + * configure.host: Handle Irix 6 shared library like Irix 5. + + * xcofflink.c (xcoff_link_add_symbols): Don't check an XMC_TD + symbol for a magic name. + (xcoff_link_input_bfd): Don't change the reloc symbol for an + XMC_TD symbol. + (_bfd_ppc_xcoff_relocate_section): Don't get the TOC offset for an + XMC_TD symbol. + +Thu Jul 18 11:36:31 1996 Stan Shebs + + * mpw-config.in: Add ELF support to mips config, create the + elf32-target.h file in the object dir. + * mpw-make.sed: Edit elfXX-target.h refs at beginnings of lines. + +Wed Jul 17 18:02:32 1996 Kim Knuttila + + * coff-ppc.c: Redid debug scheme - numerous fprintf's gone. + Also removed most abort calls, in favor of using bfd reporting. + +Wed Jul 17 14:51:52 1996 Martin M. Hunt + + * Makefile.in (ALL_MACHINES): Add cpu-d10v.o. + (BFD32_BACKENDS) Add elf32-d10v.o. + * archures.c: Add bfd_d10v_arch. + * bfd-in2.h: Add bfd_d10v_arch. + * config.bfd (d10v-*-*): New target. + * configure: (bfd_elf32_d10v_vec) New vector. + * configure.in: (bfd_elf32_d10v_vec) New vector. + * cpu-d10v.c: New file. + * elf.c (prep_headers): Added case bfd_arch_d10v. + * elf32-d10v.c: New file. + * libbfd.h: Rebuild. + * reloc.c (BFD_RELOC_D10V_10_PCREL_R, BFD_RELOC_D10V_10_PCREL_L, + BFD_RELOC_D10V_18, BFD_RELOC_D10V_18_PCREL): Define. + * targets.c (bfd_elf32_d10v_vec): New vector. + +Wed Jul 17 10:58:55 1996 Kim Knuttila + + * coff-ppc.c (coff_ppc_relocate_section): Removed bogus fprintf + +Tue Jul 16 23:49:02 1996 Stu Grossman (grossman@critters.cygnus.com) + + * archures.c bfd-in2.h: Add bfd_mach_i386_i386 and + bfd_mach_i386_i8086 machine types. + +Wed Jul 10 12:42:56 1996 Ian Lance Taylor * ecoff.c (_bfd_ecoff_new_section_hook): Set SEC_CODE for _INIT and _FINI sections. @@ -10,7 +2261,15 @@ * coffcode.h (coff_set_section_contents): A/UX does not require special handling of the _LIB section. -Tue Jul 9 12:26:30 1996 Ian Lance Taylor +Tue Jul 9 15:52:20 1996 Jeffrey A Law (law@cygnus.com) + + * coff-h8300.c (h8300_reloc16_extra_cases): Use the correct + value for R_RELBYTE. + + * reloc16.c (bfd_coff_reloc16_relax_section): Only "shrinks" + array if one was allocated. + +Tue Jul 9 12:21:54 1996 Ian Lance Taylor From Kazumoto Kojima : * elf32-mips.c (struct mips_elf_link_hash_table): Add new fields @@ -26,9 +2285,38 @@ __rld_obj_head symbol. (mips_elf_finish_dynamic_sections): Handle DT_MIPS_RLD_MAP. +Mon Jul 8 16:18:03 1996 Ian Lance Taylor + + * elf32-mips.c (mips_reloc_map): Remove BFD_RELOC_32_PCREL entry. + + * elf32-ppc.c (ppc_elf_howto_raw): For R_PPC_ADDR16_HA, use + ppc_elf_addr16_ha_reloc. + (ppc_elf_addr16_ha_reloc): New static function. + + * coff-mips.c (struct mips_hi): Define. + (mips_refhi_list): New static variable. + (mips_refhi_addr, mips_refhi_addend): Remove. + (mips_refhi_reloc): Maintain a list of unmatched REFHI relocs. + (mips_reflo_reloc): Process mips_refhi_list. + (mips_relhi_list): New static variable. + (mips_relhi_addr, mips_relhi_addend): Remove. + (mips_relhi_reloc): Maintain a list of unmatched RELHI relocs. + (mips_rello_reloc): Process mips_relhi_list. + (mips_relocate_section): Permit an arbitrary number of REFHI or + RELHI relocs before the associated REFLO or RELLO reloc. + +Fri Jul 5 19:27:49 1996 Ian Lance Taylor + + * aout-target.h (MY(callback)): Set reloc_count fields. + Thu Jul 4 12:00:37 1996 Ian Lance Taylor - * VERSION: Set to 2.7. + * sunos.c (sunos_add_dynamic_symbols): Don't create dynamic + sections unless this is a SunOS link. + + * VERSION: Set to 2.7.1. + + * Released binutils 2.7. Wed Jul 3 14:59:47 1996 Ian Lance Taylor @@ -230,6 +2518,18 @@ * coff-h8300.c: Remove #if 0 code. (compatable): Don't allow mixing/matching of different architectures. + * archures.c (bfd_mach_h8300s): Add. + * bfd-in2.h: Rebuilt. + * coff-h8300.c (funcvec_hash_newfunc): Handle H8/S too. + (BADMAG): Likewise. + (h8300_reloc16_estimate): Likewise. + (h8300_reloc16_extra_cases): Likewise. + (h8300_bfd_link_add_symbols): Likewise. + * coffcode.h (coff_set_arch_mach_hook): Likewise. + (coff_set_flags): Likewise. + * cpu-h8300.c (h8300_scan): Likewise. + Add H8/S to bfd_h8300_arch list. + Tue Jun 18 14:42:58 1996 Klaus Kaempf Added support for Alpha OpenVMS: @@ -4618,7 +6918,7 @@ Local Variables: -mode: indented-text +mode: change-log left-margin: 8 fill-column: 74 version-control: never diff -urN binutils-2.7/bfd/Makefile.in binutils-2.8/bfd/Makefile.in --- binutils-2.7/bfd/Makefile.in Thu Jul 4 12:30:37 1996 +++ binutils-2.8/bfd/Makefile.in Wed Apr 30 12:55:44 1997 @@ -1,5 +1,5 @@ # Makefile template for Configure for the BFD library. -# Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 +# Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 # Free Software Foundation, Inc. # Written by Cygnus Support. # @@ -64,6 +64,7 @@ SHLIB = @SHLIB@ SHLIB_CC = @SHLIB_CC@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ +SHLIB_LIBS = @SHLIB_LIBS@ COMMON_SHLIB = @COMMON_SHLIB@ SHLINK = @SHLINK@ @@ -113,15 +114,19 @@ cpu-a29k.o \ cpu-alpha.o \ cpu-arm.o \ + cpu-d10v.o \ cpu-h8300.o \ cpu-h8500.o \ cpu-hppa.o \ cpu-i386.o \ cpu-i860.o \ cpu-i960.o \ + cpu-m32r.o \ cpu-m68k.o \ cpu-m88k.o \ cpu-mips.o \ + cpu-m10200.o \ + cpu-m10300.o \ cpu-ns32k.o \ cpu-powerpc.o \ cpu-rs6000.o \ @@ -142,9 +147,12 @@ cpu-i386.c \ cpu-i860.c \ cpu-i960.c \ + cpu-m32r.c \ cpu-m68k.c \ cpu-m88k.c \ cpu-mips.c \ + cpu-m10200.c \ + cpu-m10300.c \ cpu-ns32k.c \ cpu-powerpc.c \ cpu-rs6000.c \ @@ -159,7 +167,9 @@ # target_vector in targets.c if configured with --enable-targets=all. BFD32_BACKENDS = \ aout-adobe.o \ + aout-arm.o \ aout-ns32k.o \ + aout-sparcle.o \ aout0.o \ aout32.o \ bout.o \ @@ -183,6 +193,7 @@ coff-rs6000.o \ coff-sh.o \ coff-sparc.o \ + coff-svm68k.o \ coff-u68k.o \ coff-we32k.o \ coff-w65.o \ @@ -190,21 +201,28 @@ cofflink.o \ ecoff.o \ ecofflink.o \ + elf32-d10v.o \ elf32-gen.o \ elf32-hppa.o \ elf32-i386.o \ elf32-i860.o \ + elf32-m32r.o \ elf32-m68k.o \ elf32-m88k.o \ elf32-mips.o \ + elf-m10200.o \ + elf-m10300.o \ elf32-ppc.o \ + elf32-sh.o \ elf32-sparc.o \ elf32.o \ elflink.o \ + hp300bsd.o \ hp300hpux.o \ som.o \ i386aout.o \ i386bsd.o \ + i386dynix.o \ i386freebsd.o \ i386linux.o \ i386lynx.o \ @@ -213,6 +231,7 @@ i386mach3.o \ i386os9k.o \ ieee.o \ + m68k4knetbsd.o \ m68klinux.o \ m68klynx.o \ m68knetbsd.o \ @@ -235,6 +254,8 @@ pei-ppc.o \ ppcboot.o \ reloc16.o \ + riscix.o \ + sparclinux.o \ sparclynx.o \ sparcnetbsd.o \ sunos.o \ @@ -244,7 +265,9 @@ BFD32_BACKENDS_CFILES = \ aout-adobe.c \ + aout-arm.c \ aout-ns32k.c \ + aout-sparcle.c \ aout0.c \ aout32.c \ bout.c \ @@ -268,6 +291,7 @@ coff-rs6000.c \ coff-sh.c \ coff-sparc.c \ + coff-svm68k.c \ coff-u68k.c \ coff-we32k.c \ coff-w65.c \ @@ -279,17 +303,23 @@ elf32-hppa.c \ elf32-i386.c \ elf32-i860.c \ + elf32-m32r.c \ elf32-m68k.c \ elf32-m88k.c \ elf32-mips.c \ + elf-m10200.c \ + elf-m10300.c \ elf32-ppc.c \ + elf32-sh.c \ elf32-sparc.c \ elf32.c \ elflink.c \ + hp300bsd.c \ hp300hpux.c \ som.c \ i386aout.c \ i386bsd.c \ + i386dynix.c \ i386freebsd.c \ i386linux.c \ i386lynx.c \ @@ -298,6 +328,7 @@ i386mach3.c \ i386os9k.c \ ieee.c \ + m68k4knetbsd.c \ m68klinux.c \ m68klynx.c \ m68knetbsd.c \ @@ -320,6 +351,8 @@ pei-ppc.c \ ppcboot.c \ reloc16.c \ + riscix.c \ + sparclinux.c \ sparclynx.c \ sparcnetbsd.c \ sunos.c \ @@ -406,7 +439,7 @@ "INSTALL_DATA=$(INSTALL_DATA)" \ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" -ALL_CFLAGS=@HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) $(CFLAGS) +ALL_CFLAGS=-D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) $(CFLAGS) .c.o: if [ -n "$(PICFLAG)" ]; then \ $(CC) -c $(PICFLAG) $(ALL_CFLAGS) $< -o pic/$@; \ @@ -425,14 +458,15 @@ $(ALL_MACHINES_CFILES) \ $(BFD32_BACKENDS_CFILES) \ $(BFD64_BACKENDS_CFILES) \ - $(OPTIONAL_BACKENDS_CFILES) \ - i386dynix.c hp300bsd.c + $(OPTIONAL_BACKENDS_CFILES) -HFILES = aout-target.h aoutf1.h aoutx.h coffcode.h \ - coffswap.h ecoffswap.h elf32-hppa.h elf32-target.h elf64-target.h \ - elfcode.h evax.h hppa_stubs.h libaout.h libbfd.h \ - libcoff.h libecoff.h elf-bfd.h libhppa.h libieee.h libnlm.h \ - liboasys.h nlm-target.h nlmcode.h som.h genlink.h netbsd.h ns32k.h +HFILES = \ + aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h \ + ecoffswap.h elf32-hppa.h elf32-target.h elf64-target.h \ + elfcode.h evax.h genlink.h hppa_stubs.h libaout.h libbfd.h \ + libcoff.h libecoff.h elf-bfd.h libhppa.h libieee.h libnlm.h \ + liboasys.h netbsd.h nlm-target.h nlmcode.h ns32k.h som.h \ + targmatch.h all: Makefile $(ALLLIBS) @PICLIST@ @$(MAKE) subdir_do DO=all "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) @@ -475,7 +509,7 @@ esac ; \ done ; \ echo $$f > tofiles - $(srcdir)/../move-if-change tofiles ofiles + $(SHELL) $(srcdir)/../move-if-change tofiles ofiles touch stamp-ofiles ofiles: stamp-ofiles ; @true @@ -493,14 +527,14 @@ else \ cp ofiles tpiclist; \ fi - $(srcdir)/../move-if-change tpiclist piclist + $(SHELL) $(srcdir)/../move-if-change tpiclist piclist touch stamp-piclist piclist: stamp-piclist ; @true $(SHLIB): stamp-picdir $(OFILES) piclist rm -f $(SHLIB) - $(SHLIB_CC) $(SHLIB_CFLAGS) -o $(SHLIB) `cat piclist` + $(SHLIB_CC) $(SHLIB_CFLAGS) -o $(SHLIB) `cat piclist` $(SHLIB_LIBS) # We make a link from libbfd.so to libbfd.so.VERSION for linking, and # also a link from libTARGET-bfd.so.VERSION for running. @@ -508,10 +542,10 @@ ts=lib`echo $(SHLIB) | sed -e 's/^lib//' | sed -e '$(program_transform_name)'`; \ if [ "$$ts" != "$(SHLIB)" ]; then \ rm -f $$ts; \ - ln -sf $(SHLIB) $$ts; \ + ln -s $(SHLIB) $$ts; \ else true; fi rm -f $(SHLINK) - ln -sf $(SHLIB) $(SHLINK) + ln -s $(SHLIB) $(SHLINK) # This target creates libTARGET-bfd.so.VERSION as a symlink to # libbfd.so.VERSION. It is used on SunOS, which does not have SONAME. @@ -519,10 +553,18 @@ tf=lib`echo $(SHLIB) | sed -e 's/^lib//' | sed '$(program_transform_name)'`; \ if [ "$$tf" != "$(SHLIB)" ]; then \ rm -f $$tf; \ - ln -sf $(SHLIB) $$tf; \ + ln -s $(SHLIB) $$tf; \ else true; fi touch stamp-tshlink +# This file holds an array associating configuration triplets and +# vector names. It is built from config.bfd. It is not compiled by +# itself, but is included by targets.c. +targmatch.h: config.bfd targmatch.sed + rm -f targmatch.h + sed -f $(srcdir)/targmatch.sed < $(srcdir)/config.bfd > targmatch.new + mv -f targmatch.new targmatch.h + # When compiling archures.c and targets.c, supply the default target # info from configure. @@ -563,17 +605,22 @@ etags $(INCDIR)/*.h $(srcdir)/*.h $(srcdir)/*.c do_mostlyclean: - rm -f *.o *~ core *.E *.p *.ip aout-params.h gen-aout config.log \ - pic/*.o + rm -f *.o *~ core *.E *.p *.ip aout-params.h gen-aout pic/*.o do_clean: do_mostlyclean - rm -f libbfd.a TAGS bfd.h stmp-bfd.h ofiles stamp-ofiles \ + rm -f libbfd.a TAGS bfd.h stmp-bfd.h bfd-tmp.h ofiles stamp-ofiles \ elf32-target.h elf64-target.h $(SHLIB) $(SHLINK) \ - piclist stamp-piclist + piclist stamp-piclist targmatch.h do_distclean: do_clean - rm -f Makefile config.status config.cache config.h stamp-h + rm -f Makefile config.status config.cache config.h config.log \ + stamp-h bfd-in3.h rm -rf pic stamp-picdir + +# do_maintainer_clean really should remove bfd-in2.h, since it is a +# generated file. However, the GNU standards say that +# maintainer-clean should not delete anything which needs to exist in +# order to run configure, and bfd-in2.h is used by configure. do_maintainer_clean: do_distclean - rm -f $(srcdir)/bfd-in2.h $(srcdir)/libbfd.h $(srcdir)/libcoff.h + rm -f $(srcdir)/libbfd.h $(srcdir)/libcoff.h mostlyclean: do_mostlyclean $(MAKE) subdir_do DO=mostlyclean "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) @@ -588,7 +635,7 @@ $(MAKE) subdir_do DO=maintainer-clean "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) $(MAKE) do_maintainer_clean -BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h +BFD_H_DEPS= $(INCDIR)/ansidecl.h LOCAL_H_DEPS= libbfd.h sysdep.h config.h $(BFD_LIBS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) $(BFD_MACHINES): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) @@ -656,9 +703,9 @@ rm -f $(libdir)/$$tf; \ if [ "$$f" = "$(SHLINK)" ]; then \ ts=lib`echo $(SHLIB) | sed -e 's/^lib//' | sed '$(program_transform_name)'`; \ - ln -sf $$ts $(libdir)/$$tf; \ + ln -s $$ts $(libdir)/$$tf; \ elif [ "$$f" = "$(SHLIB)" ]; then \ - $(INSTALL_PROGRAM) $$f $(libdir)/$$tf; \ + @INSTALL_SHLIB@ \ else \ $(INSTALL_DATA) $$f $(libdir)/$$tf; \ $(RANLIB) $(libdir)/$$tf; \ @@ -671,15 +718,13 @@ $(INSTALL_DATA) $(BFD_H) $(includedir)/bfd.h $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(includedir)/ansidecl.h $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(includedir)/bfdlink.h - $(INSTALL_DATA) $(INCDIR)/obstack.h $(includedir)/obstack.h -if test -z "$(oldincludedir)"; then true; else \ test -d $(oldincludedir) || mkdir $(oldincludedir); \ $(INSTALL_DATA) $(BFD_H) $(oldincludedir)/bfd.h; \ $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(oldincludedir)/ansidecl.h; \ $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(oldincludedir)/bfdlink.h; \ - $(INSTALL_DATA) $(INCDIR)/obstack.h $(oldincludedir)/obstack.h; \ - $(MAKE) subdir_do DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS); \ fi + $(MAKE) subdir_do DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) Makefile: Makefile.in config.status CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status @@ -709,7 +754,7 @@ $(DEP) -f .dep2a $(ALL_CFLAGS) $? sed -e '/DO NOT DELETE/d' -e '/^$$/d' < .dep2a >> .dep2 rm -f .dep2a - $(srcdir)/../move-if-change .dep2 .dep1 + $(SHELL) $(srcdir)/../move-if-change .dep2 .dep1 dep.sed: dep-in.sed config.status sed <$(srcdir)/dep-in.sed >dep.sed \ @@ -720,12 +765,12 @@ dep: .dep sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile cat .dep >> tmp-Makefile - $(srcdir)/../move-if-change tmp-Makefile Makefile + $(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile dep-in: .dep sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in cat .dep >> tmp-Makefile.in - $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in + $(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in host-aout.o: Makefile @@ -740,40 +785,40 @@ $(BFD_H): stmp-bfd.h ; @true -stmp-bfd.h : $(srcdir)/bfd-in2.h Makefile - rm -f bfd.h-new - sed -e 's/@WORDSIZE@/$(WORDSIZE)/' \ - -e "s/@VERSION@/`cat $(srcdir)/VERSION`/" \ - -e 's/@BFD_HOST_64BIT_LONG@/@HOST_64BIT_LONG@/' \ - < $(srcdir)/bfd-in2.h \ - > bfd.h-new - $(srcdir)/../move-if-change bfd.h-new $(BFD_H) +stmp-bfd.h: bfd-in3.h + rm -f bfd-tmp.h + cp bfd-in3.h bfd-tmp.h + $(SHELL) $(srcdir)/../move-if-change bfd-tmp.h $(BFD_H) + rm -f bfd-tmp.h touch stmp-bfd.h +bfd-in3.h: bfd-in2.h config.status + CONFIG_FILES=bfd-in3.h:bfd-in2.h CONFIG_HEADERS= $(SHELL) ./config.status + # Could really use a "copy-if-change"... headers: (cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS)) cp $(docdir)/bfd.h bfd-in2.h-new - $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h + $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h cp $(docdir)/libbfd.h libbfd.h-new - $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h + $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h cp $(docdir)/libcoff.h libcoff.h-new - $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h + $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h # The rules for the generated header files are here so that people can # type `make bfd-in2.h' if they remove it. They are not run by default. $(srcdir)/bfd-in2.h: (cd $(docdir); $(MAKE) bfd.h $(FLAGS_TO_PASS)) cp $(docdir)/bfd.h bfd-in2.h-new - $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h + $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h $(srcdir)/libbfd.h: (cd $(docdir); $(MAKE) libbfd.h $(FLAGS_TO_PASS)) cp $(docdir)/libbfd.h libbfd.h-new - $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h + $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h $(srcdir)/libcoff.h: (cd $(docdir); $(MAKE) libcoff.h $(FLAGS_TO_PASS)) cp $(docdir)/libcoff.h libcoff.h-new - $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h + $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h bfd.info: (cd $(docdir); $(MAKE) bfd.info $(FLAGS_TO_PASS)) @@ -785,6 +830,13 @@ (cd $(docdir); $(MAKE) bfd.ps $(FLAGS_TO_PASS)) +elf32-d10v.o: elf32-d10v.c elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + elf32-target.h + + + + $(OFILES): stamp-picdir stamp-picdir: @@ -799,10 +851,10 @@ # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. archive.o: archive.c $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h archures.o: archures.c -bfd.o: bfd.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h +bfd.o: bfd.c $(INCDIR)/libiberty.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h libcoff.h \ + libecoff.h $(INCDIR)/coff/ecoff.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h cache.o: cache.c coffgen.o: coffgen.c $(INCDIR)/coff/internal.h libcoff.h \ $(INCDIR)/bfdlink.h @@ -810,13 +862,13 @@ format.o: format.c init.o: init.c libbfd.o: libbfd.c -opncls.o: opncls.c +opncls.o: opncls.c $(INCDIR)/objalloc.h reloc.o: reloc.c $(INCDIR)/bfdlink.h section.o: section.c syms.o: syms.c $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def -targets.o: targets.c -hash.o: hash.c +targets.o: targets.c $(INCDIR)/fnmatch.h targmatch.h +hash.o: hash.c $(INCDIR)/objalloc.h linker.o: linker.c $(INCDIR)/bfdlink.h genlink.h elf.o: elf.c $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h @@ -836,9 +888,12 @@ cpu-i386.o: cpu-i386.c cpu-i860.o: cpu-i860.c cpu-i960.o: cpu-i960.c +cpu-m32r.o: cpu-m32r.c cpu-m68k.o: cpu-m68k.c cpu-m88k.o: cpu-m88k.c cpu-mips.o: cpu-mips.c +cpu-m10200.o: cpu-m10200.c +cpu-m10300.o: cpu-m10300.c cpu-ns32k.o: cpu-ns32k.c ns32k.h cpu-powerpc.o: cpu-powerpc.c cpu-rs6000.o: cpu-rs6000.c @@ -850,8 +905,15 @@ cpu-z8k.o: cpu-z8k.c aout-adobe.o: aout-adobe.c $(INCDIR)/aout/adobe.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def libaout.h $(INCDIR)/bfdlink.h +aout-arm.o: aout-arm.c libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h aoutx.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h aout-ns32k.o: aout-ns32k.c $(INCDIR)/aout/aout64.h \ ns32k.h libaout.h $(INCDIR)/bfdlink.h +aout-sparcle.o: aout-sparcle.c $(INCDIR)/bfdlink.h \ + libaout.h aoutf1.h $(INCDIR)/aout/sun4.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ + aout-target.h aout0.o: aout0.c aoutf1.h $(INCDIR)/aout/sun4.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h @@ -911,6 +973,9 @@ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h coff-sparc.o: coff-sparc.c $(INCDIR)/coff/sparc.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h +coff-svm68k.o: coff-svm68k.c coff-m68k.c $(INCDIR)/coff/m68k.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h coff-u68k.o: coff-u68k.c coff-m68k.c $(INCDIR)/coff/m68k.h \ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h @@ -927,9 +992,10 @@ libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ libcoff.h libecoff.h -ecofflink.o: ecofflink.c $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h +ecofflink.o: ecofflink.c $(INCDIR)/bfdlink.h $(INCDIR)/objalloc.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ + libcoff.h libecoff.h elf32-gen.o: elf32-gen.c elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ elf32-target.h @@ -943,6 +1009,9 @@ elf32-i860.o: elf32-i860.c elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ elf32-target.h +elf32-m32r.o: elf32-m32r.c elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/m32r.h elf32-target.h elf32-m68k.o: elf32-m68k.c $(INCDIR)/bfdlink.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ elf32-target.h @@ -955,28 +1024,44 @@ $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h ecoffswap.h \ elf32-target.h +elf-m10200.o: elf-m10200.c elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + elf32-target.h +elf-m10300.o: elf-m10300.c elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + elf32-target.h elf32-ppc.o: elf32-ppc.c $(INCDIR)/bfdlink.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/elf/ppc.h elf32-target.h +elf32-sh.o: elf32-sh.c $(INCDIR)/bfdlink.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + elf32-target.h elf32-sparc.o: elf32-sparc.c $(INCDIR)/bfdlink.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/elf/sparc.h elf32-target.h elf32.o: elf32.c elfcode.h $(INCDIR)/bfdlink.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - elfcore.h elflink.h + $(INCDIR)/fnmatch.h elfcore.h elflink.h elflink.o: elflink.c $(INCDIR)/bfdlink.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h +hp300bsd.o: hp300bsd.c libaout.h $(INCDIR)/bfdlink.h \ + aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h hp300hpux.o: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \ aoutx.h $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ aout-target.h som.o: som.c -i386aout.o: i386aout.c libaout.h $(INCDIR)/bfdlink.h \ - aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ +i386aout.o: i386aout.c $(INCDIR)/aout/aout64.h libaout.h \ + $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h i386bsd.o: i386bsd.c libaout.h $(INCDIR)/bfdlink.h \ aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +i386dynix.o: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ + aout-target.h i386freebsd.o: i386freebsd.c freebsd.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 @@ -996,6 +1081,9 @@ i386os9k.o: i386os9k.c $(INCDIR)/bfdlink.h libaout.h \ $(INCDIR)/os9k.h ieee.o: ieee.c $(INCDIR)/ieee.h libieee.h +m68k4knetbsd.o: m68k4knetbsd.c netbsd.h libaout.h $(INCDIR)/bfdlink.h \ + aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h m68klinux.o: m68klinux.c $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h libaout.h \ $(INCDIR)/bfdlink.h aout-target.h @@ -1055,6 +1143,12 @@ ppcboot.o: ppcboot.c reloc16.o: reloc16.c $(INCDIR)/bfdlink.h genlink.h \ $(INCDIR)/coff/internal.h libcoff.h +riscix.o: riscix.c libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + aout-target.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +sparclinux.o: sparclinux.c $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h sparclynx.o: sparclynx.c $(INCDIR)/aout/sun4.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h @@ -1086,8 +1180,8 @@ elf64-gen.o: elf64-gen.c elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ elf64-target.h -elf64-mips.o: elf64-mips.c $(INCDIR)/bfdlink.h genlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ +elf64-mips.o: elf64-mips.c $(INCDIR)/aout/ar.h $(INCDIR)/bfdlink.h \ + genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/coff/sym.h \ $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h ecoffswap.h \ @@ -1097,7 +1191,7 @@ $(INCDIR)/elf/sparc.h elf64-target.h elf64.o: elf64.c elfcode.h $(INCDIR)/bfdlink.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - elfcore.h elflink.h + $(INCDIR)/fnmatch.h elfcore.h elflink.h evax-alpha.o: evax-alpha.c $(INCDIR)/bfdlink.h evax.h evax-egsd.o: evax-egsd.c $(INCDIR)/bfdlink.h evax.h evax-etir.o: evax-etir.c $(INCDIR)/bfdlink.h evax.h @@ -1116,11 +1210,4 @@ osf-core.o: osf-core.c trad-core.o: trad-core.c libaout.h $(INCDIR)/bfdlink.h cisco-core.o: cisco-core.c -i386dynix.o: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \ - $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h -hp300bsd.o: hp300bsd.c libaout.h $(INCDIR)/bfdlink.h \ - aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff -urN binutils-2.7/bfd/README binutils-2.8/bfd/README --- binutils-2.7/bfd/README Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/README Wed Apr 30 12:55:45 1997 @@ -0,0 +1,48 @@ +BFD is a an object file library. It permits applications to use the +same routines to process object files regardless of their format. + +BFD is used by the GNU debugger, assembler, linker, and the binary +utilities. + +The documentation on using BFD is scanty and may be occasionally +incorrect. Pointers to documentation problems, or an entirely +rewritten manual, would be appreciated. + +BFD is normally built as part of another package. See the build +instructions for that package, probably in a README file in the +appropriate directory. + +BFD supports the following configure options: + + --target=TARGET + The default target for which to build the library. TARGET is + a configuration target triplet, such as sparc-sun-solaris. + --enable-targets=TARGET,TARGET,TARGET... + Additional targets the library should support. To include + support for all known targets, use --enable-targets=all. + --enable-64-bit-bfd + Include support for 64 bit targets. This is automatically + turned on if you explicitly request a 64 bit target, but not + for --enable-targets=all. This requires a compiler with a 64 + bit integer type, such as gcc. + --enable-shared + Build BFD as a shared library. + --enable-commonbfdlib + Build BFD, opcodes, and libiberty as a single shared library. + --with-mmap + Use mmap when accessing files. This is faster on some hosts, + but slower on others. It may not work on all hosts. + +Report bugs with BFD to bug-gnu-utils@prep.ai.mit.edu. + +Patches are encouraged. When sending patches, always send the output +of diff -u or diff -c from the original file to the new file. Do not +send default diff output. Do not make the diff from the new file to +the original file. Remember that any patch must not break other +systems. Remember that BFD must support cross compilation from any +host to any target, so patches which use ``#ifdef HOST'' are not +acceptable. Please also read the ``Reporting Bugs'' section of the +gcc manual. + +Bug reports without patches will be remembered, but they may never get +fixed until somebody volunteers to fix them. diff -urN binutils-2.7/bfd/TODO binutils-2.8/bfd/TODO --- binutils-2.7/bfd/TODO Thu Jul 4 12:17:31 1996 +++ binutils-2.8/bfd/TODO Wed Apr 30 12:55:45 1997 @@ -4,7 +4,7 @@ is in a single bfd_target structure. Hence all the code for *writing* object files is still pulled into all the applications that only care about *reading* (gdb, nm, objdump), while gas has - to carry along all the unneded baggage for reading objects. And + to carry along all the unneeded baggage for reading objects. And so on. This would be a substantial change, and the payoff would not all that great (essentially none if bfd is used as a shared library). diff -urN binutils-2.7/bfd/VERSION binutils-2.8/bfd/VERSION --- binutils-2.7/bfd/VERSION Thu Jul 4 15:28:15 1996 +++ binutils-2.8/bfd/VERSION Wed Apr 30 12:55:45 1997 @@ -1 +1 @@ -2.7 +2.8 diff -urN binutils-2.7/bfd/acconfig.h binutils-2.8/bfd/acconfig.h --- binutils-2.7/bfd/acconfig.h Thu Jul 4 12:17:31 1996 +++ binutils-2.8/bfd/acconfig.h Wed Apr 30 12:55:45 1997 @@ -1,9 +1,18 @@ +/* Whether strstr must be declared even if is included. */ +#undef NEED_DECLARATION_STRSTR + /* Whether malloc must be declared even if is included. */ #undef NEED_DECLARATION_MALLOC +/* Whether realloc must be declared even if is included. */ +#undef NEED_DECLARATION_REALLOC + /* Whether free must be declared even if is included. */ #undef NEED_DECLARATION_FREE + +/* Whether getenv must be declared even if is included. */ +#undef NEED_DECLARATION_GETENV @TOP@ /* Do we need to use the b modifier when opening binary files? */ diff -urN binutils-2.7/bfd/aclocal.m4 binutils-2.8/bfd/aclocal.m4 --- binutils-2.7/bfd/aclocal.m4 Thu Jul 4 12:17:31 1996 +++ binutils-2.8/bfd/aclocal.m4 Wed Apr 30 12:55:45 1997 @@ -3,7 +3,7 @@ [AC_REQUIRE([AC_CANONICAL_SYSTEM]) case "${host}" in changequote(,)dnl -i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32) +i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32 | *-*-windows) changequote([,])dnl AC_DEFINE(USE_BINARY_FOPEN) ;; esac])dnl @@ -11,7 +11,6 @@ dnl Get a default for CC_FOR_BUILD to put into Makefile. AC_DEFUN(BFD_CC_FOR_BUILD, [# Put a plausible default for CC_FOR_BUILD in Makefile. -AC_REQUIRE([AC_C_CROSS])dnl if test -z "$CC_FOR_BUILD"; then if test "x$cross_compiling" = "xno"; then CC_FOR_BUILD='$(CC)' @@ -27,6 +26,13 @@ AC_CACHE_VAL(bfd_cv_decl_needed_$1, [AC_TRY_COMPILE([ #include +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif #ifdef HAVE_STDLIB_H #include #endif diff -urN binutils-2.7/bfd/aix386-core.c binutils-2.8/bfd/aix386-core.c --- binutils-2.7/bfd/aix386-core.c Thu Jul 4 12:17:31 1996 +++ binutils-2.8/bfd/aix386-core.c Wed Apr 30 12:55:45 1997 @@ -1,7 +1,8 @@ /* BFD back-end for AIX on PS/2 core files. This was based on trad-core.c, which was written by John Gilmore of Cygnus Support. - Copyright 1988, 1989, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1988, 89, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. Written by Minh Tran-Le . Converted to back end form by Ian Lance Taylor . @@ -24,7 +25,6 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/i386.h" #include "coff/internal.h" #include "libcoff.h" @@ -68,6 +68,8 @@ asection *sections[MAX_CORE_SEGS]; }; +static void swap_abort PARAMS ((void)); + static const bfd_target * aix386_core_file_p (abfd) bfd *abfd; @@ -234,7 +236,7 @@ } /* If somebody calls any byte-swapping routines, shoot them. */ -void +static void swap_abort() { abort(); /* This way doesn't require any declaration for ANSI to fuck up */ diff -urN binutils-2.7/bfd/aout-adobe.c binutils-2.8/bfd/aout-adobe.c --- binutils-2.7/bfd/aout-adobe.c Thu Jul 4 12:17:31 1996 +++ binutils-2.8/bfd/aout-adobe.c Wed Apr 30 12:55:45 1997 @@ -112,8 +112,6 @@ take just about any a.out file as an Adobe a.out file. FIXME! */ if (N_BADMAG (anexec)) { - extern char *getenv (); - targ = getenv ("GNUTARGET"); if (targ && !strcmp (targ, a_out_adobe_vec.name)) ; /* Just continue anyway, if specifically set to this format */ diff -urN binutils-2.7/bfd/aout-arm.c binutils-2.8/bfd/aout-arm.c --- binutils-2.7/bfd/aout-arm.c Thu Jul 4 12:17:32 1996 +++ binutils-2.8/bfd/aout-arm.c Wed Apr 30 12:55:45 1997 @@ -1,5 +1,5 @@ /* BFD back-end for raw ARM a.out binaries. - Copyright (C) 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) This file is part of BFD, the Binary File Descriptor library. @@ -38,7 +38,6 @@ #include "bfd.h" #include "sysdep.h" -#include "assert.h" #define MYARM(OP) CAT(aoutarm_,OP) reloc_howto_type *MYARM(bfd_reloc_type_lookup) @@ -348,7 +347,6 @@ { int r_index; int r_extern; - unsigned int r_length; int r_pcrel; struct aoutdata *su = &(abfd->tdata.aout_data->a); diff -urN binutils-2.7/bfd/aout-sparcle.c binutils-2.8/bfd/aout-sparcle.c --- binutils-2.7/bfd/aout-sparcle.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/aout-sparcle.c Wed Apr 30 12:55:46 1997 @@ -0,0 +1,32 @@ +/* BFD backend for sparc little-endian aout binaries. + Copyright (C) 1996 Free Software Foundation, Inc. + Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#define TARGETNAME "a.out-sparc-little" +#define MY(OP) CAT(sparcle_aout_,OP) + +#include "bfd.h" +#include "bfdlink.h" +#include "libaout.h" + +#define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_SPARCLET) + +/* Include the usual a.out support. */ +#define TARGET_IS_LITTLE_ENDIAN_P +#include "aoutf1.h" diff -urN binutils-2.7/bfd/aout-target.h binutils-2.8/bfd/aout-target.h --- binutils-2.7/bfd/aout-target.h Thu Jul 4 12:17:33 1996 +++ binutils-2.8/bfd/aout-target.h Wed Apr 30 12:55:46 1997 @@ -1,5 +1,6 @@ /* Define a target vector and some small routines for a variant of a.out. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -22,11 +23,19 @@ #include "aout/ar.h" /*#include "libaout.h"*/ -extern reloc_howto_type * NAME(aout,reloc_type_lookup) (); +#ifndef SEGMENT_SIZE +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#endif + +extern reloc_howto_type * NAME(aout,reloc_type_lookup) + PARAMS ((bfd *, bfd_reloc_code_real_type)); /* Set parameters about this a.out file that are machine-dependent. This routine is called from some_aout_object_p just before it returns. */ #ifndef MY_callback + +static const bfd_target *MY(callback) PARAMS ((bfd *)); + static const bfd_target * MY(callback) (abfd) bfd *abfd; @@ -43,6 +52,23 @@ obj_datasec (abfd)->vma = N_DATADDR(*execp); obj_bsssec (abfd)->vma = N_BSSADDR(*execp); + /* For some targets, if the entry point is not in the same page + as the start of the text, then adjust the VMA so that it is. + FIXME: Do this with a macro like SET_ARCH_MACH instead? */ + if (aout_backend_info (abfd)->entry_is_text_address + && execp->a_entry > obj_textsec (abfd)->vma) + { + bfd_vma adjust; + + adjust = execp->a_entry - obj_textsec (abfd)->vma; + /* Adjust only by whole pages. */ + adjust &= ~(TARGET_PAGE_SIZE - 1); + obj_textsec (abfd)->vma += adjust; + obj_datasec (abfd)->vma += adjust; + obj_bsssec (abfd)->vma += adjust; + } + + /* Set the load addresses to be the same as the virtual addresses. */ obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; @@ -66,6 +92,15 @@ bfd_default_set_arch_mach(abfd, DEFAULT_ARCH, 0); #endif + /* The number of relocation records. This must be called after + SET_ARCH_MACH. It assumes that SET_ARCH_MACH will set + obj_reloc_entry_size correctly, if the reloc size is not + RELOC_STD_SIZE. */ + obj_textsec (abfd)->reloc_count = + execp->a_trsize / obj_reloc_entry_size (abfd); + obj_datasec (abfd)->reloc_count = + execp->a_drsize / obj_reloc_entry_size (abfd); + /* Now that we know the architecture, set the alignments of the sections. This is normally done by NAME(aout,new_section_hook), but when the initial sections were created the architecture had @@ -90,11 +125,7 @@ Sizes get set in set_sizes callback, later. */ #if 0 adata(abfd).page_size = TARGET_PAGE_SIZE; -#ifdef SEGMENT_SIZE adata(abfd).segment_size = SEGMENT_SIZE; -#else - adata(abfd).segment_size = TARGET_PAGE_SIZE; -#endif adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; #endif @@ -105,6 +136,8 @@ #ifndef MY_object_p /* Finish up the reading of an a.out file header */ +static const bfd_target *MY(object_p) PARAMS ((bfd *)); + static const bfd_target * MY(object_p) (abfd) bfd *abfd; @@ -166,6 +199,9 @@ #ifndef MY_mkobject + +static boolean MY(mkobject) PARAMS ((bfd *)); + static boolean MY(mkobject) (abfd) bfd *abfd; @@ -175,11 +211,7 @@ #if 0 /* Sizes get set in set_sizes callback, later, after we know the architecture and machine. */ adata(abfd).page_size = TARGET_PAGE_SIZE; -#ifdef SEGMENT_SIZE adata(abfd).segment_size = SEGMENT_SIZE; -#else - adata(abfd).segment_size = TARGET_PAGE_SIZE; -#endif adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; #endif return true; @@ -195,6 +227,9 @@ section contents, and copy_private_bfd_data is not called until after the section contents have been set. */ +static boolean MY_bfd_copy_private_section_data + PARAMS ((bfd *, asection *, bfd *, asection *)); + /*ARGSUSED*/ static boolean MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec) @@ -203,7 +238,8 @@ bfd *obfd; asection *osec; { - if (bfd_get_flavour (obfd) == bfd_target_aout_flavour) + if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour + && bfd_get_flavour (obfd) == bfd_target_aout_flavour) obj_aout_subformat (obfd) = obj_aout_subformat (ibfd); return true; } @@ -236,17 +272,15 @@ #endif #ifndef MY_set_sizes + +static boolean MY(set_sizes) PARAMS ((bfd *)); + static boolean MY(set_sizes) (abfd) bfd *abfd; { adata(abfd).page_size = TARGET_PAGE_SIZE; - -#ifdef SEGMENT_SIZE adata(abfd).segment_size = SEGMENT_SIZE; -#else - adata(abfd).segment_size = TARGET_PAGE_SIZE; -#endif #ifdef ZMAGIC_DISK_BLOCK_SIZE adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE; @@ -272,6 +306,9 @@ #ifndef MY_text_includes_header #define MY_text_includes_header 0 #endif +#ifndef MY_entry_is_text_address +#define MY_entry_is_text_address 0 +#endif #ifndef MY_exec_header_not_counted #define MY_exec_header_not_counted 0 #endif @@ -297,6 +334,7 @@ static CONST struct aout_backend_data MY(backend_data) = { MY_zmagic_contiguous, MY_text_includes_header, + MY_entry_is_text_address, MY_exec_hdr_flags, 0, /* text vma? */ MY_set_sizes, @@ -339,6 +377,8 @@ /* Final link routine. We need to use a call back to get the correct offsets in the output file. */ +static boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *)); + static boolean MY_bfd_final_link (abfd, info) bfd *abfd; @@ -512,8 +552,8 @@ #define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags #endif -#ifndef MY_bfd_is_local_label -#define MY_bfd_is_local_label bfd_generic_is_local_label +#ifndef MY_bfd_is_local_label_name +#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name #endif #ifndef MY_bfd_free_cached_info diff -urN binutils-2.7/bfd/aoutf1.h binutils-2.8/bfd/aoutf1.h --- binutils-2.7/bfd/aoutf1.h Thu Jul 4 12:17:33 1996 +++ binutils-2.8/bfd/aoutf1.h Wed Apr 30 12:55:47 1997 @@ -1,5 +1,5 @@ /* A.out "format 1" file handling code for BFD. - Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -65,13 +65,52 @@ /*SUPPRESS558*/ /*SUPPRESS529*/ -static void #if ARCH_SIZE == 64 -sunos_64_set_arch_mach +#define sunos_set_arch_mach sunos_64_set_arch_mach +#define sunos_write_object_contents aout_64_sunos4_write_object_contents #else -sunos_32_set_arch_mach +#define sunos_set_arch_mach sunos_32_set_arch_mach +#define sunos_write_object_contents aout_32_sunos4_write_object_contents #endif - (abfd, machtype) + +static boolean sunos_merge_private_bfd_data PARAMS ((bfd *, bfd *)); +static void sunos_set_arch_mach PARAMS ((bfd *, int)); +static void choose_reloc_size PARAMS ((bfd *)); +static boolean sunos_write_object_contents PARAMS ((bfd *)); +static const bfd_target *sunos4_core_file_p PARAMS ((bfd *)); +static char *sunos4_core_file_failing_command PARAMS ((bfd *)); +static int sunos4_core_file_failing_signal PARAMS ((bfd *)); +static boolean sunos4_core_file_matches_executable_p PARAMS ((bfd *, bfd *)); +static boolean sunos4_set_sizes PARAMS ((bfd *)); + +/* Merge backend data into the output file. + This is necessary on sparclet-aout where we want the resultant machine + number to be M_SPARCLET if any input file is M_SPARCLET. */ + +#define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data + +static boolean +sunos_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd, *obfd; +{ + if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour + || bfd_get_flavour (obfd) != bfd_target_aout_flavour) + return true; + + if (bfd_get_arch (obfd) == bfd_arch_sparc) + { + if (bfd_get_mach (obfd) < bfd_get_mach (ibfd)) + bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd)); + } + + return true; +} + +/* This is either sunos_32_set_arch_mach or sunos_64_set_arch_mach, + depending upon ARCH_SIZE. */ + +static void +sunos_set_arch_mach (abfd, machtype) bfd *abfd; int machtype; { @@ -155,17 +194,14 @@ } } -/* Write an object file in SunOS format. - Section contents have already been written. We write the - file header, symbols, and relocation. */ +/* Write an object file in SunOS format. Section contents have + already been written. We write the file header, symbols, and + relocation. The real name of this function is either + aout_64_sunos4_write_object_contents or + aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */ static boolean -#if ARCH_SIZE == 64 -aout_64_sunos4_write_object_contents -#else -aout_32_sunos4_write_object_contents -#endif - (abfd) +sunos_write_object_contents (abfd) bfd *abfd; { struct external_exec exec_bytes; @@ -361,6 +397,13 @@ int c_ucode; /* Exception no. from u_code */ }; +static void swapcore_sun3 + PARAMS ((bfd *, char *, struct internal_sunos_core *)); +static void swapcore_sparc + PARAMS ((bfd *, char *, struct internal_sunos_core *)); +static void swapcore_solaris_bcp + PARAMS ((bfd *, char *, struct internal_sunos_core *)); + /* byte-swap in the Sun-3 core structure */ static void swapcore_sun3 (abfd, ext, intcore) @@ -749,6 +792,9 @@ #define MY_exec_hdr_flags 1 #endif +#ifndef MY_entry_is_text_address +#define MY_entry_is_text_address 0 +#endif #ifndef MY_add_dynamic_symbols #define MY_add_dynamic_symbols 0 #endif @@ -772,6 +818,7 @@ { 0, /* zmagic files are not contiguous */ 1, /* text includes header */ + MY_entry_is_text_address, MY_exec_hdr_flags, 0, /* default text vma */ sunos4_set_sizes, @@ -796,6 +843,8 @@ #define MY_write_object_contents NAME(aout,sunos4_write_object_contents) #define MY_backend_data &sunos4_aout_backend +#ifndef TARGET_IS_LITTLE_ENDIAN_P #define TARGET_IS_BIG_ENDIAN_P +#endif #include "aout-target.h" diff -urN binutils-2.7/bfd/aoutx.h binutils-2.8/bfd/aoutx.h --- binutils-2.7/bfd/aoutx.h Thu Jul 4 12:17:37 1996 +++ binutils-2.8/bfd/aoutx.h Wed Apr 30 12:55:47 1997 @@ -1,5 +1,5 @@ /* BFD semi-generic back-end for a.out binaries. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -136,6 +136,9 @@ PARAMS ((bfd *, aout_symbol_type *)); static boolean translate_to_native_sym_flags PARAMS ((bfd *, asymbol *, struct external_nlist *)); +static void adjust_o_magic PARAMS ((bfd *, struct internal_exec *)); +static void adjust_z_magic PARAMS ((bfd *, struct internal_exec *)); +static void adjust_n_magic PARAMS ((bfd *, struct internal_exec *)); /* SUBSECTION @@ -449,7 +452,7 @@ execp = abfd->tdata.aout_data->a.hdr; /* Set the file flags */ - abfd->flags = NO_FLAGS; + abfd->flags = BFD_NO_FLAGS; if (execp->a_drsize || execp->a_trsize) abfd->flags |= HAS_RELOC; /* Setting of EXEC_P has been deferred to the bottom of this function */ @@ -582,9 +585,20 @@ guess at whether the file is executable. If the entry point is within the text segment, assume it is. (This makes files executable even if their entry point address is 0, as long as - their text starts at zero.). */ - if ((execp->a_entry >= obj_textsec(abfd)->vma) && - (execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size)) + their text starts at zero.). + + This test had to be changed to deal with systems where the text segment + runs at a different location than the default. The problem is that the + entry address can appear to be outside the text segment, thus causing an + erroneous conclusion that the file isn't executable. + + To fix this, we now accept any non-zero entry point as an indication of + executability. This will work most of the time, since only the linker + sets the entry point, and that is likely to be non-zero for most systems. */ + + if (execp->a_entry != 0 + || (execp->a_entry >= obj_textsec(abfd)->vma + && execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size)) abfd->flags |= EXEC_P; #ifdef STAT_FOR_EXEC else @@ -1236,7 +1250,7 @@ syms = (struct external_nlist *) obj_aout_sym_window (abfd).data; #else /* We allocate using malloc to make the values easy to free - later on. If we put them on the obstack it might not be + later on. If we put them on the objalloc it might not be possible to free them. */ syms = ((struct external_nlist *) bfd_malloc ((size_t) count * EXTERNAL_NLIST_SIZE)); @@ -1941,6 +1955,9 @@ /* Standard reloc stuff */ /* Output standard relocation information to a file in target byte order. */ +extern void NAME(aout,swap_std_reloc_out) + PARAMS ((bfd *, arelent *, struct reloc_std_external *)); + void NAME(aout,swap_std_reloc_out) (abfd, g, natptr) bfd *abfd; @@ -2036,6 +2053,9 @@ /* Extended stuff */ /* Output extended relocation information to a file in target byte order. */ +extern void NAME(aout,swap_ext_reloc_out) + PARAMS ((bfd *, arelent *, struct reloc_ext_external *)); + void NAME(aout,swap_ext_reloc_out) (abfd, g, natptr) bfd *abfd; @@ -4262,10 +4282,8 @@ case discard_none: break; case discard_l: - if (*name == *finfo->info->lprefix - && (finfo->info->lprefix_len == 1 - || strncmp (name, finfo->info->lprefix, - finfo->info->lprefix_len) == 0)) + if ((type & N_STAB) == 0 + && bfd_is_local_label_name (input_bfd, name)) skip = true; break; case discard_all: @@ -5085,12 +5103,20 @@ { /* We are generating a relocateable output file, and must modify the reloc accordingly. */ - if (r_extern) + if (r_extern + || r_type == RELOC_BASE10 + || r_type == RELOC_BASE13 + || r_type == RELOC_BASE22) { /* If we know the symbol this relocation is against, convert it into a relocation against a section. This is what the native linker does. */ - h = sym_hashes[r_index]; + if (r_type == RELOC_BASE10 + || r_type == RELOC_BASE13 + || r_type == RELOC_BASE22) + h = NULL; + else + h = sym_hashes[r_index]; if (h != (struct aout_link_hash_entry *) NULL && (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak)) @@ -5206,8 +5232,12 @@ } /* As described above, we must always adjust a PC relative - reloc by the change in VMA of the source. */ - if (howto_table_ext[r_type].pc_relative) + reloc by the change in VMA of the source. However, if + pcrel_offset is set, then the addend does not include the + location within the section, in which case we don't need + to adjust anything. */ + if (howto_table_ext[r_type].pc_relative + && ! howto_table_ext[r_type].pcrel_offset) relocation -= (input_section->output_section->vma + input_section->output_offset - input_section->vma); diff -urN binutils-2.7/bfd/archive.c binutils-2.8/bfd/archive.c --- binutils-2.7/bfd/archive.c Thu Jul 4 12:17:38 1996 +++ binutils-2.8/bfd/archive.c Wed Apr 30 12:55:47 1997 @@ -1,5 +1,5 @@ /* BFD back-end for archive files (libraries). - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault. This file is part of BFD, the Binary File Descriptor library. @@ -142,12 +142,9 @@ #define BFD_GNU960_ARMAG(abfd) (BFD_COFF_FILE_P((abfd)) ? ARMAG : ARMAGB) #endif -/* Can't define this in hosts/foo.h, because (e.g. in gprof) the hosts file - is included, then obstack.h, which thinks if offsetof is defined, it - doesn't need to include stddef.h. */ /* Define offsetof for those systems which lack it */ -#if !defined (offsetof) +#ifndef offsetof #define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) #endif @@ -780,7 +777,7 @@ ardata->first_file_filepos += (ardata->first_file_filepos) % 2; /* FIXME, we should provide some way to free raw_ardata when we are done using the strings from it. For now, it seems - to be allocated on an obstack anyway... */ + to be allocated on an objalloc anyway... */ bfd_has_map (abfd) = true; return true; } @@ -826,7 +823,9 @@ little, because our tools changed. Here's a horrible hack to clean up the crap. */ - if (stringsize > 0xfffff) + if (stringsize > 0xfffff + && bfd_get_arch (abfd) == bfd_arch_i960 + && bfd_get_flavour (abfd) == bfd_target_coff_flavour) { /* This looks dangerous, let's do it the other way around */ nsymz = bfd_getl32 ((PTR) int_buf); @@ -930,6 +929,12 @@ return do_slurp_bsd_armap (abfd); else if (!strncmp (nextname, "/ ", 16)) return do_slurp_coff_armap (abfd); + else if (!strncmp (nextname, "/SYM64/ ", 16)) + { + /* Irix 6 archive--must be recognized by code in elf64-mips.c. */ + bfd_set_error (bfd_error_wrong_format); + return false; + } bfd_has_map (abfd) = false; return true; @@ -1034,7 +1039,7 @@ ardata->first_file_filepos += (ardata->first_file_filepos) % 2; /* FIXME, we should provide some way to free raw_ardata when we are done using the strings from it. For now, it seems - to be allocated on an obstack anyway... */ + to be allocated on an objalloc anyway... */ bfd_has_map (abfd) = true; return true; } @@ -1117,7 +1122,7 @@ (bfd_ardata (abfd)->first_file_filepos) % 2; /* FIXME, we can't release namedata here because it was allocated - below extended_names on the obstack... */ + below extended_names on the objalloc... */ /* bfd_release (abfd, namedata); */ } return true; @@ -1720,7 +1725,7 @@ if (map == NULL) goto error_return; - /* We put the symbol names on the arch obstack, and then discard + /* We put the symbol names on the arch objalloc, and then discard them when done. */ first_name = bfd_alloc (arch, 1); if (first_name == NULL) @@ -1873,8 +1878,13 @@ bfd_ardata (arch)->armap_datepos = (SARMAG + offsetof (struct ar_hdr, ar_date[0])); sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp); +#ifndef _WIN32 sprintf (hdr.ar_uid, "%ld", (long) getuid ()); sprintf (hdr.ar_gid, "%ld", (long) getgid ()); +#else + sprintf (hdr.ar_uid, "%ld", (long) 666); + sprintf (hdr.ar_gid, "%ld", (long) 42); +#endif sprintf (hdr.ar_size, "%-10d", (int) mapsize); strncpy (hdr.ar_fmag, ARFMAG, 2); for (i = 0; i < sizeof (struct ar_hdr); i++) diff -urN binutils-2.7/bfd/archures.c binutils-2.8/bfd/archures.c --- binutils-2.7/bfd/archures.c Thu Jul 4 12:30:47 1996 +++ binutils-2.8/bfd/archures.c Wed Apr 30 12:55:47 1997 @@ -1,5 +1,5 @@ /* BFD library support routines for architectures. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Hacked by John Gilmore and Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -104,6 +104,8 @@ . ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a) . bfd_arch_mips, {* MIPS Rxxxx *} . bfd_arch_i386, {* Intel 386 *} +.#define bfd_mach_i386_i386 0 +.#define bfd_mach_i386_i8086 1 . bfd_arch_we32k, {* AT&T WE32xxx *} . bfd_arch_tahoe, {* CCI/Harris Tahoe *} . bfd_arch_i860, {* Intel 860 *} @@ -115,9 +117,11 @@ . bfd_arch_h8300, {* Hitachi H8/300 *} .#define bfd_mach_h8300 1 .#define bfd_mach_h8300h 2 +.#define bfd_mach_h8300s 3 . bfd_arch_powerpc, {* PowerPC *} . bfd_arch_rs6000, {* IBM RS/6000 *} . bfd_arch_hppa, {* HP PA RISC *} +. bfd_arch_d10v, {* Mitsubishi D10V *} . bfd_arch_z8k, {* Zilog Z8000 *} .#define bfd_mach_z8001 1 .#define bfd_mach_z8002 2 @@ -127,6 +131,9 @@ . bfd_arch_arm, {* Advanced Risc Machines ARM *} . bfd_arch_ns32k, {* National Semiconductors ns32000 *} . bfd_arch_w65, {* WDC 65816 *} +. bfd_arch_m32r, {* Mitsubishi M32R/D *} +. bfd_arch_mn10200, {* Matsushita MN10200 *} +. bfd_arch_mn10300, {* Matsushita MN10300 *} . bfd_arch_last . }; @@ -168,15 +175,19 @@ extern const bfd_arch_info_type bfd_a29k_arch; extern const bfd_arch_info_type bfd_alpha_arch; extern const bfd_arch_info_type bfd_arm_arch; +extern const bfd_arch_info_type bfd_d10v_arch; extern const bfd_arch_info_type bfd_h8300_arch; extern const bfd_arch_info_type bfd_h8500_arch; extern const bfd_arch_info_type bfd_hppa_arch; extern const bfd_arch_info_type bfd_i386_arch; extern const bfd_arch_info_type bfd_i860_arch; extern const bfd_arch_info_type bfd_i960_arch; +extern const bfd_arch_info_type bfd_m32r_arch; extern const bfd_arch_info_type bfd_m68k_arch; extern const bfd_arch_info_type bfd_m88k_arch; extern const bfd_arch_info_type bfd_mips_arch; +extern const bfd_arch_info_type bfd_mn10200_arch; +extern const bfd_arch_info_type bfd_mn10300_arch; extern const bfd_arch_info_type bfd_powerpc_arch; extern const bfd_arch_info_type bfd_rs6000_arch; extern const bfd_arch_info_type bfd_sh_arch; @@ -195,15 +206,19 @@ &bfd_a29k_arch, &bfd_alpha_arch, &bfd_arm_arch, + &bfd_d10v_arch, &bfd_h8300_arch, &bfd_h8500_arch, &bfd_hppa_arch, &bfd_i386_arch, &bfd_i860_arch, &bfd_i960_arch, + &bfd_m32r_arch, &bfd_m68k_arch, &bfd_m88k_arch, &bfd_mips_arch, + &bfd_mn10200_arch, + &bfd_mn10300_arch, &bfd_powerpc_arch, &bfd_rs6000_arch, &bfd_sh_arch, diff -urN binutils-2.7/bfd/bfd-in.h binutils-2.8/bfd/bfd-in.h --- binutils-2.7/bfd/bfd-in.h Thu Jul 4 12:17:39 1996 +++ binutils-2.8/bfd/bfd-in.h Wed Apr 30 12:55:47 1997 @@ -1,5 +1,5 @@ /* Main header file for the bfd library -- portable access to object files. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Contributed by Cygnus Support. ** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them; @@ -49,12 +49,15 @@ #endif #include "ansidecl.h" -#include "obstack.h" /* These two lines get substitutions done by commands in Makefile.in. */ #define BFD_VERSION "@VERSION@" -#define BFD_ARCH_SIZE @WORDSIZE@ +#define BFD_ARCH_SIZE @wordsize@ #define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@ +#if @BFD_HOST_64_BIT_DEFINED@ +#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@ +#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@ +#endif #if BFD_ARCH_SIZE >= 64 #define BFD64 @@ -114,27 +117,29 @@ /* Support for different sizes of target format ints and addresses. If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be set to 1 above. Otherwise, if gcc is being used, this code will - use gcc's "long long" type. Otherwise, the compilation will fail - if 64-bit targets are requested. */ + use gcc's "long long" type. Otherwise, BFD_HOST_64_BIT must be + defined above. */ #ifdef BFD64 #ifndef BFD_HOST_64_BIT #if BFD_HOST_64BIT_LONG #define BFD_HOST_64_BIT long +#define BFD_HOST_U_64_BIT unsigned long #else #ifdef __GNUC__ #define BFD_HOST_64_BIT long long +#define BFD_HOST_U_64_BIT unsigned long long #else /* ! defined (__GNUC__) */ #error No 64 bit integer type available #endif /* ! defined (__GNUC__) */ #endif /* ! BFD_HOST_64BIT_LONG */ #endif /* ! defined (BFD_HOST_64_BIT) */ -typedef unsigned BFD_HOST_64_BIT bfd_vma; +typedef BFD_HOST_U_64_BIT bfd_vma; typedef BFD_HOST_64_BIT bfd_signed_vma; -typedef unsigned BFD_HOST_64_BIT bfd_size_type; -typedef unsigned BFD_HOST_64_BIT symvalue; +typedef BFD_HOST_U_64_BIT bfd_size_type; +typedef BFD_HOST_U_64_BIT symvalue; #ifndef fprintf_vma #if BFD_HOST_64BIT_LONG @@ -193,7 +198,7 @@ to another, and are not necessarily correct). */ /* No flags. */ -#define NO_FLAGS 0x00 +#define BFD_NO_FLAGS 0x00 /* BFD contains relocation entries. */ #define HAS_RELOC 0x01 @@ -374,8 +379,9 @@ struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); - /* An obstack for this hash table. */ - struct obstack memory; + /* An objalloc for this hash table. This is a struct objalloc *, + but we use PTR to avoid requiring the inclusion of objalloc.h. */ + PTR memory; }; /* Initialize a hash table. */ @@ -533,6 +539,7 @@ struct symbol_cache_entry; struct bfd_link_info; struct bfd_link_hash_entry; +struct bfd_elf_version_tree; #endif extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd)); extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value)); @@ -599,11 +606,13 @@ extern struct bfd_link_needed_list *bfd_elf_get_needed_list PARAMS ((bfd *, struct bfd_link_info *)); extern boolean bfd_elf32_size_dynamic_sections - PARAMS ((bfd *, const char *, const char *, boolean, - struct bfd_link_info *, struct sec **)); + PARAMS ((bfd *, const char *, const char *, boolean, const char *, + const char * const *, struct bfd_link_info *, struct sec **, + struct bfd_elf_version_tree *)); extern boolean bfd_elf64_size_dynamic_sections - PARAMS ((bfd *, const char *, const char *, boolean, - struct bfd_link_info *, struct sec **)); + PARAMS ((bfd *, const char *, const char *, boolean, const char *, + const char * const *, struct bfd_link_info *, struct sec **, + struct bfd_elf_version_tree *)); extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *)); extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *)); @@ -622,6 +631,8 @@ extern boolean bfd_i386linux_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); extern boolean bfd_m68klinux_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +extern boolean bfd_sparclinux_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); /* mmap hacks */ diff -urN binutils-2.7/bfd/bfd-in2.h binutils-2.8/bfd/bfd-in2.h --- binutils-2.7/bfd/bfd-in2.h Thu Jul 4 12:30:50 1996 +++ binutils-2.8/bfd/bfd-in2.h Wed Apr 30 12:55:48 1997 @@ -1,5 +1,5 @@ /* Main header file for the bfd library -- portable access to object files. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Contributed by Cygnus Support. ** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them; @@ -49,12 +49,15 @@ #endif #include "ansidecl.h" -#include "obstack.h" /* These two lines get substitutions done by commands in Makefile.in. */ #define BFD_VERSION "@VERSION@" -#define BFD_ARCH_SIZE @WORDSIZE@ +#define BFD_ARCH_SIZE @wordsize@ #define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@ +#if @BFD_HOST_64_BIT_DEFINED@ +#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@ +#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@ +#endif #if BFD_ARCH_SIZE >= 64 #define BFD64 @@ -114,27 +117,29 @@ /* Support for different sizes of target format ints and addresses. If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be set to 1 above. Otherwise, if gcc is being used, this code will - use gcc's "long long" type. Otherwise, the compilation will fail - if 64-bit targets are requested. */ + use gcc's "long long" type. Otherwise, BFD_HOST_64_BIT must be + defined above. */ #ifdef BFD64 #ifndef BFD_HOST_64_BIT #if BFD_HOST_64BIT_LONG #define BFD_HOST_64_BIT long +#define BFD_HOST_U_64_BIT unsigned long #else #ifdef __GNUC__ #define BFD_HOST_64_BIT long long +#define BFD_HOST_U_64_BIT unsigned long long #else /* ! defined (__GNUC__) */ #error No 64 bit integer type available #endif /* ! defined (__GNUC__) */ #endif /* ! BFD_HOST_64BIT_LONG */ #endif /* ! defined (BFD_HOST_64_BIT) */ -typedef unsigned BFD_HOST_64_BIT bfd_vma; +typedef BFD_HOST_U_64_BIT bfd_vma; typedef BFD_HOST_64_BIT bfd_signed_vma; -typedef unsigned BFD_HOST_64_BIT bfd_size_type; -typedef unsigned BFD_HOST_64_BIT symvalue; +typedef BFD_HOST_U_64_BIT bfd_size_type; +typedef BFD_HOST_U_64_BIT symvalue; #ifndef fprintf_vma #if BFD_HOST_64BIT_LONG @@ -193,7 +198,7 @@ to another, and are not necessarily correct). */ /* No flags. */ -#define NO_FLAGS 0x00 +#define BFD_NO_FLAGS 0x00 /* BFD contains relocation entries. */ #define HAS_RELOC 0x01 @@ -374,8 +379,9 @@ struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); - /* An obstack for this hash table. */ - struct obstack memory; + /* An objalloc for this hash table. This is a struct objalloc *, + but we use PTR to avoid requiring the inclusion of objalloc.h. */ + PTR memory; }; /* Initialize a hash table. */ @@ -533,6 +539,7 @@ struct symbol_cache_entry; struct bfd_link_info; struct bfd_link_hash_entry; +struct bfd_elf_version_tree; #endif extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd)); extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value)); @@ -599,11 +606,13 @@ extern struct bfd_link_needed_list *bfd_elf_get_needed_list PARAMS ((bfd *, struct bfd_link_info *)); extern boolean bfd_elf32_size_dynamic_sections - PARAMS ((bfd *, const char *, const char *, boolean, - struct bfd_link_info *, struct sec **)); + PARAMS ((bfd *, const char *, const char *, boolean, const char *, + const char * const *, struct bfd_link_info *, struct sec **, + struct bfd_elf_version_tree *)); extern boolean bfd_elf64_size_dynamic_sections - PARAMS ((bfd *, const char *, const char *, boolean, - struct bfd_link_info *, struct sec **)); + PARAMS ((bfd *, const char *, const char *, boolean, const char *, + const char * const *, struct bfd_link_info *, struct sec **, + struct bfd_elf_version_tree *)); extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *)); extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *)); @@ -623,6 +632,8 @@ PARAMS ((bfd *, struct bfd_link_info *)); extern boolean bfd_m68klinux_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); +extern boolean bfd_sparclinux_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); /* mmap hacks */ @@ -690,7 +701,7 @@ bfd_fdopenr PARAMS ((CONST char *filename, CONST char *target, int fd)); bfd * -bfd_openstreamr PARAMS (()); +bfd_openstreamr PARAMS ((const char *, const char *, PTR)); bfd * bfd_openw PARAMS ((CONST char *filename, CONST char *target)); @@ -701,9 +712,6 @@ boolean bfd_close_all_done PARAMS ((bfd *)); -bfd_size_type -bfd_alloc_size PARAMS ((bfd *abfd)); - bfd * bfd_create PARAMS ((CONST char *filename, bfd *templ)); @@ -933,6 +941,12 @@ contents. */ #define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000 + /* This section was created by the linker as part of dynamic + relocation or other arcane processing. It is skipped when + going through the first-pass output, trusting that someone + else up the line will take care of it later. */ +#define SEC_LINKER_CREATED 0x800000 + /* End of section flags. */ /* Some internal packed boolean fields. */ @@ -1140,7 +1154,7 @@ bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, bfd *obfd, asection *osec)); #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ - BFD_SEND (ibfd, _bfd_copy_private_section_data, \ + BFD_SEND (obfd, _bfd_copy_private_section_data, \ (ibfd, isection, obfd, osection)) enum bfd_architecture { @@ -1181,6 +1195,8 @@ ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a) bfd_arch_mips, /* MIPS Rxxxx */ bfd_arch_i386, /* Intel 386 */ +#define bfd_mach_i386_i386 0 +#define bfd_mach_i386_i8086 1 bfd_arch_we32k, /* AT&T WE32xxx */ bfd_arch_tahoe, /* CCI/Harris Tahoe */ bfd_arch_i860, /* Intel 860 */ @@ -1192,9 +1208,11 @@ bfd_arch_h8300, /* Hitachi H8/300 */ #define bfd_mach_h8300 1 #define bfd_mach_h8300h 2 +#define bfd_mach_h8300s 3 bfd_arch_powerpc, /* PowerPC */ bfd_arch_rs6000, /* IBM RS/6000 */ bfd_arch_hppa, /* HP PA RISC */ + bfd_arch_d10v, /* Mitsubishi D10V */ bfd_arch_z8k, /* Zilog Z8000 */ #define bfd_mach_z8001 1 #define bfd_mach_z8002 2 @@ -1204,6 +1222,9 @@ bfd_arch_arm, /* Advanced Risc Machines ARM */ bfd_arch_ns32k, /* National Semiconductors ns32000 */ bfd_arch_w65, /* WDC 65816 */ + bfd_arch_m32r, /* Mitsubishi M32R/D */ + bfd_arch_mn10200, /* Matsushita MN10200 */ + bfd_arch_mn10300, /* Matsushita MN10300 */ bfd_arch_last }; @@ -1333,7 +1354,7 @@ struct reloc_howto_struct { - /* The type field has mainly a documetary use - the back end can + /* The type field has mainly a documentary use - the back end can do what it wants with it, though normally the back end's external idea of what a reloc number is stored in this field. For example, a PC relative word relocation @@ -1461,6 +1482,7 @@ BFD_RELOC_64, BFD_RELOC_32, BFD_RELOC_26, + BFD_RELOC_24, BFD_RELOC_16, BFD_RELOC_14, BFD_RELOC_8, @@ -1537,11 +1559,6 @@ BFD_RELOC_GPREL16, BFD_RELOC_GPREL32, -/* For openVMS/Alpha systems, these are displacements for switch -tables. */ - BFD_RELOC_SWREL32, - BFD_RELOC_SWREL64, - /* Reloc types used for i960/b.out. */ BFD_RELOC_I960_CALLJ, @@ -1613,6 +1630,12 @@ in with the file's GP value on reading, for convenience, as with the GPDISP_LO16 reloc. +The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16. +It should refer to the symbol to be referenced, as with 16_GOTOFF, +but it generates output not based on the position within the .got +section, but relative to the GP value chosen for the file during the +final link stage. + The LITUSE reloc, on the instruction using the loaded address, gives information to the linker that it might be able to use to optimize away some literal section references. The symbol is ignored (read @@ -1624,6 +1647,7 @@ The GNU linker currently doesn't do any of this optimizing. */ BFD_RELOC_ALPHA_LITERAL, + BFD_RELOC_ALPHA_ELF_LITERAL, BFD_RELOC_ALPHA_LITUSE, /* The HINT relocation indicates a value that should be filled into the @@ -1631,17 +1655,24 @@ prediction logic which may be provided on some processors. */ BFD_RELOC_ALPHA_HINT, -/* The LINKAGE relocation outputs a special code in the object file, -the rest is handled by the linker. */ +/* The LINKAGE relocation outputs a linkage pair in the object file, +which is filled by the linker. */ BFD_RELOC_ALPHA_LINKAGE, -/* The BASEREG relocation calculates differences to basereg. */ - BFD_RELOC_ALPHA_BASEREG, +/* The CODEADDR relocation outputs a STO_CA in the object file, +which is filled by the linker. */ + BFD_RELOC_ALPHA_CODEADDR, /* Bits 27..2 of the relocation address shifted right 2 bits; simple reloc otherwise. */ BFD_RELOC_MIPS_JMP, +/* The MIPS16 jump instruction. */ + BFD_RELOC_MIPS16_JMP, + +/* MIPS16 GP relative reloc. */ + BFD_RELOC_MIPS16_GPREL, + /* High 16 bits of 32-bit value; simple reloc. */ BFD_RELOC_HI16, @@ -1752,6 +1783,92 @@ BFD_RELOC_ARM_LDR_IMM, BFD_RELOC_ARM_LITERAL, BFD_RELOC_ARM_IN_POOL, + BFD_RELOC_ARM_OFFSET_IMM8, + BFD_RELOC_ARM_HWLITERAL, + BFD_RELOC_ARM_THUMB_ADD, + BFD_RELOC_ARM_THUMB_IMM, + BFD_RELOC_ARM_THUMB_SHIFT, + BFD_RELOC_ARM_THUMB_OFFSET, + +/* Hitachi SH relocs. Not all of these appear in object files. */ + BFD_RELOC_SH_PCDISP8BY2, + BFD_RELOC_SH_PCDISP12BY2, + BFD_RELOC_SH_IMM4, + BFD_RELOC_SH_IMM4BY2, + BFD_RELOC_SH_IMM4BY4, + BFD_RELOC_SH_IMM8, + BFD_RELOC_SH_IMM8BY2, + BFD_RELOC_SH_IMM8BY4, + BFD_RELOC_SH_PCRELIMM8BY2, + BFD_RELOC_SH_PCRELIMM8BY4, + BFD_RELOC_SH_SWITCH16, + BFD_RELOC_SH_SWITCH32, + BFD_RELOC_SH_USES, + BFD_RELOC_SH_COUNT, + BFD_RELOC_SH_ALIGN, + BFD_RELOC_SH_CODE, + BFD_RELOC_SH_DATA, + BFD_RELOC_SH_LABEL, + + +/* Mitsubishi D10V relocs. +This is a 10-bit reloc with the right 2 bits +assumed to be 0. */ + BFD_RELOC_D10V_10_PCREL_R, + +/* Mitsubishi D10V relocs. +This is a 10-bit reloc with the right 2 bits +assumed to be 0. This is the same as the previous reloc +except it is in the left container, i.e., +shifted left 15 bits. */ + BFD_RELOC_D10V_10_PCREL_L, + +/* This is an 18-bit reloc with the right 2 bits +assumed to be 0. */ + BFD_RELOC_D10V_18, + +/* This is an 18-bit reloc with the right 2 bits +assumed to be 0. */ + BFD_RELOC_D10V_18_PCREL, + + + +/* Mitsubishi M32R relocs. +This is a 24 bit absolute address. */ + BFD_RELOC_M32R_24, + +/* This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0. */ + BFD_RELOC_M32R_10_PCREL, + +/* This is an 18-bit reloc with the right 2 bits assumed to be 0. */ + BFD_RELOC_M32R_18_PCREL, + +/* This is a 26-bit reloc with the right 2 bits assumed to be 0. */ + BFD_RELOC_M32R_26_PCREL, + +/* This is a 16-bit reloc containing the high 16 bits of an address +used when the lower 16 bits are treated as unsigned. */ + BFD_RELOC_M32R_HI16_ULO, + +/* This is a 16-bit reloc containing the high 16 bits of an address +used when the lower 16 bits are treated as signed. */ + BFD_RELOC_M32R_HI16_SLO, + +/* This is a 16-bit reloc containing the lower 16 bits of an address. */ + BFD_RELOC_M32R_LO16, + +/* This is a 16-bit reloc containing the small data area offset for use in +add3, load, and store instructions. */ + BFD_RELOC_M32R_SDA16, + + +/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the +instruction. */ + BFD_RELOC_MN10300_32_PCREL, + +/* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the +instruction. */ + BFD_RELOC_MN10300_16_PCREL, BFD_RELOC_UNUSED }; typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; reloc_howto_type * @@ -1884,8 +2001,11 @@ boolean bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym)); -#define bfd_is_local_label(abfd, sym) \ - BFD_SEND (abfd, _bfd_is_local_label,(abfd, sym)) +boolean +bfd_is_local_label_name PARAMS ((bfd *abfd, const char *name)); + +#define bfd_is_local_label_name(abfd, name) \ + BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) #define bfd_canonicalize_symtab(abfd, location) \ BFD_SEND (abfd, _bfd_canonicalize_symtab,\ (abfd, location)) @@ -1909,7 +2029,7 @@ bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym)); #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ - BFD_SEND (ibfd, _bfd_copy_private_symbol_data, \ + BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ (ibfd, isymbol, obfd, osymbol)) struct _bfd { @@ -2061,8 +2181,10 @@ /* Used by the application to hold private data*/ PTR usrdata; - /* Where all the allocated stuff under this BFD goes */ - struct obstack memory; + /* Where all the allocated stuff under this BFD goes. This is a + struct objalloc *, but we use PTR to avoid requiring the inclusion of + objalloc.h. */ + PTR memory; }; typedef enum bfd_error @@ -2149,13 +2271,13 @@ bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); #define bfd_copy_private_bfd_data(ibfd, obfd) \ - BFD_SEND (ibfd, _bfd_copy_private_bfd_data, \ + BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ (ibfd, obfd)) boolean bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); #define bfd_merge_private_bfd_data(ibfd, obfd) \ - BFD_SEND (ibfd, _bfd_merge_private_bfd_data, \ + BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ (ibfd, obfd)) boolean bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); @@ -2414,7 +2536,7 @@ CAT(NAME,_make_empty_symbol),\ CAT(NAME,_print_symbol),\ CAT(NAME,_get_symbol_info),\ -CAT(NAME,_bfd_is_local_label),\ +CAT(NAME,_bfd_is_local_label_name),\ CAT(NAME,_get_lineno),\ CAT(NAME,_find_nearest_line),\ CAT(NAME,_bfd_make_debug_symbol),\ @@ -2433,7 +2555,7 @@ struct symbol_cache_entry *, symbol_info *)); #define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e)) - boolean (*_bfd_is_local_label) PARAMS ((bfd *, asymbol *)); + boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *)); alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd, @@ -2529,6 +2651,9 @@ PTR backend_data; } bfd_target; +boolean +bfd_set_default_target PARAMS ((const char *name)); + const bfd_target * bfd_find_target PARAMS ((CONST char *target_name, bfd *abfd)); diff -urN binutils-2.7/bfd/bfd.c binutils-2.8/bfd/bfd.c --- binutils-2.7/bfd/bfd.c Thu Jul 4 12:17:42 1996 +++ binutils-2.8/bfd/bfd.c Wed Apr 30 12:55:48 1997 @@ -1,5 +1,6 @@ /* Generic BFD library interface and support routines. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -182,8 +183,10 @@ . {* Used by the application to hold private data*} . PTR usrdata; . -. {* Where all the allocated stuff under this BFD goes *} -. struct obstack memory; +. {* Where all the allocated stuff under this BFD goes. This is a +. struct objalloc *, but we use PTR to avoid requiring the inclusion of +. objalloc.h. *} +. PTR memory; .}; . */ @@ -197,6 +200,7 @@ #include #endif +#include "libiberty.h" #include "bfdlink.h" #include "libbfd.h" #include "coff/internal.h" @@ -263,9 +267,6 @@ . */ -#undef strerror -extern char *strerror(); - static bfd_error_type bfd_error = bfd_error_no_error; CONST char *CONST bfd_errmsgs[] = { @@ -345,19 +346,7 @@ extern int errno; #endif if (error_tag == bfd_error_system_call) - { - const char *errmsg; - - errmsg = strerror (errno); - if (errmsg == NULL) - { - static char buf[32]; - - sprintf (buf, "Error %d", errno); - errmsg = buf; - } - return errmsg; - } + return xstrerror (errno); if ((((int)error_tag <(int) bfd_error_no_error) || ((int)error_tag > (int)bfd_error_invalid_error_code))) @@ -615,7 +604,7 @@ arelent **location; unsigned int count; { - asect->orelocation = location; + asect->orelocation = location; asect->reloc_count = count; } @@ -954,7 +943,7 @@ Not enough memory exists to create private data for @var{obfd}. .#define bfd_copy_private_bfd_data(ibfd, obfd) \ -. BFD_SEND (ibfd, _bfd_copy_private_bfd_data, \ +. BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ . (ibfd, obfd)) */ @@ -975,7 +964,7 @@ Not enough memory exists to create private data for @var{obfd}. .#define bfd_merge_private_bfd_data(ibfd, obfd) \ -. BFD_SEND (ibfd, _bfd_merge_private_bfd_data, \ +. BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ . (ibfd, obfd)) */ @@ -1124,7 +1113,7 @@ m = ((struct elf_segment_map *) bfd_alloc (abfd, (sizeof (struct elf_segment_map) - + (count - 1) * sizeof (asection *)))); + + ((size_t) count - 1) * sizeof (asection *)))); if (m == NULL) return false; diff -urN binutils-2.7/bfd/binary.c binutils-2.8/bfd/binary.c --- binutils-2.7/bfd/binary.c Thu Jul 4 12:17:42 1996 +++ binutils-2.8/bfd/binary.c Wed Apr 30 12:55:48 1997 @@ -1,5 +1,5 @@ /* BFD back-end for binary objects. - Copyright 1994 Free Software Foundation, Inc. + Copyright 1994, 95, 96, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, This file is part of BFD, the Binary File Descriptor library. @@ -229,7 +229,7 @@ bfd_symbol_info (symbol, ret); } -#define binary_bfd_is_local_label bfd_generic_is_local_label +#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name #define binary_get_lineno _bfd_nosymbols_get_lineno #define binary_find_nearest_line _bfd_nosymbols_find_nearest_line #define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol @@ -255,19 +255,31 @@ file_ptr offset; bfd_size_type size; { + /* We don't want to output anything for a section that is neither + loaded nor allocated. The contents of such a section are not + meaningful in the binary format. */ + if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0) + return true; + if (! abfd->output_has_begun) { + boolean found_low; bfd_vma low; asection *s; /* The lowest section LMA sets the virtual address of the start of the file. We use this to set the file position of all the sections. */ - low = abfd->sections->lma; - for (s = abfd->sections->next; s != NULL; s = s->next) - if ((s->flags & SEC_HAS_CONTENTS) != 0 - && s->lma < low) - low = s->lma; + found_low = false; + low = 0; + for (s = abfd->sections; s != NULL; s = s->next) + if (((s->flags & (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC)) + == (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC)) + && (! found_low || s->lma < low)) + { + low = s->lma; + found_low = true; + } for (s = abfd->sections; s != NULL; s = s->next) s->filepos = s->lma - low; diff -urN binutils-2.7/bfd/cf-m68klynx.c binutils-2.8/bfd/cf-m68klynx.c --- binutils-2.7/bfd/cf-m68klynx.c Thu Jul 4 12:17:45 1996 +++ binutils-2.8/bfd/cf-m68klynx.c Wed Apr 30 12:55:49 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Motorola M68K COFF LynxOS files. - Copyright 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -20,204 +20,9 @@ #define TARGET_SYM m68klynx_coff_vec #define TARGET_NAME "coff-m68k-lynx" - #define LYNXOS - #define COFF_LONG_FILENAMES - -#define _bfd_m68kcoff_howto_table _bfd_m68klynx_howto_table -#define _bfd_m68kcoff_rtype2howto _bfd_m68klynx_rtype2howto -#define _bfd_m68kcoff_howto2rtype _bfd_m68klynx_howto2rtype -#define _bfd_m68kcoff_reloc_type_lookup _bfd_m68klynx_reloc_type_lookup - -#define LYNX_SPECIAL_FN _bfd_m68klynx_special_fn - -#include "bfd.h" -#include "sysdep.h" - -#ifdef ANSI_PROTOTYPES -struct internal_reloc; -struct coff_link_hash_entry; -struct internal_syment; -#endif - -static bfd_reloc_status_type _bfd_m68klynx_special_fn - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *coff_m68k_lynx_rtype_to_howto - PARAMS ((bfd *, asection *, struct internal_reloc *, - struct coff_link_hash_entry *, struct internal_syment *, - bfd_vma *)); - -/* For some reason when using m68k COFF the value stored in the .text - section for a reference to a common symbol is the value itself plus - any desired offset. (taken from work done by Ian Taylor, Cygnus Support, - for I386 COFF). */ - -/* If we are producing relocateable output, we need to do some - adjustments to the object file that are not done by the - bfd_perform_relocation function. This function is called by every - reloc type to make any required adjustments. */ - -static bfd_reloc_status_type -_bfd_m68klynx_special_fn (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - symvalue diff; - - if (output_bfd == (bfd *) NULL) - return bfd_reloc_continue; - - if (bfd_is_com_section (symbol->section)) - { - /* We are relocating a common symbol. The current value in the - object file is ORIG + OFFSET, where ORIG is the value of the - common symbol as seen by the object file when it was compiled - (this may be zero if the symbol was undefined) and OFFSET is - the offset into the common symbol (normally zero, but may be - non-zero when referring to a field in a common structure). - ORIG is the negative of reloc_entry->addend, which is set by - the CALC_ADDEND macro below. We want to replace the value in - the object file with NEW + OFFSET, where NEW is the value of - the common symbol which we are going to put in the final - object file. NEW is symbol->value. */ - diff = symbol->value + reloc_entry->addend; - } - else - { - /* For some reason bfd_perform_relocation always effectively - ignores the addend for a COFF target when producing - relocateable output. This seems to be always wrong for 386 - COFF, so we handle the addend here instead. */ - diff = reloc_entry->addend; - } - -#define DOIT(x) \ - x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) - - if (diff != 0) - { - reloc_howto_type *howto = reloc_entry->howto; - unsigned char *addr = (unsigned char *) data + reloc_entry->address; - - switch (howto->size) - { - case 0: - { - char x = bfd_get_8 (abfd, addr); - DOIT (x); - bfd_put_8 (abfd, x, addr); - } - break; - - case 1: - { - short x = bfd_get_16 (abfd, addr); - DOIT (x); - bfd_put_16 (abfd, x, addr); - } - break; - - case 2: - { - long x = bfd_get_32 (abfd, addr); - DOIT (x); - bfd_put_32 (abfd, x, addr); - } - break; - - default: - abort (); - } - } - - /* Now let bfd_perform_relocation finish everything up. */ - return bfd_reloc_continue; -} -/* Compute the addend of a reloc. If the reloc is to a common symbol, - the object file contains the value of the common symbol. By the - time this is called, the linker may be using a different symbol - from a different object file with a different value. Therefore, we - hack wildly to locate the original symbol from this file so that we - can make the correct adjustment. This macro sets coffsym to the - symbol from the original file, and uses it to set the addend value - correctly. If this is not a common symbol, the usual addend - calculation is done, except that an additional tweak is needed for - PC relative relocs. - FIXME: This macro refers to symbols and asect; these are from the - calling function, not the macro arguments. */ - -#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ - { \ - coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ - if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ - coffsym = (obj_symbols (abfd) \ - + (cache_ptr->sym_ptr_ptr - symbols)); \ - else if (ptr) \ - coffsym = coff_symbol_from (abfd, ptr); \ - if (coffsym != (coff_symbol_type *) NULL \ - && coffsym->native->u.syment.n_scnum == 0) \ - cache_ptr->addend = - coffsym->native->u.syment.n_value; \ - else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ - && ptr->section != (asection *) NULL) \ - cache_ptr->addend = - (ptr->section->vma + ptr->value); \ - else \ - cache_ptr->addend = 0; \ - if (ptr && (reloc.r_type == R_PCRBYTE \ - || reloc.r_type == R_PCRWORD \ - || reloc.r_type == R_PCRLONG)) \ - cache_ptr->addend += asect->vma; \ - } - -#define coff_rtype_to_howto coff_m68k_lynx_rtype_to_howto +#define STATIC_RELOCS +#define COFF_COMMON_ADDEND #include "coff-m68k.c" - -/* coff-m68k.c uses the special COFF backend linker. We need to - adjust common symbols. - - We can't define this function until after we have included - coff-m68k.c, because it uses RTYPE2HOWTO. */ - -/*ARGSUSED*/ -static reloc_howto_type * -coff_m68k_lynx_rtype_to_howto (abfd, sec, rel, h, sym, addendp) - bfd *abfd; - asection *sec; - struct internal_reloc *rel; - struct coff_link_hash_entry *h; - struct internal_syment *sym; - bfd_vma *addendp; -{ - arelent relent; - reloc_howto_type *howto; - - RTYPE2HOWTO (&relent, rel); - - howto = relent.howto; - - if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0) - { - /* This is a common symbol. The section contents include the - size (sym->n_value) as an addend. The relocate_section - function will be adding in the final value of the symbol. We - need to subtract out the current size in order to get the - correct result. */ - BFD_ASSERT (h != NULL); - *addendp -= sym->n_value; - } - - /* If the output symbol is common (in which case this must be a - relocateable link), we need to add in the final size of the - common symbol. */ - if (h != NULL && h->root.type == bfd_link_hash_common) - *addendp += h->root.u.c.size; - - return howto; -} diff -urN binutils-2.7/bfd/cisco-core.c binutils-2.8/bfd/cisco-core.c --- binutils-2.7/bfd/cisco-core.c Thu Jul 4 12:17:45 1996 +++ binutils-2.8/bfd/cisco-core.c Wed Apr 30 12:55:49 1997 @@ -184,6 +184,9 @@ /* NAN */ case 54: abfd->tdata.cisco_core_data->sig = SIGFPE; break; default: +#ifndef SIGEMT +#define SIGEMT SIGTRAP +#endif /* "software generated"*/ abfd->tdata.cisco_core_data->sig = SIGEMT; } diff -urN binutils-2.7/bfd/coff-a29k.c binutils-2.8/bfd/coff-a29k.c --- binutils-2.7/bfd/coff-a29k.c Thu Jul 4 12:17:46 1996 +++ binutils-2.8/bfd/coff-a29k.c Wed Apr 30 12:55:49 1997 @@ -1,5 +1,5 @@ /* BFD back-end for AMD 29000 COFF binaries. - Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. Contributed by David Wood at New York University 7/8/91. This file is part of BFD, the Binary File Descriptor library. @@ -23,7 +23,6 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/a29k.h" #include "coff/internal.h" #include "libcoff.h" @@ -354,7 +353,7 @@ symndx = rel->r_symndx; loc = contents + rel->r_vaddr - input_section->vma; - if (symndx == -1) + if (symndx == -1 || rel->r_type == R_IHCONST) h = NULL; else h = obj_coff_sym_hashes (input_bfd)[symndx]; diff -urN binutils-2.7/bfd/coff-alpha.c binutils-2.8/bfd/coff-alpha.c --- binutils-2.7/bfd/coff-alpha.c Thu Jul 4 12:17:47 1996 +++ binutils-2.8/bfd/coff-alpha.c Wed Apr 30 12:55:49 1997 @@ -1,5 +1,5 @@ /* BFD back-end for ALPHA Extended-Coff files. - Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. Modified from coff-mips.c by Steve Chamberlain and Ian Lance Taylor . @@ -47,6 +47,8 @@ arelent *)); static void alpha_adjust_reloc_out PARAMS ((bfd *, const arelent *, struct internal_reloc *)); +static reloc_howto_type *alpha_bfd_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); static bfd_byte *alpha_ecoff_get_relocated_section_contents PARAMS ((bfd *abfd, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *data, boolean relocateable, asymbol **symbols)); @@ -2264,7 +2266,7 @@ (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */ alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out, alpha_ecoff_swap_scnhdr_out, - FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, true, false, + FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, true, false, 4, alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in, alpha_ecoff_swap_scnhdr_in, NULL, alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook, diff -urN binutils-2.7/bfd/coff-apollo.c binutils-2.8/bfd/coff-apollo.c --- binutils-2.7/bfd/coff-apollo.c Thu Jul 4 12:17:48 1996 +++ binutils-2.8/bfd/coff-apollo.c Wed Apr 30 12:55:49 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Apollo 68000 COFF binaries. - Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. By Troy Rollo (troy@cbme.unsw.edu.au) Based on m68k standard COFF version Written by Cygnus Support. @@ -22,7 +22,6 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/apollo.h" #include "coff/internal.h" #include "libcoff.h" diff -urN binutils-2.7/bfd/coff-arm.c binutils-2.8/bfd/coff-arm.c --- binutils-2.7/bfd/coff-arm.c Thu Jul 4 12:17:48 1996 +++ binutils-2.8/bfd/coff-arm.c Wed Apr 30 12:55:50 1997 @@ -1,5 +1,5 @@ /* BFD back-end for ARM COFF files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,6 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/arm.h" @@ -44,7 +43,9 @@ static bfd_reloc_status_type coff_arm_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); - +static boolean coff_arm_adjust_symndx + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, + struct internal_reloc *, boolean *)); /* Used by the assembler. */ static bfd_reloc_status_type @@ -216,7 +217,7 @@ "ARM26D", true, 0x00ffffff, - 0x00ffffff, + 0x0, false), {-1}, HOWTO( 9, @@ -294,6 +295,37 @@ { *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase; } + + /* The relocation_section function will skip pcrel_offset relocs + when doing a relocateable link. However, we want to convert + ARM26 to ARM26D relocs if possible. We return a fake howto in + this case without pcrel_offset set, and adjust the addend to + compensate. */ + if (rel->r_type == 3 + && h != NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->root.u.def.section->output_section == sec->output_section) + { + static reloc_howto_type fake_arm26_reloc = + HOWTO (3, + 2, + 2, + 26, + true, + 0, + complain_overflow_signed, + aoutarm_fix_pcrel_26 , + "ARM26", + false, + 0x00ffffff, + 0x00ffffff, + false); + + *addendp -= rel->r_vaddr - sec->vma; + return &fake_arm26_reloc; + } + return howto; } @@ -419,6 +451,34 @@ /* We use the special COFF backend linker. */ #define coff_relocate_section _bfd_coff_generic_relocate_section +/* When doing a relocateable link, we want to convert ARM26 relocs + into ARM26D relocs. */ + +static boolean +coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) + bfd *obfd; + struct bfd_link_info *info; + bfd *ibfd; + asection *sec; + struct internal_reloc *irel; + boolean *adjustedp; +{ + if (irel->r_type == 3) + { + struct coff_link_hash_entry *h; + + h = obj_coff_sym_hashes (ibfd)[irel->r_symndx]; + if (h != NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->root.u.def.section->output_section == sec->output_section) + irel->r_type = 7; + } + *adjustedp = false; + return true; +} + +#define coff_adjust_symndx coff_arm_adjust_symndx #include "coffcode.h" diff -urN binutils-2.7/bfd/coff-aux.c binutils-2.8/bfd/coff-aux.c --- binutils-2.7/bfd/coff-aux.c Thu Jul 4 12:17:48 1996 +++ binutils-2.8/bfd/coff-aux.c Wed Apr 30 12:55:50 1997 @@ -1,8 +1,6 @@ /* BFD back-end for Apple M68K COFF A/UX 3.x files. - Copyright 1996 Free Software Foundation, Inc. - Portions written by Richard Henderson , - COMMON symbol munging cribbed from cf-m68klynx.c which was - written by Cygnus Support. + Copyright 1996, 1997 Free Software Foundation, Inc. + Written by Richard Henderson . This file is part of BFD, the Binary File Descriptor library. @@ -35,225 +33,30 @@ /* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */ #define BSS_NOLOAD_IS_SHARED_LIBRARY -#define _bfd_m68kcoff_howto_table _bfd_m68kaux_howto_table -#define _bfd_m68kcoff_rtype2howto _bfd_m68kaux_rtype2howto -#define _bfd_m68kcoff_howto2rtype _bfd_m68kaux_howto2rtype -#define _bfd_m68kcoff_reloc_type_lookup _bfd_m68kaux_reloc_type_lookup +#define STATIC_RELOCS -/* Rather than change names lots of places, reuse the same hack */ -#define LYNX_SPECIAL_FN _bfd_m68kaux_special_fn +#define COFF_COMMON_ADDEND #include "bfd.h" #include "sysdep.h" -#ifdef ANSI_PROTOTYPES -struct internal_reloc; -struct coff_link_hash_entry; -struct internal_syment; -#endif - - -static bfd_reloc_status_type _bfd_m68kaux_special_fn - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *coff_m68k_aux_rtype_to_howto - PARAMS ((bfd *, asection *, struct internal_reloc *, - struct coff_link_hash_entry *, struct internal_syment *, - bfd_vma *)); static boolean coff_m68k_aux_link_add_one_symbol PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *, bfd_vma, const char *, boolean, boolean, struct bfd_link_hash_entry **)); - -#define coff_rtype_to_howto coff_m68k_aux_rtype_to_howto #define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol - -/* Compute the addend of a reloc. If the reloc is to a common symbol, - the object file contains the value of the common symbol. By the - time this is called, the linker may be using a different symbol - from a different object file with a different value. Therefore, we - hack wildly to locate the original symbol from this file so that we - can make the correct adjustment. This macro sets coffsym to the - symbol from the original file, and uses it to set the addend value - correctly. If this is not a common symbol, the usual addend - calculation is done, except that an additional tweak is needed for - PC relative relocs. - FIXME: This macro refers to symbols and asect; these are from the - calling function, not the macro arguments. */ - -#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ - { \ - coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ - if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ - coffsym = (obj_symbols (abfd) \ - + (cache_ptr->sym_ptr_ptr - symbols)); \ - else if (ptr) \ - coffsym = coff_symbol_from (abfd, ptr); \ - if (coffsym != (coff_symbol_type *) NULL \ - && coffsym->native->u.syment.n_scnum == 0) \ - cache_ptr->addend = - coffsym->native->u.syment.n_value; \ - else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ - && ptr->section != (asection *) NULL) \ - cache_ptr->addend = - (ptr->section->vma + ptr->value); \ - else \ - cache_ptr->addend = 0; \ - if (ptr && (reloc.r_type == R_PCRBYTE \ - || reloc.r_type == R_PCRWORD \ - || reloc.r_type == R_PCRLONG)) \ - cache_ptr->addend += asect->vma; \ - } - - - #include "coff/aux-coff.h" /* override coff/internal.h and coff/m68k.h */ #include "coff-m68k.c" - - -/* For some reason when using m68k COFF the value stored in the .text - section for a reference to a common symbol is the value itself plus - any desired offset. (taken from work done by Ian Taylor, Cygnus Support, - for I386 COFF). */ - -/* If we are producing relocateable output, we need to do some - adjustments to the object file that are not done by the - bfd_perform_relocation function. This function is called by every - reloc type to make any required adjustments. */ - -static bfd_reloc_status_type -_bfd_m68kaux_special_fn (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - symvalue diff; - - if (output_bfd == (bfd *) NULL) - return bfd_reloc_continue; - - if (bfd_is_com_section (symbol->section)) - { - /* We are relocating a common symbol. The current value in the - object file is ORIG + OFFSET, where ORIG is the value of the - common symbol as seen by the object file when it was compiled - (this may be zero if the symbol was undefined) and OFFSET is - the offset into the common symbol (normally zero, but may be - non-zero when referring to a field in a common structure). - ORIG is the negative of reloc_entry->addend, which is set by - the CALC_ADDEND macro below. We want to replace the value in - the object file with NEW + OFFSET, where NEW is the value of - the common symbol which we are going to put in the final - object file. NEW is symbol->value. */ - diff = symbol->value + reloc_entry->addend; - } - else - { - /* For some reason bfd_perform_relocation always effectively - ignores the addend for a COFF target when producing - relocateable output. This seems to be always wrong for 386 - COFF, so we handle the addend here instead. */ - diff = reloc_entry->addend; - } - -#define DOIT(x) \ - x = ((x & ~howto->dst_mask) | \ - (((x & howto->src_mask) + diff) & howto->dst_mask)) - - if (diff != 0) - { - reloc_howto_type *howto = reloc_entry->howto; - unsigned char *addr = (unsigned char *) data + reloc_entry->address; - - switch (howto->size) - { - case 0: - { - char x = bfd_get_8 (abfd, addr); - DOIT (x); - bfd_put_8 (abfd, x, addr); - } - break; - - case 1: - { - short x = bfd_get_16 (abfd, addr); - DOIT (x); - bfd_put_16 (abfd, x, addr); - } - break; - - case 2: - { - long x = bfd_get_32 (abfd, addr); - DOIT (x); - bfd_put_32 (abfd, x, addr); - } - break; - - default: - abort (); - } - } - - /* Now let bfd_perform_relocation finish everything up. */ - return bfd_reloc_continue; -} - - -/* coff-m68k.c uses the special COFF backend linker. We need to - adjust common symbols. */ - -/*ARGSUSED*/ -static reloc_howto_type * -coff_m68k_aux_rtype_to_howto (abfd, sec, rel, h, sym, addendp) - bfd *abfd; - asection *sec; - struct internal_reloc *rel; - struct coff_link_hash_entry *h; - struct internal_syment *sym; - bfd_vma *addendp; -{ - arelent relent; - reloc_howto_type *howto; - - RTYPE2HOWTO (&relent, rel); - - howto = relent.howto; - - if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0) - { - /* This is a common symbol. The section contents include the - size (sym->n_value) as an addend. The relocate_section - function will be adding in the final value of the symbol. We - need to subtract out the current size in order to get the - correct result. */ - BFD_ASSERT (h != NULL); - *addendp -= sym->n_value; - } - - /* If the output symbol is common (in which case this must be a - relocateable link), we need to add in the final size of the - common symbol. */ - if (h != NULL && h->root.type == bfd_link_hash_common) - *addendp += h->root.u.c.size; - - return howto; -} - - /* We need non-absolute symbols to override absolute symbols. This mirrors Apple's "solution" to let a static library symbol override a shared library symbol. On the whole not a good thing, given how shared libraries work here, but can work if you are careful with what you include in the shared object. */ -boolean +static boolean coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value, string, copy, collect, hashp) struct bfd_link_info *info; diff -urN binutils-2.7/bfd/coff-h8300.c binutils-2.8/bfd/coff-h8300.c --- binutils-2.7/bfd/coff-h8300.c Thu Jul 4 12:30:47 1996 +++ binutils-2.8/bfd/coff-h8300.c Wed Apr 30 12:55:51 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Hitachi H8/300 COFF binaries. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Steve Chamberlain, . This file is part of BFD, the Binary File Descriptor library. @@ -20,7 +20,6 @@ #include "bfd.h" #include "sysdep.h" -#include "obstack.h" #include "libbfd.h" #include "bfdlink.h" #include "genlink.h" @@ -139,7 +138,7 @@ if (bfd_get_mach (table->abfd) == bfd_mach_h8300) table->offset += 2; else if (bfd_get_mach (table->abfd) == bfd_mach_h8300h - ) + || bfd_get_mach (table->abfd) == bfd_mach_h8300s) table->offset += 4; else return NULL; @@ -259,10 +258,7 @@ #define SELECT_RELOC(x,howto) \ { x.r_type = select_reloc(howto); } -#define BADMAG(x)\ - (H8300BADMAG(x) \ - && H8300HBADMAG(x) \ - ) +#define BADMAG(x) (H8300BADMAG(x) && H8300HBADMAG(x) && H8300SBADMAG(x)) #define H8300 1 /* Customize coffcode.h */ #define __A_MAGIC_SET__ @@ -362,7 +358,7 @@ #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) -/* Perform any necessaru magic to the addend in a reloc entry */ +/* Perform any necessary magic to the addend in a reloc entry */ #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ @@ -570,7 +566,7 @@ && value >= 0xff00 && value <= 0xffff) || ((bfd_get_mach (abfd) == bfd_mach_h8300h - ) + || bfd_get_mach (abfd) == bfd_mach_h8300s) && value >= 0xffff00 && value <= 0xffffff)) { @@ -593,7 +589,7 @@ /* The address is in 0xffff00..0xffffff inclusive on the h8300h, then we can relax this mov.b */ if ((bfd_get_mach (abfd) == bfd_mach_h8300h - ) + || bfd_get_mach (abfd) == bfd_mach_h8300s) && value >= 0xffff00 && value <= 0xffffff) { @@ -736,7 +732,7 @@ value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); /* Sanity check. */ - if (value < 0xff + if (value <= 0xff || (value >= 0x0000ff00 && value <= 0x0000ffff) || (value >= 0x00ffff00 && value <= 0x00ffffff) || (value >= 0xffffff00 && value <= 0xffffffff)) @@ -744,7 +740,7 @@ /* Everything looks OK. Apply the relocation and update the src/dst address appropriately. */ - bfd_put_8 (abfd, gap, data + dst_address); + bfd_put_8 (abfd, value & 0xff, data + dst_address); dst_address += 1; src_address += 1; } @@ -1132,7 +1128,7 @@ input_section), vectors_sec->contents + h->offset); else if (bfd_get_mach (input_section->owner) == bfd_mach_h8300h - ) + || bfd_get_mach (input_section->owner) == bfd_mach_h8300s) bfd_put_32 (abfd, bfd_coff_reloc16_get_value (reloc, link_info, @@ -1302,7 +1298,7 @@ if (bfd_get_mach (abfd) == bfd_mach_h8300) h8300_coff_hash_table (info)->vectors_sec->_raw_size += 2; else if (bfd_get_mach (abfd) == bfd_mach_h8300h - ) + || bfd_get_mach (abfd) == bfd_mach_h8300s) h8300_coff_hash_table (info)->vectors_sec->_raw_size += 4; } } diff -urN binutils-2.7/bfd/coff-h8500.c binutils-2.8/bfd/coff-h8500.c --- binutils-2.7/bfd/coff-h8500.c Thu Jul 4 12:17:51 1996 +++ binutils-2.8/bfd/coff-h8500.c Wed Apr 30 12:55:52 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Hitachi H8/500 COFF binaries. - Copyright 1993, 1994 Free Software Foundation, Inc. + Copyright 1993, 94, 95, 1997 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, . @@ -21,7 +21,6 @@ #include "bfd.h" #include "sysdep.h" -#include "obstack.h" #include "libbfd.h" #include "bfdlink.h" #include "coff/h8500.h" @@ -137,7 +136,7 @@ #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) -/* Perform any necessaru magic to the addend in a reloc entry */ +/* Perform any necessary magic to the addend in a reloc entry */ #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ diff -urN binutils-2.7/bfd/coff-i386.c binutils-2.8/bfd/coff-i386.c --- binutils-2.7/bfd/coff-i386.c Thu Jul 4 12:17:52 1996 +++ binutils-2.8/bfd/coff-i386.c Wed Apr 30 12:55:52 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Intel 386 COFF files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,6 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/i386.h" diff -urN binutils-2.7/bfd/coff-i860.c binutils-2.8/bfd/coff-i860.c --- binutils-2.7/bfd/coff-i860.c Thu Jul 4 12:17:52 1996 +++ binutils-2.8/bfd/coff-i860.c Wed Apr 30 12:55:52 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Intel 860 COFF files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. Created mostly by substituting "860" for "386" in coff-i386.c Harry Dolan , October 1995 @@ -22,7 +22,6 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/i860.h" diff -urN binutils-2.7/bfd/coff-i960.c binutils-2.8/bfd/coff-i960.c --- binutils-2.7/bfd/coff-i960.c Thu Jul 4 12:17:53 1996 +++ binutils-2.8/bfd/coff-i960.c Wed Apr 30 12:55:52 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Intel 960 COFF files. - Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -24,11 +24,11 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/i960.h" #include "coff/internal.h" #include "libcoff.h" /* to allow easier abstraction-breaking */ +static boolean coff_i960_is_local_label_name PARAMS ((bfd *, const char *)); static bfd_reloc_status_type optcall_callback PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_reloc_status_type coff_i960_relocate @@ -52,6 +52,20 @@ #define COFF_LONG_FILENAMES +/* This set of local label names is taken from gas. */ + +static boolean +coff_i960_is_local_label_name (abfd, name) + bfd *abfd; + const char *name; +{ + return (name[0] == 'L' + || (name[0] == '.' + && (name[1] == 'C' + || name[1] == 'I' + || name[1] == '.'))); +} + /* This is just like the usual CALC_ADDEND, but it includes the section VMA for PC relative relocs. */ #ifndef CALC_ADDEND @@ -584,6 +598,8 @@ return true; } + +#define coff_bfd_is_local_label_name coff_i960_is_local_label_name #define coff_start_final_link coff_i960_start_final_link diff -urN binutils-2.7/bfd/coff-m68k.c binutils-2.8/bfd/coff-m68k.c --- binutils-2.7/bfd/coff-m68k.c Thu Jul 4 12:17:53 1996 +++ binutils-2.8/bfd/coff-m68k.c Wed Apr 30 12:55:52 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Motorola 68000 COFF binaries. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -21,14 +21,30 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/m68k.h" #include "coff/internal.h" #include "libcoff.h" -#ifndef LYNX_SPECIAL_FN -#define LYNX_SPECIAL_FN 0 -#endif +/* This source file is compiled multiple times for various m68k COFF + variants. The following macros control its behaviour: + + TARGET_SYM + The C name of the BFD target vector. The default is m68kcoff_vec. + TARGET_NAME + The user visible target name. The default is "coff-m68k". + NAMES_HAVE_UNDERSCORE + Whether symbol names have an underscore. + ONLY_DECLARE_RELOCS + Only declare the relocation howto array. Don't actually compile + it. The actual array will be picked up in another version of the + file. + STATIC_RELOCS + Make the relocation howto array, and associated functions, static. + COFF_COMMON_ADDEND + If this is defined, then, for a relocation against a common + symbol, the object file holds the value (the size) of the common + symbol. If this is not defined, then, for a relocation against a + common symbol, the object file holds zero. */ #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) @@ -37,24 +53,58 @@ #define COFF_PAGE_SIZE 0x2000 #endif +#ifndef COFF_COMMON_ADDEND +#define RELOC_SPECIAL_FN 0 +#else +static bfd_reloc_status_type m68kcoff_common_addend_special_fn + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type *m68kcoff_common_addend_rtype_to_howto + PARAMS ((bfd *, asection *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *, + bfd_vma *)); +#define RELOC_SPECIAL_FN m68kcoff_common_addend_special_fn +#endif + +static boolean m68k_coff_is_local_label_name PARAMS ((bfd *, const char *)); + +/* On the delta, a symbol starting with L% is local. We won't see + such a symbol on other platforms, so it should be safe to always + consider it local here. */ + +static boolean +m68k_coff_is_local_label_name (abfd, name) + bfd *abfd; + const char *name; +{ + if (name[0] == 'L' && name[1] == '%') + return true; + + return _bfd_coff_is_local_label_name (abfd, name); +} + +#ifndef STATIC_RELOCS /* Clean up namespace. */ #define m68kcoff_howto_table _bfd_m68kcoff_howto_table #define m68k_rtype2howto _bfd_m68kcoff_rtype2howto #define m68k_howto2rtype _bfd_m68kcoff_howto2rtype #define m68k_reloc_type_lookup _bfd_m68kcoff_reloc_type_lookup +#endif #ifdef ONLY_DECLARE_RELOCS extern reloc_howto_type m68kcoff_howto_table[]; #else +#ifdef STATIC_RELOCS +static +#endif reloc_howto_type m68kcoff_howto_table[] = { - HOWTO(R_RELBYTE, 0, 0, 8, false, 0, complain_overflow_bitfield, LYNX_SPECIAL_FN, "8", true, 0x000000ff,0x000000ff, false), - HOWTO(R_RELWORD, 0, 1, 16, false, 0, complain_overflow_bitfield, LYNX_SPECIAL_FN, "16", true, 0x0000ffff,0x0000ffff, false), - HOWTO(R_RELLONG, 0, 2, 32, false, 0, complain_overflow_bitfield, LYNX_SPECIAL_FN, "32", true, 0xffffffff,0xffffffff, false), - HOWTO(R_PCRBYTE, 0, 0, 8, true, 0, complain_overflow_signed, LYNX_SPECIAL_FN, "DISP8", true, 0x000000ff,0x000000ff, false), - HOWTO(R_PCRWORD, 0, 1, 16, true, 0, complain_overflow_signed, LYNX_SPECIAL_FN, "DISP16", true, 0x0000ffff,0x0000ffff, false), - HOWTO(R_PCRLONG, 0, 2, 32, true, 0, complain_overflow_signed, LYNX_SPECIAL_FN, "DISP32", true, 0xffffffff,0xffffffff, false), - HOWTO(R_RELLONG_NEG, 0, -2, 32, false, 0, complain_overflow_bitfield, LYNX_SPECIAL_FN, "-32", true, 0xffffffff,0xffffffff, false), + HOWTO(R_RELBYTE, 0, 0, 8, false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "8", true, 0x000000ff,0x000000ff, false), + HOWTO(R_RELWORD, 0, 1, 16, false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "16", true, 0x0000ffff,0x0000ffff, false), + HOWTO(R_RELLONG, 0, 2, 32, false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "32", true, 0xffffffff,0xffffffff, false), + HOWTO(R_PCRBYTE, 0, 0, 8, true, 0, complain_overflow_signed, RELOC_SPECIAL_FN, "DISP8", true, 0x000000ff,0x000000ff, false), + HOWTO(R_PCRWORD, 0, 1, 16, true, 0, complain_overflow_signed, RELOC_SPECIAL_FN, "DISP16", true, 0x0000ffff,0x0000ffff, false), + HOWTO(R_PCRLONG, 0, 2, 32, true, 0, complain_overflow_signed, RELOC_SPECIAL_FN, "DISP32", true, 0xffffffff,0xffffffff, false), + HOWTO(R_RELLONG_NEG, 0, -2, 32, false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "-32", true, 0xffffffff,0xffffffff, false), }; #endif /* not ONLY_DECLARE_RELOCS */ @@ -71,6 +121,9 @@ extern reloc_howto_type *m68k_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); #else +#ifdef STATIC_RELOCS +static +#endif void m68k_rtype2howto(internal, relocentry) arelent *internal; @@ -88,6 +141,9 @@ } } +#ifdef STATIC_RELOCS +static +#endif int m68k_howto2rtype (internal) reloc_howto_type *internal; @@ -113,6 +169,9 @@ return R_RELLONG; } +#ifdef STATIC_RELOCS +static +#endif reloc_howto_type * m68k_reloc_type_lookup (abfd, code) bfd *abfd; @@ -139,26 +198,244 @@ m68k_rtype2howto(internal, (relocentry)->r_type) #define SELECT_RELOC(external, internal) \ - external.r_type = m68k_howto2rtype(internal); + external.r_type = m68k_howto2rtype (internal) #define coff_bfd_reloc_type_lookup m68k_reloc_type_lookup +#ifndef COFF_COMMON_ADDEND +#ifndef coff_rtype_to_howto + +#define coff_rtype_to_howto m68kcoff_rtype_to_howto + +static reloc_howto_type *m68kcoff_rtype_to_howto + PARAMS ((bfd *, asection *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *, + bfd_vma *)); + +/*ARGSUSED*/ +static reloc_howto_type * +m68kcoff_rtype_to_howto (abfd, sec, rel, h, sym, addendp) + bfd *abfd; + asection *sec; + struct internal_reloc *rel; + struct coff_link_hash_entry *h; + struct internal_syment *sym; + bfd_vma *addendp; +{ + arelent relent; + reloc_howto_type *howto; + + RTYPE2HOWTO (&relent, rel); + + howto = relent.howto; + + if (howto->pc_relative) + *addendp += sec->vma; + + return howto; +} + +#endif /* ! defined (coff_rtype_to_howto) */ +#endif /* ! defined (COFF_COMMON_ADDEND) */ + +#ifdef COFF_COMMON_ADDEND + +/* If COFF_COMMON_ADDEND is defined, then when using m68k COFF the + value stored in the .text section for a reference to a common + symbol is the value itself plus any desired offset. (taken from + work done by Ian Taylor, Cygnus Support, for I386 COFF). */ + +/* If we are producing relocateable output, we need to do some + adjustments to the object file that are not done by the + bfd_perform_relocation function. This function is called by every + reloc type to make any required adjustments. */ + +static bfd_reloc_status_type +m68kcoff_common_addend_special_fn (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + symvalue diff; + + if (output_bfd == (bfd *) NULL) + return bfd_reloc_continue; + + if (bfd_is_com_section (symbol->section)) + { + /* We are relocating a common symbol. The current value in the + object file is ORIG + OFFSET, where ORIG is the value of the + common symbol as seen by the object file when it was compiled + (this may be zero if the symbol was undefined) and OFFSET is + the offset into the common symbol (normally zero, but may be + non-zero when referring to a field in a common structure). + ORIG is the negative of reloc_entry->addend, which is set by + the CALC_ADDEND macro below. We want to replace the value in + the object file with NEW + OFFSET, where NEW is the value of + the common symbol which we are going to put in the final + object file. NEW is symbol->value. */ + diff = symbol->value + reloc_entry->addend; + } + else + { + /* For some reason bfd_perform_relocation always effectively + ignores the addend for a COFF target when producing + relocateable output. This seems to be always wrong for 386 + COFF, so we handle the addend here instead. */ + diff = reloc_entry->addend; + } + +#define DOIT(x) \ + x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) + + if (diff != 0) + { + reloc_howto_type *howto = reloc_entry->howto; + unsigned char *addr = (unsigned char *) data + reloc_entry->address; + + switch (howto->size) + { + case 0: + { + char x = bfd_get_8 (abfd, addr); + DOIT (x); + bfd_put_8 (abfd, x, addr); + } + break; + + case 1: + { + short x = bfd_get_16 (abfd, addr); + DOIT (x); + bfd_put_16 (abfd, x, addr); + } + break; + + case 2: + { + long x = bfd_get_32 (abfd, addr); + DOIT (x); + bfd_put_32 (abfd, x, addr); + } + break; + + default: + abort (); + } + } + + /* Now let bfd_perform_relocation finish everything up. */ + return bfd_reloc_continue; +} + +/* Compute the addend of a reloc. If the reloc is to a common symbol, + the object file contains the value of the common symbol. By the + time this is called, the linker may be using a different symbol + from a different object file with a different value. Therefore, we + hack wildly to locate the original symbol from this file so that we + can make the correct adjustment. This macro sets coffsym to the + symbol from the original file, and uses it to set the addend value + correctly. If this is not a common symbol, the usual addend + calculation is done, except that an additional tweak is needed for + PC relative relocs. + FIXME: This macro refers to symbols and asect; these are from the + calling function, not the macro arguments. */ + +#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ + { \ + coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ + if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ + coffsym = (obj_symbols (abfd) \ + + (cache_ptr->sym_ptr_ptr - symbols)); \ + else if (ptr) \ + coffsym = coff_symbol_from (abfd, ptr); \ + if (coffsym != (coff_symbol_type *) NULL \ + && coffsym->native->u.syment.n_scnum == 0) \ + cache_ptr->addend = - coffsym->native->u.syment.n_value; \ + else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ + && ptr->section != (asection *) NULL) \ + cache_ptr->addend = - (ptr->section->vma + ptr->value); \ + else \ + cache_ptr->addend = 0; \ + if (ptr && (reloc.r_type == R_PCRBYTE \ + || reloc.r_type == R_PCRWORD \ + || reloc.r_type == R_PCRLONG)) \ + cache_ptr->addend += asect->vma; \ + } + +#ifndef coff_rtype_to_howto + +/* coff-m68k.c uses the special COFF backend linker. We need to + adjust common symbols. */ + +/*ARGSUSED*/ +static reloc_howto_type * +m68kcoff_common_addend_rtype_to_howto (abfd, sec, rel, h, sym, addendp) + bfd *abfd; + asection *sec; + struct internal_reloc *rel; + struct coff_link_hash_entry *h; + struct internal_syment *sym; + bfd_vma *addendp; +{ + arelent relent; + reloc_howto_type *howto; + + RTYPE2HOWTO (&relent, rel); + + howto = relent.howto; + + if (howto->pc_relative) + *addendp += sec->vma; + + if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0) + { + /* This is a common symbol. The section contents include the + size (sym->n_value) as an addend. The relocate_section + function will be adding in the final value of the symbol. We + need to subtract out the current size in order to get the + correct result. */ + BFD_ASSERT (h != NULL); + *addendp -= sym->n_value; + } + + /* If the output symbol is common (in which case this must be a + relocateable link), we need to add in the final size of the + common symbol. */ + if (h != NULL && h->root.type == bfd_link_hash_common) + *addendp += h->root.u.c.size; + + return howto; +} + +#define coff_rtype_to_howto m68kcoff_common_addend_rtype_to_howto + +#endif /* ! defined (coff_rtype_to_howto) */ + +#endif /* COFF_COMMON_ADDEND */ + +#define coff_bfd_is_local_label_name m68k_coff_is_local_label_name + #define coff_relocate_section _bfd_coff_generic_relocate_section #include "coffcode.h" -const bfd_target -#ifdef TARGET_SYM - TARGET_SYM = -#else - m68kcoff_vec = +#ifndef TARGET_SYM +#define TARGET_SYM m68kcoff_vec +#endif + +#ifndef TARGET_NAME +#define TARGET_NAME "coff-m68k" #endif + +const bfd_target TARGET_SYM = { -#ifdef TARGET_NAME TARGET_NAME, -#else - "coff-m68k", /* name */ -#endif bfd_target_coff_flavour, BFD_ENDIAN_BIG, /* data byte order is big */ BFD_ENDIAN_BIG, /* header byte order is big */ @@ -200,4 +477,4 @@ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), COFF_SWAP_TABLE - }; +}; diff -urN binutils-2.7/bfd/coff-m88k.c binutils-2.8/bfd/coff-m88k.c --- binutils-2.7/bfd/coff-m88k.c Thu Jul 4 12:17:53 1996 +++ binutils-2.8/bfd/coff-m88k.c Wed Apr 30 12:55:52 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Motorola 88000 COFF "Binary Compatability Standard" files. - Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -22,11 +22,11 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/m88k.h" #include "coff/internal.h" #include "libcoff.h" +static boolean m88k_is_local_label_name PARAMS ((bfd *, const char *)); static bfd_reloc_status_type m88k_special_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); @@ -34,6 +34,18 @@ PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) + +/* On coff-m88k, local labels start with '@'. */ + +#define coff_bfd_is_local_label_name m88k_is_local_label_name + +static boolean +m88k_is_local_label_name (abfd, name) + bfd *abfd; + const char *name; +{ + return name[0] == '@'; +} static bfd_reloc_status_type m88k_special_reloc (abfd, reloc_entry, symbol, data, diff -urN binutils-2.7/bfd/coff-mips.c binutils-2.8/bfd/coff-mips.c --- binutils-2.7/bfd/coff-mips.c Thu Jul 4 12:17:55 1996 +++ binutils-2.8/bfd/coff-mips.c Wed Apr 30 12:55:53 1997 @@ -1,5 +1,5 @@ /* BFD back-end for MIPS Extended-Coff files. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -112,6 +112,9 @@ asection *, struct ecoff_link_hash_entry *, bfd_byte *, bfd_vma)); +static reloc_howto_type *mips_bfd_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); + /* ECOFF has COFF sections, but the debugging information is stored in a completely different format. ECOFF targets use some of the @@ -623,10 +626,21 @@ REFLO reloc, because there is a carry from the REFLO to the REFHI. Here we just save the information we need; we do the actual relocation when we see the REFLO. MIPS ECOFF requires that the - REFLO immediately follow the REFHI, so this ought to work. */ + REFLO immediately follow the REFHI. As a GNU extension, we permit + an arbitrary number of HI relocs to be associated with a single LO + reloc. This extension permits gcc to output the HI and LO relocs + itself. */ + +struct mips_hi +{ + struct mips_hi *next; + bfd_byte *addr; + bfd_vma addend; +}; -static bfd_byte *mips_refhi_addr; -static bfd_vma mips_refhi_addend; +/* FIXME: This should not be a static variable. */ + +static struct mips_hi *mips_refhi_list; static bfd_reloc_status_type mips_refhi_reloc (abfd, @@ -646,6 +660,7 @@ { bfd_reloc_status_type ret; bfd_vma relocation; + struct mips_hi *n; /* If we're relocating, and this an external symbol, we don't want to change anything. */ @@ -675,8 +690,13 @@ return bfd_reloc_outofrange; /* Save the information, and let REFLO do the actual relocation. */ - mips_refhi_addr = (bfd_byte *) data + reloc_entry->address; - mips_refhi_addend = relocation; + n = (struct mips_hi *) bfd_malloc (sizeof *n); + if (n == NULL) + return bfd_reloc_outofrange; + n->addr = (bfd_byte *) data + reloc_entry->address; + n->addend = relocation; + n->next = mips_refhi_list; + mips_refhi_list = n; if (output_bfd != (bfd *) NULL) reloc_entry->address += input_section->output_offset; @@ -704,36 +724,48 @@ bfd *output_bfd; char **error_message; { - if (mips_refhi_addr != (bfd_byte *) NULL) + if (mips_refhi_list != NULL) { - unsigned long insn; - unsigned long val; - unsigned long vallo; - - /* Do the REFHI relocation. Note that we actually don't need to - know anything about the REFLO itself, except where to find - the low 16 bits of the addend needed by the REFHI. */ - insn = bfd_get_32 (abfd, mips_refhi_addr); - vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) - & 0xffff); - val = ((insn & 0xffff) << 16) + vallo; - val += mips_refhi_addend; - - /* The low order 16 bits are always treated as a signed value. - Therefore, a negative value in the low order bits requires an - adjustment in the high order bits. We need to make this - adjustment in two ways: once for the bits we took from the - data, and once for the bits we are putting back in to the - data. */ - if ((vallo & 0x8000) != 0) - val -= 0x10000; - if ((val & 0x8000) != 0) - val += 0x10000; + struct mips_hi *l; - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, mips_refhi_addr); + l = mips_refhi_list; + while (l != NULL) + { + unsigned long insn; + unsigned long val; + unsigned long vallo; + struct mips_hi *next; + + /* Do the REFHI relocation. Note that we actually don't + need to know anything about the REFLO itself, except + where to find the low 16 bits of the addend needed by the + REFHI. */ + insn = bfd_get_32 (abfd, l->addr); + vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) + & 0xffff); + val = ((insn & 0xffff) << 16) + vallo; + val += l->addend; + + /* The low order 16 bits are always treated as a signed + value. Therefore, a negative value in the low order bits + requires an adjustment in the high order bits. We need + to make this adjustment in two ways: once for the bits we + took from the data, and once for the bits we are putting + back in to the data. */ + if ((vallo & 0x8000) != 0) + val -= 0x10000; + if ((val & 0x8000) != 0) + val += 0x10000; + + insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); + bfd_put_32 (abfd, insn, l->addr); + + next = l->next; + free (l); + l = next; + } - mips_refhi_addr = (bfd_byte *) NULL; + mips_refhi_list = NULL; } /* Now do the REFLO reloc in the usual way. */ @@ -888,8 +920,9 @@ are Cygnus extensions used when generating position independent code for embedded systems. */ -static bfd_byte *mips_relhi_addr; -static bfd_vma mips_relhi_addend; +/* FIXME: This should not be a static variable. */ + +static struct mips_hi *mips_relhi_list; static bfd_reloc_status_type mips_relhi_reloc (abfd, @@ -909,6 +942,7 @@ { bfd_reloc_status_type ret; bfd_vma relocation; + struct mips_hi *n; /* If this is a reloc against a section symbol, then it is correct in the object file. The only time we want to change this case is @@ -947,8 +981,13 @@ return bfd_reloc_outofrange; /* Save the information, and let RELLO do the actual relocation. */ - mips_relhi_addr = (bfd_byte *) data + reloc_entry->address; - mips_relhi_addend = relocation; + n = (struct mips_hi *) bfd_malloc (sizeof *n); + if (n == NULL) + return bfd_reloc_outofrange; + n->addr = (bfd_byte *) data + reloc_entry->address; + n->addend = relocation; + n->next = mips_relhi_list; + mips_relhi_list = n; if (output_bfd != (bfd *) NULL) reloc_entry->address += input_section->output_offset; @@ -976,46 +1015,58 @@ bfd *output_bfd; char **error_message; { - if (mips_relhi_addr != (bfd_byte *) NULL) + if (mips_relhi_list != NULL) { - unsigned long insn; - unsigned long val; - unsigned long vallo; - - /* Do the RELHI relocation. Note that we actually don't need to - know anything about the RELLO itself, except where to find - the low 16 bits of the addend needed by the RELHI. */ - insn = bfd_get_32 (abfd, mips_relhi_addr); - vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) - & 0xffff); - val = ((insn & 0xffff) << 16) + vallo; - val += mips_relhi_addend; - - /* If the symbol is defined, make val PC relative. If the - symbol is not defined we don't want to do this, because we - don't want the value in the object file to incorporate the - address of the reloc. */ - if (! bfd_is_und_section (bfd_get_section (symbol)) - && ! bfd_is_com_section (bfd_get_section (symbol))) - val -= (input_section->output_section->vma - + input_section->output_offset - + reloc_entry->address); - - /* The low order 16 bits are always treated as a signed value. - Therefore, a negative value in the low order bits requires an - adjustment in the high order bits. We need to make this - adjustment in two ways: once for the bits we took from the - data, and once for the bits we are putting back in to the - data. */ - if ((vallo & 0x8000) != 0) - val -= 0x10000; - if ((val & 0x8000) != 0) - val += 0x10000; + struct mips_hi *l; - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, mips_relhi_addr); + l = mips_relhi_list; + while (l != NULL) + { + unsigned long insn; + unsigned long val; + unsigned long vallo; + struct mips_hi *next; + + /* Do the RELHI relocation. Note that we actually don't + need to know anything about the RELLO itself, except + where to find the low 16 bits of the addend needed by the + RELHI. */ + insn = bfd_get_32 (abfd, l->addr); + vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) + & 0xffff); + val = ((insn & 0xffff) << 16) + vallo; + val += l->addend; + + /* If the symbol is defined, make val PC relative. If the + symbol is not defined we don't want to do this, because + we don't want the value in the object file to incorporate + the address of the reloc. */ + if (! bfd_is_und_section (bfd_get_section (symbol)) + && ! bfd_is_com_section (bfd_get_section (symbol))) + val -= (input_section->output_section->vma + + input_section->output_offset + + reloc_entry->address); + + /* The low order 16 bits are always treated as a signed + value. Therefore, a negative value in the low order bits + requires an adjustment in the high order bits. We need + to make this adjustment in two ways: once for the bits we + took from the data, and once for the bits we are putting + back in to the data. */ + if ((vallo & 0x8000) != 0) + val -= 0x10000; + if ((val & 0x8000) != 0) + val += 0x10000; + + insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); + bfd_put_32 (abfd, insn, l->addr); + + next = l->next; + free (l); + l = next; + } - mips_relhi_addr = (bfd_byte *) NULL; + mips_relhi_list = NULL; } /* If this is a reloc against a section symbol, then it is correct @@ -1194,8 +1245,8 @@ boolean got_lo; struct internal_reloc lo_int_rel; - BFD_ASSERT (input_bfd->xvec->header_byteorder - == output_bfd->xvec->header_byteorder); + BFD_ASSERT (input_bfd->xvec->byteorder + == output_bfd->xvec->byteorder); /* We keep a table mapping the symndx found in an internal reloc to the appropriate section. This is faster than looking up the @@ -1261,6 +1312,7 @@ for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++) { struct internal_reloc int_rel; + boolean use_lo; bfd_vma addend; reloc_howto_type *howto; struct ecoff_link_hash_entry *h = NULL; @@ -1285,16 +1337,33 @@ if (int_rel.r_type == MIPS_R_REFHI || int_rel.r_type == MIPS_R_RELHI) { - BFD_ASSERT ((ext_rel + 1) < ext_rel_end); - mips_ecoff_swap_reloc_in (input_bfd, (PTR) (ext_rel + 1), - &lo_int_rel); - BFD_ASSERT ((lo_int_rel.r_type - == (int_rel.r_type == MIPS_R_REFHI - ? MIPS_R_REFLO - : MIPS_R_RELLO)) - && int_rel.r_extern == lo_int_rel.r_extern - && int_rel.r_symndx == lo_int_rel.r_symndx); - got_lo = true; + struct external_reloc *lo_ext_rel; + + /* As a GNU extension, permit an arbitrary number of REFHI + or RELHI relocs before the REFLO or RELLO reloc. This + permits gcc to emit the HI and LO relocs itself. */ + for (lo_ext_rel = ext_rel + 1; + lo_ext_rel < ext_rel_end; + lo_ext_rel++) + { + mips_ecoff_swap_reloc_in (input_bfd, (PTR) lo_ext_rel, + &lo_int_rel); + if (lo_int_rel.r_type != int_rel.r_type) + break; + } + + if (lo_ext_rel < ext_rel_end + && (lo_int_rel.r_type + == (int_rel.r_type == MIPS_R_REFHI + ? MIPS_R_REFLO + : MIPS_R_RELLO)) + && int_rel.r_extern == lo_int_rel.r_extern + && int_rel.r_symndx == lo_int_rel.r_symndx) + { + use_lo = true; + if (lo_ext_rel == ext_rel + 1) + got_lo = true; + } } howto = &mips_howto_table[int_rel.r_type]; @@ -1570,8 +1639,8 @@ being against a section, we must put a special value into the r_offset field. This value is the old addend. The r_offset for - both the RELOHI and RELLO relocs are the - same, and we set both when we see RELHI. */ + both the RELHI and RELLO relocs are the same, + and we set both when we see RELHI. */ if (int_rel.r_type == MIPS_R_RELHI) { long addhi, addlo; @@ -1586,17 +1655,23 @@ addhi -= 0x10000; addhi <<= 16; - addlo = bfd_get_32 (input_bfd, - (contents - + adjust - + lo_int_rel.r_vaddr - - input_section->vma)); - addlo &= 0xffff; - if (addlo & 0x8000) - addlo -= 0x10000; + if (! use_lo) + addlo = 0; + else + { + addlo = bfd_get_32 (input_bfd, + (contents + + adjust + + lo_int_rel.r_vaddr + - input_section->vma)); + addlo &= 0xffff; + if (addlo & 0x8000) + addlo -= 0x10000; + + lo_int_rel.r_offset = addhi + addlo; + } int_rel.r_offset = addhi + addlo; - lo_int_rel.r_offset = int_rel.r_offset; } } @@ -1660,7 +1735,8 @@ - input_section->vma)); else { - mips_relocate_hi (&int_rel, &lo_int_rel, + mips_relocate_hi (&int_rel, + use_lo ? &lo_int_rel : NULL, input_bfd, input_section, contents, adjust, relocation, int_rel.r_type == MIPS_R_RELHI); @@ -1714,7 +1790,7 @@ adding in the start address. */ if (howto->pc_relative) { - if (int_rel.r_type != MIPS_R_RELHI) + if (int_rel.r_type != MIPS_R_RELHI || ! use_lo) relocation += int_rel.r_vaddr + adjust; else relocation += lo_int_rel.r_vaddr + adjust; @@ -1734,8 +1810,9 @@ addend); else { - mips_relocate_hi (&int_rel, &lo_int_rel, input_bfd, - input_section, contents, adjust, + mips_relocate_hi (&int_rel, + use_lo ? &lo_int_rel : NULL, + input_bfd, input_section, contents, adjust, relocation, int_rel.r_type == MIPS_R_RELHI); r = bfd_reloc_ok; @@ -1801,7 +1878,7 @@ if (section_tdata == (struct ecoff_section_tdata *) NULL) { sec->used_by_bfd = - (PTR) bfd_alloc_by_size_t (abfd, sizeof (struct ecoff_section_tdata)); + (PTR) bfd_alloc (abfd, sizeof (struct ecoff_section_tdata)); if (sec->used_by_bfd == NULL) return false; @@ -2037,7 +2114,7 @@ size_t size; size = sec->reloc_count * sizeof (long); - offsets = (long *) bfd_alloc_by_size_t (abfd, size); + offsets = (long *) bfd_alloc (abfd, size); if (offsets == (long *) NULL) goto error_return; memset (offsets, 0, size); @@ -2420,7 +2497,7 @@ (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */ mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out, mips_ecoff_swap_scnhdr_out, - FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, true, false, + FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, true, false, 4, mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in, mips_ecoff_swap_scnhdr_in, NULL, mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook, @@ -2581,6 +2658,48 @@ _bfd_generic_mkarchive, bfd_false}, {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */ _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (_bfd_ecoff), + BFD_JUMP_TABLE_COPY (_bfd_ecoff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_ecoff), + BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff), + BFD_JUMP_TABLE_RELOCS (_bfd_ecoff), + BFD_JUMP_TABLE_WRITE (_bfd_ecoff), + BFD_JUMP_TABLE_LINK (_bfd_ecoff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + (PTR) &mips_ecoff_backend_data +}; + +const bfd_target ecoff_biglittle_vec = +{ + "ecoff-biglittlemips", /* name */ + bfd_target_ecoff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_BIG, /* header byte order is big */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), + 0, /* leading underscore */ + ' ', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + _bfd_ecoff_archive_p, _bfd_dummy_target}, + {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, BFD_JUMP_TABLE_GENERIC (_bfd_ecoff), BFD_JUMP_TABLE_COPY (_bfd_ecoff), diff -urN binutils-2.7/bfd/coff-ppc.c binutils-2.8/bfd/coff-ppc.c --- binutils-2.7/bfd/coff-ppc.c Thu Jul 4 12:17:57 1996 +++ binutils-2.8/bfd/coff-ppc.c Wed Apr 30 12:55:53 1997 @@ -1,5 +1,5 @@ /* BFD back-end for PowerPC Microsoft Portable Executable files. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Original version pieced together by Kim Knuttila (krk@cygnus.com) @@ -36,7 +36,6 @@ #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/powerpc.h" #include "coff/internal.h" @@ -51,6 +50,12 @@ #include "libcoff.h" +/* This file is compiled more than once, but we only compile the + final_link routine once. */ +extern boolean ppc_bfd_coff_final_link + PARAMS ((bfd *, struct bfd_link_info *)); +extern void dump_toc PARAMS ((PTR)); + /* The toc is a set of bfd_vma fields. We use the fact that valid */ /* addresses are even (i.e. the bit representing "1" is off) to allow */ /* us to encode a little extra information in the field */ @@ -68,6 +73,33 @@ #define MARK_AS_WRITTEN(x) ((x) |= 1) #define MAKE_ADDR_AGAIN(x) ((x) &= ~1) + +/* Turn on this check if you suspect something amiss in the hash tables */ +#ifdef DEBUG_HASH + +/* Need a 7 char string for an eye catcher */ +#define EYE "krkjunk" + +#define HASH_CHECK_DCL char eye_catcher[8]; +#define HASH_CHECK_INIT(ret) strcpy(ret->eye_catcher, EYE) +#define HASH_CHECK(addr) \ + if (strcmp(addr->eye_catcher, EYE) != 0) \ + { \ + fprintf(stderr,\ + "File %s, line %d, Hash check failure, bad eye %8s\n", \ + __FILE__, __LINE__, addr->eye_catcher); \ + abort(); \ + } + + +#else + +#define HASH_CHECK_DCL +#define HASH_CHECK_INIT(ret) +#define HASH_CHECK(addr) + +#endif + /* In order not to add an int to every hash table item for every coff linker, we define our own hash table, derived from the coff one */ @@ -82,20 +114,10 @@ bfd_vma toc_offset; /* Our addition, as required */ int symbol_is_glue; unsigned long int glue_insn; - char eye_catcher[8]; -}; -/* Need a 7 char string for an eye catcher */ -#define EYE "krkjunk" + HASH_CHECK_DCL +}; -#define CHECK_EYE(addr) \ - if (strcmp(addr, EYE) != 0) \ - { \ - fprintf(stderr,\ - "File %s, line %d, Hash check failure, bad eye %8s\n", \ - __FILE__, __LINE__, addr); \ - abort(); \ - } /* PE linker hash table. */ @@ -107,6 +129,20 @@ static struct bfd_hash_entry *ppc_coff_link_hash_newfunc PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static boolean ppc_coff_link_hash_table_init + PARAMS ((struct ppc_coff_link_hash_table *, bfd *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *))); +static struct bfd_link_hash_table *ppc_coff_link_hash_table_create + PARAMS ((bfd *)); +static boolean coff_ppc_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **)); +static reloc_howto_type *coff_ppc_rtype_to_howto + PARAMS ((bfd *, asection *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *, + bfd_vma *)); /* Routine to create an entry in the link hash table. */ @@ -140,7 +176,8 @@ SET_UNALLOCATED(ret->toc_offset); ret->symbol_is_glue = 0; ret->glue_insn = 0; - strcpy(ret->eye_catcher, EYE); + + HASH_CHECK_INIT(ret); } return (struct bfd_hash_entry *) ret; @@ -186,8 +223,8 @@ /* The nt loader points the toc register to &toc + 32768, in order to */ -/* use the complete range of a 16-bit displacement (I guess). We have */ -/* to adjust for this when we fix up loads displaced off the toc reg. */ +/* use the complete range of a 16-bit displacement. We have to adjust */ +/* for this when we fix up loads displaced off the toc reg. */ #define TOC_LOAD_ADJUSTMENT (-32768) #define TOC_SECTION_NAME ".private.toc" @@ -786,6 +823,10 @@ /* toc construction and management routines */ + +/* This file is compiled twice, and these variables are defined in one + of the compilations. FIXME: This is confusing and weird. Also, + BFD should not use global variables. */ extern bfd* bfd_of_toc_owner; extern long int global_toc_size; @@ -819,8 +860,11 @@ extern struct list_ele *head; extern struct list_ele *tail; +static void record_toc + PARAMS ((asection *, int, enum ref_category, const char *)); + static void -record_toc(toc_section, our_toc_offset, cat, name) +record_toc (toc_section, our_toc_offset, cat, name) asection *toc_section; int our_toc_offset; enum ref_category cat; @@ -851,8 +895,13 @@ #ifdef COFF_IMAGE_WITH_PE +static boolean ppc_record_toc_entry + PARAMS ((bfd *, struct bfd_link_info *, asection *, int, enum toc_type)); +static void ppc_mark_symbol_as_glue + PARAMS ((bfd *, int, struct internal_reloc *)); + /* record a toc offset against a symbol */ -static int +static boolean ppc_record_toc_entry(abfd, info, sec, sym, toc_kind) bfd *abfd; struct bfd_link_info *info; @@ -861,7 +910,6 @@ enum toc_type toc_kind; { struct ppc_coff_link_hash_entry *h; - int ret_val; const char *name; int *local_syms; @@ -871,7 +919,7 @@ h = (struct ppc_coff_link_hash_entry *) (obj_coff_sym_hashes (abfd)[sym]); if (h != 0) { - CHECK_EYE(h->eye_catcher); + HASH_CHECK(h); } if (h == 0) @@ -896,31 +944,15 @@ if (IS_UNALLOCATED(local_syms[sym])) { local_syms[sym] = global_toc_size; - ret_val = global_toc_size; global_toc_size += 4; /* The size must fit in a 16bit displacment */ - if (global_toc_size >= 65535) + if (global_toc_size > 65535) { - fprintf(stderr, - "Exceeded toc size of 65535\n"); - abort(); + (*_bfd_error_handler) ("TOC overflow"); + bfd_set_error (bfd_error_file_too_big); + return false; } - -#ifdef TOC_DEBUG - fprintf(stderr, - "Setting toc_offset for local sym %d to %d\n", - sym, ret_val); -#endif - } - else - { - ret_val = local_syms[sym]; -#ifdef TOC_DEBUG - fprintf(stderr, - "toc_offset already set for local sym %d to %d\n", - sym, ret_val); -#endif } } else @@ -932,155 +964,21 @@ if (IS_UNALLOCATED(h->toc_offset)) { h->toc_offset = global_toc_size; - ret_val = global_toc_size; global_toc_size += 4; /* The size must fit in a 16bit displacment */ if (global_toc_size >= 65535) { - fprintf(stderr, - "Exceeded toc size of 65535\n"); - abort(); + (*_bfd_error_handler) ("TOC overflow"); + bfd_set_error (bfd_error_file_too_big); + return false; } - -#ifdef TOC_DEBUG - fprintf(stderr, - "Setting toc_offset for sym %d (%s) [h=%p] to %d\n", - sym, name, h, ret_val); -#endif - } - else - { - ret_val = h->toc_offset; -#ifdef TOC_DEBUG - fprintf(stderr, - "toc_offset already set for sym %d (%s) [h=%p] to %d\n", - sym, name, h, ret_val); -#endif } } - return ret_val; -} - -#endif /* COFF_IMAGE_WITH_PE */ - -#if 0 - -/* FIXME: record a toc offset against a data-in-toc symbol */ -/* Now, there is currenly some confusion on what this means. In some - compilers one sees the moral equivalent of: - .tocd - define some data - .text - refer to the data with a [tocv] qualifier - In general, one sees something to indicate that a tocd has been - seen, and that would trigger the allocation of data in toc. The IBM - docs seem to suggest that anything with the TOCDEFN qualifier should - never trigger storage allocation. However, in the kernel32.lib that - we've been using for our test bed, there are a couple of variables - referenced that fail that test. - - So it can't work that way. -*/ -static int -ppc_record_data_in_toc_entry(abfd, info, sec, sym, toc_kind) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - int sym; - enum toc_type toc_kind; -{ - struct ppc_coff_link_hash_entry *h = 0; - int ret_val; - const char *name; - - int *local_syms; - - h = (struct ppc_coff_link_hash_entry *) (obj_coff_sym_hashes (abfd)[sym]); - - if (h == 0) - { - local_syms = obj_coff_local_toc_table(abfd); - if (local_syms == 0) - { - int i; - /* allocate a table */ - local_syms = - (int *) bfd_zalloc (abfd, - obj_raw_syment_count(abfd) * sizeof(int)); - if (local_syms == 0) - return false; - obj_coff_local_toc_table(abfd) = local_syms; - for (i = 0; i < obj_raw_syment_count(abfd); ++i) - { - SET_UNALLOCATED(local_syms[i]); - } - } - - if (IS_UNALLOCATED(local_syms[sym])) - { - local_syms[sym] = global_toc_size; - ret_val = global_toc_size; - global_toc_size += 4; -#ifdef TOC_DEBUG - fprintf(stderr, - "Setting data_in_toc_offset for local sym %d to %d\n", - sym, ret_val); -#endif - } - else - { - ret_val = local_syms[sym]; -#ifdef TOC_DEBUG - fprintf(stderr, - "data_in_toc_offset already set for local sym %d to %d\n", - sym, ret_val); -#endif - } - } - else - { - CHECK_EYE(h->eye_catcher); - - name = h->root.root.root.string; - - /* check to see if there's a toc slot allocated. If not, do it - here. It will be used in relocate_section */ - if (IS_UNALLOCATED(h->toc_offset)) - { -#if 0 - h->toc_offset = global_toc_size; -#endif - ret_val = global_toc_size; - /* We're allocating a chunk of the toc, as opposed to a slot */ - /* FIXME: alignment? */ - - global_toc_size += 4; -#ifdef TOC_DEBUG - fprintf(stderr, - "Setting data_in_toc_offset for sym %d (%s) [h=%p] to %d\n", - sym, name, h, ret_val); -#endif - } - else - { - ret_val = h->toc_offset; -#ifdef TOC_DEBUG - fprintf(stderr, - "data_in_toc_offset already set for sym %d (%s) [h=%p] to %d\n", - sym, name, h, ret_val); -#endif - } - } - - return ret_val; + return true; } -#endif /* 0 */ - -#ifdef COFF_IMAGE_WITH_PE - /* record a toc offset against a symbol */ static void ppc_mark_symbol_as_glue(abfd, sym, rel) @@ -1091,11 +989,8 @@ struct ppc_coff_link_hash_entry *h; h = (struct ppc_coff_link_hash_entry *) (obj_coff_sym_hashes (abfd)[sym]); -#ifdef DEBUG_RELOC - fprintf(stderr, - "ppc_mark_symbol_as_glue:\n"); -#endif - CHECK_EYE(h->eye_catcher); + + HASH_CHECK(h); h->symbol_is_glue = 1; h->glue_insn = bfd_get_32 (abfd, (bfd_byte *) &rel->r_vaddr); @@ -1105,32 +1000,6 @@ #endif /* COFF_IMAGE_WITH_PE */ -#if 0 - -/* Provided the symbol, returns the value reffed */ -static long get_symbol_value PARAMS ((asymbol *)); - -static long -get_symbol_value (symbol) - asymbol *symbol; -{ - long relocation = 0; - - if (bfd_is_com_section (symbol->section)) - { - relocation = 0; - } - else - { - relocation = symbol->value + - symbol->section->output_section->vma + - symbol->section->output_offset; - } - - return(relocation); -} - -#endif /* 0 */ /* Return true if this relocation should appear in the output .reloc section. */ @@ -1180,8 +1049,6 @@ unsigned short r_type; unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/ - fprintf(stderr, "pe_ppc_reloc (%s)\n", TARGET_LITTLE_NAME); - r_type = reloc_entry->howto->type; if (output_bfd) @@ -1240,15 +1107,6 @@ bfd_vma relocation; reloc_howto_type *howto = 0; -#ifdef DEBUG_RELOC - fprintf(stderr, - "pe_ppc_relocate_section (%s) for %s in bfd %s\n", - TARGET_LITTLE_NAME, - input_section->name, - input_bfd->filename); - -#endif - /* If we are performing a relocateable link, we don't need to do a thing. The caller will take care of adjusting the reloc addresses and symbol indices. */ @@ -1274,23 +1132,6 @@ unsigned short r_type = EXTRACT_TYPE (rel->r_type); unsigned short r_flags = EXTRACT_FLAGS(rel->r_type); -#ifdef DEBUG_RELOC - /* now examine flags */ - if (r_flags != 0) - { - fprintf (stderr, "Reloc with flags found!"); - if ( r_flags & IMAGE_REL_PPC_NEG ) - fprintf (stderr, " NEG"); - if ( r_flags & IMAGE_REL_PPC_BRTAKEN ) - fprintf (stderr, " BRTAKEN"); - if ( r_flags & IMAGE_REL_PPC_BRNTAKEN ) - fprintf (stderr, " BRNTAKEN"); - if ( r_flags & IMAGE_REL_PPC_TOCDEFN ) - fprintf (stderr, " TOCDEFN"); - fprintf(stderr, "\n"); - } -#endif - symndx = rel->r_symndx; loc = contents + rel->r_vaddr - input_section->vma; @@ -1308,7 +1149,7 @@ (obj_coff_sym_hashes (input_bfd)[symndx]); if (h != 0) { - CHECK_EYE(h->eye_catcher); + HASH_CHECK(h); } sym = syms + symndx; @@ -1316,8 +1157,7 @@ if (r_type == IMAGE_REL_PPC_IMGLUE && h == 0) { - fprintf(stderr, - "relocate_section: IMGLUE reloc has no name!\n"); + /* An IMGLUE reloc must have a name. Something is very wrong. */ abort(); } @@ -1340,7 +1180,7 @@ } else { - CHECK_EYE(h->eye_catcher); + HASH_CHECK(h); if (h->root.root.type == bfd_link_hash_defined || h->root.root.type == bfd_link_hash_defweak) @@ -1352,8 +1192,6 @@ } else { - fprintf(stderr, - "missing %s\n",h->root.root.root.string); if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.root.string, input_bfd, input_section, rel->r_vaddr - input_section->vma))) @@ -1367,11 +1205,10 @@ switch (r_type) { default: - fprintf( stderr, - "ERROR: during reloc processing -- unsupported reloc %s\n", - howto->name); + (*_bfd_error_handler) + ("%s: unsupported relocation type 0x%02x", + bfd_get_filename (input_bfd), r_type); bfd_set_error (bfd_error_bad_value); - abort(); return false; case IMAGE_REL_PPC_TOCREL16: { @@ -1384,17 +1221,10 @@ { toc_section = bfd_get_section_by_name (bfd_of_toc_owner, TOC_SECTION_NAME); -#ifdef TOC_DEBUG - - fprintf(stderr, - "BFD of toc owner %p (%s), section addr of %s %p\n", - bfd_of_toc_owner, bfd_of_toc_owner->filename, - TOC_SECTION_NAME, toc_section); -#endif if ( toc_section == NULL ) { - fprintf(stderr, "No Toc section!\n"); + /* There is no toc section. Something is very wrong. */ abort(); } } @@ -1425,27 +1255,14 @@ again. */ MAKE_ADDR_AGAIN(our_toc_offset); -#ifdef TOC_DEBUG - - fprintf(stderr, - "Not writing out toc_offset of %d for %s\n", - our_toc_offset, name); -#endif } else { /* write out the toc entry */ - record_toc(toc_section, our_toc_offset, priv, strdup(name)); -#ifdef TOC_DEBUG - fprintf(stderr, - "Writing out toc_offset " - "toc_section (%p,%p)+%d val %d for %s\n", - toc_section, - toc_section->contents, - our_toc_offset, - val, - name); -#endif + record_toc(toc_section, + our_toc_offset, + priv, + strdup(name)); bfd_put_32(output_bfd, val, @@ -1477,29 +1294,19 @@ dll linkage, takes advantage of that and considers the IAT to be part of the toc, thus saving a load. */ -#ifdef DEBUG_RELOC - fprintf(stderr, - "TOCDEFN is on, (%s) (%p) our_toc_offset = %x, val (%x) vma (%x) off (%x)\n", - name, h, our_toc_offset, - val, toc_section->output_section->vma, - toc_section->output_offset); -#endif our_toc_offset = val - (toc_section->output_section->vma + toc_section->output_offset); -#ifdef DEBUG_RELOC - fprintf(stderr, - " our_toc_offset set to %x\n", our_toc_offset); -#endif - /* The size must still fit in a 16bit displacment */ if (our_toc_offset >= 65535) { - fprintf(stderr, - "Error: TOCDEFN Relocation of %d for %s exceeded displacement of 65535\n", our_toc_offset, name); - abort(); + (*_bfd_error_handler) + ("%s: Relocation for %s of %x exceeds Toc size limit", + bfd_get_filename (input_bfd), name, our_toc_offset); + bfd_set_error (bfd_error_bad_value); + return false; } record_toc(toc_section, our_toc_offset, pub, strdup(name)); @@ -1511,28 +1318,11 @@ again. */ MAKE_ADDR_AGAIN(our_toc_offset); -#ifdef TOC_DEBUG - fprintf(stderr, - "Not writing out toc_offset of %d for %s\n", - our_toc_offset, name); -#endif } else { record_toc(toc_section, our_toc_offset, pub, strdup(name)); -#ifdef TOC_DEBUG - /* write out the toc entry */ - fprintf(stderr, - "Writing out toc_offset " - "toc_section (%p,%p)+%d val %d for %s\n", - toc_section, - toc_section->contents, - our_toc_offset, - val, - name); -#endif - /* write out the toc entry */ bfd_put_32(output_bfd, val, @@ -1560,10 +1350,6 @@ if (coff_data(output_bfd)->pe) addr -= pe_data(output_bfd)->pe_opthdr.ImageBase; -#ifdef DEBUG_RELOC - fprintf(stderr, - " Toc Section .reloc candidate addr = %x\n", addr); -#endif fwrite (&addr, 1,4, (FILE *) info->base_file); } @@ -1572,9 +1358,12 @@ if ( (r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN && our_toc_offset > toc_section->_raw_size) { - fprintf(stderr, - "reloc offset is bigger than the toc size!\n"); - abort(); + (*_bfd_error_handler) + ("%s: Relocation exceeds allocated TOC (%x)", + bfd_get_filename (input_bfd), + toc_section->_raw_size); + bfd_set_error (bfd_error_bad_value); + return false; } /* Now we know the relocation for this toc reference */ @@ -1647,15 +1436,13 @@ if (h->symbol_is_glue == 1) break; my_name = h->root.root.root.string; - fprintf(stderr, - "Warning: previously missed IMGLUE reloc %s \n", - howto->name, - bfd_get_filename(input_bfd), - input_section->name); - break; + (*_bfd_error_handler) + ("%s: Out of order IMGLUE reloc for %s", + bfd_get_filename (input_bfd), my_name); + bfd_set_error (bfd_error_bad_value); + return false; } - break; case IMAGE_REL_PPC_ADDR32NB: { @@ -1686,12 +1473,6 @@ "__idata4_magic__", false, false, true); import_table_size = myh->root.u.def.value; -#ifdef DEBUG_RELOC - fprintf(stderr, - "first computation triggered fta %x, ts %d(%x), its %d(%x)\n", - first_thunk_address, thunk_size, thunk_size, import_table_size, - import_table_size); -#endif } if (h == 0) @@ -1720,7 +1501,7 @@ false, false, true); if (myh == 0) { - fprintf(stderr, "Missing idata magic cookies, this cannot work anyway...\n"); + /* Missing magic cookies. Something is very wrong. */ abort(); } @@ -1747,13 +1528,6 @@ "__idata4_magic__", false, false, true); import_table_size = myh->root.u.def.value; -#ifdef DEBUG_RELOC - - fprintf(stderr, - "second computation triggered fta %x, ts %d(%x), its %d(%x)\n", - first_thunk_address, thunk_size, thunk_size, import_table_size, - import_table_size); -#endif } } } @@ -1803,19 +1577,8 @@ if (coff_data(output_bfd)->pe) { -#ifdef DEBUG_RELOC - bfd_vma before_addr = addr; -#endif addr -= pe_data(output_bfd)->pe_opthdr.ImageBase; -#ifdef DEBUG_RELOC - fprintf(stderr, - " adjusted down from %x to %x", before_addr, addr); -#endif } -#ifdef DEBUG_RELOC - fprintf(stderr, "\n"); -#endif - fwrite (&addr, 1,4, (FILE *) info->base_file); } } @@ -1846,28 +1609,12 @@ buf[SYMNMLEN] = '\0'; name = buf; } -#if 0 - else - { - name = _bfd_coff_internal_syment_name (input_bfd, sym, buf); - if (name == NULL) - return false; - } -#endif if (! ((*info->callbacks->reloc_overflow) (info, name, howto->name, (bfd_vma) 0, input_bfd, input_section, rel->r_vaddr - input_section->vma))) { -#ifdef DEBUG_RELOC - fprintf(stderr, - "pe_ppc_relocate_section (%s) for %s in bfd %s RETURNING TRUE\n", - TARGET_LITTLE_NAME, - input_section->name, - input_bfd->filename); - -#endif return false; } } @@ -1875,21 +1622,15 @@ } -#ifdef DEBUG_RELOC - fprintf(stderr, - "pe_ppc_relocate_section (%s) for %s in bfd %s RETURNING TRUE\n", - TARGET_LITTLE_NAME, - input_section->name, - input_bfd->filename); - -#endif - return true; } - #ifdef COFF_IMAGE_WITH_PE +/* FIXME: BFD should not use global variables. This file is compiled + twice, and these variables are shared. This is confusing and + weird. */ + long int global_toc_size = 4; bfd* bfd_of_toc_owner = 0; @@ -1909,8 +1650,8 @@ h3 = " Offset spelling (if present)\n"; void -dump_toc(vfile) - void *vfile; +dump_toc (vfile) + PTR vfile; { FILE *file = vfile; struct list_ele *t; @@ -1967,15 +1708,14 @@ if (bfd_of_toc_owner == 0) { - fprintf(stderr, - "There is no bfd that owns the toc section!\n"); + /* No toc owner? Something is very wrong. */ abort(); } s = bfd_get_section_by_name ( bfd_of_toc_owner , TOC_SECTION_NAME); if (s == NULL) { - fprintf(stderr, "No Toc section!\n"); + /* No toc section? Something is very wrong. */ abort(); } @@ -1996,12 +1736,6 @@ asection *sec; struct internal_reloc *i, *rel; -#ifdef DEBUG_RELOC - fprintf(stderr, - "ppc_process_before_allocation: BFD %s\n", - bfd_get_filename(abfd)); -#endif - /* here we have a bfd that is to be included on the link. We have a hook to do reloc rummaging, before section sizes are nailed down. */ @@ -2017,15 +1751,6 @@ for (; sec != 0; sec = sec->next) { - int toc_offset; - -#ifdef DEBUG_RELOC - fprintf(stderr, - " section %s reloc count %d\n", - sec->name, - sec->reloc_count); -#endif - if (sec->reloc_count == 0) continue; @@ -2040,46 +1765,20 @@ { unsigned short r_type = EXTRACT_TYPE (rel->r_type); unsigned short r_flags = EXTRACT_FLAGS(rel->r_type); + boolean ok = true; -#ifdef DEBUG_RELOC - /* now examine flags */ - if (r_flags != 0) - { - fprintf (stderr, "Reloc with flags found!"); - if ( r_flags & IMAGE_REL_PPC_NEG ) - fprintf (stderr, " NEG"); - if ( r_flags & IMAGE_REL_PPC_BRTAKEN ) - fprintf (stderr, " BRTAKEN"); - if ( r_flags & IMAGE_REL_PPC_BRNTAKEN ) - fprintf (stderr, " BRNTAKEN"); - if ( r_flags & IMAGE_REL_PPC_TOCDEFN ) - fprintf (stderr, " TOCDEFN"); - fprintf(stderr, "\n"); - } -#endif - DUMP_RELOC2(ppc_coff_howto_table[r_type].name, rel); switch(r_type) { case IMAGE_REL_PPC_TOCREL16: -#if 0 - /* FIXME: - This remains unimplemented for now, as it currently adds - un-necessary elements to the toc. All we need to do today - is not do anything if TOCDEFN is on. - */ - if ( r_flags & IMAGE_REL_PPC_TOCDEFN ) - toc_offset = ppc_record_data_in_toc_entry(abfd, info, sec, - rel->r_symndx, - default_toc); - else - toc_offset = ppc_record_toc_entry(abfd, info, sec, - rel->r_symndx, default_toc); -#endif + /* if TOCDEFN is on, ignore as someone else has allocated the + toc entry */ if ( (r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN ) - toc_offset = ppc_record_toc_entry(abfd, info, sec, - rel->r_symndx, default_toc); + ok = ppc_record_toc_entry(abfd, info, sec, + rel->r_symndx, default_toc); + if (!ok) + return false; break; case IMAGE_REL_PPC_IMGLUE: ppc_mark_symbol_as_glue(abfd, rel->r_symndx, rel); @@ -2346,38 +2045,11 @@ /* the masking process only slices off the bottom byte for r_type. */ if ( r_type > MAX_RELOC_INDEX ) - { - fprintf(stderr, - "ppc_coff_rtype2howto: reloc index %d out of range [%d, %ld]\n", - internal->r_type, 0, (long) MAX_RELOC_INDEX); - abort(); - } + abort(); /* check for absolute crap */ if ( junk != 0 ) - { - fprintf(stderr, - "ppc_coff_rtype2howto: reloc index %d contains junk %d\n", - internal->r_type, junk); - abort(); - } - -#ifdef DEBUG_RELOC - /* now examine flags */ - if (r_flags != 0) - { - fprintf (stderr, "Reloc with flags found!"); - if ( r_flags & IMAGE_REL_PPC_NEG ) - fprintf (stderr, " NEG"); - if ( r_flags & IMAGE_REL_PPC_BRTAKEN ) - fprintf (stderr, " BRTAKEN"); - if ( r_flags & IMAGE_REL_PPC_BRNTAKEN ) - fprintf (stderr, " BRNTAKEN"); - if ( r_flags & IMAGE_REL_PPC_TOCDEFN ) - fprintf (stderr, " TOCDEFN"); - fprintf(stderr, "\n"); - } -#endif + abort(); switch(r_type) { @@ -2444,39 +2116,12 @@ /* the masking process only slices off the bottom byte for r_type. */ if ( r_type > MAX_RELOC_INDEX ) - { - fprintf(stderr, - "coff_ppc_rtype_to_howto: index %d out of range [%d, %ld]\n", - r_type, 0, (long) MAX_RELOC_INDEX); - abort(); - } + abort(); /* check for absolute crap */ if ( junk != 0 ) - { - fprintf(stderr, - "coff_ppc_rtype_to_howto: reloc index %d contains junk %d\n", - rel->r_type, junk); - abort(); - } - -#ifdef DEBUG_RELOC - /* now examine flags */ - if (r_flags != 0) - { - fprintf (stderr, "Reloc with flags found!"); - if ( r_flags & IMAGE_REL_PPC_NEG ) - fprintf (stderr, " NEG"); - if ( r_flags & IMAGE_REL_PPC_BRTAKEN ) - fprintf (stderr, " BRTAKEN"); - if ( r_flags & IMAGE_REL_PPC_BRNTAKEN ) - fprintf (stderr, " BRNTAKEN"); - if ( r_flags & IMAGE_REL_PPC_TOCDEFN ) - fprintf (stderr, " TOCDEFN"); - fprintf(stderr, "\n"); - } -#endif - + abort(); + switch(r_type) { case IMAGE_REL_PPC_ADDR32NB: @@ -2530,12 +2175,6 @@ bfd *abfd; bfd_reloc_code_real_type code; { - -#ifdef DEBUG_RELOC - fprintf(stderr, "ppc_coff_reloc_type_lookup for %s\n", - bfd_get_reloc_code_name(code)); -#endif - switch (code) { HOW2MAP(BFD_RELOC_32_GOTOFF, IMAGE_REL_PPC_IMGLUE); @@ -2561,8 +2200,7 @@ #define RTYPE2HOWTO(cache_ptr, dst) ppc_coff_rtype2howto (cache_ptr, dst) #ifndef COFF_IMAGE_WITH_PE -static void -ppc_coff_swap_sym_in_hook (); +static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR)); #endif /* We use the special COFF backend linker, with our own special touch. */ @@ -2625,20 +2263,13 @@ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY ; -#ifdef TOC_DEBUG - fprintf(stderr, - "ppc_coff_swap_sym_in_hook: about to create the %s section\n", - TOC_SECTION_NAME); -#endif - s = bfd_make_section (abfd, TOC_SECTION_NAME); if (s == NULL || !bfd_set_section_flags (abfd, s, flags) || !bfd_set_section_alignment (abfd, s, 2)) { - fprintf(stderr, - "toc section allocation failed!\n"); + /* FIXME: set appropriate bfd error */ abort(); } @@ -2650,13 +2281,13 @@ } #endif -boolean -ppc_bfd_coff_final_link (); - #ifndef COFF_IMAGE_WITH_PE +static boolean ppc_do_last PARAMS ((bfd *)); +static bfd *ppc_get_last PARAMS ((void)); + static boolean -ppc_do_last(abfd) +ppc_do_last (abfd) bfd *abfd; { if (abfd == bfd_of_toc_owner) @@ -2740,7 +2371,10 @@ /* Compute the file positions for all the sections. */ if (! abfd->output_has_begun) - bfd_coff_compute_section_file_positions (abfd); + { + if (! bfd_coff_compute_section_file_positions (abfd)) + return false; + } /* Count the line numbers and relocation entries required for the output file. Set the file positions for the relocs. */ @@ -2965,7 +2599,6 @@ #ifdef POWERPC_LE_PE { - extern bfd* ppc_get_last(); bfd* last_one = ppc_get_last(); if (last_one) { diff -urN binutils-2.7/bfd/coff-rs6000.c binutils-2.8/bfd/coff-rs6000.c --- binutils-2.7/bfd/coff-rs6000.c Thu Jul 4 12:17:58 1996 +++ binutils-2.8/bfd/coff-rs6000.c Wed Apr 30 12:55:53 1997 @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF" files. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. FIXME: Can someone provide a transliteration of this name into ASCII? Using the following chars caused a compiler warning on HIUX (so I replaced them with octal escapes), and isn't useful without an understanding of what @@ -31,7 +31,6 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/internal.h" #include "coff/rs6000.h" #include "libcoff.h" @@ -40,6 +39,7 @@ static boolean xcoff_mkobject PARAMS ((bfd *)); static boolean xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *)); +static boolean xcoff_is_local_label_name PARAMS ((bfd *, const char *)); static void xcoff_rtype2howto PARAMS ((arelent *, struct internal_reloc *)); static reloc_howto_type *xcoff_reloc_type_lookup @@ -53,6 +53,7 @@ static boolean xcoff_write_armap PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); static boolean xcoff_write_archive_contents PARAMS ((bfd *)); +static int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean)); /* We use our own tdata type. Its first field is the COFF tdata type, so the COFF routines are compatible. */ @@ -130,6 +131,19 @@ ox->maxstack = ix->maxstack; return true; } + +/* I don't think XCOFF really has a notion of local labels based on + name. This will mean that ld -X doesn't actually strip anything. + The AIX native linker does not have a -X option, and it ignores the + -x option. */ + +static boolean +xcoff_is_local_label_name (abfd, name) + bfd *abfd; + const char *name; +{ + return false; +} /* The XCOFF reloc table. Actually, XCOFF relocations specify the bitsize and whether they are signed or not, along with a @@ -541,6 +555,7 @@ #define coff_mkobject xcoff_mkobject #define coff_bfd_copy_private_bfd_data xcoff_copy_private_bfd_data +#define coff_bfd_is_local_label_name xcoff_is_local_label_name #define coff_bfd_reloc_type_lookup xcoff_reloc_type_lookup #define coff_relocate_section _bfd_ppc_xcoff_relocate_section diff -urN binutils-2.7/bfd/coff-sh.c binutils-2.8/bfd/coff-sh.c --- binutils-2.7/bfd/coff-sh.c Thu Jul 4 12:18:00 1996 +++ binutils-2.8/bfd/coff-sh.c Wed Apr 30 12:55:53 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Hitachi Super-H COFF binaries. - Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, . Relaxing code written by Ian Lance Taylor, . @@ -22,7 +22,6 @@ #include "bfd.h" #include "sysdep.h" -#include "obstack.h" #include "libbfd.h" #include "bfdlink.h" #include "coff/sh.h" @@ -41,7 +40,7 @@ static boolean sh_align_loads PARAMS ((bfd *, asection *, struct internal_reloc *, bfd_byte *, boolean *)); static boolean sh_swap_insns - PARAMS ((bfd *, asection *, struct internal_reloc *, bfd_byte *, bfd_vma)); + PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); static boolean sh_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, struct internal_reloc *, struct internal_syment *, asection **)); @@ -1883,7 +1882,8 @@ /* See whether instructions I1 and I2 conflict, assuming I1 comes before I2. OP1 and OP2 are the corresponding sh_opcode structures. - This should return true if the instructions can be swapped safely. */ + This should return true if there is a conflict, or false if the + instructions can be swapped safely. */ static boolean sh_insns_conflict (i1, op1, i2, op2) @@ -1902,7 +1902,7 @@ return true; if ((f1 & SETSSP) != 0 && (f2 & USESSP) != 0) - return false; + return true; if ((f2 & SETSSP) != 0 && (f1 & USESSP) != 0) return true; @@ -1972,6 +1972,189 @@ return false; } +/* Try to align loads and stores within a span of memory. This is + called by both the ELF and the COFF sh targets. ABFD and SEC are + the BFD and section we are examining. CONTENTS is the contents of + the section. SWAP is the routine to call to swap two instructions. + RELOCS is a pointer to the internal relocation information, to be + passed to SWAP. PLABEL is a pointer to the current label in a + sorted list of labels; LABEL_END is the end of the list. START and + STOP are the range of memory to examine. If a swap is made, + *PSWAPPED is set to true. */ + +boolean +_bfd_sh_align_load_span (abfd, sec, contents, swap, relocs, + plabel, label_end, start, stop, pswapped) + bfd *abfd; + asection *sec; + bfd_byte *contents; + boolean (*swap) PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); + PTR relocs; + bfd_vma **plabel; + bfd_vma *label_end; + bfd_vma start; + bfd_vma stop; + boolean *pswapped; +{ + bfd_vma i; + + /* Instructions should be aligned on 2 byte boundaries. */ + if ((start & 1) == 1) + ++start; + + /* Now look through the unaligned addresses. */ + i = start; + if ((i & 2) == 0) + i += 2; + for (; i < stop; i += 4) + { + unsigned int insn; + const struct sh_opcode *op; + unsigned int prev_insn = 0; + const struct sh_opcode *prev_op = NULL; + + insn = bfd_get_16 (abfd, contents + i); + op = sh_insn_info (insn); + if (op == NULL + || (op->flags & (LOAD | STORE)) == 0) + continue; + + /* This is a load or store which is not on a four byte boundary. */ + + while (*plabel < label_end && **plabel < i) + ++*plabel; + + if (i > start) + { + prev_insn = bfd_get_16 (abfd, contents + i - 2); + prev_op = sh_insn_info (prev_insn); + + /* If the load/store instruction is in a delay slot, we + can't swap. */ + if (prev_op == NULL + || (prev_op->flags & DELAY) != 0) + continue; + } + if (i > start + && (*plabel >= label_end || **plabel != i) + && prev_op != NULL + && (prev_op->flags & (LOAD | STORE)) == 0 + && ! sh_insns_conflict (prev_insn, prev_op, insn, op)) + { + boolean ok; + + /* The load/store instruction does not have a label, and + there is a previous instruction; PREV_INSN is not + itself a load/store instruction, and PREV_INSN and + INSN do not conflict. */ + + ok = true; + + if (i >= start + 4) + { + unsigned int prev2_insn; + const struct sh_opcode *prev2_op; + + prev2_insn = bfd_get_16 (abfd, contents + i - 4); + prev2_op = sh_insn_info (prev2_insn); + + /* If the instruction before PREV_INSN has a delay + slot--that is, PREV_INSN is in a delay slot--we + can not swap. */ + if (prev2_op == NULL + || (prev2_op->flags & DELAY) != 0) + ok = false; + + /* If the instruction before PREV_INSN is a load, + and it sets a register which INSN uses, then + putting INSN immediately after PREV_INSN will + cause a pipeline bubble, so there is no point to + making the swap. */ + if (ok + && (prev2_op->flags & LOAD) != 0 + && sh_load_use (prev2_insn, prev2_op, insn, op)) + ok = false; + } + + if (ok) + { + if (! (*swap) (abfd, sec, relocs, contents, i - 2)) + return false; + *pswapped = true; + continue; + } + } + + while (*plabel < label_end && **plabel < i + 2) + ++*plabel; + + if (i + 2 < stop + && (*plabel >= label_end || **plabel != i + 2)) + { + unsigned int next_insn; + const struct sh_opcode *next_op; + + /* There is an instruction after the load/store + instruction, and it does not have a label. */ + next_insn = bfd_get_16 (abfd, contents + i + 2); + next_op = sh_insn_info (next_insn); + if (next_op != NULL + && (next_op->flags & (LOAD | STORE)) == 0 + && ! sh_insns_conflict (insn, op, next_insn, next_op)) + { + boolean ok; + + /* NEXT_INSN is not itself a load/store instruction, + and it does not conflict with INSN. */ + + ok = true; + + /* If PREV_INSN is a load, and it sets a register + which NEXT_INSN uses, then putting NEXT_INSN + immediately after PREV_INSN will cause a pipeline + bubble, so there is no reason to make this swap. */ + if (prev_op != NULL + && (prev_op->flags & LOAD) != 0 + && sh_load_use (prev_insn, prev_op, next_insn, next_op)) + ok = false; + + /* If INSN is a load, and it sets a register which + the insn after NEXT_INSN uses, then doing the + swap will cause a pipeline bubble, so there is no + reason to make the swap. However, if the insn + after NEXT_INSN is itself a load or store + instruction, then it is misaligned, so + optimistically hope that it will be swapped + itself, and just live with the pipeline bubble if + it isn't. */ + if (ok + && i + 4 < stop + && (op->flags & LOAD) != 0) + { + unsigned int next2_insn; + const struct sh_opcode *next2_op; + + next2_insn = bfd_get_16 (abfd, contents + i + 4); + next2_op = sh_insn_info (next2_insn); + if ((next2_op->flags & (LOAD | STORE)) == 0 + && sh_load_use (insn, op, next2_insn, next2_op)) + ok = false; + } + + if (ok) + { + if (! (*swap) (abfd, sec, relocs, contents, i)) + return false; + *pswapped = true; + continue; + } + } + } + } + + return true; +} + /* Look for loads and stores which we can align to four byte boundaries. See the longer comment above sh_relax_section for why this is desirable. This sets *PSWAPPED if some instruction was @@ -2015,7 +2198,7 @@ for (irel = internal_relocs; irel < irelend; irel++) { - bfd_vma start, stop, i; + bfd_vma start, stop; if (irel->r_type != R_SH_CODE) continue; @@ -2030,162 +2213,10 @@ else stop = sec->_cooked_size; - /* Instructions should be aligned on 2 byte boundaries. */ - if ((start & 1) == 1) - ++start; - - /* Now look through the unaligned addresses. */ - i = start; - if ((i & 2) == 0) - i += 2; - for (; i < stop; i += 4) - { - unsigned int insn; - const struct sh_opcode *op; - unsigned int prev_insn = 0; - const struct sh_opcode *prev_op = NULL; - - insn = bfd_get_16 (abfd, contents + i); - op = sh_insn_info (insn); - if (op == NULL - || (op->flags & (LOAD | STORE)) == 0) - continue; - - /* This is a load or store which is not on a four byte - boundary. */ - - while (label < label_end && *label < i) - ++label; - - if (i > start) - { - prev_insn = bfd_get_16 (abfd, contents + i - 2); - prev_op = sh_insn_info (prev_insn); - - /* If the load/store instruction is in a delay slot, we - can't swap. */ - if (prev_op == NULL - || (prev_op->flags & DELAY) != 0) - continue; - } - if (i > start - && (label >= label_end || *label != i) - && prev_op != NULL - && (prev_op->flags & (LOAD | STORE)) == 0 - && ! sh_insns_conflict (prev_insn, prev_op, insn, op)) - { - boolean ok; - - /* The load/store instruction does not have a label, and - there is a previous instruction; PREV_INSN is not - itself a load/store instruction, and PREV_INSN and - INSN do not conflict. */ - - ok = true; - - if (i >= start + 4) - { - unsigned int prev2_insn; - const struct sh_opcode *prev2_op; - - prev2_insn = bfd_get_16 (abfd, contents + i - 4); - prev2_op = sh_insn_info (prev2_insn); - - /* If the instruction before PREV_INSN has a delay - slot--that is, PREV_INSN is in a delay slot--we - can not swap. */ - if (prev2_op == NULL - || (prev2_op->flags & DELAY) != 0) - ok = false; - - /* If the instruction before PREV_INSN is a load, - and it sets a register which INSN uses, then - putting INSN immediately after PREV_INSN will - cause a pipeline bubble, so there is no point to - making the swap. */ - if (ok - && (prev2_op->flags & LOAD) != 0 - && sh_load_use (prev2_insn, prev2_op, insn, op)) - ok = false; - } - - if (ok) - { - if (! sh_swap_insns (abfd, sec, internal_relocs, - contents, i - 2)) - goto error_return; - *pswapped = true; - continue; - } - } - - while (label < label_end && *label < i + 2) - ++label; - - if (i + 2 < stop - && (label >= label_end || *label != i + 2)) - { - unsigned int next_insn; - const struct sh_opcode *next_op; - - /* There is an instruction after the load/store - instruction, and it does not have a label. */ - next_insn = bfd_get_16 (abfd, contents + i + 2); - next_op = sh_insn_info (next_insn); - if (next_op != NULL - && (next_op->flags & (LOAD | STORE)) == 0 - && ! sh_insns_conflict (insn, op, next_insn, next_op)) - { - boolean ok; - - /* NEXT_INSN is not itself a load/store instruction, - and it does not conflict with INSN. */ - - ok = true; - - /* If PREV_INSN is a load, and it sets a register - which NEXT_INSN uses, then putting NEXT_INSN - immediately after PREV_INSN will cause a pipeline - bubble, so there is no reason to make this swap. */ - if (prev_op != NULL - && (prev_op->flags & LOAD) != 0 - && sh_load_use (prev_insn, prev_op, next_insn, next_op)) - ok = false; - - /* If INSN is a load, and it sets a register which - the insn after NEXT_INSN uses, then doing the - swap will cause a pipeline bubble, so there is no - reason to make the swap. However, if the insn - after NEXT_INSN is itself a load or store - instruction, then it is misaligned, so - optimistically hope that it will be swapped - itself, and just live with the pipeline bubble if - it isn't. */ - if (ok - && i + 4 < stop - && (op->flags & LOAD) != 0) - { - unsigned int next2_insn; - const struct sh_opcode *next2_op; - - next2_insn = bfd_get_16 (abfd, contents + i + 4); - next2_op = sh_insn_info (next2_insn); - if ((next2_op->flags & (LOAD | STORE)) == 0 - && sh_load_use (insn, op, next2_insn, next2_op)) - ok = false; - } - - if (ok) - { - if (! sh_swap_insns (abfd, sec, internal_relocs, - contents, i)) - goto error_return; - *pswapped = true; - continue; - } - } - } - } + if (! _bfd_sh_align_load_span (abfd, sec, contents, sh_swap_insns, + (PTR) internal_relocs, &label, + label_end, start, stop, pswapped)) + goto error_return; } free (labels); @@ -2201,13 +2232,14 @@ /* Swap two SH instructions. */ static boolean -sh_swap_insns (abfd, sec, internal_relocs, contents, addr) +sh_swap_insns (abfd, sec, relocs, contents, addr) bfd *abfd; asection *sec; - struct internal_reloc *internal_relocs; + PTR relocs; bfd_byte *contents; bfd_vma addr; { + struct internal_reloc *internal_relocs = (struct internal_reloc *) relocs; unsigned short i1, i2; struct internal_reloc *irel, *irelend; @@ -2374,6 +2406,14 @@ } else { + if (symndx < 0 || symndx >= obj_raw_syment_count (input_bfd)) + { + (*_bfd_error_handler) + ("%s: illegal symbol index %ld in relocs", + bfd_get_filename (input_bfd), symndx); + bfd_set_error (bfd_error_bad_value); + return false; + } h = obj_coff_sym_hashes (input_bfd)[symndx]; sym = syms + symndx; } diff -urN binutils-2.7/bfd/coff-sparc.c binutils-2.8/bfd/coff-sparc.c --- binutils-2.7/bfd/coff-sparc.c Thu Jul 4 12:18:01 1996 +++ binutils-2.8/bfd/coff-sparc.c Wed Apr 30 12:55:53 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Sparc COFF files. - Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,6 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/sparc.h" #include "coff/internal.h" #include "libcoff.h" diff -urN binutils-2.7/bfd/coff-svm68k.c binutils-2.8/bfd/coff-svm68k.c --- binutils-2.7/bfd/coff-svm68k.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/coff-svm68k.c Wed Apr 30 12:55:53 1997 @@ -0,0 +1,26 @@ +/* BFD back-end for Motorola sysv68 + Copyright 1997 Free Software Foundation, Inc. + Written by Philippe De Muyter . + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#define TARGET_SYM m68ksysvcoff_vec +#define TARGET_NAME "coff-m68k-sysv" +#define STATIC_RELOCS +#define COFF_COMMON_ADDEND + +#include "coff-m68k.c" diff -urN binutils-2.7/bfd/coff-w65.c binutils-2.8/bfd/coff-w65.c --- binutils-2.7/bfd/coff-w65.c Thu Jul 4 12:18:01 1996 +++ binutils-2.8/bfd/coff-w65.c Wed Apr 30 12:55:54 1997 @@ -1,5 +1,5 @@ /* BFD back-end for WDC 65816 COFF binaries. - Copyright 1995 Free Software Foundation, Inc. + Copyright 1995, 96, 1997 Free Software Foundation, Inc. Written by Steve Chamberlain, . This file is part of BFD, the Binary File Descriptor library. @@ -20,7 +20,6 @@ #include "bfd.h" #include "sysdep.h" -#include "obstack.h" #include "libbfd.h" #include "bfdlink.h" #include "coff/w65.h" @@ -83,7 +82,7 @@ #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) -/* Perform any necessaru magic to the addend in a reloc entry */ +/* Perform any necessary magic to the addend in a reloc entry */ #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ diff -urN binutils-2.7/bfd/coff-we32k.c binutils-2.8/bfd/coff-we32k.c --- binutils-2.7/bfd/coff-we32k.c Thu Jul 4 12:18:01 1996 +++ binutils-2.8/bfd/coff-we32k.c Wed Apr 30 12:55:54 1997 @@ -1,5 +1,5 @@ /* BFD back-end for we32k COFF files. - Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1992, 93, 94, 95, 1997 Free Software Foundation, Inc. Contributed by Brendan Kehoe (brendan@cs.widener.edu). This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,6 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" #include "coff/we32k.h" #include "coff/internal.h" #include "libcoff.h" diff -urN binutils-2.7/bfd/coff-z8k.c binutils-2.8/bfd/coff-z8k.c --- binutils-2.7/bfd/coff-z8k.c Thu Jul 4 12:18:01 1996 +++ binutils-2.8/bfd/coff-z8k.c Wed Apr 30 12:55:54 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Zilog Z800n COFF binaries. - Copyright 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1992, 93, 94, 95, 1997 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, . @@ -21,7 +21,6 @@ #include "bfd.h" #include "sysdep.h" -#include "obstack.h" #include "libbfd.h" #include "bfdlink.h" #include "coff/z8k.h" @@ -112,7 +111,7 @@ #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) -/* Perform any necessaru magic to the addend in a reloc entry */ +/* Perform any necessary magic to the addend in a reloc entry */ #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ diff -urN binutils-2.7/bfd/coffcode.h binutils-2.8/bfd/coffcode.h --- binutils-2.7/bfd/coffcode.h Wed Jul 10 11:19:29 1996 +++ binutils-2.8/bfd/coffcode.h Wed Apr 30 12:55:54 1997 @@ -1,5 +1,5 @@ /* Support for the generic parts of most COFF variants, for BFD. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -310,6 +310,30 @@ #endif #define STRING_SIZE_SIZE (4) + +static long sec_to_styp_flags PARAMS ((const char *, flagword)); +static flagword styp_to_sec_flags PARAMS ((bfd *, PTR, const char *)); +static boolean coff_bad_format_hook PARAMS ((bfd *, PTR)); +static boolean coff_new_section_hook PARAMS ((bfd *, asection *)); +static boolean coff_set_arch_mach_hook PARAMS ((bfd *, PTR)); +static boolean coff_write_relocs PARAMS ((bfd *, int)); +static boolean coff_set_flags + PARAMS ((bfd *, unsigned int *, unsigned short *)); +static boolean coff_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +static boolean coff_compute_section_file_positions PARAMS ((bfd *)); +static boolean coff_write_object_contents PARAMS ((bfd *)); +static boolean coff_set_section_contents + PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); +static PTR buy_and_read PARAMS ((bfd *, file_ptr, int, size_t)); +static boolean coff_slurp_line_table PARAMS ((bfd *, asection *)); +static boolean coff_slurp_symbol_table PARAMS ((bfd *)); +static boolean coff_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **)); +static long coff_canonicalize_reloc + PARAMS ((bfd *, asection *, arelent **, asymbol **)); +#ifndef coff_mkobject_hook +static PTR coff_mkobject_hook PARAMS ((bfd *, PTR, PTR)); +#endif /* void warning(); */ @@ -727,6 +751,7 @@ . unsigned int _bfd_linesz; . boolean _bfd_coff_long_filenames; . boolean _bfd_coff_long_section_names; +. unsigned int _bfd_coff_default_section_alignment_power; . void (*_bfd_coff_swap_filehdr_in) PARAMS (( . bfd *abfd, . PTR ext, @@ -796,7 +821,7 @@ . boolean (*_bfd_coff_sym_is_global) PARAMS (( . bfd *abfd, . struct internal_syment *)); -. void (*_bfd_coff_compute_section_file_positions) PARAMS (( +. boolean (*_bfd_coff_compute_section_file_positions) PARAMS (( . bfd *abfd)); . boolean (*_bfd_coff_start_final_link) PARAMS (( . bfd *output_bfd, @@ -880,6 +905,8 @@ .#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames) .#define bfd_coff_long_section_names(abfd) \ . (coff_backend_info (abfd)->_bfd_coff_long_section_names) +.#define bfd_coff_default_section_alignment_power(abfd) \ +. (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) .#define bfd_coff_swap_filehdr_in(abfd, i,o) \ . ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) . @@ -1033,6 +1060,8 @@ /* Set the alignment of a BFD section. */ +static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR)); + static void coff_set_alignment_hook (abfd, section, scnhdr) bfd * abfd; @@ -1064,6 +1093,8 @@ section->alignment_power = y;\ } +static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR)); + static void coff_set_alignment_hook (abfd, section, scnhdr) bfd * abfd; @@ -1151,6 +1182,8 @@ When we see one, we correct the reloc and line number counts in the real header, and remove the section we just created. */ +static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR)); + static void coff_set_alignment_hook (abfd, section, scnhdr) bfd *abfd; @@ -1192,6 +1225,9 @@ #endif /* ! I960 */ #ifndef coff_mkobject + +static boolean coff_mkobject PARAMS ((bfd *)); + static boolean coff_mkobject (abfd) bfd * abfd; @@ -1499,6 +1535,15 @@ break; #endif +#ifdef H8300SMAGIC + case H8300SMAGIC: + arch = bfd_arch_h8300; + machine = bfd_mach_h8300s; + /* !! FIXME this probably isn't the right place for this */ + abfd->flags |= BFD_IS_RELAXABLE; + break; +#endif + #ifdef SH_ARCH_MAGIC_BIG case SH_ARCH_MAGIC_BIG: case SH_ARCH_MAGIC_LITTLE: @@ -1524,6 +1569,12 @@ break; #endif +#ifdef TIC80_ARCH_MAGIC + case TIC80_ARCH_MAGIC: + arch = bfd_arch_tic80; + break; +#endif + default: /* Unreadable input file type */ arch = bfd_arch_obscure; break; @@ -1535,6 +1586,9 @@ #ifdef SYMNAME_IN_DEBUG +static boolean symname_in_debug_hook + PARAMS ((bfd *, struct internal_syment *)); + static boolean symname_in_debug_hook (abfd, sym) bfd * abfd; @@ -1825,7 +1879,7 @@ static boolean coff_set_flags (abfd, magicp, flagsp) bfd * abfd; - unsigned *magicp; + unsigned int *magicp; unsigned short *flagsp; { switch (bfd_get_arch (abfd)) @@ -1923,8 +1977,13 @@ #ifdef APOLLOM68KMAGIC *magicp = APOLLO_COFF_VERSION_NUMBER; #else + /* NAMES_HAVE_UNDERSCORE may be defined by coff-u68k.c. */ +#ifdef NAMES_HAVE_UNDERSCORE + *magicp = MC68KBCSMAGIC; +#else *magicp = MC68MAGIC; #endif +#endif #ifdef LYNXOS /* Just overwrite the usual value if we're doing Lynx. */ *magicp = LYNXCOFFMAGIC; @@ -1949,6 +2008,9 @@ case bfd_mach_h8300h: *magicp = H8300HMAGIC; return true; + case bfd_mach_h8300s: + *magicp = H8300SMAGIC; + return true; } break; #endif @@ -2039,13 +2101,14 @@ /* Calculate the file position for each section. */ -static void +static boolean coff_compute_section_file_positions (abfd) bfd * abfd; { asection *current; asection *previous = (asection *) NULL; file_ptr sofar = FILHSZ; + boolean align_adjust; #ifndef I960 file_ptr old_sofar; @@ -2131,6 +2194,7 @@ sofar += SCNHSZ; #endif + align_adjust = false; for (current = abfd->sections, count = 1; current != (asection *) NULL; current = current->next, ++count) @@ -2179,20 +2243,14 @@ current->used_by_bfd = (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)); if (current->used_by_bfd == NULL) - { - /* FIXME: Return error. */ - abort (); - } + return false; } if (pei_section_data (abfd, current) == NULL) { coff_section_data (abfd, current)->tdata = (PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata)); if (coff_section_data (abfd, current)->tdata == NULL) - { - /* FIXME: Return error. */ - abort (); - } + return false; } if (pei_section_data (abfd, current)->virt_size == 0) pei_section_data (abfd, current)->virt_size = current->_raw_size; @@ -2205,12 +2263,20 @@ #ifndef I960 /* make sure that this section is of the right size too */ if ((abfd->flags & EXEC_P) == 0) - current->_raw_size = BFD_ALIGN (current->_raw_size, - 1 << current->alignment_power); + { + bfd_size_type old_size; + + old_size = current->_raw_size; + current->_raw_size = BFD_ALIGN (current->_raw_size, + 1 << current->alignment_power); + align_adjust = current->_raw_size != old_size; + sofar += current->_raw_size - old_size; + } else { old_sofar = sofar; sofar = BFD_ALIGN (sofar, 1 << current->alignment_power); + align_adjust = sofar != old_sofar; current->_raw_size += sofar - old_sofar; } #endif @@ -2226,9 +2292,30 @@ previous = current; } + /* It is now safe to write to the output file. If we needed an + alignment adjustment for the last section, then make sure that + there is a byte at offset sofar. If there are no symbols and no + relocs, then nothing follows the last section. If we don't force + the last byte out, then the file may appear to be truncated. */ + if (align_adjust) + { + bfd_byte b; + + b = 0; + if (bfd_seek (abfd, sofar - 1, SEEK_SET) != 0 + || bfd_write (&b, 1, 1, abfd) != 1) + return false; + } + + /* Make sure the relocations are aligned. We don't need to make + sure that this byte exists, because it will only matter if there + really are relocs. */ + sofar = BFD_ALIGN (sofar, 1 << COFF_DEFAULT_SECTION_ALIGNMENT_POWER); + obj_relocbase (abfd) = sofar; abfd->output_has_begun = true; + return true; } #if 0 @@ -2285,7 +2372,7 @@ if (!need_text && !need_data && !need_bss && !need_file) return true; nsyms += need_text + need_data + need_bss + need_file; - sympp2 = (asymbol **) bfd_alloc_by_size_t (abfd, nsyms * sizeof (asymbol *)); + sympp2 = (asymbol **) bfd_alloc (abfd, nsyms * sizeof (asymbol *)); if (!sympp2) return false; memcpy (sympp2, sympp, i * sizeof (asymbol *)); @@ -2340,7 +2427,10 @@ lnno_size = coff_count_linenumbers (abfd) * LINESZ; if (abfd->output_has_begun == false) - coff_compute_section_file_positions (abfd); + { + if (! coff_compute_section_file_positions (abfd)) + return false; + } reloc_base = obj_relocbase (abfd); @@ -2698,6 +2788,10 @@ internal_a.magic = NMAGIC; /* Assume separate i/d */ #define __A_MAGIC_SET__ #endif /* A29K */ +#ifdef TIC80 + internal_a.magic = TIC80_ARCH_MAGIC; +#define __A_MAGIC_SET__ +#endif /* TIC80 */ #ifdef I860 /* FIXME: What are the a.out magic numbers for the i860? */ internal_a.magic = 0; @@ -2972,7 +3066,10 @@ bfd_size_type count; { if (abfd->output_has_begun == false) /* set by bfd.c handler */ - coff_compute_section_file_positions (abfd); + { + if (! coff_compute_section_file_positions (abfd)) + return false; + } #if defined(_LIB) && !defined(TARG_AUX) @@ -3049,8 +3146,7 @@ return false; } - /* We depend on bfd_close to free all the memory on the obstack. */ - /* FIXME if bfd_release is not using obstacks! */ + /* We depend on bfd_close to free all the memory on the objalloc. */ return true; } @@ -3126,11 +3222,27 @@ if (cache_ptr->line_number == 0) { - coff_symbol_type *sym = - (coff_symbol_type *) (dst.l_addr.l_symndx - + obj_raw_syments (abfd))->u.syment._n._n_n._n_zeroes; + boolean warned; + long symndx; + coff_symbol_type *sym; + + warned = false; + symndx = dst.l_addr.l_symndx; + if (symndx < 0 || symndx >= obj_raw_syment_count (abfd)) + { + (*_bfd_error_handler) + ("%s: warning: illegal symbol index %ld in line numbers", + bfd_get_filename (abfd), dst.l_addr.l_symndx); + symndx = 0; + warned = true; + } + /* FIXME: We should not be casting between ints and + pointers like this. */ + sym = ((coff_symbol_type *) + ((symndx + obj_raw_syments (abfd)) + ->u.syment._n._n_n._n_zeroes)); cache_ptr->u.sym = (asymbol *) sym; - if (sym->lineno != NULL) + if (sym->lineno != NULL && ! warned) { (*_bfd_error_handler) ("%s: warning: duplicate line number information for `%s'", @@ -3464,6 +3576,8 @@ #ifdef OTHER_GLOBAL_CLASS +static boolean coff_sym_is_global PARAMS ((bfd *, struct internal_syment *)); + static boolean coff_sym_is_global (abfd, syment) bfd *abfd; @@ -3568,40 +3682,43 @@ for (idx = 0; idx < asect->reloc_count; idx++) { -#ifdef RELOC_PROCESSING struct internal_reloc dst; struct external_reloc *src; - - cache_ptr = reloc_cache + idx; - src = native_relocs + idx; - coff_swap_reloc_in (abfd, src, &dst); - - RELOC_PROCESSING (cache_ptr, &dst, symbols, abfd, asect); -#else - struct internal_reloc dst; +#ifndef RELOC_PROCESSING asymbol *ptr; - struct external_reloc *src; +#endif cache_ptr = reloc_cache + idx; src = native_relocs + idx; coff_swap_reloc_in (abfd, src, &dst); - +#ifdef RELOC_PROCESSING + RELOC_PROCESSING (cache_ptr, &dst, symbols, abfd, asect); +#else cache_ptr->address = dst.r_vaddr; if (dst.r_symndx != -1) { - /* @@ Should never be greater than count of symbols! */ - if (dst.r_symndx >= obj_conv_table_size (abfd)) - abort (); - cache_ptr->sym_ptr_ptr = symbols + obj_convert (abfd)[dst.r_symndx]; - ptr = *(cache_ptr->sym_ptr_ptr); + if (dst.r_symndx < 0 || dst.r_symndx >= obj_conv_table_size (abfd)) + { + (*_bfd_error_handler) + ("%s: warning: illegal symbol index %ld in relocs", + bfd_get_filename (abfd), dst.r_symndx); + cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + ptr = NULL; + } + else + { + cache_ptr->sym_ptr_ptr = (symbols + + obj_convert (abfd)[dst.r_symndx]); + ptr = *(cache_ptr->sym_ptr_ptr); + } } else { cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - ptr = 0; + ptr = NULL; } /* The symbols definitions that we have read in have been @@ -3619,8 +3736,16 @@ /* Fill in the cache_ptr->howto field from dst.r_type */ RTYPE2HOWTO (cache_ptr, &dst); -#endif +#endif /* RELOC_PROCESSING */ + if (cache_ptr->howto == NULL) + { + (*_bfd_error_handler) + ("%s: illegal relocation type %d at address 0x%lx", + bfd_get_filename (abfd), dst.r_type, (long) dst.r_vaddr); + bfd_set_error (bfd_error_bad_value); + return false; + } } asect->relocation = reloc_cache; @@ -3717,6 +3842,10 @@ #ifndef coff_reloc16_estimate #define coff_reloc16_estimate dummy_reloc16_estimate +static int dummy_reloc16_estimate + PARAMS ((bfd *, asection *, arelent *, unsigned int, + struct bfd_link_info *)); + static int dummy_reloc16_estimate (abfd, input_section, reloc, shrink, link_info) bfd *abfd; @@ -3731,8 +3860,15 @@ #endif #ifndef coff_reloc16_extra_cases + #define coff_reloc16_extra_cases dummy_reloc16_extra_cases + /* This works even if abort is not declared in any header file. */ + +static void dummy_reloc16_extra_cases + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, + bfd_byte *, unsigned int *, unsigned int *)); + static void dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) @@ -3802,6 +3938,7 @@ #else false, #endif + COFF_DEFAULT_SECTION_ALIGNMENT_POWER, coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in, coff_swap_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook, coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, @@ -3835,8 +3972,8 @@ #define coff_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data #endif -#ifndef coff_bfd_is_local_label -#define coff_bfd_is_local_label bfd_generic_is_local_label +#ifndef coff_bfd_is_local_label_name +#define coff_bfd_is_local_label_name _bfd_coff_is_local_label_name #endif #ifndef coff_read_minisymbols #define coff_read_minisymbols _bfd_generic_read_minisymbols diff -urN binutils-2.7/bfd/coffgen.c binutils-2.8/bfd/coffgen.c --- binutils-2.7/bfd/coffgen.c Thu Jul 4 12:18:05 1996 +++ binutils-2.8/bfd/coffgen.c Wed Apr 30 12:55:54 1997 @@ -1,5 +1,5 @@ /* Support for the generic parts of COFF, for BFD. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -56,6 +56,17 @@ static void coff_pointerize_aux PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, unsigned int, combined_entry_type *)); +static boolean make_a_section_from_file + PARAMS ((bfd *, struct internal_scnhdr *, unsigned int)); +static const bfd_target *coff_real_object_p + PARAMS ((bfd *, unsigned, struct internal_filehdr *, + struct internal_aouthdr *)); +static void fixup_symbol_value + PARAMS ((coff_symbol_type *, struct internal_syment *)); +static char *build_debug_section + PARAMS ((bfd *)); +static char *copy_name + PARAMS ((bfd *, char *, int)); #define STRING_SIZE_SIZE (4) @@ -639,9 +650,8 @@ asymbol **newsyms; unsigned int i; - newsyms = (asymbol **) bfd_alloc_by_size_t (bfd_ptr, - sizeof (asymbol *) - * (symbol_count + 1)); + newsyms = (asymbol **) bfd_alloc (bfd_ptr, + sizeof (asymbol *) * (symbol_count + 1)); if (!newsyms) return false; bfd_ptr->outsymbols = newsyms; @@ -1369,7 +1379,7 @@ combined_entry_type e[10]; }; struct foo *f; - f = (struct foo *) bfd_alloc_by_size_t (abfd, sizeof (*f)); + f = (struct foo *) bfd_alloc (abfd, sizeof (*f)); if (!f) { bfd_set_error (bfd_error_no_error); @@ -2072,6 +2082,19 @@ symbol->name); } } +} + +/* Return whether a symbol name implies a local symbol. In COFF, + local symbols generally start with ``.L''. Most targets use this + function for the is_local_label_name entry point, but some may + override it. */ + +boolean +_bfd_coff_is_local_label_name (abfd, name) + bfd *abfd; + const char *name; +{ + return name[0] == '.' && name[1] == 'L'; } /* Provided a BFD, a section and an offset into the section, calculate diff -urN binutils-2.7/bfd/cofflink.c binutils-2.8/bfd/cofflink.c --- binutils-2.7/bfd/cofflink.c Thu Jul 4 12:18:07 1996 +++ binutils-2.8/bfd/cofflink.c Wed Apr 30 12:55:54 1997 @@ -1,5 +1,5 @@ /* COFF specific linker code. - Copyright 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -34,6 +34,10 @@ static boolean coff_link_check_ar_symbols PARAMS ((bfd *, struct bfd_link_info *, boolean *)); static boolean coff_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *)); +static char *dores_com PARAMS ((char *, bfd *, int)); +static char *get_name PARAMS ((char *, char **)); +static int process_embedded_commands + PARAMS ((bfd *, struct bfd_link_info *, bfd *)); /* Create an entry in a COFF linker hash table. */ @@ -283,6 +287,7 @@ struct bfd_link_info *info; { boolean (*sym_is_global) PARAMS ((bfd *, struct internal_syment *)); + boolean keep_syms; boolean default_copy; bfd_size_type symcount; struct coff_link_hash_entry **sym_hash; @@ -290,6 +295,11 @@ bfd_byte *esym; bfd_byte *esym_end; + /* Keep the symbols during this function, in case the linker needs + to read the generic symbols in order to report an error message. */ + keep_syms = obj_coff_keep_syms (abfd); + obj_coff_keep_syms (abfd) = true; + sym_is_global = coff_backend_info (abfd)->_bfd_coff_sym_is_global; if (info->keep_memory) @@ -306,7 +316,7 @@ ((size_t) symcount * sizeof (struct coff_link_hash_entry *)))); if (sym_hash == NULL && symcount != 0) - return false; + goto error_return; obj_coff_sym_hashes (abfd) = sym_hash; memset (sym_hash, 0, (size_t) symcount * sizeof (struct coff_link_hash_entry *)); @@ -335,7 +345,7 @@ name = _bfd_coff_internal_syment_name (abfd, &sym, buf); if (name == NULL) - return false; + goto error_return; /* We must copy the name into memory if we got it from the syment itself, rather than the string table. */ @@ -370,7 +380,14 @@ (info, abfd, name, flags, section, value, (const char *) NULL, copy, false, (struct bfd_link_hash_entry **) sym_hash))) - return false; + goto error_return; + + if (section == bfd_com_section_ptr + && (*sym_hash)->root.type == bfd_link_hash_common + && ((*sym_hash)->root.u.c.p->alignment_power + > bfd_coff_default_section_alignment_power (abfd))) + (*sym_hash)->root.u.c.p->alignment_power + = bfd_coff_default_section_alignment_power (abfd); if (info->hash->creator->flavour == bfd_get_flavour (abfd)) { @@ -381,8 +398,16 @@ && (*sym_hash)->root.type != bfd_link_hash_defined)) { (*sym_hash)->class = sym.n_sclass; - (*sym_hash)->type = sym.n_type; - (*sym_hash)->numaux = sym.n_numaux; + if (sym.n_type != T_NULL) + { + if ((*sym_hash)->type != T_NULL + && (*sym_hash)->type != sym.n_type) + (*_bfd_error_handler) + ("Warning: type of symbol `%s' changed from %d to %d in %s", + name, (*sym_hash)->type, sym.n_type, + bfd_get_filename (abfd)); + (*sym_hash)->type = sym.n_type; + } (*sym_hash)->auxbfd = abfd; if (sym.n_numaux != 0) { @@ -391,12 +416,13 @@ bfd_byte *eaux; union internal_auxent *iaux; + (*sym_hash)->numaux = sym.n_numaux; alloc = ((union internal_auxent *) bfd_hash_allocate (&info->hash->table, (sym.n_numaux * sizeof (*alloc)))); if (alloc == NULL) - return false; + goto error_return; for (i = 0, eaux = esym + symesz, iaux = alloc; i < sym.n_numaux; i++, eaux += symesz, iaux++) @@ -439,7 +465,7 @@ (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)); if (stab->used_by_bfd == NULL) - return false; + goto error_return; secdata = coff_section_data (abfd, stab); } @@ -448,12 +474,18 @@ if (! _bfd_link_section_stabs (abfd, &table->stab_info, stab, stabstr, &secdata->stab_info)) - return false; + goto error_return; } } } + obj_coff_keep_syms (abfd) = keep_syms; + return true; + + error_return: + obj_coff_keep_syms (abfd) = keep_syms; + return false; } /* Do the final link step. */ @@ -512,7 +544,10 @@ /* Compute the file positions for all the sections. */ if (! abfd->output_has_begun) - bfd_coff_compute_section_file_positions (abfd); + { + if (! bfd_coff_compute_section_file_positions (abfd)) + goto error_return; + } /* Count the line numbers and relocation entries required for the output file. Set the file positions for the relocs. */ @@ -817,7 +852,7 @@ finfo.outsyms = NULL; } - if (info->relocateable) + if (info->relocateable && max_output_reloc_count > 0) { /* Now that we have written out all the global symbols, we know the symbol indices to use for relocs against them, and we can @@ -1237,8 +1272,7 @@ false) == NULL)) || (! global && finfo->info->discard == discard_l - && strncmp (name, finfo->info->lprefix, - finfo->info->lprefix_len) == 0)) + && bfd_is_local_label_name (input_bfd, name))) skip = true; } @@ -1505,7 +1539,13 @@ indx = ((esym - (bfd_byte *) obj_coff_external_syms (input_bfd)) / isymesz); h = obj_coff_sym_hashes (input_bfd)[indx]; - BFD_ASSERT (h != NULL); + if (h == NULL) + { + /* This can happen if there were errors earlier in + the link. */ + bfd_set_error (bfd_error_bad_value); + return false; + } h->indx = output_index; } @@ -1554,7 +1594,12 @@ if (*indexp < 0) { h = *sym_hash; - BFD_ASSERT (h->numaux == isymp->n_numaux); + + /* The m68k-motorola-sysv assembler will sometimes + generate two symbols with the same name, but only one + will have aux entries. */ + BFD_ASSERT (isymp->n_numaux == 0 + || h->numaux == isymp->n_numaux); } esym += isymesz; @@ -2055,8 +2100,9 @@ } else { - if (! _bfd_write_section_stabs (output_bfd, o, &secdata->stab_info, - contents)) + if (! (_bfd_write_section_stabs + (output_bfd, &coff_hash_table (finfo->info)->stab_info, + o, &secdata->stab_info, contents))) return false; } } @@ -2391,6 +2437,18 @@ if (howto == NULL) return false; + /* If we are doing a relocateable link, then we can just ignore + a PC relative reloc that is pcrel_offset. It will already + have the correct value. If this is not a relocateable link, + then we should ignore the symbol value. */ + if (howto->pc_relative && howto->pcrel_offset) + { + if (info->relocateable) + continue; + if (sym != NULL && sym->n_scnum != 0) + addend += sym->n_value; + } + val = 0; if (h == NULL) @@ -2463,6 +2521,13 @@ abort (); case bfd_reloc_ok: break; + case bfd_reloc_outofrange: + (*_bfd_error_handler) + ("%s: bad reloc address 0x%lx in section `%s'", + bfd_get_filename (input_bfd), + (unsigned long) rel->r_vaddr, + bfd_get_section_name (input_bfd, input_section)); + return false; case bfd_reloc_overflow: { const char *name; diff -urN binutils-2.7/bfd/coffswap.h binutils-2.8/bfd/coffswap.h --- binutils-2.7/bfd/coffswap.h Thu Jul 4 12:18:07 1996 +++ binutils-2.8/bfd/coffswap.h Wed Apr 30 12:55:55 1997 @@ -169,6 +169,27 @@ #define PUT_SCNHDR_LNNOPTR bfd_h_put_32 #endif +static void coff_swap_aouthdr_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int coff_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR)); +static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int coff_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR)); +static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int coff_swap_filehdr_out PARAMS ((bfd *, PTR, PTR)); +#ifndef NO_COFF_RELOCS +static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR)); +#endif /* NO_COFF_RELOCS */ +#ifndef NO_COFF_SYMBOLS +static void coff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int coff_swap_sym_out PARAMS ((bfd *, PTR, PTR)); +static void coff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +static unsigned int coff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +#endif /* NO_COFF_SYMBOLS */ +#ifndef NO_COFF_LINENOS +static void coff_swap_lineno_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int coff_swap_lineno_out PARAMS ((bfd *, PTR, PTR)); +#endif /* NO_COFF_LINENOS */ + #ifndef NO_COFF_RELOCS static void @@ -196,7 +217,6 @@ #endif } - static unsigned int coff_swap_reloc_out (abfd, src, dst) bfd *abfd; @@ -580,7 +600,6 @@ #endif /* NO_COFF_LINENOS */ - static void coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) bfd *abfd; @@ -791,12 +810,11 @@ memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name)); buf[sizeof (scnhdr_int->s_name)] = '\0'; - (*_bfd_error_handler) ("%s: %s: line number overflow: 0x%lx > 0xffff", - bfd_get_filename (abfd), - buf, scnhdr_int->s_nlnno); - bfd_set_error (bfd_error_file_truncated); + (*_bfd_error_handler) + ("%s: warning: %s: line number overflow: 0x%lx > 0xffff", + bfd_get_filename (abfd), + buf, scnhdr_int->s_nlnno); PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno); - ret = 0; } if (scnhdr_int->s_nreloc <= 0xffff) PUTHALF(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc); diff -urN binutils-2.7/bfd/config.bfd binutils-2.8/bfd/config.bfd --- binutils-2.7/bfd/config.bfd Thu Jul 4 12:30:46 1996 +++ binutils-2.8/bfd/config.bfd Wed Apr 30 12:55:55 1997 @@ -7,7 +7,11 @@ # targ_selvecs Vectors to build for this target # targ_archs Architectures for this target # targ_cflags $(CFLAGS) for this target (FIXME: pretty bogus) -# targ_undercore Whether underscores are used: yes or no +# targ_underscore Whether underscores are used: yes or no + +# Part of this file is processed by targmatch.sed to generate the +# targmatch.h file. The #ifdef and #endif lines that appear below are +# copied directly into targmatch.h. # The binutils c++filt program wants to know whether underscores are # stripped or not. That is why we set targ_underscore. c++filt uses @@ -22,11 +26,11 @@ targ_cflags= targ_underscore=no -targ_cpu=`echo $targ | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +targ_cpu=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` case "${targ_cpu}" in arm*) targ_archs=bfd_arm_arch ;; hppa*) targ_archs=bfd_hppa_arch ;; -i[345]86) targ_archs=bfd_i386_arch ;; +i[3456]86) targ_archs=bfd_i386_arch ;; m68*) targ_archs=bfd_m68k_arch ;; m88*) targ_archs=bfd_m88k_arch ;; mips*) targ_archs=bfd_mips_arch ;; @@ -43,6 +47,8 @@ # convention, else the table becomes a real mess to understand and maintain. case "${targ}" in +# START OF targmatch.h +#ifdef BFD64 alpha-*-netware*) targ_defvec=ecoffalpha_little_vec targ_selvecs=nlm32_alpha_vec @@ -61,6 +67,7 @@ alpha-*-*) targ_defvec=ecoffalpha_little_vec ;; +#endif /* BFD64 */ arm-*-riscix*) targ_defvec=riscix_vec @@ -95,6 +102,11 @@ targ_underscore=yes ;; + d10v-*-*) + targ_defvec=bfd_elf32_d10v_vec + ;; + + h8300*-*-*) targ_defvec=h8300coff_vec targ_underscore=yes @@ -105,15 +117,10 @@ targ_underscore=yes ;; - sh-*-*) - targ_defvec=shcoff_vec - targ_selvecs="shcoff_vec shlcoff_vec" - targ_underscore=yes - ;; - - hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4*) + hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*) targ_defvec=bfd_elf32_hppa_vec ;; +#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) hppa*-*-bsd*) targ_defvec=som_vec targ_selvecs=bfd_elf32_hppa_vec @@ -125,82 +132,82 @@ targ_defvec=som_vec targ_selvecs=bfd_elf32_hppa_vec ;; +#endif /* defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) */ - i[345]86-*-sysv4* | i[345]86-*-unixware | i[345]86-*-solaris2* | \ - i[345]86-*-elf | i[345]86-*-sco*elf* | i[345]86-*-freebsdelf*) + i[3456]86-*-sysv4* | i[3456]86-*-unixware | i[3456]86-*-solaris2* | \ + i[3456]86-*-elf | i[3456]86-*-sco*elf* | i[3456]86-*-freebsdelf* | \ + i[3456]86-*-dgux*) targ_defvec=bfd_elf32_i386_vec targ_selvecs=i386coff_vec ;; - i[345]86-*-sysv* | i[345]86-*-isc* | i[345]86-*-sco* | i[345]86-*-coff | \ - i[345]86-*-aix* | i[345]86-*-go32* | i[345]86*-*-rtems*) + i[3456]86-*-sysv* | i[3456]86-*-isc* | i[3456]86-*-sco* | i[3456]86-*-coff | \ + i[3456]86-*-aix* | i[3456]86-*-go32* | i[3456]86*-*-rtems*) targ_defvec=i386coff_vec ;; - i[345]86-sequent-bsd*) + i[3456]86-sequent-bsd*) targ_defvec=i386dynix_vec targ_underscore=yes ;; - i[345]86-*-bsd*) + i[3456]86-*-bsd*) targ_defvec=i386bsd_vec targ_underscore=yes ;; - i[345]86-*-freebsd*) + i[3456]86-*-freebsd*) targ_defvec=i386freebsd_vec targ_selvecs=i386bsd_vec targ_underscore=yes ;; - i[345]86-*-netbsd*) + i[3456]86-*-netbsd* | i[3456]86-*-openbsd*) targ_defvec=i386netbsd_vec targ_selvecs=i386bsd_vec targ_underscore=yes ;; - i[345]86-*-netware*) + i[3456]86-*-netware*) targ_defvec=bfd_elf32_i386_vec targ_selvecs="nlm32_i386_vec i386coff_vec i386aout_vec" ;; - i[345]86-*-linuxaout*) + i[3456]86-*-linuxaout*) targ_defvec=i386linux_vec targ_selvecs=bfd_elf32_i386_vec targ_underscore=yes ;; - i[345]86-*-linux*) + i[3456]86-*-linux*) targ_defvec=bfd_elf32_i386_vec targ_selvecs=i386linux_vec - targ_underscore=yes ;; - i[345]86-*-lynxos*) + i[3456]86-*-lynxos*) targ_defvec=i386lynx_coff_vec targ_selvecs=i386lynx_aout_vec ;; - i[345]86-*-gnu*) + i[3456]86-*-gnu*) targ_defvec=bfd_elf32_i386_vec targ_selvecs=i386mach3_vec targ_cflags=-DSTAT_FOR_EXEC - targ_underscore=yes ;; - i[345]86-*-mach* | i[345]86-*-osf1mk*) + i[3456]86-*-mach* | i[3456]86-*-osf1mk*) targ_defvec=i386mach3_vec targ_cflags=-DSTAT_FOR_EXEC targ_underscore=yes ;; - i[345]86-*-os9k) + i[3456]86-*-os9k) targ_defvec=i386os9k_vec ;; - i[345]86-*-msdos*) + i[3456]86-*-msdos*) targ_defvec=i386aout_vec targ_selvecs=i386msdos_vec ;; - i[345]86-*-moss*) + i[3456]86-*-moss*) targ_defvec=bfd_elf32_i386_vec targ_selvecs="i386msdos_vec i386aout_vec" ;; - i[345]86-*-cygwin32 | i[345]86-*-winnt | i[345]86-*-pe) + i[3456]86-*-cygwin32 | i[3456]86-*-winnt | i[3456]86-*-pe) targ_defvec=i386pe_vec targ_selvecs="i386pe_vec i386pei_vec" ;; - i[345]86-none-*) + i[3456]86-none-*) targ_defvec=i386coff_vec ;; - i[345]86-*-aout* | i[345]86*-*-vsta*) + i[3456]86-*-aout* | i[3456]86*-*-vsta*) targ_defvec=i386aout_vec ;; @@ -227,6 +234,10 @@ targ_underscore=yes ;; + m32r-*-*) + targ_defvec=bfd_elf32_m32r_vec + ;; + m68*-apollo-*) targ_defvec=apollocoff_vec ;; @@ -234,6 +245,9 @@ targ_defvec=m68kcoffun_vec targ_underscore=yes ;; + m68*-motorola-sysv*) + targ_defvec=m68ksysvcoff_vec + ;; m68*-hp-bsd*) targ_defvec=hp300bsd_vec targ_underscore=yes @@ -276,7 +290,7 @@ targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec" targ_underscore=yes ;; - m68*-*-netbsd*) + m68*-*-netbsd* | m68*-*-openbsd*) targ_defvec=m68knetbsd_vec targ_selvecs="m68k4knetbsd_vec hp300bsd_vec sunos_big_vec" targ_underscore=yes @@ -288,7 +302,7 @@ ;; m68*-ericsson-*) targ_defvec=sunos_big_vec - targ_selvecs="m68kcoff_vec tekhex_vec" + targ_selvecs="m68kcoff_vec versados_vec tekhex_vec" targ_underscore=yes ;; m68*-cbm-*) @@ -341,6 +355,10 @@ targ_defvec=ecoff_big_vec targ_selvecs=ecoff_little_vec ;; + mips*-*-irix6*) + targ_defvec=bfd_elf32_bigmips_vec + targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" + ;; mips*-*-irix5*) targ_defvec=bfd_elf32_bigmips_vec targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec" @@ -349,6 +367,10 @@ targ_defvec=ecoff_big_vec targ_selvecs=ecoff_little_vec ;; + mips*-*-lnews*) + targ_defvec=ecoff_biglittle_vec + targ_selvecs="ecoff_little_vec ecoff_big_vec" + ;; mips*-*-mach3*) targ_defvec=aout_mips_little_vec targ_cflags=-DSTAT_FOR_EXEC @@ -365,24 +387,44 @@ targ_defvec=bfd_elf32_littlemips_vec targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" ;; - mips*-*-elf*) + mips*-*-elf* | mips*-*-rtems*) targ_defvec=bfd_elf32_bigmips_vec targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" ;; + mips*-*-none) + targ_defvec=bfd_elf32_bigmips_vec + targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" + ;; + mips*el*-*-linux* | mips*el*-*-openbsd*) + targ_defvec=bfd_elf32_littlemips_vec + targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec" + ;; + mips*-*-linux* | mips*-*-openbsd*) + targ_defvec=bfd_elf32_bigmips_vec + targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec" + ;; + + mn10200-*-*) + targ_defvec=bfd_elf32_mn10200_vec + ;; + + mn10300-*-*) + targ_defvec=bfd_elf32_mn10300_vec + ;; ns32k-pc532-mach* | ns32k-pc532-ux*) targ_defvec=pc532machaout_vec targ_underscore=yes ;; - ns32k-*-netbsd* | ns32k-*-lites*) + ns32k-*-netbsd* | ns32k-*-lites* | ns32k-*-openbsd*) targ_defvec=pc532netbsd_vec targ_underscore=yes ;; - powerpc-*-aix*) + powerpc-*-aix* | powerpc-*-beos*) targ_defvec=rs6000coff_vec ;; - powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ + powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ powerpc-*-solaris2* | powerpc-*-linux* | powerpc-*-rtems*) targ_defvec=bfd_elf32_powerpc_vec targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec ppcboot_vec" @@ -409,26 +451,56 @@ targ_defvec=rs6000coff_vec ;; + sh-*-elf*) + targ_defvec=bfd_elf32_sh_vec + targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec" + targ_underscore=yes + ;; + sh-*-*) + targ_defvec=shcoff_vec + targ_selvecs="shcoff_vec shlcoff_vec" + targ_underscore=yes + ;; + + sparclet-*-aout*) + targ_defvec=sunos_big_vec + targ_selvecs=sparcle_aout_vec + targ_underscore=yes + ;; + sparc-*-linuxaout*) + targ_defvec=sparclinux_vec + targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" + targ_underscore=yes + ;; + sparc-*-linux*) + targ_defvec=bfd_elf32_sparc_vec + targ_selvecs="sparclinux_vec sunos_big_vec" + ;; sparc-*-lynxos*) targ_defvec=sparclynx_coff_vec targ_selvecs=sparclynx_aout_vec ;; - sparc-*-netbsd*) + sparc-*-netbsd* | sparc-*-openbsd*) targ_defvec=sparcnetbsd_vec targ_underscore=yes ;; - sparc-*-elf* | sparc-*-sysv4* | sparc-*-solaris2*) + sparc-*-elf* | sparc-*-solaris2*) targ_defvec=bfd_elf32_sparc_vec targ_selvecs=sunos_big_vec ;; + sparc-*-sysv4*) + targ_defvec=bfd_elf32_sparc_vec + ;; sparc64-*-aout*) targ_defvec=sunos_big_vec targ_underscore=yes ;; +#ifdef BFD64 sparc64-*-elf*) targ_defvec=bfd_elf64_sparc_vec targ_selvecs=bfd_elf32_sparc_vec ;; +#endif /* BFD64 */ sparc-*-netware*) targ_defvec=bfd_elf32_sparc_vec targ_selvecs="nlm32_sparc_vec sunos_big_vec" @@ -441,20 +513,19 @@ targ_underscore=yes ;; +#if 0 tahoe-*-*) targ_defvec=host_aout_vec targ_underscore=yes ;; +#endif - vax-*-vms*) - echo 1>&2 "*** BFD does not support target ${targ}." - echo 1>&2 "*** Look in bfd/config.bfd for supported targets." - exit 1 - ;; - vax-*-*) +#if 0 + vax-*-bsd* | vax-*-ultrix*) targ_defvec=host_aout_vec targ_underscore=yes ;; +#endif we32k-*-*) targ_defvec=we32kcoff_vec @@ -474,7 +545,7 @@ ;; *-adobe-*) - targ_defvec=a_aout_adobe_vec + targ_defvec=a_out_adobe_vec targ_underscore=yes ;; @@ -487,7 +558,7 @@ targ_defvec=m68kcoff_vec targ_selvecs=ieee_vec ;; - +# END OF targmatch.h *) echo 1>&2 "*** BFD does not support target ${targ}." echo 1>&2 "*** Look in bfd/config.bfd for supported targets." diff -urN binutils-2.7/bfd/config.h-vms binutils-2.8/bfd/config.h-vms --- binutils-2.7/bfd/config.h-vms Thu Jul 4 12:18:08 1996 +++ binutils-2.8/bfd/config.h-vms Wed Dec 31 19:00:00 1969 @@ -1,59 +0,0 @@ -/* config.h-vms. Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de. */ -/* config.in. Generated automatically from configure.in by autoheader. */ - -/* Whether malloc must be declared even if is included. */ -/* #undef NEED_DECLARATION_MALLOC */ - -/* Whether free must be declared even if is included. */ -/* #undef NEED_DECLARATION_FREE */ - -/* Define if you have a working `mmap' system call. */ -/* #define HAVE_MMAP 1 */ - -/* Do we need to use the b modifier when opening binary files? */ -/* #undef USE_BINARY_FOPEN */ - -/* Name of host specific header file to include in trad-core.c. */ -/* #undef TRAD_HEADER */ - -/* Define only if is available *and* it defines prstatus_t. */ -/* #undef HAVE_SYS_PROCFS_H */ - -/* Do we really want to use mmap if it's available? */ -/* #undef USE_MMAP */ - -/* Define if you have the fcntl function. */ -#define HAVE_FCNTL 1 - -/* Define if you have the getpagesize function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define if you have the madvise function. */ -#define HAVE_MADVISE 1 - -/* Define if you have the mprotect function. */ -#define HAVE_MPROTECT 1 - -/* Define if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the header file. */ -#define HAVE_STDDEF_H 1 - -/* Define if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_FILE_H 1 - -/* Define if you have the header file. */ -#define HAVE_TIME_H 1 - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 diff -urN binutils-2.7/bfd/config.in binutils-2.8/bfd/config.in --- binutils-2.7/bfd/config.in Thu Jul 4 12:18:08 1996 +++ binutils-2.8/bfd/config.in Wed Apr 30 12:55:55 1997 @@ -1,11 +1,20 @@ /* config.in. Generated automatically from configure.in by autoheader. */ +/* Whether strstr must be declared even if is included. */ +#undef NEED_DECLARATION_STRSTR + /* Whether malloc must be declared even if is included. */ #undef NEED_DECLARATION_MALLOC +/* Whether realloc must be declared even if is included. */ +#undef NEED_DECLARATION_REALLOC + /* Whether free must be declared even if is included. */ #undef NEED_DECLARATION_FREE +/* Whether getenv must be declared even if is included. */ +#undef NEED_DECLARATION_GETENV + /* Define if you have a working `mmap' system call. */ #undef HAVE_MMAP @@ -44,9 +53,6 @@ /* Define if you have the sysconf function. */ #undef HAVE_SYSCONF - -/* Define if you have the valloc function. */ -#undef HAVE_VALLOC /* Define if you have the header file. */ #undef HAVE_FCNTL_H diff -urN binutils-2.7/bfd/configure binutils-2.8/bfd/configure --- binutils-2.7/bfd/configure Thu Jul 4 12:30:42 1996 +++ binutils-2.8/bfd/configure Wed Apr 30 12:55:55 1997 @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.10 +# Generated automatically using autoconf version 2.12 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -59,6 +59,8 @@ # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 ac_prev= for ac_option @@ -340,7 +342,7 @@ verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.10" + echo "configure generated by autoconf version 2.12" exit 0 ;; -with-* | --with-*) @@ -442,11 +444,14 @@ done # NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# 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 @@ -508,6 +513,7 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. @@ -624,6 +630,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:634: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -638,12 +645,13 @@ esac host=`$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/'` +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:655: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -655,12 +663,13 @@ esac target=`$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/'` +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:673: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -672,9 +681,9 @@ esac build=`$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/'` +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" && @@ -728,6 +737,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:741: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -756,6 +766,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:770: 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 @@ -802,7 +813,47 @@ 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:818: 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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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* + +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:852: 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:857: 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 @@ -811,7 +862,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:815: \"$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:866: \"$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 @@ -819,29 +870,34 @@ fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + if test $ac_cv_prog_gcc = yes; then GCC=yes - if test "${CFLAGS+set}" != set; then - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + 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:881: 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_gcc_g=yes + ac_cv_prog_cc_g=yes else - ac_cv_prog_gcc_g=no + ac_cv_prog_cc_g=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 - if test $ac_cv_prog_gcc_g = yes; then - CFLAGS="-g -O" - else - CFLAGS="-O" - 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 + CFLAGS="-g -O2" + else + CFLAGS="-O2" fi else GCC= @@ -850,6 +906,7 @@ echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:910: 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 @@ -883,6 +940,7 @@ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:944: 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 @@ -913,6 +971,7 @@ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:975: 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 @@ -943,6 +1002,7 @@ # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1006: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -984,11 +1044,12 @@ # 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:1048: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in @@ -1011,7 +1072,7 @@ ;; esac done - IFS="$ac_save_ifs" + IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then @@ -1048,6 +1109,7 @@ + if test "${commonbfdlib}" = "true"; then COMMON_SHLIB=yes PICLIST=piclist @@ -1059,37 +1121,25 @@ -HOST_64BIT_LONG=0 + +VERSION=`cat ${srcdir}/VERSION` + + +BFD_HOST_64BIT_LONG=0 +BFD_HOST_64_BIT_DEFINED=0 +BFD_HOST_64_BIT= +BFD_HOST_U_64_BIT= if test "x${HOST_64BIT_TYPE}" = "xlong"; then - HOST_64BIT_LONG=1 + BFD_HOST_64BIT_LONG=1 +elif test "x${HOST_64BIT_TYPE}" != "x"; then + BFD_HOST_64_BIT_DEFINED=1 + BFD_HOST_64_BIT=${HOST_64BIT_TYPE} + BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE} fi -# If we cannot run a trivial program, we must be cross compiling. -echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_c_cross=yes -else -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } -if test -s conftest && (./conftest; exit) 2>/dev/null; then - ac_cv_c_cross=no -else - ac_cv_c_cross=yes -fi -fi -rm -fr conftest* -fi -echo "$ac_t""$ac_cv_c_cross" 1>&6 -cross_compiling=$ac_cv_c_cross + # Put a plausible default for CC_FOR_BUILD in Makefile. if test -z "$CC_FOR_BUILD"; then @@ -1102,6 +1152,7 @@ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1156: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1116,33 +1167,37 @@ # 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:1126: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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:1141: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1194: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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 @@ -1159,24 +1214,27 @@ for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h do -ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1220: 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:1174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1230: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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 @@ -1184,7 +1242,7 @@ 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 | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 +echo "configure:1260: 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:1211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1270: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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 @@ -1221,7 +1282,7 @@ 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 | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 +echo "configure:1297: 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 #include -int main() { return 0; } -int t() { +int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1250: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1311: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_time=no fi rm -f conftest* - fi echo "$ac_t""$ac_cv_header_time" 1>&6 @@ -1268,11 +1330,12 @@ for ac_func in fcntl getpagesize setitimer sysconf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1334: 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; }; then +if { (eval echo configure:1362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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'` @@ -1321,42 +1385,98 @@ case "${host}" in -i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32) +i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32 | *-*-windows) cat >> confdefs.h <<\EOF #define USE_BINARY_FOPEN 1 EOF ;; esac +echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 +echo "configure:1397: 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 < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { +char *(*pfn) = (char *(*)) strstr +; return 0; } +EOF +if { (eval echo configure:1423: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_strstr=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_decl_needed_strstr=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$bfd_cv_decl_needed_strstr" 1>&6 +if test $bfd_cv_decl_needed_strstr = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo strstr | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +echo "configure:1445: 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 < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif -int main() { return 0; } -int t() { +int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:1352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1471: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* bfd_cv_decl_needed_malloc=yes fi rm -f conftest* - fi echo "$ac_t""$bfd_cv_decl_needed_malloc" 1>&6 @@ -1368,35 +1488,91 @@ fi +echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 +echo "configure:1493: 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 < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { +char *(*pfn) = (char *(*)) realloc +; return 0; } +EOF +if { (eval echo configure:1519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_realloc=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_decl_needed_realloc=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$bfd_cv_decl_needed_realloc" 1>&6 +if test $bfd_cv_decl_needed_realloc = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo realloc | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +echo "configure:1541: 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 < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif -int main() { return 0; } -int t() { +int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:1392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1567: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* bfd_cv_decl_needed_free=yes fi rm -f conftest* - fi echo "$ac_t""$bfd_cv_decl_needed_free" 1>&6 @@ -1408,6 +1584,54 @@ fi +echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 +echo "configure:1589: 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 < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { +char *(*pfn) = (char *(*)) getenv +; return 0; } +EOF +if { (eval echo configure:1615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_getenv=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_decl_needed_getenv=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$bfd_cv_decl_needed_getenv" 1>&6 +if test $bfd_cv_decl_needed_getenv = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo getenv | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <> confdefs.h <<\EOF #define TRAD_HEADER "hosts/symmetry.h" EOF ;; - i[345]86-sequent-sysv4*) ;; - i[345]86-sequent-sysv*) + i[3456]86-sequent-sysv4*) ;; + i[3456]86-sequent-sysv*) COREFILE=trad-core.o cat >> confdefs.h <<\EOF #define TRAD_HEADER "hosts/symmetry.h" EOF ;; - i[345]86-*-bsd* | i[345]86-*-freebsd*) + i[3456]86-*-bsd* | i[3456]86-*-freebsd*) COREFILE=trad-core.o cat >> confdefs.h <<\EOF #define TRAD_HEADER "hosts/i386bsd.h" EOF ;; - i[345]86-*-netbsd*) + i[3456]86-*-netbsd* | i[3456]86-*-openbsd*) COREFILE=netbsd-core.o ;; - i[345]86-esix-sysv3*) + i[3456]86-esix-sysv3*) COREFILE=trad-core.o cat >> confdefs.h <<\EOF #define TRAD_HEADER "hosts/esix.h" EOF ;; - i[345]86-*-sco* | i[345]86-*-isc*) + i[3456]86-*-sco* | i[3456]86-*-isc*) COREFILE=trad-core.o cat >> confdefs.h <<\EOF #define TRAD_HEADER "hosts/i386sco.h" EOF ;; - i[345]86-*-mach3*) + i[3456]86-*-mach3*) COREFILE=trad-core.o cat >> confdefs.h <<\EOF #define TRAD_HEADER "hosts/i386mach3.h" EOF ;; - i[345]86-*-linux*) + i[3456]86-*-linux*) COREFILE=trad-core.o cat >> confdefs.h <<\EOF #define TRAD_HEADER "hosts/i386linux.h" EOF ;; - i[345]86-*-isc*) COREFILE=trad-core.o ;; - i[345]86-*-aix*) COREFILE=aix386-core.o ;; + i[3456]86-*-isc*) COREFILE=trad-core.o ;; + i[3456]86-*-aix*) COREFILE=aix386-core.o ;; i860-*-mach3* | i860-*-osf1*) COREFILE=trad-core.o cat >> confdefs.h <<\EOF @@ -1503,7 +1727,7 @@ EOF ;; - mips-*-netbsd*) + mips-*-netbsd* | mips*-*-openbsd*) COREFILE=netbsd-core.o ;; mips-dec-*) @@ -1515,6 +1739,7 @@ ;; mips-sgi-irix4*) COREFILE=irix-core.o ;; mips-sgi-irix5*) COREFILE=irix-core.o ;; + mips-sgi-irix6*) COREFILE=irix-core.o ;; mips-*-mach3*) COREFILE=trad-core.o cat >> confdefs.h <<\EOF @@ -1573,7 +1798,7 @@ EOF ;; - m68*-*-netbsd*) + m68*-*-netbsd* | m68*-*-openbsd*) COREFILE=netbsd-core.o ;; m68*-apple-aux*) @@ -1599,15 +1824,17 @@ EOF ;; - ns32k-*-netbsd*) + ns32k-*-netbsd* | ns32k-*-openbsd*) COREFILE=netbsd-core.o ;; rs6000-*-lynx*) COREFILE=lynx-core.o ;; rs6000-*-aix4*) COREFILE=rs6000-core.o ;; rs6000-*-*) COREFILE=rs6000-core.o ;; + powerpc-*-*bsd*) COREFILE=netbsd-core.o ;; powerpc-*-aix4*) COREFILE=rs6000-core.o ;; powerpc-*-aix*) COREFILE=rs6000-core.o ;; - sparc-*-netbsd*) + powerpc-*-beos*) ;; + sparc-*-netbsd* | sparc-*-openbsd*) COREFILE=netbsd-core.o ;; tahoe-*-*) @@ -1656,27 +1883,28 @@ # Define HAVE_SYS_PROCFS_H if the file exists and defines # prstatus_t. echo $ac_n "checking for sys/procfs.h""... $ac_c" 1>&6 +echo "configure:1887: checking for sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_header_sys_procfs_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < -int main() { return 0; } -int t() { +int main() { prstatus_t t; ; return 0; } EOF -if { (eval echo configure:1672: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_header_sys_procfs_h=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* bfd_cv_header_sys_procfs_h=no fi rm -f conftest* - fi echo "$ac_t""$bfd_cv_header_sys_procfs_h" 1>&6 @@ -1697,7 +1925,7 @@ if test -n "$enable_targets" ; then for targ in `echo $enable_targets | sed 's/,/ /g'` do - result=`$ac_config_sub $targ 2>/dev/null` + result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null` if test -n "$result" ; then canon_targets="$canon_targets $result" else @@ -1787,6 +2015,7 @@ bfd_elf32_bigmips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;; bfd_elf64_bigmips_vec) tb="$tb elf64-mips.o elf64.o elf32-mips.o elf32.o $elf ecofflink.o" target64=true ;; + bfd_elf32_d10v_vec) tb="$tb elf32-d10v.o elf32.o $elf" ;; bfd_elf32_hppa_vec) tb="$tb elf32-hppa.o elf32.o $elf" ;; bfd_elf32_i386_vec) tb="$tb elf32-i386.o elf32.o $elf" ;; bfd_elf32_i860_vec) tb="$tb elf32-i860.o elf32.o $elf" ;; @@ -1794,10 +2023,15 @@ bfd_elf32_littlemips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;; bfd_elf64_littlemips_vec) tb="$tb elf64-mips.o elf64.o elf32-mips.o elf32.o $elf ecofflink.o" target64=true ;; + bfd_elf32_m32r_vec) tb="$tb elf32-m32r.o elf32.o $elf" ;; bfd_elf32_m68k_vec) tb="$tb elf32-m68k.o elf32.o $elf" ;; bfd_elf32_m88k_vec) tb="$tb elf32-m88k.o elf32.o $elf" ;; + bfd_elf32_mn10200_vec) tb="$tb elf-m10200.o elf32.o $elf" ;; + bfd_elf32_mn10300_vec) tb="$tb elf-m10300.o elf32.o $elf" ;; bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;; bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;; + bfd_elf32_sh_vec) tb="$tb elf32-sh.o elf32.o $elf coff-sh.o" ;; + bfd_elf32_shl_vec) tb="$tb elf32-sh.o elf32.o $elf coff-sh.o" ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.o elf32.o $elf" ;; bfd_elf64_big_generic_vec) tb="$tb elf64-gen.o elf64.o $elf" target64=true ;; @@ -1810,6 +2044,7 @@ target64=true ;; ecoff_big_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; ecoff_little_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; + ecoff_biglittle_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; ecoffalpha_little_vec) tb="$tb coff-alpha.o ecoff.o ecofflink.o" target64=true ;; evax_alpha_vec) tb="$tb evax-alpha.o evax-emh.o evax-egsd.o evax-etir.o evax-misc.o" @@ -1845,6 +2080,7 @@ m68knetbsd_vec) tb="$tb m68knetbsd.o aout32.o" ;; m68k4knetbsd_vec) tb="$tb m68k4knetbsd.o aout32.o" ;; m68kaux_coff_vec) tb="$tb coff-aux.o coff-m68k.o cofflink.o" ;; + m68ksysvcoff_vec) tb="$tb coff-svm68k.o cofflink.o" ;; m88kbcs_vec) tb="$tb coff-m88k.o" ;; newsos3_vec) tb="$tb newsos3.o aout32.o" ;; nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;; @@ -1865,6 +2101,8 @@ shcoff_vec) tb="$tb coff-sh.o cofflink.o" ;; shlcoff_vec) tb="$tb coff-sh.o cofflink.o" ;; som_vec) tb="$tb som.o" ;; + sparcle_aout_vec) tb="$tb aout-sparcle.o aout32.o" ;; + sparclinux_vec) tb="$tb sparclinux.o aout32.o stab-syms.o" ;; sparclynx_aout_vec) tb="$tb sparclynx.o lynx-core.o aout32.o" ;; sparclynx_coff_vec) tb="$tb cf-sparclynx.o lynx-core.o" ;; sparcnetbsd_vec) tb="$tb sparcnetbsd.o aout32.o" ;; @@ -1884,7 +2122,9 @@ done # Target architecture .o files. -ta=`echo $selarchs | sed -e s/bfd_/cpu-/g -e s/_arch/.o/g` +# A couple of CPUs use shorter file names to avoid problems on DOS +# filesystems. +ta=`echo $selarchs | sed -e s/bfd_/cpu-/g -e s/_arch/.o/g -e s/mn10200/m10200/ -e s/mn10300/m10300/` # Weed out duplicate .o files. f="" @@ -1912,9 +2152,13 @@ bfd_backends="${bfd_backends}"' $(ALL_BACKENDS)' bfd_machines="${bfd_machines}"' $(ALL_MACHINES)' selvecs= + havevecs= selarchs= else # all_targets is true # Only set these if they will be nonempty, for the clever echo. + havevecs= + test -n "$selvecs" && + havevecs=`echo $selvecs | sed -e 's/^/-DHAVE_/' -e 's/ \(.\)/ -DHAVE_\1/g'` test -n "$selvecs" && selvecs=`echo $selvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'` test -n "$selarchs" && @@ -1925,7 +2169,7 @@ *true*) wordsize=64 all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)' - if test -z "$GCC" && test "$HOST_64BIT_LONG" = "0"; then + if test -z "$GCC" && test "$BFD_HOST_64BIT_LONG" = "0" && test "$BFD_HOST_64_BIT_DEFINED" = "0"; then echo "configure: warning: You have requested a 64 bit BFD configuration, but" 1>&2 echo "configure: warning: your compiler may not have a 64 bit integral type" 1>&2 fi @@ -1945,16 +2189,58 @@ test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}" test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'" test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'" +test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}" -for ac_func in valloc getpagesize +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:2200: 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:2210: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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:2239: 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; }; then +if { (eval echo configure:2267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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'` @@ -2001,94 +2288,170 @@ done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_func_mmap'+set}'`\" = set"; then +echo "configure:2292: 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=no + ac_cv_func_mmap_fixed_mapped=no else -cat > conftest.$ac_ext < conftest.$ac_ext < #include #include +/* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE -# include -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif -# else -# ifdef NBPC -# define getpagesize() NBPC -# else -# define getpagesize() PAGESIZE /* SVR4 */ -# endif -# endif +# ifdef HAVE_UNISTD_H +# include # endif -#endif -#ifndef HAVE_VALLOC -# define valloc malloc -#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 *valloc(unsigned), *malloc(unsigned); } +extern "C" { void *malloc(unsigned); } #else -char *valloc(), *malloc(); +char *malloc(); #endif int main() { - char *buf1, *buf2, *buf3; - int i = getpagesize(), j; - int i2 = i * 2; - int fd; - - buf1 = (char *)valloc(i2); - buf2 = (char *)valloc(i); - buf3 = (char *)malloc(i2); - for (j = 0; j < i2; ++j) - *(buf1 + j) = rand(); - fd = open("conftestmmap", O_CREAT | O_RDWR, 0666); - write(fd, buf1, i2); - mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, fd, 0); - for (j = 0; j < i; ++j) - if (*(buf1 + j) != *(buf2 + j)) - exit(1); - lseek(fd, (long)i, 0); - read(fd, buf2, i); /* read into mapped memory -- file should not change */ - /* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */ - lseek(fd, (long)0, 0); - read(fd, buf3, i2); - for (j = 0; j < i2; ++j) - if (*(buf1 + j) != *(buf3 + j)) - exit(1); - exit(0); + 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 -{ (eval echo configure:2085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } -if test -s conftest && (./conftest; exit) 2>/dev/null; then - ac_cv_func_mmap=yes +if { (eval echo configure:2440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mmap_fixed_mapped=yes else - ac_cv_func_mmap=no -fi + 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 -echo "$ac_t""$ac_cv_func_mmap" 1>&6 -if test $ac_cv_func_mmap = yes; then +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 @@ -2098,11 +2461,12 @@ for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2465: 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; }; then +if { (eval echo configure:2493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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'` @@ -2148,7 +2513,7 @@ fi done -case ${want_mmap}+${ac_cv_func_mmap} in +case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in true+yes ) cat >> confdefs.h <<\EOF #define USE_MMAP 1 EOF @@ -2173,11 +2538,25 @@ # --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 | - sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ - >> confcache + case `(ac_space=' '; set) 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 @@ -2232,7 +2611,7 @@ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.10" + echo "$CONFIG_STATUS generated by autoconf version 2.12" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -2243,7 +2622,7 @@ ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "Makefile doc/Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile doc/Makefile bfd-in3.h:bfd-in2.h config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $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]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac - # Adjust relative srcdir, etc. for subdirectories. + # 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%/[^/][^/]*$%%'` @@ -2357,6 +2778,7 @@ [/$]*) 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." @@ -2365,14 +2787,16 @@ # $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 -" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done -rm -f conftest.subs +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. @@ -2393,11 +2817,17 @@ ac_eC=' ' ac_eD='%g' -CONFIG_HEADERS=${CONFIG_HEADERS-"config.h:config.in"} +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]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac @@ -2405,7 +2835,8 @@ echo creating $ac_file rm -f conftest.frag conftest.in conftest.out - cp $ac_given_srcdir/$ac_file_in conftest.in + 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 @@ -2433,8 +2864,6 @@ # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. -# Maximum number of lines to put in a single here document. -ac_max_here_lines=12 rm -f conftest.tail while : @@ -2476,7 +2905,11 @@ fi fi; done +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac exit 0 EOF diff -urN binutils-2.7/bfd/configure.com binutils-2.8/bfd/configure.com --- binutils-2.7/bfd/configure.com Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/configure.com Wed Apr 30 12:55:55 1997 @@ -0,0 +1,133 @@ +$! +$! This file configures the bfd library for use with openVMS/Alpha +$! We do not use the configure script, since we do not have /bin/sh +$! to execute it. +$! +$! Written by Klaus K"ampf (kkaempf@progis.de) +$! +$arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2 +$arch = f$element(arch_indx,"|","|VAX|Alpha|") +$if arch .eqs. "VAX" +$then +$ write sys$output "Target VAX not supported." +$ exit 2 +$endif +$! +$! copy bfd-in2.h to bfd.h, replacing @ macros +$! +$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input - + []bfd-in2.h /output=[]bfd.h +$DECK +! +! Copy file, changing lines with macros (@@) +! +! + vfile := CREATE_BUFFER("vfile", "VERSION."); + POSITION(BEGINNING_OF(vfile)); + vers := CURRENT_LINE; + + file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); + rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); + + match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT(vers); + ENDIF; + match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('64'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('0'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('0'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT(''); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT(''); + ENDIF; + WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); + QUIT +$ EOD +$ write sys$output "Generated `bfd.h' from `bfd-in2.h'." +$! +$! +$! create targmatch.h +$! +$ open/write tfile []targmatch.h +$ write tfile "{ " + """alpha-*-*vms*""" + "," +$ write tfile "#if !defined (SELECT_VECS) || defined (HAVE_evax_alpha_vec)" +$ write tfile "&evax_alpha_vec" +$ write tfile "#else" +$ write tfile "UNSUPPORTED_TARGET" +$ write tfile "#endif" +$ write tfile "}," +$ close tfile +$ write sys$output "Generated `targmatch.h'" +$! +$! +$! create config.h +$! +$ create []config.h +/* config.h-vms. Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de. */ +/* config.in. Generated automatically from configure.in by autoheader. */ +/* Whether malloc must be declared even if is included. */ +/* #undef NEED_DECLARATION_MALLOC */ +/* Whether free must be declared even if is included. */ +/* #undef NEED_DECLARATION_FREE */ +/* Define if you have a working `mmap' system call. */ +/* #define HAVE_MMAP 1 */ +/* Do we need to use the b modifier when opening binary files? */ +/* #undef USE_BINARY_FOPEN */ +/* Name of host specific header file to include in trad-core.c. */ +/* #undef TRAD_HEADER */ +/* Define only if is available *and* it defines prstatus_t. */ +/* #undef HAVE_SYS_PROCFS_H */ +/* Do we really want to use mmap if it's available? */ +/* #undef USE_MMAP */ +/* Define if you have the fcntl function. */ +#define HAVE_FCNTL 1 +/* Define if you have the getpagesize function. */ +#define HAVE_GETPAGESIZE 1 +/* Define if you have the madvise function. */ +#define HAVE_MADVISE 1 +/* Define if you have the mprotect function. */ +#define HAVE_MPROTECT 1 +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 +/* Define if you have the header file. */ +#define HAVE_STDDEF_H 1 +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 +/* Define if you have the header file. */ +#define HAVE_STRINGS_H 1 +/* Define if you have the header file. */ +#define HAVE_SYS_FILE_H 1 +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 +$! +$ write sys$output "Generated `config.h'" + diff -urN binutils-2.7/bfd/configure.host binutils-2.8/bfd/configure.host --- binutils-2.7/bfd/configure.host Thu Jul 4 12:18:12 1996 +++ binutils-2.8/bfd/configure.host Wed Apr 30 12:55:56 1997 @@ -8,15 +8,19 @@ # This sets the following shell variables: # HDEFINES host specific compiler options -# host64 set to true if this is a 64 bit host +# host64 set to true if 64 bit types are as fast as 32 bit # HOST_64BIT_TYPE host 64 bit type +# HOST_U_64BIT_TYPE unsigned 64 bit type (not needed if 64BIT_TYPE is long) # SHLIB_CC compiler to use when building shared library # SHLIB_CFLAGS flags to use when building shared library +# SHLIB_LIBS libraries to use when building shared library # PICFLAG may be set to flag to use to compile PIC # SHLINK may be set to the name to link the shared library to # ALLLIBS may be set to libraries to build # HLDFLAGS LDFLAGS specific to the host +# HLDENV environment variable to set when linking for the host # RPATH_ENVVAR environment variable used to find shared libraries +# INSTALL_SHLIB install a shared library HDEFINES= host64=false @@ -31,33 +35,62 @@ hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;; hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;; -i[345]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;; -i[345]86-sequent-sysv4*) ;; -i[345]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;; - -mips-dec-netbsd*) ;; -mips-dec-*) HDEFINES="-G 4" ;; -mips-sgi-irix3*) HDEFINES="-G 4" ;; -mips-sgi-irix4*) HDEFINES="-G 4" ;; -mips-*-sysv4*) ;; -mips-*-sysv*) HDEFINES="-G 4" ;; -mips-*-riscos*) HDEFINES="-G 4" ;; +i[3456]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;; +i[3456]86-sequent-sysv4*) ;; +i[3456]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;; + +mips*-dec-netbsd*) ;; +mips*-*-openbsd*) ;; +mips*-dec-*) HDEFINES="-G 4" ;; +mips*-sgi-irix3*) HDEFINES="-G 4" ;; +mips*-sgi-irix4*) HDEFINES="-G 4" ;; +mips*-sgi-irix6*) host64=true + HOST_64BIT_TYPE="long long"; + HOST_U_64BIT_TYPE="unsigned long long"; + ;; +mips*-*-sysv4*) ;; +mips*-*-sysv*) HDEFINES="-G 4" ;; +mips*-*-riscos*) HDEFINES="-G 4" ;; m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;; +*-*-solaris*) HOST_64BIT_TYPE="long long" + HOST_U_64BIT_TYPE="unsigned long long" + ;; + +*-*-windows*) + HOST_64BIT_TYPE=__int64 + HOST_U_64BIT_TYPE="unsigned __int64" +# The following krock is necessary because we can't run the build compiler +# (MSVC) on the configure host, so we have to explicitly set the values here. +# Note that this file is never run through autoconf, so we can't use any +# autoconf macros here. Because of this, we have to muck with autoconf +# variables explicitly. + ac_cv_func_mmap_fixed_mapped=no + ac_cv_header_time=no + ac_cv_func_getpagesize=no + ac_cv_func_madvise=no + ac_cv_func_mprotect=no + ac_cv_header_sys_file_h=no + ac_cv_header_sys_time_h=no + ac_cv_header_unistd_h=no + ;; esac # If we are configuring with --enable-shared, adjust the shared # library support based on the host. This support must work for both # the BFD and the opcodes libraries. HLDFLAGS= +HLDENV= RPATH_ENVVAR=LD_LIBRARY_PATH SHLIB_CC='$(CC)' SHLIB_CFLAGS='-shared' +SHLIB_LIBS= +INSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf;' if [ "${shared}" = "true" ]; then case "${host}" in hppa*-*-*) picfrag=${srcdir}/../config/mh-papic ;; - i[3456]86-*-*) picfrag=${srcdir}/../config/mh-x86pic ;; + i[34566]86-*-*) picfrag=${srcdir}/../config/mh-x86pic ;; *-*-*) picfrag=${srcdir}/../config/mh-${host_cpu}pic ;; esac if [ -f "${picfrag}" ]; then @@ -80,9 +113,10 @@ SHLIB_CFLAGS='-shared $(PICFLAG)' HLDFLAGS='-Wl,+s,+b,$(libdir)' RPATH_ENVVAR=SHLIB_PATH + INSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf; chmod -w $(libdir)/$$tf;' ;; - *-*-irix5*) - # -fpic is not needed on Irix 5. + *-*-irix[56]*) + # -fpic is not needed on Irix 5 or 6. PICFLAG= SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)' HLDFLAGS='-Wl,-rpath,$(libdir)' @@ -95,10 +129,17 @@ /lib | /usr/lib) ;; *) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; esac + # On Linux, apparently, linking against -lc lets ldconfig figure + # out which version of libc should be used. + SHLIB_LIBS=-lc ;; - *-*-sysv4* | *-*-solaris*) + *-*-solaris*) SHLIB_CFLAGS='-shared -h $(SONAME)' HLDFLAGS='-R $(libdir)' + ;; + *-*-sysv4*) + SHLIB_CFLAGS='-shared -h $(SONAME)' + HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;' ;; *-*-sunos*) # Build a libTARGET-bfd.so.VERSION symlink in the object directory. diff -urN binutils-2.7/bfd/configure.in binutils-2.8/bfd/configure.in --- binutils-2.7/bfd/configure.in Thu Jul 4 12:30:41 1996 +++ binutils-2.8/bfd/configure.in Wed Apr 30 12:55:56 1997 @@ -99,6 +99,7 @@ AC_SUBST(SHLIB) AC_SUBST(SHLIB_CC) AC_SUBST(SHLIB_CFLAGS) +AC_SUBST(SHLIB_LIBS) if test "${commonbfdlib}" = "true"; then COMMON_SHLIB=yes PICLIST=piclist @@ -109,12 +110,26 @@ AC_SUBST(COMMON_SHLIB) AC_SUBST(PICLIST) AC_SUBST(SHLINK) +AC_SUBST(INSTALL_SHLIB) -HOST_64BIT_LONG=0 +VERSION=`cat ${srcdir}/VERSION` +AC_SUBST(VERSION) + +BFD_HOST_64BIT_LONG=0 +BFD_HOST_64_BIT_DEFINED=0 +BFD_HOST_64_BIT= +BFD_HOST_U_64_BIT= if test "x${HOST_64BIT_TYPE}" = "xlong"; then - HOST_64BIT_LONG=1 + BFD_HOST_64BIT_LONG=1 +elif test "x${HOST_64BIT_TYPE}" != "x"; then + BFD_HOST_64_BIT_DEFINED=1 + BFD_HOST_64_BIT=${HOST_64BIT_TYPE} + BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE} fi -AC_SUBST(HOST_64BIT_LONG) +AC_SUBST(BFD_HOST_64BIT_LONG) +AC_SUBST(BFD_HOST_64_BIT_DEFINED) +AC_SUBST(BFD_HOST_64_BIT) +AC_SUBST(BFD_HOST_U_64_BIT) BFD_CC_FOR_BUILD @@ -125,8 +140,11 @@ BFD_BINARY_FOPEN +BFD_NEED_DECLARATION(strstr) BFD_NEED_DECLARATION(malloc) +BFD_NEED_DECLARATION(realloc) BFD_NEED_DECLARATION(free) +BFD_NEED_DECLARATION(getenv) # If we are configured native, pick a core file support file. COREFILE= @@ -144,56 +162,56 @@ hppa*-*-bsd*) COREFILE="hpux-core.o hppabsd-core.o" COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;; changequote(,)dnl - i[345]86-sequent-bsd*) + i[3456]86-sequent-bsd*) changequote([,])dnl COREFILE=trad-core.o; AC_DEFINE(TRAD_HEADER,"hosts/symmetry.h") ;; changequote(,)dnl - i[345]86-sequent-sysv4*) ;; - i[345]86-sequent-sysv*) + i[3456]86-sequent-sysv4*) ;; + i[3456]86-sequent-sysv*) changequote([,])dnl COREFILE=trad-core.o AC_DEFINE(TRAD_HEADER,"hosts/symmetry.h") ;; changequote(,)dnl - i[345]86-*-bsd* | i[345]86-*-freebsd*) + i[3456]86-*-bsd* | i[3456]86-*-freebsd*) changequote([,])dnl COREFILE=trad-core.o AC_DEFINE(TRAD_HEADER,"hosts/i386bsd.h") ;; changequote(,)dnl - i[345]86-*-netbsd*) + i[3456]86-*-netbsd* | i[3456]86-*-openbsd*) changequote([,])dnl COREFILE=netbsd-core.o ;; changequote(,)dnl - i[345]86-esix-sysv3*) + i[3456]86-esix-sysv3*) changequote([,])dnl COREFILE=trad-core.o AC_DEFINE(TRAD_HEADER,"hosts/esix.h") ;; changequote(,)dnl - i[345]86-*-sco* | i[345]86-*-isc*) + i[3456]86-*-sco* | i[3456]86-*-isc*) changequote([,])dnl COREFILE=trad-core.o AC_DEFINE(TRAD_HEADER,"hosts/i386sco.h") ;; changequote(,)dnl - i[345]86-*-mach3*) + i[3456]86-*-mach3*) changequote([,])dnl COREFILE=trad-core.o AC_DEFINE(TRAD_HEADER,"hosts/i386mach3.h") ;; changequote(,)dnl - i[345]86-*-linux*) + i[3456]86-*-linux*) changequote([,])dnl COREFILE=trad-core.o AC_DEFINE(TRAD_HEADER,"hosts/i386linux.h") ;; changequote(,)dnl - i[345]86-*-isc*) COREFILE=trad-core.o ;; - i[345]86-*-aix*) COREFILE=aix386-core.o ;; + i[3456]86-*-isc*) COREFILE=trad-core.o ;; + i[3456]86-*-aix*) COREFILE=aix386-core.o ;; changequote([,])dnl i860-*-mach3* | i860-*-osf1*) COREFILE=trad-core.o @@ -207,7 +225,7 @@ COREFILE=trad-core.o AC_DEFINE(TRAD_HEADER,"hosts/mipsmach3.h") ;; - mips-*-netbsd*) + mips-*-netbsd* | mips*-*-openbsd*) COREFILE=netbsd-core.o ;; mips-dec-*) @@ -216,6 +234,7 @@ ;; mips-sgi-irix4*) COREFILE=irix-core.o ;; mips-sgi-irix5*) COREFILE=irix-core.o ;; + mips-sgi-irix6*) COREFILE=irix-core.o ;; mips-*-mach3*) COREFILE=trad-core.o AC_DEFINE(TRAD_HEADER,"hosts/mipsmach3.h") @@ -250,7 +269,7 @@ COREFILE=trad-core.o AC_DEFINE(TRAD_HEADER,"hosts/news.h") ;; - m68*-*-netbsd*) + m68*-*-netbsd* | m68*-*-openbsd*) COREFILE=netbsd-core.o ;; m68*-apple-aux*) @@ -267,15 +286,17 @@ COREFILE=trad-core.o AC_DEFINE(TRAD_HEADER,"hosts/pc532mach.h") ;; - ns32k-*-netbsd*) + ns32k-*-netbsd* | ns32k-*-openbsd*) COREFILE=netbsd-core.o ;; rs6000-*-lynx*) COREFILE=lynx-core.o ;; rs6000-*-aix4*) COREFILE=rs6000-core.o ;; rs6000-*-*) COREFILE=rs6000-core.o ;; + powerpc-*-*bsd*) COREFILE=netbsd-core.o ;; powerpc-*-aix4*) COREFILE=rs6000-core.o ;; powerpc-*-aix*) COREFILE=rs6000-core.o ;; - sparc-*-netbsd*) + powerpc-*-beos*) ;; + sparc-*-netbsd* | sparc-*-openbsd*) COREFILE=netbsd-core.o ;; tahoe-*-*) @@ -331,7 +352,7 @@ if test -n "$enable_targets" ; then for targ in `echo $enable_targets | sed 's/,/ /g'` do - result=`$ac_config_sub $targ 2>/dev/null` + result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null` if test -n "$result" ; then canon_targets="$canon_targets $result" else @@ -421,6 +442,7 @@ bfd_elf32_bigmips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;; bfd_elf64_bigmips_vec) tb="$tb elf64-mips.o elf64.o elf32-mips.o elf32.o $elf ecofflink.o" target64=true ;; + bfd_elf32_d10v_vec) tb="$tb elf32-d10v.o elf32.o $elf" ;; bfd_elf32_hppa_vec) tb="$tb elf32-hppa.o elf32.o $elf" ;; bfd_elf32_i386_vec) tb="$tb elf32-i386.o elf32.o $elf" ;; bfd_elf32_i860_vec) tb="$tb elf32-i860.o elf32.o $elf" ;; @@ -428,10 +450,15 @@ bfd_elf32_littlemips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;; bfd_elf64_littlemips_vec) tb="$tb elf64-mips.o elf64.o elf32-mips.o elf32.o $elf ecofflink.o" target64=true ;; + bfd_elf32_m32r_vec) tb="$tb elf32-m32r.o elf32.o $elf" ;; bfd_elf32_m68k_vec) tb="$tb elf32-m68k.o elf32.o $elf" ;; bfd_elf32_m88k_vec) tb="$tb elf32-m88k.o elf32.o $elf" ;; + bfd_elf32_mn10200_vec) tb="$tb elf-m10200.o elf32.o $elf" ;; + bfd_elf32_mn10300_vec) tb="$tb elf-m10300.o elf32.o $elf" ;; bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;; bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;; + bfd_elf32_sh_vec) tb="$tb elf32-sh.o elf32.o $elf coff-sh.o" ;; + bfd_elf32_shl_vec) tb="$tb elf32-sh.o elf32.o $elf coff-sh.o" ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.o elf32.o $elf" ;; bfd_elf64_big_generic_vec) tb="$tb elf64-gen.o elf64.o $elf" target64=true ;; @@ -444,6 +471,7 @@ target64=true ;; ecoff_big_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; ecoff_little_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; + ecoff_biglittle_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; ecoffalpha_little_vec) tb="$tb coff-alpha.o ecoff.o ecofflink.o" target64=true ;; evax_alpha_vec) tb="$tb evax-alpha.o evax-emh.o evax-egsd.o evax-etir.o evax-misc.o" @@ -479,6 +507,7 @@ m68knetbsd_vec) tb="$tb m68knetbsd.o aout32.o" ;; m68k4knetbsd_vec) tb="$tb m68k4knetbsd.o aout32.o" ;; m68kaux_coff_vec) tb="$tb coff-aux.o coff-m68k.o cofflink.o" ;; + m68ksysvcoff_vec) tb="$tb coff-svm68k.o cofflink.o" ;; m88kbcs_vec) tb="$tb coff-m88k.o" ;; newsos3_vec) tb="$tb newsos3.o aout32.o" ;; nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;; @@ -499,6 +528,8 @@ shcoff_vec) tb="$tb coff-sh.o cofflink.o" ;; shlcoff_vec) tb="$tb coff-sh.o cofflink.o" ;; som_vec) tb="$tb som.o" ;; + sparcle_aout_vec) tb="$tb aout-sparcle.o aout32.o" ;; + sparclinux_vec) tb="$tb sparclinux.o aout32.o stab-syms.o" ;; sparclynx_aout_vec) tb="$tb sparclynx.o lynx-core.o aout32.o" ;; sparclynx_coff_vec) tb="$tb cf-sparclynx.o lynx-core.o" ;; sparcnetbsd_vec) tb="$tb sparcnetbsd.o aout32.o" ;; @@ -518,7 +549,9 @@ done # Target architecture .o files. -ta=`echo $selarchs | sed -e s/bfd_/cpu-/g -e s/_arch/.o/g` +# A couple of CPUs use shorter file names to avoid problems on DOS +# filesystems. +ta=`echo $selarchs | sed -e s/bfd_/cpu-/g -e s/_arch/.o/g -e s/mn10200/m10200/ -e s/mn10300/m10300/` # Weed out duplicate .o files. f="" @@ -546,9 +579,13 @@ bfd_backends="${bfd_backends}"' $(ALL_BACKENDS)' bfd_machines="${bfd_machines}"' $(ALL_MACHINES)' selvecs= + havevecs= selarchs= else # all_targets is true # Only set these if they will be nonempty, for the clever echo. + havevecs= + test -n "$selvecs" && + havevecs=`echo $selvecs | sed -e 's/^/-DHAVE_/' -e 's/ \(.\)/ -DHAVE_\1/g'` test -n "$selvecs" && selvecs=`echo $selvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'` test -n "$selarchs" && @@ -559,7 +596,7 @@ *true*) wordsize=64 all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)' - if test -z "$GCC" && test "$HOST_64BIT_LONG" = "0"; then + if test -z "$GCC" && test "$BFD_HOST_64BIT_LONG" = "0" && test "$BFD_HOST_64_BIT_DEFINED" = "0"; then AC_MSG_WARN([You have requested a 64 bit BFD configuration, but]) AC_MSG_WARN([your compiler may not have a 64 bit integral type]) fi @@ -579,15 +616,16 @@ test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}" test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'" test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'" +test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}" AC_SUBST(tdefaults) dnl AC_CHECK_HEADERS(sys/mman.h) AC_FUNC_MMAP AC_CHECK_FUNCS(madvise mprotect) -case ${want_mmap}+${ac_cv_func_mmap} in +case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in true+yes ) AC_DEFINE(USE_MMAP) ;; esac rm -f doc/config.status -AC_OUTPUT(Makefile doc/Makefile, +AC_OUTPUT(Makefile doc/Makefile bfd-in3.h:bfd-in2.h, [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac]) diff -urN binutils-2.7/bfd/cpu-d10v.c binutils-2.8/bfd/cpu-d10v.c --- binutils-2.7/bfd/cpu-d10v.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/cpu-d10v.c Wed Apr 30 12:55:56 1997 @@ -0,0 +1,40 @@ +/* BFD support for the D10V processor + Copyright 1996 Free Software Foundation, Inc. + Contributed by Martin Hunt (hunt@cygnus.com). + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_d10v_arch = +{ + 16, /* 16 bits in a word */ + 16, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_d10v, + 0, + "d10v", + "d10v", + 4, /* section alignment power */ + true, + bfd_default_compatible, + bfd_default_scan, + 0, +}; + diff -urN binutils-2.7/bfd/cpu-h8300.c binutils-2.8/bfd/cpu-h8300.c --- binutils-2.7/bfd/cpu-h8300.c Thu Jul 4 12:30:49 1996 +++ binutils-2.8/bfd/cpu-h8300.c Wed Apr 30 12:55:56 1997 @@ -55,6 +55,10 @@ { return (info->mach == bfd_mach_h8300h); } + else if (*string == 's' || *string == 'S') + { + return (info->mach == bfd_mach_h8300s); + } else { return info->mach == bfd_mach_h8300; @@ -78,7 +82,6 @@ return in; } -#define H8300H_INFO_STRUCT bfd_h8300_arch static const bfd_arch_info_type h8300_info_struct = { 16, /* 16 bits in a word */ @@ -96,7 +99,7 @@ 0, }; -const bfd_arch_info_type H8300H_INFO_STRUCT = +static const bfd_arch_info_type h8300h_info_struct = { 32, /* 32 bits in a word */ 32, /* 32 bits in an address */ @@ -113,5 +116,19 @@ &h8300_info_struct, }; - -#undef H8300_INFO_STRUCT +const bfd_arch_info_type bfd_h8300_arch = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_h8300, + bfd_mach_h8300s, + "h8300s", /* arch_name */ + "h8300s", /* printable name */ + 1, + false, /* the default machine */ + compatible, + h8300_scan, +/* local_bfd_reloc_type_lookup, */ + &h8300h_info_struct, +}; diff -urN binutils-2.7/bfd/cpu-i386.c binutils-2.8/bfd/cpu-i386.c --- binutils-2.7/bfd/cpu-i386.c Thu Jul 4 12:18:14 1996 +++ binutils-2.8/bfd/cpu-i386.c Wed Apr 30 12:55:56 1997 @@ -1,5 +1,5 @@ /* BFD support for the Intel 386 architecture. - Copyright 1992 Free Software Foundation, Inc. + Copyright 1992, 94, 95, 1996 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -21,18 +21,34 @@ #include "sysdep.h" #include "libbfd.h" +static const bfd_arch_info_type i8086_arch = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address (well, not really) */ + 8, /* 8 bits in a byte */ + bfd_arch_i386, + bfd_mach_i386_i8086, + "i8086", + "i8086", + 3, + false, + bfd_default_compatible, + bfd_default_scan , + 0, +}; + const bfd_arch_info_type bfd_i386_arch = - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_i386, - 0, /* only 1 machine */ - "i386", - "i386", - 3, - true, /* the one and only */ - bfd_default_compatible, - bfd_default_scan , - 0, - }; +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_i386, + bfd_mach_i386_i386, + "i386", + "i386", + 3, + true, + bfd_default_compatible, + bfd_default_scan , + &i8086_arch, +}; diff -urN binutils-2.7/bfd/cpu-m10200.c binutils-2.8/bfd/cpu-m10200.c --- binutils-2.7/bfd/cpu-m10200.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/cpu-m10200.c Wed Apr 30 12:55:56 1997 @@ -0,0 +1,38 @@ +/* BFD support for the Matsushita 10200 processor + Copyright 1996, 1997 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_mn10200_arch = + { + 16, /* 16 bits in a word */ + 24, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_mn10200, + 200, + "mn10200", + "mn10200", + 2, + true, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + }; diff -urN binutils-2.7/bfd/cpu-m10300.c binutils-2.8/bfd/cpu-m10300.c --- binutils-2.7/bfd/cpu-m10300.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/cpu-m10300.c Wed Apr 30 12:55:56 1997 @@ -0,0 +1,38 @@ +/* BFD support for the Matsushita 10300 processor + Copyright 1996, 1997 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_mn10300_arch = + { + 32, /* 16 bits in a word */ + 32, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_mn10300, + 300, + "mn10300", + "mn10300", + 2, + true, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + }; diff -urN binutils-2.7/bfd/cpu-m32r.c binutils-2.8/bfd/cpu-m32r.c --- binutils-2.7/bfd/cpu-m32r.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/cpu-m32r.c Wed Apr 30 12:55:57 1997 @@ -0,0 +1,38 @@ +/* BFD support for the M32R processor. + Copyright (C) 1996 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_m32r_arch = +{ + 32, /* bits in a word */ + 32, /* bits in an address */ + 8, /* bits in a byte */ + bfd_arch_m32r, + 0, + "m32r", + "m32r", + 4, /* section alignment power */ + true, /* the default */ + bfd_default_compatible, + bfd_default_scan, + 0 +}; diff -urN binutils-2.7/bfd/cpu-m68k.c binutils-2.8/bfd/cpu-m68k.c --- binutils-2.7/bfd/cpu-m68k.c Thu Jul 4 12:18:14 1996 +++ binutils-2.8/bfd/cpu-m68k.c Wed Apr 30 12:55:57 1997 @@ -1,5 +1,5 @@ /* BFD library support routines for architectures. - Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -21,9 +21,6 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" - -int bfd_default_scan_num_mach(); - #define N(name, print,d,next) \ { 32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_default_compatible,bfd_default_scan, next, } diff -urN binutils-2.7/bfd/cpu-mips.c binutils-2.8/bfd/cpu-mips.c --- binutils-2.7/bfd/cpu-mips.c Thu Jul 4 12:18:14 1996 +++ binutils-2.8/bfd/cpu-mips.c Wed Apr 30 12:55:57 1997 @@ -1,5 +1,5 @@ /* bfd back-end for mips support - Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -29,6 +29,20 @@ 32, /* 32 bits in an address */ 8, /* 8 bits in a byte */ bfd_arch_mips, + 3000, + "mips", + "mips:3000", + 3, + false, + bfd_default_compatible, + bfd_default_scan, + &arch_info_struct[1], + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_mips, 6000, "mips", "mips:6000", @@ -36,7 +50,7 @@ false, bfd_default_compatible, bfd_default_scan, - &arch_info_struct[1], + &arch_info_struct[2], }, { 64, /* 64 bits in a word */ @@ -50,7 +64,7 @@ false, bfd_default_compatible, bfd_default_scan , - &arch_info_struct[2], + &arch_info_struct[3], }, { 64, /* 64 bits in a word */ @@ -64,19 +78,37 @@ false, bfd_default_compatible, bfd_default_scan , + &arch_info_struct[4], + }, + { + 64, /* 64 bits in a word */ + 64, /* 64 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_mips, + 16, + "mips", + "mips:16", + 3, + false, + bfd_default_compatible, + bfd_default_scan , 0, } }; +/* The default architecture is mips:3000, but with a machine number of + zero. This lets the linker distinguish between a default setting + of mips, and an explicit setting of mips:3000. */ + const bfd_arch_info_type bfd_mips_arch = { 32, /* 32 bits in a word */ 32, /* 32 bits in an address */ 8, /* 8 bits in a byte */ bfd_arch_mips, - 3000, + 0, + "mips", "mips", - "mips:3000", 3, true, bfd_default_compatible, diff -urN binutils-2.7/bfd/cpu-sparc.c binutils-2.8/bfd/cpu-sparc.c --- binutils-2.7/bfd/cpu-sparc.c Thu Jul 4 12:18:15 1996 +++ binutils-2.8/bfd/cpu-sparc.c Wed Apr 30 12:55:57 1997 @@ -1,5 +1,5 @@ /* BFD support for the SPARC architecture. - Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1992, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -22,6 +22,9 @@ #include "libbfd.h" /* Don't mix 32 bit and 64 bit files. */ + +static const bfd_arch_info_type *sparc_compatible + PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); static const bfd_arch_info_type * sparc_compatible (a, b) diff -urN binutils-2.7/bfd/dep-in.sed binutils-2.8/bfd/dep-in.sed --- binutils-2.7/bfd/dep-in.sed Thu Jul 4 12:18:15 1996 +++ binutils-2.8/bfd/dep-in.sed Wed Apr 30 12:55:59 1997 @@ -1,17 +1,18 @@ :loop /\\$/N -/\\$/b loop +s/\\\n */ /g +t loop s! @BFD_H@!!g s!@INCDIR@!$(INCDIR)!g s!@SRCDIR@/!!g s!hosts/[^ ]*\.h ! !g s/ sysdep.h//g +s! \.\./bfd/sysdep.h!!g s/ libbfd.h//g s/ config.h//g s! \$(INCDIR)/fopen-[^ ]*\.h!!g s! \$(INCDIR)/ansidecl\.h!!g -s! \$(INCDIR)/obstack\.h!!g s/\\\n */ /g diff -urN binutils-2.7/bfd/doc/ChangeLog binutils-2.8/bfd/doc/ChangeLog --- binutils-2.7/bfd/doc/ChangeLog Thu Jul 4 12:20:15 1996 +++ binutils-2.8/bfd/doc/ChangeLog Wed Apr 30 12:56:24 1997 @@ -1,3 +1,20 @@ +Tue Apr 8 12:49:46 1997 Ian Lance Taylor + + * Makefile.in (install-info): Permit info files to be in srcdir. + (stamp-*): Add a stamp-X target for each X.texi target. + (*.texi): Just depend upon stamp-X. + (clean): Remove stamp-*. + (distclean): Depend upon mostlyclean. Remove stamp-*. Don't + remove $(DOCFILES). + +Mon Apr 7 15:23:26 1997 Ian Lance Taylor + + * Makefile.in (distclean): Don't remove *.info files. + +Thu Feb 13 20:50:02 1997 Klaus Kaempf (kkaempf@progis.de) + + * makefile.vms: New file. + Tue Jun 18 18:32:28 1996 Ian Lance Taylor * chew.c (kill_bogus_lines): Reset sl when not at the start of a diff -urN binutils-2.7/bfd/doc/Makefile.in binutils-2.8/bfd/doc/Makefile.in --- binutils-2.7/bfd/doc/Makefile.in Thu Jul 4 12:20:15 1996 +++ binutils-2.8/bfd/doc/Makefile.in Wed Apr 30 12:56:24 1997 @@ -109,8 +109,13 @@ dvi: bfd.dvi install-info: info - for i in *.info* ; do \ - $(INSTALL_DATA) $$i $(infodir)/$$i ; \ + if [ -r bfd.info ]; then \ + dir=.; \ + else \ + dir=$(srcdir); \ + fi; \ + for i in `cd $$dir; echo *.info*`; do \ + $(INSTALL_DATA) $$dir/$$i $(infodir)/$$i; \ done docs: $(MKDOC) protos bfd.info bfd.dvi bfd.ps @@ -127,62 +132,126 @@ # We can't replace these rules with an implicit rule, because # makes without VPATH support couldn't find the .h files in `..'. -aoutx.texi: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.texi - -archive.texi: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.texi - -archures.texi: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.texi - -bfd.texi: $(MKDOC) $(srcdir)/../bfd.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.texi - -cache.texi: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.texi - -coffcode.texi: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.texi - -core.texi: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.texi - -elf.texi: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.texi - -elfcode.texi: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.texi - -format.texi: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.texi - -libbfd.texi: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.texi - -opncls.texi: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../opncls.c >opncls.texi - -reloc.texi : $(MKDOC) $(srcdir)/../reloc.c - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.texi - -section.texi: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.texi - -syms.texi : $(MKDOC) $(srcdir)/../syms.c - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.texi - -targets.texi: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.texi - -init.texi: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.texi - -hash.texi: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.texi - -linker.texi: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.texi +# We use stamp-XXX targets so that we can distribute the info files, +# and permit people to rebuild them, without requiring the makeinfo +# program. If somebody tries to rebuild info, but none of the .texi +# files have changed, then this Makefile will build chew, and will +# build all of the stamp files, but will not actually have to rebuild +# bfd.info. + +stamp-aoutx: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.tmp + $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi + touch stamp-aoutx +aoutx.texi: stamp-aoutx + +stamp-archive: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.tmp + $(srcdir)/../../move-if-change archive.tmp archive.texi + touch stamp-archive +archive.texi: stamp-archive + +stamp-archures: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp + $(srcdir)/../../move-if-change archures.tmp archures.texi + touch stamp-archures +archures.texi: stamp-archures + +stamp-bfd: $(MKDOC) $(srcdir)/../bfd.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp + $(srcdir)/../../move-if-change bfd.tmp bfd.texi + touch stamp-bfd +bfd.texi: stamp-bfd + +stamp-cache: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp + $(srcdir)/../../move-if-change cache.tmp cache.texi + touch stamp-cache +cache.texi: stamp-cache + +stamp-coffcode: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.tmp + $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi + touch stamp-coffcode +coffcode.texi: stamp-coffcode + +stamp-core: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.tmp + $(srcdir)/../../move-if-change core.tmp core.texi + touch stamp-core +core.texi: stamp-core + +stamp-elf: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.tmp + $(srcdir)/../../move-if-change elf.tmp elf.texi + touch stamp-elf +elf.texi: stamp-elf + +stamp-elfcode: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.tmp + $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi + touch stamp-elfcode +elfcode.texi: stamp-elfcode + +stamp-format: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp + $(srcdir)/../../move-if-change format.tmp format.texi + touch stamp-format +format.texi: stamp-format + +stamp-libbfd: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp + $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi + touch stamp-libbfd +libbfd.texi: stamp-libbfd + +stamp-opncls: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../opncls.c >opncls.tmp + $(srcdir)/../../move-if-change opncls.tmp opncls.texi + touch stamp-opncls +opncls.texi: stamp-opncls + +stamp-reloc: $(MKDOC) $(srcdir)/../reloc.c + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.tmp + $(srcdir)/../../move-if-change reloc.tmp reloc.texi + touch stamp-reloc +reloc.texi: stamp-reloc + +stamp-section: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.tmp + $(srcdir)/../../move-if-change section.tmp section.texi + touch stamp-section +section.texi: stamp-section + +stamp-syms: $(MKDOC) $(srcdir)/../syms.c + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.tmp + $(srcdir)/../../move-if-change syms.tmp syms.texi + touch stamp-syms +syms.texi: stamp-syms + +stamp-targets: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.tmp + $(srcdir)/../../move-if-change targets.tmp targets.texi + touch stamp-targets +targets.texi: stamp-targets + +stamp-init: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.tmp + $(srcdir)/../../move-if-change init.tmp init.texi + touch stamp-init +init.texi: stamp-init + +stamp-hash: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.tmp + $(srcdir)/../../move-if-change hash.tmp hash.texi + touch stamp-hash +hash.texi: stamp-hash + +stamp-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str + $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.tmp + $(srcdir)/../../move-if-change linker.tmp linker.texi + touch stamp-linker +linker.texi: stamp-linker libbfd.h: $(srcdir)/../libbfd-in.h \ $(srcdir)/../init.c \ @@ -253,10 +322,12 @@ rm -rf *.log *.ps *~* *.dvi *# $(MKDOC) *.o clean: mostlyclean - rm -rf $(STAGESTUFF) + rm -rf $(STAGESTUFF) stamp-* rm -f *.p *.ip bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log -distclean: clean +distclean: mostlyclean + rm -f *.p *.ip bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log + rm -f stamp-* rm -f Makefile config.status maintainer-clean realclean: clean diff -urN binutils-2.7/bfd/doc/aoutx.texi binutils-2.8/bfd/doc/aoutx.texi --- binutils-2.7/bfd/doc/aoutx.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/aoutx.texi Wed Apr 30 12:56:24 1997 @@ -0,0 +1,211 @@ +@section a.out backends + +@* +@strong{Description}@* +BFD supports a number of different flavours of a.out format, +though the major differences are only the sizes of the +structures on disk, and the shape of the relocation +information. + +The support is split into a basic support file @file{aoutx.h} +and other files which derive functions from the base. One +derivation file is @file{aoutf1.h} (for a.out flavour 1), and +adds to the basic a.out functions support for sun3, sun4, 386 +and 29k a.out files, to create a target jump vector for a +specific target. + +This information is further split out into more specific files +for each machine, including @file{sunos.c} for sun3 and sun4, +@file{newsos3.c} for the Sony NEWS, and @file{demo64.c} for a +demonstration of a 64 bit a.out format. + +The base file @file{aoutx.h} defines general mechanisms for +reading and writing records to and from disk and various +other methods which BFD requires. It is included by +@file{aout32.c} and @file{aout64.c} to form the names +@code{aout_32_swap_exec_header_in}, @code{aout_64_swap_exec_header_in}, etc. + +As an example, this is what goes on to make the back end for a +sun4, from @file{aout32.c}: + +@example + #define ARCH_SIZE 32 + #include "aoutx.h" +@end example + +Which exports names: + +@example + ... + aout_32_canonicalize_reloc + aout_32_find_nearest_line + aout_32_get_lineno + aout_32_get_reloc_upper_bound + ... +@end example + +from @file{sunos.c}: + +@example + #define TARGET_NAME "a.out-sunos-big" + #define VECNAME sunos_big_vec + #include "aoutf1.h" +@end example + +requires all the names from @file{aout32.c}, and produces the jump vector + +@example + sunos_big_vec +@end example + +The file @file{host-aout.c} is a special case. It is for a large set +of hosts that use ``more or less standard'' a.out files, and +for which cross-debugging is not interesting. It uses the +standard 32-bit a.out support routines, but determines the +file offsets and addresses of the text, data, and BSS +sections, the machine architecture and machine type, and the +entry point address, in a host-dependent manner. Once these +values have been determined, generic code is used to handle +the object file. + +When porting it to run on a new system, you must supply: + +@example + HOST_PAGE_SIZE + HOST_SEGMENT_SIZE + HOST_MACHINE_ARCH (optional) + HOST_MACHINE_MACHINE (optional) + HOST_TEXT_START_ADDR + HOST_STACK_END_ADDR +@end example + +in the file @file{../include/sys/h-@var{XXX}.h} (for your host). These +values, plus the structures and macros defined in @file{a.out.h} on +your host system, will produce a BFD target that will access +ordinary a.out files on your host. To configure a new machine +to use @file{host-aout.c}, specify: + +@example + TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec + TDEPFILES= host-aout.o trad-core.o +@end example + +in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in} +to use the +@file{@var{XXX}.mt} file (by setting "@code{bfd_target=XXX}") when your +configuration is selected. +@* +@subsection Relocations + +@* +@strong{Description}@* +The file @file{aoutx.h} provides for both the @emph{standard} +and @emph{extended} forms of a.out relocation records. + +The standard records contain only an +address, a symbol index, and a type field. The extended records +(used on 29ks and sparcs) also have a full integer for an +addend. +@* +@subsection Internal entry points + +@* +@strong{Description}@* +@file{aoutx.h} exports several routines for accessing the +contents of an a.out file, which are gathered and exported in +turn by various format specific files (eg sunos.c). +@* +@findex aout_@var{size}_swap_exec_header_in +@subsubsection @code{aout_@var{size}_swap_exec_header_in} +@strong{Synopsis} +@example +void aout_@var{size}_swap_exec_header_in, + (bfd *abfd, + struct external_exec *raw_bytes, + struct internal_exec *execp); +@end example +@strong{Description}@* +Swap the information in an executable header @var{raw_bytes} taken +from a raw byte stream memory image into the internal exec header +structure @var{execp}. +@* +@findex aout_@var{size}_swap_exec_header_out +@subsubsection @code{aout_@var{size}_swap_exec_header_out} +@strong{Synopsis} +@example +void aout_@var{size}_swap_exec_header_out + (bfd *abfd, + struct internal_exec *execp, + struct external_exec *raw_bytes); +@end example +@strong{Description}@* +Swap the information in an internal exec header structure +@var{execp} into the buffer @var{raw_bytes} ready for writing to disk. +@* +@findex aout_@var{size}_some_aout_object_p +@subsubsection @code{aout_@var{size}_some_aout_object_p} +@strong{Synopsis} +@example +const bfd_target *aout_@var{size}_some_aout_object_p + (bfd *abfd, + const bfd_target *(*callback_to_real_object_p)()); +@end example +@strong{Description}@* +Some a.out variant thinks that the file open in @var{abfd} +checking is an a.out file. Do some more checking, and set up +for access if it really is. Call back to the calling +environment's "finish up" function just before returning, to +handle any last-minute setup. +@* +@findex aout_@var{size}_mkobject +@subsubsection @code{aout_@var{size}_mkobject} +@strong{Synopsis} +@example +boolean aout_@var{size}_mkobject, (bfd *abfd); +@end example +@strong{Description}@* +Initialize BFD @var{abfd} for use with a.out files. +@* +@findex aout_@var{size}_machine_type +@subsubsection @code{aout_@var{size}_machine_type} +@strong{Synopsis} +@example +enum machine_type aout_@var{size}_machine_type + (enum bfd_architecture arch, + unsigned long machine)); + @end example +@strong{Description}@* +Keep track of machine architecture and machine type for +a.out's. Return the @code{machine_type} for a particular +architecture and machine, or @code{M_UNKNOWN} if that exact architecture +and machine can't be represented in a.out format. + +If the architecture is understood, machine type 0 (default) +is always understood. +@* +@findex aout_@var{size}_set_arch_mach +@subsubsection @code{aout_@var{size}_set_arch_mach} +@strong{Synopsis} +@example +boolean aout_@var{size}_set_arch_mach, + (bfd *, + enum bfd_architecture arch, + unsigned long machine)); + @end example +@strong{Description}@* +Set the architecture and the machine of the BFD @var{abfd} to the +values @var{arch} and @var{machine}. Verify that @var{abfd}'s format +can support the architecture required. +@* +@findex aout_@var{size}_new_section_hook +@subsubsection @code{aout_@var{size}_new_section_hook} +@strong{Synopsis} +@example +boolean aout_@var{size}_new_section_hook, + (bfd *abfd, + asection *newsect)); + @end example +@strong{Description}@* +Called by the BFD in response to a @code{bfd_make_section} +request. +@* diff -urN binutils-2.7/bfd/doc/archive.texi binutils-2.8/bfd/doc/archive.texi --- binutils-2.7/bfd/doc/archive.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/archive.texi Wed Apr 30 12:56:24 1997 @@ -0,0 +1,95 @@ +@section Archives + +@* +@strong{Description}@* +An archive (or library) is just another BFD. It has a symbol +table, although there's not much a user program will do with it. + +The big difference between an archive BFD and an ordinary BFD +is that the archive doesn't have sections. Instead it has a +chain of BFDs that are considered its contents. These BFDs can +be manipulated like any other. The BFDs contained in an +archive opened for reading will all be opened for reading. You +may put either input or output BFDs into an archive opened for +output; they will be handled correctly when the archive is closed. + +Use @code{bfd_openr_next_archived_file} to step through +the contents of an archive opened for input. You don't +have to read the entire archive if you don't want +to! Read it until you find what you want. + +Archive contents of output BFDs are chained through the +@code{next} pointer in a BFD. The first one is findable through +the @code{archive_head} slot of the archive. Set it with +@code{bfd_set_archive_head} (q.v.). A given BFD may be in only one +open output archive at a time. + +As expected, the BFD archive code is more general than the +archive code of any given environment. BFD archives may +contain files of different formats (e.g., a.out and coff) and +even different architectures. You may even place archives +recursively into archives! + +This can cause unexpected confusion, since some archive +formats are more expressive than others. For instance, Intel +COFF archives can preserve long filenames; SunOS a.out archives +cannot. If you move a file from the first to the second +format and back again, the filename may be truncated. +Likewise, different a.out environments have different +conventions as to how they truncate filenames, whether they +preserve directory names in filenames, etc. When +interoperating with native tools, be sure your files are +homogeneous. + +Beware: most of these formats do not react well to the +presence of spaces in filenames. We do the best we can, but +can't always handle this case due to restrictions in the format of +archives. Many Unix utilities are braindead in regards to +spaces and such in filenames anyway, so this shouldn't be much +of a restriction. + +Archives are supported in BFD in @code{archive.c}. +@* +@findex bfd_get_next_mapent +@subsubsection @code{bfd_get_next_mapent} +@strong{Synopsis} +@example +symindex bfd_get_next_mapent(bfd *abfd, symindex previous, carsym **sym); +@end example +@strong{Description}@* +Step through archive @var{abfd}'s symbol table (if it +has one). Successively update @var{sym} with the next symbol's +information, returning that symbol's (internal) index into the +symbol table. + +Supply @code{BFD_NO_MORE_SYMBOLS} as the @var{previous} entry to get +the first one; returns @code{BFD_NO_MORE_SYMBOLS} when you've already +got the last one. + +A @code{carsym} is a canonical archive symbol. The only +user-visible element is its name, a null-terminated string. +@* +@findex bfd_set_archive_head +@subsubsection @code{bfd_set_archive_head} +@strong{Synopsis} +@example +boolean bfd_set_archive_head(bfd *output, bfd *new_head); +@end example +@strong{Description}@* +Set the head of the chain of +BFDs contained in the archive @var{output} to @var{new_head}. +@* +@findex bfd_openr_next_archived_file +@subsubsection @code{bfd_openr_next_archived_file} +@strong{Synopsis} +@example +bfd *bfd_openr_next_archived_file(bfd *archive, bfd *previous); +@end example +@strong{Description}@* +Provided a BFD, @var{archive}, containing an archive and NULL, open +an input BFD on the first contained element and returns that. +Subsequent calls should pass +the archive and the previous return value to return a created +BFD to the next contained element. NULL is returned when there +are no more. +@* diff -urN binutils-2.7/bfd/doc/archures.texi binutils-2.8/bfd/doc/archures.texi --- binutils-2.7/bfd/doc/archures.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/archures.texi Wed Apr 30 12:56:25 1997 @@ -0,0 +1,307 @@ +@section Architectures +BFD keeps one atom in a BFD describing the +architecture of the data attached to the BFD: a pointer to a +@code{bfd_arch_info_type}. + +Pointers to structures can be requested independently of a BFD +so that an architecture's information can be interrogated +without access to an open BFD. + +The architecture information is provided by each architecture package. +The set of default architectures is selected by the macro +@code{SELECT_ARCHITECTURES}. This is normally set up in the +@file{config/@var{target}.mt} file of your choice. If the name is not +defined, then all the architectures supported are included. + +When BFD starts up, all the architectures are called with an +initialize method. It is up to the architecture back end to +insert as many items into the list of architectures as it wants to; +generally this would be one for each machine and one for the +default case (an item with a machine field of 0). + +BFD's idea of an architecture is implemented in @file{archures.c}. +@* +@subsection bfd_architecture + +@* +@strong{Description}@* +This enum gives the object file's CPU architecture, in a +global sense---i.e., what processor family does it belong to? +Another field indicates which processor within +the family is in use. The machine gives a number which +distinguishes different versions of the architecture, +containing, for example, 2 and 3 for Intel i960 KA and i960 KB, +and 68020 and 68030 for Motorola 68020 and 68030. +@example +enum bfd_architecture +@{ + bfd_arch_unknown, /* File arch not known */ + bfd_arch_obscure, /* Arch known, not one of these */ + bfd_arch_m68k, /* Motorola 68xxx */ + bfd_arch_vax, /* DEC Vax */ + bfd_arch_i960, /* Intel 960 */ + /* The order of the following is important. + lower number indicates a machine type that + only accepts a subset of the instructions + available to machines with higher numbers. + The exception is the "ca", which is + incompatible with all other machines except + "core". */ + +#define bfd_mach_i960_core 1 +#define bfd_mach_i960_ka_sa 2 +#define bfd_mach_i960_kb_sb 3 +#define bfd_mach_i960_mc 4 +#define bfd_mach_i960_xa 5 +#define bfd_mach_i960_ca 6 +#define bfd_mach_i960_jx 7 +#define bfd_mach_i960_hx 8 + + bfd_arch_a29k, /* AMD 29000 */ + bfd_arch_sparc, /* SPARC */ +#define bfd_mach_sparc 1 + /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */ +#define bfd_mach_sparc_sparclet 2 +#define bfd_mach_sparc_sparclite 3 +#define bfd_mach_sparc_v8plus 4 +#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns */ +#define bfd_mach_sparc_v9 6 +#define bfd_mach_sparc_v9a 7 /* with ultrasparc add'ns */ + /* Nonzero if MACH has the v9 instruction set. */ +#define bfd_mach_sparc_v9_p(mach) \ + ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a) + bfd_arch_mips, /* MIPS Rxxxx */ + bfd_arch_i386, /* Intel 386 */ +#define bfd_mach_i386_i386 0 +#define bfd_mach_i386_i8086 1 + bfd_arch_we32k, /* AT&T WE32xxx */ + bfd_arch_tahoe, /* CCI/Harris Tahoe */ + bfd_arch_i860, /* Intel 860 */ + bfd_arch_romp, /* IBM ROMP PC/RT */ + bfd_arch_alliant, /* Alliant */ + bfd_arch_convex, /* Convex */ + bfd_arch_m88k, /* Motorola 88xxx */ + bfd_arch_pyramid, /* Pyramid Technology */ + bfd_arch_h8300, /* Hitachi H8/300 */ +#define bfd_mach_h8300 1 +#define bfd_mach_h8300h 2 +#define bfd_mach_h8300s 3 + bfd_arch_powerpc, /* PowerPC */ + bfd_arch_rs6000, /* IBM RS/6000 */ + bfd_arch_hppa, /* HP PA RISC */ + bfd_arch_d10v, /* Mitsubishi D10V */ + bfd_arch_z8k, /* Zilog Z8000 */ +#define bfd_mach_z8001 1 +#define bfd_mach_z8002 2 + bfd_arch_h8500, /* Hitachi H8/500 */ + bfd_arch_sh, /* Hitachi SH */ + bfd_arch_alpha, /* Dec Alpha */ + bfd_arch_arm, /* Advanced Risc Machines ARM */ + bfd_arch_ns32k, /* National Semiconductors ns32000 */ + bfd_arch_w65, /* WDC 65816 */ + bfd_arch_m32r, /* Mitsubishi M32R/D */ + bfd_arch_mn10200, /* Matsushita MN10200 */ + bfd_arch_mn10300, /* Matsushita MN10300 */ + bfd_arch_last + @}; +@end example +@* +@subsection bfd_arch_info + +@* +@strong{Description}@* +This structure contains information on architectures for use +within BFD. +@example + +typedef struct bfd_arch_info +@{ + int bits_per_word; + int bits_per_address; + int bits_per_byte; + enum bfd_architecture arch; + unsigned long mach; + const char *arch_name; + const char *printable_name; + unsigned int section_align_power; + /* true if this is the default machine for the architecture */ + boolean the_default; + const struct bfd_arch_info * (*compatible) + PARAMS ((const struct bfd_arch_info *a, + const struct bfd_arch_info *b)); + + boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *)); + + const struct bfd_arch_info *next; +@} bfd_arch_info_type; +@end example +@* +@findex bfd_printable_name +@subsubsection @code{bfd_printable_name} +@strong{Synopsis} +@example +const char *bfd_printable_name(bfd *abfd); +@end example +@strong{Description}@* +Return a printable string representing the architecture and machine +from the pointer to the architecture info structure. +@* +@findex bfd_scan_arch +@subsubsection @code{bfd_scan_arch} +@strong{Synopsis} +@example +const bfd_arch_info_type *bfd_scan_arch(const char *string); +@end example +@strong{Description}@* +Figure out if BFD supports any cpu which could be described with +the name @var{string}. Return a pointer to an @code{arch_info} +structure if a machine is found, otherwise NULL. +@* +@findex bfd_arch_get_compatible +@subsubsection @code{bfd_arch_get_compatible} +@strong{Synopsis} +@example +const bfd_arch_info_type *bfd_arch_get_compatible( + const bfd *abfd, + const bfd *bbfd); +@end example +@strong{Description}@* +Determine whether two BFDs' +architectures and machine types are compatible. Calculates +the lowest common denominator between the two architectures +and machine types implied by the BFDs and returns a pointer to +an @code{arch_info} structure describing the compatible machine. +@* +@findex bfd_default_arch_struct +@subsubsection @code{bfd_default_arch_struct} +@strong{Description}@* +The @code{bfd_default_arch_struct} is an item of +@code{bfd_arch_info_type} which has been initialized to a fairly +generic state. A BFD starts life by pointing to this +structure, until the correct back end has determined the real +architecture of the file. +@example +extern const bfd_arch_info_type bfd_default_arch_struct; +@end example +@* +@findex bfd_set_arch_info +@subsubsection @code{bfd_set_arch_info} +@strong{Synopsis} +@example +void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg); +@end example +@strong{Description}@* +Set the architecture info of @var{abfd} to @var{arg}. +@* +@findex bfd_default_set_arch_mach +@subsubsection @code{bfd_default_set_arch_mach} +@strong{Synopsis} +@example +boolean bfd_default_set_arch_mach(bfd *abfd, + enum bfd_architecture arch, + unsigned long mach); +@end example +@strong{Description}@* +Set the architecture and machine type in BFD @var{abfd} +to @var{arch} and @var{mach}. Find the correct +pointer to a structure and insert it into the @code{arch_info} +pointer. +@* +@findex bfd_get_arch +@subsubsection @code{bfd_get_arch} +@strong{Synopsis} +@example +enum bfd_architecture bfd_get_arch(bfd *abfd); +@end example +@strong{Description}@* +Return the enumerated type which describes the BFD @var{abfd}'s +architecture. +@* +@findex bfd_get_mach +@subsubsection @code{bfd_get_mach} +@strong{Synopsis} +@example +unsigned long bfd_get_mach(bfd *abfd); +@end example +@strong{Description}@* +Return the long type which describes the BFD @var{abfd}'s +machine. +@* +@findex bfd_arch_bits_per_byte +@subsubsection @code{bfd_arch_bits_per_byte} +@strong{Synopsis} +@example +unsigned int bfd_arch_bits_per_byte(bfd *abfd); +@end example +@strong{Description}@* +Return the number of bits in one of the BFD @var{abfd}'s +architecture's bytes. +@* +@findex bfd_arch_bits_per_address +@subsubsection @code{bfd_arch_bits_per_address} +@strong{Synopsis} +@example +unsigned int bfd_arch_bits_per_address(bfd *abfd); +@end example +@strong{Description}@* +Return the number of bits in one of the BFD @var{abfd}'s +architecture's addresses. +@* +@findex bfd_default_compatible +@subsubsection @code{bfd_default_compatible} +@strong{Synopsis} +@example +const bfd_arch_info_type *bfd_default_compatible + (const bfd_arch_info_type *a, + const bfd_arch_info_type *b); +@end example +@strong{Description}@* +The default function for testing for compatibility. +@* +@findex bfd_default_scan +@subsubsection @code{bfd_default_scan} +@strong{Synopsis} +@example +boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string); +@end example +@strong{Description}@* +The default function for working out whether this is an +architecture hit and a machine hit. +@* +@findex bfd_get_arch_info +@subsubsection @code{bfd_get_arch_info} +@strong{Synopsis} +@example +const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd); +@end example +@strong{Description}@* +Return the architecture info struct in @var{abfd}. +@* +@findex bfd_lookup_arch +@subsubsection @code{bfd_lookup_arch} +@strong{Synopsis} +@example +const bfd_arch_info_type *bfd_lookup_arch + (enum bfd_architecture + arch, + unsigned long machine); +@end example +@strong{Description}@* +Look for the architecure info structure which matches the +arguments @var{arch} and @var{machine}. A machine of 0 matches the +machine/architecture structure which marks itself as the +default. +@* +@findex bfd_printable_arch_mach +@subsubsection @code{bfd_printable_arch_mach} +@strong{Synopsis} +@example +const char *bfd_printable_arch_mach + (enum bfd_architecture arch, unsigned long machine); +@end example +@strong{Description}@* +Return a printable string representing the architecture and +machine type. + +This routine is depreciated. +@* diff -urN binutils-2.7/bfd/doc/bfd.info binutils-2.8/bfd/doc/bfd.info --- binutils-2.7/bfd/doc/bfd.info Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/bfd.info Wed Apr 30 13:14:27 1997 @@ -0,0 +1,94 @@ +This is Info file bfd.info, produced by Makeinfo-1.64 from the input +file ./bfd.texinfo. + +START-INFO-DIR-ENTRY +* Bfd: (bfd). The Binary File Descriptor library. +END-INFO-DIR-ENTRY + + This file documents the BFD library. + + Copyright (C) 1991 Free Software Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, subject to the +terms of the GNU General Public License, which includes the provision +that the entire resulting derived work is distributed under the terms +of a permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions. + + +Indirect: +bfd.info-1: 936 +bfd.info-2: 50487 +bfd.info-3: 91356 +bfd.info-4: 139850 +bfd.info-5: 181537 + +Tag Table: +(Indirect) +Node: Top936 +Node: Overview1201 +Node: History2251 +Node: How It Works3192 +Node: What BFD Version 2 Can Do4733 +Node: BFD information loss6047 +Node: Canonical format8570 +Node: BFD front end12931 +Node: Memory Usage31295 +Node: Initialization32518 +Node: Sections32890 +Node: Section Input33365 +Node: Section Output34717 +Node: typedef asection37178 +Node: section prototypes50487 +Node: Symbols56231 +Node: Reading Symbols57818 +Node: Writing Symbols58898 +Node: Mini Symbols60458 +Node: typedef asymbol61419 +Node: symbol handling functions66065 +Node: Archives70069 +Node: Formats73671 +Node: Relocations76452 +Node: typedef arelent77168 +Node: howto manager91356 +Node: Core Files106226 +Node: Targets107231 +Node: bfd_target109189 +Node: Architectures126860 +Node: Opening and Closing136295 +Node: Internal139850 +Node: File Caching144788 +Node: Linker Functions147532 +Node: Creating a Linker Hash Table149195 +Node: Adding Symbols to the Hash Table150918 +Node: Differing file formats151804 +Node: Adding symbols from an object file153533 +Node: Adding symbols from an archive155665 +Node: Performing the Final Link158060 +Node: Information provided by the linker159288 +Node: Relocating the section contents160420 +Node: Writing the symbol table162153 +Node: Hash Tables164740 +Node: Creating and Freeing a Hash Table165928 +Node: Looking Up or Entering a String167080 +Node: Traversing a Hash Table168318 +Node: Deriving a New Hash Table Type169092 +Node: Define the Derived Structures170144 +Node: Write the Derived Creation Routine171206 +Node: Write Other Derived Routines173884 +Node: BFD back ends175180 +Node: What to Put Where175399 +Node: aout175537 +Node: coff181537 +Node: elf206935 +Node: Index207760 + +End Tag Table diff -urN binutils-2.7/bfd/doc/bfd.info-1 binutils-2.8/bfd/doc/bfd.info-1 --- binutils-2.7/bfd/doc/bfd.info-1 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/bfd.info-1 Wed Apr 30 13:14:26 1997 @@ -0,0 +1,1306 @@ +This is Info file bfd.info, produced by Makeinfo-1.64 from the input +file ./bfd.texinfo. + +START-INFO-DIR-ENTRY +* Bfd: (bfd). The Binary File Descriptor library. +END-INFO-DIR-ENTRY + + This file documents the BFD library. + + Copyright (C) 1991 Free Software Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, subject to the +terms of the GNU General Public License, which includes the provision +that the entire resulting derived work is distributed under the terms +of a permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions. + + +File: bfd.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir) + + This file documents the binary file descriptor library libbfd. + +* Menu: + +* Overview:: Overview of BFD +* BFD front end:: BFD front end +* BFD back ends:: BFD back ends +* Index:: Index + + +File: bfd.info, Node: Overview, Next: BFD front end, Prev: Top, Up: Top + +Introduction +************ + + BFD is a package which allows applications to use the same routines +to operate on object files whatever the object file format. A new +object file format can be supported simply by creating a new BFD back +end and adding it to the library. + + BFD is split into two parts: the front end, and the back ends (one +for each object file format). + * The front end of BFD provides the interface to the user. It manages + memory and various canonical data structures. The front end also + decides which back end to use and when to call back end routines. + + * The back ends provide BFD its view of the real world. Each back + end provides a set of calls which the BFD front end can use to + maintain its canonical form. The back ends also may keep around + information for their own use, for greater efficiency. + +* Menu: + +* History:: History +* How It Works:: How It Works +* What BFD Version 2 Can Do:: What BFD Version 2 Can Do + + +File: bfd.info, Node: History, Next: How It Works, Prev: Overview, Up: Overview + +History +======= + + One spur behind BFD was the desire, on the part of the GNU 960 team +at Intel Oregon, for interoperability of applications on their COFF and +b.out file formats. Cygnus was providing GNU support for the team, and +was contracted to provide the required functionality. + + The name came from a conversation David Wallace was having with +Richard Stallman about the library: RMS said that it would be quite +hard--David said "BFD". Stallman was right, but the name stuck. + + At the same time, Ready Systems wanted much the same thing, but for +different object file formats: IEEE-695, Oasys, Srecords, a.out and 68k +coff. + + BFD was first implemented by members of Cygnus Support; Steve +Chamberlain (`sac@cygnus.com'), John Gilmore (`gnu@cygnus.com'), K. +Richard Pixley (`rich@cygnus.com') and David Henkel-Wallace +(`gumby@cygnus.com'). + + +File: bfd.info, Node: How It Works, Next: What BFD Version 2 Can Do, Prev: History, Up: Overview + +How To Use BFD +============== + + To use the library, include `bfd.h' and link with `libbfd.a'. + + BFD provides a common interface to the parts of an object file for a +calling application. + + When an application sucessfully opens a target file (object, +archive, or whatever), a pointer to an internal structure is returned. +This pointer points to a structure called `bfd', described in `bfd.h'. +Our convention is to call this pointer a BFD, and instances of it +within code `abfd'. All operations on the target object file are +applied as methods to the BFD. The mapping is defined within `bfd.h' +in a set of macros, all beginning with `bfd_' to reduce namespace +pollution. + + For example, this sequence does what you would probably expect: +return the number of sections in an object file attached to a BFD +`abfd'. + + #include "bfd.h" + + unsigned int number_of_sections(abfd) + bfd *abfd; + { + return bfd_count_sections(abfd); + } + + The abstraction used within BFD is that an object file has: + + * a header, + + * a number of sections containing raw data (*note Sections::.), + + * a set of relocations (*note Relocations::.), and + + * some symbol information (*note Symbols::.). + +Also, BFDs opened for archives have the additional attribute of an index +and contain subordinate BFDs. This approach is fine for a.out and coff, +but loses efficiency when applied to formats such as S-records and +IEEE-695. + + +File: bfd.info, Node: What BFD Version 2 Can Do, Prev: How It Works, Up: Overview + +What BFD Version 2 Can Do +========================= + + When an object file is opened, BFD subroutines automatically +determine the format of the input object file. They then build a +descriptor in memory with pointers to routines that will be used to +access elements of the object file's data structures. + + As different information from the the object files is required, BFD +reads from different sections of the file and processes them. For +example, a very common operation for the linker is processing symbol +tables. Each BFD back end provides a routine for converting between +the object file's representation of symbols and an internal canonical +format. When the linker asks for the symbol table of an object file, it +calls through a memory pointer to the routine from the relevant BFD +back end which reads and converts the table into a canonical form. The +linker then operates upon the canonical form. When the link is finished +and the linker writes the output file's symbol table, another BFD back +end routine is called to take the newly created symbol table and +convert it into the chosen output format. + +* Menu: + +* BFD information loss:: Information Loss +* Canonical format:: The BFD canonical object-file format + + +File: bfd.info, Node: BFD information loss, Next: Canonical format, Up: What BFD Version 2 Can Do + +Information Loss +---------------- + + *Information can be lost during output.* The output formats +supported by BFD do not provide identical facilities, and information +which can be described in one form has nowhere to go in another format. +One example of this is alignment information in `b.out'. There is +nowhere in an `a.out' format file to store alignment information on the +contained data, so when a file is linked from `b.out' and an `a.out' +image is produced, alignment information will not propagate to the +output file. (The linker will still use the alignment information +internally, so the link is performed correctly). + + Another example is COFF section names. COFF files may contain an +unlimited number of sections, each one with a textual section name. If +the target of the link is a format which does not have many sections +(e.g., `a.out') or has sections without names (e.g., the Oasys format), +the link cannot be done simply. You can circumvent this problem by +describing the desired input-to-output section mapping with the linker +command language. + + *Information can be lost during canonicalization.* The BFD internal +canonical form of the external formats is not exhaustive; there are +structures in input formats for which there is no direct representation +internally. This means that the BFD back ends cannot maintain all +possible data richness through the transformation between external to +internal and back to external formats. + + This limitation is only a problem when an application reads one +format and writes another. Each BFD back end is responsible for +maintaining as much data as possible, and the internal BFD canonical +form has structures which are opaque to the BFD core, and exported only +to the back ends. When a file is read in one format, the canonical form +is generated for BFD and the application. At the same time, the back +end saves away any information which may otherwise be lost. If the data +is then written back in the same format, the back end routine will be +able to use the canonical form provided by the BFD core as well as the +information it prepared earlier. Since there is a great deal of +commonality between back ends, there is no information lost when +linking or copying big endian COFF to little endian COFF, or `a.out' to +`b.out'. When a mixture of formats is linked, the information is only +lost from the files whose format differs from the destination. + + +File: bfd.info, Node: Canonical format, Prev: BFD information loss, Up: What BFD Version 2 Can Do + +The BFD canonical object-file format +------------------------------------ + + The greatest potential for loss of information occurs when there is +the least overlap between the information provided by the source +format, that stored by the canonical format, and that needed by the +destination format. A brief description of the canonical form may help +you understand which kinds of data you can count on preserving across +conversions. + +*files* + Information stored on a per-file basis includes target machine + architecture, particular implementation format type, a demand + pageable bit, and a write protected bit. Information like Unix + magic numbers is not stored here--only the magic numbers' meaning, + so a `ZMAGIC' file would have both the demand pageable bit and the + write protected text bit set. The byte order of the target is + stored on a per-file basis, so that big- and little-endian object + files may be used with one another. + +*sections* + Each section in the input file contains the name of the section, + the section's original address in the object file, size and + alignment information, various flags, and pointers into other BFD + data structures. + +*symbols* + Each symbol contains a pointer to the information for the object + file which originally defined it, its name, its value, and various + flag bits. When a BFD back end reads in a symbol table, it + relocates all symbols to make them relative to the base of the + section where they were defined. Doing this ensures that each + symbol points to its containing section. Each symbol also has a + varying amount of hidden private data for the BFD back end. Since + the symbol points to the original file, the private data format + for that symbol is accessible. `ld' can operate on a collection + of symbols of wildly different formats without problems. + + Normal global and simple local symbols are maintained on output, + so an output file (no matter its format) will retain symbols + pointing to functions and to global, static, and common variables. + Some symbol information is not worth retaining; in `a.out', type + information is stored in the symbol table as long symbol names. + This information would be useless to most COFF debuggers; the + linker has command line switches to allow users to throw it away. + + There is one word of type information within the symbol, so if the + format supports symbol type information within symbols (for + example, COFF, IEEE, Oasys) and the type is simple enough to fit + within one word (nearly everything but aggregates), the + information will be preserved. + +*relocation level* + Each canonical BFD relocation record contains a pointer to the + symbol to relocate to, the offset of the data to relocate, the + section the data is in, and a pointer to a relocation type + descriptor. Relocation is performed by passing messages through + the relocation type descriptor and the symbol pointer. Therefore, + relocations can be performed on output data using a relocation + method that is only available in one of the input formats. For + instance, Oasys provides a byte relocation format. A relocation + record requesting this relocation type would point indirectly to a + routine to perform this, so the relocation may be performed on a + byte being written to a 68k COFF file, even though 68k COFF has no + such relocation type. + +*line numbers* + Object formats can contain, for debugging purposes, some form of + mapping between symbols, source line numbers, and addresses in the + output file. These addresses have to be relocated along with the + symbol information. Each symbol with an associated list of line + number records points to the first record of the list. The head + of a line number list consists of a pointer to the symbol, which + allows finding out the address of the function whose line number + is being described. The rest of the list is made up of pairs: + offsets into the section and line numbers. Any format which can + simply derive this information can pass it successfully between + formats (COFF, IEEE and Oasys). + + +File: bfd.info, Node: BFD front end, Next: BFD back ends, Prev: Overview, Up: Top + +BFD front end +************* + +`typedef bfd' +============= + + A BFD has type `bfd'; objects of this type are the cornerstone of +any application using BFD. Using BFD consists of making references +though the BFD and to data in the BFD. + + Here is the structure that defines the type `bfd'. It contains the +major data about the file and pointers to the rest of the data. +. + struct _bfd + { + /* The filename the application opened the BFD with. */ + CONST char *filename; + + /* A pointer to the target jump table. */ + const struct bfd_target *xvec; + + /* To avoid dragging too many header files into every file that + includes ``bfd.h'', IOSTREAM has been declared as a "char + *", and MTIME as a "long". Their correct types, to which they + are cast when used, are "FILE *" and "time_t". The iostream + is the result of an fopen on the filename. However, if the + BFD_IN_MEMORY flag is set, then iostream is actually a pointer + to a bfd_in_memory struct. */ + PTR iostream; + + /* Is the file descriptor being cached? That is, can it be closed as + needed, and re-opened when accessed later? */ + + boolean cacheable; + + /* Marks whether there was a default target specified when the + BFD was opened. This is used to select which matching algorithm + to use to choose the back end. */ + + boolean target_defaulted; + + /* The caching routines use these to maintain a + least-recently-used list of BFDs */ + + struct _bfd *lru_prev, *lru_next; + + /* When a file is closed by the caching routines, BFD retains + state information on the file here: */ + + file_ptr where; + + /* and here: (``once'' means at least once) */ + + boolean opened_once; + + /* Set if we have a locally maintained mtime value, rather than + getting it from the file each time: */ + + boolean mtime_set; + + /* File modified time, if mtime_set is true: */ + + long mtime; + + /* Reserved for an unimplemented file locking extension.*/ + + int ifd; + + /* The format which belongs to the BFD. (object, core, etc.) */ + + bfd_format format; + + /* The direction the BFD was opened with*/ + + enum bfd_direction {no_direction = 0, + read_direction = 1, + write_direction = 2, + both_direction = 3} direction; + + /* Format_specific flags*/ + + flagword flags; + + /* Currently my_archive is tested before adding origin to + anything. I believe that this can become always an add of + origin, with origin set to 0 for non archive files. */ + + file_ptr origin; + + /* Remember when output has begun, to stop strange things + from happening. */ + boolean output_has_begun; + + /* Pointer to linked list of sections*/ + struct sec *sections; + + /* The number of sections */ + unsigned int section_count; + + /* Stuff only useful for object files: + The start address. */ + bfd_vma start_address; + + /* Used for input and output*/ + unsigned int symcount; + + /* Symbol table for output BFD (with symcount entries) */ + struct symbol_cache_entry **outsymbols; + + /* Pointer to structure which contains architecture information*/ + const struct bfd_arch_info *arch_info; + + /* Stuff only useful for archives:*/ + PTR arelt_data; + struct _bfd *my_archive; /* The containing archive BFD. */ + struct _bfd *next; /* The next BFD in the archive. */ + struct _bfd *archive_head; /* The first BFD in the archive. */ + boolean has_armap; + + /* A chain of BFD structures involved in a link. */ + struct _bfd *link_next; + + /* A field used by _bfd_generic_link_add_archive_symbols. This will + be used only for archive elements. */ + int archive_pass; + + /* Used by the back end to hold private data. */ + + union + { + struct aout_data_struct *aout_data; + struct artdata *aout_ar_data; + struct _oasys_data *oasys_obj_data; + struct _oasys_ar_data *oasys_ar_data; + struct coff_tdata *coff_obj_data; + struct pe_tdata *pe_obj_data; + struct xcoff_tdata *xcoff_obj_data; + struct ecoff_tdata *ecoff_obj_data; + struct ieee_data_struct *ieee_data; + struct ieee_ar_data_struct *ieee_ar_data; + struct srec_data_struct *srec_data; + struct ihex_data_struct *ihex_data; + struct tekhex_data_struct *tekhex_data; + struct elf_obj_tdata *elf_obj_data; + struct nlm_obj_tdata *nlm_obj_data; + struct bout_data_struct *bout_data; + struct sun_core_struct *sun_core_data; + struct trad_core_struct *trad_core_data; + struct som_data_struct *som_data; + struct hpux_core_struct *hpux_core_data; + struct hppabsd_core_struct *hppabsd_core_data; + struct sgi_core_struct *sgi_core_data; + struct lynx_core_struct *lynx_core_data; + struct osf_core_struct *osf_core_data; + struct cisco_core_struct *cisco_core_data; + struct versados_data_struct *versados_data; + struct netbsd_core_struct *netbsd_core_data; + PTR any; + } tdata; + + /* Used by the application to hold private data*/ + PTR usrdata; + + /* Where all the allocated stuff under this BFD goes. This is a + struct objalloc *, but we use PTR to avoid requiring the inclusion of + objalloc.h. */ + PTR memory; + }; + +Error reporting +=============== + + Most BFD functions return nonzero on success (check their individual +documentation for precise semantics). On an error, they call +`bfd_set_error' to set an error condition that callers can check by +calling `bfd_get_error'. If that returns `bfd_error_system_call', then +check `errno'. + + The easiest way to report a BFD error to the user is to use +`bfd_perror'. +Type `bfd_error_type' +--------------------- + +The values returned by `bfd_get_error' are defined by the enumerated +type `bfd_error_type'. +. + typedef enum bfd_error + { + bfd_error_no_error = 0, + bfd_error_system_call, + bfd_error_invalid_target, + bfd_error_wrong_format, + bfd_error_invalid_operation, + bfd_error_no_memory, + bfd_error_no_symbols, + bfd_error_no_armap, + bfd_error_no_more_archived_files, + bfd_error_malformed_archive, + bfd_error_file_not_recognized, + bfd_error_file_ambiguously_recognized, + bfd_error_no_contents, + bfd_error_nonrepresentable_section, + bfd_error_no_debug_section, + bfd_error_bad_value, + bfd_error_file_truncated, + bfd_error_file_too_big, + bfd_error_invalid_error_code + } bfd_error_type; + +`bfd_get_error' +............... + + *Synopsis* + bfd_error_type bfd_get_error (void); + *Description* +Return the current BFD error condition. +`bfd_set_error' +............... + +*Synopsis* + void bfd_set_error (bfd_error_type error_tag); + *Description* +Set the BFD error condition to be ERROR_TAG. +`bfd_errmsg' +............ + +*Synopsis* + CONST char *bfd_errmsg (bfd_error_type error_tag); + *Description* +Return a string describing the error ERROR_TAG, or the system error if +ERROR_TAG is `bfd_error_system_call'. +`bfd_perror' +............ + +*Synopsis* + void bfd_perror (CONST char *message); + *Description* +Print to the standard error stream a string describing the last BFD +error that occurred, or the last system error if the last BFD error was +a system call failure. If MESSAGE is non-NULL and non-empty, the error +string printed is preceded by MESSAGE, a colon, and a space. It is +followed by a newline. +BFD error handler +----------------- + +Some BFD functions want to print messages describing the problem. They +call a BFD error handler function. This function may be overriden by +the program. + + The BFD error handler acts like printf. +. + typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...)); + +`bfd_set_error_handler' +....................... + + *Synopsis* + bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); + *Description* +Set the BFD error handler function. Returns the previous function. +`bfd_set_error_program_name' +............................ + +*Synopsis* + void bfd_set_error_program_name (const char *); + *Description* +Set the program name to use when printing a BFD error. This is printed +before the error message followed by a colon and space. The string +must not be changed after it is passed to this function. +Symbols +======= + +`bfd_get_reloc_upper_bound' +........................... + +*Synopsis* + long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect); + *Description* +Return the number of bytes required to store the relocation information +associated with section SECT attached to bfd ABFD. If an error occurs, +return -1. +`bfd_canonicalize_reloc' +........................ + +*Synopsis* + long bfd_canonicalize_reloc + (bfd *abfd, + asection *sec, + arelent **loc, + asymbol **syms); + *Description* +Call the back end associated with the open BFD ABFD and translate the +external form of the relocation information attached to SEC into the +internal canonical form. Place the table into memory at LOC, which has +been preallocated, usually by a call to `bfd_get_reloc_upper_bound'. +Returns the number of relocs, or -1 on error. + + The SYMS table is also needed for horrible internal magic reasons. +`bfd_set_reloc' +............... + +*Synopsis* + void bfd_set_reloc + (bfd *abfd, asection *sec, arelent **rel, unsigned int count) + *Description* +Set the relocation pointer and count within section SEC to the values +REL and COUNT. The argument ABFD is ignored. +`bfd_set_file_flags' +.................... + +*Synopsis* + boolean bfd_set_file_flags(bfd *abfd, flagword flags); + *Description* +Set the flag word in the BFD ABFD to the value FLAGS. + + Possible errors are: + * `bfd_error_wrong_format' - The target bfd was not of object format. + + * `bfd_error_invalid_operation' - The target bfd was open for + reading. + + * `bfd_error_invalid_operation' - The flag word contained a bit + which was not applicable to the type of file. E.g., an attempt + was made to set the `D_PAGED' bit on a BFD format which does not + support demand paging. +`bfd_set_start_address' +....................... + +*Synopsis* + boolean bfd_set_start_address(bfd *abfd, bfd_vma vma); + *Description* +Make VMA the entry point of output BFD ABFD. +*Returns* +Returns `true' on success, `false' otherwise. +`bfd_get_mtime' +............... + +*Synopsis* + long bfd_get_mtime(bfd *abfd); + *Description* +Return the file modification time (as read from the file system, or +from the archive header for archive members). +`bfd_get_size' +.............. + +*Synopsis* + long bfd_get_size(bfd *abfd); + *Description* +Return the file size (as read from file system) for the file associated +with BFD ABFD. + + The initial motivation for, and use of, this routine is not so we +can get the exact size of the object the BFD applies to, since that +might not be generally possible (archive members for example). It +would be ideal if someone could eventually modify it so that such +results were guaranteed. + + Instead, we want to ask questions like "is this NNN byte sized +object I'm about to try read from file offset YYY reasonable?" As as +example of where we might do this, some object formats use string +tables for which the first `sizeof(long)' bytes of the table contain +the size of the table itself, including the size bytes. If an +application tries to read what it thinks is one of these string tables, +without some way to validate the size, and for some reason the size is +wrong (byte swapping error, wrong location for the string table, etc.), +the only clue is likely to be a read error when it tries to read the +table, or a "virtual memory exhausted" error when it tries to allocate +15 bazillon bytes of space for the 15 bazillon byte table it is about +to read. This function at least allows us to answer the quesion, "is +the size reasonable?". +`bfd_get_gp_size' +................. + +*Synopsis* + int bfd_get_gp_size(bfd *abfd); + *Description* +Return the maximum size of objects to be optimized using the GP +register under MIPS ECOFF. This is typically set by the `-G' argument +to the compiler, assembler or linker. +`bfd_set_gp_size' +................. + +*Synopsis* + void bfd_set_gp_size(bfd *abfd, int i); + *Description* +Set the maximum size of objects to be optimized using the GP register +under ECOFF or MIPS ELF. This is typically set by the `-G' argument to +the compiler, assembler or linker. +`bfd_scan_vma' +.............. + +*Synopsis* + bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base); + *Description* +Convert, like `strtoul', a numerical expression STRING into a `bfd_vma' +integer, and return that integer. (Though without as many bells and +whistles as `strtoul'.) The expression is assumed to be unsigned (i.e., +positive). If given a BASE, it is used as the base for conversion. A +base of 0 causes the function to interpret the string in hex if a +leading "0x" or "0X" is found, otherwise in octal if a leading zero is +found, otherwise in decimal. + + Overflow is not detected. +`bfd_copy_private_bfd_data' +........................... + +*Synopsis* + boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd); + *Description* +Copy private BFD information from the BFD IBFD to the the BFD OBFD. +Return `true' on success, `false' on error. Possible error returns are: + + * `bfd_error_no_memory' - Not enough memory exists to create private + data for OBFD. + #define bfd_copy_private_bfd_data(ibfd, obfd) \ + BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ + (ibfd, obfd)) + +`bfd_merge_private_bfd_data' +............................ + +*Synopsis* + boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd); + *Description* +Merge private BFD information from the BFD IBFD to the the output file +BFD OBFD when linking. Return `true' on success, `false' on error. +Possible error returns are: + + * `bfd_error_no_memory' - Not enough memory exists to create private + data for OBFD. + #define bfd_merge_private_bfd_data(ibfd, obfd) \ + BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ + (ibfd, obfd)) + +`bfd_set_private_flags' +....................... + +*Synopsis* + boolean bfd_set_private_flags(bfd *abfd, flagword flags); + *Description* +Set private BFD flag information in the BFD ABFD. Return `true' on +success, `false' on error. Possible error returns are: + + * `bfd_error_no_memory' - Not enough memory exists to create private + data for OBFD. + #define bfd_set_private_flags(abfd, flags) \ + BFD_SEND (abfd, _bfd_set_private_flags, \ + (abfd, flags)) + +`stuff' +....... + +*Description* +Stuff which should be documented: + #define bfd_sizeof_headers(abfd, reloc) \ + BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) + + #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ + BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line)) + + /* Do these three do anything useful at all, for any back end? */ + #define bfd_debug_info_start(abfd) \ + BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) + + #define bfd_debug_info_end(abfd) \ + BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) + + #define bfd_debug_info_accumulate(abfd, section) \ + BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) + + + #define bfd_stat_arch_elt(abfd, stat) \ + BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) + + #define bfd_update_armap_timestamp(abfd) \ + BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) + + #define bfd_set_arch_mach(abfd, arch, mach)\ + BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) + + #define bfd_relax_section(abfd, section, link_info, again) \ + BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again)) + + #define bfd_link_hash_table_create(abfd) \ + BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) + + #define bfd_link_add_symbols(abfd, info) \ + BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) + + #define bfd_final_link(abfd, info) \ + BFD_SEND (abfd, _bfd_final_link, (abfd, info)) + + #define bfd_free_cached_info(abfd) \ + BFD_SEND (abfd, _bfd_free_cached_info, (abfd)) + + #define bfd_get_dynamic_symtab_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd)) + + #define bfd_print_private_bfd_data(abfd, file)\ + BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file)) + + #define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ + BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) + + #define bfd_get_dynamic_reloc_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) + + #define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \ + BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) + + extern bfd_byte *bfd_get_relocated_section_contents + PARAMS ((bfd *, struct bfd_link_info *, + struct bfd_link_order *, bfd_byte *, + boolean, asymbol **)); + +* Menu: + +* Memory Usage:: +* Initialization:: +* Sections:: +* Symbols:: +* Archives:: +* Formats:: +* Relocations:: +* Core Files:: +* Targets:: +* Architectures:: +* Opening and Closing:: +* Internal:: +* File Caching:: +* Linker Functions:: +* Hash Tables:: + + +File: bfd.info, Node: Memory Usage, Next: Initialization, Prev: BFD front end, Up: BFD front end + +Memory usage +============ + + BFD keeps all of its internal structures in obstacks. There is one +obstack per open BFD file, into which the current state is stored. When +a BFD is closed, the obstack is deleted, and so everything which has +been allocated by BFD for the closing file is thrown away. + + BFD does not free anything created by an application, but pointers +into `bfd' structures become invalid on a `bfd_close'; for example, +after a `bfd_close' the vector passed to `bfd_canonicalize_symtab' is +still around, since it has been allocated by the application, but the +data that it pointed to are lost. + + The general rule is to not close a BFD until all operations dependent +upon data from the BFD have been completed, or all the data from within +the file has been copied. To help with the management of memory, there +is a function (`bfd_alloc_size') which returns the number of bytes in +obstacks associated with the supplied BFD. This could be used to select +the greediest open BFD, close it to reclaim the memory, perform some +operation and reopen the BFD again, to get a fresh copy of the data +structures. + + +File: bfd.info, Node: Initialization, Next: Sections, Prev: Memory Usage, Up: BFD front end + +Initialization +============== + + These are the functions that handle initializing a BFD. +`bfd_init' +.......... + +*Synopsis* + void bfd_init(void); + *Description* +This routine must be called before any other BFD function to initialize +magical internal data structures. + +File: bfd.info, Node: Sections, Next: Symbols, Prev: Initialization, Up: BFD front end + +Sections +======== + +The raw data contained within a BFD is maintained through the section +abstraction. A single BFD may have any number of sections. It keeps +hold of them by pointing to the first; each one points to the next in +the list. + + Sections are supported in BFD in `section.c'. + +* Menu: + +* Section Input:: +* Section Output:: +* typedef asection:: +* section prototypes:: + + +File: bfd.info, Node: Section Input, Next: Section Output, Prev: Sections, Up: Sections + +Section input +------------- + +When a BFD is opened for reading, the section structures are created +and attached to the BFD. + + Each section has a name which describes the section in the outside +world--for example, `a.out' would contain at least three sections, +called `.text', `.data' and `.bss'. + + Names need not be unique; for example a COFF file may have several +sections named `.data'. + + Sometimes a BFD will contain more than the "natural" number of +sections. A back end may attach other sections containing constructor +data, or an application may add a section (using `bfd_make_section') to +the sections attached to an already open BFD. For example, the linker +creates an extra section `COMMON' for each input file's BFD to hold +information about common storage. + + The raw data is not necessarily read in when the section descriptor +is created. Some targets may leave the data in place until a +`bfd_get_section_contents' call is made. Other back ends may read in +all the data at once. For example, an S-record file has to be read +once to determine the size of the data. An IEEE-695 file doesn't +contain raw data in sections, but data and relocation expressions +intermixed, so the data area has to be parsed to get out the data and +relocations. + +File: bfd.info, Node: Section Output, Next: typedef asection, Prev: Section Input, Up: Sections + +Section output +-------------- + +To write a new object style BFD, the various sections to be written +have to be created. They are attached to the BFD in the same way as +input sections; data is written to the sections using +`bfd_set_section_contents'. + + Any program that creates or combines sections (e.g., the assembler +and linker) must use the `asection' fields `output_section' and +`output_offset' to indicate the file sections to which each section +must be written. (If the section is being created from scratch, +`output_section' should probably point to the section itself and +`output_offset' should probably be zero.) + + The data to be written comes from input sections attached (via +`output_section' pointers) to the output sections. The output section +structure can be considered a filter for the input section: the output +section determines the vma of the output data and the name, but the +input section determines the offset into the output section of the data +to be written. + + E.g., to create a section "O", starting at 0x100, 0x123 long, +containing two subsections, "A" at offset 0x0 (i.e., at vma 0x100) and +"B" at offset 0x20 (i.e., at vma 0x120) the `asection' structures would +look like: + + section name "A" + output_offset 0x00 + size 0x20 + output_section -----------> section name "O" + | vma 0x100 + section name "B" | size 0x123 + output_offset 0x20 | + size 0x103 | + output_section --------| + +Link orders +----------- + +The data within a section is stored in a "link_order". These are much +like the fixups in `gas'. The link_order abstraction allows a section +to grow and shrink within itself. + + A link_order knows how big it is, and which is the next link_order +and where the raw data for it is; it also points to a list of +relocations which apply to it. + + The link_order is used by the linker to perform relaxing on final +code. The compiler creates code which is as big as necessary to make +it work without relaxing, and the user can select whether to relax. +Sometimes relaxing takes a lot of time. The linker runs around the +relocations to see if any are attached to data which can be shrunk, if +so it does it on a link_order by link_order basis. + +File: bfd.info, Node: typedef asection, Next: section prototypes, Prev: Section Output, Up: Sections + +typedef asection +---------------- + +Here is the section structure: +. + typedef struct sec + { + /* The name of the section; the name isn't a copy, the pointer is + the same as that passed to bfd_make_section. */ + + CONST char *name; + + /* Which section is it; 0..nth. */ + + int index; + + /* The next section in the list belonging to the BFD, or NULL. */ + + struct sec *next; + + /* The field flags contains attributes of the section. Some + flags are read in from the object file, and some are + synthesized from other information. */ + + flagword flags; + + #define SEC_NO_FLAGS 0x000 + + /* Tells the OS to allocate space for this section when loading. + This is clear for a section containing debug information + only. */ + #define SEC_ALLOC 0x001 + + /* Tells the OS to load the section from the file when loading. + This is clear for a .bss section. */ + #define SEC_LOAD 0x002 + + /* The section contains data still to be relocated, so there is + some relocation information too. */ + #define SEC_RELOC 0x004 + + #if 0 /* Obsolete ? */ + #define SEC_BALIGN 0x008 + #endif + + /* A signal to the OS that the section contains read only + data. */ + #define SEC_READONLY 0x010 + + /* The section contains code only. */ + #define SEC_CODE 0x020 + + /* The section contains data only. */ + #define SEC_DATA 0x040 + + /* The section will reside in ROM. */ + #define SEC_ROM 0x080 + + /* The section contains constructor information. This section + type is used by the linker to create lists of constructors and + destructors used by `g++'. When a back end sees a symbol + which should be used in a constructor list, it creates a new + section for the type of name (e.g., `__CTOR_LIST__'), attaches + the symbol to it, and builds a relocation. To build the lists + of constructors, all the linker has to do is catenate all the + sections called `__CTOR_LIST__' and relocate the data + contained within - exactly the operations it would peform on + standard data. */ + #define SEC_CONSTRUCTOR 0x100 + + /* The section is a constuctor, and should be placed at the + end of the text, data, or bss section(?). */ + #define SEC_CONSTRUCTOR_TEXT 0x1100 + #define SEC_CONSTRUCTOR_DATA 0x2100 + #define SEC_CONSTRUCTOR_BSS 0x3100 + + /* The section has contents - a data section could be + `SEC_ALLOC' | `SEC_HAS_CONTENTS'; a debug section could be + `SEC_HAS_CONTENTS' */ + #define SEC_HAS_CONTENTS 0x200 + + /* An instruction to the linker to not output the section + even if it has information which would normally be written. */ + #define SEC_NEVER_LOAD 0x400 + + /* The section is a COFF shared library section. This flag is + only for the linker. If this type of section appears in + the input file, the linker must copy it to the output file + without changing the vma or size. FIXME: Although this + was originally intended to be general, it really is COFF + specific (and the flag was renamed to indicate this). It + might be cleaner to have some more general mechanism to + allow the back end to control what the linker does with + sections. */ + #define SEC_COFF_SHARED_LIBRARY 0x800 + + /* The section contains common symbols (symbols may be defined + multiple times, the value of a symbol is the amount of + space it requires, and the largest symbol value is the one + used). Most targets have exactly one of these (which we + translate to bfd_com_section_ptr), but ECOFF has two. */ + #define SEC_IS_COMMON 0x8000 + + /* The section contains only debugging information. For + example, this is set for ELF .debug and .stab sections. + strip tests this flag to see if a section can be + discarded. */ + #define SEC_DEBUGGING 0x10000 + + /* The contents of this section are held in memory pointed to + by the contents field. This is checked by + bfd_get_section_contents, and the data is retrieved from + memory if appropriate. */ + #define SEC_IN_MEMORY 0x20000 + + /* The contents of this section are to be excluded by the + linker for executable and shared objects unless those + objects are to be further relocated. */ + #define SEC_EXCLUDE 0x40000 + + /* The contents of this section are to be sorted by the + based on the address specified in the associated symbol + table. */ + #define SEC_SORT_ENTRIES 0x80000 + + /* When linking, duplicate sections of the same name should be + discarded, rather than being combined into a single section as + is usually done. This is similar to how common symbols are + handled. See SEC_LINK_DUPLICATES below. */ + #define SEC_LINK_ONCE 0x100000 + + /* If SEC_LINK_ONCE is set, this bitfield describes how the linker + should handle duplicate sections. */ + #define SEC_LINK_DUPLICATES 0x600000 + + /* This value for SEC_LINK_DUPLICATES means that duplicate + sections with the same name should simply be discarded. */ + #define SEC_LINK_DUPLICATES_DISCARD 0x0 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if there are any duplicate sections, although + it should still only link one copy. */ + #define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections are a different size. */ + #define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections contain different + contents. */ + #define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000 + + /* This section was created by the linker as part of dynamic + relocation or other arcane processing. It is skipped when + going through the first-pass output, trusting that someone + else up the line will take care of it later. */ + #define SEC_LINKER_CREATED 0x800000 + + /* End of section flags. */ + + /* Some internal packed boolean fields. */ + + /* See the vma field. */ + unsigned int user_set_vma : 1; + + /* Whether relocations have been processed. */ + unsigned int reloc_done : 1; + + /* A mark flag used by some of the linker backends. */ + unsigned int linker_mark : 1; + + /* End of internal packed boolean fields. */ + + /* The virtual memory address of the section - where it will be + at run time. The symbols are relocated against this. The + user_set_vma flag is maintained by bfd; if it's not set, the + backend can assign addresses (for example, in `a.out', where + the default address for `.data' is dependent on the specific + target and various flags). */ + + bfd_vma vma; + + /* The load address of the section - where it would be in a + rom image; really only used for writing section header + information. */ + + bfd_vma lma; + + /* The size of the section in bytes, as it will be output. + contains a value even if the section has no contents (e.g., the + size of `.bss'). This will be filled in after relocation */ + + bfd_size_type _cooked_size; + + /* The original size on disk of the section, in bytes. Normally this + value is the same as the size, but if some relaxing has + been done, then this value will be bigger. */ + + bfd_size_type _raw_size; + + /* If this section is going to be output, then this value is the + offset into the output section of the first byte in the input + section. E.g., if this was going to start at the 100th byte in + the output section, this value would be 100. */ + + bfd_vma output_offset; + + /* The output section through which to map on output. */ + + struct sec *output_section; + + /* The alignment requirement of the section, as an exponent of 2 - + e.g., 3 aligns to 2^3 (or 8). */ + + unsigned int alignment_power; + + /* If an input section, a pointer to a vector of relocation + records for the data in this section. */ + + struct reloc_cache_entry *relocation; + + /* If an output section, a pointer to a vector of pointers to + relocation records for the data in this section. */ + + struct reloc_cache_entry **orelocation; + + /* The number of relocation records in one of the above */ + + unsigned reloc_count; + + /* Information below is back end specific - and not always used + or updated. */ + + /* File position of section data */ + + file_ptr filepos; + + /* File position of relocation info */ + + file_ptr rel_filepos; + + /* File position of line data */ + + file_ptr line_filepos; + + /* Pointer to data for applications */ + + PTR userdata; + + /* If the SEC_IN_MEMORY flag is set, this points to the actual + contents. */ + unsigned char *contents; + + /* Attached line number information */ + + alent *lineno; + + /* Number of line number records */ + + unsigned int lineno_count; + + /* When a section is being output, this value changes as more + linenumbers are written out */ + + file_ptr moving_line_filepos; + + /* What the section number is in the target world */ + + int target_index; + + PTR used_by_bfd; + + /* If this is a constructor section then here is a list of the + relocations created to relocate items within it. */ + + struct relent_chain *constructor_chain; + + /* The BFD which owns the section. */ + + bfd *owner; + + /* A symbol which points at this section only */ + struct symbol_cache_entry *symbol; + struct symbol_cache_entry **symbol_ptr_ptr; + + struct bfd_link_order *link_order_head; + struct bfd_link_order *link_order_tail; + } asection ; + + /* These sections are global, and are managed by BFD. The application + and target back end are not permitted to change the values in + these sections. New code should use the section_ptr macros rather + than referring directly to the const sections. The const sections + may eventually vanish. */ + #define BFD_ABS_SECTION_NAME "*ABS*" + #define BFD_UND_SECTION_NAME "*UND*" + #define BFD_COM_SECTION_NAME "*COM*" + #define BFD_IND_SECTION_NAME "*IND*" + + /* the absolute section */ + extern const asection bfd_abs_section; + #define bfd_abs_section_ptr ((asection *) &bfd_abs_section) + #define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) + /* Pointer to the undefined section */ + extern const asection bfd_und_section; + #define bfd_und_section_ptr ((asection *) &bfd_und_section) + #define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) + /* Pointer to the common section */ + extern const asection bfd_com_section; + #define bfd_com_section_ptr ((asection *) &bfd_com_section) + /* Pointer to the indirect section */ + extern const asection bfd_ind_section; + #define bfd_ind_section_ptr ((asection *) &bfd_ind_section) + #define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr) + + extern const struct symbol_cache_entry * const bfd_abs_symbol; + extern const struct symbol_cache_entry * const bfd_com_symbol; + extern const struct symbol_cache_entry * const bfd_und_symbol; + extern const struct symbol_cache_entry * const bfd_ind_symbol; + #define bfd_get_section_size_before_reloc(section) \ + (section->reloc_done ? (abort(),1): (section)->_raw_size) + #define bfd_get_section_size_after_reloc(section) \ + ((section->reloc_done) ? (section)->_cooked_size: (abort(),1)) + diff -urN binutils-2.7/bfd/doc/bfd.info-2 binutils-2.8/bfd/doc/bfd.info-2 --- binutils-2.7/bfd/doc/bfd.info-2 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/bfd.info-2 Wed Apr 30 13:14:26 1997 @@ -0,0 +1,1121 @@ +This is Info file bfd.info, produced by Makeinfo-1.64 from the input +file ./bfd.texinfo. + +START-INFO-DIR-ENTRY +* Bfd: (bfd). The Binary File Descriptor library. +END-INFO-DIR-ENTRY + + This file documents the BFD library. + + Copyright (C) 1991 Free Software Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, subject to the +terms of the GNU General Public License, which includes the provision +that the entire resulting derived work is distributed under the terms +of a permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions. + + +File: bfd.info, Node: section prototypes, Prev: typedef asection, Up: Sections + +Section prototypes +------------------ + + These are the functions exported by the section handling part of BFD. +`bfd_get_section_by_name' +......................... + +*Synopsis* + asection *bfd_get_section_by_name(bfd *abfd, CONST char *name); + *Description* +Run through ABFD and return the one of the `asection's whose name +matches NAME, otherwise `NULL'. *Note Sections::, for more information. + + This should only be used in special cases; the normal way to process +all sections of a given name is to use `bfd_map_over_sections' and +`strcmp' on the name (or better yet, base it on the section flags or +something else) for each section. +`bfd_make_section_old_way' +.......................... + +*Synopsis* + asection *bfd_make_section_old_way(bfd *abfd, CONST char *name); + *Description* +Create a new empty section called NAME and attach it to the end of the +chain of sections for the BFD ABFD. An attempt to create a section with +a name which is already in use returns its pointer without changing the +section chain. + + It has the funny name since this is the way it used to be before it +was rewritten.... + + Possible errors are: + * `bfd_error_invalid_operation' - If output has already started for + this BFD. + + * `bfd_error_no_memory' - If memory allocation fails. +`bfd_make_section_anyway' +......................... + +*Synopsis* + asection *bfd_make_section_anyway(bfd *abfd, CONST char *name); + *Description* +Create a new empty section called NAME and attach it to the end of the +chain of sections for ABFD. Create a new section even if there is +already a section with that name. + + Return `NULL' and set `bfd_error' on error; possible errors are: + * `bfd_error_invalid_operation' - If output has already started for + ABFD. + + * `bfd_error_no_memory' - If memory allocation fails. +`bfd_make_section' +.................. + +*Synopsis* + asection *bfd_make_section(bfd *, CONST char *name); + *Description* +Like `bfd_make_section_anyway', but return `NULL' (without calling +bfd_set_error ()) without changing the section chain if there is +already a section named NAME. If there is an error, return `NULL' and +set `bfd_error'. +`bfd_set_section_flags' +....................... + +*Synopsis* + boolean bfd_set_section_flags(bfd *abfd, asection *sec, flagword flags); + *Description* +Set the attributes of the section SEC in the BFD ABFD to the value +FLAGS. Return `true' on success, `false' on error. Possible error +returns are: + + * `bfd_error_invalid_operation' - The section cannot have one or + more of the attributes requested. For example, a .bss section in + `a.out' may not have the `SEC_HAS_CONTENTS' field set. +`bfd_map_over_sections' +....................... + +*Synopsis* + void bfd_map_over_sections(bfd *abfd, + void (*func)(bfd *abfd, + asection *sect, + PTR obj), + PTR obj); + *Description* +Call the provided function FUNC for each section attached to the BFD +ABFD, passing OBJ as an argument. The function will be called as if by + + func(abfd, the_section, obj); + + This is the prefered method for iterating over sections; an +alternative would be to use a loop: + + section *p; + for (p = abfd->sections; p != NULL; p = p->next) + func(abfd, p, ...) + +`bfd_set_section_size' +...................... + +*Synopsis* + boolean bfd_set_section_size(bfd *abfd, asection *sec, bfd_size_type val); + *Description* +Set SEC to the size VAL. If the operation is ok, then `true' is +returned, else `false'. + + Possible error returns: + * `bfd_error_invalid_operation' - Writing has started to the BFD, so + setting the size is invalid. +`bfd_set_section_contents' +.......................... + +*Synopsis* + boolean bfd_set_section_contents + (bfd *abfd, + asection *section, + PTR data, + file_ptr offset, + bfd_size_type count); + *Description* +Sets the contents of the section SECTION in BFD ABFD to the data +starting in memory at DATA. The data is written to the output section +starting at offset OFFSET for COUNT bytes. + + Normally `true' is returned, else `false'. Possible error returns +are: + * `bfd_error_no_contents' - The output section does not have the + `SEC_HAS_CONTENTS' attribute, so nothing can be written to it. + + * and some more too This routine is front end to the back end +function `_bfd_set_section_contents'. +`bfd_get_section_contents' +.......................... + +*Synopsis* + boolean bfd_get_section_contents + (bfd *abfd, asection *section, PTR location, + file_ptr offset, bfd_size_type count); + *Description* +Read data from SECTION in BFD ABFD into memory starting at LOCATION. +The data is read at an offset of OFFSET from the start of the input +section, and is read for COUNT bytes. + + If the contents of a constructor with the `SEC_CONSTRUCTOR' flag set +are requested or if the section does not have the `SEC_HAS_CONTENTS' +flag set, then the LOCATION is filled with zeroes. If no errors occur, +`true' is returned, else `false'. +`bfd_copy_private_section_data' +............................... + +*Synopsis* + boolean bfd_copy_private_section_data(bfd *ibfd, asection *isec, bfd *obfd, asection *osec); + *Description* +Copy private section information from ISEC in the BFD IBFD to the +section OSEC in the BFD OBFD. Return `true' on success, `false' on +error. Possible error returns are: + + * `bfd_error_no_memory' - Not enough memory exists to create private + data for OSEC. + #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ + BFD_SEND (obfd, _bfd_copy_private_section_data, \ + (ibfd, isection, obfd, osection)) + + +File: bfd.info, Node: Symbols, Next: Archives, Prev: Sections, Up: BFD front end + +Symbols +======= + +BFD tries to maintain as much symbol information as it can when it +moves information from file to file. BFD passes information to +applications though the `asymbol' structure. When the application +requests the symbol table, BFD reads the table in the native form and +translates parts of it into the internal format. To maintain more than +the information passed to applications, some targets keep some +information "behind the scenes" in a structure only the particular back +end knows about. For example, the coff back end keeps the original +symbol table structure as well as the canonical structure when a BFD is +read in. On output, the coff back end can reconstruct the output symbol +table so that no information is lost, even information unique to coff +which BFD doesn't know or understand. If a coff symbol table were read, +but were written through an a.out back end, all the coff specific +information would be lost. The symbol table of a BFD is not necessarily +read in until a canonicalize request is made. Then the BFD back end +fills in a table provided by the application with pointers to the +canonical information. To output symbols, the application provides BFD +with a table of pointers to pointers to `asymbol's. This allows +applications like the linker to output a symbol as it was read, since +the "behind the scenes" information will be still available. + +* Menu: + +* Reading Symbols:: +* Writing Symbols:: +* Mini Symbols:: +* typedef asymbol:: +* symbol handling functions:: + + +File: bfd.info, Node: Reading Symbols, Next: Writing Symbols, Prev: Symbols, Up: Symbols + +Reading symbols +--------------- + +There are two stages to reading a symbol table from a BFD: allocating +storage, and the actual reading process. This is an excerpt from an +application which reads the symbol table: + + long storage_needed; + asymbol **symbol_table; + long number_of_symbols; + long i; + + storage_needed = bfd_get_symtab_upper_bound (abfd); + + if (storage_needed < 0) + FAIL + + if (storage_needed == 0) { + return ; + } + symbol_table = (asymbol **) xmalloc (storage_needed); + ... + number_of_symbols = + bfd_canonicalize_symtab (abfd, symbol_table); + + if (number_of_symbols < 0) + FAIL + + for (i = 0; i < number_of_symbols; i++) { + process_symbol (symbol_table[i]); + } + + All storage for the symbols themselves is in an objalloc connected +to the BFD; it is freed when the BFD is closed. + +File: bfd.info, Node: Writing Symbols, Next: Mini Symbols, Prev: Reading Symbols, Up: Symbols + +Writing symbols +--------------- + +Writing of a symbol table is automatic when a BFD open for writing is +closed. The application attaches a vector of pointers to pointers to +symbols to the BFD being written, and fills in the symbol count. The +close and cleanup code reads through the table provided and performs +all the necessary operations. The BFD output code must always be +provided with an "owned" symbol: one which has come from another BFD, +or one which has been created using `bfd_make_empty_symbol'. Here is an +example showing the creation of a symbol table with only one element: + + #include "bfd.h" + main() + { + bfd *abfd; + asymbol *ptrs[2]; + asymbol *new; + + abfd = bfd_openw("foo","a.out-sunos-big"); + bfd_set_format(abfd, bfd_object); + new = bfd_make_empty_symbol(abfd); + new->name = "dummy_symbol"; + new->section = bfd_make_section_old_way(abfd, ".text"); + new->flags = BSF_GLOBAL; + new->value = 0x12345; + + ptrs[0] = new; + ptrs[1] = (asymbol *)0; + + bfd_set_symtab(abfd, ptrs, 1); + bfd_close(abfd); + } + + ./makesym + nm foo + 00012345 A dummy_symbol + + Many formats cannot represent arbitary symbol information; for +instance, the `a.out' object format does not allow an arbitary number +of sections. A symbol pointing to a section which is not one of +`.text', `.data' or `.bss' cannot be described. + +File: bfd.info, Node: Mini Symbols, Next: typedef asymbol, Prev: Writing Symbols, Up: Symbols + +Mini Symbols +------------ + +Mini symbols provide read-only access to the symbol table. They use +less memory space, but require more time to access. They can be useful +for tools like nm or objdump, which may have to handle symbol tables of +extremely large executables. + + The `bfd_read_minisymbols' function will read the symbols into +memory in an internal form. It will return a `void *' pointer to a +block of memory, a symbol count, and the size of each symbol. The +pointer is allocated using `malloc', and should be freed by the caller +when it is no longer needed. + + The function `bfd_minisymbol_to_symbol' will take a pointer to a +minisymbol, and a pointer to a structure returned by +`bfd_make_empty_symbol', and return a `asymbol' structure. The return +value may or may not be the same as the value from +`bfd_make_empty_symbol' which was passed in. + +File: bfd.info, Node: typedef asymbol, Next: symbol handling functions, Prev: Mini Symbols, Up: Symbols + +typedef asymbol +--------------- + +An `asymbol' has the form: +. + typedef struct symbol_cache_entry + { + /* A pointer to the BFD which owns the symbol. This information + is necessary so that a back end can work out what additional + information (invisible to the application writer) is carried + with the symbol. + + This field is *almost* redundant, since you can use section->owner + instead, except that some symbols point to the global sections + bfd_{abs,com,und}_section. This could be fixed by making + these globals be per-bfd (or per-target-flavor). FIXME. */ + + struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */ + + /* The text of the symbol. The name is left alone, and not copied; the + application may not alter it. */ + CONST char *name; + + /* The value of the symbol. This really should be a union of a + numeric value with a pointer, since some flags indicate that + a pointer to another symbol is stored here. */ + symvalue value; + + /* Attributes of a symbol: */ + + #define BSF_NO_FLAGS 0x00 + + /* The symbol has local scope; `static' in `C'. The value + is the offset into the section of the data. */ + #define BSF_LOCAL 0x01 + + /* The symbol has global scope; initialized data in `C'. The + value is the offset into the section of the data. */ + #define BSF_GLOBAL 0x02 + + /* The symbol has global scope and is exported. The value is + the offset into the section of the data. */ + #define BSF_EXPORT BSF_GLOBAL /* no real difference */ + + /* A normal C symbol would be one of: + `BSF_LOCAL', `BSF_FORT_COMM', `BSF_UNDEFINED' or + `BSF_GLOBAL' */ + + /* The symbol is a debugging record. The value has an arbitary + meaning. */ + #define BSF_DEBUGGING 0x08 + + /* The symbol denotes a function entry point. Used in ELF, + perhaps others someday. */ + #define BSF_FUNCTION 0x10 + + /* Used by the linker. */ + #define BSF_KEEP 0x20 + #define BSF_KEEP_G 0x40 + + /* A weak global symbol, overridable without warnings by + a regular global symbol of the same name. */ + #define BSF_WEAK 0x80 + + /* This symbol was created to point to a section, e.g. ELF's + STT_SECTION symbols. */ + #define BSF_SECTION_SYM 0x100 + + /* The symbol used to be a common symbol, but now it is + allocated. */ + #define BSF_OLD_COMMON 0x200 + + /* The default value for common data. */ + #define BFD_FORT_COMM_DEFAULT_VALUE 0 + + /* In some files the type of a symbol sometimes alters its + location in an output file - ie in coff a `ISFCN' symbol + which is also `C_EXT' symbol appears where it was + declared and not at the end of a section. This bit is set + by the target BFD part to convey this information. */ + + #define BSF_NOT_AT_END 0x400 + + /* Signal that the symbol is the label of constructor section. */ + #define BSF_CONSTRUCTOR 0x800 + + /* Signal that the symbol is a warning symbol. The name is a + warning. The name of the next symbol is the one to warn about; + if a reference is made to a symbol with the same name as the next + symbol, a warning is issued by the linker. */ + #define BSF_WARNING 0x1000 + + /* Signal that the symbol is indirect. This symbol is an indirect + pointer to the symbol with the same name as the next symbol. */ + #define BSF_INDIRECT 0x2000 + + /* BSF_FILE marks symbols that contain a file name. This is used + for ELF STT_FILE symbols. */ + #define BSF_FILE 0x4000 + + /* Symbol is from dynamic linking information. */ + #define BSF_DYNAMIC 0x8000 + + /* The symbol denotes a data object. Used in ELF, and perhaps + others someday. */ + #define BSF_OBJECT 0x10000 + + flagword flags; + + /* A pointer to the section to which this symbol is + relative. This will always be non NULL, there are special + sections for undefined and absolute symbols. */ + struct sec *section; + + /* Back end special data. */ + union + { + PTR p; + bfd_vma i; + } udata; + + } asymbol; + + +File: bfd.info, Node: symbol handling functions, Prev: typedef asymbol, Up: Symbols + +Symbol handling functions +------------------------- + +`bfd_get_symtab_upper_bound' +............................ + +*Description* +Return the number of bytes required to store a vector of pointers to +`asymbols' for all the symbols in the BFD ABFD, including a terminal +NULL pointer. If there are no symbols in the BFD, then return 0. If an +error occurs, return -1. + #define bfd_get_symtab_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd)) + +`bfd_is_local_label' +.................... + +*Synopsis* + boolean bfd_is_local_label(bfd *abfd, asymbol *sym); + *Description* +Return true if the given symbol SYM in the BFD ABFD is a compiler +generated local label, else return false. +`bfd_is_local_label_name' +......................... + +*Synopsis* + boolean bfd_is_local_label_name(bfd *abfd, const char *name); + *Description* +Return true if a symbol with the name NAME in the BFD ABFD is a +compiler generated local label, else return false. This just checks +whether the name has the form of a local label. + #define bfd_is_local_label_name(abfd, name) \ + BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) + +`bfd_canonicalize_symtab' +......................... + +*Description* +Read the symbols from the BFD ABFD, and fills in the vector LOCATION +with pointers to the symbols and a trailing NULL. Return the actual +number of symbol pointers, not including the NULL. + #define bfd_canonicalize_symtab(abfd, location) \ + BFD_SEND (abfd, _bfd_canonicalize_symtab,\ + (abfd, location)) + +`bfd_set_symtab' +................ + +*Synopsis* + boolean bfd_set_symtab (bfd *abfd, asymbol **location, unsigned int count); + *Description* +Arrange that when the output BFD ABFD is closed, the table LOCATION of +COUNT pointers to symbols will be written. +`bfd_print_symbol_vandf' +........................ + +*Synopsis* + void bfd_print_symbol_vandf(PTR file, asymbol *symbol); + *Description* +Print the value and flags of the SYMBOL supplied to the stream FILE. +`bfd_make_empty_symbol' +....................... + +*Description* +Create a new `asymbol' structure for the BFD ABFD and return a pointer +to it. + + This routine is necessary because each back end has private +information surrounding the `asymbol'. Building your own `asymbol' and +pointing to it will not create the private information, and will cause +problems later on. + #define bfd_make_empty_symbol(abfd) \ + BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) + +`bfd_make_debug_symbol' +....................... + +*Description* +Create a new `asymbol' structure for the BFD ABFD, to be used as a +debugging symbol. Further details of its use have yet to be worked out. + #define bfd_make_debug_symbol(abfd,ptr,size) \ + BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) + +`bfd_decode_symclass' +..................... + +*Description* +Return a character corresponding to the symbol class of SYMBOL, or '?' +for an unknown class. +*Synopsis* + int bfd_decode_symclass(asymbol *symbol); + +`bfd_symbol_info' +................. + + *Description* +Fill in the basic info about symbol that nm needs. Additional info may +be added by the back-ends after calling this function. +*Synopsis* + void bfd_symbol_info(asymbol *symbol, symbol_info *ret); + +`bfd_copy_private_symbol_data' +.............................. + + *Synopsis* + boolean bfd_copy_private_symbol_data(bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym); + *Description* +Copy private symbol information from ISYM in the BFD IBFD to the symbol +OSYM in the BFD OBFD. Return `true' on success, `false' on error. +Possible error returns are: + + * `bfd_error_no_memory' - Not enough memory exists to create private + data for OSEC. + #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ + BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ + (ibfd, isymbol, obfd, osymbol)) + + +File: bfd.info, Node: Archives, Next: Formats, Prev: Symbols, Up: BFD front end + +Archives +======== + +*Description* +An archive (or library) is just another BFD. It has a symbol table, +although there's not much a user program will do with it. + + The big difference between an archive BFD and an ordinary BFD is +that the archive doesn't have sections. Instead it has a chain of BFDs +that are considered its contents. These BFDs can be manipulated like +any other. The BFDs contained in an archive opened for reading will +all be opened for reading. You may put either input or output BFDs +into an archive opened for output; they will be handled correctly when +the archive is closed. + + Use `bfd_openr_next_archived_file' to step through the contents of +an archive opened for input. You don't have to read the entire archive +if you don't want to! Read it until you find what you want. + + Archive contents of output BFDs are chained through the `next' +pointer in a BFD. The first one is findable through the `archive_head' +slot of the archive. Set it with `bfd_set_archive_head' (q.v.). A +given BFD may be in only one open output archive at a time. + + As expected, the BFD archive code is more general than the archive +code of any given environment. BFD archives may contain files of +different formats (e.g., a.out and coff) and even different +architectures. You may even place archives recursively into archives! + + This can cause unexpected confusion, since some archive formats are +more expressive than others. For instance, Intel COFF archives can +preserve long filenames; SunOS a.out archives cannot. If you move a +file from the first to the second format and back again, the filename +may be truncated. Likewise, different a.out environments have different +conventions as to how they truncate filenames, whether they preserve +directory names in filenames, etc. When interoperating with native +tools, be sure your files are homogeneous. + + Beware: most of these formats do not react well to the presence of +spaces in filenames. We do the best we can, but can't always handle +this case due to restrictions in the format of archives. Many Unix +utilities are braindead in regards to spaces and such in filenames +anyway, so this shouldn't be much of a restriction. + + Archives are supported in BFD in `archive.c'. +`bfd_get_next_mapent' +..................... + +*Synopsis* + symindex bfd_get_next_mapent(bfd *abfd, symindex previous, carsym **sym); + *Description* +Step through archive ABFD's symbol table (if it has one). Successively +update SYM with the next symbol's information, returning that symbol's +(internal) index into the symbol table. + + Supply `BFD_NO_MORE_SYMBOLS' as the PREVIOUS entry to get the first +one; returns `BFD_NO_MORE_SYMBOLS' when you've already got the last one. + + A `carsym' is a canonical archive symbol. The only user-visible +element is its name, a null-terminated string. +`bfd_set_archive_head' +...................... + +*Synopsis* + boolean bfd_set_archive_head(bfd *output, bfd *new_head); + *Description* +Set the head of the chain of BFDs contained in the archive OUTPUT to +NEW_HEAD. +`bfd_openr_next_archived_file' +.............................. + +*Synopsis* + bfd *bfd_openr_next_archived_file(bfd *archive, bfd *previous); + *Description* +Provided a BFD, ARCHIVE, containing an archive and NULL, open an input +BFD on the first contained element and returns that. Subsequent calls +should pass the archive and the previous return value to return a +created BFD to the next contained element. NULL is returned when there +are no more. + +File: bfd.info, Node: Formats, Next: Relocations, Prev: Archives, Up: BFD front end + +File formats +============ + +A format is a BFD concept of high level file contents type. The formats +supported by BFD are: + + * `bfd_object' The BFD may contain data, symbols, relocations and +debug info. + + * `bfd_archive' The BFD contains other BFDs and an optional index. + + * `bfd_core' The BFD contains the result of an executable core dump. +`bfd_check_format' +.................. + +*Synopsis* + boolean bfd_check_format(bfd *abfd, bfd_format format); + *Description* +Verify if the file attached to the BFD ABFD is compatible with the +format FORMAT (i.e., one of `bfd_object', `bfd_archive' or `bfd_core'). + + If the BFD has been set to a specific target before the call, only +the named target and format combination is checked. If the target has +not been set, or has been set to `default', then all the known target +backends is interrogated to determine a match. If the default target +matches, it is used. If not, exactly one target must recognize the +file, or an error results. + + The function returns `true' on success, otherwise `false' with one +of the following error codes: + + * `bfd_error_invalid_operation' - if `format' is not one of + `bfd_object', `bfd_archive' or `bfd_core'. + + * `bfd_error_system_call' - if an error occured during a read - even + some file mismatches can cause bfd_error_system_calls. + + * `file_not_recognised' - none of the backends recognised the file + format. + + * `bfd_error_file_ambiguously_recognized' - more than one backend + recognised the file format. +`bfd_check_format_matches' +.......................... + +*Synopsis* + boolean bfd_check_format_matches(bfd *abfd, bfd_format format, char ***matching); + *Description* +Like `bfd_check_format', except when it returns false with `bfd_errno' +set to `bfd_error_file_ambiguously_recognized'. In that case, if +MATCHING is not NULL, it will be filled in with a NULL-terminated list +of the names of the formats that matched, allocated with `malloc'. +Then the user may choose a format and try again. + + When done with the list that MATCHING points to, the caller should +free it. +`bfd_set_format' +................ + +*Synopsis* + boolean bfd_set_format(bfd *abfd, bfd_format format); + *Description* +This function sets the file format of the BFD ABFD to the format +FORMAT. If the target set in the BFD does not support the format +requested, the format is invalid, or the BFD is not open for writing, +then an error occurs. +`bfd_format_string' +................... + +*Synopsis* + CONST char *bfd_format_string(bfd_format format); + *Description* +Return a pointer to a const string `invalid', `object', `archive', +`core', or `unknown', depending upon the value of FORMAT. + +File: bfd.info, Node: Relocations, Next: Core Files, Prev: Formats, Up: BFD front end + +Relocations +=========== + +BFD maintains relocations in much the same way it maintains symbols: +they are left alone until required, then read in en-mass and translated +into an internal form. A common routine `bfd_perform_relocation' acts +upon the canonical form to do the fixup. + + Relocations are maintained on a per section basis, while symbols are +maintained on a per BFD basis. + + All that a back end has to do to fit the BFD interface is to create +a `struct reloc_cache_entry' for each relocation in a particular +section, and fill in the right bits of the structures. + +* Menu: + +* typedef arelent:: +* howto manager:: + + +File: bfd.info, Node: typedef arelent, Next: howto manager, Prev: Relocations, Up: Relocations + +typedef arelent +--------------- + +This is the structure of a relocation entry: +. + typedef enum bfd_reloc_status + { + /* No errors detected */ + bfd_reloc_ok, + + /* The relocation was performed, but there was an overflow. */ + bfd_reloc_overflow, + + /* The address to relocate was not within the section supplied. */ + bfd_reloc_outofrange, + + /* Used by special functions */ + bfd_reloc_continue, + + /* Unsupported relocation size requested. */ + bfd_reloc_notsupported, + + /* Unused */ + bfd_reloc_other, + + /* The symbol to relocate against was undefined. */ + bfd_reloc_undefined, + + /* The relocation was performed, but may not be ok - presently + generated only when linking i960 coff files with i960 b.out + symbols. If this type is returned, the error_message argument + to bfd_perform_relocation will be set. */ + bfd_reloc_dangerous + } + bfd_reloc_status_type; + + + typedef struct reloc_cache_entry + { + /* A pointer into the canonical table of pointers */ + struct symbol_cache_entry **sym_ptr_ptr; + + /* offset in section */ + bfd_size_type address; + + /* addend for relocation value */ + bfd_vma addend; + + /* Pointer to how to perform the required relocation */ + reloc_howto_type *howto; + + } arelent; + *Description* +Here is a description of each of the fields within an `arelent': + + * `sym_ptr_ptr' The symbol table pointer points to a pointer to the +symbol associated with the relocation request. It is the pointer into +the table returned by the back end's `get_symtab' action. *Note +Symbols::. The symbol is referenced through a pointer to a pointer so +that tools like the linker can fix up all the symbols of the same name +by modifying only one pointer. The relocation routine looks in the +symbol and uses the base of the section the symbol is attached to and +the value of the symbol as the initial relocation offset. If the symbol +pointer is zero, then the section provided is looked up. + + * `address' The `address' field gives the offset in bytes from the +base of the section data which owns the relocation record to the first +byte of relocatable information. The actual data relocated will be +relative to this point; for example, a relocation type which modifies +the bottom two bytes of a four byte word would not touch the first byte +pointed to in a big endian world. + + * `addend' The `addend' is a value provided by the back end to be +added (!) to the relocation offset. Its interpretation is dependent upon +the howto. For example, on the 68k the code: + + char foo[]; + main() + { + return foo[0x12345678]; + } + + Could be compiled into: + + linkw fp,#-4 + moveb @#12345678,d0 + extbl d0 + unlk fp + rts + + This could create a reloc pointing to `foo', but leave the offset in +the data, something like: + + RELOCATION RECORDS FOR [.text]: + offset type value + 00000006 32 _foo + + 00000000 4e56 fffc ; linkw fp,#-4 + 00000004 1039 1234 5678 ; moveb @#12345678,d0 + 0000000a 49c0 ; extbl d0 + 0000000c 4e5e ; unlk fp + 0000000e 4e75 ; rts + + Using coff and an 88k, some instructions don't have enough space in +them to represent the full address range, and pointers have to be +loaded in two parts. So you'd get something like: + + or.u r13,r0,hi16(_foo+0x12345678) + ld.b r2,r13,lo16(_foo+0x12345678) + jmp r1 + + This should create two relocs, both pointing to `_foo', and with +0x12340000 in their addend field. The data would consist of: + + RELOCATION RECORDS FOR [.text]: + offset type value + 00000002 HVRT16 _foo+0x12340000 + 00000006 LVRT16 _foo+0x12340000 + + 00000000 5da05678 ; or.u r13,r0,0x5678 + 00000004 1c4d5678 ; ld.b r2,r13,0x5678 + 00000008 f400c001 ; jmp r1 + + The relocation routine digs out the value from the data, adds it to +the addend to get the original offset, and then adds the value of +`_foo'. Note that all 32 bits have to be kept around somewhere, to cope +with carry from bit 15 to bit 16. + + One further example is the sparc and the a.out format. The sparc has +a similar problem to the 88k, in that some instructions don't have room +for an entire offset, but on the sparc the parts are created in odd +sized lumps. The designers of the a.out format chose to not use the +data within the section for storing part of the offset; all the offset +is kept within the reloc. Anything in the data should be ignored. + + save %sp,-112,%sp + sethi %hi(_foo+0x12345678),%g2 + ldsb [%g2+%lo(_foo+0x12345678)],%i0 + ret + restore + + Both relocs contain a pointer to `foo', and the offsets contain junk. + + RELOCATION RECORDS FOR [.text]: + offset type value + 00000004 HI22 _foo+0x12345678 + 00000008 LO10 _foo+0x12345678 + + 00000000 9de3bf90 ; save %sp,-112,%sp + 00000004 05000000 ; sethi %hi(_foo+0),%g2 + 00000008 f048a000 ; ldsb [%g2+%lo(_foo+0)],%i0 + 0000000c 81c7e008 ; ret + 00000010 81e80000 ; restore + + * `howto' The `howto' field can be imagined as a relocation +instruction. It is a pointer to a structure which contains information +on what to do with all of the other information in the reloc record and +data section. A back end would normally have a relocation instruction +set and turn relocations into pointers to the correct structure on +input - but it would be possible to create each howto field on demand. +`enum complain_overflow' +........................ + +Indicates what sort of overflow checking should be done when performing +a relocation. +. + enum complain_overflow + { + /* Do not complain on overflow. */ + complain_overflow_dont, + + /* Complain if the bitfield overflows, whether it is considered + as signed or unsigned. */ + complain_overflow_bitfield, + + /* Complain if the value overflows when considered as signed + number. */ + complain_overflow_signed, + + /* Complain if the value overflows when considered as an + unsigned number. */ + complain_overflow_unsigned + }; + +`reloc_howto_type' +.................. + + The `reloc_howto_type' is a structure which contains all the +information that libbfd needs to know to tie up a back end's data. +.struct symbol_cache_entry; /* Forward declaration */ + + struct reloc_howto_struct + { + /* The type field has mainly a documentary use - the back end can + do what it wants with it, though normally the back end's + external idea of what a reloc number is stored + in this field. For example, a PC relative word relocation + in a coff environment has the type 023 - because that's + what the outside world calls a R_PCRWORD reloc. */ + unsigned int type; + + /* The value the final relocation is shifted right by. This drops + unwanted data from the relocation. */ + unsigned int rightshift; + + /* The size of the item to be relocated. This is *not* a + power-of-two measure. To get the number of bytes operated + on by a type of relocation, use bfd_get_reloc_size. */ + int size; + + /* The number of bits in the item to be relocated. This is used + when doing overflow checking. */ + unsigned int bitsize; + + /* Notes that the relocation is relative to the location in the + data section of the addend. The relocation function will + subtract from the relocation value the address of the location + being relocated. */ + boolean pc_relative; + + /* The bit position of the reloc value in the destination. + The relocated value is left shifted by this amount. */ + unsigned int bitpos; + + /* What type of overflow error should be checked for when + relocating. */ + enum complain_overflow complain_on_overflow; + + /* If this field is non null, then the supplied function is + called rather than the normal function. This allows really + strange relocation methods to be accomodated (e.g., i960 callj + instructions). */ + bfd_reloc_status_type (*special_function) + PARAMS ((bfd *abfd, + arelent *reloc_entry, + struct symbol_cache_entry *symbol, + PTR data, + asection *input_section, + bfd *output_bfd, + char **error_message)); + + /* The textual name of the relocation type. */ + char *name; + + /* When performing a partial link, some formats must modify the + relocations rather than the data - this flag signals this.*/ + boolean partial_inplace; + + /* The src_mask selects which parts of the read in data + are to be used in the relocation sum. E.g., if this was an 8 bit + bit of data which we read and relocated, this would be + 0x000000ff. When we have relocs which have an addend, such as + sun4 extended relocs, the value in the offset part of a + relocating field is garbage so we never use it. In this case + the mask would be 0x00000000. */ + bfd_vma src_mask; + + /* The dst_mask selects which parts of the instruction are replaced + into the instruction. In most cases src_mask == dst_mask, + except in the above special case, where dst_mask would be + 0x000000ff, and src_mask would be 0x00000000. */ + bfd_vma dst_mask; + + /* When some formats create PC relative instructions, they leave + the value of the pc of the place being relocated in the offset + slot of the instruction, so that a PC relative relocation can + be made just by adding in an ordinary offset (e.g., sun3 a.out). + Some formats leave the displacement part of an instruction + empty (e.g., m88k bcs); this flag signals the fact.*/ + boolean pcrel_offset; + + }; + +`The HOWTO Macro' +................. + + *Description* +The HOWTO define is horrible and will go away. + #define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ + {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC} + +*Description* +And will be replaced with the totally magic way. But for the moment, we +are compatible, so do it this way. + #define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN) + +*Description* +Helper routine to turn a symbol into a relocation value. + #define HOWTO_PREPARE(relocation, symbol) \ + { \ + if (symbol != (asymbol *)NULL) { \ + if (bfd_is_com_section (symbol->section)) { \ + relocation = 0; \ + } \ + else { \ + relocation = symbol->value; \ + } \ + } \ + } + +`bfd_get_reloc_size' +.................... + +*Synopsis* + int bfd_get_reloc_size (reloc_howto_type *); + *Description* +For a reloc_howto_type that operates on a fixed number of bytes, this +returns the number of bytes operated on. +`arelent_chain' +............... + +*Description* +How relocs are tied together in an `asection': + typedef struct relent_chain { + arelent relent; + struct relent_chain *next; + } arelent_chain; + +`bfd_perform_relocation' +........................ + +*Synopsis* + bfd_reloc_status_type + bfd_perform_relocation + (bfd *abfd, + arelent *reloc_entry, + PTR data, + asection *input_section, + bfd *output_bfd, + char **error_message); + *Description* +If OUTPUT_BFD is supplied to this function, the generated image will be +relocatable; the relocations are copied to the output file after they +have been changed to reflect the new state of the world. There are two +ways of reflecting the results of partial linkage in an output file: by +modifying the output data in place, and by modifying the relocation +record. Some native formats (e.g., basic a.out and basic coff) have no +way of specifying an addend in the relocation type, so the addend has +to go in the output data. This is no big deal since in these formats +the output data slot will always be big enough for the addend. Complex +reloc types with addends were invented to solve just this problem. The +ERROR_MESSAGE argument is set to an error message if this return +`bfd_reloc_dangerous'. +`bfd_install_relocation' +........................ + +*Synopsis* + bfd_reloc_status_type + bfd_install_relocation + (bfd *abfd, + arelent *reloc_entry, + PTR data, bfd_vma data_start, + asection *input_section, + char **error_message); + *Description* +This looks remarkably like `bfd_perform_relocation', except it does not +expect that the section contents have been filled in. I.e., it's +suitable for use when creating, rather than applying a relocation. + + For now, this function should be considered reserved for the +assembler. diff -urN binutils-2.7/bfd/doc/bfd.info-3 binutils-2.8/bfd/doc/bfd.info-3 --- binutils-2.7/bfd/doc/bfd.info-3 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/bfd.info-3 Wed Apr 30 13:14:27 1997 @@ -0,0 +1,1322 @@ +This is Info file bfd.info, produced by Makeinfo-1.64 from the input +file ./bfd.texinfo. + +START-INFO-DIR-ENTRY +* Bfd: (bfd). The Binary File Descriptor library. +END-INFO-DIR-ENTRY + + This file documents the BFD library. + + Copyright (C) 1991 Free Software Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, subject to the +terms of the GNU General Public License, which includes the provision +that the entire resulting derived work is distributed under the terms +of a permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions. + + +File: bfd.info, Node: howto manager, Prev: typedef arelent, Up: Relocations + +The howto manager +================= + +When an application wants to create a relocation, but doesn't know what +the target machine might call it, it can find out by using this bit of +code. +`bfd_reloc_code_type' +..................... + +*Description* +The insides of a reloc code. The idea is that, eventually, there will +be one enumerator for every type of relocation we ever do. Pass one of +these values to `bfd_reloc_type_lookup', and it'll return a howto +pointer. + + This does mean that the application must determine the correct +enumerator value; you can't get a howto pointer from a random set of +attributes. +Here are the possible values for `enum bfd_reloc_code_real': + + - : BFD_RELOC_64 + - : BFD_RELOC_32 + - : BFD_RELOC_26 + - : BFD_RELOC_24 + - : BFD_RELOC_16 + - : BFD_RELOC_14 + - : BFD_RELOC_8 + Basic absolute relocations of N bits. + + - : BFD_RELOC_64_PCREL + - : BFD_RELOC_32_PCREL + - : BFD_RELOC_24_PCREL + - : BFD_RELOC_16_PCREL + - : BFD_RELOC_12_PCREL + - : BFD_RELOC_8_PCREL + PC-relative relocations. Sometimes these are relative to the + address of the relocation itself; sometimes they are relative to + the start of the section containing the relocation. It depends on + the specific target. + + The 24-bit relocation is used in some Intel 960 configurations. + + - : BFD_RELOC_32_GOT_PCREL + - : BFD_RELOC_16_GOT_PCREL + - : BFD_RELOC_8_GOT_PCREL + - : BFD_RELOC_32_GOTOFF + - : BFD_RELOC_16_GOTOFF + - : BFD_RELOC_LO16_GOTOFF + - : BFD_RELOC_HI16_GOTOFF + - : BFD_RELOC_HI16_S_GOTOFF + - : BFD_RELOC_8_GOTOFF + - : BFD_RELOC_32_PLT_PCREL + - : BFD_RELOC_24_PLT_PCREL + - : BFD_RELOC_16_PLT_PCREL + - : BFD_RELOC_8_PLT_PCREL + - : BFD_RELOC_32_PLTOFF + - : BFD_RELOC_16_PLTOFF + - : BFD_RELOC_LO16_PLTOFF + - : BFD_RELOC_HI16_PLTOFF + - : BFD_RELOC_HI16_S_PLTOFF + - : BFD_RELOC_8_PLTOFF + For ELF. + + - : BFD_RELOC_68K_GLOB_DAT + - : BFD_RELOC_68K_JMP_SLOT + - : BFD_RELOC_68K_RELATIVE + Relocations used by 68K ELF. + + - : BFD_RELOC_32_BASEREL + - : BFD_RELOC_16_BASEREL + - : BFD_RELOC_LO16_BASEREL + - : BFD_RELOC_HI16_BASEREL + - : BFD_RELOC_HI16_S_BASEREL + - : BFD_RELOC_8_BASEREL + - : BFD_RELOC_RVA + Linkage-table relative. + + - : BFD_RELOC_8_FFnn + Absolute 8-bit relocation, but used to form an address like 0xFFnn. + + - : BFD_RELOC_32_PCREL_S2 + - : BFD_RELOC_16_PCREL_S2 + - : BFD_RELOC_23_PCREL_S2 + These PC-relative relocations are stored as word displacements - + i.e., byte displacements shifted right two bits. The 30-bit word + displacement (<<32_PCREL_S2>> - 32 bits, shifted 2) is used on the + SPARC. (SPARC tools generally refer to this as <>.) The + signed 16-bit displacement is used on the MIPS, and the 23-bit + displacement is used on the Alpha. + + - : BFD_RELOC_HI22 + - : BFD_RELOC_LO10 + High 22 bits and low 10 bits of 32-bit value, placed into lower + bits of the target word. These are used on the SPARC. + + - : BFD_RELOC_GPREL16 + - : BFD_RELOC_GPREL32 + For systems that allocate a Global Pointer register, these are + displacements off that register. These relocation types are + handled specially, because the value the register will have is + decided relatively late. + + - : BFD_RELOC_I960_CALLJ + Reloc types used for i960/b.out. + + - : BFD_RELOC_NONE + - : BFD_RELOC_SPARC_WDISP22 + - : BFD_RELOC_SPARC22 + - : BFD_RELOC_SPARC13 + - : BFD_RELOC_SPARC_GOT10 + - : BFD_RELOC_SPARC_GOT13 + - : BFD_RELOC_SPARC_GOT22 + - : BFD_RELOC_SPARC_PC10 + - : BFD_RELOC_SPARC_PC22 + - : BFD_RELOC_SPARC_WPLT30 + - : BFD_RELOC_SPARC_COPY + - : BFD_RELOC_SPARC_GLOB_DAT + - : BFD_RELOC_SPARC_JMP_SLOT + - : BFD_RELOC_SPARC_RELATIVE + - : BFD_RELOC_SPARC_UA32 + SPARC ELF relocations. There is probably some overlap with other + relocation types already defined. + + - : BFD_RELOC_SPARC_BASE13 + - : BFD_RELOC_SPARC_BASE22 + I think these are specific to SPARC a.out (e.g., Sun 4). + + - : BFD_RELOC_SPARC_64 + - : BFD_RELOC_SPARC_10 + - : BFD_RELOC_SPARC_11 + - : BFD_RELOC_SPARC_OLO10 + - : BFD_RELOC_SPARC_HH22 + - : BFD_RELOC_SPARC_HM10 + - : BFD_RELOC_SPARC_LM22 + - : BFD_RELOC_SPARC_PC_HH22 + - : BFD_RELOC_SPARC_PC_HM10 + - : BFD_RELOC_SPARC_PC_LM22 + - : BFD_RELOC_SPARC_WDISP16 + - : BFD_RELOC_SPARC_WDISP19 + - : BFD_RELOC_SPARC_GLOB_JMP + - : BFD_RELOC_SPARC_7 + - : BFD_RELOC_SPARC_6 + - : BFD_RELOC_SPARC_5 + Some relocations we're using for SPARC V9 - subject to change. + + - : BFD_RELOC_ALPHA_GPDISP_HI16 + Alpha ECOFF and ELF relocations. Some of these treat the symbol or + "addend" in some special way. For GPDISP_HI16 ("gpdisp") + relocations, the symbol is ignored when writing; when reading, it + will be the absolute section symbol. The addend is the + displacement in bytes of the "lda" instruction from the "ldah" + instruction (which is at the address of this reloc). + + - : BFD_RELOC_ALPHA_GPDISP_LO16 + For GPDISP_LO16 ("ignore") relocations, the symbol is handled as + with GPDISP_HI16 relocs. The addend is ignored when writing the + relocations out, and is filled in with the file's GP value on + reading, for convenience. + + - : BFD_RELOC_ALPHA_GPDISP + The ELF GPDISP relocation is exactly the same as the GPDISP_HI16 + relocation except that there is no accompanying GPDISP_LO16 + relocation. + + - : BFD_RELOC_ALPHA_LITERAL + - : BFD_RELOC_ALPHA_ELF_LITERAL + - : BFD_RELOC_ALPHA_LITUSE + The Alpha LITERAL/LITUSE relocs are produced by a symbol reference; + the assembler turns it into a LDQ instruction to load the address + of the symbol, and then fills in a register in the real + instruction. + + The LITERAL reloc, at the LDQ instruction, refers to the .lita + section symbol. The addend is ignored when writing, but is filled + in with the file's GP value on reading, for convenience, as with + the GPDISP_LO16 reloc. + + The ELF_LITERAL reloc is somewhere between 16_GOTOFF and + GPDISP_LO16. It should refer to the symbol to be referenced, as + with 16_GOTOFF, but it generates output not based on the position + within the .got section, but relative to the GP value chosen for + the file during the final link stage. + + The LITUSE reloc, on the instruction using the loaded address, + gives information to the linker that it might be able to use to + optimize away some literal section references. The symbol is + ignored (read as the absolute section symbol), and the "addend" + indicates the type of instruction using the register: 1 - "memory" + fmt insn 2 - byte-manipulation (byte offset reg) 3 - jsr (target + of branch) + + The GNU linker currently doesn't do any of this optimizing. + + - : BFD_RELOC_ALPHA_HINT + The HINT relocation indicates a value that should be filled into + the "hint" field of a jmp/jsr/ret instruction, for possible branch- + prediction logic which may be provided on some processors. + + - : BFD_RELOC_ALPHA_LINKAGE + The LINKAGE relocation outputs a linkage pair in the object file, + which is filled by the linker. + + - : BFD_RELOC_ALPHA_CODEADDR + The CODEADDR relocation outputs a STO_CA in the object file, which + is filled by the linker. + + - : BFD_RELOC_MIPS_JMP + Bits 27..2 of the relocation address shifted right 2 bits; simple + reloc otherwise. + + - : BFD_RELOC_MIPS16_JMP + The MIPS16 jump instruction. + + - : BFD_RELOC_MIPS16_GPREL + MIPS16 GP relative reloc. + + - : BFD_RELOC_HI16 + High 16 bits of 32-bit value; simple reloc. + + - : BFD_RELOC_HI16_S + High 16 bits of 32-bit value but the low 16 bits will be sign + extended and added to form the final result. If the low 16 bits + form a negative number, we need to add one to the high value to + compensate for the borrow when the low bits are added. + + - : BFD_RELOC_LO16 + Low 16 bits. + + - : BFD_RELOC_PCREL_HI16_S + Like BFD_RELOC_HI16_S, but PC relative. + + - : BFD_RELOC_PCREL_LO16 + Like BFD_RELOC_LO16, but PC relative. + + - : BFD_RELOC_MIPS_GPREL + Relocation relative to the global pointer. + + - : BFD_RELOC_MIPS_LITERAL + Relocation against a MIPS literal section. + + - : BFD_RELOC_MIPS_GOT16 + - : BFD_RELOC_MIPS_CALL16 + - : BFD_RELOC_MIPS_GPREL32 + - : BFD_RELOC_MIPS_GOT_HI16 + - : BFD_RELOC_MIPS_GOT_LO16 + - : BFD_RELOC_MIPS_CALL_HI16 + - : BFD_RELOC_MIPS_CALL_LO16 + MIPS ELF relocations. + + - : BFD_RELOC_386_GOT32 + - : BFD_RELOC_386_PLT32 + - : BFD_RELOC_386_COPY + - : BFD_RELOC_386_GLOB_DAT + - : BFD_RELOC_386_JUMP_SLOT + - : BFD_RELOC_386_RELATIVE + - : BFD_RELOC_386_GOTOFF + - : BFD_RELOC_386_GOTPC + i386/elf relocations + + - : BFD_RELOC_NS32K_IMM_8 + - : BFD_RELOC_NS32K_IMM_16 + - : BFD_RELOC_NS32K_IMM_32 + - : BFD_RELOC_NS32K_IMM_8_PCREL + - : BFD_RELOC_NS32K_IMM_16_PCREL + - : BFD_RELOC_NS32K_IMM_32_PCREL + - : BFD_RELOC_NS32K_DISP_8 + - : BFD_RELOC_NS32K_DISP_16 + - : BFD_RELOC_NS32K_DISP_32 + - : BFD_RELOC_NS32K_DISP_8_PCREL + - : BFD_RELOC_NS32K_DISP_16_PCREL + - : BFD_RELOC_NS32K_DISP_32_PCREL + ns32k relocations + + - : BFD_RELOC_PPC_B26 + - : BFD_RELOC_PPC_BA26 + - : BFD_RELOC_PPC_TOC16 + - : BFD_RELOC_PPC_B16 + - : BFD_RELOC_PPC_B16_BRTAKEN + - : BFD_RELOC_PPC_B16_BRNTAKEN + - : BFD_RELOC_PPC_BA16 + - : BFD_RELOC_PPC_BA16_BRTAKEN + - : BFD_RELOC_PPC_BA16_BRNTAKEN + - : BFD_RELOC_PPC_COPY + - : BFD_RELOC_PPC_GLOB_DAT + - : BFD_RELOC_PPC_JMP_SLOT + - : BFD_RELOC_PPC_RELATIVE + - : BFD_RELOC_PPC_LOCAL24PC + - : BFD_RELOC_PPC_EMB_NADDR32 + - : BFD_RELOC_PPC_EMB_NADDR16 + - : BFD_RELOC_PPC_EMB_NADDR16_LO + - : BFD_RELOC_PPC_EMB_NADDR16_HI + - : BFD_RELOC_PPC_EMB_NADDR16_HA + - : BFD_RELOC_PPC_EMB_SDAI16 + - : BFD_RELOC_PPC_EMB_SDA2I16 + - : BFD_RELOC_PPC_EMB_SDA2REL + - : BFD_RELOC_PPC_EMB_SDA21 + - : BFD_RELOC_PPC_EMB_MRKREF + - : BFD_RELOC_PPC_EMB_RELSEC16 + - : BFD_RELOC_PPC_EMB_RELST_LO + - : BFD_RELOC_PPC_EMB_RELST_HI + - : BFD_RELOC_PPC_EMB_RELST_HA + - : BFD_RELOC_PPC_EMB_BIT_FLD + - : BFD_RELOC_PPC_EMB_RELSDA + Power(rs6000) and PowerPC relocations. + + - : BFD_RELOC_CTOR + The type of reloc used to build a contructor table - at the moment + probably a 32 bit wide absolute relocation, but the target can + choose. It generally does map to one of the other relocation + types. + + - : BFD_RELOC_ARM_PCREL_BRANCH + ARM 26 bit pc-relative branch. The lowest two bits must be zero + and are not stored in the instruction. + + - : BFD_RELOC_ARM_IMMEDIATE + - : BFD_RELOC_ARM_OFFSET_IMM + - : BFD_RELOC_ARM_SHIFT_IMM + - : BFD_RELOC_ARM_SWI + - : BFD_RELOC_ARM_MULTI + - : BFD_RELOC_ARM_CP_OFF_IMM + - : BFD_RELOC_ARM_ADR_IMM + - : BFD_RELOC_ARM_LDR_IMM + - : BFD_RELOC_ARM_LITERAL + - : BFD_RELOC_ARM_IN_POOL + - : BFD_RELOC_ARM_OFFSET_IMM8 + - : BFD_RELOC_ARM_HWLITERAL + - : BFD_RELOC_ARM_THUMB_ADD + - : BFD_RELOC_ARM_THUMB_IMM + - : BFD_RELOC_ARM_THUMB_SHIFT + - : BFD_RELOC_ARM_THUMB_OFFSET + These relocs are only used within the ARM assembler. They are not + (at present) written to any object files. + + - : BFD_RELOC_SH_PCDISP8BY2 + - : BFD_RELOC_SH_PCDISP12BY2 + - : BFD_RELOC_SH_IMM4 + - : BFD_RELOC_SH_IMM4BY2 + - : BFD_RELOC_SH_IMM4BY4 + - : BFD_RELOC_SH_IMM8 + - : BFD_RELOC_SH_IMM8BY2 + - : BFD_RELOC_SH_IMM8BY4 + - : BFD_RELOC_SH_PCRELIMM8BY2 + - : BFD_RELOC_SH_PCRELIMM8BY4 + - : BFD_RELOC_SH_SWITCH16 + - : BFD_RELOC_SH_SWITCH32 + - : BFD_RELOC_SH_USES + - : BFD_RELOC_SH_COUNT + - : BFD_RELOC_SH_ALIGN + - : BFD_RELOC_SH_CODE + - : BFD_RELOC_SH_DATA + - : BFD_RELOC_SH_LABEL + Hitachi SH relocs. Not all of these appear in object files. + + - : BFD_RELOC_D10V_10_PCREL_R + Mitsubishi D10V relocs. This is a 10-bit reloc with the right 2 + bits assumed to be 0. + + - : BFD_RELOC_D10V_10_PCREL_L + Mitsubishi D10V relocs. This is a 10-bit reloc with the right 2 + bits assumed to be 0. This is the same as the previous reloc + except it is in the left container, i.e., shifted left 15 bits. + + - : BFD_RELOC_D10V_18 + This is an 18-bit reloc with the right 2 bits assumed to be 0. + + - : BFD_RELOC_D10V_18_PCREL + This is an 18-bit reloc with the right 2 bits assumed to be 0. + + - : BFD_RELOC_M32R_24 + Mitsubishi M32R relocs. This is a 24 bit absolute address. + + - : BFD_RELOC_M32R_10_PCREL + This is a 10-bit pc-relative reloc with the right 2 bits assumed + to be 0. + + - : BFD_RELOC_M32R_18_PCREL + This is an 18-bit reloc with the right 2 bits assumed to be 0. + + - : BFD_RELOC_M32R_26_PCREL + This is a 26-bit reloc with the right 2 bits assumed to be 0. + + - : BFD_RELOC_M32R_HI16_ULO + This is a 16-bit reloc containing the high 16 bits of an address + used when the lower 16 bits are treated as unsigned. + + - : BFD_RELOC_M32R_HI16_SLO + This is a 16-bit reloc containing the high 16 bits of an address + used when the lower 16 bits are treated as signed. + + - : BFD_RELOC_M32R_LO16 + This is a 16-bit reloc containing the lower 16 bits of an address. + + - : BFD_RELOC_M32R_SDA16 + This is a 16-bit reloc containing the small data area offset for + use in add3, load, and store instructions. + + - : BFD_RELOC_MN10300_32_PCREL + This is a 32bit pcrel reloc for the mn10300, offset by two bytes + in the instruction. + + - : BFD_RELOC_MN10300_16_PCREL + This is a 16bit pcrel reloc for the mn10300, offset by two bytes + in the instruction. + . + typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; + +`bfd_reloc_type_lookup' +....................... + + *Synopsis* + reloc_howto_type * + bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code); + *Description* +Return a pointer to a howto structure which, when invoked, will perform +the relocation CODE on data from the architecture noted. +`bfd_default_reloc_type_lookup' +............................... + +*Synopsis* + reloc_howto_type *bfd_default_reloc_type_lookup + (bfd *abfd, bfd_reloc_code_real_type code); + *Description* +Provides a default relocation lookup routine for any architecture. +`bfd_get_reloc_code_name' +......................... + +*Synopsis* + const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); + *Description* +Provides a printable name for the supplied relocation code. Useful +mainly for printing error messages. +`bfd_generic_relax_section' +........................... + +*Synopsis* + boolean bfd_generic_relax_section + (bfd *abfd, + asection *section, + struct bfd_link_info *, + boolean *); + *Description* +Provides default handling for relaxing for back ends which don't do +relaxing - i.e., does nothing. +`bfd_generic_get_relocated_section_contents' +............................................ + +*Synopsis* + bfd_byte * + bfd_generic_get_relocated_section_contents (bfd *abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + boolean relocateable, + asymbol **symbols); + *Description* +Provides default handling of relocation effort for back ends which +can't be bothered to do it efficiently. + +File: bfd.info, Node: Core Files, Next: Targets, Prev: Relocations, Up: BFD front end + +Core files +========== + +*Description* +These are functions pertaining to core files. +`bfd_core_file_failing_command' +............................... + +*Synopsis* + CONST char *bfd_core_file_failing_command(bfd *abfd); + *Description* +Return a read-only string explaining which program was running when it +failed and produced the core file ABFD. +`bfd_core_file_failing_signal' +.............................. + +*Synopsis* + int bfd_core_file_failing_signal(bfd *abfd); + *Description* +Returns the signal number which caused the core dump which generated +the file the BFD ABFD is attached to. +`core_file_matches_executable_p' +................................ + +*Synopsis* + boolean core_file_matches_executable_p + (bfd *core_bfd, bfd *exec_bfd); + *Description* +Return `true' if the core file attached to CORE_BFD was generated by a +run of the executable file attached to EXEC_BFD, `false' otherwise. + +File: bfd.info, Node: Targets, Next: Architectures, Prev: Core Files, Up: BFD front end + +Targets +======= + +*Description* +Each port of BFD to a different machine requries the creation of a +target back end. All the back end provides to the root part of BFD is a +structure containing pointers to functions which perform certain low +level operations on files. BFD translates the applications's requests +through a pointer into calls to the back end routines. + + When a file is opened with `bfd_openr', its format and target are +unknown. BFD uses various mechanisms to determine how to interpret the +file. The operations performed are: + + * Create a BFD by calling the internal routine `_bfd_new_bfd', then + call `bfd_find_target' with the target string supplied to + `bfd_openr' and the new BFD pointer. + + * If a null target string was provided to `bfd_find_target', look up + the environment variable `GNUTARGET' and use that as the target + string. + + * If the target string is still `NULL', or the target string is + `default', then use the first item in the target vector as the + target type, and set `target_defaulted' in the BFD to cause + `bfd_check_format' to loop through all the targets. *Note + bfd_target::. *Note Formats::. + + * Otherwise, inspect the elements in the target vector one by one, + until a match on target name is found. When found, use it. + + * Otherwise return the error `bfd_error_invalid_target' to + `bfd_openr'. + + * `bfd_openr' attempts to open the file using `bfd_open_file', and + returns the BFD. Once the BFD has been opened and the target +selected, the file format may be determined. This is done by calling +`bfd_check_format' on the BFD with a suggested format. If +`target_defaulted' has been set, each possible target type is tried to +see if it recognizes the specified format. `bfd_check_format' returns +`true' when the caller guesses right. + +* Menu: + +* bfd_target:: + + +File: bfd.info, Node: bfd_target, Prev: Targets, Up: Targets + +bfd_target +---------- + +*Description* +This structure contains everything that BFD knows about a target. It +includes things like its byte order, name, and which routines to call +to do various operations. + + Every BFD points to a target structure with its `xvec' member. + + The macros below are used to dispatch to functions through the +`bfd_target' vector. They are used in a number of macros further down +in `bfd.h', and are also used when calling various routines by hand +inside the BFD implementation. The ARGLIST argument must be +parenthesized; it contains all the arguments to the called function. + + They make the documentation (more) unpleasant to read, so if someone +wants to fix this and not break the above, please do. + #define BFD_SEND(bfd, message, arglist) \ + ((*((bfd)->xvec->message)) arglist) + + #ifdef DEBUG_BFD_SEND + #undef BFD_SEND + #define BFD_SEND(bfd, message, arglist) \ + (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ + ((*((bfd)->xvec->message)) arglist) : \ + (bfd_assert (__FILE__,__LINE__), NULL)) + #endif + For operations which index on the BFD format: + #define BFD_SEND_FMT(bfd, message, arglist) \ + (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) + + #ifdef DEBUG_BFD_SEND + #undef BFD_SEND_FMT + #define BFD_SEND_FMT(bfd, message, arglist) \ + (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ + (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \ + (bfd_assert (__FILE__,__LINE__), NULL)) + #endif + This is the structure which defines the type of BFD this is. The +`xvec' member of the struct `bfd' itself points here. Each module that +implements access to a different target under BFD, defines one of these. + + FIXME, these names should be rationalised with the names of the +entry points which call them. Too bad we can't have one macro to define +them both! + enum bfd_flavour { + bfd_target_unknown_flavour, + bfd_target_aout_flavour, + bfd_target_coff_flavour, + bfd_target_ecoff_flavour, + bfd_target_elf_flavour, + bfd_target_ieee_flavour, + bfd_target_nlm_flavour, + bfd_target_oasys_flavour, + bfd_target_tekhex_flavour, + bfd_target_srec_flavour, + bfd_target_ihex_flavour, + bfd_target_som_flavour, + bfd_target_os9k_flavour, + bfd_target_versados_flavour, + bfd_target_msdos_flavour, + bfd_target_evax_flavour + }; + + enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN }; + + /* Forward declaration. */ + typedef struct bfd_link_info _bfd_link_info; + + typedef struct bfd_target + { + Identifies the kind of target, e.g., SunOS4, Ultrix, etc. + char *name; + The "flavour" of a back end is a general indication about the +contents of a file. + enum bfd_flavour flavour; + The order of bytes within the data area of a file. + enum bfd_endian byteorder; + The order of bytes within the header parts of a file. + enum bfd_endian header_byteorder; + A mask of all the flags which an executable may have set - from the +set `BFD_NO_FLAGS', `HAS_RELOC', ...`D_PAGED'. + flagword object_flags; + A mask of all the flags which a section may have set - from the set +`SEC_NO_FLAGS', `SEC_ALLOC', ...`SET_NEVER_LOAD'. + flagword section_flags; + The character normally found at the front of a symbol (if any), +perhaps `_'. + char symbol_leading_char; + The pad character for file names within an archive header. + char ar_pad_char; + The maximum number of characters in an archive header. + unsigned short ar_max_namelen; + Entries for byte swapping for data. These are different from the +other entry points, since they don't take a BFD asthe first argument. +Certain other handlers could do the same. + bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *)); + void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *)); + void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *)); + void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); + Byte swapping for the headers + bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *)); + void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *)); + void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *)); + void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); + Format dependent routines: these are vectors of entry points within +the target vector structure, one for each format to check. + + Check the format of a file being read. Return a `bfd_target *' or +zero. + const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *)); + Set the format of a file being written. + boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); + Write cached information into a file being written, at `bfd_close'. + boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); + The general target vector. + + /* Generic entry points. */ + #define BFD_JUMP_TABLE_GENERIC(NAME)\ + CAT(NAME,_close_and_cleanup),\ + CAT(NAME,_bfd_free_cached_info),\ + CAT(NAME,_new_section_hook),\ + CAT(NAME,_get_section_contents),\ + CAT(NAME,_get_section_contents_in_window) + + /* Called when the BFD is being closed to do any necessary cleanup. */ + boolean (*_close_and_cleanup) PARAMS ((bfd *)); + /* Ask the BFD to free all cached information. */ + boolean (*_bfd_free_cached_info) PARAMS ((bfd *)); + /* Called when a new section is created. */ + boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); + /* Read the contents of a section. */ + boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, + file_ptr, bfd_size_type)); + boolean (*_bfd_get_section_contents_in_window) + PARAMS ((bfd *, sec_ptr, bfd_window *, + file_ptr, bfd_size_type)); + + /* Entry points to copy private data. */ + #define BFD_JUMP_TABLE_COPY(NAME)\ + CAT(NAME,_bfd_copy_private_bfd_data),\ + CAT(NAME,_bfd_merge_private_bfd_data),\ + CAT(NAME,_bfd_copy_private_section_data),\ + CAT(NAME,_bfd_copy_private_symbol_data),\ + CAT(NAME,_bfd_set_private_flags),\ + CAT(NAME,_bfd_print_private_bfd_data)\ + /* Called to copy BFD general private data from one object file + to another. */ + boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *)); + /* Called to merge BFD general private data from one object file + to a common output file when linking. */ + boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *)); + /* Called to copy BFD private section data from one object file + to another. */ + boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr, + bfd *, sec_ptr)); + /* Called to copy BFD private symbol data from one symbol + to another. */ + boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *, + bfd *, asymbol *)); + /* Called to set private backend flags */ + boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword)); + + /* Called to print private BFD data */ + boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR)); + + /* Core file entry points. */ + #define BFD_JUMP_TABLE_CORE(NAME)\ + CAT(NAME,_core_file_failing_command),\ + CAT(NAME,_core_file_failing_signal),\ + CAT(NAME,_core_file_matches_executable_p) + char * (*_core_file_failing_command) PARAMS ((bfd *)); + int (*_core_file_failing_signal) PARAMS ((bfd *)); + boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *)); + + /* Archive entry points. */ + #define BFD_JUMP_TABLE_ARCHIVE(NAME)\ + CAT(NAME,_slurp_armap),\ + CAT(NAME,_slurp_extended_name_table),\ + CAT(NAME,_construct_extended_name_table),\ + CAT(NAME,_truncate_arname),\ + CAT(NAME,_write_armap),\ + CAT(NAME,_read_ar_hdr),\ + CAT(NAME,_openr_next_archived_file),\ + CAT(NAME,_get_elt_at_index),\ + CAT(NAME,_generic_stat_arch_elt),\ + CAT(NAME,_update_armap_timestamp) + boolean (*_bfd_slurp_armap) PARAMS ((bfd *)); + boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *)); + boolean (*_bfd_construct_extended_name_table) + PARAMS ((bfd *, char **, bfd_size_type *, const char **)); + void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *)); + boolean (*write_armap) PARAMS ((bfd *arch, + unsigned int elength, + struct orl *map, + unsigned int orl_count, + int stridx)); + PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *)); + bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev)); + #define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i)) + bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex)); + int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *)); + boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *)); + + /* Entry points used for symbols. */ + #define BFD_JUMP_TABLE_SYMBOLS(NAME)\ + CAT(NAME,_get_symtab_upper_bound),\ + CAT(NAME,_get_symtab),\ + CAT(NAME,_make_empty_symbol),\ + CAT(NAME,_print_symbol),\ + CAT(NAME,_get_symbol_info),\ + CAT(NAME,_bfd_is_local_label_name),\ + CAT(NAME,_get_lineno),\ + CAT(NAME,_find_nearest_line),\ + CAT(NAME,_bfd_make_debug_symbol),\ + CAT(NAME,_read_minisymbols),\ + CAT(NAME,_minisymbol_to_symbol) + long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *)); + long (*_bfd_canonicalize_symtab) PARAMS ((bfd *, + struct symbol_cache_entry **)); + struct symbol_cache_entry * + (*_bfd_make_empty_symbol) PARAMS ((bfd *)); + void (*_bfd_print_symbol) PARAMS ((bfd *, PTR, + struct symbol_cache_entry *, + bfd_print_symbol_type)); + #define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e)) + void (*_bfd_get_symbol_info) PARAMS ((bfd *, + struct symbol_cache_entry *, + symbol_info *)); + #define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e)) + boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *)); + + alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); + boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd, + struct sec *section, struct symbol_cache_entry **symbols, + bfd_vma offset, CONST char **file, CONST char **func, + unsigned int *line)); + /* Back-door to allow format-aware applications to create debug symbols + while using BFD for everything else. Currently used by the assembler + when creating COFF files. */ + asymbol * (*_bfd_make_debug_symbol) PARAMS (( + bfd *abfd, + void *ptr, + unsigned long size)); + #define bfd_read_minisymbols(b, d, m, s) \ + BFD_SEND (b, _read_minisymbols, (b, d, m, s)) + long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *, + unsigned int *)); + #define bfd_minisymbol_to_symbol(b, d, m, f) \ + BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) + asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR, + asymbol *)); + + /* Routines for relocs. */ + #define BFD_JUMP_TABLE_RELOCS(NAME)\ + CAT(NAME,_get_reloc_upper_bound),\ + CAT(NAME,_canonicalize_reloc),\ + CAT(NAME,_bfd_reloc_type_lookup) + long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr)); + long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, + struct symbol_cache_entry **)); + /* See documentation on reloc types. */ + reloc_howto_type * + (*reloc_type_lookup) PARAMS ((bfd *abfd, + bfd_reloc_code_real_type code)); + + /* Routines used when writing an object file. */ + #define BFD_JUMP_TABLE_WRITE(NAME)\ + CAT(NAME,_set_arch_mach),\ + CAT(NAME,_set_section_contents) + boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture, + unsigned long)); + boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR, + file_ptr, bfd_size_type)); + + /* Routines used by the linker. */ + #define BFD_JUMP_TABLE_LINK(NAME)\ + CAT(NAME,_sizeof_headers),\ + CAT(NAME,_bfd_get_relocated_section_contents),\ + CAT(NAME,_bfd_relax_section),\ + CAT(NAME,_bfd_link_hash_table_create),\ + CAT(NAME,_bfd_link_add_symbols),\ + CAT(NAME,_bfd_final_link),\ + CAT(NAME,_bfd_link_split_section) + int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean)); + bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *, + struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *data, boolean relocateable, + struct symbol_cache_entry **)); + + boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *, + struct bfd_link_info *, boolean *again)); + + /* Create a hash table for the linker. Different backends store + different information in this table. */ + struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *)); + + /* Add symbols from this object file into the hash table. */ + boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, 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 *)); + + /* Should this section be split up into smaller pieces during linking. */ + boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *)); + + /* Routines to handle dynamic symbols and relocs. */ + #define BFD_JUMP_TABLE_DYNAMIC(NAME)\ + CAT(NAME,_get_dynamic_symtab_upper_bound),\ + CAT(NAME,_canonicalize_dynamic_symtab),\ + CAT(NAME,_get_dynamic_reloc_upper_bound),\ + CAT(NAME,_canonicalize_dynamic_reloc) + /* Get the amount of memory required to hold the dynamic symbols. */ + long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *)); + /* Read in the dynamic symbols. */ + long (*_bfd_canonicalize_dynamic_symtab) + PARAMS ((bfd *, struct symbol_cache_entry **)); + /* Get the amount of memory required to hold the dynamic relocs. */ + long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *)); + /* Read in the dynamic relocs. */ + long (*_bfd_canonicalize_dynamic_reloc) + PARAMS ((bfd *, arelent **, struct symbol_cache_entry **)); + Data for use by back-end routines, which isn't generic enough to +belong in this structure. + PTR backend_data; + } bfd_target; + +`bfd_set_default_target' +........................ + +*Synopsis* + boolean bfd_set_default_target (const char *name); + *Description* +Set the default target vector to use when recognizing a BFD. This +takes the name of the target, which may be a BFD target name or a +configuration triplet. +`bfd_find_target' +................. + +*Synopsis* + const bfd_target *bfd_find_target(CONST char *target_name, bfd *abfd); + *Description* +Return a pointer to the transfer vector for the object target named +TARGET_NAME. If TARGET_NAME is `NULL', choose the one in the +environment variable `GNUTARGET'; if that is null or not defined, then +choose the first entry in the target list. Passing in the string +"default" or setting the environment variable to "default" will cause +the first entry in the target list to be returned, and +"target_defaulted" will be set in the BFD. This causes +`bfd_check_format' to loop over all the targets to find the one that +matches the file being read. +`bfd_target_list' +................. + +*Synopsis* + const char **bfd_target_list(void); + *Description* +Return a freshly malloced NULL-terminated vector of the names of all +the valid BFD targets. Do not modify the names. + +File: bfd.info, Node: Architectures, Next: Opening and Closing, Prev: Targets, Up: BFD front end + +Architectures +============= + +BFD keeps one atom in a BFD describing the architecture of the data +attached to the BFD: a pointer to a `bfd_arch_info_type'. + + Pointers to structures can be requested independently of a BFD so +that an architecture's information can be interrogated without access +to an open BFD. + + The architecture information is provided by each architecture +package. The set of default architectures is selected by the macro +`SELECT_ARCHITECTURES'. This is normally set up in the +`config/TARGET.mt' file of your choice. If the name is not defined, +then all the architectures supported are included. + + When BFD starts up, all the architectures are called with an +initialize method. It is up to the architecture back end to insert as +many items into the list of architectures as it wants to; generally +this would be one for each machine and one for the default case (an +item with a machine field of 0). + + BFD's idea of an architecture is implemented in `archures.c'. +bfd_architecture +---------------- + +*Description* +This enum gives the object file's CPU architecture, in a global +sense--i.e., what processor family does it belong to? Another field +indicates which processor within the family is in use. The machine +gives a number which distinguishes different versions of the +architecture, containing, for example, 2 and 3 for Intel i960 KA and +i960 KB, and 68020 and 68030 for Motorola 68020 and 68030. + enum bfd_architecture + { + bfd_arch_unknown, /* File arch not known */ + bfd_arch_obscure, /* Arch known, not one of these */ + bfd_arch_m68k, /* Motorola 68xxx */ + bfd_arch_vax, /* DEC Vax */ + bfd_arch_i960, /* Intel 960 */ + /* The order of the following is important. + lower number indicates a machine type that + only accepts a subset of the instructions + available to machines with higher numbers. + The exception is the "ca", which is + incompatible with all other machines except + "core". */ + + #define bfd_mach_i960_core 1 + #define bfd_mach_i960_ka_sa 2 + #define bfd_mach_i960_kb_sb 3 + #define bfd_mach_i960_mc 4 + #define bfd_mach_i960_xa 5 + #define bfd_mach_i960_ca 6 + #define bfd_mach_i960_jx 7 + #define bfd_mach_i960_hx 8 + + bfd_arch_a29k, /* AMD 29000 */ + bfd_arch_sparc, /* SPARC */ + #define bfd_mach_sparc 1 + /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */ + #define bfd_mach_sparc_sparclet 2 + #define bfd_mach_sparc_sparclite 3 + #define bfd_mach_sparc_v8plus 4 + #define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns */ + #define bfd_mach_sparc_v9 6 + #define bfd_mach_sparc_v9a 7 /* with ultrasparc add'ns */ + /* Nonzero if MACH has the v9 instruction set. */ + #define bfd_mach_sparc_v9_p(mach) \ + ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a) + bfd_arch_mips, /* MIPS Rxxxx */ + bfd_arch_i386, /* Intel 386 */ + #define bfd_mach_i386_i386 0 + #define bfd_mach_i386_i8086 1 + bfd_arch_we32k, /* AT&T WE32xxx */ + bfd_arch_tahoe, /* CCI/Harris Tahoe */ + bfd_arch_i860, /* Intel 860 */ + bfd_arch_romp, /* IBM ROMP PC/RT */ + bfd_arch_alliant, /* Alliant */ + bfd_arch_convex, /* Convex */ + bfd_arch_m88k, /* Motorola 88xxx */ + bfd_arch_pyramid, /* Pyramid Technology */ + bfd_arch_h8300, /* Hitachi H8/300 */ + #define bfd_mach_h8300 1 + #define bfd_mach_h8300h 2 + #define bfd_mach_h8300s 3 + bfd_arch_powerpc, /* PowerPC */ + bfd_arch_rs6000, /* IBM RS/6000 */ + bfd_arch_hppa, /* HP PA RISC */ + bfd_arch_d10v, /* Mitsubishi D10V */ + bfd_arch_z8k, /* Zilog Z8000 */ + #define bfd_mach_z8001 1 + #define bfd_mach_z8002 2 + bfd_arch_h8500, /* Hitachi H8/500 */ + bfd_arch_sh, /* Hitachi SH */ + bfd_arch_alpha, /* Dec Alpha */ + bfd_arch_arm, /* Advanced Risc Machines ARM */ + bfd_arch_ns32k, /* National Semiconductors ns32000 */ + bfd_arch_w65, /* WDC 65816 */ + bfd_arch_m32r, /* Mitsubishi M32R/D */ + bfd_arch_mn10200, /* Matsushita MN10200 */ + bfd_arch_mn10300, /* Matsushita MN10300 */ + bfd_arch_last + }; + +bfd_arch_info +------------- + +*Description* +This structure contains information on architectures for use within BFD. + + typedef struct bfd_arch_info + { + int bits_per_word; + int bits_per_address; + int bits_per_byte; + enum bfd_architecture arch; + unsigned long mach; + const char *arch_name; + const char *printable_name; + unsigned int section_align_power; + /* true if this is the default machine for the architecture */ + boolean the_default; + const struct bfd_arch_info * (*compatible) + PARAMS ((const struct bfd_arch_info *a, + const struct bfd_arch_info *b)); + + boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *)); + + const struct bfd_arch_info *next; + } bfd_arch_info_type; + +`bfd_printable_name' +.................... + +*Synopsis* + const char *bfd_printable_name(bfd *abfd); + *Description* +Return a printable string representing the architecture and machine +from the pointer to the architecture info structure. +`bfd_scan_arch' +............... + +*Synopsis* + const bfd_arch_info_type *bfd_scan_arch(const char *string); + *Description* +Figure out if BFD supports any cpu which could be described with the +name STRING. Return a pointer to an `arch_info' structure if a machine +is found, otherwise NULL. +`bfd_arch_get_compatible' +......................... + +*Synopsis* + const bfd_arch_info_type *bfd_arch_get_compatible( + const bfd *abfd, + const bfd *bbfd); + *Description* +Determine whether two BFDs' architectures and machine types are +compatible. Calculates the lowest common denominator between the two +architectures and machine types implied by the BFDs and returns a +pointer to an `arch_info' structure describing the compatible machine. +`bfd_default_arch_struct' +......................... + +*Description* +The `bfd_default_arch_struct' is an item of `bfd_arch_info_type' which +has been initialized to a fairly generic state. A BFD starts life by +pointing to this structure, until the correct back end has determined +the real architecture of the file. + extern const bfd_arch_info_type bfd_default_arch_struct; + +`bfd_set_arch_info' +................... + +*Synopsis* + void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg); + *Description* +Set the architecture info of ABFD to ARG. +`bfd_default_set_arch_mach' +........................... + +*Synopsis* + boolean bfd_default_set_arch_mach(bfd *abfd, + enum bfd_architecture arch, + unsigned long mach); + *Description* +Set the architecture and machine type in BFD ABFD to ARCH and MACH. +Find the correct pointer to a structure and insert it into the +`arch_info' pointer. +`bfd_get_arch' +.............. + +*Synopsis* + enum bfd_architecture bfd_get_arch(bfd *abfd); + *Description* +Return the enumerated type which describes the BFD ABFD's architecture. +`bfd_get_mach' +.............. + +*Synopsis* + unsigned long bfd_get_mach(bfd *abfd); + *Description* +Return the long type which describes the BFD ABFD's machine. +`bfd_arch_bits_per_byte' +........................ + +*Synopsis* + unsigned int bfd_arch_bits_per_byte(bfd *abfd); + *Description* +Return the number of bits in one of the BFD ABFD's architecture's bytes. +`bfd_arch_bits_per_address' +........................... + +*Synopsis* + unsigned int bfd_arch_bits_per_address(bfd *abfd); + *Description* +Return the number of bits in one of the BFD ABFD's architecture's +addresses. +`bfd_default_compatible' +........................ + +*Synopsis* + const bfd_arch_info_type *bfd_default_compatible + (const bfd_arch_info_type *a, + const bfd_arch_info_type *b); + *Description* +The default function for testing for compatibility. +`bfd_default_scan' +.................. + +*Synopsis* + boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string); + *Description* +The default function for working out whether this is an architecture +hit and a machine hit. +`bfd_get_arch_info' +................... + +*Synopsis* + const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd); + *Description* +Return the architecture info struct in ABFD. +`bfd_lookup_arch' +................. + +*Synopsis* + const bfd_arch_info_type *bfd_lookup_arch + (enum bfd_architecture + arch, + unsigned long machine); + *Description* +Look for the architecure info structure which matches the arguments +ARCH and MACHINE. A machine of 0 matches the machine/architecture +structure which marks itself as the default. +`bfd_printable_arch_mach' +......................... + +*Synopsis* + const char *bfd_printable_arch_mach + (enum bfd_architecture arch, unsigned long machine); + *Description* +Return a printable string representing the architecture and machine +type. + + This routine is depreciated. + +File: bfd.info, Node: Opening and Closing, Next: Internal, Prev: Architectures, Up: BFD front end + +Opening and closing BFDs +======================== + +`bfd_openr' +........... + +*Synopsis* + bfd *bfd_openr(CONST char *filename, CONST char *target); + *Description* +Open the file FILENAME (using `fopen') with the target TARGET. Return +a pointer to the created BFD. + + Calls `bfd_find_target', so TARGET is interpreted as by that +function. + + If `NULL' is returned then an error has occured. Possible errors +are `bfd_error_no_memory', `bfd_error_invalid_target' or `system_call' +error. +`bfd_fdopenr' +............. + +*Synopsis* + bfd *bfd_fdopenr(CONST char *filename, CONST char *target, int fd); + *Description* +`bfd_fdopenr' is to `bfd_fopenr' much like `fdopen' is to `fopen'. It +opens a BFD on a file already described by the FD supplied. + + When the file is later `bfd_close'd, the file descriptor will be +closed. + + If the caller desires that this file descriptor be cached by BFD +(opened as needed, closed as needed to free descriptors for other +opens), with the supplied FD used as an initial file descriptor (but +subject to closure at any time), call bfd_set_cacheable(bfd, 1) on the +returned BFD. The default is to assume no cacheing; the file +descriptor will remain open until `bfd_close', and will not be affected +by BFD operations on other files. + + Possible errors are `bfd_error_no_memory', +`bfd_error_invalid_target' and `bfd_error_system_call'. +`bfd_openstreamr' +................. + +*Synopsis* + bfd *bfd_openstreamr(const char *, const char *, PTR); + *Description* +Open a BFD for read access on an existing stdio stream. When the BFD +is passed to `bfd_close', the stream will be closed. +`bfd_openw' +........... + +*Synopsis* + bfd *bfd_openw(CONST char *filename, CONST char *target); + *Description* +Create a BFD, associated with file FILENAME, using the file format +TARGET, and return a pointer to it. + + Possible errors are `bfd_error_system_call', `bfd_error_no_memory', +`bfd_error_invalid_target'. +`bfd_close' +........... + +*Synopsis* + boolean bfd_close(bfd *abfd); + *Description* +Close a BFD. If the BFD was open for writing, then pending operations +are completed and the file written out and closed. If the created file +is executable, then `chmod' is called to mark it as such. + + All memory attached to the BFD is released. + + The file descriptor associated with the BFD is closed (even if it +was passed in to BFD by `bfd_fdopenr'). +*Returns* +`true' is returned if all is ok, otherwise `false'. +`bfd_close_all_done' +.................... + +*Synopsis* + boolean bfd_close_all_done(bfd *); + *Description* +Close a BFD. Differs from `bfd_close' since it does not complete any +pending operations. This routine would be used if the application had +just used BFD for swapping and didn't want to use any of the writing +code. + + If the created file is executable, then `chmod' is called to mark it +as such. + + All memory attached to the BFD is released. +*Returns* +`true' is returned if all is ok, otherwise `false'. +`bfd_create' +............ + +*Synopsis* + bfd *bfd_create(CONST char *filename, bfd *templ); + *Description* +Create a new BFD in the manner of `bfd_openw', but without opening a +file. The new BFD takes the target from the target used by TEMPLATE. The +format is always set to `bfd_object'. +`bfd_alloc' +........... + +*Synopsis* + PTR bfd_alloc (bfd *abfd, size_t wanted); + *Description* +Allocate a block of WANTED bytes of memory attached to `abfd' and +return a pointer to it. diff -urN binutils-2.7/bfd/doc/bfd.info-4 binutils-2.8/bfd/doc/bfd.info-4 --- binutils-2.7/bfd/doc/bfd.info-4 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/bfd.info-4 Wed Apr 30 13:14:27 1997 @@ -0,0 +1,1023 @@ +This is Info file bfd.info, produced by Makeinfo-1.64 from the input +file ./bfd.texinfo. + +START-INFO-DIR-ENTRY +* Bfd: (bfd). The Binary File Descriptor library. +END-INFO-DIR-ENTRY + + This file documents the BFD library. + + Copyright (C) 1991 Free Software Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, subject to the +terms of the GNU General Public License, which includes the provision +that the entire resulting derived work is distributed under the terms +of a permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions. + + +File: bfd.info, Node: Internal, Next: File Caching, Prev: Opening and Closing, Up: BFD front end + +Internal functions +================== + +*Description* +These routines are used within BFD. They are not intended for export, +but are documented here for completeness. +`bfd_write_bigendian_4byte_int' +............................... + +*Synopsis* + void bfd_write_bigendian_4byte_int(bfd *abfd, int i); + *Description* +Write a 4 byte integer I to the output BFD ABFD, in big endian order +regardless of what else is going on. This is useful in archives. +`bfd_put_size' +.............. + +`bfd_get_size' +.............. + +*Description* +These macros as used for reading and writing raw data in sections; each +access (except for bytes) is vectored through the target format of the +BFD and mangled accordingly. The mangling performs any necessary endian +translations and removes alignment restrictions. Note that types +accepted and returned by these macros are identical so they can be +swapped around in macros--for example, `libaout.h' defines `GET_WORD' +to either `bfd_get_32' or `bfd_get_64'. + + In the put routines, VAL must be a `bfd_vma'. If we are on a system +without prototypes, the caller is responsible for making sure that is +true, with a cast if necessary. We don't cast them in the macro +definitions because that would prevent `lint' or `gcc -Wall' from +detecting sins such as passing a pointer. To detect calling these with +less than a `bfd_vma', use `gcc -Wconversion' on a host with 64 bit +`bfd_vma''s. + + /* Byte swapping macros for user section data. */ + + #define bfd_put_8(abfd, val, ptr) \ + (*((unsigned char *)(ptr)) = (unsigned char)(val)) + #define bfd_put_signed_8 \ + bfd_put_8 + #define bfd_get_8(abfd, ptr) \ + (*(unsigned char *)(ptr)) + #define bfd_get_signed_8(abfd, ptr) \ + ((*(unsigned char *)(ptr) ^ 0x80) - 0x80) + + #define bfd_put_16(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_putx16, ((val),(ptr))) + #define bfd_put_signed_16 \ + bfd_put_16 + #define bfd_get_16(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx16, (ptr)) + #define bfd_get_signed_16(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) + + #define bfd_put_32(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_putx32, ((val),(ptr))) + #define bfd_put_signed_32 \ + bfd_put_32 + #define bfd_get_32(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx32, (ptr)) + #define bfd_get_signed_32(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx_signed_32, (ptr)) + + #define bfd_put_64(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_putx64, ((val), (ptr))) + #define bfd_put_signed_64 \ + bfd_put_64 + #define bfd_get_64(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx64, (ptr)) + #define bfd_get_signed_64(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx_signed_64, (ptr)) + +`bfd_h_put_size' +................ + +*Description* +These macros have the same function as their `bfd_get_x' bretheren, +except that they are used for removing information for the header +records of object files. Believe it or not, some object files keep +their header records in big endian order and their data in little +endian order. + + /* Byte swapping macros for file header data. */ + + #define bfd_h_put_8(abfd, val, ptr) \ + bfd_put_8 (abfd, val, ptr) + #define bfd_h_put_signed_8(abfd, val, ptr) \ + bfd_put_8 (abfd, val, ptr) + #define bfd_h_get_8(abfd, ptr) \ + bfd_get_8 (abfd, ptr) + #define bfd_h_get_signed_8(abfd, ptr) \ + bfd_get_signed_8 (abfd, ptr) + + #define bfd_h_put_16(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_h_putx16,(val,ptr)) + #define bfd_h_put_signed_16 \ + bfd_h_put_16 + #define bfd_h_get_16(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx16,(ptr)) + #define bfd_h_get_signed_16(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr)) + + #define bfd_h_put_32(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_h_putx32,(val,ptr)) + #define bfd_h_put_signed_32 \ + bfd_h_put_32 + #define bfd_h_get_32(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx32,(ptr)) + #define bfd_h_get_signed_32(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr)) + + #define bfd_h_put_64(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_h_putx64,(val, ptr)) + #define bfd_h_put_signed_64 \ + bfd_h_put_64 + #define bfd_h_get_64(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx64,(ptr)) + #define bfd_h_get_signed_64(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr)) + +`bfd_log2' +.......... + +*Synopsis* + unsigned int bfd_log2(bfd_vma x); + *Description* +Return the log base 2 of the value supplied, rounded up. E.g., an X of +1025 returns 11. + +File: bfd.info, Node: File Caching, Next: Linker Functions, Prev: Internal, Up: BFD front end + +File caching +============ + +The file caching mechanism is embedded within BFD and allows the +application to open as many BFDs as it wants without regard to the +underlying operating system's file descriptor limit (often as low as 20 +open files). The module in `cache.c' maintains a least recently used +list of `BFD_CACHE_MAX_OPEN' files, and exports the name +`bfd_cache_lookup', which runs around and makes sure that the required +BFD is open. If not, then it chooses a file to close, closes it and +opens the one wanted, returning its file handle. +`BFD_CACHE_MAX_OPEN macro' +.......................... + +*Description* +The maximum number of files which the cache will keep open at one time. + #define BFD_CACHE_MAX_OPEN 10 + +`bfd_last_cache' +................ + +*Synopsis* + extern bfd *bfd_last_cache; + *Description* +Zero, or a pointer to the topmost BFD on the chain. This is used by +the `bfd_cache_lookup' macro in `libbfd.h' to determine when it can +avoid a function call. +`bfd_cache_lookup' +.................. + +*Description* +Check to see if the required BFD is the same as the last one looked up. +If so, then it can use the stream in the BFD with impunity, since it +can't have changed since the last lookup; otherwise, it has to perform +the complicated lookup function. + #define bfd_cache_lookup(x) \ + ((x)==bfd_last_cache? \ + (FILE*)(bfd_last_cache->iostream): \ + bfd_cache_lookup_worker(x)) + +`bfd_cache_init' +................ + +*Synopsis* + boolean bfd_cache_init (bfd *abfd); + *Description* +Add a newly opened BFD to the cache. +`bfd_cache_close' +................. + +*Synopsis* + boolean bfd_cache_close (bfd *abfd); + *Description* +Remove the BFD ABFD from the cache. If the attached file is open, then +close it too. +*Returns* +`false' is returned if closing the file fails, `true' is returned if +all is well. +`bfd_open_file' +............... + +*Synopsis* + FILE* bfd_open_file(bfd *abfd); + *Description* +Call the OS to open a file for ABFD. Return the `FILE *' (possibly +`NULL') that results from this operation. Set up the BFD so that +future accesses know the file is open. If the `FILE *' returned is +`NULL', then it won't have been put in the cache, so it won't have to +be removed from it. +`bfd_cache_lookup_worker' +......................... + +*Synopsis* + FILE *bfd_cache_lookup_worker(bfd *abfd); + *Description* +Called when the macro `bfd_cache_lookup' fails to find a quick answer. +Find a file descriptor for ABFD. If necessary, it open it. If there +are already more than `BFD_CACHE_MAX_OPEN' files open, it tries to +close one first, to avoid running out of file descriptors. + +File: bfd.info, Node: Linker Functions, Next: Hash Tables, Prev: File Caching, Up: BFD front end + +Linker Functions +================ + +The linker uses three special entry points in the BFD target vector. +It is not necessary to write special routines for these entry points +when creating a new BFD back end, since generic versions are provided. +However, writing them can speed up linking and make it use +significantly less runtime memory. + + The first routine creates a hash table used by the other routines. +The second routine adds the symbols from an object file to the hash +table. The third routine takes all the object files and links them +together to create the output file. These routines are designed so +that the linker proper does not need to know anything about the symbols +in the object files that it is linking. The linker merely arranges the +sections as directed by the linker script and lets BFD handle the +details of symbols and relocs. + + The second routine and third routines are passed a pointer to a +`struct bfd_link_info' structure (defined in `bfdlink.h') which holds +information relevant to the link, including the linker hash table +(which was created by the first routine) and a set of callback +functions to the linker proper. + + The generic linker routines are in `linker.c', and use the header +file `genlink.h'. As of this writing, the only back ends which have +implemented versions of these routines are a.out (in `aoutx.h') and +ECOFF (in `ecoff.c'). The a.out routines are used as examples +throughout this section. + +* Menu: + +* Creating a Linker Hash Table:: +* Adding Symbols to the Hash Table:: +* Performing the Final Link:: + + +File: bfd.info, Node: Creating a Linker Hash Table, Next: Adding Symbols to the Hash Table, Prev: Linker Functions, Up: Linker Functions + +Creating a linker hash table +---------------------------- + +The linker routines must create a hash table, which must be derived +from `struct bfd_link_hash_table' described in `bfdlink.c'. *Note Hash +Tables:: for information on how to create a derived hash table. This +entry point is called using the target vector of the linker output file. + + The `_bfd_link_hash_table_create' entry point must allocate and +initialize an instance of the desired hash table. If the back end does +not require any additional information to be stored with the entries in +the hash table, the entry point may simply create a `struct +bfd_link_hash_table'. Most likely, however, some additional +information will be needed. + + For example, with each entry in the hash table the a.out linker +keeps the index the symbol has in the final output file (this index +number is used so that when doing a relocateable link the symbol index +used in the output file can be quickly filled in when copying over a +reloc). The a.out linker code defines the required structures and +functions for a hash table derived from `struct bfd_link_hash_table'. +The a.out linker hash table is created by the function +`NAME(aout,link_hash_table_create)'; it simply allocates space for the +hash table, initializes it, and returns a pointer to it. + + When writing the linker routines for a new back end, you will +generally not know exactly which fields will be required until you have +finished. You should simply create a new hash table which defines no +additional fields, and then simply add fields as they become necessary. + +File: bfd.info, Node: Adding Symbols to the Hash Table, Next: Performing the Final Link, Prev: Creating a Linker Hash Table, Up: Linker Functions + +Adding symbols to the hash table +-------------------------------- + +The linker proper will call the `_bfd_link_add_symbols' entry point for +each object file or archive which is to be linked (typically these are +the files named on the command line, but some may also come from the +linker script). The entry point is responsible for examining the file. +For an object file, BFD must add any relevant symbol information to +the hash table. For an archive, BFD must determine which elements of +the archive should be used and adding them to the link. + + The a.out version of this entry point is +`NAME(aout,link_add_symbols)'. + +* Menu: + +* Differing file formats:: +* Adding symbols from an object file:: +* Adding symbols from an archive:: + + +File: bfd.info, Node: Differing file formats, Next: Adding symbols from an object file, Prev: Adding Symbols to the Hash Table, Up: Adding Symbols to the Hash Table + +Differing file formats +...................... + +Normally all the files involved in a link will be of the same format, +but it is also possible to link together different format object files, +and the back end must support that. The `_bfd_link_add_symbols' entry +point is called via the target vector of the file to be added. This +has an important consequence: the function may not assume that the hash +table is the type created by the corresponding +`_bfd_link_hash_table_create' vector. All the `_bfd_link_add_symbols' +function can assume about the hash table is that it is derived from +`struct bfd_link_hash_table'. + + Sometimes the `_bfd_link_add_symbols' function must store some +information in the hash table entry to be used by the `_bfd_final_link' +function. In such a case the `creator' field of the hash table must be +checked to make sure that the hash table was created by an object file +of the same format. + + The `_bfd_final_link' routine must be prepared to handle a hash +entry without any extra information added by the +`_bfd_link_add_symbols' function. A hash entry without extra +information will also occur when the linker script directs the linker +to create a symbol. Note that, regardless of how a hash table entry is +added, all the fields will be initialized to some sort of null value by +the hash table entry initialization function. + + See `ecoff_link_add_externals' for an example of how to check the +`creator' field before saving information (in this case, the ECOFF +external symbol debugging information) in a hash table entry. + +File: bfd.info, Node: Adding symbols from an object file, Next: Adding symbols from an archive, Prev: Differing file formats, Up: Adding Symbols to the Hash Table + +Adding symbols from an object file +.................................. + +When the `_bfd_link_add_symbols' routine is passed an object file, it +must add all externally visible symbols in that object file to the hash +table. The actual work of adding the symbol to the hash table is +normally handled by the function `_bfd_generic_link_add_one_symbol'. +The `_bfd_link_add_symbols' routine is responsible for reading all the +symbols from the object file and passing the correct information to +`_bfd_generic_link_add_one_symbol'. + + The `_bfd_link_add_symbols' routine should not use +`bfd_canonicalize_symtab' to read the symbols. The point of providing +this routine is to avoid the overhead of converting the symbols into +generic `asymbol' structures. + + `_bfd_generic_link_add_one_symbol' handles the details of combining +common symbols, warning about multiple definitions, and so forth. It +takes arguments which describe the symbol to add, notably symbol flags, +a section, and an offset. The symbol flags include such things as +`BSF_WEAK' or `BSF_INDIRECT'. The section is a section in the object +file, or something like `bfd_und_section_ptr' for an undefined symbol +or `bfd_com_section_ptr' for a common symbol. + + If the `_bfd_final_link' routine is also going to need to read the +symbol information, the `_bfd_link_add_symbols' routine should save it +somewhere attached to the object file BFD. However, the information +should only be saved if the `keep_memory' field of the `info' argument +is true, so that the `-no-keep-memory' linker switch is effective. + + The a.out function which adds symbols from an object file is +`aout_link_add_object_symbols', and most of the interesting work is in +`aout_link_add_symbols'. The latter saves pointers to the hash tables +entries created by `_bfd_generic_link_add_one_symbol' indexed by symbol +number, so that the `_bfd_final_link' routine does not have to call the +hash table lookup routine to locate the entry. + +File: bfd.info, Node: Adding symbols from an archive, Prev: Adding symbols from an object file, Up: Adding Symbols to the Hash Table + +Adding symbols from an archive +.............................. + +When the `_bfd_link_add_symbols' routine is passed an archive, it must +look through the symbols defined by the archive and decide which +elements of the archive should be included in the link. For each such +element it must call the `add_archive_element' linker callback, and it +must add the symbols from the object file to the linker hash table. + + In most cases the work of looking through the symbols in the archive +should be done by the `_bfd_generic_link_add_archive_symbols' function. +This function builds a hash table from the archive symbol table and +looks through the list of undefined symbols to see which elements +should be included. `_bfd_generic_link_add_archive_symbols' is passed +a function to call to make the final decision about adding an archive +element to the link and to do the actual work of adding the symbols to +the linker hash table. + + The function passed to `_bfd_generic_link_add_archive_symbols' must +read the symbols of the archive element and decide whether the archive +element should be included in the link. If the element is to be +included, the `add_archive_element' linker callback routine must be +called with the element as an argument, and the elements symbols must +be added to the linker hash table just as though the element had itself +been passed to the `_bfd_link_add_symbols' function. + + When the a.out `_bfd_link_add_symbols' function receives an archive, +it calls `_bfd_generic_link_add_archive_symbols' passing +`aout_link_check_archive_element' as the function argument. +`aout_link_check_archive_element' calls `aout_link_check_ar_symbols'. +If the latter decides to add the element (an element is only added if +it provides a real, non-common, definition for a previously undefined +or common symbol) it calls the `add_archive_element' callback and then +`aout_link_check_archive_element' calls `aout_link_add_symbols' to +actually add the symbols to the linker hash table. + + The ECOFF back end is unusual in that it does not normally call +`_bfd_generic_link_add_archive_symbols', because ECOFF archives already +contain a hash table of symbols. The ECOFF back end searches the +archive itself to avoid the overhead of creating a new hash table. + +File: bfd.info, Node: Performing the Final Link, Prev: Adding Symbols to the Hash Table, Up: Linker Functions + +Performing the final link +------------------------- + +When all the input files have been processed, the linker calls the +`_bfd_final_link' entry point of the output BFD. This routine is +responsible for producing the final output file, which has several +aspects. It must relocate the contents of the input sections and copy +the data into the output sections. It must build an output symbol +table including any local symbols from the input files and the global +symbols from the hash table. When producing relocateable output, it +must modify the input relocs and write them into the output file. +There may also be object format dependent work to be done. + + The linker will also call the `write_object_contents' entry point +when the BFD is closed. The two entry points must work together in +order to produce the correct output file. + + The details of how this works are inevitably dependent upon the +specific object file format. The a.out `_bfd_final_link' routine is +`NAME(aout,final_link)'. + +* Menu: + +* Information provided by the linker:: +* Relocating the section contents:: +* Writing the symbol table:: + + +File: bfd.info, Node: Information provided by the linker, Next: Relocating the section contents, Prev: Performing the Final Link, Up: Performing the Final Link + +Information provided by the linker +.................................. + +Before the linker calls the `_bfd_final_link' entry point, it sets up +some data structures for the function to use. + + The `input_bfds' field of the `bfd_link_info' structure will point +to a list of all the input files included in the link. These files are +linked through the `link_next' field of the `bfd' structure. + + Each section in the output file will have a list of `link_order' +structures attached to the `link_order_head' field (the `link_order' +structure is defined in `bfdlink.h'). These structures describe how to +create the contents of the output section in terms of the contents of +various input sections, fill constants, and, eventually, other types of +information. They also describe relocs that must be created by the BFD +backend, but do not correspond to any input file; this is used to +support -Ur, which builds constructors while generating a relocateable +object file. + +File: bfd.info, Node: Relocating the section contents, Next: Writing the symbol table, Prev: Information provided by the linker, Up: Performing the Final Link + +Relocating the section contents +............................... + +The `_bfd_final_link' function should look through the `link_order' +structures attached to each section of the output file. Each +`link_order' structure should either be handled specially, or it should +be passed to the function `_bfd_default_link_order' which will do the +right thing (`_bfd_default_link_order' is defined in `linker.c'). + + For efficiency, a `link_order' of type `bfd_indirect_link_order' +whose associated section belongs to a BFD of the same format as the +output BFD must be handled specially. This type of `link_order' +describes part of an output section in terms of a section belonging to +one of the input files. The `_bfd_final_link' function should read the +contents of the section and any associated relocs, apply the relocs to +the section contents, and write out the modified section contents. If +performing a relocateable link, the relocs themselves must also be +modified and written out. + + The functions `_bfd_relocate_contents' and +`_bfd_final_link_relocate' provide some general support for performing +the actual relocations, notably overflow checking. Their arguments +include information about the symbol the relocation is against and a +`reloc_howto_type' argument which describes the relocation to perform. +These functions are defined in `reloc.c'. + + The a.out function which handles reading, relocating, and writing +section contents is `aout_link_input_section'. The actual relocation +is done in `aout_link_input_section_std' and +`aout_link_input_section_ext'. + +File: bfd.info, Node: Writing the symbol table, Prev: Relocating the section contents, Up: Performing the Final Link + +Writing the symbol table +........................ + +The `_bfd_final_link' function must gather all the symbols in the input +files and write them out. It must also write out all the symbols in +the global hash table. This must be controlled by the `strip' and +`discard' fields of the `bfd_link_info' structure. + + The local symbols of the input files will not have been entered into +the linker hash table. The `_bfd_final_link' routine must consider +each input file and include the symbols in the output file. It may be +convenient to do this when looking through the `link_order' structures, +or it may be done by stepping through the `input_bfds' list. + + The `_bfd_final_link' routine must also traverse the global hash +table to gather all the externally visible symbols. It is possible +that most of the externally visible symbols may be written out when +considering the symbols of each input file, but it is still necessary +to traverse the hash table since the linker script may have defined +some symbols that are not in any of the input files. + + The `strip' field of the `bfd_link_info' structure controls which +symbols are written out. The possible values are listed in +`bfdlink.h'. If the value is `strip_some', then the `keep_hash' field +of the `bfd_link_info' structure is a hash table of symbols to keep; +each symbol should be looked up in this hash table, and only symbols +which are present should be included in the output file. + + If the `strip' field of the `bfd_link_info' structure permits local +symbols to be written out, the `discard' field is used to further +controls which local symbols are included in the output file. If the +value is `discard_l', then all local symbols which begin with a certain +prefix are discarded; this is controlled by the +`bfd_is_local_label_name' entry point. + + The a.out backend handles symbols by calling +`aout_link_write_symbols' on each input BFD and then traversing the +global hash table with the function `aout_link_write_other_symbol'. It +builds a string table while writing out the symbols, which is written +to the output file at the end of `NAME(aout,final_link)'. +`bfd_link_split_section' +........................ + +*Synopsis* + boolean bfd_link_split_section(bfd *abfd, asection *sec); + *Description* +Return nonzero if SEC should be split during a reloceatable or final +link. + #define bfd_link_split_section(abfd, sec) \ + BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec)) + + +File: bfd.info, Node: Hash Tables, Prev: Linker Functions, Up: BFD front end + +Hash Tables +=========== + +BFD provides a simple set of hash table functions. Routines are +provided to initialize a hash table, to free a hash table, to look up a +string in a hash table and optionally create an entry for it, and to +traverse a hash table. There is currently no routine to delete an +string from a hash table. + + The basic hash table does not permit any data to be stored with a +string. However, a hash table is designed to present a base class from +which other types of hash tables may be derived. These derived types +may store additional information with the string. Hash tables were +implemented in this way, rather than simply providing a data pointer in +a hash table entry, because they were designed for use by the linker +back ends. The linker may create thousands of hash table entries, and +the overhead of allocating private data and storing and following +pointers becomes noticeable. + + The basic hash table code is in `hash.c'. + +* Menu: + +* Creating and Freeing a Hash Table:: +* Looking Up or Entering a String:: +* Traversing a Hash Table:: +* Deriving a New Hash Table Type:: + + +File: bfd.info, Node: Creating and Freeing a Hash Table, Next: Looking Up or Entering a String, Prev: Hash Tables, Up: Hash Tables + +Creating and freeing a hash table +--------------------------------- + +To create a hash table, create an instance of a `struct bfd_hash_table' +(defined in `bfd.h') and call `bfd_hash_table_init' (if you know +approximately how many entries you will need, the function +`bfd_hash_table_init_n', which takes a SIZE argument, may be used). +`bfd_hash_table_init' returns `false' if some sort of error occurs. + + The function `bfd_hash_table_init' take as an argument a function to +use to create new entries. For a basic hash table, use the function +`bfd_hash_newfunc'. *Note Deriving a New Hash Table Type:: for why you +would want to use a different value for this argument. + + `bfd_hash_table_init' will create an objalloc which will be used to +allocate new entries. You may allocate memory on this objalloc using +`bfd_hash_allocate'. + + Use `bfd_hash_table_free' to free up all the memory that has been +allocated for a hash table. This will not free up the `struct +bfd_hash_table' itself, which you must provide. + +File: bfd.info, Node: Looking Up or Entering a String, Next: Traversing a Hash Table, Prev: Creating and Freeing a Hash Table, Up: Hash Tables + +Looking up or entering a string +------------------------------- + +The function `bfd_hash_lookup' is used both to look up a string in the +hash table and to create a new entry. + + If the CREATE argument is `false', `bfd_hash_lookup' will look up a +string. If the string is found, it will returns a pointer to a `struct +bfd_hash_entry'. If the string is not found in the table +`bfd_hash_lookup' will return `NULL'. You should not modify any of the +fields in the returns `struct bfd_hash_entry'. + + If the CREATE argument is `true', the string will be entered into +the hash table if it is not already there. Either way a pointer to a +`struct bfd_hash_entry' will be returned, either to the existing +structure or to a newly created one. In this case, a `NULL' return +means that an error occurred. + + If the CREATE argument is `true', and a new entry is created, the +COPY argument is used to decide whether to copy the string onto the +hash table objalloc or not. If COPY is passed as `false', you must be +careful not to deallocate or modify the string as long as the hash table +exists. + +File: bfd.info, Node: Traversing a Hash Table, Next: Deriving a New Hash Table Type, Prev: Looking Up or Entering a String, Up: Hash Tables + +Traversing a hash table +----------------------- + +The function `bfd_hash_traverse' may be used to traverse a hash table, +calling a function on each element. The traversal is done in a random +order. + + `bfd_hash_traverse' takes as arguments a function and a generic +`void *' pointer. The function is called with a hash table entry (a +`struct bfd_hash_entry *') and the generic pointer passed to +`bfd_hash_traverse'. The function must return a `boolean' value, which +indicates whether to continue traversing the hash table. If the +function returns `false', `bfd_hash_traverse' will stop the traversal +and return immediately. + +File: bfd.info, Node: Deriving a New Hash Table Type, Prev: Traversing a Hash Table, Up: Hash Tables + +Deriving a new hash table type +------------------------------ + +Many uses of hash tables want to store additional information which +each entry in the hash table. Some also find it convenient to store +additional information with the hash table itself. This may be done +using a derived hash table. + + Since C is not an object oriented language, creating a derived hash +table requires sticking together some boilerplate routines with a few +differences specific to the type of hash table you want to create. + + An example of a derived hash table is the linker hash table. The +structures for this are defined in `bfdlink.h'. The functions are in +`linker.c'. + + You may also derive a hash table from an already derived hash table. +For example, the a.out linker backend code uses a hash table derived +from the linker hash table. + +* Menu: + +* Define the Derived Structures:: +* Write the Derived Creation Routine:: +* Write Other Derived Routines:: + + +File: bfd.info, Node: Define the Derived Structures, Next: Write the Derived Creation Routine, Prev: Deriving a New Hash Table Type, Up: Deriving a New Hash Table Type + +Define the derived structures +............................. + +You must define a structure for an entry in the hash table, and a +structure for the hash table itself. + + The first field in the structure for an entry in the hash table must +be of the type used for an entry in the hash table you are deriving +from. If you are deriving from a basic hash table this is `struct +bfd_hash_entry', which is defined in `bfd.h'. The first field in the +structure for the hash table itself must be of the type of the hash +table you are deriving from itself. If you are deriving from a basic +hash table, this is `struct bfd_hash_table'. + + For example, the linker hash table defines `struct +bfd_link_hash_entry' (in `bfdlink.h'). The first field, `root', is of +type `struct bfd_hash_entry'. Similarly, the first field in `struct +bfd_link_hash_table', `table', is of type `struct bfd_hash_table'. + +File: bfd.info, Node: Write the Derived Creation Routine, Next: Write Other Derived Routines, Prev: Define the Derived Structures, Up: Deriving a New Hash Table Type + +Write the derived creation routine +.................................. + +You must write a routine which will create and initialize an entry in +the hash table. This routine is passed as the function argument to +`bfd_hash_table_init'. + + In order to permit other hash tables to be derived from the hash +table you are creating, this routine must be written in a standard way. + + The first argument to the creation routine is a pointer to a hash +table entry. This may be `NULL', in which case the routine should +allocate the right amount of space. Otherwise the space has already +been allocated by a hash table type derived from this one. + + After allocating space, the creation routine must call the creation +routine of the hash table type it is derived from, passing in a pointer +to the space it just allocated. This will initialize any fields used +by the base hash table. + + Finally the creation routine must initialize any local fields for +the new hash table type. + + Here is a boilerplate example of a creation routine. FUNCTION_NAME +is the name of the routine. ENTRY_TYPE is the type of an entry in the +hash table you are creating. BASE_NEWFUNC is the name of the creation +routine of the hash table type your hash table is derived from. +.struct bfd_hash_entry * + FUNCTION_NAME (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; + { + struct ENTRY_TYPE *ret = (ENTRY_TYPE *) entry; + + /* Allocate the structure if it has not already been allocated by a + derived class. */ + if (ret == (ENTRY_TYPE *) NULL) + { + ret = ((ENTRY_TYPE *) + bfd_hash_allocate (table, sizeof (ENTRY_TYPE))); + if (ret == (ENTRY_TYPE *) NULL) + return NULL; + } + + /* Call the allocation method of the base class. */ + ret = ((ENTRY_TYPE *) + BASE_NEWFUNC ((struct bfd_hash_entry *) ret, table, string)); + + /* Initialize the local fields here. */ + + return (struct bfd_hash_entry *) ret; + } + *Description* +The creation routine for the linker hash table, which is in `linker.c', +looks just like this example. FUNCTION_NAME is +`_bfd_link_hash_newfunc'. ENTRY_TYPE is `struct bfd_link_hash_entry'. +BASE_NEWFUNC is `bfd_hash_newfunc', the creation routine for a basic +hash table. + + `_bfd_link_hash_newfunc' also initializes the local fields in a +linker hash table entry: `type', `written' and `next'. + +File: bfd.info, Node: Write Other Derived Routines, Prev: Write the Derived Creation Routine, Up: Deriving a New Hash Table Type + +Write other derived routines +............................ + +You will want to write other routines for your new hash table, as well. + + You will want an initialization routine which calls the +initialization routine of the hash table you are deriving from and +initializes any other local fields. For the linker hash table, this is +`_bfd_link_hash_table_init' in `linker.c'. + + You will want a lookup routine which calls the lookup routine of the +hash table you are deriving from and casts the result. The linker hash +table uses `bfd_link_hash_lookup' in `linker.c' (this actually takes an +additional argument which it uses to decide how to return the looked up +value). + + You may want a traversal routine. This should just call the +traversal routine of the hash table you are deriving from with +appropriate casts. The linker hash table uses `bfd_link_hash_traverse' +in `linker.c'. + + These routines may simply be defined as macros. For example, the +a.out backend linker hash table, which is derived from the linker hash +table, uses macros for the lookup and traversal routines. These are +`aout_link_hash_lookup' and `aout_link_hash_traverse' in aoutx.h. + +File: bfd.info, Node: BFD back ends, Next: Index, Prev: BFD front end, Up: Top + +BFD back ends +************* + +* Menu: + +* What to Put Where:: +* aout :: a.out backends +* coff :: coff backends +* elf :: elf backends + + +File: bfd.info, Node: What to Put Where, Next: aout, Prev: BFD back ends, Up: BFD back ends + + All of BFD lives in one directory. + + +File: bfd.info, Node: aout, Next: coff, Prev: What to Put Where, Up: BFD back ends + +a.out backends +============== + +*Description* +BFD supports a number of different flavours of a.out format, though the +major differences are only the sizes of the structures on disk, and the +shape of the relocation information. + + The support is split into a basic support file `aoutx.h' and other +files which derive functions from the base. One derivation file is +`aoutf1.h' (for a.out flavour 1), and adds to the basic a.out functions +support for sun3, sun4, 386 and 29k a.out files, to create a target +jump vector for a specific target. + + This information is further split out into more specific files for +each machine, including `sunos.c' for sun3 and sun4, `newsos3.c' for +the Sony NEWS, and `demo64.c' for a demonstration of a 64 bit a.out +format. + + The base file `aoutx.h' defines general mechanisms for reading and +writing records to and from disk and various other methods which BFD +requires. It is included by `aout32.c' and `aout64.c' to form the names +`aout_32_swap_exec_header_in', `aout_64_swap_exec_header_in', etc. + + As an example, this is what goes on to make the back end for a sun4, +from `aout32.c': + + #define ARCH_SIZE 32 + #include "aoutx.h" + + Which exports names: + + ... + aout_32_canonicalize_reloc + aout_32_find_nearest_line + aout_32_get_lineno + aout_32_get_reloc_upper_bound + ... + + from `sunos.c': + + #define TARGET_NAME "a.out-sunos-big" + #define VECNAME sunos_big_vec + #include "aoutf1.h" + + requires all the names from `aout32.c', and produces the jump vector + + sunos_big_vec + + The file `host-aout.c' is a special case. It is for a large set of +hosts that use "more or less standard" a.out files, and for which +cross-debugging is not interesting. It uses the standard 32-bit a.out +support routines, but determines the file offsets and addresses of the +text, data, and BSS sections, the machine architecture and machine +type, and the entry point address, in a host-dependent manner. Once +these values have been determined, generic code is used to handle the +object file. + + When porting it to run on a new system, you must supply: + + HOST_PAGE_SIZE + HOST_SEGMENT_SIZE + HOST_MACHINE_ARCH (optional) + HOST_MACHINE_MACHINE (optional) + HOST_TEXT_START_ADDR + HOST_STACK_END_ADDR + + in the file `../include/sys/h-XXX.h' (for your host). These values, +plus the structures and macros defined in `a.out.h' on your host +system, will produce a BFD target that will access ordinary a.out files +on your host. To configure a new machine to use `host-aout.c', specify: + + TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec + TDEPFILES= host-aout.o trad-core.o + + in the `config/XXX.mt' file, and modify `configure.in' to use the +`XXX.mt' file (by setting "`bfd_target=XXX'") when your configuration +is selected. +Relocations +----------- + +*Description* +The file `aoutx.h' provides for both the *standard* and *extended* +forms of a.out relocation records. + + The standard records contain only an address, a symbol index, and a +type field. The extended records (used on 29ks and sparcs) also have a +full integer for an addend. +Internal entry points +--------------------- + +*Description* +`aoutx.h' exports several routines for accessing the contents of an +a.out file, which are gathered and exported in turn by various format +specific files (eg sunos.c). +`aout_SIZE_swap_exec_header_in' +............................... + +*Synopsis* + void aout_SIZE_swap_exec_header_in, + (bfd *abfd, + struct external_exec *raw_bytes, + struct internal_exec *execp); + *Description* +Swap the information in an executable header RAW_BYTES taken from a raw +byte stream memory image into the internal exec header structure EXECP. +`aout_SIZE_swap_exec_header_out' +................................ + +*Synopsis* + void aout_SIZE_swap_exec_header_out + (bfd *abfd, + struct internal_exec *execp, + struct external_exec *raw_bytes); + *Description* +Swap the information in an internal exec header structure EXECP into +the buffer RAW_BYTES ready for writing to disk. +`aout_SIZE_some_aout_object_p' +.............................. + +*Synopsis* + const bfd_target *aout_SIZE_some_aout_object_p + (bfd *abfd, + const bfd_target *(*callback_to_real_object_p)()); + *Description* +Some a.out variant thinks that the file open in ABFD checking is an +a.out file. Do some more checking, and set up for access if it really +is. Call back to the calling environment's "finish up" function just +before returning, to handle any last-minute setup. +`aout_SIZE_mkobject' +.................... + +*Synopsis* + boolean aout_SIZE_mkobject, (bfd *abfd); + *Description* +Initialize BFD ABFD for use with a.out files. +`aout_SIZE_machine_type' +........................ + +*Synopsis* + enum machine_type aout_SIZE_machine_type + (enum bfd_architecture arch, + unsigned long machine)); + *Description* +Keep track of machine architecture and machine type for a.out's. Return +the `machine_type' for a particular architecture and machine, or +`M_UNKNOWN' if that exact architecture and machine can't be represented +in a.out format. + + If the architecture is understood, machine type 0 (default) is +always understood. +`aout_SIZE_set_arch_mach' +......................... + +*Synopsis* + boolean aout_SIZE_set_arch_mach, + (bfd *, + enum bfd_architecture arch, + unsigned long machine)); + *Description* +Set the architecture and the machine of the BFD ABFD to the values ARCH +and MACHINE. Verify that ABFD's format can support the architecture +required. +`aout_SIZE_new_section_hook' +............................ + +*Synopsis* + boolean aout_SIZE_new_section_hook, + (bfd *abfd, + asection *newsect)); + *Description* +Called by the BFD in response to a `bfd_make_section' request. diff -urN binutils-2.7/bfd/doc/bfd.info-5 binutils-2.8/bfd/doc/bfd.info-5 --- binutils-2.7/bfd/doc/bfd.info-5 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/bfd.info-5 Wed Apr 30 13:14:27 1997 @@ -0,0 +1,991 @@ +This is Info file bfd.info, produced by Makeinfo-1.64 from the input +file ./bfd.texinfo. + +START-INFO-DIR-ENTRY +* Bfd: (bfd). The Binary File Descriptor library. +END-INFO-DIR-ENTRY + + This file documents the BFD library. + + Copyright (C) 1991 Free Software Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, subject to the +terms of the GNU General Public License, which includes the provision +that the entire resulting derived work is distributed under the terms +of a permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions. + + +File: bfd.info, Node: coff, Next: elf, Prev: aout, Up: BFD back ends + +coff backends +============= + +BFD supports a number of different flavours of coff format. The major +differences between formats are the sizes and alignments of fields in +structures on disk, and the occasional extra field. + + Coff in all its varieties is implemented with a few common files and +a number of implementation specific files. For example, The 88k bcs +coff format is implemented in the file `coff-m88k.c'. This file +`#include's `coff/m88k.h' which defines the external structure of the +coff format for the 88k, and `coff/internal.h' which defines the +internal structure. `coff-m88k.c' also defines the relocations used by +the 88k format *Note Relocations::. + + The Intel i960 processor version of coff is implemented in +`coff-i960.c'. This file has the same structure as `coff-m88k.c', +except that it includes `coff/i960.h' rather than `coff-m88k.h'. +Porting to a new version of coff +-------------------------------- + +The recommended method is to select from the existing implementations +the version of coff which is most like the one you want to use. For +example, we'll say that i386 coff is the one you select, and that your +coff flavour is called foo. Copy `i386coff.c' to `foocoff.c', copy +`../include/coff/i386.h' to `../include/coff/foo.h', and add the lines +to `targets.c' and `Makefile.in' so that your new back end is used. +Alter the shapes of the structures in `../include/coff/foo.h' so that +they match what you need. You will probably also have to add `#ifdef's +to the code in `coff/internal.h' and `coffcode.h' if your version of +coff is too wild. + + You can verify that your new BFD backend works quite simply by +building `objdump' from the `binutils' directory, and making sure that +its version of what's going on and your host system's idea (assuming it +has the pretty standard coff dump utility, usually called `att-dump' or +just `dump') are the same. Then clean up your code, and send what +you've done to Cygnus. Then your stuff will be in the next release, and +you won't have to keep integrating it. +How the coff backend works +-------------------------- + +File layout +........... + +The Coff backend is split into generic routines that are applicable to +any Coff target and routines that are specific to a particular target. +The target-specific routines are further split into ones which are +basically the same for all Coff targets except that they use the +external symbol format or use different values for certain constants. + + The generic routines are in `coffgen.c'. These routines work for +any Coff target. They use some hooks into the target specific code; +the hooks are in a `bfd_coff_backend_data' structure, one of which +exists for each target. + + The essentially similar target-specific routines are in +`coffcode.h'. This header file includes executable C code. The +various Coff targets first include the appropriate Coff header file, +make any special defines that are needed, and then include `coffcode.h'. + + Some of the Coff targets then also have additional routines in the +target source file itself. + + For example, `coff-i960.c' includes `coff/internal.h' and +`coff/i960.h'. It then defines a few constants, such as `I960', and +includes `coffcode.h'. Since the i960 has complex relocation types, +`coff-i960.c' also includes some code to manipulate the i960 relocs. +This code is not in `coffcode.h' because it would not be used by any +other target. +Bit twiddling +............. + +Each flavour of coff supported in BFD has its own header file +describing the external layout of the structures. There is also an +internal description of the coff layout, in `coff/internal.h'. A major +function of the coff backend is swapping the bytes and twiddling the +bits to translate the external form of the structures into the normal +internal form. This is all performed in the `bfd_swap'_thing_direction +routines. Some elements are different sizes between different versions +of coff; it is the duty of the coff version specific include file to +override the definitions of various packing routines in `coffcode.h'. +E.g., the size of line number entry in coff is sometimes 16 bits, and +sometimes 32 bits. `#define'ing `PUT_LNSZ_LNNO' and `GET_LNSZ_LNNO' +will select the correct one. No doubt, some day someone will find a +version of coff which has a varying field size not catered to at the +moment. To port BFD, that person will have to add more `#defines'. +Three of the bit twiddling routines are exported to `gdb'; +`coff_swap_aux_in', `coff_swap_sym_in' and `coff_swap_linno_in'. `GDB' +reads the symbol table on its own, but uses BFD to fix things up. More +of the bit twiddlers are exported for `gas'; `coff_swap_aux_out', +`coff_swap_sym_out', `coff_swap_lineno_out', `coff_swap_reloc_out', +`coff_swap_filehdr_out', `coff_swap_aouthdr_out', +`coff_swap_scnhdr_out'. `Gas' currently keeps track of all the symbol +table and reloc drudgery itself, thereby saving the internal BFD +overhead, but uses BFD to swap things on the way out, making cross +ports much safer. Doing so also allows BFD (and thus the linker) to +use the same header files as `gas', which makes one avenue to disaster +disappear. +Symbol reading +.............. + +The simple canonical form for symbols used by BFD is not rich enough to +keep all the information available in a coff symbol table. The back end +gets around this problem by keeping the original symbol table around, +"behind the scenes". + + When a symbol table is requested (through a call to +`bfd_canonicalize_symtab'), a request gets through to +`coff_get_normalized_symtab'. This reads the symbol table from the coff +file and swaps all the structures inside into the internal form. It +also fixes up all the pointers in the table (represented in the file by +offsets from the first symbol in the table) into physical pointers to +elements in the new internal table. This involves some work since the +meanings of fields change depending upon context: a field that is a +pointer to another structure in the symbol table at one moment may be +the size in bytes of a structure at the next. Another pass is made +over the table. All symbols which mark file names (`C_FILE' symbols) +are modified so that the internal string points to the value in the +auxent (the real filename) rather than the normal text associated with +the symbol (`".file"'). + + At this time the symbol names are moved around. Coff stores all +symbols less than nine characters long physically within the symbol +table; longer strings are kept at the end of the file in the string +table. This pass moves all strings into memory and replaces them with +pointers to the strings. + + The symbol table is massaged once again, this time to create the +canonical table used by the BFD application. Each symbol is inspected +in turn, and a decision made (using the `sclass' field) about the +various flags to set in the `asymbol'. *Note Symbols::. The generated +canonical table shares strings with the hidden internal symbol table. + + Any linenumbers are read from the coff file too, and attached to the +symbols which own the functions the linenumbers belong to. +Symbol writing +.............. + +Writing a symbol to a coff file which didn't come from a coff file will +lose any debugging information. The `asymbol' structure remembers the +BFD from which the symbol was taken, and on output the back end makes +sure that the same destination target as source target is present. + + When the symbols have come from a coff file then all the debugging +information is preserved. + + Symbol tables are provided for writing to the back end in a vector +of pointers to pointers. This allows applications like the linker to +accumulate and output large symbol tables without having to do too much +byte copying. + + This function runs through the provided symbol table and patches +each symbol marked as a file place holder (`C_FILE') to point to the +next file place holder in the list. It also marks each `offset' field +in the list with the offset from the first symbol of the current symbol. + + Another function of this procedure is to turn the canonical value +form of BFD into the form used by coff. Internally, BFD expects symbol +values to be offsets from a section base; so a symbol physically at +0x120, but in a section starting at 0x100, would have the value 0x20. +Coff expects symbols to contain their final value, so symbols have +their values changed at this point to reflect their sum with their +owning section. This transformation uses the `output_section' field of +the `asymbol''s `asection' *Note Sections::. + + * `coff_mangle_symbols' This routine runs though the provided symbol +table and uses the offsets generated by the previous pass and the +pointers generated when the symbol table was read in to create the +structured hierachy required by coff. It changes each pointer to a +symbol into the index into the symbol table of the asymbol. + + * `coff_write_symbols' This routine runs through the symbol table +and patches up the symbols from their internal form into the coff way, +calls the bit twiddlers, and writes out the table to the file. +`coff_symbol_type' +.................. + +*Description* +The hidden information for an `asymbol' is described in a +`combined_entry_type': +. + typedef struct coff_ptr_struct + { + + /* Remembers the offset from the first symbol in the file for + this symbol. Generated by coff_renumber_symbols. */ + unsigned int offset; + + /* Should the value of this symbol be renumbered. Used for + XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */ + unsigned int fix_value : 1; + + /* Should the tag field of this symbol be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_tag : 1; + + /* Should the endidx field of this symbol be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_end : 1; + + /* Should the x_csect.x_scnlen field be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_scnlen : 1; + + /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the + index into the line number entries. Set by + coff_slurp_symbol_table. */ + unsigned int fix_line : 1; + + /* The container for the symbol structure as read and translated + from the file. */ + + union { + union internal_auxent auxent; + struct internal_syment syment; + } u; + } combined_entry_type; + + + /* Each canonical asymbol really looks like this: */ + + typedef struct coff_symbol_struct + { + /* The actual symbol which the rest of BFD works with */ + asymbol symbol; + + /* A pointer to the hidden information for this symbol */ + combined_entry_type *native; + + /* A pointer to the linenumber information for this symbol */ + struct lineno_cache_entry *lineno; + + /* Have the line numbers been relocated yet ? */ + boolean done_lineno; + } coff_symbol_type; + +`bfd_coff_backend_data' +....................... + + Special entry points for gdb to swap in coff symbol table parts: + typedef struct + { + void (*_bfd_coff_swap_aux_in) PARAMS (( + bfd *abfd, + PTR ext, + int type, + int class, + int indaux, + int numaux, + PTR in)); + + void (*_bfd_coff_swap_sym_in) PARAMS (( + bfd *abfd , + PTR ext, + PTR in)); + + void (*_bfd_coff_swap_lineno_in) PARAMS (( + bfd *abfd, + PTR ext, + PTR in)); + Special entry points for gas to swap out coff parts: + unsigned int (*_bfd_coff_swap_aux_out) PARAMS (( + bfd *abfd, + PTR in, + int type, + int class, + int indaux, + int numaux, + PTR ext)); + + unsigned int (*_bfd_coff_swap_sym_out) PARAMS (( + bfd *abfd, + PTR in, + PTR ext)); + + unsigned int (*_bfd_coff_swap_lineno_out) PARAMS (( + bfd *abfd, + PTR in, + PTR ext)); + + unsigned int (*_bfd_coff_swap_reloc_out) PARAMS (( + bfd *abfd, + PTR src, + PTR dst)); + + unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS (( + bfd *abfd, + PTR in, + PTR out)); + + unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS (( + bfd *abfd, + PTR in, + PTR out)); + + unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS (( + bfd *abfd, + PTR in, + PTR out)); + Special entry points for generic COFF routines to call target +dependent COFF routines: + unsigned int _bfd_filhsz; + unsigned int _bfd_aoutsz; + unsigned int _bfd_scnhsz; + unsigned int _bfd_symesz; + unsigned int _bfd_auxesz; + unsigned int _bfd_relsz; + unsigned int _bfd_linesz; + boolean _bfd_coff_long_filenames; + boolean _bfd_coff_long_section_names; + unsigned int _bfd_coff_default_section_alignment_power; + void (*_bfd_coff_swap_filehdr_in) PARAMS (( + bfd *abfd, + PTR ext, + PTR in)); + void (*_bfd_coff_swap_aouthdr_in) PARAMS (( + bfd *abfd, + PTR ext, + PTR in)); + void (*_bfd_coff_swap_scnhdr_in) PARAMS (( + bfd *abfd, + PTR ext, + PTR in)); + void (*_bfd_coff_swap_reloc_in) PARAMS (( + bfd *abfd, + PTR ext, + PTR in)); + boolean (*_bfd_coff_bad_format_hook) PARAMS (( + bfd *abfd, + PTR internal_filehdr)); + boolean (*_bfd_coff_set_arch_mach_hook) PARAMS (( + bfd *abfd, + PTR internal_filehdr)); + PTR (*_bfd_coff_mkobject_hook) PARAMS (( + bfd *abfd, + PTR internal_filehdr, + PTR internal_aouthdr)); + flagword (*_bfd_styp_to_sec_flags_hook) PARAMS (( + bfd *abfd, + PTR internal_scnhdr, + const char *name)); + void (*_bfd_set_alignment_hook) PARAMS (( + bfd *abfd, + asection *sec, + PTR internal_scnhdr)); + boolean (*_bfd_coff_slurp_symbol_table) PARAMS (( + bfd *abfd)); + boolean (*_bfd_coff_symname_in_debug) PARAMS (( + bfd *abfd, + struct internal_syment *sym)); + boolean (*_bfd_coff_pointerize_aux_hook) PARAMS (( + bfd *abfd, + combined_entry_type *table_base, + combined_entry_type *symbol, + unsigned int indaux, + combined_entry_type *aux)); + boolean (*_bfd_coff_print_aux) PARAMS (( + bfd *abfd, + FILE *file, + combined_entry_type *table_base, + combined_entry_type *symbol, + combined_entry_type *aux, + unsigned int indaux)); + void (*_bfd_coff_reloc16_extra_cases) PARAMS (( + bfd *abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + arelent *reloc, + bfd_byte *data, + unsigned int *src_ptr, + unsigned int *dst_ptr)); + int (*_bfd_coff_reloc16_estimate) PARAMS (( + bfd *abfd, + asection *input_section, + arelent *r, + unsigned int shrink, + struct bfd_link_info *link_info)); + boolean (*_bfd_coff_sym_is_global) PARAMS (( + bfd *abfd, + struct internal_syment *)); + boolean (*_bfd_coff_compute_section_file_positions) PARAMS (( + bfd *abfd)); + boolean (*_bfd_coff_start_final_link) PARAMS (( + bfd *output_bfd, + struct bfd_link_info *info)); + boolean (*_bfd_coff_relocate_section) PARAMS (( + bfd *output_bfd, + struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + struct internal_reloc *relocs, + struct internal_syment *syms, + asection **sections)); + reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS (( + bfd *abfd, + asection *sec, + struct internal_reloc *rel, + struct coff_link_hash_entry *h, + struct internal_syment *sym, + bfd_vma *addendp)); + boolean (*_bfd_coff_adjust_symndx) PARAMS (( + bfd *obfd, + struct bfd_link_info *info, + bfd *ibfd, + asection *sec, + struct internal_reloc *reloc, + boolean *adjustedp)); + boolean (*_bfd_coff_link_add_one_symbol) PARAMS (( + struct bfd_link_info *info, + bfd *abfd, + const char *name, + flagword flags, + asection *section, + bfd_vma value, + const char *string, + boolean copy, + boolean collect, + struct bfd_link_hash_entry **hashp)); + + } bfd_coff_backend_data; + + #define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) + + #define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ + ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) + + #define bfd_coff_swap_sym_in(a,e,i) \ + ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) + + #define bfd_coff_swap_lineno_in(a,e,i) \ + ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) + + #define bfd_coff_swap_reloc_out(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) + + #define bfd_coff_swap_lineno_out(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) + + #define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ + ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) + + #define bfd_coff_swap_sym_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) + + #define bfd_coff_swap_scnhdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) + + #define bfd_coff_swap_filehdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) + + #define bfd_coff_swap_aouthdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) + + #define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) + #define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz) + #define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz) + #define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz) + #define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz) + #define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz) + #define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) + #define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames) + #define bfd_coff_long_section_names(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_long_section_names) + #define bfd_coff_default_section_alignment_power(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) + #define bfd_coff_swap_filehdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) + + #define bfd_coff_swap_aouthdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) + + #define bfd_coff_swap_scnhdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) + + #define bfd_coff_swap_reloc_in(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) + + #define bfd_coff_bad_format_hook(abfd, filehdr) \ + ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) + + #define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ + ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) + #define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ + ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr)) + + #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\ + ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name)) + + #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ + ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) + + #define bfd_coff_slurp_symbol_table(abfd)\ + ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) + + #define bfd_coff_symname_in_debug(abfd, sym)\ + ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) + + #define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ + ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ + (abfd, file, base, symbol, aux, indaux)) + + #define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\ + ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ + (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) + + #define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ + ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ + (abfd, section, reloc, shrink, link_info)) + + #define bfd_coff_sym_is_global(abfd, sym)\ + ((coff_backend_info (abfd)->_bfd_coff_sym_is_global)\ + (abfd, sym)) + + #define bfd_coff_compute_section_file_positions(abfd)\ + ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ + (abfd)) + + #define bfd_coff_start_final_link(obfd, info)\ + ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ + (obfd, info)) + #define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ + ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ + (obfd, info, ibfd, o, con, rel, isyms, secs)) + #define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ + ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ + (abfd, sec, rel, h, sym, addendp)) + #define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ + ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ + (obfd, info, ibfd, sec, rel, adjustedp)) + #define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\ + ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ + (info, abfd, name, flags, section, value, string, cp, coll, hashp)) + +Writing relocations +................... + + To write relocations, the back end steps though the canonical +relocation table and create an `internal_reloc'. The symbol index to +use is removed from the `offset' field in the symbol table supplied. +The address comes directly from the sum of the section base address and +the relocation offset; the type is dug directly from the howto field. +Then the `internal_reloc' is swapped into the shape of an +`external_reloc' and written out to disk. +Reading linenumbers +................... + +Creating the linenumber table is done by reading in the entire coff +linenumber table, and creating another table for internal use. + + A coff linenumber table is structured so that each function is +marked as having a line number of 0. Each line within the function is +an offset from the first line in the function. The base of the line +number information for the table is stored in the symbol associated +with the function. + + The information is copied from the external to the internal table, +and each symbol which marks a function is marked by pointing its... + + How does this work ? +Reading relocations +................... + +Coff relocations are easily transformed into the internal BFD form +(`arelent'). + + Reading a coff relocation table is done in the following stages: + + * Read the entire coff relocation table into memory. + + * Process each relocation in turn; first swap it from the external + to the internal form. + + * Turn the symbol referenced in the relocation's symbol index into a + pointer into the canonical symbol table. This table is the same + as the one returned by a call to `bfd_canonicalize_symtab'. The + back end will call that routine and save the result if a + canonicalization hasn't been done. + + * The reloc index is turned into a pointer to a howto structure, in + a back end specific way. For instance, the 386 and 960 use the + `r_type' to directly produce an index into a howto table vector; + the 88k subtracts a number from the `r_type' field and creates an + addend field. + +File: bfd.info, Node: elf, Prev: coff, Up: BFD back ends + +ELF backends +============ + +BFD support for ELF formats is being worked on. Currently, the best +supported back ends are for sparc and i386 (running svr4 or Solaris 2). + + Documentation of the internals of the support code still needs to be +written. The code is changing quickly enough that we haven't bothered +yet. +`bfd_elf_find_section' +...................... + +*Synopsis* + struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name); + *Description* +Helper functions for GDB to locate the string tables. Since BFD hides +string tables from callers, GDB needs to use an internal hook to find +them. Sun's .stabstr, in particular, isn't even pointed to by the +.stab section, so ordinary mechanisms wouldn't work to find it, even if +we had some. + +File: bfd.info, Node: Index, Prev: BFD back ends, Up: Top + +Index +***** + +* Menu: + +* _bfd_final_link_relocate: Relocating the section contents. +* _bfd_generic_link_add_archive_symbols: Adding symbols from an archive. +* _bfd_generic_link_add_one_symbol: Adding symbols from an object file. +* _bfd_link_add_symbols in target vector: Adding Symbols to the Hash Table. +* _bfd_link_final_link in target vector: Performing the Final Link. +* _bfd_link_hash_table_create in target vector: Creating a Linker Hash Table. +* _bfd_relocate_contents: Relocating the section contents. +* aout_SIZE_machine_type: aout. +* aout_SIZE_mkobject: aout. +* aout_SIZE_new_section_hook: aout. +* aout_SIZE_set_arch_mach: aout. +* aout_SIZE_some_aout_object_p: aout. +* aout_SIZE_swap_exec_header_in: aout. +* aout_SIZE_swap_exec_header_out: aout. +* arelent_chain: typedef arelent. +* BFD: Overview. +* BFD canonical format: Canonical format. +* bfd_alloc: Opening and Closing. +* bfd_arch_bits_per_address: Architectures. +* bfd_arch_bits_per_byte: Architectures. +* bfd_arch_get_compatible: Architectures. +* bfd_cache_close: File Caching. +* bfd_cache_init: File Caching. +* bfd_cache_lookup: File Caching. +* bfd_cache_lookup_worker: File Caching. +* BFD_CACHE_MAX_OPEN macro: File Caching. +* bfd_canonicalize_reloc: BFD front end. +* bfd_canonicalize_symtab: symbol handling functions. +* bfd_check_format: Formats. +* bfd_check_format_matches: Formats. +* bfd_close: Opening and Closing. +* bfd_close_all_done: Opening and Closing. +* bfd_coff_backend_data: coff. +* bfd_copy_private_bfd_data: BFD front end. +* bfd_copy_private_section_data: section prototypes. +* bfd_copy_private_symbol_data: symbol handling functions. +* bfd_core_file_failing_command: Core Files. +* bfd_core_file_failing_signal: Core Files. +* bfd_create: Opening and Closing. +* bfd_decode_symclass: symbol handling functions. +* bfd_default_arch_struct: Architectures. +* bfd_default_compatible: Architectures. +* bfd_default_reloc_type_lookup: howto manager. +* bfd_default_scan: Architectures. +* bfd_default_set_arch_mach: Architectures. +* bfd_elf_find_section: elf. +* bfd_errmsg: BFD front end. +* bfd_fdopenr: Opening and Closing. +* bfd_find_target: bfd_target. +* bfd_format_string: Formats. +* bfd_generic_get_relocated_section_contents: howto manager. +* bfd_generic_relax_section: howto manager. +* bfd_get_arch: Architectures. +* bfd_get_arch_info: Architectures. +* bfd_get_error: BFD front end. +* bfd_get_gp_size: BFD front end. +* bfd_get_mach: Architectures. +* bfd_get_mtime: BFD front end. +* bfd_get_next_mapent: Archives. +* bfd_get_reloc_code_name: howto manager. +* bfd_get_reloc_size: typedef arelent. +* bfd_get_reloc_upper_bound: BFD front end. +* bfd_get_section_by_name: section prototypes. +* bfd_get_section_contents: section prototypes. +* bfd_get_size <1>: Internal. +* bfd_get_size: BFD front end. +* bfd_get_symtab_upper_bound: symbol handling functions. +* bfd_h_put_size: Internal. +* bfd_hash_allocate: Creating and Freeing a Hash Table. +* bfd_hash_lookup: Looking Up or Entering a String. +* bfd_hash_newfunc: Creating and Freeing a Hash Table. +* bfd_hash_table_free: Creating and Freeing a Hash Table. +* bfd_hash_table_init: Creating and Freeing a Hash Table. +* bfd_hash_table_init_n: Creating and Freeing a Hash Table. +* bfd_hash_traverse: Traversing a Hash Table. +* bfd_init: Initialization. +* bfd_install_relocation: typedef arelent. +* bfd_is_local_label: symbol handling functions. +* bfd_is_local_label_name: symbol handling functions. +* bfd_last_cache: File Caching. +* bfd_link_split_section: Writing the symbol table. +* bfd_log2: Internal. +* bfd_lookup_arch: Architectures. +* bfd_make_debug_symbol: symbol handling functions. +* bfd_make_empty_symbol: symbol handling functions. +* bfd_make_section: section prototypes. +* bfd_make_section_anyway: section prototypes. +* bfd_make_section_old_way: section prototypes. +* bfd_map_over_sections: section prototypes. +* bfd_merge_private_bfd_data: BFD front end. +* bfd_open_file: File Caching. +* bfd_openr: Opening and Closing. +* bfd_openr_next_archived_file: Archives. +* bfd_openstreamr: Opening and Closing. +* bfd_openw: Opening and Closing. +* bfd_perform_relocation: typedef arelent. +* bfd_perror: BFD front end. +* bfd_print_symbol_vandf: symbol handling functions. +* bfd_printable_arch_mach: Architectures. +* bfd_printable_name: Architectures. +* bfd_put_size: Internal. +* BFD_RELOC_12_PCREL: howto manager. +* BFD_RELOC_14: howto manager. +* BFD_RELOC_16: howto manager. +* BFD_RELOC_16_BASEREL: howto manager. +* BFD_RELOC_16_GOT_PCREL: howto manager. +* BFD_RELOC_16_GOTOFF: howto manager. +* BFD_RELOC_16_PCREL: howto manager. +* BFD_RELOC_16_PCREL_S2: howto manager. +* BFD_RELOC_16_PLT_PCREL: howto manager. +* BFD_RELOC_16_PLTOFF: howto manager. +* BFD_RELOC_23_PCREL_S2: howto manager. +* BFD_RELOC_24: howto manager. +* BFD_RELOC_24_PCREL: howto manager. +* BFD_RELOC_24_PLT_PCREL: howto manager. +* BFD_RELOC_26: howto manager. +* BFD_RELOC_32: howto manager. +* BFD_RELOC_32_BASEREL: howto manager. +* BFD_RELOC_32_GOT_PCREL: howto manager. +* BFD_RELOC_32_GOTOFF: howto manager. +* BFD_RELOC_32_PCREL: howto manager. +* BFD_RELOC_32_PCREL_S2: howto manager. +* BFD_RELOC_32_PLT_PCREL: howto manager. +* BFD_RELOC_32_PLTOFF: howto manager. +* BFD_RELOC_386_COPY: howto manager. +* BFD_RELOC_386_GLOB_DAT: howto manager. +* BFD_RELOC_386_GOT32: howto manager. +* BFD_RELOC_386_GOTOFF: howto manager. +* BFD_RELOC_386_GOTPC: howto manager. +* BFD_RELOC_386_JUMP_SLOT: howto manager. +* BFD_RELOC_386_PLT32: howto manager. +* BFD_RELOC_386_RELATIVE: howto manager. +* BFD_RELOC_64: howto manager. +* BFD_RELOC_64_PCREL: howto manager. +* BFD_RELOC_68K_GLOB_DAT: howto manager. +* BFD_RELOC_68K_JMP_SLOT: howto manager. +* BFD_RELOC_68K_RELATIVE: howto manager. +* BFD_RELOC_8: howto manager. +* BFD_RELOC_8_BASEREL: howto manager. +* BFD_RELOC_8_FFnn: howto manager. +* BFD_RELOC_8_GOT_PCREL: howto manager. +* BFD_RELOC_8_GOTOFF: howto manager. +* BFD_RELOC_8_PCREL: howto manager. +* BFD_RELOC_8_PLT_PCREL: howto manager. +* BFD_RELOC_8_PLTOFF: howto manager. +* BFD_RELOC_ALPHA_CODEADDR: howto manager. +* BFD_RELOC_ALPHA_ELF_LITERAL: howto manager. +* BFD_RELOC_ALPHA_GPDISP: howto manager. +* BFD_RELOC_ALPHA_GPDISP_HI16: howto manager. +* BFD_RELOC_ALPHA_GPDISP_LO16: howto manager. +* BFD_RELOC_ALPHA_HINT: howto manager. +* BFD_RELOC_ALPHA_LINKAGE: howto manager. +* BFD_RELOC_ALPHA_LITERAL: howto manager. +* BFD_RELOC_ALPHA_LITUSE: howto manager. +* BFD_RELOC_ARM_ADR_IMM: howto manager. +* BFD_RELOC_ARM_CP_OFF_IMM: howto manager. +* BFD_RELOC_ARM_HWLITERAL: howto manager. +* BFD_RELOC_ARM_IMMEDIATE: howto manager. +* BFD_RELOC_ARM_IN_POOL: howto manager. +* BFD_RELOC_ARM_LDR_IMM: howto manager. +* BFD_RELOC_ARM_LITERAL: howto manager. +* BFD_RELOC_ARM_MULTI: howto manager. +* BFD_RELOC_ARM_OFFSET_IMM: howto manager. +* BFD_RELOC_ARM_OFFSET_IMM8: howto manager. +* BFD_RELOC_ARM_PCREL_BRANCH: howto manager. +* BFD_RELOC_ARM_SHIFT_IMM: howto manager. +* BFD_RELOC_ARM_SWI: howto manager. +* BFD_RELOC_ARM_THUMB_ADD: howto manager. +* BFD_RELOC_ARM_THUMB_IMM: howto manager. +* BFD_RELOC_ARM_THUMB_OFFSET: howto manager. +* BFD_RELOC_ARM_THUMB_SHIFT: howto manager. +* bfd_reloc_code_type: howto manager. +* BFD_RELOC_CTOR: howto manager. +* BFD_RELOC_D10V_10_PCREL_L: howto manager. +* BFD_RELOC_D10V_10_PCREL_R: howto manager. +* BFD_RELOC_D10V_18: howto manager. +* BFD_RELOC_D10V_18_PCREL: howto manager. +* BFD_RELOC_GPREL16: howto manager. +* BFD_RELOC_GPREL32: howto manager. +* BFD_RELOC_HI16: howto manager. +* BFD_RELOC_HI16_BASEREL: howto manager. +* BFD_RELOC_HI16_GOTOFF: howto manager. +* BFD_RELOC_HI16_PLTOFF: howto manager. +* BFD_RELOC_HI16_S: howto manager. +* BFD_RELOC_HI16_S_BASEREL: howto manager. +* BFD_RELOC_HI16_S_GOTOFF: howto manager. +* BFD_RELOC_HI16_S_PLTOFF: howto manager. +* BFD_RELOC_HI22: howto manager. +* BFD_RELOC_I960_CALLJ: howto manager. +* BFD_RELOC_LO10: howto manager. +* BFD_RELOC_LO16: howto manager. +* BFD_RELOC_LO16_BASEREL: howto manager. +* BFD_RELOC_LO16_GOTOFF: howto manager. +* BFD_RELOC_LO16_PLTOFF: howto manager. +* BFD_RELOC_M32R_10_PCREL: howto manager. +* BFD_RELOC_M32R_18_PCREL: howto manager. +* BFD_RELOC_M32R_24: howto manager. +* BFD_RELOC_M32R_26_PCREL: howto manager. +* BFD_RELOC_M32R_HI16_SLO: howto manager. +* BFD_RELOC_M32R_HI16_ULO: howto manager. +* BFD_RELOC_M32R_LO16: howto manager. +* BFD_RELOC_M32R_SDA16: howto manager. +* BFD_RELOC_MIPS16_GPREL: howto manager. +* BFD_RELOC_MIPS16_JMP: howto manager. +* BFD_RELOC_MIPS_CALL16: howto manager. +* BFD_RELOC_MIPS_CALL_HI16: howto manager. +* BFD_RELOC_MIPS_CALL_LO16: howto manager. +* BFD_RELOC_MIPS_GOT16: howto manager. +* BFD_RELOC_MIPS_GOT_HI16: howto manager. +* BFD_RELOC_MIPS_GOT_LO16: howto manager. +* BFD_RELOC_MIPS_GPREL: howto manager. +* BFD_RELOC_MIPS_GPREL32: howto manager. +* BFD_RELOC_MIPS_JMP: howto manager. +* BFD_RELOC_MIPS_LITERAL: howto manager. +* BFD_RELOC_MN10300_16_PCREL: howto manager. +* BFD_RELOC_MN10300_32_PCREL: howto manager. +* BFD_RELOC_NONE: howto manager. +* BFD_RELOC_NS32K_DISP_16: howto manager. +* BFD_RELOC_NS32K_DISP_16_PCREL: howto manager. +* BFD_RELOC_NS32K_DISP_32: howto manager. +* BFD_RELOC_NS32K_DISP_32_PCREL: howto manager. +* BFD_RELOC_NS32K_DISP_8: howto manager. +* BFD_RELOC_NS32K_DISP_8_PCREL: howto manager. +* BFD_RELOC_NS32K_IMM_16: howto manager. +* BFD_RELOC_NS32K_IMM_16_PCREL: howto manager. +* BFD_RELOC_NS32K_IMM_32: howto manager. +* BFD_RELOC_NS32K_IMM_32_PCREL: howto manager. +* BFD_RELOC_NS32K_IMM_8: howto manager. +* BFD_RELOC_NS32K_IMM_8_PCREL: howto manager. +* BFD_RELOC_PCREL_HI16_S: howto manager. +* BFD_RELOC_PCREL_LO16: howto manager. +* BFD_RELOC_PPC_B16: howto manager. +* BFD_RELOC_PPC_B16_BRNTAKEN: howto manager. +* BFD_RELOC_PPC_B16_BRTAKEN: howto manager. +* BFD_RELOC_PPC_B26: howto manager. +* BFD_RELOC_PPC_BA16: howto manager. +* BFD_RELOC_PPC_BA16_BRNTAKEN: howto manager. +* BFD_RELOC_PPC_BA16_BRTAKEN: howto manager. +* BFD_RELOC_PPC_BA26: howto manager. +* BFD_RELOC_PPC_COPY: howto manager. +* BFD_RELOC_PPC_EMB_BIT_FLD: howto manager. +* BFD_RELOC_PPC_EMB_MRKREF: howto manager. +* BFD_RELOC_PPC_EMB_NADDR16: howto manager. +* BFD_RELOC_PPC_EMB_NADDR16_HA: howto manager. +* BFD_RELOC_PPC_EMB_NADDR16_HI: howto manager. +* BFD_RELOC_PPC_EMB_NADDR16_LO: howto manager. +* BFD_RELOC_PPC_EMB_NADDR32: howto manager. +* BFD_RELOC_PPC_EMB_RELSDA: howto manager. +* BFD_RELOC_PPC_EMB_RELSEC16: howto manager. +* BFD_RELOC_PPC_EMB_RELST_HA: howto manager. +* BFD_RELOC_PPC_EMB_RELST_HI: howto manager. +* BFD_RELOC_PPC_EMB_RELST_LO: howto manager. +* BFD_RELOC_PPC_EMB_SDA21: howto manager. +* BFD_RELOC_PPC_EMB_SDA2I16: howto manager. +* BFD_RELOC_PPC_EMB_SDA2REL: howto manager. +* BFD_RELOC_PPC_EMB_SDAI16: howto manager. +* BFD_RELOC_PPC_GLOB_DAT: howto manager. +* BFD_RELOC_PPC_JMP_SLOT: howto manager. +* BFD_RELOC_PPC_LOCAL24PC: howto manager. +* BFD_RELOC_PPC_RELATIVE: howto manager. +* BFD_RELOC_PPC_TOC16: howto manager. +* BFD_RELOC_RVA: howto manager. +* BFD_RELOC_SH_ALIGN: howto manager. +* BFD_RELOC_SH_CODE: howto manager. +* BFD_RELOC_SH_COUNT: howto manager. +* BFD_RELOC_SH_DATA: howto manager. +* BFD_RELOC_SH_IMM4: howto manager. +* BFD_RELOC_SH_IMM4BY2: howto manager. +* BFD_RELOC_SH_IMM4BY4: howto manager. +* BFD_RELOC_SH_IMM8: howto manager. +* BFD_RELOC_SH_IMM8BY2: howto manager. +* BFD_RELOC_SH_IMM8BY4: howto manager. +* BFD_RELOC_SH_LABEL: howto manager. +* BFD_RELOC_SH_PCDISP12BY2: howto manager. +* BFD_RELOC_SH_PCDISP8BY2: howto manager. +* BFD_RELOC_SH_PCRELIMM8BY2: howto manager. +* BFD_RELOC_SH_PCRELIMM8BY4: howto manager. +* BFD_RELOC_SH_SWITCH16: howto manager. +* BFD_RELOC_SH_SWITCH32: howto manager. +* BFD_RELOC_SH_USES: howto manager. +* BFD_RELOC_SPARC13: howto manager. +* BFD_RELOC_SPARC22: howto manager. +* BFD_RELOC_SPARC_10: howto manager. +* BFD_RELOC_SPARC_11: howto manager. +* BFD_RELOC_SPARC_5: howto manager. +* BFD_RELOC_SPARC_6: howto manager. +* BFD_RELOC_SPARC_64: howto manager. +* BFD_RELOC_SPARC_7: howto manager. +* BFD_RELOC_SPARC_BASE13: howto manager. +* BFD_RELOC_SPARC_BASE22: howto manager. +* BFD_RELOC_SPARC_COPY: howto manager. +* BFD_RELOC_SPARC_GLOB_DAT: howto manager. +* BFD_RELOC_SPARC_GLOB_JMP: howto manager. +* BFD_RELOC_SPARC_GOT10: howto manager. +* BFD_RELOC_SPARC_GOT13: howto manager. +* BFD_RELOC_SPARC_GOT22: howto manager. +* BFD_RELOC_SPARC_HH22: howto manager. +* BFD_RELOC_SPARC_HM10: howto manager. +* BFD_RELOC_SPARC_JMP_SLOT: howto manager. +* BFD_RELOC_SPARC_LM22: howto manager. +* BFD_RELOC_SPARC_OLO10: howto manager. +* BFD_RELOC_SPARC_PC10: howto manager. +* BFD_RELOC_SPARC_PC22: howto manager. +* BFD_RELOC_SPARC_PC_HH22: howto manager. +* BFD_RELOC_SPARC_PC_HM10: howto manager. +* BFD_RELOC_SPARC_PC_LM22: howto manager. +* BFD_RELOC_SPARC_RELATIVE: howto manager. +* BFD_RELOC_SPARC_UA32: howto manager. +* BFD_RELOC_SPARC_WDISP16: howto manager. +* BFD_RELOC_SPARC_WDISP19: howto manager. +* BFD_RELOC_SPARC_WDISP22: howto manager. +* BFD_RELOC_SPARC_WPLT30: howto manager. +* bfd_reloc_type_lookup: howto manager. +* bfd_scan_arch: Architectures. +* bfd_scan_vma: BFD front end. +* bfd_set_arch_info: Architectures. +* bfd_set_archive_head: Archives. +* bfd_set_default_target: bfd_target. +* bfd_set_error: BFD front end. +* bfd_set_error_handler: BFD front end. +* bfd_set_error_program_name: BFD front end. +* bfd_set_file_flags: BFD front end. +* bfd_set_format: Formats. +* bfd_set_gp_size: BFD front end. +* bfd_set_private_flags: BFD front end. +* bfd_set_reloc: BFD front end. +* bfd_set_section_contents: section prototypes. +* bfd_set_section_flags: section prototypes. +* bfd_set_section_size: section prototypes. +* bfd_set_start_address: BFD front end. +* bfd_set_symtab: symbol handling functions. +* bfd_symbol_info: symbol handling functions. +* bfd_target_list: bfd_target. +* bfd_write_bigendian_4byte_int: Internal. +* coff_symbol_type: coff. +* core_file_matches_executable_p: Core Files. +* Hash tables: Hash Tables. +* internal object-file format: Canonical format. +* Linker: Linker Functions. +* stuff: BFD front end. +* target vector (_bfd_final_link): Performing the Final Link. +* target vector (_bfd_link_add_symbols): Adding Symbols to the Hash Table. +* target vector (_bfd_link_hash_table_create): Creating a Linker Hash Table. +* The HOWTO Macro: typedef arelent. +* what is it?: Overview. + + diff -urN binutils-2.7/bfd/doc/bfd.texi binutils-2.8/bfd/doc/bfd.texi --- binutils-2.7/bfd/doc/bfd.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/bfd.texi Wed Apr 30 12:56:26 1997 @@ -0,0 +1,585 @@ +@section @code{typedef bfd} +A BFD has type @code{bfd}; objects of this type are the +cornerstone of any application using BFD. Using BFD +consists of making references though the BFD and to data in the BFD. + +Here is the structure that defines the type @code{bfd}. It +contains the major data about the file and pointers +to the rest of the data. +@* +. +@example +struct _bfd +@{ + /* The filename the application opened the BFD with. */ + CONST char *filename; + + /* A pointer to the target jump table. */ + const struct bfd_target *xvec; + + /* To avoid dragging too many header files into every file that + includes `@code{bfd.h}', IOSTREAM has been declared as a "char + *", and MTIME as a "long". Their correct types, to which they + are cast when used, are "FILE *" and "time_t". The iostream + is the result of an fopen on the filename. However, if the + BFD_IN_MEMORY flag is set, then iostream is actually a pointer + to a bfd_in_memory struct. */ + PTR iostream; + + /* Is the file descriptor being cached? That is, can it be closed as + needed, and re-opened when accessed later? */ + + boolean cacheable; + + /* Marks whether there was a default target specified when the + BFD was opened. This is used to select which matching algorithm + to use to choose the back end. */ + + boolean target_defaulted; + + /* The caching routines use these to maintain a + least-recently-used list of BFDs */ + + struct _bfd *lru_prev, *lru_next; + + /* When a file is closed by the caching routines, BFD retains + state information on the file here: */ + + file_ptr where; + + /* and here: (``once'' means at least once) */ + + boolean opened_once; + + /* Set if we have a locally maintained mtime value, rather than + getting it from the file each time: */ + + boolean mtime_set; + + /* File modified time, if mtime_set is true: */ + + long mtime; + + /* Reserved for an unimplemented file locking extension.*/ + + int ifd; + + /* The format which belongs to the BFD. (object, core, etc.) */ + + bfd_format format; + + /* The direction the BFD was opened with*/ + + enum bfd_direction @{no_direction = 0, + read_direction = 1, + write_direction = 2, + both_direction = 3@} direction; + + /* Format_specific flags*/ + + flagword flags; + + /* Currently my_archive is tested before adding origin to + anything. I believe that this can become always an add of + origin, with origin set to 0 for non archive files. */ + + file_ptr origin; + + /* Remember when output has begun, to stop strange things + from happening. */ + boolean output_has_begun; + + /* Pointer to linked list of sections*/ + struct sec *sections; + + /* The number of sections */ + unsigned int section_count; + + /* Stuff only useful for object files: + The start address. */ + bfd_vma start_address; + + /* Used for input and output*/ + unsigned int symcount; + + /* Symbol table for output BFD (with symcount entries) */ + struct symbol_cache_entry **outsymbols; + + /* Pointer to structure which contains architecture information*/ + const struct bfd_arch_info *arch_info; + + /* Stuff only useful for archives:*/ + PTR arelt_data; + struct _bfd *my_archive; /* The containing archive BFD. */ + struct _bfd *next; /* The next BFD in the archive. */ + struct _bfd *archive_head; /* The first BFD in the archive. */ + boolean has_armap; + + /* A chain of BFD structures involved in a link. */ + struct _bfd *link_next; + + /* A field used by _bfd_generic_link_add_archive_symbols. This will + be used only for archive elements. */ + int archive_pass; + + /* Used by the back end to hold private data. */ + + union + @{ + struct aout_data_struct *aout_data; + struct artdata *aout_ar_data; + struct _oasys_data *oasys_obj_data; + struct _oasys_ar_data *oasys_ar_data; + struct coff_tdata *coff_obj_data; + struct pe_tdata *pe_obj_data; + struct xcoff_tdata *xcoff_obj_data; + struct ecoff_tdata *ecoff_obj_data; + struct ieee_data_struct *ieee_data; + struct ieee_ar_data_struct *ieee_ar_data; + struct srec_data_struct *srec_data; + struct ihex_data_struct *ihex_data; + struct tekhex_data_struct *tekhex_data; + struct elf_obj_tdata *elf_obj_data; + struct nlm_obj_tdata *nlm_obj_data; + struct bout_data_struct *bout_data; + struct sun_core_struct *sun_core_data; + struct trad_core_struct *trad_core_data; + struct som_data_struct *som_data; + struct hpux_core_struct *hpux_core_data; + struct hppabsd_core_struct *hppabsd_core_data; + struct sgi_core_struct *sgi_core_data; + struct lynx_core_struct *lynx_core_data; + struct osf_core_struct *osf_core_data; + struct cisco_core_struct *cisco_core_data; + struct versados_data_struct *versados_data; + struct netbsd_core_struct *netbsd_core_data; + PTR any; + @} tdata; + + /* Used by the application to hold private data*/ + PTR usrdata; + + /* Where all the allocated stuff under this BFD goes. This is a + struct objalloc *, but we use PTR to avoid requiring the inclusion of + objalloc.h. */ + PTR memory; +@}; + +@end example +@section Error reporting +Most BFD functions return nonzero on success (check their +individual documentation for precise semantics). On an error, +they call @code{bfd_set_error} to set an error condition that callers +can check by calling @code{bfd_get_error}. +If that returns @code{bfd_error_system_call}, then check +@code{errno}. + +The easiest way to report a BFD error to the user is to +use @code{bfd_perror}. +@* +@subsection Type @code{bfd_error_type} +The values returned by @code{bfd_get_error} are defined by the +enumerated type @code{bfd_error_type}. +@* +. +@example +typedef enum bfd_error +@{ + bfd_error_no_error = 0, + bfd_error_system_call, + bfd_error_invalid_target, + bfd_error_wrong_format, + bfd_error_invalid_operation, + bfd_error_no_memory, + bfd_error_no_symbols, + bfd_error_no_armap, + bfd_error_no_more_archived_files, + bfd_error_malformed_archive, + bfd_error_file_not_recognized, + bfd_error_file_ambiguously_recognized, + bfd_error_no_contents, + bfd_error_nonrepresentable_section, + bfd_error_no_debug_section, + bfd_error_bad_value, + bfd_error_file_truncated, + bfd_error_file_too_big, + bfd_error_invalid_error_code +@} bfd_error_type; + +@end example +@findex bfd_get_error +@subsubsection @code{bfd_get_error} +@strong{Synopsis} +@example +bfd_error_type bfd_get_error (void); +@end example +@strong{Description}@* +Return the current BFD error condition. +@* +@findex bfd_set_error +@subsubsection @code{bfd_set_error} +@strong{Synopsis} +@example +void bfd_set_error (bfd_error_type error_tag); +@end example +@strong{Description}@* +Set the BFD error condition to be @var{error_tag}. +@* +@findex bfd_errmsg +@subsubsection @code{bfd_errmsg} +@strong{Synopsis} +@example +CONST char *bfd_errmsg (bfd_error_type error_tag); +@end example +@strong{Description}@* +Return a string describing the error @var{error_tag}, or +the system error if @var{error_tag} is @code{bfd_error_system_call}. +@* +@findex bfd_perror +@subsubsection @code{bfd_perror} +@strong{Synopsis} +@example +void bfd_perror (CONST char *message); +@end example +@strong{Description}@* +Print to the standard error stream a string describing the +last BFD error that occurred, or the last system error if +the last BFD error was a system call failure. If @var{message} +is non-NULL and non-empty, the error string printed is preceded +by @var{message}, a colon, and a space. It is followed by a newline. +@* +@subsection BFD error handler +Some BFD functions want to print messages describing the +problem. They call a BFD error handler function. This +function may be overriden by the program. + +The BFD error handler acts like printf. +@* +. +@example +typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...)); + +@end example +@findex bfd_set_error_handler +@subsubsection @code{bfd_set_error_handler} +@strong{Synopsis} +@example +bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); +@end example +@strong{Description}@* +Set the BFD error handler function. Returns the previous +function. +@* +@findex bfd_set_error_program_name +@subsubsection @code{bfd_set_error_program_name} +@strong{Synopsis} +@example +void bfd_set_error_program_name (const char *); +@end example +@strong{Description}@* +Set the program name to use when printing a BFD error. This +is printed before the error message followed by a colon and +space. The string must not be changed after it is passed to +this function. +@* +@section Symbols + +@* +@findex bfd_get_reloc_upper_bound +@subsubsection @code{bfd_get_reloc_upper_bound} +@strong{Synopsis} +@example +long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect); +@end example +@strong{Description}@* +Return the number of bytes required to store the +relocation information associated with section @var{sect} +attached to bfd @var{abfd}. If an error occurs, return -1. +@* +@findex bfd_canonicalize_reloc +@subsubsection @code{bfd_canonicalize_reloc} +@strong{Synopsis} +@example +long bfd_canonicalize_reloc + (bfd *abfd, + asection *sec, + arelent **loc, + asymbol **syms); +@end example +@strong{Description}@* +Call the back end associated with the open BFD +@var{abfd} and translate the external form of the relocation +information attached to @var{sec} into the internal canonical +form. Place the table into memory at @var{loc}, which has +been preallocated, usually by a call to +@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or +-1 on error. + +The @var{syms} table is also needed for horrible internal magic +reasons. +@* +@findex bfd_set_reloc +@subsubsection @code{bfd_set_reloc} +@strong{Synopsis} +@example +void bfd_set_reloc + (bfd *abfd, asection *sec, arelent **rel, unsigned int count) +@end example +@strong{Description}@* +Set the relocation pointer and count within +section @var{sec} to the values @var{rel} and @var{count}. +The argument @var{abfd} is ignored. +@* +@findex bfd_set_file_flags +@subsubsection @code{bfd_set_file_flags} +@strong{Synopsis} +@example +boolean bfd_set_file_flags(bfd *abfd, flagword flags); +@end example +@strong{Description}@* +Set the flag word in the BFD @var{abfd} to the value @var{flags}. + +Possible errors are: +@itemize @bullet + +@item +@code{bfd_error_wrong_format} - The target bfd was not of object format. +@item +@code{bfd_error_invalid_operation} - The target bfd was open for reading. +@item +@code{bfd_error_invalid_operation} - +The flag word contained a bit which was not applicable to the +type of file. E.g., an attempt was made to set the @code{D_PAGED} bit +on a BFD format which does not support demand paging. +@end itemize +@* +@findex bfd_set_start_address +@subsubsection @code{bfd_set_start_address} +@strong{Synopsis} +@example +boolean bfd_set_start_address(bfd *abfd, bfd_vma vma); +@end example +@strong{Description}@* +Make @var{vma} the entry point of output BFD @var{abfd}. +@* +@strong{Returns}@* +Returns @code{true} on success, @code{false} otherwise. +@* +@findex bfd_get_mtime +@subsubsection @code{bfd_get_mtime} +@strong{Synopsis} +@example +long bfd_get_mtime(bfd *abfd); +@end example +@strong{Description}@* +Return the file modification time (as read from the file system, or +from the archive header for archive members). +@* +@findex bfd_get_size +@subsubsection @code{bfd_get_size} +@strong{Synopsis} +@example +long bfd_get_size(bfd *abfd); +@end example +@strong{Description}@* +Return the file size (as read from file system) for the file +associated with BFD @var{abfd}. + +The initial motivation for, and use of, this routine is not +so we can get the exact size of the object the BFD applies to, since +that might not be generally possible (archive members for example). +It would be ideal if someone could eventually modify +it so that such results were guaranteed. + +Instead, we want to ask questions like "is this NNN byte sized +object I'm about to try read from file offset YYY reasonable?" +As as example of where we might do this, some object formats +use string tables for which the first @code{sizeof(long)} bytes of the +table contain the size of the table itself, including the size bytes. +If an application tries to read what it thinks is one of these +string tables, without some way to validate the size, and for +some reason the size is wrong (byte swapping error, wrong location +for the string table, etc.), the only clue is likely to be a read +error when it tries to read the table, or a "virtual memory +exhausted" error when it tries to allocate 15 bazillon bytes +of space for the 15 bazillon byte table it is about to read. +This function at least allows us to answer the quesion, "is the +size reasonable?". +@* +@findex bfd_get_gp_size +@subsubsection @code{bfd_get_gp_size} +@strong{Synopsis} +@example +int bfd_get_gp_size(bfd *abfd); +@end example +@strong{Description}@* +Return the maximum size of objects to be optimized using the GP +register under MIPS ECOFF. This is typically set by the @code{-G} +argument to the compiler, assembler or linker. +@* +@findex bfd_set_gp_size +@subsubsection @code{bfd_set_gp_size} +@strong{Synopsis} +@example +void bfd_set_gp_size(bfd *abfd, int i); +@end example +@strong{Description}@* +Set the maximum size of objects to be optimized using the GP +register under ECOFF or MIPS ELF. This is typically set by +the @code{-G} argument to the compiler, assembler or linker. +@* +@findex bfd_scan_vma +@subsubsection @code{bfd_scan_vma} +@strong{Synopsis} +@example +bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base); +@end example +@strong{Description}@* +Convert, like @code{strtoul}, a numerical expression +@var{string} into a @code{bfd_vma} integer, and return that integer. +(Though without as many bells and whistles as @code{strtoul}.) +The expression is assumed to be unsigned (i.e., positive). +If given a @var{base}, it is used as the base for conversion. +A base of 0 causes the function to interpret the string +in hex if a leading "0x" or "0X" is found, otherwise +in octal if a leading zero is found, otherwise in decimal. + +Overflow is not detected. +@* +@findex bfd_copy_private_bfd_data +@subsubsection @code{bfd_copy_private_bfd_data} +@strong{Synopsis} +@example +boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd); +@end example +@strong{Description}@* +Copy private BFD information from the BFD @var{ibfd} to the +the BFD @var{obfd}. Return @code{true} on success, @code{false} on error. +Possible error returns are: + +@itemize @bullet + +@item +@code{bfd_error_no_memory} - +Not enough memory exists to create private data for @var{obfd}. +@end itemize +@example +#define bfd_copy_private_bfd_data(ibfd, obfd) \ + BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ + (ibfd, obfd)) +@end example +@* +@findex bfd_merge_private_bfd_data +@subsubsection @code{bfd_merge_private_bfd_data} +@strong{Synopsis} +@example +boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd); +@end example +@strong{Description}@* +Merge private BFD information from the BFD @var{ibfd} to the +the output file BFD @var{obfd} when linking. Return @code{true} +on success, @code{false} on error. Possible error returns are: + +@itemize @bullet + +@item +@code{bfd_error_no_memory} - +Not enough memory exists to create private data for @var{obfd}. +@end itemize +@example +#define bfd_merge_private_bfd_data(ibfd, obfd) \ + BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ + (ibfd, obfd)) +@end example +@* +@findex bfd_set_private_flags +@subsubsection @code{bfd_set_private_flags} +@strong{Synopsis} +@example +boolean bfd_set_private_flags(bfd *abfd, flagword flags); +@end example +@strong{Description}@* +Set private BFD flag information in the BFD @var{abfd}. +Return @code{true} on success, @code{false} on error. Possible error +returns are: + +@itemize @bullet + +@item +@code{bfd_error_no_memory} - +Not enough memory exists to create private data for @var{obfd}. +@end itemize +@example +#define bfd_set_private_flags(abfd, flags) \ + BFD_SEND (abfd, _bfd_set_private_flags, \ + (abfd, flags)) +@end example +@* +@findex stuff +@subsubsection @code{stuff} +@strong{Description}@* +Stuff which should be documented: +@example +#define bfd_sizeof_headers(abfd, reloc) \ + BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) + +#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ + BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line)) + + /* Do these three do anything useful at all, for any back end? */ +#define bfd_debug_info_start(abfd) \ + BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) + +#define bfd_debug_info_end(abfd) \ + BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) + +#define bfd_debug_info_accumulate(abfd, section) \ + BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) + + +#define bfd_stat_arch_elt(abfd, stat) \ + BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) + +#define bfd_update_armap_timestamp(abfd) \ + BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) + +#define bfd_set_arch_mach(abfd, arch, mach)\ + BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) + +#define bfd_relax_section(abfd, section, link_info, again) \ + BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again)) + +#define bfd_link_hash_table_create(abfd) \ + BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) + +#define bfd_link_add_symbols(abfd, info) \ + BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) + +#define bfd_final_link(abfd, info) \ + BFD_SEND (abfd, _bfd_final_link, (abfd, info)) + +#define bfd_free_cached_info(abfd) \ + BFD_SEND (abfd, _bfd_free_cached_info, (abfd)) + +#define bfd_get_dynamic_symtab_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd)) + +#define bfd_print_private_bfd_data(abfd, file)\ + BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file)) + +#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ + BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) + +#define bfd_get_dynamic_reloc_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) + +#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \ + BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) + +extern bfd_byte *bfd_get_relocated_section_contents + PARAMS ((bfd *, struct bfd_link_info *, + struct bfd_link_order *, bfd_byte *, + boolean, asymbol **)); + +@end example +@* diff -urN binutils-2.7/bfd/doc/cache.texi binutils-2.8/bfd/doc/cache.texi --- binutils-2.7/bfd/doc/cache.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/cache.texi Wed Apr 30 12:56:26 1997 @@ -0,0 +1,95 @@ +@section File caching +The file caching mechanism is embedded within BFD and allows +the application to open as many BFDs as it wants without +regard to the underlying operating system's file descriptor +limit (often as low as 20 open files). The module in +@code{cache.c} maintains a least recently used list of +@code{BFD_CACHE_MAX_OPEN} files, and exports the name +@code{bfd_cache_lookup}, which runs around and makes sure that +the required BFD is open. If not, then it chooses a file to +close, closes it and opens the one wanted, returning its file +handle. +@* +@findex BFD_CACHE_MAX_OPEN macro +@subsubsection @code{BFD_CACHE_MAX_OPEN macro} +@strong{Description}@* +The maximum number of files which the cache will keep open at +one time. +@example +#define BFD_CACHE_MAX_OPEN 10 +@end example +@* +@findex bfd_last_cache +@subsubsection @code{bfd_last_cache} +@strong{Synopsis} +@example +extern bfd *bfd_last_cache; +@end example +@strong{Description}@* +Zero, or a pointer to the topmost BFD on the chain. This is +used by the @code{bfd_cache_lookup} macro in @file{libbfd.h} to +determine when it can avoid a function call. +@* +@findex bfd_cache_lookup +@subsubsection @code{bfd_cache_lookup} +@strong{Description}@* +Check to see if the required BFD is the same as the last one +looked up. If so, then it can use the stream in the BFD with +impunity, since it can't have changed since the last lookup; +otherwise, it has to perform the complicated lookup function. +@example +#define bfd_cache_lookup(x) \ + ((x)==bfd_last_cache? \ + (FILE*)(bfd_last_cache->iostream): \ + bfd_cache_lookup_worker(x)) +@end example +@* +@findex bfd_cache_init +@subsubsection @code{bfd_cache_init} +@strong{Synopsis} +@example +boolean bfd_cache_init (bfd *abfd); +@end example +@strong{Description}@* +Add a newly opened BFD to the cache. +@* +@findex bfd_cache_close +@subsubsection @code{bfd_cache_close} +@strong{Synopsis} +@example +boolean bfd_cache_close (bfd *abfd); +@end example +@strong{Description}@* +Remove the BFD @var{abfd} from the cache. If the attached file is open, +then close it too. +@* +@strong{Returns}@* +@code{false} is returned if closing the file fails, @code{true} is +returned if all is well. +@* +@findex bfd_open_file +@subsubsection @code{bfd_open_file} +@strong{Synopsis} +@example +FILE* bfd_open_file(bfd *abfd); +@end example +@strong{Description}@* +Call the OS to open a file for @var{abfd}. Return the @code{FILE *} +(possibly @code{NULL}) that results from this operation. Set up the +BFD so that future accesses know the file is open. If the @code{FILE *} +returned is @code{NULL}, then it won't have been put in the +cache, so it won't have to be removed from it. +@* +@findex bfd_cache_lookup_worker +@subsubsection @code{bfd_cache_lookup_worker} +@strong{Synopsis} +@example +FILE *bfd_cache_lookup_worker(bfd *abfd); +@end example +@strong{Description}@* +Called when the macro @code{bfd_cache_lookup} fails to find a +quick answer. Find a file descriptor for @var{abfd}. If +necessary, it open it. If there are already more than +@code{BFD_CACHE_MAX_OPEN} files open, it tries to close one first, to +avoid running out of file descriptors. +@* diff -urN binutils-2.7/bfd/doc/coffcode.texi binutils-2.8/bfd/doc/coffcode.texi --- binutils-2.7/bfd/doc/coffcode.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/coffcode.texi Wed Apr 30 12:56:27 1997 @@ -0,0 +1,627 @@ +@section coff backends +BFD supports a number of different flavours of coff format. +The major differences between formats are the sizes and +alignments of fields in structures on disk, and the occasional +extra field. + +Coff in all its varieties is implemented with a few common +files and a number of implementation specific files. For +example, The 88k bcs coff format is implemented in the file +@file{coff-m88k.c}. This file @code{#include}s +@file{coff/m88k.h} which defines the external structure of the +coff format for the 88k, and @file{coff/internal.h} which +defines the internal structure. @file{coff-m88k.c} also +defines the relocations used by the 88k format +@xref{Relocations}. + +The Intel i960 processor version of coff is implemented in +@file{coff-i960.c}. This file has the same structure as +@file{coff-m88k.c}, except that it includes @file{coff/i960.h} +rather than @file{coff-m88k.h}. +@* +@subsection Porting to a new version of coff +The recommended method is to select from the existing +implementations the version of coff which is most like the one +you want to use. For example, we'll say that i386 coff is +the one you select, and that your coff flavour is called foo. +Copy @file{i386coff.c} to @file{foocoff.c}, copy +@file{../include/coff/i386.h} to @file{../include/coff/foo.h}, +and add the lines to @file{targets.c} and @file{Makefile.in} +so that your new back end is used. Alter the shapes of the +structures in @file{../include/coff/foo.h} so that they match +what you need. You will probably also have to add +@code{#ifdef}s to the code in @file{coff/internal.h} and +@file{coffcode.h} if your version of coff is too wild. + +You can verify that your new BFD backend works quite simply by +building @file{objdump} from the @file{binutils} directory, +and making sure that its version of what's going on and your +host system's idea (assuming it has the pretty standard coff +dump utility, usually called @code{att-dump} or just +@code{dump}) are the same. Then clean up your code, and send +what you've done to Cygnus. Then your stuff will be in the +next release, and you won't have to keep integrating it. +@* +@subsection How the coff backend works + +@* +@subsubsection File layout +The Coff backend is split into generic routines that are +applicable to any Coff target and routines that are specific +to a particular target. The target-specific routines are +further split into ones which are basically the same for all +Coff targets except that they use the external symbol format +or use different values for certain constants. + +The generic routines are in @file{coffgen.c}. These routines +work for any Coff target. They use some hooks into the target +specific code; the hooks are in a @code{bfd_coff_backend_data} +structure, one of which exists for each target. + +The essentially similar target-specific routines are in +@file{coffcode.h}. This header file includes executable C code. +The various Coff targets first include the appropriate Coff +header file, make any special defines that are needed, and +then include @file{coffcode.h}. + +Some of the Coff targets then also have additional routines in +the target source file itself. + +For example, @file{coff-i960.c} includes +@file{coff/internal.h} and @file{coff/i960.h}. It then +defines a few constants, such as @code{I960}, and includes +@file{coffcode.h}. Since the i960 has complex relocation +types, @file{coff-i960.c} also includes some code to +manipulate the i960 relocs. This code is not in +@file{coffcode.h} because it would not be used by any other +target. +@* +@subsubsection Bit twiddling +Each flavour of coff supported in BFD has its own header file +describing the external layout of the structures. There is also +an internal description of the coff layout, in +@file{coff/internal.h}. A major function of the +coff backend is swapping the bytes and twiddling the bits to +translate the external form of the structures into the normal +internal form. This is all performed in the +@code{bfd_swap}_@i{thing}_@i{direction} routines. Some +elements are different sizes between different versions of +coff; it is the duty of the coff version specific include file +to override the definitions of various packing routines in +@file{coffcode.h}. E.g., the size of line number entry in coff is +sometimes 16 bits, and sometimes 32 bits. @code{#define}ing +@code{PUT_LNSZ_LNNO} and @code{GET_LNSZ_LNNO} will select the +correct one. No doubt, some day someone will find a version of +coff which has a varying field size not catered to at the +moment. To port BFD, that person will have to add more @code{#defines}. +Three of the bit twiddling routines are exported to +@code{gdb}; @code{coff_swap_aux_in}, @code{coff_swap_sym_in} +and @code{coff_swap_linno_in}. @code{GDB} reads the symbol +table on its own, but uses BFD to fix things up. More of the +bit twiddlers are exported for @code{gas}; +@code{coff_swap_aux_out}, @code{coff_swap_sym_out}, +@code{coff_swap_lineno_out}, @code{coff_swap_reloc_out}, +@code{coff_swap_filehdr_out}, @code{coff_swap_aouthdr_out}, +@code{coff_swap_scnhdr_out}. @code{Gas} currently keeps track +of all the symbol table and reloc drudgery itself, thereby +saving the internal BFD overhead, but uses BFD to swap things +on the way out, making cross ports much safer. Doing so also +allows BFD (and thus the linker) to use the same header files +as @code{gas}, which makes one avenue to disaster disappear. +@* +@subsubsection Symbol reading +The simple canonical form for symbols used by BFD is not rich +enough to keep all the information available in a coff symbol +table. The back end gets around this problem by keeping the original +symbol table around, "behind the scenes". + +When a symbol table is requested (through a call to +@code{bfd_canonicalize_symtab}), a request gets through to +@code{coff_get_normalized_symtab}. This reads the symbol table from +the coff file and swaps all the structures inside into the +internal form. It also fixes up all the pointers in the table +(represented in the file by offsets from the first symbol in +the table) into physical pointers to elements in the new +internal table. This involves some work since the meanings of +fields change depending upon context: a field that is a +pointer to another structure in the symbol table at one moment +may be the size in bytes of a structure at the next. Another +pass is made over the table. All symbols which mark file names +(@code{C_FILE} symbols) are modified so that the internal +string points to the value in the auxent (the real filename) +rather than the normal text associated with the symbol +(@code{".file"}). + +At this time the symbol names are moved around. Coff stores +all symbols less than nine characters long physically +within the symbol table; longer strings are kept at the end of +the file in the string table. This pass moves all strings +into memory and replaces them with pointers to the strings. + +The symbol table is massaged once again, this time to create +the canonical table used by the BFD application. Each symbol +is inspected in turn, and a decision made (using the +@code{sclass} field) about the various flags to set in the +@code{asymbol}. @xref{Symbols}. The generated canonical table +shares strings with the hidden internal symbol table. + +Any linenumbers are read from the coff file too, and attached +to the symbols which own the functions the linenumbers belong to. +@* +@subsubsection Symbol writing +Writing a symbol to a coff file which didn't come from a coff +file will lose any debugging information. The @code{asymbol} +structure remembers the BFD from which the symbol was taken, and on +output the back end makes sure that the same destination target as +source target is present. + +When the symbols have come from a coff file then all the +debugging information is preserved. + +Symbol tables are provided for writing to the back end in a +vector of pointers to pointers. This allows applications like +the linker to accumulate and output large symbol tables +without having to do too much byte copying. + +This function runs through the provided symbol table and +patches each symbol marked as a file place holder +(@code{C_FILE}) to point to the next file place holder in the +list. It also marks each @code{offset} field in the list with +the offset from the first symbol of the current symbol. + +Another function of this procedure is to turn the canonical +value form of BFD into the form used by coff. Internally, BFD +expects symbol values to be offsets from a section base; so a +symbol physically at 0x120, but in a section starting at +0x100, would have the value 0x20. Coff expects symbols to +contain their final value, so symbols have their values +changed at this point to reflect their sum with their owning +section. This transformation uses the +@code{output_section} field of the @code{asymbol}'s +@code{asection} @xref{Sections}. + +@itemize @bullet + +@item +@code{coff_mangle_symbols} +@end itemize +This routine runs though the provided symbol table and uses +the offsets generated by the previous pass and the pointers +generated when the symbol table was read in to create the +structured hierachy required by coff. It changes each pointer +to a symbol into the index into the symbol table of the asymbol. + +@itemize @bullet + +@item +@code{coff_write_symbols} +@end itemize +This routine runs through the symbol table and patches up the +symbols from their internal form into the coff way, calls the +bit twiddlers, and writes out the table to the file. +@* +@findex coff_symbol_type +@subsubsection @code{coff_symbol_type} +@strong{Description}@* +The hidden information for an @code{asymbol} is described in a +@code{combined_entry_type}: +@* +. +@example +typedef struct coff_ptr_struct +@{ + + /* Remembers the offset from the first symbol in the file for + this symbol. Generated by coff_renumber_symbols. */ +unsigned int offset; + + /* Should the value of this symbol be renumbered. Used for + XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */ +unsigned int fix_value : 1; + + /* Should the tag field of this symbol be renumbered. + Created by coff_pointerize_aux. */ +unsigned int fix_tag : 1; + + /* Should the endidx field of this symbol be renumbered. + Created by coff_pointerize_aux. */ +unsigned int fix_end : 1; + + /* Should the x_csect.x_scnlen field be renumbered. + Created by coff_pointerize_aux. */ +unsigned int fix_scnlen : 1; + + /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the + index into the line number entries. Set by + coff_slurp_symbol_table. */ +unsigned int fix_line : 1; + + /* The container for the symbol structure as read and translated + from the file. */ + +union @{ + union internal_auxent auxent; + struct internal_syment syment; + @} u; +@} combined_entry_type; + + +/* Each canonical asymbol really looks like this: */ + +typedef struct coff_symbol_struct +@{ + /* The actual symbol which the rest of BFD works with */ +asymbol symbol; + + /* A pointer to the hidden information for this symbol */ +combined_entry_type *native; + + /* A pointer to the linenumber information for this symbol */ +struct lineno_cache_entry *lineno; + + /* Have the line numbers been relocated yet ? */ +boolean done_lineno; +@} coff_symbol_type; +@end example +@findex bfd_coff_backend_data +@subsubsection @code{bfd_coff_backend_data} +Special entry points for gdb to swap in coff symbol table parts: +@example +typedef struct +@{ + void (*_bfd_coff_swap_aux_in) PARAMS (( + bfd *abfd, + PTR ext, + int type, + int class, + int indaux, + int numaux, + PTR in)); + + void (*_bfd_coff_swap_sym_in) PARAMS (( + bfd *abfd , + PTR ext, + PTR in)); + + void (*_bfd_coff_swap_lineno_in) PARAMS (( + bfd *abfd, + PTR ext, + PTR in)); + +@end example +Special entry points for gas to swap out coff parts: +@example + unsigned int (*_bfd_coff_swap_aux_out) PARAMS (( + bfd *abfd, + PTR in, + int type, + int class, + int indaux, + int numaux, + PTR ext)); + + unsigned int (*_bfd_coff_swap_sym_out) PARAMS (( + bfd *abfd, + PTR in, + PTR ext)); + + unsigned int (*_bfd_coff_swap_lineno_out) PARAMS (( + bfd *abfd, + PTR in, + PTR ext)); + + unsigned int (*_bfd_coff_swap_reloc_out) PARAMS (( + bfd *abfd, + PTR src, + PTR dst)); + + unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS (( + bfd *abfd, + PTR in, + PTR out)); + + unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS (( + bfd *abfd, + PTR in, + PTR out)); + + unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS (( + bfd *abfd, + PTR in, + PTR out)); + +@end example +Special entry points for generic COFF routines to call target +dependent COFF routines: +@example + unsigned int _bfd_filhsz; + unsigned int _bfd_aoutsz; + unsigned int _bfd_scnhsz; + unsigned int _bfd_symesz; + unsigned int _bfd_auxesz; + unsigned int _bfd_relsz; + unsigned int _bfd_linesz; + boolean _bfd_coff_long_filenames; + boolean _bfd_coff_long_section_names; + unsigned int _bfd_coff_default_section_alignment_power; + void (*_bfd_coff_swap_filehdr_in) PARAMS (( + bfd *abfd, + PTR ext, + PTR in)); + void (*_bfd_coff_swap_aouthdr_in) PARAMS (( + bfd *abfd, + PTR ext, + PTR in)); + void (*_bfd_coff_swap_scnhdr_in) PARAMS (( + bfd *abfd, + PTR ext, + PTR in)); + void (*_bfd_coff_swap_reloc_in) PARAMS (( + bfd *abfd, + PTR ext, + PTR in)); + boolean (*_bfd_coff_bad_format_hook) PARAMS (( + bfd *abfd, + PTR internal_filehdr)); + boolean (*_bfd_coff_set_arch_mach_hook) PARAMS (( + bfd *abfd, + PTR internal_filehdr)); + PTR (*_bfd_coff_mkobject_hook) PARAMS (( + bfd *abfd, + PTR internal_filehdr, + PTR internal_aouthdr)); + flagword (*_bfd_styp_to_sec_flags_hook) PARAMS (( + bfd *abfd, + PTR internal_scnhdr, + const char *name)); + void (*_bfd_set_alignment_hook) PARAMS (( + bfd *abfd, + asection *sec, + PTR internal_scnhdr)); + boolean (*_bfd_coff_slurp_symbol_table) PARAMS (( + bfd *abfd)); + boolean (*_bfd_coff_symname_in_debug) PARAMS (( + bfd *abfd, + struct internal_syment *sym)); + boolean (*_bfd_coff_pointerize_aux_hook) PARAMS (( + bfd *abfd, + combined_entry_type *table_base, + combined_entry_type *symbol, + unsigned int indaux, + combined_entry_type *aux)); + boolean (*_bfd_coff_print_aux) PARAMS (( + bfd *abfd, + FILE *file, + combined_entry_type *table_base, + combined_entry_type *symbol, + combined_entry_type *aux, + unsigned int indaux)); + void (*_bfd_coff_reloc16_extra_cases) PARAMS (( + bfd *abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + arelent *reloc, + bfd_byte *data, + unsigned int *src_ptr, + unsigned int *dst_ptr)); + int (*_bfd_coff_reloc16_estimate) PARAMS (( + bfd *abfd, + asection *input_section, + arelent *r, + unsigned int shrink, + struct bfd_link_info *link_info)); + boolean (*_bfd_coff_sym_is_global) PARAMS (( + bfd *abfd, + struct internal_syment *)); + boolean (*_bfd_coff_compute_section_file_positions) PARAMS (( + bfd *abfd)); + boolean (*_bfd_coff_start_final_link) PARAMS (( + bfd *output_bfd, + struct bfd_link_info *info)); + boolean (*_bfd_coff_relocate_section) PARAMS (( + bfd *output_bfd, + struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + struct internal_reloc *relocs, + struct internal_syment *syms, + asection **sections)); + reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS (( + bfd *abfd, + asection *sec, + struct internal_reloc *rel, + struct coff_link_hash_entry *h, + struct internal_syment *sym, + bfd_vma *addendp)); + boolean (*_bfd_coff_adjust_symndx) PARAMS (( + bfd *obfd, + struct bfd_link_info *info, + bfd *ibfd, + asection *sec, + struct internal_reloc *reloc, + boolean *adjustedp)); + boolean (*_bfd_coff_link_add_one_symbol) PARAMS (( + struct bfd_link_info *info, + bfd *abfd, + const char *name, + flagword flags, + asection *section, + bfd_vma value, + const char *string, + boolean copy, + boolean collect, + struct bfd_link_hash_entry **hashp)); + +@} bfd_coff_backend_data; + +#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) + +#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ + ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) + +#define bfd_coff_swap_sym_in(a,e,i) \ + ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) + +#define bfd_coff_swap_lineno_in(a,e,i) \ + ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) + +#define bfd_coff_swap_reloc_out(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) + +#define bfd_coff_swap_lineno_out(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) + +#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ + ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) + +#define bfd_coff_swap_sym_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) + +#define bfd_coff_swap_scnhdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) + +#define bfd_coff_swap_filehdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) + +#define bfd_coff_swap_aouthdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) + +#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) +#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz) +#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz) +#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz) +#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz) +#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz) +#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) +#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames) +#define bfd_coff_long_section_names(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_long_section_names) +#define bfd_coff_default_section_alignment_power(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) +#define bfd_coff_swap_filehdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) + +#define bfd_coff_swap_aouthdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) + +#define bfd_coff_swap_scnhdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) + +#define bfd_coff_swap_reloc_in(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) + +#define bfd_coff_bad_format_hook(abfd, filehdr) \ + ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) + +#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ + ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) +#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ + ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr)) + +#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\ + ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name)) + +#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ + ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) + +#define bfd_coff_slurp_symbol_table(abfd)\ + ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) + +#define bfd_coff_symname_in_debug(abfd, sym)\ + ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) + +#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ + ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ + (abfd, file, base, symbol, aux, indaux)) + +#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\ + ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ + (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) + +#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ + ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ + (abfd, section, reloc, shrink, link_info)) + +#define bfd_coff_sym_is_global(abfd, sym)\ + ((coff_backend_info (abfd)->_bfd_coff_sym_is_global)\ + (abfd, sym)) + +#define bfd_coff_compute_section_file_positions(abfd)\ + ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ + (abfd)) + +#define bfd_coff_start_final_link(obfd, info)\ + ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ + (obfd, info)) +#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ + ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ + (obfd, info, ibfd, o, con, rel, isyms, secs)) +#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ + ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ + (abfd, sec, rel, h, sym, addendp)) +#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ + ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ + (obfd, info, ibfd, sec, rel, adjustedp)) +#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\ + ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ + (info, abfd, name, flags, section, value, string, cp, coll, hashp)) + +@end example +@subsubsection Writing relocations +To write relocations, the back end steps though the +canonical relocation table and create an +@code{internal_reloc}. The symbol index to use is removed from +the @code{offset} field in the symbol table supplied. The +address comes directly from the sum of the section base +address and the relocation offset; the type is dug directly +from the howto field. Then the @code{internal_reloc} is +swapped into the shape of an @code{external_reloc} and written +out to disk. +@* +@subsubsection Reading linenumbers +Creating the linenumber table is done by reading in the entire +coff linenumber table, and creating another table for internal use. + +A coff linenumber table is structured so that each function +is marked as having a line number of 0. Each line within the +function is an offset from the first line in the function. The +base of the line number information for the table is stored in +the symbol associated with the function. + +The information is copied from the external to the internal +table, and each symbol which marks a function is marked by +pointing its... + +How does this work ? +@* +@subsubsection Reading relocations +Coff relocations are easily transformed into the internal BFD form +(@code{arelent}). + +Reading a coff relocation table is done in the following stages: + +@itemize @bullet + +@item +Read the entire coff relocation table into memory. + +@item +Process each relocation in turn; first swap it from the +external to the internal form. + +@item +Turn the symbol referenced in the relocation's symbol index +into a pointer into the canonical symbol table. +This table is the same as the one returned by a call to +@code{bfd_canonicalize_symtab}. The back end will call that +routine and save the result if a canonicalization hasn't been done. + +@item +The reloc index is turned into a pointer to a howto +structure, in a back end specific way. For instance, the 386 +and 960 use the @code{r_type} to directly produce an index +into a howto table vector; the 88k subtracts a number from the +@code{r_type} field and creates an addend field. +@end itemize +@* diff -urN binutils-2.7/bfd/doc/core.texi binutils-2.8/bfd/doc/core.texi --- binutils-2.7/bfd/doc/core.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/core.texi Wed Apr 30 12:56:27 1997 @@ -0,0 +1,38 @@ +@section Core files + +@* +@strong{Description}@* +These are functions pertaining to core files. +@* +@findex bfd_core_file_failing_command +@subsubsection @code{bfd_core_file_failing_command} +@strong{Synopsis} +@example +CONST char *bfd_core_file_failing_command(bfd *abfd); +@end example +@strong{Description}@* +Return a read-only string explaining which program was running +when it failed and produced the core file @var{abfd}. +@* +@findex bfd_core_file_failing_signal +@subsubsection @code{bfd_core_file_failing_signal} +@strong{Synopsis} +@example +int bfd_core_file_failing_signal(bfd *abfd); +@end example +@strong{Description}@* +Returns the signal number which caused the core dump which +generated the file the BFD @var{abfd} is attached to. +@* +@findex core_file_matches_executable_p +@subsubsection @code{core_file_matches_executable_p} +@strong{Synopsis} +@example +boolean core_file_matches_executable_p + (bfd *core_bfd, bfd *exec_bfd); +@end example +@strong{Description}@* +Return @code{true} if the core file attached to @var{core_bfd} +was generated by a run of the executable file attached to +@var{exec_bfd}, @code{false} otherwise. +@* diff -urN binutils-2.7/bfd/doc/elf.texi binutils-2.8/bfd/doc/elf.texi --- binutils-2.7/bfd/doc/elf.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/elf.texi Wed Apr 30 12:56:27 1997 @@ -0,0 +1,22 @@ +@section ELF backends +BFD support for ELF formats is being worked on. +Currently, the best supported back ends are for sparc and i386 +(running svr4 or Solaris 2). + +Documentation of the internals of the support code still needs +to be written. The code is changing quickly enough that we +haven't bothered yet. +@* +@findex bfd_elf_find_section +@subsubsection @code{bfd_elf_find_section} +@strong{Synopsis} +@example +struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name); +@end example +@strong{Description}@* +Helper functions for GDB to locate the string tables. +Since BFD hides string tables from callers, GDB needs to use an +internal hook to find them. Sun's .stabstr, in particular, +isn't even pointed to by the .stab section, so ordinary +mechanisms wouldn't work to find it, even if we had some. +@* diff -urN binutils-2.7/bfd/doc/format.texi binutils-2.8/bfd/doc/format.texi --- binutils-2.7/bfd/doc/format.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/format.texi Wed Apr 30 12:56:27 1997 @@ -0,0 +1,108 @@ +@section File formats +A format is a BFD concept of high level file contents type. The +formats supported by BFD are: + +@itemize @bullet + +@item +@code{bfd_object} +@end itemize +The BFD may contain data, symbols, relocations and debug info. + +@itemize @bullet + +@item +@code{bfd_archive} +@end itemize +The BFD contains other BFDs and an optional index. + +@itemize @bullet + +@item +@code{bfd_core} +@end itemize +The BFD contains the result of an executable core dump. +@* +@findex bfd_check_format +@subsubsection @code{bfd_check_format} +@strong{Synopsis} +@example +boolean bfd_check_format(bfd *abfd, bfd_format format); +@end example +@strong{Description}@* +Verify if the file attached to the BFD @var{abfd} is compatible +with the format @var{format} (i.e., one of @code{bfd_object}, +@code{bfd_archive} or @code{bfd_core}). + +If the BFD has been set to a specific target before the +call, only the named target and format combination is +checked. If the target has not been set, or has been set to +@code{default}, then all the known target backends is +interrogated to determine a match. If the default target +matches, it is used. If not, exactly one target must recognize +the file, or an error results. + +The function returns @code{true} on success, otherwise @code{false} +with one of the following error codes: + +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - +if @code{format} is not one of @code{bfd_object}, @code{bfd_archive} or +@code{bfd_core}. + +@item +@code{bfd_error_system_call} - +if an error occured during a read - even some file mismatches +can cause bfd_error_system_calls. + +@item +@code{file_not_recognised} - +none of the backends recognised the file format. + +@item +@code{bfd_error_file_ambiguously_recognized} - +more than one backend recognised the file format. +@end itemize +@* +@findex bfd_check_format_matches +@subsubsection @code{bfd_check_format_matches} +@strong{Synopsis} +@example +boolean bfd_check_format_matches(bfd *abfd, bfd_format format, char ***matching); +@end example +@strong{Description}@* +Like @code{bfd_check_format}, except when it returns false with +@code{bfd_errno} set to @code{bfd_error_file_ambiguously_recognized}. In that +case, if @var{matching} is not NULL, it will be filled in with +a NULL-terminated list of the names of the formats that matched, +allocated with @code{malloc}. +Then the user may choose a format and try again. + +When done with the list that @var{matching} points to, the caller +should free it. +@* +@findex bfd_set_format +@subsubsection @code{bfd_set_format} +@strong{Synopsis} +@example +boolean bfd_set_format(bfd *abfd, bfd_format format); +@end example +@strong{Description}@* +This function sets the file format of the BFD @var{abfd} to the +format @var{format}. If the target set in the BFD does not +support the format requested, the format is invalid, or the BFD +is not open for writing, then an error occurs. +@* +@findex bfd_format_string +@subsubsection @code{bfd_format_string} +@strong{Synopsis} +@example +CONST char *bfd_format_string(bfd_format format); +@end example +@strong{Description}@* +Return a pointer to a const string +@code{invalid}, @code{object}, @code{archive}, @code{core}, or @code{unknown}, +depending upon the value of @var{format}. +@* diff -urN binutils-2.7/bfd/doc/hash.texi binutils-2.8/bfd/doc/hash.texi --- binutils-2.7/bfd/doc/hash.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/hash.texi Wed Apr 30 12:56:27 1997 @@ -0,0 +1,244 @@ +@section Hash Tables +@cindex Hash tables +BFD provides a simple set of hash table functions. Routines +are provided to initialize a hash table, to free a hash table, +to look up a string in a hash table and optionally create an +entry for it, and to traverse a hash table. There is +currently no routine to delete an string from a hash table. + +The basic hash table does not permit any data to be stored +with a string. However, a hash table is designed to present a +base class from which other types of hash tables may be +derived. These derived types may store additional information +with the string. Hash tables were implemented in this way, +rather than simply providing a data pointer in a hash table +entry, because they were designed for use by the linker back +ends. The linker may create thousands of hash table entries, +and the overhead of allocating private data and storing and +following pointers becomes noticeable. + +The basic hash table code is in @code{hash.c}. + +@menu +* Creating and Freeing a Hash Table:: +* Looking Up or Entering a String:: +* Traversing a Hash Table:: +* Deriving a New Hash Table Type:: +@end menu +@* +@node Creating and Freeing a Hash Table, Looking Up or Entering a String, Hash Tables, Hash Tables +@subsection Creating and freeing a hash table +@findex bfd_hash_table_init +@findex bfd_hash_table_init_n +To create a hash table, create an instance of a @code{struct +bfd_hash_table} (defined in @code{bfd.h}) and call +@code{bfd_hash_table_init} (if you know approximately how many +entries you will need, the function @code{bfd_hash_table_init_n}, +which takes a @var{size} argument, may be used). +@code{bfd_hash_table_init} returns @code{false} if some sort of +error occurs. + +@findex bfd_hash_newfunc +The function @code{bfd_hash_table_init} take as an argument a +function to use to create new entries. For a basic hash +table, use the function @code{bfd_hash_newfunc}. @xref{Deriving +a New Hash Table Type} for why you would want to use a +different value for this argument. + +@findex bfd_hash_allocate +@code{bfd_hash_table_init} will create an objalloc which will be +used to allocate new entries. You may allocate memory on this +objalloc using @code{bfd_hash_allocate}. + +@findex bfd_hash_table_free +Use @code{bfd_hash_table_free} to free up all the memory that has +been allocated for a hash table. This will not free up the +@code{struct bfd_hash_table} itself, which you must provide. +@* +@node Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables +@subsection Looking up or entering a string +@findex bfd_hash_lookup +The function @code{bfd_hash_lookup} is used both to look up a +string in the hash table and to create a new entry. + +If the @var{create} argument is @code{false}, @code{bfd_hash_lookup} +will look up a string. If the string is found, it will +returns a pointer to a @code{struct bfd_hash_entry}. If the +string is not found in the table @code{bfd_hash_lookup} will +return @code{NULL}. You should not modify any of the fields in +the returns @code{struct bfd_hash_entry}. + +If the @var{create} argument is @code{true}, the string will be +entered into the hash table if it is not already there. +Either way a pointer to a @code{struct bfd_hash_entry} will be +returned, either to the existing structure or to a newly +created one. In this case, a @code{NULL} return means that an +error occurred. + +If the @var{create} argument is @code{true}, and a new entry is +created, the @var{copy} argument is used to decide whether to +copy the string onto the hash table objalloc or not. If +@var{copy} is passed as @code{false}, you must be careful not to +deallocate or modify the string as long as the hash table +exists. +@* +@node Traversing a Hash Table, Deriving a New Hash Table Type, Looking Up or Entering a String, Hash Tables +@subsection Traversing a hash table +@findex bfd_hash_traverse +The function @code{bfd_hash_traverse} may be used to traverse a +hash table, calling a function on each element. The traversal +is done in a random order. + +@code{bfd_hash_traverse} takes as arguments a function and a +generic @code{void *} pointer. The function is called with a +hash table entry (a @code{struct bfd_hash_entry *}) and the +generic pointer passed to @code{bfd_hash_traverse}. The function +must return a @code{boolean} value, which indicates whether to +continue traversing the hash table. If the function returns +@code{false}, @code{bfd_hash_traverse} will stop the traversal and +return immediately. +@* +@node Deriving a New Hash Table Type, , Traversing a Hash Table, Hash Tables +@subsection Deriving a new hash table type +Many uses of hash tables want to store additional information +which each entry in the hash table. Some also find it +convenient to store additional information with the hash table +itself. This may be done using a derived hash table. + +Since C is not an object oriented language, creating a derived +hash table requires sticking together some boilerplate +routines with a few differences specific to the type of hash +table you want to create. + +An example of a derived hash table is the linker hash table. +The structures for this are defined in @code{bfdlink.h}. The +functions are in @code{linker.c}. + +You may also derive a hash table from an already derived hash +table. For example, the a.out linker backend code uses a hash +table derived from the linker hash table. + +@menu +* Define the Derived Structures:: +* Write the Derived Creation Routine:: +* Write Other Derived Routines:: +@end menu +@* +@node Define the Derived Structures, Write the Derived Creation Routine, Deriving a New Hash Table Type, Deriving a New Hash Table Type +@subsubsection Define the derived structures +You must define a structure for an entry in the hash table, +and a structure for the hash table itself. + +The first field in the structure for an entry in the hash +table must be of the type used for an entry in the hash table +you are deriving from. If you are deriving from a basic hash +table this is @code{struct bfd_hash_entry}, which is defined in +@code{bfd.h}. The first field in the structure for the hash +table itself must be of the type of the hash table you are +deriving from itself. If you are deriving from a basic hash +table, this is @code{struct bfd_hash_table}. + +For example, the linker hash table defines @code{struct +bfd_link_hash_entry} (in @code{bfdlink.h}). The first field, +@code{root}, is of type @code{struct bfd_hash_entry}. Similarly, +the first field in @code{struct bfd_link_hash_table}, @code{table}, +is of type @code{struct bfd_hash_table}. +@* +@node Write the Derived Creation Routine, Write Other Derived Routines, Define the Derived Structures, Deriving a New Hash Table Type +@subsubsection Write the derived creation routine +You must write a routine which will create and initialize an +entry in the hash table. This routine is passed as the +function argument to @code{bfd_hash_table_init}. + +In order to permit other hash tables to be derived from the +hash table you are creating, this routine must be written in a +standard way. + +The first argument to the creation routine is a pointer to a +hash table entry. This may be @code{NULL}, in which case the +routine should allocate the right amount of space. Otherwise +the space has already been allocated by a hash table type +derived from this one. + +After allocating space, the creation routine must call the +creation routine of the hash table type it is derived from, +passing in a pointer to the space it just allocated. This +will initialize any fields used by the base hash table. + +Finally the creation routine must initialize any local fields +for the new hash table type. + +Here is a boilerplate example of a creation routine. +@var{function_name} is the name of the routine. +@var{entry_type} is the type of an entry in the hash table you +are creating. @var{base_newfunc} is the name of the creation +routine of the hash table type your hash table is derived +from. +@* +.struct bfd_hash_entry * +@example +@var{function_name} (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +@{ + struct @var{entry_type} *ret = (@var{entry_type} *) entry; + + /* Allocate the structure if it has not already been allocated by a + derived class. */ + if (ret == (@var{entry_type} *) NULL) + @{ + ret = ((@var{entry_type} *) + bfd_hash_allocate (table, sizeof (@var{entry_type}))); + if (ret == (@var{entry_type} *) NULL) + return NULL; + @} + + /* Call the allocation method of the base class. */ + ret = ((@var{entry_type} *) + @var{base_newfunc} ((struct bfd_hash_entry *) ret, table, string)); + + /* Initialize the local fields here. */ + + return (struct bfd_hash_entry *) ret; +@} +@end example +@strong{Description}@* +The creation routine for the linker hash table, which is in +@code{linker.c}, looks just like this example. +@var{function_name} is @code{_bfd_link_hash_newfunc}. +@var{entry_type} is @code{struct bfd_link_hash_entry}. +@var{base_newfunc} is @code{bfd_hash_newfunc}, the creation +routine for a basic hash table. + +@code{_bfd_link_hash_newfunc} also initializes the local fields +in a linker hash table entry: @code{type}, @code{written} and +@code{next}. +@* +@node Write Other Derived Routines, , Write the Derived Creation Routine, Deriving a New Hash Table Type +@subsubsection Write other derived routines +You will want to write other routines for your new hash table, +as well. + +You will want an initialization routine which calls the +initialization routine of the hash table you are deriving from +and initializes any other local fields. For the linker hash +table, this is @code{_bfd_link_hash_table_init} in @code{linker.c}. + +You will want a lookup routine which calls the lookup routine +of the hash table you are deriving from and casts the result. +The linker hash table uses @code{bfd_link_hash_lookup} in +@code{linker.c} (this actually takes an additional argument which +it uses to decide how to return the looked up value). + +You may want a traversal routine. This should just call the +traversal routine of the hash table you are deriving from with +appropriate casts. The linker hash table uses +@code{bfd_link_hash_traverse} in @code{linker.c}. + +These routines may simply be defined as macros. For example, +the a.out backend linker hash table, which is derived from the +linker hash table, uses macros for the lookup and traversal +routines. These are @code{aout_link_hash_lookup} and +@code{aout_link_hash_traverse} in aoutx.h. +@* diff -urN binutils-2.7/bfd/doc/init.texi binutils-2.8/bfd/doc/init.texi --- binutils-2.7/bfd/doc/init.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/init.texi Wed Apr 30 12:56:27 1997 @@ -0,0 +1,13 @@ +@section Initialization +These are the functions that handle initializing a BFD. +@* +@findex bfd_init +@subsubsection @code{bfd_init} +@strong{Synopsis} +@example +void bfd_init(void); +@end example +@strong{Description}@* +This routine must be called before any other BFD function to +initialize magical internal data structures. +@* diff -urN binutils-2.7/bfd/doc/libbfd.texi binutils-2.8/bfd/doc/libbfd.texi --- binutils-2.7/bfd/doc/libbfd.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/libbfd.texi Wed Apr 30 12:56:27 1997 @@ -0,0 +1,142 @@ +@section Internal functions + +@* +@strong{Description}@* +These routines are used within BFD. +They are not intended for export, but are documented here for +completeness. +@* +@findex bfd_write_bigendian_4byte_int +@subsubsection @code{bfd_write_bigendian_4byte_int} +@strong{Synopsis} +@example +void bfd_write_bigendian_4byte_int(bfd *abfd, int i); +@end example +@strong{Description}@* +Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big +endian order regardless of what else is going on. This is useful in +archives. +@* +@findex bfd_put_size +@subsubsection @code{bfd_put_size} +@findex bfd_get_size +@subsubsection @code{bfd_get_size} +@strong{Description}@* +These macros as used for reading and writing raw data in +sections; each access (except for bytes) is vectored through +the target format of the BFD and mangled accordingly. The +mangling performs any necessary endian translations and +removes alignment restrictions. Note that types accepted and +returned by these macros are identical so they can be swapped +around in macros---for example, @file{libaout.h} defines @code{GET_WORD} +to either @code{bfd_get_32} or @code{bfd_get_64}. + +In the put routines, @var{val} must be a @code{bfd_vma}. If we are on a +system without prototypes, the caller is responsible for making +sure that is true, with a cast if necessary. We don't cast +them in the macro definitions because that would prevent @code{lint} +or @code{gcc -Wall} from detecting sins such as passing a pointer. +To detect calling these with less than a @code{bfd_vma}, use +@code{gcc -Wconversion} on a host with 64 bit @code{bfd_vma}'s. +@example + + /* Byte swapping macros for user section data. */ + +#define bfd_put_8(abfd, val, ptr) \ + (*((unsigned char *)(ptr)) = (unsigned char)(val)) +#define bfd_put_signed_8 \ + bfd_put_8 +#define bfd_get_8(abfd, ptr) \ + (*(unsigned char *)(ptr)) +#define bfd_get_signed_8(abfd, ptr) \ + ((*(unsigned char *)(ptr) ^ 0x80) - 0x80) + +#define bfd_put_16(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_putx16, ((val),(ptr))) +#define bfd_put_signed_16 \ + bfd_put_16 +#define bfd_get_16(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx16, (ptr)) +#define bfd_get_signed_16(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) + +#define bfd_put_32(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_putx32, ((val),(ptr))) +#define bfd_put_signed_32 \ + bfd_put_32 +#define bfd_get_32(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx32, (ptr)) +#define bfd_get_signed_32(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx_signed_32, (ptr)) + +#define bfd_put_64(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_putx64, ((val), (ptr))) +#define bfd_put_signed_64 \ + bfd_put_64 +#define bfd_get_64(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx64, (ptr)) +#define bfd_get_signed_64(abfd, ptr) \ + BFD_SEND(abfd, bfd_getx_signed_64, (ptr)) + +@end example +@* +@findex bfd_h_put_size +@subsubsection @code{bfd_h_put_size} +@strong{Description}@* +These macros have the same function as their @code{bfd_get_x} +bretheren, except that they are used for removing information +for the header records of object files. Believe it or not, +some object files keep their header records in big endian +order and their data in little endian order. +@example + + /* Byte swapping macros for file header data. */ + +#define bfd_h_put_8(abfd, val, ptr) \ + bfd_put_8 (abfd, val, ptr) +#define bfd_h_put_signed_8(abfd, val, ptr) \ + bfd_put_8 (abfd, val, ptr) +#define bfd_h_get_8(abfd, ptr) \ + bfd_get_8 (abfd, ptr) +#define bfd_h_get_signed_8(abfd, ptr) \ + bfd_get_signed_8 (abfd, ptr) + +#define bfd_h_put_16(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_h_putx16,(val,ptr)) +#define bfd_h_put_signed_16 \ + bfd_h_put_16 +#define bfd_h_get_16(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx16,(ptr)) +#define bfd_h_get_signed_16(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr)) + +#define bfd_h_put_32(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_h_putx32,(val,ptr)) +#define bfd_h_put_signed_32 \ + bfd_h_put_32 +#define bfd_h_get_32(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx32,(ptr)) +#define bfd_h_get_signed_32(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr)) + +#define bfd_h_put_64(abfd, val, ptr) \ + BFD_SEND(abfd, bfd_h_putx64,(val, ptr)) +#define bfd_h_put_signed_64 \ + bfd_h_put_64 +#define bfd_h_get_64(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx64,(ptr)) +#define bfd_h_get_signed_64(abfd, ptr) \ + BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr)) + +@end example +@* +@findex bfd_log2 +@subsubsection @code{bfd_log2} +@strong{Synopsis} +@example +unsigned int bfd_log2(bfd_vma x); +@end example +@strong{Description}@* +Return the log base 2 of the value supplied, rounded up. E.g., an +@var{x} of 1025 returns 11. +@* diff -urN binutils-2.7/bfd/doc/linker.texi binutils-2.8/bfd/doc/linker.texi --- binutils-2.7/bfd/doc/linker.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/linker.texi Wed Apr 30 12:56:27 1997 @@ -0,0 +1,365 @@ +@section Linker Functions +@cindex Linker +The linker uses three special entry points in the BFD target +vector. It is not necessary to write special routines for +these entry points when creating a new BFD back end, since +generic versions are provided. However, writing them can +speed up linking and make it use significantly less runtime +memory. + +The first routine creates a hash table used by the other +routines. The second routine adds the symbols from an object +file to the hash table. The third routine takes all the +object files and links them together to create the output +file. These routines are designed so that the linker proper +does not need to know anything about the symbols in the object +files that it is linking. The linker merely arranges the +sections as directed by the linker script and lets BFD handle +the details of symbols and relocs. + +The second routine and third routines are passed a pointer to +a @code{struct bfd_link_info} structure (defined in +@code{bfdlink.h}) which holds information relevant to the link, +including the linker hash table (which was created by the +first routine) and a set of callback functions to the linker +proper. + +The generic linker routines are in @code{linker.c}, and use the +header file @code{genlink.h}. As of this writing, the only back +ends which have implemented versions of these routines are +a.out (in @code{aoutx.h}) and ECOFF (in @code{ecoff.c}). The a.out +routines are used as examples throughout this section. + +@menu +* Creating a Linker Hash Table:: +* Adding Symbols to the Hash Table:: +* Performing the Final Link:: +@end menu +@* +@node Creating a Linker Hash Table, Adding Symbols to the Hash Table, Linker Functions, Linker Functions +@subsection Creating a linker hash table +@cindex _bfd_link_hash_table_create in target vector +@cindex target vector (_bfd_link_hash_table_create) +The linker routines must create a hash table, which must be +derived from @code{struct bfd_link_hash_table} described in +@code{bfdlink.c}. @xref{Hash Tables} for information on how to +create a derived hash table. This entry point is called using +the target vector of the linker output file. + +The @code{_bfd_link_hash_table_create} entry point must allocate +and initialize an instance of the desired hash table. If the +back end does not require any additional information to be +stored with the entries in the hash table, the entry point may +simply create a @code{struct bfd_link_hash_table}. Most likely, +however, some additional information will be needed. + +For example, with each entry in the hash table the a.out +linker keeps the index the symbol has in the final output file +(this index number is used so that when doing a relocateable +link the symbol index used in the output file can be quickly +filled in when copying over a reloc). The a.out linker code +defines the required structures and functions for a hash table +derived from @code{struct bfd_link_hash_table}. The a.out linker +hash table is created by the function +@code{NAME(aout,link_hash_table_create)}; it simply allocates +space for the hash table, initializes it, and returns a +pointer to it. + +When writing the linker routines for a new back end, you will +generally not know exactly which fields will be required until +you have finished. You should simply create a new hash table +which defines no additional fields, and then simply add fields +as they become necessary. +@* +@node Adding Symbols to the Hash Table, Performing the Final Link, Creating a Linker Hash Table, Linker Functions +@subsection Adding symbols to the hash table +@cindex _bfd_link_add_symbols in target vector +@cindex target vector (_bfd_link_add_symbols) +The linker proper will call the @code{_bfd_link_add_symbols} +entry point for each object file or archive which is to be +linked (typically these are the files named on the command +line, but some may also come from the linker script). The +entry point is responsible for examining the file. For an +object file, BFD must add any relevant symbol information to +the hash table. For an archive, BFD must determine which +elements of the archive should be used and adding them to the +link. + +The a.out version of this entry point is +@code{NAME(aout,link_add_symbols)}. + +@menu +* Differing file formats:: +* Adding symbols from an object file:: +* Adding symbols from an archive:: +@end menu +@* +@node Differing file formats, Adding symbols from an object file, Adding Symbols to the Hash Table, Adding Symbols to the Hash Table +@subsubsection Differing file formats +Normally all the files involved in a link will be of the same +format, but it is also possible to link together different +format object files, and the back end must support that. The +@code{_bfd_link_add_symbols} entry point is called via the target +vector of the file to be added. This has an important +consequence: the function may not assume that the hash table +is the type created by the corresponding +@code{_bfd_link_hash_table_create} vector. All the +@code{_bfd_link_add_symbols} function can assume about the hash +table is that it is derived from @code{struct +bfd_link_hash_table}. + +Sometimes the @code{_bfd_link_add_symbols} function must store +some information in the hash table entry to be used by the +@code{_bfd_final_link} function. In such a case the @code{creator} +field of the hash table must be checked to make sure that the +hash table was created by an object file of the same format. + +The @code{_bfd_final_link} routine must be prepared to handle a +hash entry without any extra information added by the +@code{_bfd_link_add_symbols} function. A hash entry without +extra information will also occur when the linker script +directs the linker to create a symbol. Note that, regardless +of how a hash table entry is added, all the fields will be +initialized to some sort of null value by the hash table entry +initialization function. + +See @code{ecoff_link_add_externals} for an example of how to +check the @code{creator} field before saving information (in this +case, the ECOFF external symbol debugging information) in a +hash table entry. +@* +@node Adding symbols from an object file, Adding symbols from an archive, Differing file formats, Adding Symbols to the Hash Table +@subsubsection Adding symbols from an object file +When the @code{_bfd_link_add_symbols} routine is passed an object +file, it must add all externally visible symbols in that +object file to the hash table. The actual work of adding the +symbol to the hash table is normally handled by the function +@code{_bfd_generic_link_add_one_symbol}. The +@code{_bfd_link_add_symbols} routine is responsible for reading +all the symbols from the object file and passing the correct +information to @code{_bfd_generic_link_add_one_symbol}. + +The @code{_bfd_link_add_symbols} routine should not use +@code{bfd_canonicalize_symtab} to read the symbols. The point of +providing this routine is to avoid the overhead of converting +the symbols into generic @code{asymbol} structures. + +@findex _bfd_generic_link_add_one_symbol +@code{_bfd_generic_link_add_one_symbol} handles the details of +combining common symbols, warning about multiple definitions, +and so forth. It takes arguments which describe the symbol to +add, notably symbol flags, a section, and an offset. The +symbol flags include such things as @code{BSF_WEAK} or +@code{BSF_INDIRECT}. The section is a section in the object +file, or something like @code{bfd_und_section_ptr} for an undefined +symbol or @code{bfd_com_section_ptr} for a common symbol. + +If the @code{_bfd_final_link} routine is also going to need to +read the symbol information, the @code{_bfd_link_add_symbols} +routine should save it somewhere attached to the object file +BFD. However, the information should only be saved if the +@code{keep_memory} field of the @code{info} argument is true, so +that the @code{-no-keep-memory} linker switch is effective. + +The a.out function which adds symbols from an object file is +@code{aout_link_add_object_symbols}, and most of the interesting +work is in @code{aout_link_add_symbols}. The latter saves +pointers to the hash tables entries created by +@code{_bfd_generic_link_add_one_symbol} indexed by symbol number, +so that the @code{_bfd_final_link} routine does not have to call +the hash table lookup routine to locate the entry. +@* +@node Adding symbols from an archive, , Adding symbols from an object file, Adding Symbols to the Hash Table +@subsubsection Adding symbols from an archive +When the @code{_bfd_link_add_symbols} routine is passed an +archive, it must look through the symbols defined by the +archive and decide which elements of the archive should be +included in the link. For each such element it must call the +@code{add_archive_element} linker callback, and it must add the +symbols from the object file to the linker hash table. + +@findex _bfd_generic_link_add_archive_symbols +In most cases the work of looking through the symbols in the +archive should be done by the +@code{_bfd_generic_link_add_archive_symbols} function. This +function builds a hash table from the archive symbol table and +looks through the list of undefined symbols to see which +elements should be included. +@code{_bfd_generic_link_add_archive_symbols} is passed a function +to call to make the final decision about adding an archive +element to the link and to do the actual work of adding the +symbols to the linker hash table. + +The function passed to +@code{_bfd_generic_link_add_archive_symbols} must read the +symbols of the archive element and decide whether the archive +element should be included in the link. If the element is to +be included, the @code{add_archive_element} linker callback +routine must be called with the element as an argument, and +the elements symbols must be added to the linker hash table +just as though the element had itself been passed to the +@code{_bfd_link_add_symbols} function. + +When the a.out @code{_bfd_link_add_symbols} function receives an +archive, it calls @code{_bfd_generic_link_add_archive_symbols} +passing @code{aout_link_check_archive_element} as the function +argument. @code{aout_link_check_archive_element} calls +@code{aout_link_check_ar_symbols}. If the latter decides to add +the element (an element is only added if it provides a real, +non-common, definition for a previously undefined or common +symbol) it calls the @code{add_archive_element} callback and then +@code{aout_link_check_archive_element} calls +@code{aout_link_add_symbols} to actually add the symbols to the +linker hash table. + +The ECOFF back end is unusual in that it does not normally +call @code{_bfd_generic_link_add_archive_symbols}, because ECOFF +archives already contain a hash table of symbols. The ECOFF +back end searches the archive itself to avoid the overhead of +creating a new hash table. +@* +@node Performing the Final Link, , Adding Symbols to the Hash Table, Linker Functions +@subsection Performing the final link +@cindex _bfd_link_final_link in target vector +@cindex target vector (_bfd_final_link) +When all the input files have been processed, the linker calls +the @code{_bfd_final_link} entry point of the output BFD. This +routine is responsible for producing the final output file, +which has several aspects. It must relocate the contents of +the input sections and copy the data into the output sections. +It must build an output symbol table including any local +symbols from the input files and the global symbols from the +hash table. When producing relocateable output, it must +modify the input relocs and write them into the output file. +There may also be object format dependent work to be done. + +The linker will also call the @code{write_object_contents} entry +point when the BFD is closed. The two entry points must work +together in order to produce the correct output file. + +The details of how this works are inevitably dependent upon +the specific object file format. The a.out +@code{_bfd_final_link} routine is @code{NAME(aout,final_link)}. + +@menu +* Information provided by the linker:: +* Relocating the section contents:: +* Writing the symbol table:: +@end menu +@* +@node Information provided by the linker, Relocating the section contents, Performing the Final Link, Performing the Final Link +@subsubsection Information provided by the linker +Before the linker calls the @code{_bfd_final_link} entry point, +it sets up some data structures for the function to use. + +The @code{input_bfds} field of the @code{bfd_link_info} structure +will point to a list of all the input files included in the +link. These files are linked through the @code{link_next} field +of the @code{bfd} structure. + +Each section in the output file will have a list of +@code{link_order} structures attached to the @code{link_order_head} +field (the @code{link_order} structure is defined in +@code{bfdlink.h}). These structures describe how to create the +contents of the output section in terms of the contents of +various input sections, fill constants, and, eventually, other +types of information. They also describe relocs that must be +created by the BFD backend, but do not correspond to any input +file; this is used to support -Ur, which builds constructors +while generating a relocateable object file. +@* +@node Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link +@subsubsection Relocating the section contents +The @code{_bfd_final_link} function should look through the +@code{link_order} structures attached to each section of the +output file. Each @code{link_order} structure should either be +handled specially, or it should be passed to the function +@code{_bfd_default_link_order} which will do the right thing +(@code{_bfd_default_link_order} is defined in @code{linker.c}). + +For efficiency, a @code{link_order} of type +@code{bfd_indirect_link_order} whose associated section belongs +to a BFD of the same format as the output BFD must be handled +specially. This type of @code{link_order} describes part of an +output section in terms of a section belonging to one of the +input files. The @code{_bfd_final_link} function should read the +contents of the section and any associated relocs, apply the +relocs to the section contents, and write out the modified +section contents. If performing a relocateable link, the +relocs themselves must also be modified and written out. + +@findex _bfd_relocate_contents +@findex _bfd_final_link_relocate +The functions @code{_bfd_relocate_contents} and +@code{_bfd_final_link_relocate} provide some general support for +performing the actual relocations, notably overflow checking. +Their arguments include information about the symbol the +relocation is against and a @code{reloc_howto_type} argument +which describes the relocation to perform. These functions +are defined in @code{reloc.c}. + +The a.out function which handles reading, relocating, and +writing section contents is @code{aout_link_input_section}. The +actual relocation is done in @code{aout_link_input_section_std} +and @code{aout_link_input_section_ext}. +@* +@node Writing the symbol table, , Relocating the section contents, Performing the Final Link +@subsubsection Writing the symbol table +The @code{_bfd_final_link} function must gather all the symbols +in the input files and write them out. It must also write out +all the symbols in the global hash table. This must be +controlled by the @code{strip} and @code{discard} fields of the +@code{bfd_link_info} structure. + +The local symbols of the input files will not have been +entered into the linker hash table. The @code{_bfd_final_link} +routine must consider each input file and include the symbols +in the output file. It may be convenient to do this when +looking through the @code{link_order} structures, or it may be +done by stepping through the @code{input_bfds} list. + +The @code{_bfd_final_link} routine must also traverse the global +hash table to gather all the externally visible symbols. It +is possible that most of the externally visible symbols may be +written out when considering the symbols of each input file, +but it is still necessary to traverse the hash table since the +linker script may have defined some symbols that are not in +any of the input files. + +The @code{strip} field of the @code{bfd_link_info} structure +controls which symbols are written out. The possible values +are listed in @code{bfdlink.h}. If the value is @code{strip_some}, +then the @code{keep_hash} field of the @code{bfd_link_info} +structure is a hash table of symbols to keep; each symbol +should be looked up in this hash table, and only symbols which +are present should be included in the output file. + +If the @code{strip} field of the @code{bfd_link_info} structure +permits local symbols to be written out, the @code{discard} field +is used to further controls which local symbols are included +in the output file. If the value is @code{discard_l}, then all +local symbols which begin with a certain prefix are discarded; +this is controlled by the @code{bfd_is_local_label_name} entry point. + +The a.out backend handles symbols by calling +@code{aout_link_write_symbols} on each input BFD and then +traversing the global hash table with the function +@code{aout_link_write_other_symbol}. It builds a string table +while writing out the symbols, which is written to the output +file at the end of @code{NAME(aout,final_link)}. +@* +@findex bfd_link_split_section +@subsubsection @code{bfd_link_split_section} +@strong{Synopsis} +@example +boolean bfd_link_split_section(bfd *abfd, asection *sec); +@end example +@strong{Description}@* +Return nonzero if @var{sec} should be split during a +reloceatable or final link. +@example +#define bfd_link_split_section(abfd, sec) \ + BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec)) + +@end example +@* diff -urN binutils-2.7/bfd/doc/makefile.vms binutils-2.8/bfd/doc/makefile.vms --- binutils-2.7/bfd/doc/makefile.vms Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/makefile.vms Wed Apr 30 12:56:27 1997 @@ -0,0 +1,5 @@ +CFLAGS = /noopt/include=([],[-],[-.-.include]) +LDFLAGS = /nomap +LDLIBS = ,sys$$library:vaxcrtl.olb/lib + +all: chew.exe diff -urN binutils-2.7/bfd/doc/opncls.texi binutils-2.8/bfd/doc/opncls.texi --- binutils-2.7/bfd/doc/opncls.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/opncls.texi Wed Apr 30 12:56:27 1997 @@ -0,0 +1,128 @@ +@section Opening and closing BFDs + +@* +@findex bfd_openr +@subsubsection @code{bfd_openr} +@strong{Synopsis} +@example +bfd *bfd_openr(CONST char *filename, CONST char *target); +@end example +@strong{Description}@* +Open the file @var{filename} (using @code{fopen}) with the target +@var{target}. Return a pointer to the created BFD. + +Calls @code{bfd_find_target}, so @var{target} is interpreted as by +that function. + +If @code{NULL} is returned then an error has occured. Possible errors +are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or @code{system_call} error. +@* +@findex bfd_fdopenr +@subsubsection @code{bfd_fdopenr} +@strong{Synopsis} +@example +bfd *bfd_fdopenr(CONST char *filename, CONST char *target, int fd); +@end example +@strong{Description}@* +@code{bfd_fdopenr} is to @code{bfd_fopenr} much like @code{fdopen} is to @code{fopen}. +It opens a BFD on a file already described by the @var{fd} +supplied. + +When the file is later @code{bfd_close}d, the file descriptor will be closed. + +If the caller desires that this file descriptor be cached by BFD +(opened as needed, closed as needed to free descriptors for +other opens), with the supplied @var{fd} used as an initial +file descriptor (but subject to closure at any time), call +bfd_set_cacheable(bfd, 1) on the returned BFD. The default is to +assume no cacheing; the file descriptor will remain open until +@code{bfd_close}, and will not be affected by BFD operations on other +files. + +Possible errors are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} and @code{bfd_error_system_call}. +@* +@findex bfd_openstreamr +@subsubsection @code{bfd_openstreamr} +@strong{Synopsis} +@example +bfd *bfd_openstreamr(const char *, const char *, PTR); +@end example +@strong{Description}@* +Open a BFD for read access on an existing stdio stream. When +the BFD is passed to @code{bfd_close}, the stream will be closed. +@* +@findex bfd_openw +@subsubsection @code{bfd_openw} +@strong{Synopsis} +@example +bfd *bfd_openw(CONST char *filename, CONST char *target); +@end example +@strong{Description}@* +Create a BFD, associated with file @var{filename}, using the +file format @var{target}, and return a pointer to it. + +Possible errors are @code{bfd_error_system_call}, @code{bfd_error_no_memory}, +@code{bfd_error_invalid_target}. +@* +@findex bfd_close +@subsubsection @code{bfd_close} +@strong{Synopsis} +@example +boolean bfd_close(bfd *abfd); +@end example +@strong{Description}@* +Close a BFD. If the BFD was open for writing, +then pending operations are completed and the file written out +and closed. If the created file is executable, then +@code{chmod} is called to mark it as such. + +All memory attached to the BFD is released. + +The file descriptor associated with the BFD is closed (even +if it was passed in to BFD by @code{bfd_fdopenr}). +@* +@strong{Returns}@* +@code{true} is returned if all is ok, otherwise @code{false}. +@* +@findex bfd_close_all_done +@subsubsection @code{bfd_close_all_done} +@strong{Synopsis} +@example +boolean bfd_close_all_done(bfd *); +@end example +@strong{Description}@* +Close a BFD. Differs from @code{bfd_close} +since it does not complete any pending operations. This +routine would be used if the application had just used BFD for +swapping and didn't want to use any of the writing code. + +If the created file is executable, then @code{chmod} is called +to mark it as such. + +All memory attached to the BFD is released. +@* +@strong{Returns}@* +@code{true} is returned if all is ok, otherwise @code{false}. +@* +@findex bfd_create +@subsubsection @code{bfd_create} +@strong{Synopsis} +@example +bfd *bfd_create(CONST char *filename, bfd *templ); +@end example +@strong{Description}@* +Create a new BFD in the manner of +@code{bfd_openw}, but without opening a file. The new BFD +takes the target from the target used by @var{template}. The +format is always set to @code{bfd_object}. +@* +@findex bfd_alloc +@subsubsection @code{bfd_alloc} +@strong{Synopsis} +@example +PTR bfd_alloc (bfd *abfd, size_t wanted); +@end example +@strong{Description}@* +Allocate a block of @var{wanted} bytes of memory attached to +@code{abfd} and return a pointer to it. +@* diff -urN binutils-2.7/bfd/doc/reloc.texi binutils-2.8/bfd/doc/reloc.texi --- binutils-2.7/bfd/doc/reloc.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/reloc.texi Wed Apr 30 13:14:11 1997 @@ -0,0 +1,914 @@ +@section Relocations +BFD maintains relocations in much the same way it maintains +symbols: they are left alone until required, then read in +en-mass and translated into an internal form. A common +routine @code{bfd_perform_relocation} acts upon the +canonical form to do the fixup. + +Relocations are maintained on a per section basis, +while symbols are maintained on a per BFD basis. + +All that a back end has to do to fit the BFD interface is to create +a @code{struct reloc_cache_entry} for each relocation +in a particular section, and fill in the right bits of the structures. + +@menu +* typedef arelent:: +* howto manager:: +@end menu +@* + +@node typedef arelent, howto manager, Relocations, Relocations +@subsection typedef arelent +This is the structure of a relocation entry: +@* +. +@example +typedef enum bfd_reloc_status +@{ + /* No errors detected */ + bfd_reloc_ok, + + /* The relocation was performed, but there was an overflow. */ + bfd_reloc_overflow, + + /* The address to relocate was not within the section supplied. */ + bfd_reloc_outofrange, + + /* Used by special functions */ + bfd_reloc_continue, + + /* Unsupported relocation size requested. */ + bfd_reloc_notsupported, + + /* Unused */ + bfd_reloc_other, + + /* The symbol to relocate against was undefined. */ + bfd_reloc_undefined, + + /* The relocation was performed, but may not be ok - presently + generated only when linking i960 coff files with i960 b.out + symbols. If this type is returned, the error_message argument + to bfd_perform_relocation will be set. */ + bfd_reloc_dangerous + @} + bfd_reloc_status_type; + + +typedef struct reloc_cache_entry +@{ + /* A pointer into the canonical table of pointers */ + struct symbol_cache_entry **sym_ptr_ptr; + + /* offset in section */ + bfd_size_type address; + + /* addend for relocation value */ + bfd_vma addend; + + /* Pointer to how to perform the required relocation */ + reloc_howto_type *howto; + +@} arelent; +@end example +@strong{Description}@* +Here is a description of each of the fields within an @code{arelent}: + +@itemize @bullet + +@item +@code{sym_ptr_ptr} +@end itemize +The symbol table pointer points to a pointer to the symbol +associated with the relocation request. It is +the pointer into the table returned by the back end's +@code{get_symtab} action. @xref{Symbols}. The symbol is referenced +through a pointer to a pointer so that tools like the linker +can fix up all the symbols of the same name by modifying only +one pointer. The relocation routine looks in the symbol and +uses the base of the section the symbol is attached to and the +value of the symbol as the initial relocation offset. If the +symbol pointer is zero, then the section provided is looked up. + +@itemize @bullet + +@item +@code{address} +@end itemize +The @code{address} field gives the offset in bytes from the base of +the section data which owns the relocation record to the first +byte of relocatable information. The actual data relocated +will be relative to this point; for example, a relocation +type which modifies the bottom two bytes of a four byte word +would not touch the first byte pointed to in a big endian +world. + +@itemize @bullet + +@item +@code{addend} +@end itemize +The @code{addend} is a value provided by the back end to be added (!) +to the relocation offset. Its interpretation is dependent upon +the howto. For example, on the 68k the code: + +@example + char foo[]; + main() + @{ + return foo[0x12345678]; + @} +@end example + +Could be compiled into: + +@example + linkw fp,#-4 + moveb @@#12345678,d0 + extbl d0 + unlk fp + rts +@end example + +This could create a reloc pointing to @code{foo}, but leave the +offset in the data, something like: + +@example +RELOCATION RECORDS FOR [.text]: +offset type value +00000006 32 _foo + +00000000 4e56 fffc ; linkw fp,#-4 +00000004 1039 1234 5678 ; moveb @@#12345678,d0 +0000000a 49c0 ; extbl d0 +0000000c 4e5e ; unlk fp +0000000e 4e75 ; rts +@end example + +Using coff and an 88k, some instructions don't have enough +space in them to represent the full address range, and +pointers have to be loaded in two parts. So you'd get something like: + +@example + or.u r13,r0,hi16(_foo+0x12345678) + ld.b r2,r13,lo16(_foo+0x12345678) + jmp r1 +@end example + +This should create two relocs, both pointing to @code{_foo}, and with +0x12340000 in their addend field. The data would consist of: + +@example +RELOCATION RECORDS FOR [.text]: +offset type value +00000002 HVRT16 _foo+0x12340000 +00000006 LVRT16 _foo+0x12340000 + +00000000 5da05678 ; or.u r13,r0,0x5678 +00000004 1c4d5678 ; ld.b r2,r13,0x5678 +00000008 f400c001 ; jmp r1 +@end example + +The relocation routine digs out the value from the data, adds +it to the addend to get the original offset, and then adds the +value of @code{_foo}. Note that all 32 bits have to be kept around +somewhere, to cope with carry from bit 15 to bit 16. + +One further example is the sparc and the a.out format. The +sparc has a similar problem to the 88k, in that some +instructions don't have room for an entire offset, but on the +sparc the parts are created in odd sized lumps. The designers of +the a.out format chose to not use the data within the section +for storing part of the offset; all the offset is kept within +the reloc. Anything in the data should be ignored. + +@example + save %sp,-112,%sp + sethi %hi(_foo+0x12345678),%g2 + ldsb [%g2+%lo(_foo+0x12345678)],%i0 + ret + restore +@end example + +Both relocs contain a pointer to @code{foo}, and the offsets +contain junk. + +@example +RELOCATION RECORDS FOR [.text]: +offset type value +00000004 HI22 _foo+0x12345678 +00000008 LO10 _foo+0x12345678 + +00000000 9de3bf90 ; save %sp,-112,%sp +00000004 05000000 ; sethi %hi(_foo+0),%g2 +00000008 f048a000 ; ldsb [%g2+%lo(_foo+0)],%i0 +0000000c 81c7e008 ; ret +00000010 81e80000 ; restore +@end example + +@itemize @bullet + +@item +@code{howto} +@end itemize +The @code{howto} field can be imagined as a +relocation instruction. It is a pointer to a structure which +contains information on what to do with all of the other +information in the reloc record and data section. A back end +would normally have a relocation instruction set and turn +relocations into pointers to the correct structure on input - +but it would be possible to create each howto field on demand. +@* +@subsubsection @code{enum complain_overflow} +Indicates what sort of overflow checking should be done when +performing a relocation. +@* +. +@example +enum complain_overflow +@{ + /* Do not complain on overflow. */ + complain_overflow_dont, + + /* Complain if the bitfield overflows, whether it is considered + as signed or unsigned. */ + complain_overflow_bitfield, + + /* Complain if the value overflows when considered as signed + number. */ + complain_overflow_signed, + + /* Complain if the value overflows when considered as an + unsigned number. */ + complain_overflow_unsigned +@}; +@end example +@subsubsection @code{reloc_howto_type} +The @code{reloc_howto_type} is a structure which contains all the +information that libbfd needs to know to tie up a back end's data. +@* +.struct symbol_cache_entry; /* Forward declaration */ +@example + +struct reloc_howto_struct +@{ + /* The type field has mainly a documentary use - the back end can + do what it wants with it, though normally the back end's + external idea of what a reloc number is stored + in this field. For example, a PC relative word relocation + in a coff environment has the type 023 - because that's + what the outside world calls a R_PCRWORD reloc. */ + unsigned int type; + + /* The value the final relocation is shifted right by. This drops + unwanted data from the relocation. */ + unsigned int rightshift; + + /* The size of the item to be relocated. This is *not* a + power-of-two measure. To get the number of bytes operated + on by a type of relocation, use bfd_get_reloc_size. */ + int size; + + /* The number of bits in the item to be relocated. This is used + when doing overflow checking. */ + unsigned int bitsize; + + /* Notes that the relocation is relative to the location in the + data section of the addend. The relocation function will + subtract from the relocation value the address of the location + being relocated. */ + boolean pc_relative; + + /* The bit position of the reloc value in the destination. + The relocated value is left shifted by this amount. */ + unsigned int bitpos; + + /* What type of overflow error should be checked for when + relocating. */ + enum complain_overflow complain_on_overflow; + + /* If this field is non null, then the supplied function is + called rather than the normal function. This allows really + strange relocation methods to be accomodated (e.g., i960 callj + instructions). */ + bfd_reloc_status_type (*special_function) + PARAMS ((bfd *abfd, + arelent *reloc_entry, + struct symbol_cache_entry *symbol, + PTR data, + asection *input_section, + bfd *output_bfd, + char **error_message)); + + /* The textual name of the relocation type. */ + char *name; + + /* When performing a partial link, some formats must modify the + relocations rather than the data - this flag signals this.*/ + boolean partial_inplace; + + /* The src_mask selects which parts of the read in data + are to be used in the relocation sum. E.g., if this was an 8 bit + bit of data which we read and relocated, this would be + 0x000000ff. When we have relocs which have an addend, such as + sun4 extended relocs, the value in the offset part of a + relocating field is garbage so we never use it. In this case + the mask would be 0x00000000. */ + bfd_vma src_mask; + + /* The dst_mask selects which parts of the instruction are replaced + into the instruction. In most cases src_mask == dst_mask, + except in the above special case, where dst_mask would be + 0x000000ff, and src_mask would be 0x00000000. */ + bfd_vma dst_mask; + + /* When some formats create PC relative instructions, they leave + the value of the pc of the place being relocated in the offset + slot of the instruction, so that a PC relative relocation can + be made just by adding in an ordinary offset (e.g., sun3 a.out). + Some formats leave the displacement part of an instruction + empty (e.g., m88k bcs); this flag signals the fact.*/ + boolean pcrel_offset; + +@}; +@end example +@findex The HOWTO Macro +@subsubsection @code{The HOWTO Macro} +@strong{Description}@* +The HOWTO define is horrible and will go away. +@example +#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ + @{(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC@} +@end example +@* +@strong{Description}@* +And will be replaced with the totally magic way. But for the +moment, we are compatible, so do it this way. +@example +#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN) + +@end example +@* +@strong{Description}@* +Helper routine to turn a symbol into a relocation value. +@example +#define HOWTO_PREPARE(relocation, symbol) \ + @{ \ + if (symbol != (asymbol *)NULL) @{ \ + if (bfd_is_com_section (symbol->section)) @{ \ + relocation = 0; \ + @} \ + else @{ \ + relocation = symbol->value; \ + @} \ + @} \ +@} +@end example +@* +@findex bfd_get_reloc_size +@subsubsection @code{bfd_get_reloc_size} +@strong{Synopsis} +@example +int bfd_get_reloc_size (reloc_howto_type *); +@end example +@strong{Description}@* +For a reloc_howto_type that operates on a fixed number of bytes, +this returns the number of bytes operated on. +@* +@findex arelent_chain +@subsubsection @code{arelent_chain} +@strong{Description}@* +How relocs are tied together in an @code{asection}: +@example +typedef struct relent_chain @{ + arelent relent; + struct relent_chain *next; +@} arelent_chain; +@end example +@* +@findex bfd_perform_relocation +@subsubsection @code{bfd_perform_relocation} +@strong{Synopsis} +@example +bfd_reloc_status_type +bfd_perform_relocation + (bfd *abfd, + arelent *reloc_entry, + PTR data, + asection *input_section, + bfd *output_bfd, + char **error_message); +@end example +@strong{Description}@* +If @var{output_bfd} is supplied to this function, the +generated image will be relocatable; the relocations are +copied to the output file after they have been changed to +reflect the new state of the world. There are two ways of +reflecting the results of partial linkage in an output file: +by modifying the output data in place, and by modifying the +relocation record. Some native formats (e.g., basic a.out and +basic coff) have no way of specifying an addend in the +relocation type, so the addend has to go in the output data. +This is no big deal since in these formats the output data +slot will always be big enough for the addend. Complex reloc +types with addends were invented to solve just this problem. +The @var{error_message} argument is set to an error message if +this return @code{bfd_reloc_dangerous}. +@* +@findex bfd_install_relocation +@subsubsection @code{bfd_install_relocation} +@strong{Synopsis} +@example +bfd_reloc_status_type +bfd_install_relocation + (bfd *abfd, + arelent *reloc_entry, + PTR data, bfd_vma data_start, + asection *input_section, + char **error_message); +@end example +@strong{Description}@* +This looks remarkably like @code{bfd_perform_relocation}, except it +does not expect that the section contents have been filled in. +I.e., it's suitable for use when creating, rather than applying +a relocation. + +For now, this function should be considered reserved for the +assembler. +@* + +@node howto manager, , typedef arelent, Relocations +@section The howto manager +When an application wants to create a relocation, but doesn't +know what the target machine might call it, it can find out by +using this bit of code. +@* +@findex bfd_reloc_code_type +@subsubsection @code{bfd_reloc_code_type} +@strong{Description}@* +The insides of a reloc code. The idea is that, eventually, there +will be one enumerator for every type of relocation we ever do. +Pass one of these values to @code{bfd_reloc_type_lookup}, and it'll +return a howto pointer. + +This does mean that the application must determine the correct +enumerator value; you can't get a howto pointer from a random set +of attributes. +@* +Here are the possible values for @code{enum bfd_reloc_code_real}: + +@deffn {} BFD_RELOC_64 +@deffnx {} BFD_RELOC_32 +@deffnx {} BFD_RELOC_26 +@deffnx {} BFD_RELOC_24 +@deffnx {} BFD_RELOC_16 +@deffnx {} BFD_RELOC_14 +@deffnx {} BFD_RELOC_8 +Basic absolute relocations of N bits. +@end deffn +@deffn {} BFD_RELOC_64_PCREL +@deffnx {} BFD_RELOC_32_PCREL +@deffnx {} BFD_RELOC_24_PCREL +@deffnx {} BFD_RELOC_16_PCREL +@deffnx {} BFD_RELOC_12_PCREL +@deffnx {} BFD_RELOC_8_PCREL +PC-relative relocations. Sometimes these are relative to the address +of the relocation itself; sometimes they are relative to the start of +the section containing the relocation. It depends on the specific target. + +The 24-bit relocation is used in some Intel 960 configurations. +@end deffn +@deffn {} BFD_RELOC_32_GOT_PCREL +@deffnx {} BFD_RELOC_16_GOT_PCREL +@deffnx {} BFD_RELOC_8_GOT_PCREL +@deffnx {} BFD_RELOC_32_GOTOFF +@deffnx {} BFD_RELOC_16_GOTOFF +@deffnx {} BFD_RELOC_LO16_GOTOFF +@deffnx {} BFD_RELOC_HI16_GOTOFF +@deffnx {} BFD_RELOC_HI16_S_GOTOFF +@deffnx {} BFD_RELOC_8_GOTOFF +@deffnx {} BFD_RELOC_32_PLT_PCREL +@deffnx {} BFD_RELOC_24_PLT_PCREL +@deffnx {} BFD_RELOC_16_PLT_PCREL +@deffnx {} BFD_RELOC_8_PLT_PCREL +@deffnx {} BFD_RELOC_32_PLTOFF +@deffnx {} BFD_RELOC_16_PLTOFF +@deffnx {} BFD_RELOC_LO16_PLTOFF +@deffnx {} BFD_RELOC_HI16_PLTOFF +@deffnx {} BFD_RELOC_HI16_S_PLTOFF +@deffnx {} BFD_RELOC_8_PLTOFF +For ELF. +@end deffn +@deffn {} BFD_RELOC_68K_GLOB_DAT +@deffnx {} BFD_RELOC_68K_JMP_SLOT +@deffnx {} BFD_RELOC_68K_RELATIVE +Relocations used by 68K ELF. +@end deffn +@deffn {} BFD_RELOC_32_BASEREL +@deffnx {} BFD_RELOC_16_BASEREL +@deffnx {} BFD_RELOC_LO16_BASEREL +@deffnx {} BFD_RELOC_HI16_BASEREL +@deffnx {} BFD_RELOC_HI16_S_BASEREL +@deffnx {} BFD_RELOC_8_BASEREL +@deffnx {} BFD_RELOC_RVA +Linkage-table relative. +@end deffn +@deffn {} BFD_RELOC_8_FFnn +Absolute 8-bit relocation, but used to form an address like 0xFFnn. +@end deffn +@deffn {} BFD_RELOC_32_PCREL_S2 +@deffnx {} BFD_RELOC_16_PCREL_S2 +@deffnx {} BFD_RELOC_23_PCREL_S2 +These PC-relative relocations are stored as word displacements -- +i.e., byte displacements shifted right two bits. The 30-bit word +displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the +SPARC. (SPARC tools generally refer to this as <>.) The +signed 16-bit displacement is used on the MIPS, and the 23-bit +displacement is used on the Alpha. +@end deffn +@deffn {} BFD_RELOC_HI22 +@deffnx {} BFD_RELOC_LO10 +High 22 bits and low 10 bits of 32-bit value, placed into lower bits of +the target word. These are used on the SPARC. +@end deffn +@deffn {} BFD_RELOC_GPREL16 +@deffnx {} BFD_RELOC_GPREL32 +For systems that allocate a Global Pointer register, these are +displacements off that register. These relocation types are +handled specially, because the value the register will have is +decided relatively late. +@end deffn +@deffn {} BFD_RELOC_I960_CALLJ +Reloc types used for i960/b.out. +@end deffn +@deffn {} BFD_RELOC_NONE +@deffnx {} BFD_RELOC_SPARC_WDISP22 +@deffnx {} BFD_RELOC_SPARC22 +@deffnx {} BFD_RELOC_SPARC13 +@deffnx {} BFD_RELOC_SPARC_GOT10 +@deffnx {} BFD_RELOC_SPARC_GOT13 +@deffnx {} BFD_RELOC_SPARC_GOT22 +@deffnx {} BFD_RELOC_SPARC_PC10 +@deffnx {} BFD_RELOC_SPARC_PC22 +@deffnx {} BFD_RELOC_SPARC_WPLT30 +@deffnx {} BFD_RELOC_SPARC_COPY +@deffnx {} BFD_RELOC_SPARC_GLOB_DAT +@deffnx {} BFD_RELOC_SPARC_JMP_SLOT +@deffnx {} BFD_RELOC_SPARC_RELATIVE +@deffnx {} BFD_RELOC_SPARC_UA32 +SPARC ELF relocations. There is probably some overlap with other +relocation types already defined. +@end deffn +@deffn {} BFD_RELOC_SPARC_BASE13 +@deffnx {} BFD_RELOC_SPARC_BASE22 +I think these are specific to SPARC a.out (e.g., Sun 4). +@end deffn +@deffn {} BFD_RELOC_SPARC_64 +@deffnx {} BFD_RELOC_SPARC_10 +@deffnx {} BFD_RELOC_SPARC_11 +@deffnx {} BFD_RELOC_SPARC_OLO10 +@deffnx {} BFD_RELOC_SPARC_HH22 +@deffnx {} BFD_RELOC_SPARC_HM10 +@deffnx {} BFD_RELOC_SPARC_LM22 +@deffnx {} BFD_RELOC_SPARC_PC_HH22 +@deffnx {} BFD_RELOC_SPARC_PC_HM10 +@deffnx {} BFD_RELOC_SPARC_PC_LM22 +@deffnx {} BFD_RELOC_SPARC_WDISP16 +@deffnx {} BFD_RELOC_SPARC_WDISP19 +@deffnx {} BFD_RELOC_SPARC_GLOB_JMP +@deffnx {} BFD_RELOC_SPARC_7 +@deffnx {} BFD_RELOC_SPARC_6 +@deffnx {} BFD_RELOC_SPARC_5 +Some relocations we're using for SPARC V9 -- subject to change. +@end deffn +@deffn {} BFD_RELOC_ALPHA_GPDISP_HI16 +Alpha ECOFF and ELF relocations. Some of these treat the symbol or +"addend" in some special way. +For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when +writing; when reading, it will be the absolute section symbol. The +addend is the displacement in bytes of the "lda" instruction from +the "ldah" instruction (which is at the address of this reloc). +@end deffn +@deffn {} BFD_RELOC_ALPHA_GPDISP_LO16 +For GPDISP_LO16 ("ignore") relocations, the symbol is handled as +with GPDISP_HI16 relocs. The addend is ignored when writing the +relocations out, and is filled in with the file's GP value on +reading, for convenience. +@end deffn +@deffn {} BFD_RELOC_ALPHA_GPDISP +The ELF GPDISP relocation is exactly the same as the GPDISP_HI16 +relocation except that there is no accompanying GPDISP_LO16 +relocation. +@end deffn +@deffn {} BFD_RELOC_ALPHA_LITERAL +@deffnx {} BFD_RELOC_ALPHA_ELF_LITERAL +@deffnx {} BFD_RELOC_ALPHA_LITUSE +The Alpha LITERAL/LITUSE relocs are produced by a symbol reference; +the assembler turns it into a LDQ instruction to load the address of +the symbol, and then fills in a register in the real instruction. + +The LITERAL reloc, at the LDQ instruction, refers to the .lita +section symbol. The addend is ignored when writing, but is filled +in with the file's GP value on reading, for convenience, as with the +GPDISP_LO16 reloc. + +The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16. +It should refer to the symbol to be referenced, as with 16_GOTOFF, +but it generates output not based on the position within the .got +section, but relative to the GP value chosen for the file during the +final link stage. + +The LITUSE reloc, on the instruction using the loaded address, gives +information to the linker that it might be able to use to optimize +away some literal section references. The symbol is ignored (read +as the absolute section symbol), and the "addend" indicates the type +of instruction using the register: +1 - "memory" fmt insn +2 - byte-manipulation (byte offset reg) +3 - jsr (target of branch) + +The GNU linker currently doesn't do any of this optimizing. +@end deffn +@deffn {} BFD_RELOC_ALPHA_HINT +The HINT relocation indicates a value that should be filled into the +"hint" field of a jmp/jsr/ret instruction, for possible branch- +prediction logic which may be provided on some processors. +@end deffn +@deffn {} BFD_RELOC_ALPHA_LINKAGE +The LINKAGE relocation outputs a linkage pair in the object file, +which is filled by the linker. +@end deffn +@deffn {} BFD_RELOC_ALPHA_CODEADDR +The CODEADDR relocation outputs a STO_CA in the object file, +which is filled by the linker. +@end deffn +@deffn {} BFD_RELOC_MIPS_JMP +Bits 27..2 of the relocation address shifted right 2 bits; +simple reloc otherwise. +@end deffn +@deffn {} BFD_RELOC_MIPS16_JMP +The MIPS16 jump instruction. +@end deffn +@deffn {} BFD_RELOC_MIPS16_GPREL +MIPS16 GP relative reloc. +@end deffn +@deffn {} BFD_RELOC_HI16 +High 16 bits of 32-bit value; simple reloc. +@end deffn +@deffn {} BFD_RELOC_HI16_S +High 16 bits of 32-bit value but the low 16 bits will be sign +extended and added to form the final result. If the low 16 +bits form a negative number, we need to add one to the high value +to compensate for the borrow when the low bits are added. +@end deffn +@deffn {} BFD_RELOC_LO16 +Low 16 bits. +@end deffn +@deffn {} BFD_RELOC_PCREL_HI16_S +Like BFD_RELOC_HI16_S, but PC relative. +@end deffn +@deffn {} BFD_RELOC_PCREL_LO16 +Like BFD_RELOC_LO16, but PC relative. +@end deffn +@deffn {} BFD_RELOC_MIPS_GPREL +Relocation relative to the global pointer. +@end deffn +@deffn {} BFD_RELOC_MIPS_LITERAL +Relocation against a MIPS literal section. +@end deffn +@deffn {} BFD_RELOC_MIPS_GOT16 +@deffnx {} BFD_RELOC_MIPS_CALL16 +@deffnx {} BFD_RELOC_MIPS_GPREL32 +@deffnx {} BFD_RELOC_MIPS_GOT_HI16 +@deffnx {} BFD_RELOC_MIPS_GOT_LO16 +@deffnx {} BFD_RELOC_MIPS_CALL_HI16 +@deffnx {} BFD_RELOC_MIPS_CALL_LO16 +MIPS ELF relocations. +@end deffn +@deffn {} BFD_RELOC_386_GOT32 +@deffnx {} BFD_RELOC_386_PLT32 +@deffnx {} BFD_RELOC_386_COPY +@deffnx {} BFD_RELOC_386_GLOB_DAT +@deffnx {} BFD_RELOC_386_JUMP_SLOT +@deffnx {} BFD_RELOC_386_RELATIVE +@deffnx {} BFD_RELOC_386_GOTOFF +@deffnx {} BFD_RELOC_386_GOTPC +i386/elf relocations +@end deffn +@deffn {} BFD_RELOC_NS32K_IMM_8 +@deffnx {} BFD_RELOC_NS32K_IMM_16 +@deffnx {} BFD_RELOC_NS32K_IMM_32 +@deffnx {} BFD_RELOC_NS32K_IMM_8_PCREL +@deffnx {} BFD_RELOC_NS32K_IMM_16_PCREL +@deffnx {} BFD_RELOC_NS32K_IMM_32_PCREL +@deffnx {} BFD_RELOC_NS32K_DISP_8 +@deffnx {} BFD_RELOC_NS32K_DISP_16 +@deffnx {} BFD_RELOC_NS32K_DISP_32 +@deffnx {} BFD_RELOC_NS32K_DISP_8_PCREL +@deffnx {} BFD_RELOC_NS32K_DISP_16_PCREL +@deffnx {} BFD_RELOC_NS32K_DISP_32_PCREL +ns32k relocations +@end deffn +@deffn {} BFD_RELOC_PPC_B26 +@deffnx {} BFD_RELOC_PPC_BA26 +@deffnx {} BFD_RELOC_PPC_TOC16 +@deffnx {} BFD_RELOC_PPC_B16 +@deffnx {} BFD_RELOC_PPC_B16_BRTAKEN +@deffnx {} BFD_RELOC_PPC_B16_BRNTAKEN +@deffnx {} BFD_RELOC_PPC_BA16 +@deffnx {} BFD_RELOC_PPC_BA16_BRTAKEN +@deffnx {} BFD_RELOC_PPC_BA16_BRNTAKEN +@deffnx {} BFD_RELOC_PPC_COPY +@deffnx {} BFD_RELOC_PPC_GLOB_DAT +@deffnx {} BFD_RELOC_PPC_JMP_SLOT +@deffnx {} BFD_RELOC_PPC_RELATIVE +@deffnx {} BFD_RELOC_PPC_LOCAL24PC +@deffnx {} BFD_RELOC_PPC_EMB_NADDR32 +@deffnx {} BFD_RELOC_PPC_EMB_NADDR16 +@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_LO +@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HI +@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HA +@deffnx {} BFD_RELOC_PPC_EMB_SDAI16 +@deffnx {} BFD_RELOC_PPC_EMB_SDA2I16 +@deffnx {} BFD_RELOC_PPC_EMB_SDA2REL +@deffnx {} BFD_RELOC_PPC_EMB_SDA21 +@deffnx {} BFD_RELOC_PPC_EMB_MRKREF +@deffnx {} BFD_RELOC_PPC_EMB_RELSEC16 +@deffnx {} BFD_RELOC_PPC_EMB_RELST_LO +@deffnx {} BFD_RELOC_PPC_EMB_RELST_HI +@deffnx {} BFD_RELOC_PPC_EMB_RELST_HA +@deffnx {} BFD_RELOC_PPC_EMB_BIT_FLD +@deffnx {} BFD_RELOC_PPC_EMB_RELSDA +Power(rs6000) and PowerPC relocations. +@end deffn +@deffn {} BFD_RELOC_CTOR +The type of reloc used to build a contructor table - at the moment +probably a 32 bit wide absolute relocation, but the target can choose. +It generally does map to one of the other relocation types. +@end deffn +@deffn {} BFD_RELOC_ARM_PCREL_BRANCH +ARM 26 bit pc-relative branch. The lowest two bits must be zero and are +not stored in the instruction. +@end deffn +@deffn {} BFD_RELOC_ARM_IMMEDIATE +@deffnx {} BFD_RELOC_ARM_OFFSET_IMM +@deffnx {} BFD_RELOC_ARM_SHIFT_IMM +@deffnx {} BFD_RELOC_ARM_SWI +@deffnx {} BFD_RELOC_ARM_MULTI +@deffnx {} BFD_RELOC_ARM_CP_OFF_IMM +@deffnx {} BFD_RELOC_ARM_ADR_IMM +@deffnx {} BFD_RELOC_ARM_LDR_IMM +@deffnx {} BFD_RELOC_ARM_LITERAL +@deffnx {} BFD_RELOC_ARM_IN_POOL +@deffnx {} BFD_RELOC_ARM_OFFSET_IMM8 +@deffnx {} BFD_RELOC_ARM_HWLITERAL +@deffnx {} BFD_RELOC_ARM_THUMB_ADD +@deffnx {} BFD_RELOC_ARM_THUMB_IMM +@deffnx {} BFD_RELOC_ARM_THUMB_SHIFT +@deffnx {} BFD_RELOC_ARM_THUMB_OFFSET +These relocs are only used within the ARM assembler. They are not +(at present) written to any object files. +@end deffn +@deffn {} BFD_RELOC_SH_PCDISP8BY2 +@deffnx {} BFD_RELOC_SH_PCDISP12BY2 +@deffnx {} BFD_RELOC_SH_IMM4 +@deffnx {} BFD_RELOC_SH_IMM4BY2 +@deffnx {} BFD_RELOC_SH_IMM4BY4 +@deffnx {} BFD_RELOC_SH_IMM8 +@deffnx {} BFD_RELOC_SH_IMM8BY2 +@deffnx {} BFD_RELOC_SH_IMM8BY4 +@deffnx {} BFD_RELOC_SH_PCRELIMM8BY2 +@deffnx {} BFD_RELOC_SH_PCRELIMM8BY4 +@deffnx {} BFD_RELOC_SH_SWITCH16 +@deffnx {} BFD_RELOC_SH_SWITCH32 +@deffnx {} BFD_RELOC_SH_USES +@deffnx {} BFD_RELOC_SH_COUNT +@deffnx {} BFD_RELOC_SH_ALIGN +@deffnx {} BFD_RELOC_SH_CODE +@deffnx {} BFD_RELOC_SH_DATA +@deffnx {} BFD_RELOC_SH_LABEL +Hitachi SH relocs. Not all of these appear in object files. +@end deffn +@deffn {} BFD_RELOC_D10V_10_PCREL_R +Mitsubishi D10V relocs. +This is a 10-bit reloc with the right 2 bits +assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_D10V_10_PCREL_L +Mitsubishi D10V relocs. +This is a 10-bit reloc with the right 2 bits +assumed to be 0. This is the same as the previous reloc +except it is in the left container, i.e., +shifted left 15 bits. +@end deffn +@deffn {} BFD_RELOC_D10V_18 +This is an 18-bit reloc with the right 2 bits +assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_D10V_18_PCREL +This is an 18-bit reloc with the right 2 bits +assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_M32R_24 +Mitsubishi M32R relocs. +This is a 24 bit absolute address. +@end deffn +@deffn {} BFD_RELOC_M32R_10_PCREL +This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_M32R_18_PCREL +This is an 18-bit reloc with the right 2 bits assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_M32R_26_PCREL +This is a 26-bit reloc with the right 2 bits assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_M32R_HI16_ULO +This is a 16-bit reloc containing the high 16 bits of an address +used when the lower 16 bits are treated as unsigned. +@end deffn +@deffn {} BFD_RELOC_M32R_HI16_SLO +This is a 16-bit reloc containing the high 16 bits of an address +used when the lower 16 bits are treated as signed. +@end deffn +@deffn {} BFD_RELOC_M32R_LO16 +This is a 16-bit reloc containing the lower 16 bits of an address. +@end deffn +@deffn {} BFD_RELOC_M32R_SDA16 +This is a 16-bit reloc containing the small data area offset for use in +add3, load, and store instructions. +@end deffn +@deffn {} BFD_RELOC_MN10300_32_PCREL +This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the +instruction. +@end deffn +@deffn {} BFD_RELOC_MN10300_16_PCREL +This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the +instruction. +@end deffn +. +@example +typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; +@end example +@findex bfd_reloc_type_lookup +@subsubsection @code{bfd_reloc_type_lookup} +@strong{Synopsis} +@example +reloc_howto_type * +bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code); +@end example +@strong{Description}@* +Return a pointer to a howto structure which, when +invoked, will perform the relocation @var{code} on data from the +architecture noted. +@* +@findex bfd_default_reloc_type_lookup +@subsubsection @code{bfd_default_reloc_type_lookup} +@strong{Synopsis} +@example +reloc_howto_type *bfd_default_reloc_type_lookup + (bfd *abfd, bfd_reloc_code_real_type code); +@end example +@strong{Description}@* +Provides a default relocation lookup routine for any architecture. +@* +@findex bfd_get_reloc_code_name +@subsubsection @code{bfd_get_reloc_code_name} +@strong{Synopsis} +@example +const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); +@end example +@strong{Description}@* +Provides a printable name for the supplied relocation code. +Useful mainly for printing error messages. +@* +@findex bfd_generic_relax_section +@subsubsection @code{bfd_generic_relax_section} +@strong{Synopsis} +@example +boolean bfd_generic_relax_section + (bfd *abfd, + asection *section, + struct bfd_link_info *, + boolean *); +@end example +@strong{Description}@* +Provides default handling for relaxing for back ends which +don't do relaxing -- i.e., does nothing. +@* +@findex bfd_generic_get_relocated_section_contents +@subsubsection @code{bfd_generic_get_relocated_section_contents} +@strong{Synopsis} +@example +bfd_byte * +bfd_generic_get_relocated_section_contents (bfd *abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + boolean relocateable, + asymbol **symbols); +@end example +@strong{Description}@* +Provides default handling of relocation effort for back ends +which can't be bothered to do it efficiently. +@* diff -urN binutils-2.7/bfd/doc/section.texi binutils-2.8/bfd/doc/section.texi --- binutils-2.7/bfd/doc/section.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/section.texi Wed Apr 30 12:56:27 1997 @@ -0,0 +1,649 @@ +@section Sections +The raw data contained within a BFD is maintained through the +section abstraction. A single BFD may have any number of +sections. It keeps hold of them by pointing to the first; +each one points to the next in the list. + +Sections are supported in BFD in @code{section.c}. + +@menu +* Section Input:: +* Section Output:: +* typedef asection:: +* section prototypes:: +@end menu +@* +@node Section Input, Section Output, Sections, Sections +@subsection Section input +When a BFD is opened for reading, the section structures are +created and attached to the BFD. + +Each section has a name which describes the section in the +outside world---for example, @code{a.out} would contain at least +three sections, called @code{.text}, @code{.data} and @code{.bss}. + +Names need not be unique; for example a COFF file may have several +sections named @code{.data}. + +Sometimes a BFD will contain more than the ``natural'' number of +sections. A back end may attach other sections containing +constructor data, or an application may add a section (using +@code{bfd_make_section}) to the sections attached to an already open +BFD. For example, the linker creates an extra section +@code{COMMON} for each input file's BFD to hold information about +common storage. + +The raw data is not necessarily read in when +the section descriptor is created. Some targets may leave the +data in place until a @code{bfd_get_section_contents} call is +made. Other back ends may read in all the data at once. For +example, an S-record file has to be read once to determine the +size of the data. An IEEE-695 file doesn't contain raw data in +sections, but data and relocation expressions intermixed, so +the data area has to be parsed to get out the data and +relocations. +@* +@node Section Output, typedef asection, Section Input, Sections +@subsection Section output +To write a new object style BFD, the various sections to be +written have to be created. They are attached to the BFD in +the same way as input sections; data is written to the +sections using @code{bfd_set_section_contents}. + +Any program that creates or combines sections (e.g., the assembler +and linker) must use the @code{asection} fields @code{output_section} and +@code{output_offset} to indicate the file sections to which each +section must be written. (If the section is being created from +scratch, @code{output_section} should probably point to the section +itself and @code{output_offset} should probably be zero.) + +The data to be written comes from input sections attached +(via @code{output_section} pointers) to +the output sections. The output section structure can be +considered a filter for the input section: the output section +determines the vma of the output data and the name, but the +input section determines the offset into the output section of +the data to be written. + +E.g., to create a section "O", starting at 0x100, 0x123 long, +containing two subsections, "A" at offset 0x0 (i.e., at vma +0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the @code{asection} +structures would look like: + +@example + section name "A" + output_offset 0x00 + size 0x20 + output_section -----------> section name "O" + | vma 0x100 + section name "B" | size 0x123 + output_offset 0x20 | + size 0x103 | + output_section --------| +@end example +@* +@subsection Link orders +The data within a section is stored in a @dfn{link_order}. +These are much like the fixups in @code{gas}. The link_order +abstraction allows a section to grow and shrink within itself. + +A link_order knows how big it is, and which is the next +link_order and where the raw data for it is; it also points to +a list of relocations which apply to it. + +The link_order is used by the linker to perform relaxing on +final code. The compiler creates code which is as big as +necessary to make it work without relaxing, and the user can +select whether to relax. Sometimes relaxing takes a lot of +time. The linker runs around the relocations to see if any +are attached to data which can be shrunk, if so it does it on +a link_order by link_order basis. +@* + +@node typedef asection, section prototypes, Section Output, Sections +@subsection typedef asection +Here is the section structure: +@* +. +@example +typedef struct sec +@{ + /* The name of the section; the name isn't a copy, the pointer is + the same as that passed to bfd_make_section. */ + + CONST char *name; + + /* Which section is it; 0..nth. */ + + int index; + + /* The next section in the list belonging to the BFD, or NULL. */ + + struct sec *next; + + /* The field flags contains attributes of the section. Some + flags are read in from the object file, and some are + synthesized from other information. */ + + flagword flags; + +#define SEC_NO_FLAGS 0x000 + + /* Tells the OS to allocate space for this section when loading. + This is clear for a section containing debug information + only. */ +#define SEC_ALLOC 0x001 + + /* Tells the OS to load the section from the file when loading. + This is clear for a .bss section. */ +#define SEC_LOAD 0x002 + + /* The section contains data still to be relocated, so there is + some relocation information too. */ +#define SEC_RELOC 0x004 + +#if 0 /* Obsolete ? */ +#define SEC_BALIGN 0x008 +#endif + + /* A signal to the OS that the section contains read only + data. */ +#define SEC_READONLY 0x010 + + /* The section contains code only. */ +#define SEC_CODE 0x020 + + /* The section contains data only. */ +#define SEC_DATA 0x040 + + /* The section will reside in ROM. */ +#define SEC_ROM 0x080 + + /* The section contains constructor information. This section + type is used by the linker to create lists of constructors and + destructors used by @code{g++}. When a back end sees a symbol + which should be used in a constructor list, it creates a new + section for the type of name (e.g., @code{__CTOR_LIST__}), attaches + the symbol to it, and builds a relocation. To build the lists + of constructors, all the linker has to do is catenate all the + sections called @code{__CTOR_LIST__} and relocate the data + contained within - exactly the operations it would peform on + standard data. */ +#define SEC_CONSTRUCTOR 0x100 + + /* The section is a constuctor, 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 + @code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be + @code{SEC_HAS_CONTENTS} */ +#define SEC_HAS_CONTENTS 0x200 + + /* An instruction to the linker to not output the section + even if it has information which would normally be written. */ +#define SEC_NEVER_LOAD 0x400 + + /* The section is a COFF shared library section. This flag is + only for the linker. If this type of section appears in + the input file, the linker must copy it to the output file + without changing the vma or size. FIXME: Although this + was originally intended to be general, it really is COFF + specific (and the flag was renamed to indicate this). It + might be cleaner to have some more general mechanism to + allow the back end to control what the linker does with + sections. */ +#define SEC_COFF_SHARED_LIBRARY 0x800 + + /* The section contains common symbols (symbols may be defined + multiple times, the value of a symbol is the amount of + space it requires, and the largest symbol value is the one + used). Most targets have exactly one of these (which we + translate to bfd_com_section_ptr), but ECOFF has two. */ +#define SEC_IS_COMMON 0x8000 + + /* The section contains only debugging information. For + example, this is set for ELF .debug and .stab sections. + strip tests this flag to see if a section can be + discarded. */ +#define SEC_DEBUGGING 0x10000 + + /* The contents of this section are held in memory pointed to + by the contents field. This is checked by + bfd_get_section_contents, and the data is retrieved from + memory if appropriate. */ +#define SEC_IN_MEMORY 0x20000 + + /* The contents of this section are to be excluded by the + linker for executable and shared objects unless those + objects are to be further relocated. */ +#define SEC_EXCLUDE 0x40000 + + /* The contents of this section are to be sorted by the + based on the address specified in the associated symbol + table. */ +#define SEC_SORT_ENTRIES 0x80000 + + /* When linking, duplicate sections of the same name should be + discarded, rather than being combined into a single section as + is usually done. This is similar to how common symbols are + handled. See SEC_LINK_DUPLICATES below. */ +#define SEC_LINK_ONCE 0x100000 + + /* If SEC_LINK_ONCE is set, this bitfield describes how the linker + should handle duplicate sections. */ +#define SEC_LINK_DUPLICATES 0x600000 + + /* This value for SEC_LINK_DUPLICATES means that duplicate + sections with the same name should simply be discarded. */ +#define SEC_LINK_DUPLICATES_DISCARD 0x0 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if there are any duplicate sections, although + it should still only link one copy. */ +#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections are a different size. */ +#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections contain different + contents. */ +#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000 + + /* This section was created by the linker as part of dynamic + relocation or other arcane processing. It is skipped when + going through the first-pass output, trusting that someone + else up the line will take care of it later. */ +#define SEC_LINKER_CREATED 0x800000 + + /* End of section flags. */ + + /* Some internal packed boolean fields. */ + + /* See the vma field. */ + unsigned int user_set_vma : 1; + + /* Whether relocations have been processed. */ + unsigned int reloc_done : 1; + + /* A mark flag used by some of the linker backends. */ + unsigned int linker_mark : 1; + + /* End of internal packed boolean fields. */ + + /* The virtual memory address of the section - where it will be + at run time. The symbols are relocated against this. The + user_set_vma flag is maintained by bfd; if it's not set, the + backend can assign addresses (for example, in @code{a.out}, where + the default address for @code{.data} is dependent on the specific + target and various flags). */ + + bfd_vma vma; + + /* The load address of the section - where it would be in a + rom image; really only used for writing section header + information. */ + + bfd_vma lma; + + /* The size of the section in bytes, as it will be output. + contains a value even if the section has no contents (e.g., the + size of @code{.bss}). This will be filled in after relocation */ + + bfd_size_type _cooked_size; + + /* The original size on disk of the section, in bytes. Normally this + value is the same as the size, but if some relaxing has + been done, then this value will be bigger. */ + + bfd_size_type _raw_size; + + /* If this section is going to be output, then this value is the + offset into the output section of the first byte in the input + section. E.g., if this was going to start at the 100th byte in + the output section, this value would be 100. */ + + bfd_vma output_offset; + + /* The output section through which to map on output. */ + + struct sec *output_section; + + /* The alignment requirement of the section, as an exponent of 2 - + e.g., 3 aligns to 2^3 (or 8). */ + + unsigned int alignment_power; + + /* If an input section, a pointer to a vector of relocation + records for the data in this section. */ + + struct reloc_cache_entry *relocation; + + /* If an output section, a pointer to a vector of pointers to + relocation records for the data in this section. */ + + struct reloc_cache_entry **orelocation; + + /* The number of relocation records in one of the above */ + + unsigned reloc_count; + + /* Information below is back end specific - and not always used + or updated. */ + + /* File position of section data */ + + file_ptr filepos; + + /* File position of relocation info */ + + file_ptr rel_filepos; + + /* File position of line data */ + + file_ptr line_filepos; + + /* Pointer to data for applications */ + + PTR userdata; + + /* If the SEC_IN_MEMORY flag is set, this points to the actual + contents. */ + unsigned char *contents; + + /* Attached line number information */ + + alent *lineno; + + /* Number of line number records */ + + unsigned int lineno_count; + + /* When a section is being output, this value changes as more + linenumbers are written out */ + + file_ptr moving_line_filepos; + + /* What the section number is in the target world */ + + int target_index; + + PTR used_by_bfd; + + /* If this is a constructor section then here is a list of the + relocations created to relocate items within it. */ + + struct relent_chain *constructor_chain; + + /* The BFD which owns the section. */ + + bfd *owner; + + /* A symbol which points at this section only */ + struct symbol_cache_entry *symbol; + struct symbol_cache_entry **symbol_ptr_ptr; + + struct bfd_link_order *link_order_head; + struct bfd_link_order *link_order_tail; +@} asection ; + + /* These sections are global, and are managed by BFD. The application + and target back end are not permitted to change the values in + these sections. New code should use the section_ptr macros rather + than referring directly to the const sections. The const sections + may eventually vanish. */ +#define BFD_ABS_SECTION_NAME "*ABS*" +#define BFD_UND_SECTION_NAME "*UND*" +#define BFD_COM_SECTION_NAME "*COM*" +#define BFD_IND_SECTION_NAME "*IND*" + + /* the absolute section */ +extern const asection bfd_abs_section; +#define bfd_abs_section_ptr ((asection *) &bfd_abs_section) +#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) + /* Pointer to the undefined section */ +extern const asection bfd_und_section; +#define bfd_und_section_ptr ((asection *) &bfd_und_section) +#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) + /* Pointer to the common section */ +extern const asection bfd_com_section; +#define bfd_com_section_ptr ((asection *) &bfd_com_section) + /* Pointer to the indirect section */ +extern const asection bfd_ind_section; +#define bfd_ind_section_ptr ((asection *) &bfd_ind_section) +#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr) + +extern const struct symbol_cache_entry * const bfd_abs_symbol; +extern const struct symbol_cache_entry * const bfd_com_symbol; +extern const struct symbol_cache_entry * const bfd_und_symbol; +extern const struct symbol_cache_entry * const bfd_ind_symbol; +#define bfd_get_section_size_before_reloc(section) \ + (section->reloc_done ? (abort(),1): (section)->_raw_size) +#define bfd_get_section_size_after_reloc(section) \ + ((section->reloc_done) ? (section)->_cooked_size: (abort(),1)) +@end example + +@node section prototypes, , typedef asection, Sections +@subsection Section prototypes +These are the functions exported by the section handling part of BFD. +@* +@findex bfd_get_section_by_name +@subsubsection @code{bfd_get_section_by_name} +@strong{Synopsis} +@example +asection *bfd_get_section_by_name(bfd *abfd, CONST char *name); +@end example +@strong{Description}@* +Run through @var{abfd} and return the one of the +@code{asection}s whose name matches @var{name}, otherwise @code{NULL}. +@xref{Sections}, for more information. + +This should only be used in special cases; the normal way to process +all sections of a given name is to use @code{bfd_map_over_sections} and +@code{strcmp} on the name (or better yet, base it on the section flags +or something else) for each section. +@* +@findex bfd_make_section_old_way +@subsubsection @code{bfd_make_section_old_way} +@strong{Synopsis} +@example +asection *bfd_make_section_old_way(bfd *abfd, CONST char *name); +@end example +@strong{Description}@* +Create a new empty section called @var{name} +and attach it to the end of the chain of sections for the +BFD @var{abfd}. An attempt to create a section with a name which +is already in use returns its pointer without changing the +section chain. + +It has the funny name since this is the way it used to be +before it was rewritten.... + +Possible errors are: +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - +If output has already started for this BFD. +@item +@code{bfd_error_no_memory} - +If memory allocation fails. +@end itemize +@* +@findex bfd_make_section_anyway +@subsubsection @code{bfd_make_section_anyway} +@strong{Synopsis} +@example +asection *bfd_make_section_anyway(bfd *abfd, CONST char *name); +@end example +@strong{Description}@* +Create a new empty section called @var{name} and attach it to the end of +the chain of sections for @var{abfd}. Create a new section even if there +is already a section with that name. + +Return @code{NULL} and set @code{bfd_error} on error; possible errors are: +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}. +@item +@code{bfd_error_no_memory} - If memory allocation fails. +@end itemize +@* +@findex bfd_make_section +@subsubsection @code{bfd_make_section} +@strong{Synopsis} +@example +asection *bfd_make_section(bfd *, CONST char *name); +@end example +@strong{Description}@* +Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling +bfd_set_error ()) without changing the section chain if there is already a +section named @var{name}. If there is an error, return @code{NULL} and set +@code{bfd_error}. +@* +@findex bfd_set_section_flags +@subsubsection @code{bfd_set_section_flags} +@strong{Synopsis} +@example +boolean bfd_set_section_flags(bfd *abfd, asection *sec, flagword flags); +@end example +@strong{Description}@* +Set the attributes of the section @var{sec} in the BFD +@var{abfd} to the value @var{flags}. Return @code{true} on success, +@code{false} on error. Possible error returns are: + +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - +The section cannot have one or more of the attributes +requested. For example, a .bss section in @code{a.out} may not +have the @code{SEC_HAS_CONTENTS} field set. +@end itemize +@* +@findex bfd_map_over_sections +@subsubsection @code{bfd_map_over_sections} +@strong{Synopsis} +@example +void bfd_map_over_sections(bfd *abfd, + void (*func)(bfd *abfd, + asection *sect, + PTR obj), + PTR obj); +@end example +@strong{Description}@* +Call the provided function @var{func} for each section +attached to the BFD @var{abfd}, passing @var{obj} as an +argument. The function will be called as if by + +@example + func(abfd, the_section, obj); +@end example + +This is the prefered method for iterating over sections; an +alternative would be to use a loop: + +@example + section *p; + for (p = abfd->sections; p != NULL; p = p->next) + func(abfd, p, ...) +@end example +@* +@findex bfd_set_section_size +@subsubsection @code{bfd_set_section_size} +@strong{Synopsis} +@example +boolean bfd_set_section_size(bfd *abfd, asection *sec, bfd_size_type val); +@end example +@strong{Description}@* +Set @var{sec} to the size @var{val}. If the operation is +ok, then @code{true} is returned, else @code{false}. + +Possible error returns: +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - +Writing has started to the BFD, so setting the size is invalid. +@end itemize +@* +@findex bfd_set_section_contents +@subsubsection @code{bfd_set_section_contents} +@strong{Synopsis} +@example +boolean bfd_set_section_contents + (bfd *abfd, + asection *section, + PTR data, + file_ptr offset, + bfd_size_type count); +@end example +@strong{Description}@* +Sets the contents of the section @var{section} in BFD +@var{abfd} to the data starting in memory at @var{data}. The +data is written to the output section starting at offset +@var{offset} for @var{count} bytes. + +Normally @code{true} is returned, else @code{false}. Possible error +returns are: +@itemize @bullet + +@item +@code{bfd_error_no_contents} - +The output section does not have the @code{SEC_HAS_CONTENTS} +attribute, so nothing can be written to it. +@item +and some more too +@end itemize +This routine is front end to the back end function +@code{_bfd_set_section_contents}. +@* +@findex bfd_get_section_contents +@subsubsection @code{bfd_get_section_contents} +@strong{Synopsis} +@example +boolean bfd_get_section_contents + (bfd *abfd, asection *section, PTR location, + file_ptr offset, bfd_size_type count); +@end example +@strong{Description}@* +Read data from @var{section} in BFD @var{abfd} +into memory starting at @var{location}. The data is read at an +offset of @var{offset} from the start of the input section, +and is read for @var{count} bytes. + +If the contents of a constructor with the @code{SEC_CONSTRUCTOR} +flag set are requested or if the section does not have the +@code{SEC_HAS_CONTENTS} flag set, then the @var{location} is filled +with zeroes. If no errors occur, @code{true} is returned, else +@code{false}. +@* +@findex bfd_copy_private_section_data +@subsubsection @code{bfd_copy_private_section_data} +@strong{Synopsis} +@example +boolean bfd_copy_private_section_data(bfd *ibfd, asection *isec, bfd *obfd, asection *osec); +@end example +@strong{Description}@* +Copy private section information from @var{isec} in the BFD +@var{ibfd} to the section @var{osec} in the BFD @var{obfd}. +Return @code{true} on success, @code{false} on error. Possible error +returns are: + +@itemize @bullet + +@item +@code{bfd_error_no_memory} - +Not enough memory exists to create private data for @var{osec}. +@end itemize +@example +#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ + BFD_SEND (obfd, _bfd_copy_private_section_data, \ + (ibfd, isection, obfd, osection)) +@end example +@* diff -urN binutils-2.7/bfd/doc/syms.texi binutils-2.8/bfd/doc/syms.texi --- binutils-2.7/bfd/doc/syms.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/syms.texi Wed Apr 30 12:56:27 1997 @@ -0,0 +1,407 @@ +@section Symbols +BFD tries to maintain as much symbol information as it can when +it moves information from file to file. BFD passes information +to applications though the @code{asymbol} structure. When the +application requests the symbol table, BFD reads the table in +the native form and translates parts of it into the internal +format. To maintain more than the information passed to +applications, some targets keep some information ``behind the +scenes'' in a structure only the particular back end knows +about. For example, the coff back end keeps the original +symbol table structure as well as the canonical structure when +a BFD is read in. On output, the coff back end can reconstruct +the output symbol table so that no information is lost, even +information unique to coff which BFD doesn't know or +understand. If a coff symbol table were read, but were written +through an a.out back end, all the coff specific information +would be lost. The symbol table of a BFD +is not necessarily read in until a canonicalize request is +made. Then the BFD back end fills in a table provided by the +application with pointers to the canonical information. To +output symbols, the application provides BFD with a table of +pointers to pointers to @code{asymbol}s. This allows applications +like the linker to output a symbol as it was read, since the ``behind +the scenes'' information will be still available. +@menu +* Reading Symbols:: +* Writing Symbols:: +* Mini Symbols:: +* typedef asymbol:: +* symbol handling functions:: +@end menu +@* +@node Reading Symbols, Writing Symbols, Symbols, Symbols +@subsection Reading symbols +There are two stages to reading a symbol table from a BFD: +allocating storage, and the actual reading process. This is an +excerpt from an application which reads the symbol table: + +@example + long storage_needed; + asymbol **symbol_table; + long number_of_symbols; + long i; + + storage_needed = bfd_get_symtab_upper_bound (abfd); + + if (storage_needed < 0) + FAIL + + if (storage_needed == 0) @{ + return ; + @} + symbol_table = (asymbol **) xmalloc (storage_needed); + ... + number_of_symbols = + bfd_canonicalize_symtab (abfd, symbol_table); + + if (number_of_symbols < 0) + FAIL + + for (i = 0; i < number_of_symbols; i++) @{ + process_symbol (symbol_table[i]); + @} +@end example + +All storage for the symbols themselves is in an objalloc +connected to the BFD; it is freed when the BFD is closed. +@* +@node Writing Symbols, Mini Symbols, Reading Symbols, Symbols +@subsection Writing symbols +Writing of a symbol table is automatic when a BFD open for +writing is closed. The application attaches a vector of +pointers to pointers to symbols to the BFD being written, and +fills in the symbol count. The close and cleanup code reads +through the table provided and performs all the necessary +operations. The BFD output code must always be provided with an +``owned'' symbol: one which has come from another BFD, or one +which has been created using @code{bfd_make_empty_symbol}. Here is an +example showing the creation of a symbol table with only one element: + +@example + #include "bfd.h" + main() + @{ + bfd *abfd; + asymbol *ptrs[2]; + asymbol *new; + + abfd = bfd_openw("foo","a.out-sunos-big"); + bfd_set_format(abfd, bfd_object); + new = bfd_make_empty_symbol(abfd); + new->name = "dummy_symbol"; + new->section = bfd_make_section_old_way(abfd, ".text"); + new->flags = BSF_GLOBAL; + new->value = 0x12345; + + ptrs[0] = new; + ptrs[1] = (asymbol *)0; + + bfd_set_symtab(abfd, ptrs, 1); + bfd_close(abfd); + @} + + ./makesym + nm foo + 00012345 A dummy_symbol +@end example + +Many formats cannot represent arbitary symbol information; for +instance, the @code{a.out} object format does not allow an +arbitary number of sections. A symbol pointing to a section +which is not one of @code{.text}, @code{.data} or @code{.bss} cannot +be described. +@* +@node Mini Symbols, typedef asymbol, Writing Symbols, Symbols +@subsection Mini Symbols +Mini symbols provide read-only access to the symbol table. +They use less memory space, but require more time to access. +They can be useful for tools like nm or objdump, which may +have to handle symbol tables of extremely large executables. + +The @code{bfd_read_minisymbols} function will read the symbols +into memory in an internal form. It will return a @code{void *} +pointer to a block of memory, a symbol count, and the size of +each symbol. The pointer is allocated using @code{malloc}, and +should be freed by the caller when it is no longer needed. + +The function @code{bfd_minisymbol_to_symbol} will take a pointer +to a minisymbol, and a pointer to a structure returned by +@code{bfd_make_empty_symbol}, and return a @code{asymbol} structure. +The return value may or may not be the same as the value from +@code{bfd_make_empty_symbol} which was passed in. +@* + +@node typedef asymbol, symbol handling functions, Mini Symbols, Symbols +@subsection typedef asymbol +An @code{asymbol} has the form: +@* +. +@example +typedef struct symbol_cache_entry +@{ + /* A pointer to the BFD which owns the symbol. This information + is necessary so that a back end can work out what additional + information (invisible to the application writer) is carried + with the symbol. + + This field is *almost* redundant, since you can use section->owner + instead, except that some symbols point to the global sections + bfd_@{abs,com,und@}_section. This could be fixed by making + these globals be per-bfd (or per-target-flavor). FIXME. */ + + struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */ + + /* The text of the symbol. The name is left alone, and not copied; the + application may not alter it. */ + CONST char *name; + + /* The value of the symbol. This really should be a union of a + numeric value with a pointer, since some flags indicate that + a pointer to another symbol is stored here. */ + symvalue value; + + /* Attributes of a symbol: */ + +#define BSF_NO_FLAGS 0x00 + + /* The symbol has local scope; @code{static} in @code{C}. The value + is the offset into the section of the data. */ +#define BSF_LOCAL 0x01 + + /* The symbol has global scope; initialized data in @code{C}. The + value is the offset into the section of the data. */ +#define BSF_GLOBAL 0x02 + + /* The symbol has global scope and is exported. The value is + the offset into the section of the data. */ +#define BSF_EXPORT BSF_GLOBAL /* no real difference */ + + /* A normal C symbol would be one of: + @code{BSF_LOCAL}, @code{BSF_FORT_COMM}, @code{BSF_UNDEFINED} or + @code{BSF_GLOBAL} */ + + /* The symbol is a debugging record. The value has an arbitary + meaning. */ +#define BSF_DEBUGGING 0x08 + + /* The symbol denotes a function entry point. Used in ELF, + perhaps others someday. */ +#define BSF_FUNCTION 0x10 + + /* Used by the linker. */ +#define BSF_KEEP 0x20 +#define BSF_KEEP_G 0x40 + + /* A weak global symbol, overridable without warnings by + a regular global symbol of the same name. */ +#define BSF_WEAK 0x80 + + /* This symbol was created to point to a section, e.g. ELF's + STT_SECTION symbols. */ +#define BSF_SECTION_SYM 0x100 + + /* The symbol used to be a common symbol, but now it is + allocated. */ +#define BSF_OLD_COMMON 0x200 + + /* The default value for common data. */ +#define BFD_FORT_COMM_DEFAULT_VALUE 0 + + /* In some files the type of a symbol sometimes alters its + location in an output file - ie in coff a @code{ISFCN} symbol + which is also @code{C_EXT} symbol appears where it was + declared and not at the end of a section. This bit is set + by the target BFD part to convey this information. */ + +#define BSF_NOT_AT_END 0x400 + + /* Signal that the symbol is the label of constructor section. */ +#define BSF_CONSTRUCTOR 0x800 + + /* Signal that the symbol is a warning symbol. The name is a + warning. The name of the next symbol is the one to warn about; + if a reference is made to a symbol with the same name as the next + symbol, a warning is issued by the linker. */ +#define BSF_WARNING 0x1000 + + /* Signal that the symbol is indirect. This symbol is an indirect + pointer to the symbol with the same name as the next symbol. */ +#define BSF_INDIRECT 0x2000 + + /* BSF_FILE marks symbols that contain a file name. This is used + for ELF STT_FILE symbols. */ +#define BSF_FILE 0x4000 + + /* Symbol is from dynamic linking information. */ +#define BSF_DYNAMIC 0x8000 + + /* The symbol denotes a data object. Used in ELF, and perhaps + others someday. */ +#define BSF_OBJECT 0x10000 + + flagword flags; + + /* A pointer to the section to which this symbol is + relative. This will always be non NULL, there are special + sections for undefined and absolute symbols. */ + struct sec *section; + + /* Back end special data. */ + union + @{ + PTR p; + bfd_vma i; + @} udata; + +@} asymbol; +@end example + +@node symbol handling functions, , typedef asymbol, Symbols +@subsection Symbol handling functions + +@* +@findex bfd_get_symtab_upper_bound +@subsubsection @code{bfd_get_symtab_upper_bound} +@strong{Description}@* +Return the number of bytes required to store a vector of pointers +to @code{asymbols} for all the symbols in the BFD @var{abfd}, +including a terminal NULL pointer. If there are no symbols in +the BFD, then return 0. If an error occurs, return -1. +@example +#define bfd_get_symtab_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd)) +@end example +@* +@findex bfd_is_local_label +@subsubsection @code{bfd_is_local_label} +@strong{Synopsis} +@example +boolean bfd_is_local_label(bfd *abfd, asymbol *sym); +@end example +@strong{Description}@* +Return true if the given symbol @var{sym} in the BFD @var{abfd} is +a compiler generated local label, else return false. +@* +@findex bfd_is_local_label_name +@subsubsection @code{bfd_is_local_label_name} +@strong{Synopsis} +@example +boolean bfd_is_local_label_name(bfd *abfd, const char *name); +@end example +@strong{Description}@* +Return true if a symbol with the name @var{name} in the BFD +@var{abfd} is a compiler generated local label, else return +false. This just checks whether the name has the form of a +local label. +@example +#define bfd_is_local_label_name(abfd, name) \ + BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) +@end example +@* +@findex bfd_canonicalize_symtab +@subsubsection @code{bfd_canonicalize_symtab} +@strong{Description}@* +Read the symbols from the BFD @var{abfd}, and fills in +the vector @var{location} with pointers to the symbols and +a trailing NULL. +Return the actual number of symbol pointers, not +including the NULL. +@example +#define bfd_canonicalize_symtab(abfd, location) \ + BFD_SEND (abfd, _bfd_canonicalize_symtab,\ + (abfd, location)) +@end example +@* +@findex bfd_set_symtab +@subsubsection @code{bfd_set_symtab} +@strong{Synopsis} +@example +boolean bfd_set_symtab (bfd *abfd, asymbol **location, unsigned int count); +@end example +@strong{Description}@* +Arrange that when the output BFD @var{abfd} is closed, +the table @var{location} of @var{count} pointers to symbols +will be written. +@* +@findex bfd_print_symbol_vandf +@subsubsection @code{bfd_print_symbol_vandf} +@strong{Synopsis} +@example +void bfd_print_symbol_vandf(PTR file, asymbol *symbol); +@end example +@strong{Description}@* +Print the value and flags of the @var{symbol} supplied to the +stream @var{file}. +@* +@findex bfd_make_empty_symbol +@subsubsection @code{bfd_make_empty_symbol} +@strong{Description}@* +Create a new @code{asymbol} structure for the BFD @var{abfd} +and return a pointer to it. + +This routine is necessary because each back end has private +information surrounding the @code{asymbol}. Building your own +@code{asymbol} and pointing to it will not create the private +information, and will cause problems later on. +@example +#define bfd_make_empty_symbol(abfd) \ + BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) +@end example +@* +@findex bfd_make_debug_symbol +@subsubsection @code{bfd_make_debug_symbol} +@strong{Description}@* +Create a new @code{asymbol} structure for the BFD @var{abfd}, +to be used as a debugging symbol. Further details of its use have +yet to be worked out. +@example +#define bfd_make_debug_symbol(abfd,ptr,size) \ + BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) +@end example +@* +@findex bfd_decode_symclass +@subsubsection @code{bfd_decode_symclass} +@strong{Description}@* +Return a character corresponding to the symbol +class of @var{symbol}, or '?' for an unknown class. +@* +@strong{Synopsis} +@example +int bfd_decode_symclass(asymbol *symbol); +@end example +@findex bfd_symbol_info +@subsubsection @code{bfd_symbol_info} +@strong{Description}@* +Fill in the basic info about symbol that nm needs. +Additional info may be added by the back-ends after +calling this function. +@* +@strong{Synopsis} +@example +void bfd_symbol_info(asymbol *symbol, symbol_info *ret); +@end example +@findex bfd_copy_private_symbol_data +@subsubsection @code{bfd_copy_private_symbol_data} +@strong{Synopsis} +@example +boolean bfd_copy_private_symbol_data(bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym); +@end example +@strong{Description}@* +Copy private symbol information from @var{isym} in the BFD +@var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}. +Return @code{true} on success, @code{false} on error. Possible error +returns are: + +@itemize @bullet + +@item +@code{bfd_error_no_memory} - +Not enough memory exists to create private data for @var{osec}. +@end itemize +@example +#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ + BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ + (ibfd, isymbol, obfd, osymbol)) +@end example +@* diff -urN binutils-2.7/bfd/doc/targets.texi binutils-2.8/bfd/doc/targets.texi --- binutils-2.7/bfd/doc/targets.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/doc/targets.texi Wed Apr 30 12:56:28 1997 @@ -0,0 +1,478 @@ +@section Targets + +@* +@strong{Description}@* +Each port of BFD to a different machine requries the creation +of a target back end. All the back end provides to the root +part of BFD is a structure containing pointers to functions +which perform certain low level operations on files. BFD +translates the applications's requests through a pointer into +calls to the back end routines. + +When a file is opened with @code{bfd_openr}, its format and +target are unknown. BFD uses various mechanisms to determine +how to interpret the file. The operations performed are: + +@itemize @bullet + +@item +Create a BFD by calling the internal routine +@code{_bfd_new_bfd}, then call @code{bfd_find_target} with the +target string supplied to @code{bfd_openr} and the new BFD pointer. + +@item +If a null target string was provided to @code{bfd_find_target}, +look up the environment variable @code{GNUTARGET} and use +that as the target string. + +@item +If the target string is still @code{NULL}, or the target string is +@code{default}, then use the first item in the target vector +as the target type, and set @code{target_defaulted} in the BFD to +cause @code{bfd_check_format} to loop through all the targets. +@xref{bfd_target}. @xref{Formats}. + +@item +Otherwise, inspect the elements in the target vector +one by one, until a match on target name is found. When found, +use it. + +@item +Otherwise return the error @code{bfd_error_invalid_target} to +@code{bfd_openr}. + +@item +@code{bfd_openr} attempts to open the file using +@code{bfd_open_file}, and returns the BFD. +@end itemize +Once the BFD has been opened and the target selected, the file +format may be determined. This is done by calling +@code{bfd_check_format} on the BFD with a suggested format. +If @code{target_defaulted} has been set, each possible target +type is tried to see if it recognizes the specified format. +@code{bfd_check_format} returns @code{true} when the caller guesses right. +@menu +* bfd_target:: +@end menu +@* +@node bfd_target, , Targets, Targets + +@subsection bfd_target + +@* +@strong{Description}@* +This structure contains everything that BFD knows about a +target. It includes things like its byte order, name, and which +routines to call to do various operations. + +Every BFD points to a target structure with its @code{xvec} +member. + +The macros below are used to dispatch to functions through the +@code{bfd_target} vector. They are used in a number of macros further +down in @file{bfd.h}, and are also used when calling various +routines by hand inside the BFD implementation. The @var{arglist} +argument must be parenthesized; it contains all the arguments +to the called function. + +They make the documentation (more) unpleasant to read, so if +someone wants to fix this and not break the above, please do. +@example +#define BFD_SEND(bfd, message, arglist) \ + ((*((bfd)->xvec->message)) arglist) + +#ifdef DEBUG_BFD_SEND +#undef BFD_SEND +#define BFD_SEND(bfd, message, arglist) \ + (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ + ((*((bfd)->xvec->message)) arglist) : \ + (bfd_assert (__FILE__,__LINE__), NULL)) +#endif +@end example +For operations which index on the BFD format: +@example +#define BFD_SEND_FMT(bfd, message, arglist) \ + (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) + +#ifdef DEBUG_BFD_SEND +#undef BFD_SEND_FMT +#define BFD_SEND_FMT(bfd, message, arglist) \ + (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ + (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \ + (bfd_assert (__FILE__,__LINE__), NULL)) +#endif +@end example +This is the structure which defines the type of BFD this is. The +@code{xvec} member of the struct @code{bfd} itself points here. Each +module that implements access to a different target under BFD, +defines one of these. + +FIXME, these names should be rationalised with the names of +the entry points which call them. Too bad we can't have one +macro to define them both! +@example +enum bfd_flavour @{ + bfd_target_unknown_flavour, + bfd_target_aout_flavour, + bfd_target_coff_flavour, + bfd_target_ecoff_flavour, + bfd_target_elf_flavour, + bfd_target_ieee_flavour, + bfd_target_nlm_flavour, + bfd_target_oasys_flavour, + bfd_target_tekhex_flavour, + bfd_target_srec_flavour, + bfd_target_ihex_flavour, + bfd_target_som_flavour, + bfd_target_os9k_flavour, + bfd_target_versados_flavour, + bfd_target_msdos_flavour, + bfd_target_evax_flavour +@}; + +enum bfd_endian @{ BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN @}; + + /* Forward declaration. */ +typedef struct bfd_link_info _bfd_link_info; + +typedef struct bfd_target +@{ +@end example +Identifies the kind of target, e.g., SunOS4, Ultrix, etc. +@example + char *name; +@end example +The "flavour" of a back end is a general indication about the contents +of a file. +@example + enum bfd_flavour flavour; +@end example +The order of bytes within the data area of a file. +@example + enum bfd_endian byteorder; +@end example +The order of bytes within the header parts of a file. +@example + enum bfd_endian header_byteorder; +@end example +A mask of all the flags which an executable may have set - +from the set @code{BFD_NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}. +@example + flagword object_flags; +@end example +A mask of all the flags which a section may have set - from +the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}. +@example + flagword section_flags; +@end example +The character normally found at the front of a symbol +(if any), perhaps `_'. +@example + char symbol_leading_char; +@end example +The pad character for file names within an archive header. +@example + char ar_pad_char; +@end example +The maximum number of characters in an archive header. +@example + unsigned short ar_max_namelen; +@end example +Entries for byte swapping for data. These are different from the other +entry points, since they don't take a BFD asthe first argument. +Certain other handlers could do the same. +@example + bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *)); + void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *)); + void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *)); + void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); +@end example +Byte swapping for the headers +@example + bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *)); + void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *)); + void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *)); + bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *)); + void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); +@end example +Format dependent routines: these are vectors of entry points +within the target vector structure, one for each format to check. + +Check the format of a file being read. Return a @code{bfd_target *} or zero. +@example + const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *)); +@end example +Set the format of a file being written. +@example + boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); +@end example +Write cached information into a file being written, at @code{bfd_close}. +@example + boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); +@end example +The general target vector. +@example + + /* Generic entry points. */ +#define BFD_JUMP_TABLE_GENERIC(NAME)\ +CAT(NAME,_close_and_cleanup),\ +CAT(NAME,_bfd_free_cached_info),\ +CAT(NAME,_new_section_hook),\ +CAT(NAME,_get_section_contents),\ +CAT(NAME,_get_section_contents_in_window) + + /* Called when the BFD is being closed to do any necessary cleanup. */ + boolean (*_close_and_cleanup) PARAMS ((bfd *)); + /* Ask the BFD to free all cached information. */ + boolean (*_bfd_free_cached_info) PARAMS ((bfd *)); + /* Called when a new section is created. */ + boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); + /* Read the contents of a section. */ + boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, + file_ptr, bfd_size_type)); + boolean (*_bfd_get_section_contents_in_window) + PARAMS ((bfd *, sec_ptr, bfd_window *, + file_ptr, bfd_size_type)); + + /* Entry points to copy private data. */ +#define BFD_JUMP_TABLE_COPY(NAME)\ +CAT(NAME,_bfd_copy_private_bfd_data),\ +CAT(NAME,_bfd_merge_private_bfd_data),\ +CAT(NAME,_bfd_copy_private_section_data),\ +CAT(NAME,_bfd_copy_private_symbol_data),\ +CAT(NAME,_bfd_set_private_flags),\ +CAT(NAME,_bfd_print_private_bfd_data)\ + /* Called to copy BFD general private data from one object file + to another. */ + boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *)); + /* Called to merge BFD general private data from one object file + to a common output file when linking. */ + boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *)); + /* Called to copy BFD private section data from one object file + to another. */ + boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr, + bfd *, sec_ptr)); + /* Called to copy BFD private symbol data from one symbol + to another. */ + boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *, + bfd *, asymbol *)); + /* Called to set private backend flags */ + boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword)); + + /* Called to print private BFD data */ + boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR)); + + /* Core file entry points. */ +#define BFD_JUMP_TABLE_CORE(NAME)\ +CAT(NAME,_core_file_failing_command),\ +CAT(NAME,_core_file_failing_signal),\ +CAT(NAME,_core_file_matches_executable_p) + char * (*_core_file_failing_command) PARAMS ((bfd *)); + int (*_core_file_failing_signal) PARAMS ((bfd *)); + boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *)); + + /* Archive entry points. */ +#define BFD_JUMP_TABLE_ARCHIVE(NAME)\ +CAT(NAME,_slurp_armap),\ +CAT(NAME,_slurp_extended_name_table),\ +CAT(NAME,_construct_extended_name_table),\ +CAT(NAME,_truncate_arname),\ +CAT(NAME,_write_armap),\ +CAT(NAME,_read_ar_hdr),\ +CAT(NAME,_openr_next_archived_file),\ +CAT(NAME,_get_elt_at_index),\ +CAT(NAME,_generic_stat_arch_elt),\ +CAT(NAME,_update_armap_timestamp) + boolean (*_bfd_slurp_armap) PARAMS ((bfd *)); + boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *)); + boolean (*_bfd_construct_extended_name_table) + PARAMS ((bfd *, char **, bfd_size_type *, const char **)); + void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *)); + boolean (*write_armap) PARAMS ((bfd *arch, + unsigned int elength, + struct orl *map, + unsigned int orl_count, + int stridx)); + PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *)); + bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev)); +#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i)) + bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex)); + int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *)); + boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *)); + + /* Entry points used for symbols. */ +#define BFD_JUMP_TABLE_SYMBOLS(NAME)\ +CAT(NAME,_get_symtab_upper_bound),\ +CAT(NAME,_get_symtab),\ +CAT(NAME,_make_empty_symbol),\ +CAT(NAME,_print_symbol),\ +CAT(NAME,_get_symbol_info),\ +CAT(NAME,_bfd_is_local_label_name),\ +CAT(NAME,_get_lineno),\ +CAT(NAME,_find_nearest_line),\ +CAT(NAME,_bfd_make_debug_symbol),\ +CAT(NAME,_read_minisymbols),\ +CAT(NAME,_minisymbol_to_symbol) + long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *)); + long (*_bfd_canonicalize_symtab) PARAMS ((bfd *, + struct symbol_cache_entry **)); + struct symbol_cache_entry * + (*_bfd_make_empty_symbol) PARAMS ((bfd *)); + void (*_bfd_print_symbol) PARAMS ((bfd *, PTR, + struct symbol_cache_entry *, + bfd_print_symbol_type)); +#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e)) + void (*_bfd_get_symbol_info) PARAMS ((bfd *, + struct symbol_cache_entry *, + symbol_info *)); +#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e)) + boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *)); + + alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); + boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd, + struct sec *section, struct symbol_cache_entry **symbols, + bfd_vma offset, CONST char **file, CONST char **func, + unsigned int *line)); + /* Back-door to allow format-aware applications to create debug symbols + while using BFD for everything else. Currently used by the assembler + when creating COFF files. */ + asymbol * (*_bfd_make_debug_symbol) PARAMS (( + bfd *abfd, + void *ptr, + unsigned long size)); +#define bfd_read_minisymbols(b, d, m, s) \ + BFD_SEND (b, _read_minisymbols, (b, d, m, s)) + long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *, + unsigned int *)); +#define bfd_minisymbol_to_symbol(b, d, m, f) \ + BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) + asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR, + asymbol *)); + + /* Routines for relocs. */ +#define BFD_JUMP_TABLE_RELOCS(NAME)\ +CAT(NAME,_get_reloc_upper_bound),\ +CAT(NAME,_canonicalize_reloc),\ +CAT(NAME,_bfd_reloc_type_lookup) + long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr)); + long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, + struct symbol_cache_entry **)); + /* See documentation on reloc types. */ + reloc_howto_type * + (*reloc_type_lookup) PARAMS ((bfd *abfd, + bfd_reloc_code_real_type code)); + + /* Routines used when writing an object file. */ +#define BFD_JUMP_TABLE_WRITE(NAME)\ +CAT(NAME,_set_arch_mach),\ +CAT(NAME,_set_section_contents) + boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture, + unsigned long)); + boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR, + file_ptr, bfd_size_type)); + + /* Routines used by the linker. */ +#define BFD_JUMP_TABLE_LINK(NAME)\ +CAT(NAME,_sizeof_headers),\ +CAT(NAME,_bfd_get_relocated_section_contents),\ +CAT(NAME,_bfd_relax_section),\ +CAT(NAME,_bfd_link_hash_table_create),\ +CAT(NAME,_bfd_link_add_symbols),\ +CAT(NAME,_bfd_final_link),\ +CAT(NAME,_bfd_link_split_section) + int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean)); + bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *, + struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *data, boolean relocateable, + struct symbol_cache_entry **)); + + boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *, + struct bfd_link_info *, boolean *again)); + + /* Create a hash table for the linker. Different backends store + different information in this table. */ + struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *)); + + /* Add symbols from this object file into the hash table. */ + boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, 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 *)); + + /* Should this section be split up into smaller pieces during linking. */ + boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *)); + + /* Routines to handle dynamic symbols and relocs. */ +#define BFD_JUMP_TABLE_DYNAMIC(NAME)\ +CAT(NAME,_get_dynamic_symtab_upper_bound),\ +CAT(NAME,_canonicalize_dynamic_symtab),\ +CAT(NAME,_get_dynamic_reloc_upper_bound),\ +CAT(NAME,_canonicalize_dynamic_reloc) + /* Get the amount of memory required to hold the dynamic symbols. */ + long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *)); + /* Read in the dynamic symbols. */ + long (*_bfd_canonicalize_dynamic_symtab) + PARAMS ((bfd *, struct symbol_cache_entry **)); + /* Get the amount of memory required to hold the dynamic relocs. */ + long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *)); + /* Read in the dynamic relocs. */ + long (*_bfd_canonicalize_dynamic_reloc) + PARAMS ((bfd *, arelent **, struct symbol_cache_entry **)); + +@end example +Data for use by back-end routines, which isn't generic enough to belong +in this structure. +@example + PTR backend_data; +@} bfd_target; +@end example +@* +@findex bfd_set_default_target +@subsubsection @code{bfd_set_default_target} +@strong{Synopsis} +@example +boolean bfd_set_default_target (const char *name); +@end example +@strong{Description}@* +Set the default target vector to use when recognizing a BFD. +This takes the name of the target, which may be a BFD target +name or a configuration triplet. +@* +@findex bfd_find_target +@subsubsection @code{bfd_find_target} +@strong{Synopsis} +@example +const bfd_target *bfd_find_target(CONST char *target_name, bfd *abfd); +@end example +@strong{Description}@* +Return a pointer to the transfer vector for the object target +named @var{target_name}. If @var{target_name} is @code{NULL}, choose the +one in the environment variable @code{GNUTARGET}; if that is null or not +defined, then choose the first entry in the target list. +Passing in the string "default" or setting the environment +variable to "default" will cause the first entry in the target +list to be returned, and "target_defaulted" will be set in the +BFD. This causes @code{bfd_check_format} to loop over all the +targets to find the one that matches the file being read. +@* +@findex bfd_target_list +@subsubsection @code{bfd_target_list} +@strong{Synopsis} +@example +const char **bfd_target_list(void); +@end example +@strong{Description}@* +Return a freshly malloced NULL-terminated +vector of the names of all the valid BFD targets. Do not +modify the names. +@* diff -urN binutils-2.7/bfd/ecoff.c binutils-2.8/bfd/ecoff.c --- binutils-2.7/bfd/ecoff.c Wed Jul 10 12:46:45 1996 +++ binutils-2.8/bfd/ecoff.c Wed Apr 30 12:55:52 1997 @@ -1,5 +1,5 @@ /* Generic ECOFF (Extended-COFF) routines. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -1443,11 +1443,11 @@ /*ARGSUSED*/ boolean -_bfd_ecoff_bfd_is_local_label (abfd, symbol) +_bfd_ecoff_bfd_is_local_label_name (abfd, name) bfd *abfd; - asymbol *symbol; + const char *name; { - return symbol->name[0] == '$'; + return name[0] == '$'; } /* Print information about an ECOFF symbol. */ @@ -1856,10 +1856,10 @@ size_t c; boolean local; - /* This function is selected based on the input vector. We only - want to copy information over if the output BFD also uses ECOFF + /* We only want to copy information over if both BFD's use ECOFF format. */ - if (bfd_get_flavour (obfd) != bfd_target_ecoff_flavour) + if (bfd_get_flavour (ibfd) != bfd_target_ecoff_flavour + || bfd_get_flavour (obfd) != bfd_target_ecoff_flavour) return true; /* Copy the GP value and the register masks. */ @@ -2043,6 +2043,7 @@ asection *current; unsigned int i; file_ptr old_sofar; + boolean rdata_in_text; boolean first_data, first_nonalloc; const bfd_vma round = ecoff_backend (abfd)->round; @@ -2063,6 +2064,27 @@ qsort (sorted_hdrs, abfd->section_count, sizeof (asection *), ecoff_sort_hdrs); + /* Some versions of the OSF linker put the .rdata section in the + text segment, and some do not. */ + rdata_in_text = ecoff_backend (abfd)->rdata_in_text; + if (rdata_in_text) + { + for (i = 0; i < abfd->section_count; i++) + { + current = sorted_hdrs[i]; + if (strcmp (current->name, _RDATA) == 0) + break; + if ((current->flags & SEC_CODE) == 0 + && strcmp (current->name, _PDATA) != 0 + && strcmp (current->name, _RCONST) != 0) + { + rdata_in_text = false; + break; + } + } + } + ecoff_data (abfd)->rdata_in_text = rdata_in_text; + first_data = true; first_nonalloc = true; for (i = 0; i < abfd->section_count; i++) @@ -2090,7 +2112,7 @@ && (abfd->flags & D_PAGED) != 0 && ! first_data && (current->flags & SEC_CODE) == 0 - && (! ecoff_backend (abfd)->rdata_in_text + && (! rdata_in_text || strcmp (current->name, _RDATA) != 0) && strcmp (current->name, _PDATA) != 0 && strcmp (current->name, _RCONST) != 0) @@ -2545,7 +2567,7 @@ if ((section.s_flags & STYP_TEXT) != 0 || ((section.s_flags & STYP_RDATA) != 0 - && backend->rdata_in_text) + && ecoff_data (abfd)->rdata_in_text) || section.s_flags == STYP_PDATA || (section.s_flags & STYP_DYNAMIC) != 0 || (section.s_flags & STYP_LIBLIST) != 0 diff -urN binutils-2.7/bfd/ecofflink.c binutils-2.8/bfd/ecofflink.c --- binutils-2.7/bfd/ecofflink.c Thu Jul 4 12:18:27 1996 +++ binutils-2.8/bfd/ecofflink.c Wed Apr 30 12:56:00 1997 @@ -1,5 +1,5 @@ /* Routines to link ECOFF debugging information. - Copyright 1993, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, . This file is part of BFD, the Binary File Descriptor library. @@ -22,12 +22,14 @@ #include "sysdep.h" #include "bfdlink.h" #include "libbfd.h" -#include "obstack.h" +#include "objalloc.h" #include "aout/stab_gnu.h" #include "coff/internal.h" #include "coff/sym.h" #include "coff/symconst.h" #include "coff/ecoff.h" +#include "libcoff.h" +#include "libecoff.h" static boolean ecoff_add_bytes PARAMS ((char **buf, char **bufend, size_t need)); @@ -49,10 +51,6 @@ static boolean lookup_line PARAMS ((bfd *, struct ecoff_debug_info * const, const struct ecoff_debug_swap * const, struct ecoff_find_line *)); - -/* Obstack allocation and deallocation routines. */ -#define obstack_chunk_alloc malloc -#define obstack_chunk_free free /* Routines to swap auxiliary information in and out. I am assuming that the auxiliary information format is always going to be target @@ -395,8 +393,8 @@ struct shuffle *rfd_end; /* The size of the largest file shuffle. */ unsigned long largest_file_shuffle; - /* An obstack for debugging information. */ - struct obstack memory; + /* An objalloc for debugging information. */ + struct objalloc *memory; }; /* Add a file entry to a shuffle list. */ @@ -429,8 +427,8 @@ return true; } - n = (struct shuffle *) obstack_alloc (&ainfo->memory, - sizeof (struct shuffle)); + n = (struct shuffle *) objalloc_alloc (ainfo->memory, + sizeof (struct shuffle)); if (!n) { bfd_set_error (bfd_error_no_memory); @@ -468,8 +466,8 @@ { struct shuffle *n; - n = (struct shuffle *) obstack_alloc (&ainfo->memory, - sizeof (struct shuffle)); + n = (struct shuffle *) objalloc_alloc (ainfo->memory, + sizeof (struct shuffle)); if (!n) { bfd_set_error (bfd_error_no_memory); @@ -537,7 +535,8 @@ output_debug->symbolic_header.issMax = 1; } - if (!obstack_begin (&ainfo->memory, 4050)) + ainfo->memory = objalloc_create (); + if (ainfo->memory == NULL) { bfd_set_error (bfd_error_no_memory); return NULL; @@ -564,7 +563,7 @@ if (! info->relocateable) bfd_hash_table_free (&ainfo->str_hash.table); - obstack_free (&ainfo->memory, (PTR) NULL); + objalloc_free (ainfo->memory); free (ainfo); } @@ -669,7 +668,7 @@ * sizeof (RFDT))); sz = (input_symhdr->crfd + input_symhdr->ifdMax) * external_rfd_size; - rfd_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz); + rfd_out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz); if (!input_debug->ifdmap || !rfd_out) { bfd_set_error (bfd_error_no_memory); @@ -769,7 +768,7 @@ /* Look through the FDR's and copy over all associated debugging information. */ sz = copied * external_fdr_size; - fdr_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz); + fdr_out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz); if (!fdr_out) { bfd_set_error (bfd_error_no_memory); @@ -824,7 +823,7 @@ out again. */ fgotfilename = false; sz = fdr.csym * external_sym_size; - sym_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz); + sym_out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz); if (!sym_out) { bfd_set_error (bfd_error_no_memory); @@ -1025,7 +1024,7 @@ + fdr.ipdFirst * insz); end = in + fdr.cpd * insz; sz = fdr.cpd * outsz; - out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz); + out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz); if (!out) { bfd_set_error (bfd_error_no_memory); @@ -1066,7 +1065,7 @@ + fdr.ioptBase * insz); end = in + fdr.copt * insz; sz = fdr.copt * outsz; - out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz); + out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz); if (!out) { bfd_set_error (bfd_error_no_memory); @@ -1247,8 +1246,8 @@ internal_sym.sc = scUndefined; internal_sym.index = indexNil; - external_sym = (PTR) obstack_alloc (&ainfo->memory, - output_swap->external_sym_size); + external_sym = (PTR) objalloc_alloc (ainfo->memory, + output_swap->external_sym_size); if (!external_sym) { bfd_set_error (bfd_error_no_memory); @@ -1267,8 +1266,8 @@ the lang field to be langC. The fBigendian field will indicate little endian format, but it doesn't matter because it only applies to aux fields and there are none. */ - external_fdr = (PTR) obstack_alloc (&ainfo->memory, - output_swap->external_fdr_size); + external_fdr = (PTR) objalloc_alloc (ainfo->memory, + output_swap->external_fdr_size); if (!external_fdr) { bfd_set_error (bfd_error_no_memory); diff -urN binutils-2.7/bfd/elf-bfd.h binutils-2.8/bfd/elf-bfd.h --- binutils-2.7/bfd/elf-bfd.h Thu Jul 4 12:18:28 1996 +++ binutils-2.8/bfd/elf-bfd.h Wed Apr 30 12:56:00 1997 @@ -1,5 +1,5 @@ /* BFD back-end data structures for ELF files. - Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -62,6 +62,12 @@ PTR any; } tc_data; + + /* Version information. This is from an Elf_Internal_Versym + structure in a SHT_GNU_versym section. It is zero if there is no + version information. */ + unsigned short version; + } elf_symbol_type; /* ELF linker hash table entries. */ @@ -107,11 +113,27 @@ from the beginning of the section. */ struct elf_linker_section_pointers *linker_section_pointer; + /* Version information. */ + union + { + /* This field is used for a symbol which is not defined in a + regular object. It points to the version information read in + from the dynamic object. */ + Elf_Internal_Verdef *verdef; + /* This field is used for a symbol which is defined in a regular + object. It is set up in size_dynamic_sections. It points to + the version information we should write out for this symbol. */ + struct bfd_elf_version_tree *vertree; + } verinfo; + /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */ char type; + /* Symbol st_other value. */ + unsigned char other; + /* Some flags; legal values follow. */ - unsigned char elf_link_hash_flags; + unsigned short elf_link_hash_flags; /* Symbol is referenced by a non-shared object. */ #define ELF_LINK_HASH_REF_REGULAR 01 /* Symbol is defined by a non-shared object. */ @@ -128,8 +150,10 @@ #define ELF_LINK_HASH_NEEDS_PLT 0100 /* Symbol appears in a non-ELF input file. */ #define ELF_LINK_NON_ELF 0200 - /* Note: If you add more flags, you must change the type of - elf_link_hash_flags. */ + /* Symbol should be marked as hidden in the version information. */ +#define ELF_LINK_HIDDEN 0400 + /* Symbol was forced to local scope due to a version script file. */ +#define ELF_LINK_FORCED_LOCAL 01000 }; /* ELF linker hash table. */ @@ -193,7 +217,8 @@ boolean (*write_shdrs_and_ehdr) PARAMS ((bfd *)); void (*write_relocs) PARAMS ((bfd *, asection *, PTR)); void (*swap_symbol_out) PARAMS ((bfd *, const Elf_Internal_Sym *, PTR)); - boolean (*slurp_reloc_table) PARAMS ((bfd *, asection *, asymbol **)); + boolean (*slurp_reloc_table) + PARAMS ((bfd *, asection *, asymbol **, boolean)); long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean)); void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); }; @@ -356,6 +381,13 @@ boolean (*elf_backend_adjust_dynamic_symbol) PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h)); + /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker + after all the linker input files have been seen but before the + section sizes have been set. This is called after + ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */ + boolean (*elf_backend_always_size_sections) + PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); + /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend linker after all the linker input files have been seen but before the sections sizes have been set. This is called after @@ -561,8 +593,12 @@ Elf_Internal_Shdr strtab_hdr; Elf_Internal_Shdr dynsymtab_hdr; Elf_Internal_Shdr dynstrtab_hdr; + Elf_Internal_Shdr dynversym_hdr; + Elf_Internal_Shdr dynverref_hdr; + Elf_Internal_Shdr dynverdef_hdr; unsigned int symtab_section, shstrtab_section; unsigned int strtab_section, dynsymtab_section; + unsigned int dynversym_section, dynverdef_section, dynverref_section; file_ptr next_file_pos; void *prstatus; /* The raw /proc prstatus structure */ void *prpsinfo; /* The raw /proc prpsinfo structure */ @@ -615,9 +651,26 @@ find_nearest_line. */ struct mips_elf_find_line *find_line_info; + /* An array of stub sections indexed by symbol number, used by the + MIPS ELF linker. FIXME: We should figure out some way to only + include this field for a MIPS ELF target. */ + asection **local_stubs; + /* Used to determine if the e_flags field has been initialized */ boolean flags_init; + /* Number of symbol version definitions we are about to emit. */ + int cverdefs; + + /* Number of symbol version references we are about to emit. */ + int cverrefs; + + /* Symbol version definitions in external objects. */ + Elf_Internal_Verdef *verdef; + + /* Symbol version references to external objects. */ + Elf_Internal_Verneed *verref; + /* Linker sections that we are interested in. */ struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ]; }; @@ -628,6 +681,9 @@ #define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr) #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section) #define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section) +#define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section) +#define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section) +#define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section) #define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals) #define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals) #define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms) @@ -643,6 +699,27 @@ #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init) #define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n]) +extern void _bfd_elf_swap_verdef_in + PARAMS ((bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *)); +extern void _bfd_elf_swap_verdef_out + PARAMS ((bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *)); +extern void _bfd_elf_swap_verdaux_in + PARAMS ((bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *)); +extern void _bfd_elf_swap_verdaux_out + PARAMS ((bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *)); +extern void _bfd_elf_swap_verneed_in + PARAMS ((bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *)); +extern void _bfd_elf_swap_verneed_out + PARAMS ((bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *)); +extern void _bfd_elf_swap_vernaux_in + PARAMS ((bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *)); +extern void _bfd_elf_swap_vernaux_out + PARAMS ((bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *)); +extern void _bfd_elf_swap_versym_in + PARAMS ((bfd *, const Elf_External_Versym *, Elf_Internal_Versym *)); +extern void _bfd_elf_swap_versym_out + PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *)); + extern int _bfd_elf_section_from_bfd_section PARAMS ((bfd *, asection *)); extern char *bfd_elf_string_from_elf_section PARAMS ((bfd *, unsigned, unsigned)); @@ -656,9 +733,6 @@ #define bfd_elf32_print_symbol bfd_elf_print_symbol #define bfd_elf64_print_symbol bfd_elf_print_symbol -#define bfd_elf32_mkobject bfd_elf_mkobject -#define bfd_elf64_mkobject bfd_elf_mkobject -#define elf_mkobject bfd_elf_mkobject extern unsigned long bfd_elf_hash PARAMS ((CONST unsigned char *)); @@ -682,6 +756,7 @@ struct bfd_hash_entry *(*) (struct bfd_hash_entry *, struct bfd_hash_table *, const char *))); +extern boolean _bfd_elf_slurp_version_tables PARAMS ((bfd *)); extern boolean _bfd_elf_copy_private_symbol_data PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); @@ -698,9 +773,13 @@ extern long _bfd_elf_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); extern long _bfd_elf_canonicalize_reloc PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); +extern long _bfd_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); +extern long _bfd_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **, + asymbol **)); extern asymbol *_bfd_elf_make_empty_symbol PARAMS ((bfd *)); extern void _bfd_elf_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); +extern boolean _bfd_elf_is_local_label_name PARAMS ((bfd *, const char *)); extern alent *_bfd_elf_get_lineno PARAMS ((bfd *, asymbol *)); extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); @@ -719,6 +798,7 @@ Elf_Internal_Rela *)); extern boolean bfd_section_from_shdr PARAMS ((bfd *, unsigned int shindex)); +extern boolean bfd_section_from_phdr PARAMS ((bfd *, Elf_Internal_Phdr *, int)); extern int _bfd_elf_symbol_from_bfd_symbol PARAMS ((bfd *, asymbol **)); @@ -835,6 +915,8 @@ PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma)); extern boolean bfd_elf32_link_create_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); +extern Elf_Internal_Rela *_bfd_elf32_link_read_relocs + PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean)); extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *)); extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *)); @@ -876,6 +958,8 @@ PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma)); extern boolean bfd_elf64_link_create_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); +extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs + PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean)); #define bfd_elf32_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol #define bfd_elf64_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol diff -urN binutils-2.7/bfd/elf-m10200.c binutils-2.8/bfd/elf-m10200.c --- binutils-2.7/bfd/elf-m10200.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/elf-m10200.c Wed Apr 30 12:56:00 1997 @@ -0,0 +1,1525 @@ +/* Matsushita 10200 specific support for 32-bit ELF + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" + +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void mn10200_info_to_howto + PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); +static boolean mn10200_elf_relax_delete_bytes + PARAMS ((bfd *, asection *, bfd_vma, int)); +static boolean mn10200_elf_symbol_address_p + PARAMS ((bfd *, asection *, Elf32_External_Sym *, bfd_vma)); + +/* We have to use RELA instructions since md_apply_fix3 in the assembler + does absolutely nothing. */ +#define USE_RELA + +enum reloc_type +{ + R_MN10200_NONE = 0, + R_MN10200_32, + R_MN10200_16, + R_MN10200_8, + R_MN10200_24, + R_MN10200_PCREL8, + R_MN10200_PCREL16, + R_MN10200_PCREL24, + R_MN10200_MAX +}; + +static reloc_howto_type elf_mn10200_howto_table[] = +{ + /* Dummy relocation. Does nothing. */ + HOWTO (R_MN10200_NONE, + 0, + 2, + 16, + false, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_NONE", + false, + 0, + 0, + false), + /* Standard 32 bit reloc. */ + HOWTO (R_MN10200_32, + 0, + 2, + 32, + false, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_32", + false, + 0xffffffff, + 0xffffffff, + false), + /* Standard 16 bit reloc. */ + HOWTO (R_MN10200_16, + 0, + 1, + 16, + false, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_16", + false, + 0xffff, + 0xffff, + false), + /* Standard 8 bit reloc. */ + HOWTO (R_MN10200_8, + 0, + 0, + 8, + false, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_8", + false, + 0xff, + 0xff, + false), + /* Standard 24 bit reloc. */ + HOWTO (R_MN10200_24, + 0, + 2, + 24, + false, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_24", + false, + 0xffffff, + 0xffffff, + false), + /* Simple 8 pc-relative reloc. */ + HOWTO (R_MN10200_PCREL8, + 0, + 0, + 8, + true, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_PCREL8", + false, + 0xff, + 0xff, + true), + /* Simple 16 pc-relative reloc. */ + HOWTO (R_MN10200_PCREL16, + 0, + 1, + 16, + true, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_PCREL16", + false, + 0xffff, + 0xffff, + true), + /* Simple 32bit pc-relative reloc with a 1 byte adjustment + to get the pc-relative offset correct. */ + HOWTO (R_MN10200_PCREL24, + 0, + 2, + 24, + true, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_PCREL24", + false, + 0xffffff, + 0xffffff, + true), +}; + +struct mn10200_reloc_map +{ + unsigned char bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct mn10200_reloc_map mn10200_reloc_map[] = +{ + { BFD_RELOC_NONE, R_MN10200_NONE, }, + { BFD_RELOC_32, R_MN10200_32, }, + { BFD_RELOC_16, R_MN10200_16, }, + { BFD_RELOC_8, R_MN10200_8, }, + { BFD_RELOC_24, R_MN10200_24, }, + { BFD_RELOC_8_PCREL, R_MN10200_PCREL8, }, + { BFD_RELOC_16_PCREL, R_MN10200_PCREL16, }, + { BFD_RELOC_24_PCREL, R_MN10200_PCREL24, }, +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; + i < sizeof (mn10200_reloc_map) / sizeof (struct mn10200_reloc_map); + i++) + { + if (mn10200_reloc_map[i].bfd_reloc_val == code) + return &elf_mn10200_howto_table[mn10200_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an MN10200 ELF reloc. */ + +static void +mn10200_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd; + arelent *cache_ptr; + Elf32_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_MN10200_MAX); + cache_ptr->howto = &elf_mn10200_howto_table[r_type]; +} + +/* Perform a relocation as part of a final link. */ +static bfd_reloc_status_type +mn10200_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, contents, offset, value, + addend, info, sym_sec, is_local) + reloc_howto_type *howto; + bfd *input_bfd; + bfd *output_bfd; + asection *input_section; + bfd_byte *contents; + bfd_vma offset; + bfd_vma value; + bfd_vma addend; + struct bfd_link_info *info; + asection *sym_sec; + int is_local; +{ + unsigned long r_type = howto->type; + bfd_byte *hit_data = contents + offset; + + switch (r_type) + { + + case R_MN10200_NONE: + return bfd_reloc_ok; + + case R_MN10200_32: + value += addend; + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_16: + value += addend; + + if ((long)value > 0x7fff || (long)value < -0x8000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_8: + value += addend; + + if ((long)value > 0x7fff || (long)value < -0x8000) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_24: + value += addend; + + if ((long)value > 0x7fffff || (long)value < -0x800000) + return bfd_reloc_overflow; + + value &= 0xffffff; + value |= (bfd_get_32 (input_bfd, hit_data) & 0xff000000); + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_PCREL8: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + if ((long)value > 0xff || (long)value < -0x100) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_PCREL16: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + if ((long)value > 0xffff || (long)value < -0x10000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_PCREL24: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + if ((long)value > 0xffffff || (long)value < -0x1000000) + return bfd_reloc_overflow; + + value &= 0xffffff; + value |= (bfd_get_32 (input_bfd, hit_data) & 0xff000000); + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + default: + return bfd_reloc_notsupported; + } +} + + +/* Relocate an MN10200 ELF section. */ +static boolean +mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + howto = elf_mn10200_howto_table + r_type; + + if (info->relocateable) + { + /* This is a relocateable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + sec = local_sections[r_symndx]; + rel->r_addend += sec->output_offset + sym->st_value; + } + } + + continue; + } + + /* This is a final link. */ + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + } + else + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else if (h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset))) + return false; + relocation = 0; + } + } + + r = mn10200_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, + contents, rel->r_offset, + relocation, rel->r_addend, + info, sec, h == NULL); + + if (r != bfd_reloc_ok) + { + const char *name; + const char *msg = (const char *)0; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL || *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + switch (r) + { + case bfd_reloc_overflow: + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return false; + break; + + case bfd_reloc_undefined: + if (! ((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + rel->r_offset))) + return false; + break; + + case bfd_reloc_outofrange: + msg = "internal error: out of range error"; + goto common_error; + + case bfd_reloc_notsupported: + msg = "internal error: unsupported relocation error"; + goto common_error; + + case bfd_reloc_dangerous: + msg = "internal error: dangerous error"; + goto common_error; + + default: + msg = "internal error: unknown error"; + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, + rel->r_offset))) + return false; + break; + } + } + } + + return true; +} + +/* This function handles relaxing for the mn10200. + + There's quite a few relaxing opportunites available on the mn10200: + + * jsr:24 -> jsr:16 2 bytes + + * jmp:24 -> jmp:16 2 bytes + * jmp:16 -> bra:8 1 byte + + * If the previous instruction is a conditional branch + around the jump/bra, we may be able to reverse its condition + and change its target to the jump's target. The jump/bra + can then be deleted. 2 bytes + + * mov abs24 -> mov abs16 2 byte savings + + * Most instructions which accept imm24 can relax to imm16 2 bytes + - Most instructions which accept imm16 can relax to imm8 1 byte + + * Most instructions which accept d24 can relax to d16 2 bytes + - Most instructions which accept d16 can relax to d8 1 byte + + abs24, imm24, d24 all look the same at the reloc level. It + might make the code simpler if we had different relocs for + the various relaxable operand types. + + We don't handle imm16->imm8 or d16->d8 as they're very rare + and somewhat more difficult to support. */ + +static boolean +mn10200_elf_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_Rela *internal_relocs; + Elf_Internal_Rela *free_relocs = NULL; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + bfd_byte *free_contents = NULL; + Elf32_External_Sym *extsyms = NULL; + Elf32_External_Sym *free_extsyms = NULL; + + /* Assume nothing changes. */ + *again = false; + + /* We don't have to do anything for a relocateable link, if + this section does not have relocs, or if this is not a + code section. */ + if (link_info->relocateable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0 + || (sec->flags & SEC_CODE) == 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; + + /* Get a copy of the native relocations. */ + internal_relocs = (_bfd_elf32_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + if (! link_info->keep_memory) + free_relocs = internal_relocs; + + /* Walk through them looking for relaxing opportunities. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + + /* If this isn't something that can be relaxed, then ignore + this reloc. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_NONE + || ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_8 + || ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_MAX) + continue; + + /* Get the section contents if we haven't done so already. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + /* Go get them off disk. */ + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + free_contents = contents; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* Read the local symbols if we haven't done so already. */ + if (extsyms == NULL) + { + /* Get cached copy if it exists. */ + if (symtab_hdr->contents != NULL) + extsyms = (Elf32_External_Sym *) symtab_hdr->contents; + else + { + /* Go get them off disk. */ + extsyms = ((Elf32_External_Sym *) + bfd_malloc (symtab_hdr->sh_info + * sizeof (Elf32_External_Sym))); + if (extsyms == NULL) + goto error_return; + free_extsyms = extsyms; + if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_read (extsyms, sizeof (Elf32_External_Sym), + symtab_hdr->sh_info, abfd) + != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) + goto error_return; + } + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + Elf_Internal_Sym isym; + asection *sym_sec; + + /* A local symbol. */ + bfd_elf32_swap_symbol_in (abfd, + extsyms + ELF32_R_SYM (irel->r_info), + &isym); + + sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx); + symval = (isym.st_value + + sym_sec->output_section->vma + + sym_sec->output_offset); + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + /* An external symbol. */ + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + { + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + } + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + + + /* Try to turn a 24bit pc-relative branch/call into a 16bit pc-relative + branch/call. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_PCREL24) + { + bfd_vma value = symval; + + /* Deal with pc-relative gunk. */ + value -= (sec->output_section->vma + sec->output_offset); + value -= irel->r_offset; + value += irel->r_addend; + + /* See if the value will fit in 16 bits, note the high value is + 0x7fff + 2 as the target will be two bytes closer if we are + able to relax. */ + if ((long)value < 0x8001 && (long)value > -0x8000) + { + unsigned char code; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + if (code != 0xe0 && code != 0xe1) + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* Fix the opcode. */ + if (code == 0xe0) + bfd_put_8 (abfd, 0xfc, contents + irel->r_offset - 2); + else if (code == 0xe1) + bfd_put_8 (abfd, 0xfd, contents + irel->r_offset - 2); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_PCREL16); + + /* The opcode got shorter too, so we have to fix the + addend and offset too! */ + irel->r_addend -= 1; + irel->r_offset -= 1; + + /* Delete two bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + } + } + + /* Try to turn a 16bit pc-relative branch into a 8bit pc-relative + branch. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_PCREL16) + { + bfd_vma value = symval; + + /* Deal with pc-relative gunk. */ + value -= (sec->output_section->vma + sec->output_offset); + value -= irel->r_offset; + value += irel->r_addend; + + /* See if the value will fit in 8 bits, note the high value is + 0x7f + 1 as the target will be one bytes closer if we are + able to relax. */ + if ((long)value < 0x80 && (long)value > -0x80) + { + unsigned char code; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + if (code != 0xfc) + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xea, contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_PCREL8); + + /* Delete one byte of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 1)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + } + } + + /* Try to eliminate an unconditional 8 bit pc-relative branch + which immediately follows a conditional 8 bit pc-relative + branch around the unconditional branch. + + original: new: + bCC lab1 bCC' lab2 + bra lab2 + lab1: lab1: + + + This happens when the bCC can't reach lab2 at assembly time, + but due to other relaxations it can reach at link time. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_PCREL8) + { + Elf_Internal_Rela *nrel; + bfd_vma value = symval; + unsigned char code; + + /* Deal with pc-relative gunk. */ + value -= (sec->output_section->vma + sec->output_offset); + value -= irel->r_offset; + value += irel->r_addend; + + /* Do nothing if this reloc is the last byte in the section. */ + if (irel->r_offset == sec->_cooked_size) + continue; + + /* See if the next instruction is an unconditional pc-relative + branch, more often than not this test will fail, so we + test it first to speed things up. */ + code = bfd_get_8 (abfd, contents + irel->r_offset + 1); + if (code != 0xea) + continue; + + /* Also make sure the next relocation applies to the next + instruction and that it's a pc-relative 8 bit branch. */ + nrel = irel + 1; + if (nrel == irelend + || irel->r_offset + 2 != nrel->r_offset + || ELF32_R_TYPE (nrel->r_info) != (int) R_MN10200_PCREL8) + continue; + + /* Make sure our destination immediately follows the + unconditional branch. */ + if (symval != (sec->output_section->vma + sec->output_offset + + irel->r_offset + 3)) + continue; + + /* Now make sure we are a conditional branch. This may not + be necessary, but why take the chance. + + Note these checks assume that R_MN10200_PCREL8 relocs + only occur on bCC and bCCx insns. If they occured + elsewhere, we'd need to know the start of this insn + for this check to be accurate. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + if (code != 0xe0 && code != 0xe1 && code != 0xe2 + && code != 0xe3 && code != 0xe4 && code != 0xe5 + && code != 0xe6 && code != 0xe7 && code != 0xe8 + && code != 0xe9 && code != 0xec && code != 0xed + && code != 0xee && code != 0xef && code != 0xfc + && code != 0xfd && code != 0xfe && code != 0xff) + continue; + + /* We also have to be sure there is no symbol/label + at the unconditional branch. */ + if (mn10200_elf_symbol_address_p (abfd, sec, extsyms, + irel->r_offset + 1)) + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* Reverse the condition of the first branch. */ + switch (code) + { + case 0xfc: + code = 0xfd; + break; + case 0xfd: + code = 0xfc; + break; + case 0xfe: + code = 0xff; + break; + case 0xff: + code = 0xfe; + break; + case 0xe8: + code = 0xe9; + break; + case 0xe9: + code = 0xe8; + break; + case 0xe0: + code = 0xe2; + break; + case 0xe2: + code = 0xe0; + break; + case 0xe3: + code = 0xe1; + break; + case 0xe1: + code = 0xe3; + break; + case 0xe4: + code = 0xe6; + break; + case 0xe6: + code = 0xe4; + break; + case 0xe7: + code = 0xe5; + break; + case 0xe5: + code = 0xe7; + break; + case 0xec: + code = 0xed; + break; + case 0xed: + code = 0xec; + break; + case 0xee: + code = 0xef; + break; + case 0xef: + code = 0xee; + break; + } + bfd_put_8 (abfd, code, contents + irel->r_offset - 1); + + /* Set the reloc type and symbol for the first branch + from the second branch. */ + irel->r_info = nrel->r_info; + + /* Make the reloc for the second branch a null reloc. */ + nrel->r_info = ELF32_R_INFO (ELF32_R_SYM (nrel->r_info), + R_MN10200_NONE); + + /* Delete two bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + } + + /* Try to turn a 24bit immediate, displacement or absolute address + into a 16bit immediate, displacement or absolute address. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_24) + { + bfd_vma value = symval; + + /* See if the value will fit in 16 bits. + We allow any 16bit match here. We prune those we can't + handle below. */ + if ((long)value < 0x7fff && (long)value > -0x8000) + { + unsigned char code; + + /* All insns which have 24bit operands are 5 bytes long, + the first byte will always be 0xf4, but we double check + it just in case. */ + + /* Get the first opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 2); + + if (code != 0xf4) + continue; + + /* Get the second opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + switch (code & 0xfc) + { + /* mov imm24,dn -> mov imm16,dn */ + case 0x70: + /* Not safe if the high bit is on as relaxing may + move the value out of high mem and thus not fit + in a signed 16bit value. */ + if (value & 0x8000) + continue; + + /* Note that we've changed the reldection contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xf8 + (code & 0x03), + contents + irel->r_offset - 2); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_16); + + /* The opcode got shorter too, so we have to fix the + addend and offset too! */ + irel->r_offset -= 1; + + /* Delete two bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + break; + + /* mov imm24,an -> mov imm16,an + cmp imm24,an -> cmp imm16,an + mov (abs24),dn -> mov (abs16),dn + mov dn,(abs24) -> mov dn,(abs16) + movb dn,(abs24) -> movb dn,(abs16) + movbu (abs24),dn -> movbu (abs16),dn */ + case 0x74: + case 0x7c: + case 0xc0: + case 0x40: + case 0x44: + case 0xc8: + /* Note that we've changed the reldection contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + if ((code & 0xfc) == 0x74) + code = 0xdc + (code & 0x03); + else if ((code & 0xfc) == 0x7c) + code = 0xec + (code & 0x03); + else if ((code & 0xfc) == 0xc0) + code = 0xc8 + (code & 0x03); + else if ((code & 0xfc) == 0x40) + code = 0xc0 + (code & 0x03); + else if ((code & 0xfc) == 0x44) + code = 0xc4 + (code & 0x03); + else if ((code & 0xfc) == 0xc8) + code = 0xcc + (code & 0x03); + + /* Fix the opcode. */ + bfd_put_8 (abfd, code, contents + irel->r_offset - 2); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_16); + + /* The opcode got shorter too, so we have to fix the + addend and offset too! */ + irel->r_offset -= 1; + + /* Delete two bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + break; + + /* cmp imm24,dn -> cmp imm16,dn + mov (abs24),an -> mov (abs16),an + mov an,(abs24) -> mov an,(abs16) + add imm24,dn -> add imm16,dn + add imm24,an -> add imm16,an + sub imm24,dn -> sub imm16,dn + sub imm24,an -> sub imm16,an + And all d24->d16 in memory ops. */ + case 0x78: + case 0xd0: + case 0x50: + case 0x60: + case 0x64: + case 0x68: + case 0x6c: + case 0x80: + case 0xf0: + case 0x00: + case 0x10: + case 0xb0: + case 0x30: + case 0xa0: + case 0x20: + case 0x90: + /* Not safe if the high bit is on as relaxing may + move the value out of high mem and thus not fit + in a signed 16bit value. */ + if (((code & 0xfc) == 0x78 + || (code & 0xfc) == 0x60 + || (code & 0xfc) == 0x64 + || (code & 0xfc) == 0x68 + || (code & 0xfc) == 0x6c + || (code & 0xfc) == 0x80 + || (code & 0xfc) == 0xf0 + || (code & 0xfc) == 0x00 + || (code & 0xfc) == 0x10 + || (code & 0xfc) == 0xb0 + || (code & 0xfc) == 0x30 + || (code & 0xfc) == 0xa0 + || (code & 0xfc) == 0x20 + || (code & 0xfc) == 0x90) + && (value & 0x8000) != 0) + continue; + + /* Note that we've changed the reldection contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xf7, contents + irel->r_offset - 2); + + if ((code & 0xfc) == 0x78) + code = 0x48 + (code & 0x03); + else if ((code & 0xfc) == 0xd0) + code = 0x30 + (code & 0x03); + else if ((code & 0xfc) == 0x50) + code = 0x20 + (code & 0x03); + else if ((code & 0xfc) == 0x60) + code = 0x18 + (code & 0x03); + else if ((code & 0xfc) == 0x64) + code = 0x08 + (code & 0x03); + else if ((code & 0xfc) == 0x68) + code = 0x1c + (code & 0x03); + else if ((code & 0xfc) == 0x6c) + code = 0x0c + (code & 0x03); + else if ((code & 0xfc) == 0x80) + code = 0xc0 + (code & 0x07); + else if ((code & 0xfc) == 0xf0) + code = 0xb0 + (code & 0x07); + else if ((code & 0xfc) == 0x00) + code = 0x80 + (code & 0x07); + else if ((code & 0xfc) == 0x10) + code = 0xa0 + (code & 0x07); + else if ((code & 0xfc) == 0xb0) + code = 0x70 + (code & 0x07); + else if ((code & 0xfc) == 0x30) + code = 0x60 + (code & 0x07); + else if ((code & 0xfc) == 0xa0) + code = 0xd0 + (code & 0x07); + else if ((code & 0xfc) == 0x20) + code = 0x90 + (code & 0x07); + else if ((code & 0xfc) == 0x90) + code = 0x50 + (code & 0x07); + + bfd_put_8 (abfd, code, contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_16); + + /* Delete one bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 2, 1)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + break; + + /* movb (abs24),dn ->movbu (abs16),dn extxb bn */ + case 0xc4: + /* Note that we've changed the reldection contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + bfd_put_8 (abfd, 0xcc + (code & 0x03), + contents + irel->r_offset - 2); + + bfd_put_8 (abfd, 0xb8 + (code & 0x03), + contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_16); + + /* The reloc will be applied one byte in front of its + current location. */ + irel->r_offset -= 1; + + /* Delete one bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 2, 1)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + break; + } + } + } + } + + if (free_relocs != NULL) + { + free (free_relocs); + free_relocs = NULL; + } + + if (free_contents != NULL) + { + if (! link_info->keep_memory) + free (free_contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + free_contents = NULL; + } + + if (free_extsyms != NULL) + { + if (! link_info->keep_memory) + free (free_extsyms); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = extsyms; + } + free_extsyms = NULL; + } + + return true; + + error_return: + if (free_relocs != NULL) + free (free_relocs); + if (free_contents != NULL) + free (free_contents); + if (free_extsyms != NULL) + free (free_extsyms); + return false; +} + +/* Delete some bytes from a section while relaxing. */ + +static boolean +mn10200_elf_relax_delete_bytes (abfd, sec, addr, count) + bfd *abfd; + asection *sec; + bfd_vma addr; + int count; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf32_External_Sym *extsyms; + int shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Rela *irelalign; + bfd_vma toaddr; + Elf32_External_Sym *esym, *esymend; + struct elf_link_hash_entry **sym_hash, **sym_hash_end; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + extsyms = (Elf32_External_Sym *) symtab_hdr->contents; + + shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + /* The deletion must stop at the next ALIGN reloc for an aligment + power larger than the number of bytes we are deleting. */ + + irelalign = NULL; + toaddr = sec->_cooked_size; + + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, toaddr - addr - count); + sec->_cooked_size -= count; + + /* Adjust all the relocs. */ + for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + { + /* Get the new reloc address. */ + if ((irel->r_offset > addr + && irel->r_offset < toaddr)) + irel->r_offset -= count; + } + + /* Adjust all the symbols. */ + esym = extsyms; + esymend = esym + symtab_hdr->sh_info; + for (; esym < esymend; esym++) + { + Elf_Internal_Sym isym; + + bfd_elf32_swap_symbol_in (abfd, esym, &isym); + + if (isym.st_shndx == shndx + && isym.st_value > addr + && isym.st_value < toaddr) + { + isym.st_value -= count; + bfd_elf32_swap_symbol_out (abfd, &isym, esym); + } + } + + sym_hash = elf_sym_hashes (abfd); + sym_hash_end = (sym_hash + + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info)); + for (; sym_hash < sym_hash_end; sym_hash++) + { + if (((*sym_hash)->root.type == bfd_link_hash_defined + || (*sym_hash)->root.type == bfd_link_hash_defweak) + && (*sym_hash)->root.u.def.section == sec + && (*sym_hash)->root.u.def.value > addr + && (*sym_hash)->root.u.def.value < toaddr) + { + (*sym_hash)->root.u.def.value -= count; + } + } + + return true; +} + +/* Return true if a symbol exists at the given address, else return + false. */ +static boolean +mn10200_elf_symbol_address_p (abfd, sec, extsyms, addr) + bfd *abfd; + asection *sec; + Elf32_External_Sym *extsyms; + bfd_vma addr; +{ + Elf_Internal_Shdr *symtab_hdr; + int shndx; + Elf32_External_Sym *esym, *esymend; + struct elf_link_hash_entry **sym_hash, **sym_hash_end; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + /* Examine all the symbols. */ + esym = extsyms; + esymend = esym + symtab_hdr->sh_info; + for (; esym < esymend; esym++) + { + Elf_Internal_Sym isym; + + bfd_elf32_swap_symbol_in (abfd, esym, &isym); + + if (isym.st_shndx == shndx + && isym.st_value == addr) + return true; + } + + sym_hash = elf_sym_hashes (abfd); + sym_hash_end = (sym_hash + + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info)); + for (; sym_hash < sym_hash_end; sym_hash++) + { + if (((*sym_hash)->root.type == bfd_link_hash_defined + || (*sym_hash)->root.type == bfd_link_hash_defweak) + && (*sym_hash)->root.u.def.section == sec + && (*sym_hash)->root.u.def.value == addr) + return true; + } + return false; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + which uses mn10200_elf_relocate_section. */ + +static bfd_byte * +mn10200_elf_get_relocated_section_contents (output_bfd, link_info, link_order, + data, relocateable, symbols) + bfd *output_bfd; + struct bfd_link_info *link_info; + struct bfd_link_order *link_order; + bfd_byte *data; + boolean relocateable; + asymbol **symbols; +{ + Elf_Internal_Shdr *symtab_hdr; + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf32_External_Sym *external_syms = NULL; + Elf_Internal_Sym *internal_syms = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocateable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocateable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + Elf_Internal_Sym *isymp; + asection **secpp; + Elf32_External_Sym *esym, *esymend; + + if (symtab_hdr->contents != NULL) + external_syms = (Elf32_External_Sym *) symtab_hdr->contents; + else + { + external_syms = ((Elf32_External_Sym *) + bfd_malloc (symtab_hdr->sh_info + * sizeof (Elf32_External_Sym))); + if (external_syms == NULL && symtab_hdr->sh_info > 0) + goto error_return; + if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_read (external_syms, sizeof (Elf32_External_Sym), + symtab_hdr->sh_info, input_bfd) + != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) + goto error_return; + } + + internal_relocs = (_bfd_elf32_link_read_relocs + (input_bfd, input_section, (PTR) NULL, + (Elf_Internal_Rela *) NULL, false)); + if (internal_relocs == NULL) + goto error_return; + + internal_syms = ((Elf_Internal_Sym *) + bfd_malloc (symtab_hdr->sh_info + * sizeof (Elf_Internal_Sym))); + if (internal_syms == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + sections = (asection **) bfd_malloc (symtab_hdr->sh_info + * sizeof (asection *)); + if (sections == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + isymp = internal_syms; + secpp = sections; + esym = external_syms; + esymend = esym + symtab_hdr->sh_info; + for (; esym < esymend; ++esym, ++isymp, ++secpp) + { + asection *isec; + + bfd_elf32_swap_symbol_in (input_bfd, esym, isymp); + + if (isymp->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isymp->st_shndx > 0 && isymp->st_shndx < SHN_LORESERVE) + isec = bfd_section_from_elf_index (input_bfd, isymp->st_shndx); + else if (isymp->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isymp->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else + { + /* Who knows? */ + isec = NULL; + } + + *secpp = isec; + } + + if (! mn10200_elf_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + internal_syms, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + sections = NULL; + if (internal_syms != NULL) + free (internal_syms); + internal_syms = NULL; + if (external_syms != NULL && symtab_hdr->contents == NULL) + free (external_syms); + external_syms = NULL; + if (internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + internal_relocs = NULL; + } + + return data; + + error_return: + if (internal_relocs != NULL + && internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + if (external_syms != NULL && symtab_hdr->contents == NULL) + free (external_syms); + if (internal_syms != NULL) + free (internal_syms); + if (sections != NULL) + free (sections); + return NULL; +} + + +#define TARGET_LITTLE_SYM bfd_elf32_mn10200_vec +#define TARGET_LITTLE_NAME "elf32-mn10200" +#define ELF_ARCH bfd_arch_mn10200 +#define ELF_MACHINE_CODE EM_CYGNUS_MN10200 +#define ELF_MAXPAGESIZE 0x1000 + +#define elf_info_to_howto mn10200_info_to_howto +#define elf_info_to_howto_rel 0 +#define elf_backend_relocate_section mn10200_elf_relocate_section +#define bfd_elf32_bfd_relax_section mn10200_elf_relax_section +#define bfd_elf32_bfd_get_relocated_section_contents \ + mn10200_elf_get_relocated_section_contents + +#define elf_symbol_leading_char '_' + +#include "elf32-target.h" diff -urN binutils-2.7/bfd/elf-m10300.c binutils-2.8/bfd/elf-m10300.c --- binutils-2.7/bfd/elf-m10300.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/elf-m10300.c Wed Apr 30 12:56:01 1997 @@ -0,0 +1,461 @@ +/* Matsushita 10300 specific support for 32-bit ELF + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" + +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void mn10300_info_to_howto + PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); +static bfd_reloc_status_type bfd_elf32_mn10300_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + + +/* We have to use RELA instructions since md_apply_fix3 in the assembler + does absolutely nothing. */ +#define USE_RELA + +enum reloc_type +{ + R_MN10300_NONE = 0, + R_MN10300_32, + R_MN10300_16, + R_MN10300_8, + R_MN10300_PCREL32, + R_MN10300_PCREL16, + R_MN10300_PCREL8, + R_MN10300_MAX +}; + +static reloc_howto_type elf_mn10300_howto_table[] = +{ + /* Dummy relocation. Does nothing. */ + HOWTO (R_MN10300_NONE, + 0, + 2, + 16, + false, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_NONE", + false, + 0, + 0, + false), + /* Standard 32 bit reloc. */ + HOWTO (R_MN10300_32, + 0, + 2, + 32, + false, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_32", + false, + 0xffffffff, + 0xffffffff, + false), + /* Standard 16 bit reloc. */ + HOWTO (R_MN10300_16, + 0, + 1, + 16, + false, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_16", + false, + 0xffff, + 0xffff, + false), + /* Standard 8 bit reloc. */ + HOWTO (R_MN10300_8, + 0, + 0, + 8, + false, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_8", + false, + 0xff, + 0xff, + false), + /* Standard 32bit pc-relative reloc. */ + HOWTO (R_MN10300_PCREL32, + 0, + 2, + 32, + true, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_PCREL32", + false, + 0xffffffff, + 0xffffffff, + true), + /* Standard 16bit pc-relative reloc. */ + HOWTO (R_MN10300_PCREL16, + 0, + 1, + 16, + true, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_PCREL16", + false, + 0xffff, + 0xffff, + true), + /* Standard 8 pc-relative reloc. */ + HOWTO (R_MN10300_PCREL8, + 0, + 0, + 8, + true, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_PCREL8", + false, + 0xff, + 0xff, + true), +}; + +struct mn10300_reloc_map +{ + unsigned char bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct mn10300_reloc_map mn10300_reloc_map[] = +{ + { BFD_RELOC_NONE, R_MN10300_NONE, }, + { BFD_RELOC_32, R_MN10300_32, }, + { BFD_RELOC_16, R_MN10300_16, }, + { BFD_RELOC_8, R_MN10300_8, }, + { BFD_RELOC_32_PCREL, R_MN10300_PCREL32, }, + { BFD_RELOC_16_PCREL, R_MN10300_PCREL16, }, + { BFD_RELOC_8_PCREL, R_MN10300_PCREL8, }, +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; + i < sizeof (mn10300_reloc_map) / sizeof (struct mn10300_reloc_map); + i++) + { + if (mn10300_reloc_map[i].bfd_reloc_val == code) + return &elf_mn10300_howto_table[mn10300_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an MN10300 ELF reloc. */ + +static void +mn10300_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd; + arelent *cache_ptr; + Elf32_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_MN10300_MAX); + cache_ptr->howto = &elf_mn10300_howto_table[r_type]; +} + +/* Perform a relocation as part of a final link. */ +static bfd_reloc_status_type +mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, contents, offset, value, + addend, info, sym_sec, is_local) + reloc_howto_type *howto; + bfd *input_bfd; + bfd *output_bfd; + asection *input_section; + bfd_byte *contents; + bfd_vma offset; + bfd_vma value; + bfd_vma addend; + struct bfd_link_info *info; + asection *sym_sec; + int is_local; +{ + unsigned long r_type = howto->type; + bfd_byte *hit_data = contents + offset; + + switch (r_type) + { + + case R_MN10300_NONE: + return bfd_reloc_ok; + + case R_MN10300_32: + value += addend; + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_16: + value += addend; + + if ((long)value > 0x7fff || (long)value < -0x8000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_8: + value += addend; + + if ((long)value > 0x7fff || (long)value < -0x8000) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_PCREL8: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + if ((long)value > 0xff || (long)value < -0x100) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_PCREL16: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + if ((long)value > 0xffff || (long)value < -0x10000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_PCREL32: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + default: + return bfd_reloc_notsupported; + } +} + + +/* Relocate an MN10300 ELF section. */ +static boolean +mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + howto = elf_mn10300_howto_table + r_type; + + if (info->relocateable) + { + /* This is a relocateable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + sec = local_sections[r_symndx]; + rel->r_addend += sec->output_offset + sym->st_value; + } + } + + continue; + } + + /* This is a final link. */ + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + } + else + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else if (h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset))) + return false; + relocation = 0; + } + } + + r = mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, + contents, rel->r_offset, + relocation, rel->r_addend, + info, sec, h == NULL); + + if (r != bfd_reloc_ok) + { + const char *name; + const char *msg = (const char *)0; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL || *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + switch (r) + { + case bfd_reloc_overflow: + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return false; + break; + + case bfd_reloc_undefined: + if (! ((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + rel->r_offset))) + return false; + break; + + case bfd_reloc_outofrange: + msg = "internal error: out of range error"; + goto common_error; + + case bfd_reloc_notsupported: + msg = "internal error: unsupported relocation error"; + goto common_error; + + case bfd_reloc_dangerous: + msg = "internal error: dangerous error"; + goto common_error; + + default: + msg = "internal error: unknown error"; + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, + rel->r_offset))) + return false; + break; + } + } + } + + return true; +} + +#define TARGET_LITTLE_SYM bfd_elf32_mn10300_vec +#define TARGET_LITTLE_NAME "elf32-mn10300" +#define ELF_ARCH bfd_arch_mn10300 +#define ELF_MACHINE_CODE EM_CYGNUS_MN10300 +#define ELF_MAXPAGESIZE 0x1000 + +#define elf_info_to_howto mn10300_info_to_howto +#define elf_info_to_howto_rel 0 +#define elf_backend_relocate_section mn10300_elf_relocate_section + +#define elf_symbol_leading_char '_' + +#include "elf32-target.h" diff -urN binutils-2.7/bfd/elf.c binutils-2.8/bfd/elf.c --- binutils-2.7/bfd/elf.c Thu Jul 4 12:30:44 1996 +++ binutils-2.8/bfd/elf.c Wed Apr 30 12:55:59 1997 @@ -1,5 +1,5 @@ /* ELF executable support for BFD. - Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -40,12 +40,163 @@ static INLINE struct elf_segment_map *make_mapping PARAMS ((bfd *, asection **, unsigned int, unsigned int, boolean)); +static boolean map_sections_to_segments PARAMS ((bfd *)); static int elf_sort_sections PARAMS ((const PTR, const PTR)); static boolean assign_file_positions_for_segments PARAMS ((bfd *)); static boolean assign_file_positions_except_relocs PARAMS ((bfd *)); static boolean prep_headers PARAMS ((bfd *)); static boolean swap_out_syms PARAMS ((bfd *, struct bfd_strtab_hash **)); static boolean copy_private_bfd_data PARAMS ((bfd *, bfd *)); +static char *elf_read PARAMS ((bfd *, long, unsigned int)); +static void elf_fake_sections 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 *)); +static bfd_size_type get_program_header_size PARAMS ((bfd *)); + +/* Swap version information in and out. The version information is + currently size independent. If that ever changes, this code will + need to move into elfcode.h. */ + +/* Swap in a Verdef structure. */ + +void +_bfd_elf_swap_verdef_in (abfd, src, dst) + bfd *abfd; + const Elf_External_Verdef *src; + Elf_Internal_Verdef *dst; +{ + dst->vd_version = bfd_h_get_16 (abfd, src->vd_version); + dst->vd_flags = bfd_h_get_16 (abfd, src->vd_flags); + dst->vd_ndx = bfd_h_get_16 (abfd, src->vd_ndx); + dst->vd_cnt = bfd_h_get_16 (abfd, src->vd_cnt); + dst->vd_hash = bfd_h_get_32 (abfd, src->vd_hash); + dst->vd_aux = bfd_h_get_32 (abfd, src->vd_aux); + dst->vd_next = bfd_h_get_32 (abfd, src->vd_next); +} + +/* Swap out a Verdef structure. */ + +void +_bfd_elf_swap_verdef_out (abfd, src, dst) + bfd *abfd; + const Elf_Internal_Verdef *src; + Elf_External_Verdef *dst; +{ + bfd_h_put_16 (abfd, src->vd_version, dst->vd_version); + bfd_h_put_16 (abfd, src->vd_flags, dst->vd_flags); + bfd_h_put_16 (abfd, src->vd_ndx, dst->vd_ndx); + bfd_h_put_16 (abfd, src->vd_cnt, dst->vd_cnt); + bfd_h_put_32 (abfd, src->vd_hash, dst->vd_hash); + bfd_h_put_32 (abfd, src->vd_aux, dst->vd_aux); + bfd_h_put_32 (abfd, src->vd_next, dst->vd_next); +} + +/* Swap in a Verdaux structure. */ + +void +_bfd_elf_swap_verdaux_in (abfd, src, dst) + bfd *abfd; + const Elf_External_Verdaux *src; + Elf_Internal_Verdaux *dst; +{ + dst->vda_name = bfd_h_get_32 (abfd, src->vda_name); + dst->vda_next = bfd_h_get_32 (abfd, src->vda_next); +} + +/* Swap out a Verdaux structure. */ + +void +_bfd_elf_swap_verdaux_out (abfd, src, dst) + bfd *abfd; + const Elf_Internal_Verdaux *src; + Elf_External_Verdaux *dst; +{ + bfd_h_put_32 (abfd, src->vda_name, dst->vda_name); + bfd_h_put_32 (abfd, src->vda_next, dst->vda_next); +} + +/* Swap in a Verneed structure. */ + +void +_bfd_elf_swap_verneed_in (abfd, src, dst) + bfd *abfd; + const Elf_External_Verneed *src; + Elf_Internal_Verneed *dst; +{ + dst->vn_version = bfd_h_get_16 (abfd, src->vn_version); + dst->vn_cnt = bfd_h_get_16 (abfd, src->vn_cnt); + dst->vn_file = bfd_h_get_32 (abfd, src->vn_file); + dst->vn_aux = bfd_h_get_32 (abfd, src->vn_aux); + dst->vn_next = bfd_h_get_32 (abfd, src->vn_next); +} + +/* Swap out a Verneed structure. */ + +void +_bfd_elf_swap_verneed_out (abfd, src, dst) + bfd *abfd; + const Elf_Internal_Verneed *src; + Elf_External_Verneed *dst; +{ + bfd_h_put_16 (abfd, src->vn_version, dst->vn_version); + bfd_h_put_16 (abfd, src->vn_cnt, dst->vn_cnt); + bfd_h_put_32 (abfd, src->vn_file, dst->vn_file); + bfd_h_put_32 (abfd, src->vn_aux, dst->vn_aux); + bfd_h_put_32 (abfd, src->vn_next, dst->vn_next); +} + +/* Swap in a Vernaux structure. */ + +void +_bfd_elf_swap_vernaux_in (abfd, src, dst) + bfd *abfd; + const Elf_External_Vernaux *src; + Elf_Internal_Vernaux *dst; +{ + dst->vna_hash = bfd_h_get_32 (abfd, src->vna_hash); + dst->vna_flags = bfd_h_get_16 (abfd, src->vna_flags); + dst->vna_other = bfd_h_get_16 (abfd, src->vna_other); + dst->vna_name = bfd_h_get_32 (abfd, src->vna_name); + dst->vna_next = bfd_h_get_32 (abfd, src->vna_next); +} + +/* Swap out a Vernaux structure. */ + +void +_bfd_elf_swap_vernaux_out (abfd, src, dst) + bfd *abfd; + const Elf_Internal_Vernaux *src; + Elf_External_Vernaux *dst; +{ + bfd_h_put_32 (abfd, src->vna_hash, dst->vna_hash); + bfd_h_put_16 (abfd, src->vna_flags, dst->vna_flags); + bfd_h_put_16 (abfd, src->vna_other, dst->vna_other); + bfd_h_put_32 (abfd, src->vna_name, dst->vna_name); + bfd_h_put_32 (abfd, src->vna_next, dst->vna_next); +} + +/* Swap in a Versym structure. */ + +void +_bfd_elf_swap_versym_in (abfd, src, dst) + bfd *abfd; + const Elf_External_Versym *src; + Elf_Internal_Versym *dst; +{ + dst->vs_vers = bfd_h_get_16 (abfd, src->vs_vers); +} + +/* Swap out a Versym structure. */ + +void +_bfd_elf_swap_versym_out (abfd, src, dst) + bfd *abfd; + const Elf_Internal_Versym *src; + Elf_External_Versym *dst; +{ + bfd_h_put_16 (abfd, src->vs_vers, dst->vs_vers); +} /* Standard ELF hash function. Do not change this function; you will cause invalid hash tables to be generated. (Well, you would if this @@ -96,7 +247,7 @@ } boolean -elf_mkobject (abfd) +bfd_elf_mkobject (abfd) bfd * abfd; { /* this just does initialization */ @@ -211,6 +362,15 @@ || strncmp (name, ".stab", sizeof ".stab" - 1) == 0) flags |= SEC_DEBUGGING; + /* As a GNU extension, if the name begins with .gnu.linkonce, we + only link a single copy of the section. This is used to support + g++. g++ will emit each template expansion in its own section. + The symbols will be defined as weak, so that multiple definitions + are permitted. The GNU linker extension is to actually discard + all but one of the sections. */ + if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0) + flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; + if (! bfd_set_section_flags (abfd, newsect, flags)) return false; @@ -227,7 +387,11 @@ && phdr->p_paddr != 0 && phdr->p_vaddr != phdr->p_paddr && phdr->p_vaddr <= hdr->sh_addr - && phdr->p_vaddr + phdr->p_memsz >= hdr->sh_addr + hdr->sh_size) + && phdr->p_vaddr + phdr->p_memsz >= hdr->sh_addr + hdr->sh_size + && ((flags & SEC_LOAD) == 0 + || (phdr->p_offset <= hdr->sh_offset + && (phdr->p_offset + phdr->p_filesz + >= hdr->sh_offset + hdr->sh_size)))) { newsect->lma += phdr->p_paddr - phdr->p_vaddr; break; @@ -453,6 +617,13 @@ case DT_DEBUG: name = "DEBUG"; break; case DT_TEXTREL: name = "TEXTREL"; break; case DT_JMPREL: name = "JMPREL"; break; + case DT_AUXILIARY: name = "AUXILIARY"; stringp = true; break; + case DT_FILTER: name = "FILTER"; stringp = true; break; + case DT_VERSYM: name = "VERSYM"; break; + case DT_VERDEF: name = "VERDEF"; break; + case DT_VERDEFNUM: name = "VERDEFNUM"; break; + case DT_VERNEED: name = "VERNEED"; break; + case DT_VERNEEDNUM: name = "VERNEEDNUM"; break; } fprintf (f, " %-11s ", name); @@ -475,6 +646,52 @@ dynbuf = NULL; } + if ((elf_dynverdef (abfd) != 0 && elf_tdata (abfd)->verdef == NULL) + || (elf_dynverref (abfd) != 0 && elf_tdata (abfd)->verref == NULL)) + { + if (! _bfd_elf_slurp_version_tables (abfd)) + return false; + } + + if (elf_dynverdef (abfd) != 0) + { + Elf_Internal_Verdef *t; + + fprintf (f, "\nVersion definitions:\n"); + for (t = elf_tdata (abfd)->verdef; t != NULL; t = t->vd_nextdef) + { + fprintf (f, "%d 0x%2.2x 0x%8.8lx %s\n", t->vd_ndx, + t->vd_flags, t->vd_hash, t->vd_nodename); + if (t->vd_auxptr->vda_nextptr != NULL) + { + Elf_Internal_Verdaux *a; + + fprintf (f, "\t"); + for (a = t->vd_auxptr->vda_nextptr; + a != NULL; + a = a->vda_nextptr) + fprintf (f, "%s ", a->vda_nodename); + fprintf (f, "\n"); + } + } + } + + if (elf_dynverref (abfd) != 0) + { + Elf_Internal_Verneed *t; + + fprintf (f, "\nVersion References:\n"); + for (t = elf_tdata (abfd)->verref; t != NULL; t = t->vn_nextref) + { + Elf_Internal_Vernaux *a; + + fprintf (f, " required from %s:\n", t->vn_filename); + for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) + fprintf (f, " 0x%8.8lx 0x%2.2x %2.2d %s\n", a->vna_hash, + a->vna_flags, a->vna_other, a->vna_nodename); + } + } + return true; error_return: @@ -484,9 +701,10 @@ } /* Display ELF-specific fields of a symbol. */ + void -bfd_elf_print_symbol (ignore_abfd, filep, symbol, how) - bfd *ignore_abfd; +bfd_elf_print_symbol (abfd, filep, symbol, how) + bfd *abfd; PTR filep; asymbol *symbol; bfd_print_symbol_type how; @@ -516,6 +734,64 @@ (bfd_is_com_section (symbol->section) ? ((elf_symbol_type *) symbol)->internal_elf_sym.st_value : ((elf_symbol_type *) symbol)->internal_elf_sym.st_size)); + + /* If we have version information, print it. */ + if (elf_tdata (abfd)->dynversym_section != 0 + && (elf_tdata (abfd)->dynverdef_section != 0 + || elf_tdata (abfd)->dynverref_section != 0)) + { + unsigned int vernum; + const char *version_string; + + vernum = ((elf_symbol_type *) symbol)->version & VERSYM_VERSION; + + if (vernum == 0) + version_string = ""; + else if (vernum == 1) + version_string = "Base"; + else if (vernum <= elf_tdata (abfd)->cverdefs) + version_string = + elf_tdata (abfd)->verdef[vernum - 1].vd_nodename; + else + { + Elf_Internal_Verneed *t; + + version_string = ""; + for (t = elf_tdata (abfd)->verref; + t != NULL; + t = t->vn_nextref) + { + Elf_Internal_Vernaux *a; + + for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) + { + if (a->vna_other == vernum) + { + version_string = a->vna_nodename; + break; + } + } + } + } + + if ((((elf_symbol_type *) symbol)->version & VERSYM_HIDDEN) == 0) + fprintf (file, " %-11s", version_string); + else + { + int i; + + fprintf (file, " (%s)", version_string); + for (i = 10 - strlen (version_string); i > 0; --i) + putc (' ', file); + } + } + + /* If the st_other field is not zero, print it. */ + if (((elf_symbol_type *) symbol)->internal_elf_sym.st_other != 0) + fprintf (file, " 0x%02x", + ((unsigned int) + ((elf_symbol_type *) symbol)->internal_elf_sym.st_other)); + fprintf (file, " %s", symbol->name); } break; @@ -555,7 +831,9 @@ ret->got_offset = (bfd_vma) -1; ret->plt_offset = (bfd_vma) -1; ret->linker_section_pointer = (elf_linker_section_pointers_t *)0; + ret->verinfo.verdef = NULL; ret->type = STT_NOTYPE; + ret->other = 0; /* Assume that we have been called by a non-ELF symbol reader. This flag is then reset by the code which reads an ELF input file. This ensures that a symbol created by a non-ELF symbol @@ -871,6 +1149,24 @@ } break; + case SHT_GNU_verdef: + elf_dynverdef (abfd) = shindex; + elf_tdata (abfd)->dynverdef_hdr = *hdr; + return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + break; + + case SHT_GNU_versym: + elf_dynversym (abfd) = shindex; + elf_tdata (abfd)->dynversym_hdr = *hdr; + return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + break; + + case SHT_GNU_verneed: + elf_dynverref (abfd) = shindex; + elf_tdata (abfd)->dynverref_hdr = *hdr; + return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + break; + case SHT_SHLIB: return true; @@ -1085,11 +1381,42 @@ this_hdr->sh_type = SHT_REL; this_hdr->sh_entsize = bed->s->sizeof_rel; } - else if (strcmp (asect->name, ".note") == 0) + else if (strncmp (asect->name, ".note", 5) == 0) this_hdr->sh_type = SHT_NOTE; else if (strncmp (asect->name, ".stab", 5) == 0 && strcmp (asect->name + strlen (asect->name) - 3, "str") == 0) this_hdr->sh_type = SHT_STRTAB; + else if (strcmp (asect->name, ".gnu.version") == 0) + { + this_hdr->sh_type = SHT_GNU_versym; + this_hdr->sh_entsize = sizeof (Elf_External_Versym); + } + else if (strcmp (asect->name, ".gnu.version_d") == 0) + { + this_hdr->sh_type = SHT_GNU_verdef; + this_hdr->sh_entsize = 0; + /* objcopy or strip will copy over sh_info, but may not set + cverdefs. The linker will set cverdefs, but sh_info will be + zero. */ + if (this_hdr->sh_info == 0) + this_hdr->sh_info = elf_tdata (abfd)->cverdefs; + else + BFD_ASSERT (elf_tdata (abfd)->cverdefs == 0 + || this_hdr->sh_info == elf_tdata (abfd)->cverdefs); + } + else if (strcmp (asect->name, ".gnu.version_r") == 0) + { + this_hdr->sh_type = SHT_GNU_verneed; + this_hdr->sh_entsize = 0; + /* objcopy or strip will copy over sh_info, but may not set + cverrefs. The linker will set cverrefs, but sh_info will be + zero. */ + if (this_hdr->sh_info == 0) + this_hdr->sh_info = elf_tdata (abfd)->cverrefs; + else + BFD_ASSERT (elf_tdata (abfd)->cverrefs == 0 + || this_hdr->sh_info == elf_tdata (abfd)->cverrefs); + } else if ((asect->flags & SEC_ALLOC) != 0 && (asect->flags & SEC_LOAD) != 0) this_hdr->sh_type = SHT_PROGBITS; @@ -1295,16 +1622,20 @@ case SHT_DYNAMIC: case SHT_DYNSYM: + case SHT_GNU_verneed: + case SHT_GNU_verdef: /* sh_link is the section header index of the string table - used for the dynamic entries or symbol table. */ + used for the dynamic entries, or the symbol table, or the + version strings. */ s = bfd_get_section_by_name (abfd, ".dynstr"); if (s != NULL) d->this_hdr.sh_link = elf_section_data (s)->this_idx; break; case SHT_HASH: + case SHT_GNU_versym: /* sh_link is the section header index of the symbol table - this hash table is for. */ + this hash table or version table is for. */ s = bfd_get_section_by_name (abfd, ".dynsym"); if (s != NULL) d->this_hdr.sh_link = elf_section_data (s)->this_idx; @@ -1746,36 +2077,76 @@ phdr_size = elf_tdata (abfd)->program_header_size; if (phdr_size == 0) phdr_size = get_elf_backend_data (abfd)->s->sizeof_phdr; - if (sections[0]->lma % maxpagesize < phdr_size % maxpagesize) + if ((abfd->flags & D_PAGED) == 0 + || sections[0]->lma % maxpagesize < phdr_size % maxpagesize) phdr_in_section = false; } for (i = 0, hdrpp = sections; i < count; i++, hdrpp++) { asection *hdr; + boolean new_segment; hdr = *hdrpp; /* See if this section and the last one will fit in the same - segment. Don't put a loadable section after a non-loadable - section. If we are building a dynamic executable, don't put - a writable section in a read only segment, unless they're on - the same page anyhow (we don't do this for a non-dynamic - executable because some people prefer to have only one - program segment; anybody can use PHDRS in their linker script - to control what happens anyhow). */ - if (last_hdr == NULL - || ((BFD_ALIGN (last_hdr->lma + last_hdr->_raw_size, maxpagesize) - >= hdr->lma) - && ((last_hdr->flags & SEC_LOAD) != 0 - || (hdr->flags & SEC_LOAD) == 0) - && (dynsec == NULL - || writable - || (hdr->flags & SEC_READONLY) != 0 - || (BFD_ALIGN (last_hdr->lma + last_hdr->_raw_size, - maxpagesize) - > hdr->lma)))) - + segment. */ + + if (last_hdr == NULL) + { + /* If we don't have a segment yet, then we don't need a new + one (we build the last one after this loop). */ + new_segment = false; + } + else if (last_hdr->lma - last_hdr->vma != hdr->lma - hdr->vma) + { + /* If this section has a different relation between the + virtual address and the load address, then we need a new + segment. */ + new_segment = true; + } + else if (BFD_ALIGN (last_hdr->lma + last_hdr->_raw_size, maxpagesize) + < hdr->lma) + { + /* If putting this section in this segment would force us to + skip a page in the segment, then we need a new segment. */ + new_segment = true; + } + else if ((abfd->flags & D_PAGED) == 0) + { + /* If the file is not demand paged, which means that we + don't require the sections to be correctly aligned in the + file, then there is no other reason for a new segment. */ + new_segment = false; + } + else if ((last_hdr->flags & SEC_LOAD) == 0 + && (hdr->flags & SEC_LOAD) != 0) + { + /* We don't want to put a loadable section after a + nonloadable section in the same segment. */ + new_segment = true; + } + else if (! writable + && (hdr->flags & SEC_READONLY) == 0 + && (BFD_ALIGN (last_hdr->lma + last_hdr->_raw_size, maxpagesize) + == hdr->lma)) + { + /* We don't want to put a writable section in a read only + segment, unless they are on the same page in memory + anyhow. We already know that the last section does not + bring us past the current section on the page, so the + only case in which the new section is not on the same + page as the previous section is when the previous section + ends precisely on a page boundary. */ + new_segment = true; + } + else + { + /* Otherwise, we can use the same segment. */ + new_segment = false; + } + + if (! new_segment) { if ((hdr->flags & SEC_READONLY) == 0) writable = true; @@ -1783,9 +2154,8 @@ continue; } - /* This section won't fit in the program segment. We must - create a new program header holding all the sections from - phdr_index until hdr. */ + /* We need a new program segment. We must create a new program + header holding all the sections from phdr_index until hdr. */ m = make_mapping (abfd, sections, phdr_index, i, phdr_in_section); if (m == NULL) @@ -1831,6 +2201,30 @@ pm = &m->next; } + /* For each loadable .note section, add a PT_NOTE segment. We don't + use bfd_get_section_by_name, because if we link together + nonloadable .note sections and loadable .note sections, we will + generate two .note sections in the output file. FIXME: Using + names for section types is bogus anyhow. */ + for (s = abfd->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LOAD) != 0 + && strncmp (s->name, ".note", 5) == 0) + { + m = ((struct elf_segment_map *) + bfd_zalloc (abfd, sizeof (struct elf_segment_map))); + if (m == NULL) + goto error_return; + m->next = NULL; + m->p_type = PT_NOTE; + m->count = 1; + m->sections[0] = s; + + *pm = m; + pm = &m->next; + } + } + free (sections); sections = NULL; @@ -1858,6 +2252,13 @@ else if (sec1->vma > sec2->vma) return 1; + /* Sort by LMA. Normally the LMA and the VMA will be the same, and + this will do nothing. */ + if (sec1->lma < sec2->lma) + return -1; + else if (sec1->lma > sec2->lma) + return 1; + /* Put !SEC_LOAD sections after SEC_LOAD ones. */ #define TOEND(x) (((x)->flags & SEC_LOAD) == 0) @@ -1897,7 +2298,7 @@ struct elf_segment_map *m; unsigned int alloc; Elf_Internal_Phdr *phdrs; - file_ptr off; + file_ptr off, voff; bfd_vma filehdr_vaddr, filehdr_paddr; bfd_vma phdrs_vaddr, phdrs_paddr; Elf_Internal_Phdr *p; @@ -1975,8 +2376,14 @@ if (p->p_type == PT_LOAD && m->count > 0 - && (m->sections[0]->flags & SEC_LOAD) != 0) - off += (m->sections[0]->vma - off) % bed->maxpagesize; + && (m->sections[0]->flags & SEC_ALLOC) != 0) + { + if ((abfd->flags & D_PAGED) != 0) + off += (m->sections[0]->vma - off) % bed->maxpagesize; + else + off += ((m->sections[0]->vma - off) + % (1 << bfd_get_section_alignment (abfd, m->sections[0]))); + } if (m->count == 0) p->p_vaddr = 0; @@ -1990,7 +2397,8 @@ else p->p_paddr = m->sections[0]->lma; - if (p->p_type == PT_LOAD) + if (p->p_type == PT_LOAD + && (abfd->flags & D_PAGED) != 0) p->p_align = bed->maxpagesize; else if (m->count == 0) p->p_align = bed->s->file_align; @@ -2068,6 +2476,7 @@ } } + voff = off; for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) { asection *sec; @@ -2076,6 +2485,7 @@ sec = *secpp; flags = sec->flags; + align = 1 << bfd_get_section_alignment (abfd, sec); if (p->p_type == PT_LOAD) { @@ -2085,13 +2495,17 @@ the page size. */ if ((flags & SEC_ALLOC) != 0) { - adjust = (sec->vma - off) % bed->maxpagesize; + if ((abfd->flags & D_PAGED) != 0) + adjust = (sec->vma - voff) % bed->maxpagesize; + else + adjust = (sec->vma - voff) % align; if (adjust != 0) { if (i == 0) abort (); p->p_memsz += adjust; off += adjust; + voff += adjust; if ((flags & SEC_LOAD) != 0) p->p_filesz += adjust; } @@ -2101,6 +2515,8 @@ if ((flags & SEC_LOAD) != 0) off += sec->_raw_size; + if ((flags & SEC_ALLOC) != 0) + voff += sec->_raw_size; } p->p_memsz += sec->_raw_size; @@ -2108,7 +2524,6 @@ if ((flags & SEC_LOAD) != 0) p->p_filesz += sec->_raw_size; - align = 1 << bfd_get_section_alignment (abfd, sec); if (align > p->p_align) p->p_align = align; @@ -2224,6 +2639,16 @@ ++segs; } + for (s = abfd->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LOAD) != 0 + && strncmp (s->name, ".note", 5) == 0) + { + /* We need a PT_NOTE segment. */ + ++segs; + } + } + /* Let the backend count up any program headers it might need. */ if (bed->elf_backend_additional_program_headers) { @@ -2320,7 +2745,10 @@ (hdr->bfd_section == NULL ? "*unknown*" : hdr->bfd_section->name))); - off += (hdr->sh_addr - off) % bed->maxpagesize; + if ((abfd->flags & D_PAGED) != 0) + off += (hdr->sh_addr - off) % bed->maxpagesize; + else + off += (hdr->sh_addr - off) % hdr->sh_addralign; off = _bfd_elf_assign_file_position_for_section (hdr, off, false); } @@ -2419,6 +2847,21 @@ case bfd_arch_alpha: i_ehdrp->e_machine = EM_ALPHA; break; + case bfd_arch_sh: + i_ehdrp->e_machine = EM_SH; + break; + case bfd_arch_d10v: + i_ehdrp->e_machine = EM_CYGNUS_D10V; + break; + case bfd_arch_m32r: + i_ehdrp->e_machine = EM_CYGNUS_M32R; + break; + case bfd_arch_mn10200: + i_ehdrp->e_machine = EM_CYGNUS_MN10200; + break; + case bfd_arch_mn10300: + i_ehdrp->e_machine = EM_CYGNUS_MN10300; + break; /* also note that EM_M32, AT&T WE32100 is unknown to bfd */ default: i_ehdrp->e_machine = EM_NONE; @@ -2704,7 +3147,7 @@ m = ((struct elf_segment_map *) bfd_alloc (obfd, (sizeof (struct elf_segment_map) - + (csecs - 1) * sizeof (asection *)))); + + ((size_t) csecs - 1) * sizeof (asection *)))); if (m == NULL) return false; @@ -2798,7 +3241,9 @@ ohdr->sh_entsize = ihdr->sh_entsize; if (ihdr->sh_type == SHT_SYMTAB - || ihdr->sh_type == SHT_DYNSYM) + || ihdr->sh_type == SHT_DYNSYM + || ihdr->sh_type == SHT_GNU_verneed + || ihdr->sh_type == SHT_GNU_verdef) ohdr->sh_info = ihdr->sh_info; return true; @@ -2824,6 +3269,10 @@ { elf_symbol_type *isym, *osym; + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return true; + isym = elf_symbol_from (ibfd, isymarg); osym = elf_symbol_from (obfd, osymarg); @@ -3036,7 +3485,11 @@ sym.st_info = ELF_ST_INFO (bind, type); } - sym.st_other = 0; + if (type_ptr != NULL) + sym.st_other = type_ptr->internal_elf_sym.st_other; + else + sym.st_other = 0; + bed->s->swap_symbol_out (abfd, &sym, (PTR) outbound_syms); outbound_syms += bed->s->sizeof_sym; } @@ -3116,7 +3569,10 @@ arelent *tblptr; unsigned int i; - if (! get_elf_backend_data (abfd)->s->slurp_reloc_table (abfd, section, symbols)) + if (! get_elf_backend_data (abfd)->s->slurp_reloc_table (abfd, + section, + symbols, + false)) return -1; tblptr = section->relocation; @@ -3148,6 +3604,264 @@ return get_elf_backend_data (abfd)->s->slurp_symbol_table (abfd, alocation, true); } +/* Return the size required for the dynamic reloc entries. Any + section that was actually installed in the BFD, and has type + SHT_REL or SHT_RELA, and uses the dynamic symbol table, is + considered to be a dynamic reloc section. */ + +long +_bfd_elf_get_dynamic_reloc_upper_bound (abfd) + bfd *abfd; +{ + long ret; + asection *s; + + if (elf_dynsymtab (abfd) == 0) + { + bfd_set_error (bfd_error_invalid_operation); + return -1; + } + + ret = sizeof (arelent *); + for (s = abfd->sections; s != NULL; s = s->next) + if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd) + && (elf_section_data (s)->this_hdr.sh_type == SHT_REL + || elf_section_data (s)->this_hdr.sh_type == SHT_RELA)) + ret += ((s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize) + * sizeof (arelent *)); + + return ret; +} + +/* Canonicalize the dynamic relocation entries. Note that we return + the dynamic relocations as a single block, although they are + actually associated with particular sections; the interface, which + was designed for SunOS style shared libraries, expects that there + is only one set of dynamic relocs. Any section that was actually + installed in the BFD, and has type SHT_REL or SHT_RELA, and uses + the dynamic symbol table, is considered to be a dynamic reloc + section. */ + +long +_bfd_elf_canonicalize_dynamic_reloc (abfd, storage, syms) + bfd *abfd; + arelent **storage; + asymbol **syms; +{ + boolean (*slurp_relocs) PARAMS ((bfd *, asection *, asymbol **, boolean)); + asection *s; + long ret; + + if (elf_dynsymtab (abfd) == 0) + { + bfd_set_error (bfd_error_invalid_operation); + return -1; + } + + slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table; + ret = 0; + for (s = abfd->sections; s != NULL; s = s->next) + { + if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd) + && (elf_section_data (s)->this_hdr.sh_type == SHT_REL + || elf_section_data (s)->this_hdr.sh_type == SHT_RELA)) + { + arelent *p; + long count, i; + + if (! (*slurp_relocs) (abfd, s, syms, true)) + return -1; + count = s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize; + p = s->relocation; + for (i = 0; i < count; i++) + *storage++ = p++; + ret += count; + } + } + + *storage = NULL; + + return ret; +} + +/* Read in the version information. */ + +boolean +_bfd_elf_slurp_version_tables (abfd) + bfd *abfd; +{ + bfd_byte *contents = NULL; + + if (elf_dynverdef (abfd) != 0) + { + Elf_Internal_Shdr *hdr; + Elf_External_Verdef *everdef; + Elf_Internal_Verdef *iverdef; + unsigned int i; + + hdr = &elf_tdata (abfd)->dynverdef_hdr; + + elf_tdata (abfd)->verdef = + ((Elf_Internal_Verdef *) + bfd_zalloc (abfd, hdr->sh_info * sizeof (Elf_Internal_Verdef))); + if (elf_tdata (abfd)->verdef == NULL) + goto error_return; + + elf_tdata (abfd)->cverdefs = hdr->sh_info; + + contents = (bfd_byte *) bfd_malloc (hdr->sh_size); + if (contents == NULL) + goto error_return; + if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 + || bfd_read ((PTR) contents, 1, hdr->sh_size, abfd) != hdr->sh_size) + goto error_return; + + everdef = (Elf_External_Verdef *) contents; + iverdef = elf_tdata (abfd)->verdef; + for (i = 0; i < hdr->sh_info; i++, iverdef++) + { + Elf_External_Verdaux *everdaux; + Elf_Internal_Verdaux *iverdaux; + unsigned int j; + + _bfd_elf_swap_verdef_in (abfd, everdef, iverdef); + + iverdef->vd_bfd = abfd; + + iverdef->vd_auxptr = ((Elf_Internal_Verdaux *) + bfd_alloc (abfd, + (iverdef->vd_cnt + * sizeof (Elf_Internal_Verdaux)))); + if (iverdef->vd_auxptr == NULL) + goto error_return; + + everdaux = ((Elf_External_Verdaux *) + ((bfd_byte *) everdef + iverdef->vd_aux)); + iverdaux = iverdef->vd_auxptr; + for (j = 0; j < iverdef->vd_cnt; j++, iverdaux++) + { + _bfd_elf_swap_verdaux_in (abfd, everdaux, iverdaux); + + iverdaux->vda_nodename = + bfd_elf_string_from_elf_section (abfd, hdr->sh_link, + iverdaux->vda_name); + if (iverdaux->vda_nodename == NULL) + goto error_return; + + if (j + 1 < iverdef->vd_cnt) + iverdaux->vda_nextptr = iverdaux + 1; + else + iverdaux->vda_nextptr = NULL; + + everdaux = ((Elf_External_Verdaux *) + ((bfd_byte *) everdaux + iverdaux->vda_next)); + } + + iverdef->vd_nodename = iverdef->vd_auxptr->vda_nodename; + + if (i + 1 < hdr->sh_info) + iverdef->vd_nextdef = iverdef + 1; + else + iverdef->vd_nextdef = NULL; + + everdef = ((Elf_External_Verdef *) + ((bfd_byte *) everdef + iverdef->vd_next)); + } + + free (contents); + contents = NULL; + } + + if (elf_dynverref (abfd) != 0) + { + Elf_Internal_Shdr *hdr; + Elf_External_Verneed *everneed; + Elf_Internal_Verneed *iverneed; + unsigned int i; + + hdr = &elf_tdata (abfd)->dynverref_hdr; + + elf_tdata (abfd)->verref = + ((Elf_Internal_Verneed *) + bfd_zalloc (abfd, hdr->sh_info * sizeof (Elf_Internal_Verneed))); + if (elf_tdata (abfd)->verref == NULL) + goto error_return; + + elf_tdata (abfd)->cverrefs = hdr->sh_info; + + contents = (bfd_byte *) bfd_malloc (hdr->sh_size); + if (contents == NULL) + goto error_return; + if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 + || bfd_read ((PTR) contents, 1, hdr->sh_size, abfd) != hdr->sh_size) + goto error_return; + + everneed = (Elf_External_Verneed *) contents; + iverneed = elf_tdata (abfd)->verref; + for (i = 0; i < hdr->sh_info; i++, iverneed++) + { + Elf_External_Vernaux *evernaux; + Elf_Internal_Vernaux *ivernaux; + unsigned int j; + + _bfd_elf_swap_verneed_in (abfd, everneed, iverneed); + + iverneed->vn_bfd = abfd; + + iverneed->vn_filename = + bfd_elf_string_from_elf_section (abfd, hdr->sh_link, + iverneed->vn_file); + if (iverneed->vn_filename == NULL) + goto error_return; + + iverneed->vn_auxptr = + ((Elf_Internal_Vernaux *) + bfd_alloc (abfd, + iverneed->vn_cnt * sizeof (Elf_Internal_Vernaux))); + + evernaux = ((Elf_External_Vernaux *) + ((bfd_byte *) everneed + iverneed->vn_aux)); + ivernaux = iverneed->vn_auxptr; + for (j = 0; j < iverneed->vn_cnt; j++, ivernaux++) + { + _bfd_elf_swap_vernaux_in (abfd, evernaux, ivernaux); + + ivernaux->vna_nodename = + bfd_elf_string_from_elf_section (abfd, hdr->sh_link, + ivernaux->vna_name); + if (ivernaux->vna_nodename == NULL) + goto error_return; + + if (j + 1 < iverneed->vn_cnt) + ivernaux->vna_nextptr = ivernaux + 1; + else + ivernaux->vna_nextptr = NULL; + + evernaux = ((Elf_External_Vernaux *) + ((bfd_byte *) evernaux + ivernaux->vna_next)); + } + + if (i + 1 < hdr->sh_info) + iverneed->vn_nextref = iverneed + 1; + else + iverneed->vn_nextref = NULL; + + everneed = ((Elf_External_Verneed *) + ((bfd_byte *) everneed + iverneed->vn_next)); + } + + free (contents); + contents = NULL; + } + + return true; + + error_return: + if (contents == NULL) + free (contents); + return false; +} + asymbol * _bfd_elf_make_empty_symbol (abfd) bfd *abfd; @@ -3171,6 +3885,36 @@ symbol_info *ret; { bfd_symbol_info (symbol, ret); +} + +/* Return whether a symbol name implies a local symbol. Most targets + use this function for the is_local_label_name entry point, but some + override it. */ + +boolean +_bfd_elf_is_local_label_name (abfd, name) + bfd *abfd; + const char *name; +{ + /* Normal local symbols start with ``.L''. */ + if (name[0] == '.' && name[1] == 'L') + return true; + + /* At least some SVR4 compilers (e.g., UnixWare 2.1 cc) generate + DWARF debugging symbols starting with ``..''. */ + if (name[0] == '.' && name[1] == '.') + return true; + + /* gcc will sometimes generate symbols beginning with ``_.L_'' when + emitting DWARF debugging output. I suspect this is actually a + small bug in gcc (it calls ASM_OUTPUT_LABEL when it should call + ASM_GENERATE_INTERNAL_LABEL, and this causes the leading + underscore to be emitted on some ELF targets). For ease of use, + we treat such symbols as local. */ + if (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_') + return true; + + return false; } alent * diff -urN binutils-2.7/bfd/elf32-d10v.c binutils-2.8/bfd/elf32-d10v.c --- binutils-2.7/bfd/elf32-d10v.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/elf32-d10v.c Wed Apr 30 12:56:01 1997 @@ -0,0 +1,223 @@ +/* D10V-specific support for 32-bit ELF + Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Martin Hunt (hunt@cygnus.com). + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +/* #include "elf/d10v.h" */ + +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void d10v_info_to_howto_rel + PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); + + +/* Use REL instead of RELA to save space */ +#define USE_REL + +enum reloc_type +{ + R_D10V_NONE = 0, + R_D10V_10_PCREL_R, + R_D10V_10_PCREL_L, + R_D10V_16, + R_D10V_18, + R_D10V_18_PCREL, + R_D10V_32, + R_D10V_max +}; + +static reloc_howto_type elf_d10v_howto_table[] = +{ + /* This reloc does nothing. */ + HOWTO (R_D10V_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_NONE", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + false), /* pcrel_offset */ + + /* An PC Relative 10-bit relocation, shifted by 2 */ + /* right container */ + HOWTO (R_D10V_10_PCREL_R, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_10_PCREL_R", /* name */ + false, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + true), /* pcrel_offset */ + + /* An PC Relative 10-bit relocation, shifted by 2 */ + /* left container */ + HOWTO (R_D10V_10_PCREL_L, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + true, /* pc_relative */ + 15, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_10_PCREL_L", /* name */ + false, /* partial_inplace */ + 0x07f8000, /* src_mask */ + 0x07f8000, /* dst_mask */ + true), /* pcrel_offset */ + + /* A 16 bit absolute relocation */ + HOWTO (R_D10V_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_16", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* An 18 bit absolute relocation, right shifted 2 */ + HOWTO (R_D10V_18, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 18, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_18", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* A relative 18 bit relocation, right shifted by 2 */ + HOWTO (R_D10V_18_PCREL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 18, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_18_PCREL", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + true), /* pcrel_offset */ + + /* A 32 bit absolute relocation */ + HOWTO (R_D10V_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_32", /* name */ + false, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ + +}; + +/* Map BFD reloc types to D10V ELF reloc types. */ + +struct d10v_reloc_map +{ + unsigned char bfd_reloc_val; + unsigned char elf_reloc_val; +}; + + static const struct d10v_reloc_map d10v_reloc_map[] = +{ + { BFD_RELOC_NONE, R_D10V_NONE, }, + { BFD_RELOC_D10V_10_PCREL_R, R_D10V_10_PCREL_R }, + { BFD_RELOC_D10V_10_PCREL_L, R_D10V_10_PCREL_L }, + { BFD_RELOC_16, R_D10V_16 }, + { BFD_RELOC_D10V_18, R_D10V_18 }, + { BFD_RELOC_D10V_18_PCREL, R_D10V_18_PCREL }, + { BFD_RELOC_32, R_D10V_32 }, +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; + i < sizeof (d10v_reloc_map) / sizeof (struct d10v_reloc_map); + i++) + { + if (d10v_reloc_map[i].bfd_reloc_val == code) + return &elf_d10v_howto_table[d10v_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an D10V ELF reloc. */ + +static void +d10v_info_to_howto_rel (abfd, cache_ptr, dst) + bfd *abfd; + arelent *cache_ptr; + Elf32_Internal_Rel *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_D10V_max); + cache_ptr->howto = &elf_d10v_howto_table[r_type]; +} + +#define ELF_ARCH bfd_arch_d10v +#define ELF_MACHINE_CODE EM_CYGNUS_D10V +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_d10v_vec +#define TARGET_BIG_NAME "elf32-d10v" + +#define elf_info_to_howto 0 +#define elf_info_to_howto_rel d10v_info_to_howto_rel +#define elf_backend_object_p 0 +#define elf_backend_final_write_processing 0 + +#include "elf32-target.h" diff -urN binutils-2.7/bfd/elf32-hppa.c binutils-2.8/bfd/elf32-hppa.c --- binutils-2.7/bfd/elf32-hppa.c Thu Jul 4 12:18:33 1996 +++ binutils-2.8/bfd/elf32-hppa.c Wed Apr 30 12:56:02 1997 @@ -1,5 +1,6 @@ /* BFD back-end for HP PA-RISC ELF files. - Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. Written by @@ -27,7 +28,6 @@ #include "sysdep.h" #include "bfdlink.h" #include "libbfd.h" -#include "obstack.h" #include "elf-bfd.h" /* The internal type of a symbol table extension entry. */ @@ -234,7 +234,7 @@ static void elf_hppa_tc_make_sections PARAMS ((bfd *, symext_chainS *)); -static boolean hppa_elf_is_local_label PARAMS ((bfd *, asymbol *)); +static boolean hppa_elf_is_local_label_name PARAMS ((bfd *, const char *)); static boolean elf32_hppa_add_symbol_hook PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, @@ -296,7 +296,9 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] = { {R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_NONE"}, - {R_PARISC_DIR32, 0, 0, 32, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DIR32"}, + /* The values in DIR32 are to placate the check in + _bfd_stab_section_find_nearest_line. */ + {R_PARISC_DIR32, 0, 2, 32, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DIR32", false, 0, 0xffffffff, false}, {R_PARISC_DIR21L, 0, 0, 21, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DIR21L"}, {R_PARISC_DIR17R, 0, 0, 17, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DIR17R"}, {R_PARISC_DIR17F, 0, 0, 17, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DIR17F"}, @@ -939,25 +941,26 @@ relocation with modifications based on format and field. */ elf32_hppa_reloc_type ** -hppa_elf_gen_reloc_type (abfd, base_type, format, field, ignore) +hppa_elf_gen_reloc_type (abfd, base_type, format, field, ignore, sym) bfd *abfd; elf32_hppa_reloc_type base_type; int format; int field; int ignore; + asymbol *sym; { elf32_hppa_reloc_type *finaltype; elf32_hppa_reloc_type **final_types; /* Allocate slots for the BFD relocation. */ - final_types = (elf32_hppa_reloc_type **) - bfd_alloc_by_size_t (abfd, sizeof (elf32_hppa_reloc_type *) * 2); + final_types = ((elf32_hppa_reloc_type **) + bfd_alloc (abfd, sizeof (elf32_hppa_reloc_type *) * 2)); if (final_types == NULL) return NULL; /* Allocate space for the relocation itself. */ - finaltype = (elf32_hppa_reloc_type *) - bfd_alloc_by_size_t (abfd, sizeof (elf32_hppa_reloc_type)); + finaltype = ((elf32_hppa_reloc_type *) + bfd_alloc (abfd, sizeof (elf32_hppa_reloc_type))); if (finaltype == NULL) return NULL; @@ -1550,11 +1553,11 @@ /* Return true if SYM represents a local label symbol. */ static boolean -hppa_elf_is_local_label (abfd, sym) +hppa_elf_is_local_label_name (abfd, name) bfd *abfd; - asymbol *sym; + const char *name; { - return (sym->name[0] == 'L' && sym->name[1] == '$'); + return (name[0] == 'L' && name[1] == '$'); } /* Do any backend specific processing when beginning to write an object @@ -2956,7 +2959,7 @@ /* Misc BFD support code. */ #define bfd_elf32_bfd_reloc_type_lookup elf_hppa_reloc_type_lookup -#define bfd_elf32_bfd_is_local_label hppa_elf_is_local_label +#define bfd_elf32_bfd_is_local_label_name hppa_elf_is_local_label_name /* Symbol extension stuff. */ #define bfd_elf32_set_section_contents elf32_hppa_set_section_contents diff -urN binutils-2.7/bfd/elf32-hppa.h binutils-2.8/bfd/elf32-hppa.h --- binutils-2.7/bfd/elf32-hppa.h Thu Jul 4 12:18:33 1996 +++ binutils-2.8/bfd/elf32-hppa.h Wed Apr 30 12:56:02 1997 @@ -141,7 +141,7 @@ #define R_HPPA_COMPLEX R_PARISC_UNIMPLEMENTED elf32_hppa_reloc_type **hppa_elf_gen_reloc_type - PARAMS ((bfd *, elf32_hppa_reloc_type, int, int, int)); + PARAMS ((bfd *, elf32_hppa_reloc_type, int, int, int, asymbol *)); boolean elf32_hppa_size_stubs PARAMS ((bfd *, bfd *, struct bfd_link_info *)); diff -urN binutils-2.7/bfd/elf32-i386.c binutils-2.8/bfd/elf32-i386.c --- binutils-2.7/bfd/elf32-i386.c Thu Jul 4 12:18:34 1996 +++ binutils-2.8/bfd/elf32-i386.c Wed Apr 30 12:56:02 1997 @@ -1,5 +1,5 @@ /* Intel 80386/80486-specific support for 32-bit ELF - Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -29,6 +29,11 @@ PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); static void elf_i386_info_to_howto_rel PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); +static boolean elf_i386_is_local_label_name PARAMS ((bfd *, const char *)); +static struct bfd_hash_entry *elf_i386_link_hash_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static struct bfd_link_hash_table *elf_i386_link_hash_table_create + PARAMS ((bfd *)); static boolean elf_i386_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); @@ -60,6 +65,13 @@ R_386_RELATIVE, R_386_GOTOFF, R_386_GOTPC, + FIRST_INVALID_RELOC, + LAST_INVALID_RELOC = 19, + /* The remaining relocs are a GNU extension. */ + R_386_16 = 20, + R_386_PC16, + R_386_8, + R_386_PC8, R_386_max }; @@ -93,6 +105,20 @@ HOWTO(R_386_RELATIVE, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_RELATIVE", true,0xffffffff,0xffffffff,false), HOWTO(R_386_GOTOFF, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTOFF", true,0xffffffff,0xffffffff,false), HOWTO(R_386_GOTPC, 0,2,32,true,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTPC", true,0xffffffff,0xffffffff,true), + { 11 }, + { 12 }, + { 13 }, + { 14 }, + { 15 }, + { 16 }, + { 17 }, + { 18 }, + { 19 }, + /* The remaining relocs are a GNU extension. */ + HOWTO(R_386_16, 0,1,16,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_16", true,0xffff,0xffff,false), + HOWTO(R_386_PC16, 0,1,16,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC16", true,0xffff,0xffff,true), + HOWTO(R_386_8, 0,0,8,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_8", true,0xff,0xff,false), + HOWTO(R_386_PC8, 0,0,8,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC8", true,0xff,0xff,true), }; #ifdef DEBUG_GEN_RELOC @@ -152,6 +178,23 @@ TRACE ("BFD_RELOC_386_GOTPC"); return &elf_howto_table[ (int)R_386_GOTPC ]; + /* The remaining relocs are a GNU extension. */ + case BFD_RELOC_16: + TRACE ("BFD_RELOC_16"); + return &elf_howto_table[(int) R_386_16]; + + case BFD_RELOC_16_PCREL: + TRACE ("BFD_RELOC_16_PCREL"); + return &elf_howto_table[(int) R_386_PC16]; + + case BFD_RELOC_8: + TRACE ("BFD_RELOC_8"); + return &elf_howto_table[(int) R_386_8]; + + case BFD_RELOC_8_PCREL: + TRACE ("BFD_RELOC_8_PCREL"); + return &elf_howto_table[(int) R_386_PC8]; + default: break; } @@ -166,20 +209,39 @@ arelent *cache_ptr; Elf32_Internal_Rela *dst; { - BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_386_max); - - cache_ptr->howto = &elf_howto_table[ELF32_R_TYPE(dst->r_info)]; + abort (); } static void elf_i386_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; + bfd *abfd; + arelent *cache_ptr; Elf32_Internal_Rel *dst; { - BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_386_max); + enum reloc_type type; + + type = (enum reloc_type) ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (type < R_386_max); + BFD_ASSERT (type < FIRST_INVALID_RELOC || type > LAST_INVALID_RELOC); - cache_ptr->howto = &elf_howto_table[ELF32_R_TYPE(dst->r_info)]; + cache_ptr->howto = &elf_howto_table[(int) type]; +} + +/* Return whether a symbol name implies a local label. The UnixWare + 2.1 cc generates temporary symbols that start with .X, so we + recognize them here. FIXME: do other SVR4 compilers also use .X?. + If so, we should move the .X recognition into + _bfd_elf_is_local_label_name. */ + +static boolean +elf_i386_is_local_label_name (abfd, name) + bfd *abfd; + const char *name; +{ + if (name[0] == '.' && name[1] == 'X') + return true; + + return _bfd_elf_is_local_label_name (abfd, name); } /* Functions for the i386 ELF linker. */ @@ -222,8 +284,8 @@ static const bfd_byte elf_i386_pic_plt0_entry[PLT_ENTRY_SIZE] = { - 0xff, 0xb3, 4, 0, 0, 0, /* pushl 4(%ebx) */ - 0xff, 0xa3, 8, 0, 0, 0, /* jmp *8(%ebx) */ + 0xff, 0xb3, 4, 0, 0, 0, /* pushl 4(%ebx) */ + 0xff, 0xa3, 8, 0, 0, 0, /* jmp *8(%ebx) */ 0, 0, 0, 0 /* pad out to 16 bytes. */ }; @@ -239,6 +301,115 @@ 0, 0, 0, 0 /* replaced with offset to start of .plt. */ }; +/* The i386 linker needs to keep track of the number of relocs that it + decides to copy in check_relocs for each symbol. This is so that + it can discard PC relative relocs if it doesn't need them when + linking with -Bsymbolic. We store the information in a field + extending the regular ELF linker hash table. */ + +/* This structure keeps track of the number of PC relative relocs we + have copied for a given symbol. */ + +struct elf_i386_pcrel_relocs_copied +{ + /* Next section. */ + struct elf_i386_pcrel_relocs_copied *next; + /* A section in dynobj. */ + asection *section; + /* Number of relocs copied in this section. */ + bfd_size_type count; +}; + +/* i386 ELF linker hash entry. */ + +struct elf_i386_link_hash_entry +{ + struct elf_link_hash_entry root; + + /* Number of PC relative relocs copied for this symbol. */ + struct elf_i386_pcrel_relocs_copied *pcrel_relocs_copied; +}; + +/* i386 ELF linker hash table. */ + +struct elf_i386_link_hash_table +{ + struct elf_link_hash_table root; +}; + +/* Declare this now that the above structures are defined. */ + +static boolean elf_i386_discard_copies + PARAMS ((struct elf_i386_link_hash_entry *, PTR)); + +/* Traverse an i386 ELF linker hash table. */ + +#define elf_i386_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ + (info))) + +/* Get the i386 ELF linker hash table from a link_info structure. */ + +#define elf_i386_hash_table(p) \ + ((struct elf_i386_link_hash_table *) ((p)->hash)) + +/* Create an entry in an i386 ELF linker hash table. */ + +static struct bfd_hash_entry * +elf_i386_link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct elf_i386_link_hash_entry *ret = + (struct elf_i386_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct elf_i386_link_hash_entry *) NULL) + ret = ((struct elf_i386_link_hash_entry *) + bfd_hash_allocate (table, + sizeof (struct elf_i386_link_hash_entry))); + if (ret == (struct elf_i386_link_hash_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf_i386_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != (struct elf_i386_link_hash_entry *) NULL) + { + ret->pcrel_relocs_copied = NULL; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create an i386 ELF linker hash table. */ + +static struct bfd_link_hash_table * +elf_i386_link_hash_table_create (abfd) + bfd *abfd; +{ + struct elf_i386_link_hash_table *ret; + + ret = ((struct elf_i386_link_hash_table *) + bfd_alloc (abfd, sizeof (struct elf_i386_link_hash_table))); + if (ret == (struct elf_i386_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + elf_i386_link_hash_newfunc)) + { + bfd_release (abfd, ret); + return NULL; + } + + return &ret->root.root; +} + /* Look through the relocs for a section during the first phase, and allocate space in the global offset table or procedure linkage table. */ @@ -307,7 +478,7 @@ { case R_386_GOT32: /* This symbol requires a global offset table entry. */ - + if (sgot == NULL) { sgot = bfd_get_section_by_name (dynobj, ".got"); @@ -327,6 +498,7 @@ | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY)) || ! bfd_set_section_alignment (dynobj, srelgot, 2)) return false; @@ -407,9 +579,24 @@ case R_386_32: case R_386_PC32: + /* If we are creating a shared library, and this is a reloc + against a global symbol, or a non PC relative reloc + against a local symbol, then we need to copy the reloc + into the shared library. However, if we are linking with + -Bsymbolic, we do not need to copy a reloc against a + global symbol which is defined in an object we are + including in the link (i.e., DEF_REGULAR is set). At + this point we have not seen all the input files, so it is + possible that DEF_REGULAR is not set now but will be set + later (it is never cleared). We account for that + possibility below by storing information in the + pcrel_relocs_copied field of the hash table entry. */ if (info->shared - && (sec->flags & SEC_ALLOC) != 0 - && (ELF32_R_TYPE (rel->r_info) != R_386_PC32 || h != NULL)) + && (ELF32_R_TYPE (rel->r_info) != R_386_PC32 + || (h != NULL + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) { /* When creating a shared object, we must copy these reloc types into the output file. We create a reloc @@ -432,22 +619,58 @@ sreloc = bfd_get_section_by_name (dynobj, name); if (sreloc == NULL) { + flagword flags; + sreloc = bfd_make_section (dynobj, name); + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0) + flags |= SEC_ALLOC | SEC_LOAD; if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_READONLY)) + || ! bfd_set_section_flags (dynobj, sreloc, flags) || ! bfd_set_section_alignment (dynobj, sreloc, 2)) return false; } } sreloc->_raw_size += sizeof (Elf32_External_Rel); + + /* If we are linking with -Bsymbolic, and this is a + global symbol, we count the number of PC relative + relocations we have entered for this symbol, so that + we can discard them again if the symbol is later + defined by a regular object. Note that this function + is only called if we are using an elf_i386 linker + hash table, which means that h is really a pointer to + an elf_i386_link_hash_entry. */ + if (h != NULL && info->symbolic + && ELF32_R_TYPE (rel->r_info) == R_386_PC32) + { + struct elf_i386_link_hash_entry *eh; + struct elf_i386_pcrel_relocs_copied *p; + + eh = (struct elf_i386_link_hash_entry *) h; + + for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) + if (p->section == sreloc) + break; + + if (p == NULL) + { + p = ((struct elf_i386_pcrel_relocs_copied *) + bfd_alloc (dynobj, sizeof *p)); + if (p == NULL) + return false; + p->next = eh->pcrel_relocs_copied; + eh->pcrel_relocs_copied = p; + p->section = sreloc; + p->count = 0; + } + + ++p->count; + } } - + break; default: @@ -588,14 +811,11 @@ s = bfd_get_section_by_name (dynobj, ".dynbss"); BFD_ASSERT (s != NULL); - /* If the symbol is currently defined in the .bss section of the - dynamic object, then it is OK to simply initialize it to zero. - If the symbol is in some other section, we must generate a - R_386_COPY reloc to tell the dynamic linker to copy the initial - value out of the dynamic object and into the runtime process - image. We need to remember the offset into the .rel.bss section - we are going to use. */ - if ((h->root.u.def.section->flags & SEC_LOAD) != 0) + /* We must generate a R_386_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rel.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { asection *srel; @@ -669,6 +889,15 @@ s->_raw_size = 0; } + /* If this is a -Bsymbolic shared link, then we need to discard all + PC relative relocs against symbols defined in a regular object. + We allocated space for them in the check_relocs routine, but we + will not fill them in in the relocate_section routine. */ + if (info->shared && info->symbolic) + elf_i386_link_hash_traverse (elf_i386_hash_table (info), + elf_i386_discard_copies, + (PTR) NULL); + /* The check_relocs and adjust_dynamic_symbol entry points have determined the sizes of the various dynamic sections. Allocate memory for them. */ @@ -680,7 +909,7 @@ const char *name; boolean strip; - if ((s->flags & SEC_IN_MEMORY) == 0) + if ((s->flags & SEC_LINKER_CREATED) == 0) continue; /* It's OK to base decisions on the section name, because none @@ -726,6 +955,8 @@ than .rel.plt. */ if (strcmp (name, ".rel.plt") != 0) { + const char *outname; + relocs = true; /* If this relocation section applies to a read only @@ -733,7 +964,9 @@ entry. The entries in the .rel.plt section really apply to the .got section, which we created ourselves and so know is not readonly. */ - target = bfd_get_section_by_name (output_bfd, name + 4); + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 4); if (target != NULL && (target->flags & SEC_READONLY) != 0) reltext = true; @@ -769,7 +1002,7 @@ if (s->contents == NULL && s->_raw_size != 0) return false; } - + if (elf_hash_table (info)->dynamic_sections_created) { /* Add some entries to the .dynamic section. We fill in the @@ -811,6 +1044,31 @@ return true; } +/* This function is called via elf_i386_link_hash_traverse if we are + creating a shared object with -Bsymbolic. It discards the space + allocated to copy PC relative relocs against symbols which are + defined in regular objects. We allocated space for them in the + check_relocs routine, but we won't fill them in in the + relocate_section routine. */ + +/*ARGSUSED*/ +static boolean +elf_i386_discard_copies (h, ignore) + struct elf_i386_link_hash_entry *h; + PTR ignore; +{ + struct elf_i386_pcrel_relocs_copied *s; + + /* We only discard relocs for symbols defined in a regular object. */ + if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + return true; + + for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) + s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel); + + return true; +} + /* Relocate an i386 ELF section. */ static boolean @@ -858,7 +1116,10 @@ bfd_reloc_status_type r; r_type = ELF32_R_TYPE (rel->r_info); - if (r_type < 0 || r_type >= (int) R_386_max) + if (r_type < 0 + || r_type >= (int) R_386_max + || (r_type >= (int) FIRST_INVALID_RELOC + && r_type <= (int) LAST_INVALID_RELOC)) { bfd_set_error (bfd_error_bad_value); return false; @@ -926,14 +1187,21 @@ || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) && (r_type == R_386_32 - || r_type == R_386_PC32) - && (input_section->flags & SEC_ALLOC) != 0)) + || r_type == R_386_PC32))) { /* In these cases, we don't need the relocation value. We check specially because in some obscure cases sec->output_section will be NULL. */ relocation = 0; } + else if (sec->output_section == NULL) + { + (*_bfd_error_handler) + ("%s: warning: unresolvable relocation against symbol `%s' from %s section", + bfd_get_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + relocation = 0; + } else relocation = (h->root.u.def.value + sec->output_section->vma @@ -1108,7 +1376,6 @@ case R_386_32: case R_386_PC32: if (info->shared - && (input_section->flags & SEC_ALLOC) != 0 && (r_type != R_386_PC32 || (h != NULL && (! info->symbolic @@ -1116,7 +1383,7 @@ & ELF_LINK_HASH_DEF_REGULAR) == 0)))) { Elf_Internal_Rel outrel; - boolean relocate; + boolean skip, relocate; /* When generating a shared object, these relocations are copied into the output file to be resolved at run @@ -1142,10 +1409,33 @@ BFD_ASSERT (sreloc != NULL); } - outrel.r_offset = (rel->r_offset - + input_section->output_section->vma - + input_section->output_offset); - if (r_type == R_386_PC32) + skip = false; + + if (elf_section_data (input_section)->stab_info == NULL) + outrel.r_offset = rel->r_offset; + else + { + bfd_vma off; + + off = (_bfd_stab_section_offset + (output_bfd, &elf_hash_table (info)->stab_info, + input_section, + &elf_section_data (input_section)->stab_info, + rel->r_offset)); + if (off == (bfd_vma) -1) + skip = true; + outrel.r_offset = off; + } + + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + { + memset (&outrel, 0, sizeof outrel); + relocate = false; + } + else if (r_type == R_386_PC32) { BFD_ASSERT (h != NULL && h->dynindx != -1); relocate = false; @@ -1153,8 +1443,10 @@ } else { + /* h->dynindx may be -1 if this symbol was marked to + become local. */ if (h == NULL - || (info->symbolic + || ((info->symbolic || h->dynindx == -1) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)) { @@ -1330,7 +1622,7 @@ /* This symbol has an entry in the global offset table. Set it up. */ - + BFD_ASSERT (h->dynindx != -1); sgot = bfd_get_section_by_name (dynobj, ".got"); @@ -1523,12 +1815,16 @@ #define TARGET_LITTLE_NAME "elf32-i386" #define ELF_ARCH bfd_arch_i386 #define ELF_MACHINE_CODE EM_386 +#define ELF_MAXPAGESIZE 0x1000 #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_bfd_reloc_type_lookup elf_i386_reloc_type_lookup -#define ELF_MAXPAGESIZE 0x1000 +#define bfd_elf32_bfd_is_local_label_name \ + elf_i386_is_local_label_name #define elf_backend_create_dynamic_sections \ _bfd_elf_create_dynamic_sections +#define bfd_elf32_bfd_link_hash_table_create \ + elf_i386_link_hash_table_create #define elf_backend_check_relocs elf_i386_check_relocs #define elf_backend_adjust_dynamic_symbol \ elf_i386_adjust_dynamic_symbol diff -urN binutils-2.7/bfd/elf32-m32r.c binutils-2.8/bfd/elf32-m32r.c --- binutils-2.7/bfd/elf32-m32r.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/elf32-m32r.c Wed Apr 30 12:56:03 1997 @@ -0,0 +1,1758 @@ +/* M32R-specific support for 32-bit ELF. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/m32r.h" + +static bfd_reloc_status_type m32r_elf_10_pcrel_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type m32r_elf_do_10_pcrel_reloc + PARAMS ((bfd *, reloc_howto_type *, asection *, + bfd_byte *, bfd_vma, asection *, bfd_vma, bfd_vma)); +static bfd_reloc_status_type m32r_elf_hi16_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static void m32r_elf_relocate_hi16 + PARAMS ((bfd *, int, Elf_Internal_Rela *, Elf_Internal_Rela *, + bfd_byte *, bfd_vma)); +bfd_reloc_status_type m32r_elf_lo16_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type m32r_elf_sda16_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void m32r_info_to_howto_rel + PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); +boolean _bfd_m32r_elf_section_from_bfd_section + PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *)); +void _bfd_m32r_elf_symbol_processing + PARAMS ((bfd *, asymbol *)); +static boolean m32r_elf_add_symbol_hook + PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + const char **, flagword *, asection **, bfd_vma *)); +static boolean m32r_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +#if 0 /* not yet */ +static boolean m32r_elf_relax_delete_bytes + PARAMS ((bfd *, asection *, bfd_vma, int)); +#endif + +/* Use REL instead of RELA to save space. + This only saves space in libraries and object files, but perhaps + relocs will be put in ROM? All in all though, REL relocs are a pain + to work with. */ +#define USE_REL + +static reloc_howto_type m32r_elf_howto_table[] = +{ + /* This reloc does nothing. */ + HOWTO (R_M32R_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_NONE", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + false), /* pcrel_offset */ + + /* A 16 bit absolute relocation. */ + HOWTO (R_M32R_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_16", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* A 32 bit absolute relocation. */ + HOWTO (R_M32R_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_32", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* A 24 bit address. */ + HOWTO (R_M32R_24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_24", /* name */ + true, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* An PC Relative 10-bit relocation, shifted by 2. + This reloc is complicated because relocations are relative to pc & -4. + i.e. branches in the right insn slot use the address of the left insn + slot for pc. */ + /* ??? It's not clear whether this should have partial_inplace set or not. + Branch relaxing in the assembler can store the addend in the insn, + and if bfd_install_relocation gets called the addend may get added + again. */ + HOWTO (R_M32R_10_PCREL, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + m32r_elf_10_pcrel_reloc, /* special_function */ + "R_M32R_10_PCREL", /* name */ + false, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + true), /* pcrel_offset */ + + /* A relative 18 bit relocation, right shifted by 2. */ + HOWTO (R_M32R_18_PCREL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 18, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_18_PCREL", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + true), /* pcrel_offset */ + + /* A relative 26 bit relocation, right shifted by 2. */ + /* ??? It's not clear whether this should have partial_inplace set or not. + Branch relaxing in the assembler can store the addend in the insn, + and if bfd_install_relocation gets called the addend may get added + again. */ + HOWTO (R_M32R_26_PCREL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_26_PCREL", /* name */ + false, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + true), /* pcrel_offset */ + + /* High 16 bits of address when lower 16 is or'd in. */ + HOWTO (R_M32R_HI16_ULO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m32r_elf_hi16_reloc, /* special_function */ + "R_M32R_HI16_ULO", /* name */ + true, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* High 16 bits of address when lower 16 is added in. */ + HOWTO (R_M32R_HI16_SLO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m32r_elf_hi16_reloc, /* special_function */ + "R_M32R_HI16_SLO", /* name */ + true, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* Lower 16 bits of address. */ + HOWTO (R_M32R_LO16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m32r_elf_lo16_reloc, /* special_function */ + "R_M32R_LO16", /* name */ + true, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* Small data area 16 bits offset. */ + HOWTO (R_M32R_SDA16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + m32r_elf_sda16_reloc, /* special_function */ + "R_M32R_SDA16", /* name */ + true, /* partial_inplace */ /* FIXME: correct? */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + false), /* pcrel_offset */ +}; + +/* Handle the R_M32R_10_PCREL reloc. */ + +static bfd_reloc_status_type +m32r_elf_10_pcrel_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + /* This part is from bfd_elf_generic_reloc. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (output_bfd != NULL) + { + /* FIXME: See bfd_perform_relocation. Is this right? */ + return bfd_reloc_continue; + } + + return m32r_elf_do_10_pcrel_reloc (abfd, reloc_entry->howto, + input_section, + data, reloc_entry->address, + symbol->section, + (symbol->value + + symbol->section->output_section->vma + + symbol->section->output_offset), + reloc_entry->addend); +} + +/* Utility to actually perform an R_M32R_10_PCREL reloc. */ + +static bfd_reloc_status_type +m32r_elf_do_10_pcrel_reloc (abfd, howto, input_section, data, offset, + symbol_section, symbol_value, addend) + bfd *abfd; + reloc_howto_type *howto; + asection *input_section; + bfd_byte *data; + bfd_vma offset; + asection *symbol_section; + bfd_vma symbol_value; + bfd_vma addend; +{ + bfd_signed_vma relocation; + unsigned long x; + bfd_reloc_status_type status; + + /* Sanity check the address (offset in section). */ + if (offset > input_section->_cooked_size) + return bfd_reloc_outofrange; + + relocation = symbol_value + addend; + /* Make it pc relative. */ + relocation -= (input_section->output_section->vma + + input_section->output_offset); + /* These jumps mask off the lower two bits of the current address + before doing pcrel calculations. */ + relocation -= (offset & -4L); + + if (relocation < -0x200 || relocation > 0x1ff) + status = bfd_reloc_overflow; + else + status = bfd_reloc_ok; + + x = bfd_get_16 (abfd, data + offset); + relocation >>= howto->rightshift; + relocation <<= howto->bitpos; + x = (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask); + bfd_put_16 (abfd, x, data + offset); + + return status; +} + +/* Handle the R_M32R_HI16_[SU]LO relocs. + HI16_SLO is for the add3 and load/store with displacement instructions. + HI16_ULO is for the or3 instruction. + For R_M32R_HI16_SLO, the lower 16 bits are sign extended when added to + the high 16 bytes so if the lower 16 bits are negative (bit 15 == 1) then + we must add one to the high 16 bytes (which will get subtracted off when + the low 16 bits are added). + These relocs have to be done in combination with an R_M32R_LO16 reloc + because there is a carry from the LO16 to the HI16. Here we just save + the information we need; we do the actual relocation when we see the LO16. + This code is copied from the elf32-mips.c. We also support an arbitrary + number of HI16 relocs to be associated with a single LO16 reloc. The + assembler sorts the relocs to ensure each HI16 immediately precedes its + LO16. However if there are multiple copies, the assembler may not find + the real LO16 so it picks the first one it finds. */ + +struct m32r_hi16 +{ + struct m32r_hi16 *next; + bfd_byte *addr; + bfd_vma addend; +}; + +/* FIXME: This should not be a static variable. */ + +static struct m32r_hi16 *m32r_hi16_list; + +static bfd_reloc_status_type +m32r_elf_hi16_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_reloc_status_type ret; + bfd_vma relocation; + struct m32r_hi16 *n; + + /* This part is from bfd_elf_generic_reloc. + If we're relocating, and this an external symbol, we don't want + to change anything. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && reloc_entry->addend == 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Sanity check the address (offset in section). */ + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + ret = bfd_reloc_ok; + if (bfd_is_und_section (symbol->section) + && output_bfd == (bfd *) NULL) + ret = bfd_reloc_undefined; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + + /* Save the information, and let LO16 do the actual relocation. */ + n = (struct m32r_hi16 *) bfd_malloc (sizeof *n); + if (n == NULL) + return bfd_reloc_outofrange; + n->addr = (bfd_byte *) data + reloc_entry->address; + n->addend = relocation; + n->next = m32r_hi16_list; + m32r_hi16_list = n; + + if (output_bfd != (bfd *) NULL) + reloc_entry->address += input_section->output_offset; + + return ret; +} + +/* Handle an M32R ELF HI16 reloc. */ + +static void +m32r_elf_relocate_hi16 (input_bfd, type, relhi, rello, contents, addend) + bfd *input_bfd; + int type; + Elf_Internal_Rela *relhi; + Elf_Internal_Rela *rello; + bfd_byte *contents; + bfd_vma addend; +{ + unsigned long insn; + bfd_vma addlo; + + insn = bfd_get_32 (input_bfd, contents + relhi->r_offset); + + addlo = bfd_get_32 (input_bfd, contents + rello->r_offset); + if (type == R_M32R_HI16_SLO) + addlo = ((addlo & 0xffff) ^ 0x8000) - 0x8000; + else + addlo &= 0xffff; + + addend += ((insn & 0xffff) << 16) + addlo; + + /* Reaccount for sign extension of low part. */ + if (type == R_M32R_HI16_SLO + && (addend & 0x8000) != 0) + addend += 0x10000; + + bfd_put_32 (input_bfd, + (insn & 0xffff0000) | ((addend >> 16) & 0xffff), + contents + relhi->r_offset); +} + +/* Do an R_M32R_LO16 relocation. This is a straightforward 16 bit + inplace relocation; this function exists in order to do the + R_M32R_HI16_[SU]LO relocation described above. */ + +bfd_reloc_status_type +m32r_elf_lo16_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + if (m32r_hi16_list != NULL) + { + struct m32r_hi16 *l; + + l = m32r_hi16_list; + while (l != NULL) + { + unsigned long insn; + unsigned long val; + unsigned long vallo; + struct m32r_hi16 *next; + + /* Do the HI16 relocation. Note that we actually don't need + to know anything about the LO16 itself, except where to + find the low 16 bits of the addend needed by the LO16. */ + insn = bfd_get_32 (abfd, l->addr); + vallo = ((bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) + & 0xffff) ^ 0x8000) - 0x8000; + val = ((insn & 0xffff) << 16) + vallo; + val += l->addend; + + /* Reaccount for sign extension of low part. */ + if ((val & 0x8000) != 0) + val += 0x10000; + + insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); + bfd_put_32 (abfd, insn, l->addr); + + next = l->next; + free (l); + l = next; + } + + m32r_hi16_list = NULL; + } + + /* Now do the LO16 reloc in the usual way. */ + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); +} + +/* Handle the R_M32R_SDA16 reloc. + This reloc is used to compute the address of objects in the small data area + and to perform loads and stores from that area. + The lower 16 bits are sign extended and added to the register specified + in the instruction, which is assumed to point to _SDA_BASE_. */ + +static bfd_reloc_status_type +m32r_elf_sda16_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_vma sda_base; + unsigned long x; + reloc_howto_type *howto; + + /* This part is from bfd_elf_generic_reloc. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (output_bfd != NULL) + { + /* FIXME: See bfd_perform_relocation. Is this right? */ + return bfd_reloc_continue; + } + + /* FIXME: not sure what to do here yet. But then again, the linker + may never call us. */ + abort (); +} + +/* Map BFD reloc types to M32R ELF reloc types. */ + +struct m32r_reloc_map +{ + unsigned char bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct m32r_reloc_map m32r_reloc_map[] = +{ + { BFD_RELOC_NONE, R_M32R_NONE }, + { BFD_RELOC_16, R_M32R_16 }, + { BFD_RELOC_32, R_M32R_32 }, + { BFD_RELOC_M32R_24, R_M32R_24 }, + { BFD_RELOC_M32R_10_PCREL, R_M32R_10_PCREL }, + { BFD_RELOC_M32R_18_PCREL, R_M32R_18_PCREL }, + { BFD_RELOC_M32R_26_PCREL, R_M32R_26_PCREL }, + { BFD_RELOC_M32R_HI16_ULO, R_M32R_HI16_ULO }, + { BFD_RELOC_M32R_HI16_SLO, R_M32R_HI16_SLO }, + { BFD_RELOC_M32R_LO16, R_M32R_LO16 }, + { BFD_RELOC_M32R_SDA16, R_M32R_SDA16 }, +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; + i < sizeof (m32r_reloc_map) / sizeof (struct m32r_reloc_map); + i++) + { + if (m32r_reloc_map[i].bfd_reloc_val == code) + return &m32r_elf_howto_table[m32r_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an M32R ELF reloc. */ + +static void +m32r_info_to_howto_rel (abfd, cache_ptr, dst) + bfd *abfd; + arelent *cache_ptr; + Elf32_Internal_Rel *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_M32R_max); + cache_ptr->howto = &m32r_elf_howto_table[r_type]; +} + +/* Given a BFD section, try to locate the corresponding ELF section + index. */ + +boolean +_bfd_m32r_elf_section_from_bfd_section (abfd, hdr, sec, retval) + bfd *abfd; + Elf32_Internal_Shdr *hdr; + asection *sec; + int *retval; +{ + if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) + { + *retval = SHN_M32R_SCOMMON; + return true; + } + return false; +} + +/* M32R ELF uses two common sections. One is the usual one, and the other + is for small objects. All the small objects are kept together, and then + referenced via one register, which yields faster assembler code. It is + up to the compiler to emit an instruction to load the register with + _SDA_BASE. This is what we use for the small common section. This + approach is copied from elf32-mips.c. */ +static asection m32r_elf_scom_section; +static asymbol m32r_elf_scom_symbol; +static asymbol *m32r_elf_scom_symbol_ptr; + +/* Handle the special M32R section numbers that a symbol may use. */ + +void +_bfd_m32r_elf_symbol_processing (abfd, asym) + bfd *abfd; + asymbol *asym; +{ + elf_symbol_type *elfsym; + + elfsym = (elf_symbol_type *) asym; + + switch (elfsym->internal_elf_sym.st_shndx) + { + case SHN_M32R_SCOMMON: + if (m32r_elf_scom_section.name == NULL) + { + /* Initialize the small common section. */ + m32r_elf_scom_section.name = ".scommon"; + m32r_elf_scom_section.flags = SEC_IS_COMMON; + m32r_elf_scom_section.output_section = &m32r_elf_scom_section; + m32r_elf_scom_section.symbol = &m32r_elf_scom_symbol; + m32r_elf_scom_section.symbol_ptr_ptr = &m32r_elf_scom_symbol_ptr; + m32r_elf_scom_symbol.name = ".scommon"; + m32r_elf_scom_symbol.flags = BSF_SECTION_SYM; + m32r_elf_scom_symbol.section = &m32r_elf_scom_section; + m32r_elf_scom_symbol_ptr = &m32r_elf_scom_symbol; + } + asym->section = &m32r_elf_scom_section; + asym->value = elfsym->internal_elf_sym.st_size; + break; + } +} + +/* Hook called by the linker routine which adds symbols from an object + file. We must handle the special M32R section numbers here. + We also keep watching for whether we need to create the sdata special + linker sections. */ + +static boolean +m32r_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) + bfd *abfd; + struct bfd_link_info *info; + const Elf_Internal_Sym *sym; + const char **namep; + flagword *flagsp; + asection **secp; + bfd_vma *valp; +{ + if (! info->relocateable + && (*namep)[0] == '_' && (*namep)[1] == 'S' + && strcmp (*namep, "_SDA_BASE_") == 0) + { + /* This is simpler than using _bfd_elf_create_linker_section + (our needs are simpler than ppc's needs). Also + _bfd_elf_create_linker_section currently has a bug where if a .sdata + section already exists a new one is created that follows it which + screws of _SDA_BASE_ address calcs because output_offset != 0. */ + struct elf_link_hash_entry *h; + asection *s = bfd_get_section_by_name (abfd, ".sdata"); + + /* The following code was cobbled from elf32-ppc.c and elflink.c. */ + + if (s == NULL) + { + int flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + + s = bfd_make_section_anyway (abfd, ".sdata"); + if (s == NULL) + return false; + bfd_set_section_flags (abfd, s, flags); + bfd_set_section_alignment (abfd, s, 2); + } + + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (info->hash, "_SDA_BASE_", false, false, false); + + if ((h == NULL || h->root.type == bfd_link_hash_undefined) + && !(_bfd_generic_link_add_one_symbol (info, + abfd, + "_SDA_BASE_", + BSF_GLOBAL, + s, + 32768, + (const char *) NULL, + false, + get_elf_backend_data (abfd)->collect, + (struct bfd_link_hash_entry **) &h))) + return false; + h->type = STT_OBJECT; + } + + switch (sym->st_shndx) + { + case SHN_M32R_SCOMMON: + *secp = bfd_make_section_old_way (abfd, ".scommon"); + (*secp)->flags |= SEC_IS_COMMON; + *valp = sym->st_size; + break; + } + + return true; +} + +/* We have to figure out the SDA_BASE value, so that we can adjust the + symbol value correctly. We look up the symbol _SDA_BASE_ in the output + BFD. If we can't find it, we're stuck. We cache it in the ELF + target data. We don't need to adjust the symbol value for an + external symbol if we are producing relocateable output. */ + +static bfd_reloc_status_type +m32r_elf_final_sda_base (output_bfd, info, error_message, psb) + bfd *output_bfd; + struct bfd_link_info *info; + const char **error_message; + bfd_vma *psb; +{ + if (elf_gp (output_bfd) == 0) + { + struct bfd_link_hash_entry *h; + + h = bfd_link_hash_lookup (info->hash, "_SDA_BASE_", false, false, true); + if (h != (struct bfd_link_hash_entry *) NULL + && h->type == bfd_link_hash_defined) + elf_gp (output_bfd) = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + else + { + /* Only get the error once. */ + *psb = elf_gp (output_bfd) = 4; + *error_message = + (const char *) "SDA relocation when _SDA_BASE_ not defined"; + return bfd_reloc_dangerous; + } + } + *psb = elf_gp (output_bfd); + return bfd_reloc_ok; +} + +/* Relocate an M32R/D ELF section. + There is some attempt to make this function usable for many architectures, + both USE_REL and USE_RELA ['twould be nice if such a critter existed], + if only to serve as a learning tool. + + The RELOCATE_SECTION function is called by the new ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjust the section contents as + necessary, and (if using Rela relocs and generating a + relocateable output file) adjusting the reloc addend as + necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocateable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ + +static boolean +m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd); + Elf_Internal_Rela *rel, *relend; + bfd *dynobj = elf_hash_table (info)->dynobj; + /* Assume success. */ + boolean ret = true; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + /* We can't modify r_addend here as elf_link_input_bfd has an assert to + ensure it's zero (we use REL relocs, not RELA). Therefore this + should be assigning zero to `addend', but for clarity we use + `r_addend'. */ + bfd_vma addend = rel->r_addend; + bfd_vma offset = rel->r_offset; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sec; + const char *sym_name; + bfd_reloc_status_type r; + const char *errmsg = NULL; + + r_type = ELF32_R_TYPE (rel->r_info); + if (r_type < 0 || r_type >= (int) R_M32R_max) + { + (*_bfd_error_handler) ("%s: unknown relocation type %d", + bfd_get_filename (input_bfd), + (int) r_type); + bfd_set_error (bfd_error_bad_value); + ret = false; + continue; + } + + howto = m32r_elf_howto_table + r_type; + r_symndx = ELF32_R_SYM (rel->r_info); + + if (info->relocateable) + { + /* This is a relocateable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + sec = NULL; + if (r_symndx >= symtab_hdr->sh_info) + { + /* External symbol. */ + continue; + } + + /* Local symbol. */ + sym = local_syms + r_symndx; + sym_name = ""; + /* STT_SECTION: symbol is associated with a section. */ + if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) + { + /* Symbol isn't associated with a section. Nothing to do. */ + continue; + } + + sec = local_sections[r_symndx]; + addend += sec->output_offset + sym->st_value; +#ifndef USE_REL + /* This can't be done for USE_REL because it doesn't mean anything + and elf_link_input_bfd asserts this stays zero. */ + rel->r_addend = addend; +#endif + +#ifndef USE_REL + /* Addends are stored with relocs. We're done. */ + continue; +#else /* USE_REL */ + /* If partial_inplace, we need to store any additional addend + back in the section. */ + if (! howto->partial_inplace) + continue; + /* ??? Here is a nice place to call a special_function + like handler. */ + if (r_type != R_M32R_HI16_SLO && r_type != R_M32R_HI16_ULO) + r = _bfd_relocate_contents (howto, input_bfd, + addend, contents + offset); + else + { + Elf_Internal_Rela *lorel; + + /* We allow an arbitrary number of HI16 relocs before the + LO16 reloc. This permits gcc to emit the HI and LO relocs + itself. */ + for (lorel = rel + 1; + (lorel < relend + && (ELF32_R_TYPE (lorel->r_info) == R_M32R_HI16_SLO + || ELF32_R_TYPE (lorel->r_info) == R_M32R_HI16_ULO)); + lorel++) + continue; + if (lorel < relend + && ELF32_R_TYPE (lorel->r_info) == R_M32R_LO16) + { + m32r_elf_relocate_hi16 (input_bfd, r_type, rel, lorel, + contents, addend); + r = bfd_reloc_ok; + } + else + r = _bfd_relocate_contents (howto, input_bfd, + addend, contents + offset); + } +#endif /* USE_REL */ + } + else + { + bfd_vma relocation; + + /* This is a final link. */ + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + /* Local symbol. */ + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + sym_name = ""; + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + } + else + { + /* External symbol. */ + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + sym_name = h->root.root.string; + + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + if (sec->output_section == NULL) + relocation = 0; + else + relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else if (h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, offset))) + return false; + relocation = 0; + } + } + + /* Sanity check the address. */ + if (offset > input_section->_raw_size) + { + r = bfd_reloc_outofrange; + goto check_reloc; + } + + switch ((int) r_type) + { + case (int) R_M32R_10_PCREL : + r = m32r_elf_do_10_pcrel_reloc (input_bfd, howto, input_section, + contents, offset, + sec, relocation, addend); + break; + + case (int) R_M32R_HI16_SLO : + case (int) R_M32R_HI16_ULO : + { + Elf_Internal_Rela *lorel; + + /* We allow an arbitrary number of HI16 relocs before the + LO16 reloc. This permits gcc to emit the HI and LO relocs + itself. */ + for (lorel = rel + 1; + (lorel < relend + && (ELF32_R_TYPE (lorel->r_info) == R_M32R_HI16_SLO + || ELF32_R_TYPE (lorel->r_info) == R_M32R_HI16_ULO)); + lorel++) + continue; + if (lorel < relend + && ELF32_R_TYPE (lorel->r_info) == R_M32R_LO16) + { + m32r_elf_relocate_hi16 (input_bfd, r_type, rel, lorel, + contents, relocation + addend); + r = bfd_reloc_ok; + } + else + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, offset, + relocation, addend); + } + break; + + case (int) R_M32R_SDA16 : + { + const char *name; + + BFD_ASSERT (sec != NULL); + name = bfd_get_section_name (abfd, sec); + + if (strcmp (name, ".sdata") == 0 + || strcmp (name, ".sbss") == 0 + || strcmp (name, ".scommon") == 0) + { + bfd_vma sda_base; + bfd *out_bfd = sec->output_section->owner; + + r = m32r_elf_final_sda_base (out_bfd, info, + &errmsg, + &sda_base); + if (r != bfd_reloc_ok) + { + ret = false; + goto check_reloc; + } + + /* At this point `relocation' contains the object's + address. */ + relocation -= sda_base; + /* Now it contains the offset from _SDA_BASE_. */ + } + else + { + (*_bfd_error_handler) ("%s: The target (%s) of an %s relocation is in the wrong section (%s)", + bfd_get_filename (input_bfd), + sym_name, + m32r_elf_howto_table[(int) r_type].name, + bfd_get_section_name (abfd, sec)); + /*bfd_set_error (bfd_error_bad_value); ??? why? */ + ret = false; + continue; + } + } + /* fall through */ + + default : + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, offset, + relocation, addend); + break; + } + } + + check_reloc: + + if (r != bfd_reloc_ok) + { + /* FIXME: This should be generic enough to go in a utility. */ + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL || *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + if (errmsg != NULL) + goto common_error; + + switch (r) + { + case bfd_reloc_overflow: + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, offset))) + return false; + break; + + case bfd_reloc_undefined: + if (! ((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + offset))) + return false; + break; + + case bfd_reloc_outofrange: + errmsg = "internal error: out of range error"; + goto common_error; + + case bfd_reloc_notsupported: + errmsg = "internal error: unsupported relocation error"; + goto common_error; + + case bfd_reloc_dangerous: + errmsg = "internal error: dangerous error"; + goto common_error; + + default: + errmsg = "internal error: unknown error"; + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, errmsg, name, input_bfd, input_section, + offset))) + return false; + break; + } + } + } + + return ret; +} + +#if 0 /* relaxing not supported yet */ + +/* This function handles relaxing for the m32r. + Relaxing on the m32r is tricky because of instruction alignment + requirements (4 byte instructions must be aligned on 4 byte boundaries). + + The following relaxing opportunities are handled: + + seth/add3/jl -> bl24 or bl8 + seth/add3 -> ld24 + + It would be nice to handle bl24 -> bl8 but given: + + - 4 byte insns must be on 4 byte boundaries + - branch instructions only branch to insns on 4 byte boundaries + + this isn't much of a win because the insn in the 2 "deleted" bytes + must become a nop. With some complexity some real relaxation could be + done but the frequency just wouldn't make it worth it; it's better to + try to do all the code compaction one can elsewhere. + When the chip supports parallel 16 bit insns, things may change. +*/ + +static boolean +m32r_elf_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + boolean *again; +{ + Elf_Internal_Shdr *symtab_hdr; + /* The Rela structures are used here because that's what + _bfd_elf32_link_read_relocs uses [for convenience - it sets the addend + field to 0]. */ + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *free_relocs = NULL; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + bfd_byte *free_contents = NULL; + Elf32_External_Sym *extsyms = NULL; + Elf32_External_Sym *free_extsyms = NULL; + + /* Assume nothing changes. */ + *again = false; + + /* We don't have to do anything for a relocateable link, if + this section does not have relocs, or if this is not a + code section. */ + if (link_info->relocateable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0 + || (sec->flags & SEC_CODE) == 0 + || 0 /* FIXME: check SHF_M32R_CAN_RELAX */) + 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; + + /* Get a copy of the native relocations. */ + internal_relocs = (_bfd_elf32_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + if (! link_info->keep_memory) + free_relocs = internal_relocs; + + /* Walk through them looking for relaxing opportunities. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + + /* If this isn't something that can be relaxed, then ignore + this reloc. */ + if (ELF32_R_TYPE (irel->r_info) != (int) R_M32R_HI16_SLO) + continue; + + /* Get the section contents if we haven't done so already. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + /* Go get them off disk. */ + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + free_contents = contents; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* Read the local symbols if we haven't done so already. */ + if (extsyms == NULL) + { + /* Get cached copy if it exists. */ + if (symtab_hdr->contents != NULL) + extsyms = (Elf32_External_Sym *) symtab_hdr->contents; + else + { + /* Go get them off disk. */ + extsyms = ((Elf32_External_Sym *) + bfd_malloc (symtab_hdr->sh_info + * sizeof (Elf32_External_Sym))); + if (extsyms == NULL) + goto error_return; + free_extsyms = extsyms; + if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_read (extsyms, sizeof (Elf32_External_Sym), + symtab_hdr->sh_info, abfd) + != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) + goto error_return; + } + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + Elf_Internal_Sym isym; + asection *sym_sec; + + /* A local symbol. */ + bfd_elf32_swap_symbol_in (abfd, + extsyms + ELF32_R_SYM (irel->r_info), + &isym); + + sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx); + symval = (isym.st_value + + sym_sec->output_section->vma + + sym_sec->output_offset); + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + /* An external symbol. */ + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + { + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + } + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + + /* Try to change a seth/add3/jl subroutine call to bl24 or bl8. + This sequence is generated by the compiler when compiling in + 32 bit mode. Also look for seth/add3 -> ld24. */ + + if (ELF32_R_TYPE (irel->r_info) == (int) R_M32R_HI16_SLO) + { + Elf_Internal_Rela *nrel; + bfd_vma pc = (sec->output_section->vma + sec->output_offset + + irel->r_offset); + bfd_signed_vma pcrel_value = symval - pc; + unsigned int code,reg; + int addend,nop_p,bl8_p,to_delete; + + /* The tests are ordered so that we get out as quickly as possible + if this isn't something we can relax, taking into account that + we are looking for two separate possibilities (jl/ld24). */ + + /* Do nothing if no room in the section for this to be what we're + looking for. */ + if (irel->r_offset > sec->_cooked_size - 8) + continue; + + /* Make sure the next relocation applies to the next + instruction and that it's the add3's reloc. */ + nrel = irel + 1; + if (nrel == irelend + || irel->r_offset + 4 != nrel->r_offset + || ELF32_R_TYPE (nrel->r_info) != (int) R_M32R_LO16) + continue; + + /* See if the instructions are seth/add3. */ + /* FIXME: This is where macros from cgen can come in. */ + code = bfd_get_16 (abfd, contents + irel->r_offset + 0); + if ((code & 0xf0ff) != 0xd0c0) + continue; /* not seth rN,foo */ + reg = (code & 0x0f00) >> 8; + code = bfd_get_16 (abfd, contents + irel->r_offset + 4); + if (code != (0x80a0 | reg | (reg << 8))) + continue; /* not add3 rN,rN,foo */ + + /* At this point we've confirmed we have seth/add3. Now check + whether the next insn is a jl, in which case try to change this + to bl24 or bl8. */ + + /* Ensure the branch target is in range. + The bl24 instruction has a 24 bit operand which is the target + address right shifted by 2, giving a signed range of 26 bits. + Note that 4 bytes are added to the high value because the target + will be at least 4 bytes closer if we can relax. It'll actually + be 4 or 8 bytes closer, but we don't know which just yet and + the difference isn't significant enough to worry about. */ +#ifndef USE_REL /* put in for learning purposes */ + pcrel_value += irel->r_addend; +#else + addend = bfd_get_signed_16 (abfd, contents + irel->r_offset + 2); + pcrel_value += addend; +#endif + + if (pcrel_value >= -(1 << 25) && pcrel_value < (1 << 25) + 4 + /* Do nothing if no room in the section for this to be what we're + looking for. */ + && (irel->r_offset <= sec->_cooked_size - 12) + /* Ensure the next insn is "jl rN". */ + && ((code = bfd_get_16 (abfd, contents + irel->r_offset + 8)), + code != (0x1ec0 | reg))) + { + /* We can relax to bl24/bl8. */ + + /* See if there's a nop following the jl. + Also see if we can use a bl8 insn. */ + code = bfd_get_16 (abfd, contents + irel->r_offset + 10); + nop_p = (code & 0x7fff) == 7000; + bl8_p = pcrel_value >= -0x200 && pcrel_value < 0x200; + + if (bl8_p) + { + /* Change "seth rN,foo" to "bl8 foo || nop". + We OR in CODE just in case it's not a nop (technically, + CODE currently must be a nop, but for cleanness we + allow it to be anything). */ +#ifndef USE_REL /* put in for learning purposes */ + code = 0x7e000000 | code; +#else + code = (0x7e000000 + (((addend >> 2) & 0xff) << 16)) | code; +#endif + to_delete = 8; + } + else + { + /* Change the seth rN,foo to a bl24 foo. */ +#ifndef USE_REL /* put in for learning purposes */ + code = 0xfe000000; +#else + code = 0xfe000000 + ((addend >> 2) & 0xffffff); +#endif + to_delete = nop_p ? 8 : 4; + } + + bfd_put_32 (abfd, code, contents + irel->r_offset); + + /* Set the new reloc type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (nrel->r_info), + bl8_p ? R_M32R_10_PCREL : R_M32R_26_PCREL); + + /* Delete the add3 reloc by making it a null reloc. */ + nrel->r_info = ELF32_R_INFO (ELF32_R_SYM (nrel->r_info), + R_M32R_NONE); + } + else if (addend >= 0 + && symval + addend <= 0xffffff) + { + /* We can relax to ld24. */ + + code = 0xe0000000 | (reg << 24) | (addend & 0xffffff); + bfd_put_32 (abfd, code, contents + irel->r_offset); + to_delete = 4; + /* Tell the following code a nop filler isn't needed. */ + nop_p = 1; + } + else + { + /* Can't do anything here. */ + continue; + } + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* Delete TO_DELETE bytes of data. */ + if (!m32r_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 4, to_delete)) + goto error_return; + + /* Now that the following bytes have been moved into place, see if + we need to replace the jl with a nop. This happens when we had + to use a bl24 insn and the insn following the jl isn't a nop. + Technically, this situation can't happen (since the insn can + never be executed) but to be clean we do this. When the chip + supports parallel 16 bit insns things may change. + We don't need to do this in the case of relaxing to ld24, + and the above code sets nop_p so this isn't done. */ + if (! nop_p && to_delete == 4) + bfd_put_16 (abfd, 0x7000, contents + irel->r_offset + 4); + + /* That will change things, so we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + + continue; + } + + /* loop to try the next reloc */ + } + + if (free_relocs != NULL) + { + free (free_relocs); + free_relocs = NULL; + } + + if (free_contents != NULL) + { + if (! link_info->keep_memory) + free (free_contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + free_contents = NULL; + } + + if (free_extsyms != NULL) + { + if (! link_info->keep_memory) + free (free_extsyms); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = extsyms; + } + free_extsyms = NULL; + } + + return true; + + error_return: + if (free_relocs != NULL) + free (free_relocs); + if (free_contents != NULL) + free (free_contents); + if (free_extsyms != NULL) + free (free_extsyms); + return false; +} + +/* Delete some bytes from a section while relaxing. */ + +static boolean +m32r_elf_relax_delete_bytes (abfd, sec, addr, count) + bfd *abfd; + asection *sec; + bfd_vma addr; + int count; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf32_External_Sym *extsyms; + int shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Rela *irelalign; + bfd_vma toaddr; + Elf32_External_Sym *esym, *esymend; + struct elf_link_hash_entry **sym_hash, **sym_hash_end; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + extsyms = (Elf32_External_Sym *) symtab_hdr->contents; + + shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + /* The deletion must stop at the next ALIGN reloc for an aligment + power larger than the number of bytes we are deleting. */ + + irelalign = NULL; + toaddr = sec->_cooked_size; + + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, toaddr - addr - count); + sec->_cooked_size -= count; + + /* Adjust all the relocs. */ + for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + { + /* Get the new reloc address. */ + if ((irel->r_offset > addr + && irel->r_offset < toaddr)) + irel->r_offset -= count; + } + + /* Adjust all the symbols. */ + esym = extsyms; + esymend = esym + symtab_hdr->sh_info; + for (; esym < esymend; esym++) + { + Elf_Internal_Sym isym; + + bfd_elf32_swap_symbol_in (abfd, esym, &isym); + + if (isym.st_shndx == shndx + && isym.st_value > addr + && isym.st_value < toaddr) + { + isym.st_value -= count; + bfd_elf32_swap_symbol_out (abfd, &isym, esym); + } + } + + sym_hash = elf_sym_hashes (abfd); + sym_hash_end = (sym_hash + + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info)); + for (; sym_hash < sym_hash_end; sym_hash++) + { + if (((*sym_hash)->root.type == bfd_link_hash_defined + || (*sym_hash)->root.type == bfd_link_hash_defweak) + && (*sym_hash)->root.u.def.section == sec + && (*sym_hash)->root.u.def.value > addr + && (*sym_hash)->root.u.def.value < toaddr) + { + (*sym_hash)->root.u.def.value -= count; + } + } + + return true; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + which uses m32r_elf_relocate_section. */ + +static bfd_byte * +m32r_elf_get_relocated_section_contents (output_bfd, link_info, link_order, + data, relocateable, symbols) + bfd *output_bfd; + struct bfd_link_info *link_info; + struct bfd_link_order *link_order; + bfd_byte *data; + boolean relocateable; + asymbol **symbols; +{ + Elf_Internal_Shdr *symtab_hdr; + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf32_External_Sym *external_syms = NULL; + Elf_Internal_Sym *internal_syms = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocateable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocateable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + Elf_Internal_Sym *isymp; + asection **secpp; + Elf32_External_Sym *esym, *esymend; + + if (symtab_hdr->contents != NULL) + external_syms = (Elf32_External_Sym *) symtab_hdr->contents; + else + { + external_syms = ((Elf32_External_Sym *) + bfd_malloc (symtab_hdr->sh_info + * sizeof (Elf32_External_Sym))); + if (external_syms == NULL && symtab_hdr->sh_info > 0) + goto error_return; + if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_read (external_syms, sizeof (Elf32_External_Sym), + symtab_hdr->sh_info, input_bfd) + != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) + goto error_return; + } + + internal_relocs = (_bfd_elf32_link_read_relocs + (input_bfd, input_section, (PTR) NULL, + (Elf_Internal_Rela *) NULL, false)); + if (internal_relocs == NULL) + goto error_return; + + internal_syms = ((Elf_Internal_Sym *) + bfd_malloc (symtab_hdr->sh_info + * sizeof (Elf_Internal_Sym))); + if (internal_syms == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + sections = (asection **) bfd_malloc (symtab_hdr->sh_info + * sizeof (asection *)); + if (sections == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + isymp = internal_syms; + secpp = sections; + esym = external_syms; + esymend = esym + symtab_hdr->sh_info; + for (; esym < esymend; ++esym, ++isymp, ++secpp) + { + asection *isec; + + bfd_elf32_swap_symbol_in (input_bfd, esym, isymp); + + if (isymp->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isymp->st_shndx > 0 && isymp->st_shndx < SHN_LORESERVE) + isec = bfd_section_from_elf_index (input_bfd, isymp->st_shndx); + else if (isymp->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isymp->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else if (isymp->st_shndx == SHN_M32R_SCOMMON) + isec = &m32r_elf_scom_section; + else + { + /* Who knows? */ + isec = NULL; + } + + *secpp = isec; + } + + if (! m32r_elf_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + internal_syms, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + sections = NULL; + if (internal_syms != NULL) + free (internal_syms); + internal_syms = NULL; + if (external_syms != NULL && symtab_hdr->contents == NULL) + free (external_syms); + external_syms = NULL; + if (internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + internal_relocs = NULL; + } + + return data; + + error_return: + if (internal_relocs != NULL + && internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + if (external_syms != NULL && symtab_hdr->contents == NULL) + free (external_syms); + if (internal_syms != NULL) + free (internal_syms); + if (sections != NULL) + free (sections); + return NULL; +} + +#endif /* #if 0 */ + +#define ELF_ARCH bfd_arch_m32r +#define ELF_MACHINE_CODE EM_CYGNUS_M32R +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_m32r_vec +#define TARGET_BIG_NAME "elf32-m32r" + +#define elf_info_to_howto 0 +#define elf_info_to_howto_rel m32r_info_to_howto_rel +#define elf_backend_object_p 0 +#define elf_backend_section_from_bfd_section _bfd_m32r_elf_section_from_bfd_section +#define elf_backend_symbol_processing _bfd_m32r_elf_symbol_processing +#define elf_backend_add_symbol_hook m32r_elf_add_symbol_hook +#define elf_backend_relocate_section m32r_elf_relocate_section +#define elf_backend_final_write_processing 0 + +#if 0 /* not yet */ +/* relax support */ +#define bfd_elf32_bfd_relax_section m32r_elf_relax_section +#define bfd_elf32_bfd_get_relocated_section_contents \ + m32r_elf_get_relocated_section_contents +#endif + +#include "elf32-target.h" diff -urN binutils-2.7/bfd/elf32-m68k.c binutils-2.8/bfd/elf32-m68k.c --- binutils-2.7/bfd/elf32-m68k.c Thu Jul 4 12:18:35 1996 +++ binutils-2.8/bfd/elf32-m68k.c Wed Apr 30 12:56:03 1997 @@ -1,5 +1,5 @@ /* Motorola 68k series support for 32-bit ELF - Copyright 1993, 1995, 1996 Free Software Foundation, Inc. + Copyright 1993, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -29,6 +29,10 @@ PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); static void rtype_to_howto_rel PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); +static struct bfd_hash_entry *elf_m68k_link_hash_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static struct bfd_link_hash_table *elf_m68k_link_hash_table_create + PARAMS ((bfd *)); static boolean elf_m68k_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); @@ -205,6 +209,115 @@ 0, 0, 0, 0 /* replaced with offset to start of .plt. */ }; +/* The m68k linker needs to keep track of the number of relocs that it + decides to copy in check_relocs for each symbol. This is so that it + can discard PC relative relocs if it doesn't need them when linking + with -Bsymbolic. We store the information in a field extending the + regular ELF linker hash table. */ + +/* This structure keeps track of the number of PC relative relocs we have + copied for a given symbol. */ + +struct elf_m68k_pcrel_relocs_copied +{ + /* Next section. */ + struct elf_m68k_pcrel_relocs_copied *next; + /* A section in dynobj. */ + asection *section; + /* Number of relocs copied in this section. */ + bfd_size_type count; +}; + +/* m68k ELF linker hash entry. */ + +struct elf_m68k_link_hash_entry +{ + struct elf_link_hash_entry root; + + /* Number of PC relative relocs copied for this symbol. */ + struct elf_m68k_pcrel_relocs_copied *pcrel_relocs_copied; +}; + +/* m68k ELF linker hash table. */ + +struct elf_m68k_link_hash_table +{ + struct elf_link_hash_table root; +}; + +/* Declare this now that the above structures are defined. */ + +static boolean elf_m68k_discard_copies + PARAMS ((struct elf_m68k_link_hash_entry *, PTR)); + +/* Traverse an m68k ELF linker hash table. */ + +#define elf_m68k_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ + (info))) + +/* Get the m68k ELF linker hash table from a link_info structure. */ + +#define elf_m68k_hash_table(p) \ + ((struct elf_m68k_link_hash_table *) (p)->hash) + +/* Create an entry in an m68k ELF linker hash table. */ + +static struct bfd_hash_entry * +elf_m68k_link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct elf_m68k_link_hash_entry *ret = + (struct elf_m68k_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct elf_m68k_link_hash_entry *) NULL) + ret = ((struct elf_m68k_link_hash_entry *) + bfd_hash_allocate (table, + sizeof (struct elf_m68k_link_hash_entry))); + if (ret == (struct elf_m68k_link_hash_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf_m68k_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != (struct elf_m68k_link_hash_entry *) NULL) + { + ret->pcrel_relocs_copied = NULL; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create an m68k ELF linker hash table. */ + +static struct bfd_link_hash_table * +elf_m68k_link_hash_table_create (abfd) + bfd *abfd; +{ + struct elf_m68k_link_hash_table *ret; + + ret = ((struct elf_m68k_link_hash_table *) + bfd_alloc (abfd, sizeof (struct elf_m68k_link_hash_table))); + if (ret == (struct elf_m68k_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + elf_m68k_link_hash_newfunc)) + { + bfd_release (abfd, ret); + return NULL; + } + + return &ret->root.root; +} + /* Look through the relocs for a section during the first phase, and allocate space in the global offset table or procedure linkage table. */ @@ -292,6 +405,7 @@ | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY)) || !bfd_set_section_alignment (dynobj, srelgot, 2)) return false; @@ -397,20 +511,31 @@ case R_68K_PC8: case R_68K_PC16: case R_68K_PC32: - if (h == NULL) + /* If we are creating a shared library and this is not a local + symbol, we need to copy the reloc into the shared library. + However when linking with -Bsymbolic and this is a global + symbol which is defined in an object we are including in the + link (i.e., DEF_REGULAR is set), then we can resolve the + reloc directly. At this point we have not seen all the input + files, so it is possible that DEF_REGULAR is not set now but + will be set later (it is never cleared). We account for that + possibility below by storing information in the + pcrel_relocs_copied field of the hash table entry. */ + if (!(info->shared + && (sec->flags & SEC_ALLOC) != 0 + && h != NULL + && (!info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) break; /* Fall through. */ case R_68K_8: case R_68K_16: case R_68K_32: + /* If we are creating a shared library, we need to copy the + reloc into the shared library. */ if (info->shared - && (sec->flags & SEC_ALLOC) != 0 - && ((ELF32_R_TYPE (rel->r_info) != R_68K_PC8 - && ELF32_R_TYPE (rel->r_info) != R_68K_PC16 - && ELF32_R_TYPE (rel->r_info) != R_68K_PC32) - || (!info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) + && (sec->flags & SEC_ALLOC) != 0) { /* When creating a shared object, we must copy these reloc types into the output file. We create a reloc @@ -440,6 +565,7 @@ | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY)) || !bfd_set_section_alignment (dynobj, sreloc, 2)) return false; @@ -447,6 +573,42 @@ } sreloc->_raw_size += sizeof (Elf32_External_Rela); + + /* If we are linking with -Bsymbolic, we count the number of + PC relative relocations we have entered for this symbol, + so that we can discard them again if the symbol is later + defined by a regular object. Note that this function is + only called if we are using an m68kelf linker hash table, + which means that h is really a pointer to an + elf_m68k_link_hash_entry. */ + if ((ELF32_R_TYPE (rel->r_info) == R_68K_PC8 + || ELF32_R_TYPE (rel->r_info) == R_68K_PC16 + || ELF32_R_TYPE (rel->r_info) == R_68K_PC32) + && info->symbolic) + { + struct elf_m68k_link_hash_entry *eh; + struct elf_m68k_pcrel_relocs_copied *p; + + eh = (struct elf_m68k_link_hash_entry *) h; + + for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) + if (p->section == sreloc) + break; + + if (p == NULL) + { + p = ((struct elf_m68k_pcrel_relocs_copied *) + bfd_alloc (dynobj, sizeof *p)); + if (p == NULL) + return false; + p->next = eh->pcrel_relocs_copied; + eh->pcrel_relocs_copied = p; + p->section = sreloc; + p->count = 0; + } + + ++p->count; + } } break; @@ -593,14 +755,11 @@ s = bfd_get_section_by_name (dynobj, ".dynbss"); BFD_ASSERT (s != NULL); - /* If the symbol is currently defined in the .bss section of the - dynamic object, then it is OK to simply initialize it to zero. - If the symbol is in some other section, we must generate a - R_68K_COPY reloc to tell the dynamic linker to copy the initial - value out of the dynamic object and into the runtime process - image. We need to remember the offset into the .rela.bss section - we are going to use. */ - if ((h->root.u.def.section->flags & SEC_LOAD) != 0) + /* We must generate a R_68K_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { asection *srel; @@ -674,6 +833,15 @@ s->_raw_size = 0; } + /* If this is a -Bsymbolic shared link, then we need to discard all PC + relative relocs against symbols defined in a regular object. We + allocated space for them in the check_relocs routine, but we will not + fill them in in the relocate_section routine. */ + if (info->shared && info->symbolic) + elf_m68k_link_hash_traverse (elf_m68k_hash_table (info), + elf_m68k_discard_copies, + (PTR) NULL); + /* The check_relocs and adjust_dynamic_symbol entry points have determined the sizes of the various dynamic sections. Allocate memory for them. */ @@ -685,7 +853,7 @@ const char *name; boolean strip; - if ((s->flags & SEC_IN_MEMORY) == 0) + if ((s->flags & SEC_LINKER_CREATED) == 0) continue; /* It's OK to base decisions on the section name, because none @@ -731,13 +899,17 @@ than .rela.plt. */ if (strcmp (name, ".rela.plt") != 0) { + const char *outname; + relocs = true; /* If this relocation section applies to a read only section, then we probably need a DT_TEXTREL entry. .rela.plt is actually associated with .got.plt, which is never readonly. */ - target = bfd_get_section_by_name (output_bfd, name + 5); + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 5); if (target != NULL && (target->flags & SEC_READONLY) != 0) reltext = true; @@ -815,6 +987,30 @@ return true; } +/* This function is called via elf_m68k_link_hash_traverse if we are + creating a shared object with -Bsymbolic. It discards the space + allocated to copy PC relative relocs against symbols which are defined + in regular objects. We allocated space for them in the check_relocs + routine, but we won't fill them in in the relocate_section routine. */ + +/*ARGSUSED*/ +static boolean +elf_m68k_discard_copies (h, ignore) + struct elf_m68k_link_hash_entry *h; + PTR ignore; +{ + struct elf_m68k_pcrel_relocs_copied *s; + + /* We only discard relocs for symbols defined in a regular object. */ + if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + return true; + + for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) + s->section->_raw_size -= s->count * sizeof (Elf32_External_Rela); + + return true; +} + /* Relocate an M68K ELF section. */ static boolean @@ -987,7 +1183,7 @@ { bfd_vma off; - + if (sgot == NULL) { sgot = bfd_get_section_by_name (dynobj, ".got"); @@ -1147,7 +1343,7 @@ & ELF_LINK_HASH_DEF_REGULAR) == 0))) { Elf_Internal_Rela outrel; - int relocate; + boolean skip, relocate; /* When generating a shared object, these relocations are copied into the output file to be resolved at run @@ -1173,13 +1369,38 @@ BFD_ASSERT (sreloc != NULL); } - outrel.r_offset = (rel->r_offset - + input_section->output_section->vma - + input_section->output_offset); - if (h != NULL - && (! info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) + skip = false; + + if (elf_section_data (input_section)->stab_info == NULL) + outrel.r_offset = rel->r_offset; + else + { + bfd_vma off; + + off = (_bfd_stab_section_offset + (output_bfd, &elf_hash_table (info)->stab_info, + input_section, + &elf_section_data (input_section)->stab_info, + rel->r_offset)); + if (off == (bfd_vma) -1) + skip = true; + outrel.r_offset = off; + } + + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + { + memset (&outrel, 0, sizeof outrel); + relocate = false; + } + /* h->dynindx may be -1 if the symbol was marked to + become local. */ + else if (h != NULL + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) { BFD_ASSERT (h->dynindx != -1); relocate = false; @@ -1385,7 +1606,7 @@ /* This symbol has an entry in the global offset table. Set it up. */ - + BFD_ASSERT (h->dynindx != -1); sgot = bfd_get_section_by_name (dynobj, ".got"); @@ -1583,6 +1804,8 @@ #define ELF_MAXPAGESIZE 0x2000 #define elf_backend_create_dynamic_sections \ _bfd_elf_create_dynamic_sections +#define bfd_elf32_bfd_link_hash_table_create \ + elf_m68k_link_hash_table_create #define elf_backend_check_relocs elf_m68k_check_relocs #define elf_backend_adjust_dynamic_symbol \ elf_m68k_adjust_dynamic_symbol diff -urN binutils-2.7/bfd/elf32-mips.c binutils-2.8/bfd/elf32-mips.c --- binutils-2.7/bfd/elf32-mips.c Tue Jul 9 12:25:30 1996 +++ binutils-2.8/bfd/elf32-mips.c Wed Apr 30 12:56:03 1997 @@ -1,5 +1,5 @@ /* MIPS-specific support for 32-bit ELF - Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Most of the information added by Ian Lance Taylor, Cygnus Support, . @@ -41,6 +41,8 @@ #define ECOFF_32 #include "ecoffswap.h" +static bfd_reloc_status_type mips32_64bit_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); static void mips_info_to_howto_rel @@ -56,12 +58,13 @@ struct ecoff_debug_info *)); static int mips_elf_additional_program_headers PARAMS ((bfd *)); static boolean mips_elf_modify_segment_map PARAMS ((bfd *)); +static INLINE int elf_mips_isa PARAMS ((flagword)); static boolean mips_elf32_section_from_shdr PARAMS ((bfd *, Elf32_Internal_Shdr *, char *)); static boolean mips_elf32_section_processing PARAMS ((bfd *, Elf32_Internal_Shdr *)); -static boolean mips_elf_is_local_label - PARAMS ((bfd *, asymbol *)); +static boolean mips_elf_is_local_label_name + PARAMS ((bfd *, const char *)); static struct bfd_hash_entry *mips_elf_link_hash_newfunc PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); static struct bfd_link_hash_table *mips_elf_link_hash_table_create @@ -72,16 +75,23 @@ static void mips_elf_relocate_hi16 PARAMS ((bfd *, Elf_Internal_Rela *, Elf_Internal_Rela *, bfd_byte *, bfd_vma)); -static void mips_elf_relocate_got_local +static boolean mips_elf_relocate_got_local PARAMS ((bfd *, bfd *, asection *, Elf_Internal_Rela *, Elf_Internal_Rela *, bfd_byte *, bfd_vma)); static void mips_elf_relocate_global_got PARAMS ((bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma)); +static bfd_reloc_status_type mips16_jump_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type mips16_gprel_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static boolean mips_elf_adjust_dynindx PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean mips_elf_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static boolean mips_elf_link_output_symbol_hook + PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *)); static boolean mips_elf_create_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static boolean mips_elf_create_compact_rel_section @@ -93,6 +103,8 @@ const Elf_Internal_Rela *)); static boolean mips_elf_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static boolean mips_elf_always_size_sections + PARAMS ((bfd *, struct bfd_link_info *)); static boolean mips_elf_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static boolean mips_elf_finish_dynamic_symbol @@ -124,6 +136,8 @@ unsigned long global_gotsym; /* The number of local .got entries. */ unsigned int local_gotno; + /* The number of local .got entries we have used. */ + unsigned int assigned_gotno; }; /* The number of local .got entries we reserve. */ @@ -295,7 +309,10 @@ R_MIPS_INSERT_B, R_MIPS_DELETE, R_MIPS_HIGHER, R_MIPS_HIGHEST, R_MIPS_CALL_HI16, R_MIPS_CALL_LO16, - R_MIPS_max + R_MIPS_max, + /* These relocs are used for the mips16. */ + R_MIPS16_26 = 100, + R_MIPS16_GPREL = 101 }; static reloc_howto_type elf_mips_howto_table[] = @@ -537,8 +554,23 @@ 0x000007c4, /* dst_mask */ false), /* pcrel_offset */ - /* A 64 bit relocation. Presumably not used in 32 bit ELF. */ - { R_MIPS_64 }, + /* A 64 bit relocation. This is used in 32 bit ELF when addresses + are 64 bits long; the upper 32 bits are simply a sign extension. + The fields of the howto should be the same as for R_MIPS_32, + other than the type, name, and special_function. */ + HOWTO (R_MIPS_64, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + mips32_64bit_reloc, /* special_function */ + "R_MIPS_64", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ /* Displacement in the global offset table. */ /* FIXME: Not handled correctly. */ @@ -666,6 +698,61 @@ false) /* pcrel_offset */ }; +/* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This + is a hack to make the linker think that we need 64 bit values. */ +static reloc_howto_type elf_mips_ctor64_howto = + HOWTO (R_MIPS_64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + mips32_64bit_reloc, /* special_function */ + "R_MIPS_64", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false); /* pcrel_offset */ + +/* The reloc used for the mips16 jump instruction. */ +static reloc_howto_type elf_mips16_jump_howto = + HOWTO (R_MIPS16_26, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + /* This needs complex overflow + detection, because the upper four + bits must match the PC. */ + mips16_jump_reloc, /* special_function */ + "R_MIPS16_26", /* name */ + true, /* partial_inplace */ + 0x3ffffff, /* src_mask */ + 0x3ffffff, /* dst_mask */ + false); /* pcrel_offset */ + +/* The reloc used for the mips16 gprel instruction. The src_mask and + dsk_mask for this howto do not reflect the actual instruction, in + which the value is not contiguous; the masks are for the + convenience of the relocate_section routine. */ +static reloc_howto_type elf_mips16_gprel_howto = + HOWTO (R_MIPS16_GPREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mips16_gprel_reloc, /* special_function */ + "R_MIPS16_GPREL", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false); /* pcrel_offset */ + /* Do a R_MIPS_HI16 relocation. This has to be done in combination with a R_MIPS_LO16 reloc, because there is a carry from the LO16 to the HI16. Here we just save the information we need; we do the @@ -1225,6 +1312,184 @@ return bfd_reloc_ok; } +/* Handle a 64 bit reloc in a 32 bit MIPS ELF file. These are + generated when addreses are 64 bits. The upper 32 bits are a simle + sign extension. */ + +static bfd_reloc_status_type +mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_reloc_status_type r; + arelent reloc32; + unsigned long val; + bfd_size_type addr; + + r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + if (r != bfd_reloc_continue) + return r; + + /* Do a normal 32 bit relocation on the lower 32 bits. */ + reloc32 = *reloc_entry; + if (bfd_big_endian (abfd)) + reloc32.address += 4; + reloc32.howto = &elf_mips_howto_table[R_MIPS_32]; + r = bfd_perform_relocation (abfd, &reloc32, data, input_section, + output_bfd, error_message); + + /* Sign extend into the upper 32 bits. */ + val = bfd_get_32 (abfd, (bfd_byte *) data + reloc32.address); + if ((val & 0x80000000) != 0) + val = 0xffffffff; + else + val = 0; + addr = reloc_entry->address; + if (bfd_little_endian (abfd)) + addr += 4; + bfd_put_32 (abfd, val, (bfd_byte *) data + addr); + + return r; +} + +/* Handle a mips16 jump. */ + +static bfd_reloc_status_type +mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && reloc_entry->addend == 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* FIXME. */ + { + static boolean warned; + + if (! warned) + (*_bfd_error_handler) + ("Linking mips16 objects into %s format is not supported", + bfd_get_target (input_section->output_section->owner)); + warned = true; + } + + return bfd_reloc_undefined; +} + +/* Handle a mips16 GP relative reloc. */ + +static bfd_reloc_status_type +mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + boolean relocateable; + bfd_reloc_status_type ret; + bfd_vma gp; + unsigned short extend, insn; + unsigned long final; + + /* If we're relocating, and this is an external symbol with no + addend, we don't want to change anything. We will only have an + addend if this is a newly created reloc, not read from an ELF + file. */ + if (output_bfd != NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && reloc_entry->addend == 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (output_bfd != NULL) + relocateable = true; + else + { + relocateable = false; + output_bfd = symbol->section->output_section->owner; + } + + ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, + &gp); + if (ret != bfd_reloc_ok) + return ret; + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + /* Pick up the mips16 extend instruction and the real instruction. */ + extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); + insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2); + + /* Stuff the current addend back as a 32 bit value, do the usual + relocation, and then clean up. */ + bfd_put_32 (abfd, + (((extend & 0x1f) << 11) + | (extend & 0x7e0) + | (insn & 0x1f)), + (bfd_byte *) data + reloc_entry->address); + + ret = gprel16_with_gp (abfd, symbol, reloc_entry, input_section, + relocateable, data, gp); + + final = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); + bfd_put_16 (abfd, + ((extend & 0xf800) + | ((final >> 11) & 0x1f) + | (final & 0x7e0)), + (bfd_byte *) data + reloc_entry->address); + bfd_put_16 (abfd, + ((insn & 0xffe0) + | (final & 0x1f)), + (bfd_byte *) data + reloc_entry->address + 2); + + return ret; +} + +/* Return the ISA for a MIPS e_flags value. */ + +static INLINE int +elf_mips_isa (flags) + flagword flags; +{ + switch (flags & EF_MIPS_ARCH) + { + case E_MIPS_ARCH_1: + return 1; + case E_MIPS_ARCH_2: + return 2; + case E_MIPS_ARCH_3: + return 3; + case E_MIPS_ARCH_4: + return 4; + } + return 4; +} + /* A mapping from BFD reloc types to MIPS ELF reloc types. */ struct elf_reloc_map { @@ -1237,8 +1502,7 @@ { BFD_RELOC_NONE, R_MIPS_NONE, }, { BFD_RELOC_16, R_MIPS_16 }, { BFD_RELOC_32, R_MIPS_32 }, - { BFD_RELOC_CTOR, R_MIPS_32 }, - { BFD_RELOC_32_PCREL, R_MIPS_REL32 }, + { BFD_RELOC_64, R_MIPS_64 }, { BFD_RELOC_MIPS_JMP, R_MIPS_26 }, { BFD_RELOC_HI16_S, R_MIPS_HI16 }, { BFD_RELOC_LO16, R_MIPS_LO16 }, @@ -1268,6 +1532,25 @@ if (mips_reloc_map[i].bfd_reloc_val == code) return &elf_mips_howto_table[(int) mips_reloc_map[i].elf_reloc_val]; } + + /* We need to handle BFD_RELOC_CTOR specially. If this is a mips3 + file, then we assume that we are using 64 bit addresses, and use + R_MIPS_64. Otherwise, we use R_MIPS_32. */ + if (code == BFD_RELOC_CTOR) + { + if (elf_mips_isa (elf_elfheader (abfd)->e_flags) < 3) + return &elf_mips_howto_table[(int) R_MIPS_32]; + else + return &elf_mips_ctor64_howto; + } + + /* Special handling for the MIPS16 relocs, since they are made up + reloc types with a large value. */ + if (code == BFD_RELOC_MIPS16_JMP) + return &elf_mips16_jump_howto; + else if (code == BFD_RELOC_MIPS16_GPREL) + return &elf_mips16_gprel_howto; + return NULL; } @@ -1282,8 +1565,15 @@ unsigned int r_type; r_type = ELF32_R_TYPE (dst->r_info); - BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); - cache_ptr->howto = &elf_mips_howto_table[r_type]; + if (r_type == R_MIPS16_26) + cache_ptr->howto = &elf_mips16_jump_howto; + else if (r_type == R_MIPS16_GPREL) + cache_ptr->howto = &elf_mips16_gprel_howto; + else + { + BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); + cache_ptr->howto = &elf_mips_howto_table[r_type]; + } /* The addend for a GPREL16 or LITERAL relocation comes from the GP value for the object file. We get the addend now, rather than @@ -1486,7 +1776,7 @@ { default: case E_MIPS_ARCH_1: - /* Just use the default, which was set in elfcode.h. */ + (void) bfd_default_set_arch_mach (abfd, bfd_arch_mips, 3000); break; case E_MIPS_ARCH_2: @@ -1532,6 +1822,8 @@ unsigned long val; unsigned int i; Elf_Internal_Shdr **hdrpp; + const char *name; + asection *sec; switch (bfd_get_mach (abfd)) { @@ -1564,11 +1856,15 @@ i < elf_elfheader (abfd)->e_shnum; i++, hdrpp++) { - if ((*hdrpp)->sh_type == SHT_MIPS_GPTAB) + switch ((*hdrpp)->sh_type) { - const char *name; - asection *sec; + case SHT_MIPS_LIBLIST: + sec = bfd_get_section_by_name (abfd, ".dynstr"); + if (sec != NULL) + (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; + break; + case SHT_MIPS_GPTAB: BFD_ASSERT ((*hdrpp)->bfd_section != NULL); name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); BFD_ASSERT (name != NULL @@ -1576,6 +1872,47 @@ sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1); BFD_ASSERT (sec != NULL); (*hdrpp)->sh_info = elf_section_data (sec)->this_idx; + break; + + case SHT_MIPS_CONTENT: + BFD_ASSERT ((*hdrpp)->bfd_section != NULL); + name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); + BFD_ASSERT (name != NULL + && strncmp (name, ".MIPS.content", + sizeof ".MIPS.content" - 1) == 0); + sec = bfd_get_section_by_name (abfd, + name + sizeof ".MIPS.content" - 1); + BFD_ASSERT (sec != NULL); + (*hdrpp)->sh_info = elf_section_data (sec)->this_idx; + break; + + case SHT_MIPS_SYMBOL_LIB: + sec = bfd_get_section_by_name (abfd, ".dynsym"); + if (sec != NULL) + (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; + sec = bfd_get_section_by_name (abfd, ".liblist"); + if (sec != NULL) + (*hdrpp)->sh_info = elf_section_data (sec)->this_idx; + break; + + case SHT_MIPS_EVENTS: + BFD_ASSERT ((*hdrpp)->bfd_section != NULL); + name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); + BFD_ASSERT (name != NULL); + if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0) + sec = bfd_get_section_by_name (abfd, + name + sizeof ".MIPS.events" - 1); + else + { + BFD_ASSERT (strncmp (name, ".MIPS.post_rel", + sizeof ".MIPS.post_rel" - 1) == 0); + sec = bfd_get_section_by_name (abfd, + (name + + sizeof ".MIPS.post_rel" - 1)); + } + BFD_ASSERT (sec != NULL); + (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; + break; } } } @@ -1602,10 +1939,8 @@ bfd *ibfd; bfd *obfd; { - /* This function is selected based on the input vector. We only - want to copy information over if the output BFD also uses Elf - format. */ - if (bfd_get_flavour (obfd) != bfd_target_elf_flavour) + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) return true; BFD_ASSERT (!elf_flags_init (obfd) @@ -1628,6 +1963,7 @@ { flagword old_flags; flagword new_flags; + boolean ok; /* Check if we have the same endianess */ if (ibfd->xvec->byteorder != obfd->xvec->byteorder @@ -1643,50 +1979,95 @@ return false; } - /* This function is selected based on the input vector. We only - want to copy information over if the output BFD also uses Elf - format. */ - if (bfd_get_flavour (obfd) != bfd_target_elf_flavour) + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) return true; new_flags = elf_elfheader (ibfd)->e_flags; elf_elfheader (obfd)->e_flags |= new_flags & EF_MIPS_NOREORDER; old_flags = elf_elfheader (obfd)->e_flags; - if (!elf_flags_init (obfd)) /* First call, no flags set */ + if (! elf_flags_init (obfd)) { elf_flags_init (obfd) = true; elf_elfheader (obfd)->e_flags = new_flags; - } - else if (((new_flags ^ old_flags) & ~EF_MIPS_NOREORDER) - == 0) /* Compatible flags are ok */ - ; - else /* Incompatible flags */ - { - /* Warn about -fPIC mismatch */ - if ((new_flags & EF_MIPS_PIC) != (old_flags & EF_MIPS_PIC)) + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_arch_info (obfd)->the_default) { - new_flags &= ~EF_MIPS_PIC; - (*_bfd_error_handler) - ("%s: needs all files compiled with -fPIC", - bfd_get_filename (ibfd)); + if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), + bfd_get_mach (ibfd))) + return false; } - if ((new_flags & EF_MIPS_CPIC) != (old_flags & EF_MIPS_CPIC)) + return true; + } + + /* Check flag compatibility. */ + + new_flags &= ~EF_MIPS_NOREORDER; + old_flags &= ~EF_MIPS_NOREORDER; + + if (new_flags == old_flags) + return true; + + ok = true; + + if ((new_flags & EF_MIPS_PIC) != (old_flags & EF_MIPS_PIC)) + { + new_flags &= ~EF_MIPS_PIC; + old_flags &= ~EF_MIPS_PIC; + (*_bfd_error_handler) + ("%s: linking PIC files with non-PIC files", + bfd_get_filename (ibfd)); + ok = false; + } + + if ((new_flags & EF_MIPS_CPIC) != (old_flags & EF_MIPS_CPIC)) + { + new_flags &= ~EF_MIPS_CPIC; + old_flags &= ~EF_MIPS_CPIC; + (*_bfd_error_handler) + ("%s: linking abicalls files with non-abicalls files", + bfd_get_filename (ibfd)); + ok = false; + } + + /* Don't warn about mixing -mips1 and -mips2 code, or mixing -mips3 + and -mips4 code. They will normally use the same data sizes and + calling conventions. */ + if ((new_flags & EF_MIPS_ARCH) != (old_flags & EF_MIPS_ARCH)) + { + int new_isa, old_isa; + + new_isa = elf_mips_isa (new_flags); + old_isa = elf_mips_isa (old_flags); + if ((new_isa == 1 || new_isa == 2) + ? (old_isa != 1 && old_isa != 2) + : (old_isa == 1 || old_isa == 2)) { - new_flags &= ~EF_MIPS_CPIC; (*_bfd_error_handler) - ("%s: needs all files compiled with -mabicalls", - bfd_get_filename (ibfd)); + ("%s: ISA mismatch (-mips%d) with previous modules (-mips%d)", + bfd_get_filename (ibfd), new_isa, old_isa); + ok = false; } - /* Warn about any other mismatches */ - if (new_flags != old_flags) - (*_bfd_error_handler) - ("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)", - bfd_get_filename (ibfd), (unsigned long) new_flags, - (unsigned long) old_flags); + new_flags &= ~ EF_MIPS_ARCH; + old_flags &= ~ EF_MIPS_ARCH; + } + /* Warn about any other mismatches */ + if (new_flags != old_flags) + { + (*_bfd_error_handler) + ("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)", + bfd_get_filename (ibfd), (unsigned long) new_flags, + (unsigned long) old_flags); + ok = false; + } + + if (! ok) + { bfd_set_error (bfd_error_bad_value); return false; } @@ -1743,6 +2124,14 @@ || hdr->sh_size != sizeof (Elf32_External_RegInfo)) return false; break; + case SHT_MIPS_IFACE: + if (strcmp (name, ".MIPS.interfaces") != 0) + return false; + break; + case SHT_MIPS_CONTENT: + if (strncmp (name, ".MIPS.content", sizeof ".MIPS.content" - 1) != 0) + return false; + break; case SHT_MIPS_OPTIONS: if (strcmp (name, ".options") != 0 && strcmp (name, ".MIPS.options") != 0) @@ -1752,8 +2141,14 @@ if (strncmp (name, ".debug_", sizeof ".debug_" - 1) != 0) return false; break; + case SHT_MIPS_SYMBOL_LIB: + if (strcmp (name, ".MIPS.symlib") != 0) + return false; + break; case SHT_MIPS_EVENTS: - if (strncmp (name, ".MIPS.events.", sizeof ".MIPS.events." - 1) != 0) + if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) != 0 + && strncmp (name, ".MIPS.post_rel", + sizeof ".MIPS.post_rel" - 1) != 0) return false; break; default: @@ -1866,7 +2261,7 @@ { hdr->sh_type = SHT_MIPS_LIBLIST; hdr->sh_info = sec->_raw_size / sizeof (Elf32_Lib); - /* FIXME: Set the sh_link field. */ + /* The sh_link field is set in final_write_processing. */ } else if (strcmp (name, ".msym") == 0) { @@ -1923,16 +2318,39 @@ || strcmp (name, ".lit4") == 0 || strcmp (name, ".lit8") == 0) hdr->sh_flags |= SHF_MIPS_GPREL; + else if (strcmp (name, ".MIPS.interfaces") == 0) + { + hdr->sh_type = SHT_MIPS_IFACE; + hdr->sh_flags |= SHF_MIPS_NOSTRIP; + } + else if (strcmp (name, ".MIPS.content") == 0) + { + hdr->sh_type = SHT_MIPS_CONTENT; + /* The sh_info field is set in final_write_processing. */ + } else if (strcmp (name, ".options") == 0 || strcmp (name, ".MIPS.options") == 0) { hdr->sh_type = SHT_MIPS_OPTIONS; hdr->sh_entsize = 1; + hdr->sh_flags |= SHF_MIPS_NOSTRIP; } else if (strncmp (name, ".debug_", sizeof ".debug_" - 1) == 0) hdr->sh_type = SHT_MIPS_DWARF; - else if (strncmp (name, ".MIPS.events.", sizeof ".MIPS.events." - 1) == 0) - hdr->sh_type = SHT_MIPS_EVENTS; + else if (strcmp (name, ".MIPS.symlib") == 0) + { + hdr->sh_type = SHT_MIPS_SYMBOL_LIB; + /* The sh_link and sh_info fields are set in + final_write_processing. */ + } + else if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0 + || strncmp (name, ".MIPS.post_rel", + sizeof ".MIPS.post_rel" - 1) == 0) + { + hdr->sh_type = SHT_MIPS_EVENTS; + hdr->sh_flags |= SHF_MIPS_NOSTRIP; + /* The sh_link field is set in final_write_processing. */ + } return true; } @@ -2140,7 +2558,7 @@ static asymbol *mips_elf_scom_symbol_ptr; /* MIPS ELF also uses an acommon section, which represents an - allocated common symbol which may be overridden by a + allocated common symbol which may be overridden by a definition in a shared library. */ static asection mips_elf_acom_section; static asymbol mips_elf_acom_symbol; @@ -2306,7 +2724,7 @@ *pm = m; } } - + /* If there are .dynamic and .mdebug sections, we make a room for the RTPROC header. FIXME: Rewrite without section names. */ if (bfd_get_section_by_name (abfd, ".interp") == NULL @@ -2561,11 +2979,16 @@ /*ARGSUSED*/ static boolean -mips_elf_is_local_label (abfd, symbol) +mips_elf_is_local_label_name (abfd, name) bfd *abfd; - asymbol *symbol; + const char *name; { - return symbol->name[0] == '$'; + if (name[0] == '$') + return true; + + /* On Irix 6, the labels go back to starting with '.', so we accept + the generic ELF local label syntax as well. */ + return _bfd_elf_is_local_label_name (abfd, name); } /* MIPS ELF uses a special find_nearest_line routine in order the @@ -2673,6 +3096,44 @@ line_ptr); } + /* The mips16 compiler uses a couple of special sections to handle + floating point arguments. + + Section names that look like .mips16.fn.FNNAME contain stubs that + copy floating point arguments from the fp regs to the gp regs and + then jump to FNNAME. If any 32 bit function calls FNNAME, the + call should be redirected to the stub instead. If no 32 bit + function calls FNNAME, the stub should be discarded. We need to + consider any reference to the function, not just a call, because + if the address of the function is taken we will need the stub, + since the address might be passed to a 32 bit function. + + Section names that look like .mips16.call.FNNAME contain stubs + that copy floating point arguments from the gp regs to the fp + regs and then jump to FNNAME. If FNNAME is a 32 bit function, + then any 16 bit function that calls FNNAME should be redirected + to the stub instead. If FNNAME is not a 32 bit function, the + stub should be discarded. + + .mips16.call.fp.FNNAME sections are similar, but contain stubs + which call FNNAME and then copy the return value from the fp regs + to the gp regs. These stubs store the return value in $18 while + calling FNNAME; any function which might call one of these stubs + must arrange to save $18 around the call. (This case is not + needed for 32 bit functions that call 16 bit functions, because + 16 bit functions always return floating point values in both + $f0/$f1 and $2/$3.) + + Note that in all cases FNNAME might be defined statically. + Therefore, FNNAME is not used literally. Instead, the relocation + information will indicate which symbol the section is for. + + We record any stubs that we find in the symbol table. */ + +#define FN_STUB ".mips16.fn." +#define CALL_STUB ".mips16.call." +#define CALL_FP_STUB ".mips16.call.fp." + /* The MIPS ELF linker needs additional information for each symbol in the global hash table. */ @@ -2685,6 +3146,22 @@ /* Number of MIPS_32 or MIPS_REL32 relocs against this symbol. */ unsigned int mips_32_relocs; + + /* If there is a stub that 32 bit functions should use to call this + 16 bit function, this points to the section containing the stub. */ + asection *fn_stub; + + /* Whether we need the fn_stub; this is set if this symbol appears + in any relocs other than a 16 bit call. */ + boolean need_fn_stub; + + /* If there is a stub that 16 bit functions should use to call this + 32 bit function, this points to the section containing the stub. */ + asection *call_stub; + + /* This is like the call_stub field, but it is used if the function + being called returns a floating point value. */ + asection *call_fp_stub; }; /* MIPS ELF linker hash table. */ @@ -2703,6 +3180,8 @@ boolean use_rld_obj_head; /* This is the value of the __rld_map or __rld_obj_head symbol. */ bfd_vma rld_value; + /* This is set if we see any mips16 stub sections. */ + boolean mips16_stubs_seen; }; /* Look up an entry in a MIPS ELF linker hash table. */ @@ -2760,6 +3239,10 @@ not been set. -1 means there is no associated ifd. */ ret->esym.ifd = -2; ret->mips_32_relocs = 0; + ret->fn_stub = NULL; + ret->need_fn_stub = false; + ret->call_stub = NULL; + ret->call_fp_stub = NULL; } return (struct bfd_hash_entry *) ret; @@ -2792,6 +3275,7 @@ ret->compact_rel_size = 0; ret->use_rld_obj_head = false; ret->rld_value = 0; + ret->mips16_stubs_seen = false; return &ret->root.root; } @@ -2841,7 +3325,6 @@ mips_elf_text_section.name = ".text"; mips_elf_text_section.flags = SEC_NO_FLAGS; mips_elf_text_section.output_section = NULL; - mips_elf_text_section.owner = abfd; mips_elf_text_section.symbol = &mips_elf_text_symbol; mips_elf_text_section.symbol_ptr_ptr = &mips_elf_text_symbol_ptr; mips_elf_text_symbol.name = ".text"; @@ -2850,10 +3333,10 @@ mips_elf_text_symbol_ptr = &mips_elf_text_symbol; mips_elf_text_section_ptr = &mips_elf_text_section; } - if (info->shared) - *secp = bfd_und_section_ptr; - else - *secp = mips_elf_text_section_ptr; + /* This code used to do *secp = bfd_und_section_ptr if + info->shared. I don't know why, and that doesn't make sense, + so I took it out. */ + *secp = mips_elf_text_section_ptr; break; case SHN_MIPS_ACOMMON: @@ -2866,7 +3349,6 @@ mips_elf_data_section.name = ".data"; mips_elf_data_section.flags = SEC_NO_FLAGS; mips_elf_data_section.output_section = NULL; - mips_elf_data_section.owner = abfd; mips_elf_data_section.symbol = &mips_elf_data_symbol; mips_elf_data_section.symbol_ptr_ptr = &mips_elf_data_symbol_ptr; mips_elf_data_symbol.name = ".data"; @@ -2875,10 +3357,10 @@ mips_elf_data_symbol_ptr = &mips_elf_data_symbol; mips_elf_data_section_ptr = &mips_elf_data_section; } - if (info->shared) - *secp = bfd_und_section_ptr; - else - *secp = mips_elf_data_section_ptr; + /* This code used to do *secp = bfd_und_section_ptr if + info->shared. I don't know why, and that doesn't make sense, + so I took it out. */ + *secp = mips_elf_data_section_ptr; break; case SHN_MIPS_SUNDEFINED: @@ -2911,6 +3393,12 @@ mips_elf_hash_table (info)->use_rld_obj_head = true; } + /* If this is a mips16 text symbol, add 1 to the value to make it + odd. This will cause something like .word SYM to come up with + the right value when it is loaded into the PC. */ + if (sym->st_other == STO_MIPS16) + ++*valp; + return true; } @@ -3026,7 +3514,7 @@ else { name = bfd_section_name (output_section->owner, output_section); - + if (strcmp (name, ".text") == 0) h->esym.asym.sc = scText; else if (strcmp (name, ".data") == 0) @@ -3092,7 +3580,7 @@ #if 0 /* FIXME? */ h->esym.ifd = 0; #endif - } + } if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap, h->root.root.root.string, @@ -3487,7 +3975,7 @@ } else esym.asym.value = last; - + if (! bfd_ecoff_debug_one_external (abfd, &debug, swap, name[i], &esym)) return false; @@ -3605,12 +4093,12 @@ if (rtproc_sec == NULL) { flagword flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_READONLY); + | SEC_LINKER_CREATED | SEC_READONLY); rtproc_sec = bfd_make_section (abfd, ".rtproc"); if (rtproc_sec == NULL || ! bfd_set_section_flags (abfd, rtproc_sec, flags) - || ! bfd_set_section_alignment (abfd, rtproc_sec, 12)) + || ! bfd_set_section_alignment (abfd, rtproc_sec, 4)) return false; } @@ -3955,7 +4443,7 @@ /* Handle a MIPS ELF local GOT16 reloc. */ -static void +static boolean mips_elf_relocate_got_local (output_bfd, input_bfd, sgot, relhi, rello, contents, addend) bfd *output_bfd; @@ -3966,8 +4454,8 @@ bfd_byte *contents; bfd_vma addend; { - int local_gotno; - int i; + unsigned int assigned_gotno; + unsigned int i; bfd_vma insn; bfd_vma addlo; bfd_vma address; @@ -3992,33 +4480,36 @@ g = (struct mips_got_info *) elf_section_data (sgot)->tdata; BFD_ASSERT (g != NULL); - local_gotno = g->local_gotno; + assigned_gotno = g->assigned_gotno; got_contents = sgot->contents; hipage = addend & 0xffff0000; - for (i = MIPS_RESERVED_GOTNO; i < local_gotno; i++) + for (i = MIPS_RESERVED_GOTNO; i < assigned_gotno; i++) { address = bfd_get_32 (input_bfd, got_contents + i * 4); if (hipage == (address & 0xffff0000)) break; - if (address == (bfd_vma) 0) + } + + if (i == assigned_gotno) + { + if (assigned_gotno >= g->local_gotno) { - bfd_put_32 (input_bfd, hipage, got_contents + i * 4); - break; + (*_bfd_error_handler) + ("more got entries are needed for hipage relocations"); + bfd_set_error (bfd_error_bad_value); + return false; } - } - BFD_ASSERT (i < local_gotno); -#if 1 - if (i == local_gotno) - (*_bfd_error_handler) - ("ELF MIPS linker: more got entries are needed for hipage: %x", - hipage); -#endif + bfd_put_32 (input_bfd, hipage, got_contents + assigned_gotno * 4); + ++g->assigned_gotno; + } i = - ELF_MIPS_GP_OFFSET (output_bfd) + i * 4; bfd_put_32 (input_bfd, (insn & 0xffff0000) | (i & 0xffff), contents + relhi->r_offset); + + return true; } /* Handle MIPS ELF CALL16 reloc and global GOT16 reloc. */ @@ -4097,15 +4588,24 @@ struct elf_link_hash_entry *h; asection *sec; Elf_Internal_Sym *sym; + struct mips_elf_link_hash_entry *mh; + int other; bfd_reloc_status_type r; r_type = ELF32_R_TYPE (rel->r_info); - if (r_type < 0 || r_type >= (int) R_MIPS_max) + if ((r_type < 0 || r_type >= (int) R_MIPS_max) + && r_type != R_MIPS16_26 + && r_type != R_MIPS16_GPREL) { bfd_set_error (bfd_error_bad_value); return false; } - howto = elf_mips_howto_table + r_type; + if (r_type == R_MIPS16_26) + howto = &elf_mips16_jump_howto; + else if (r_type == R_MIPS16_GPREL) + howto = &elf_mips16_gprel_howto; + else + howto = elf_mips_howto_table + r_type; if (dynobj != NULL && (r_type == R_MIPS_CALL16 @@ -4131,7 +4631,8 @@ /* Mix in the change in GP address for a GP relative reloc. */ if (r_type != R_MIPS_GPREL16 && r_type != R_MIPS_LITERAL - && r_type != R_MIPS_GPREL32) + && r_type != R_MIPS_GPREL32 + && r_type != R_MIPS16_GPREL) addend = 0; else { @@ -4209,7 +4710,11 @@ /* If this is HI16 or GOT16 with an associated LO16, adjust the addend accordingly. Otherwise, just relocate. */ - if (r_type != R_MIPS_HI16 && r_type != R_MIPS_GOT16) + if (r_type == R_MIPS_64 && bfd_big_endian (input_bfd)) + r = _bfd_relocate_contents (howto, input_bfd, + addend, + contents + rel->r_offset + 4); + else if (r_type != R_MIPS_HI16 && r_type != R_MIPS_GOT16) r = _bfd_relocate_contents (howto, input_bfd, addend, contents + rel->r_offset); @@ -4269,6 +4774,10 @@ value. */ if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) relocation += sym->st_value; + + /* mips16 text labels should be treated as odd. */ + if (sym->st_other == STO_MIPS16) + ++relocation; } else { @@ -4347,6 +4856,98 @@ } } + mh = (struct mips_elf_link_hash_entry *) h; + if (h != NULL) + other = h->other; + else if (sym != NULL) + other = sym->st_other; + else + other = 0; + + /* If this function has an fn_stub, then it is a mips16 + function which needs a stub if it is called by a 32 bit + function. If this reloc is anything other than a 16 bit + call, redirect the reloc to the stub. We don't redirect + relocs from other stub functions. */ + if (r_type != R_MIPS16_26 + && ((mh != NULL + && mh->fn_stub != NULL) + || (mh == NULL + && elf_tdata (input_bfd)->local_stubs != NULL + && elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL)) + && strncmp (bfd_get_section_name (input_bfd, input_section), + FN_STUB, sizeof FN_STUB - 1) != 0 + && strncmp (bfd_get_section_name (input_bfd, input_section), + CALL_STUB, sizeof CALL_STUB - 1) != 0 + && strncmp (bfd_get_section_name (input_bfd, input_section), + CALL_FP_STUB, sizeof CALL_FP_STUB - 1) != 0) + { + if (mh != NULL) + { + BFD_ASSERT (mh->need_fn_stub); + relocation = (mh->fn_stub->output_section->vma + + mh->fn_stub->output_offset); + } + else + { + asection *fn_stub; + + fn_stub = elf_tdata (input_bfd)->local_stubs[r_symndx]; + relocation = (fn_stub->output_section->vma + + fn_stub->output_offset); + } + + /* RELOCATION now points to 32 bit code. */ + other = 0; + } + + /* If this function has a call_stub, then it is called by a + mips16 function; the call needs to go through a stub if + this function is a 32 bit function. If this reloc is a + 16 bit call, and the symbol is not a 16 bit function, + then redirect the reloc to the stub. Note that we don't + need to worry about calling the function through a + function pointer; such calls are handled by routing + through a special mips16 routine. We don't have to check + whether this call is from a stub; it can't be, because a + stub contains 32 bit code, and hence can not have a 16 + bit reloc. */ + if (r_type == R_MIPS16_26 + && mh != NULL + && (mh->call_stub != NULL || mh->call_fp_stub != NULL) + && other != STO_MIPS16) + { + asection *stub; + + /* If both call_stub and call_fp_stub are defined, we + can figure out which one to use by seeing which one + appears in the input file. */ + if (mh->call_stub != NULL && mh->call_fp_stub != NULL) + { + asection *o; + + stub = NULL; + for (o = input_bfd->sections; o != NULL; o = o->next) + { + if (strncmp (bfd_get_section_name (input_bfd, o), + CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) + { + stub = mh->call_fp_stub; + break; + } + } + if (stub == NULL) + stub = mh->call_stub; + } + else if (mh->call_stub != NULL) + stub = mh->call_stub; + else + stub = mh->call_fp_stub; + + BFD_ASSERT (stub->_raw_size > 0); + relocation = stub->output_section->vma + stub->output_offset; + } + if (r_type == R_MIPS_HI16) { Elf_Internal_Rela *lorel; @@ -4384,10 +4985,11 @@ if ((rel + 1) < relend && ELF32_R_TYPE ((rel + 1)->r_info) == R_MIPS_LO16) { - mips_elf_relocate_got_local (output_bfd, input_bfd, sgot, - rel, rel + 1, - contents, - relocation + addend); + if (! mips_elf_relocate_got_local (output_bfd, input_bfd, + sgot, rel, rel + 1, + contents, + relocation + addend)) + return false; r = bfd_reloc_ok; } else @@ -4454,6 +5056,8 @@ == 0))) && (input_section->flags & SEC_ALLOC) != 0) { + boolean skip; + /* When generating a shared object, these relocations are copied into the output file to be resolved at run time. */ @@ -4463,16 +5067,35 @@ BFD_ASSERT (sreloc != NULL); } - outrel.r_offset = (rel->r_offset - + input_section->output_section->vma - + input_section->output_offset); + skip = false; + + if (elf_section_data (input_section)->stab_info == NULL) + outrel.r_offset = rel->r_offset; + else + { + bfd_vma off; + + off = (_bfd_stab_section_offset + (output_bfd, &elf_hash_table (info)->stab_info, + input_section, + &elf_section_data (input_section)->stab_info, + rel->r_offset)); + if (off == (bfd_vma) -1) + skip = true; + outrel.r_offset = off; + } + + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); addend = bfd_get_32 (input_bfd, contents + rel->r_offset); - if (h != NULL - && (! info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) + if (skip) + memset (&outrel, 0, sizeof outrel); + else if (h != NULL + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) { BFD_ASSERT (h->dynindx != -1); outrel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_REL32); @@ -4512,14 +5135,16 @@ addend += relocation; } - bfd_put_32 (output_bfd, addend, contents + rel->r_offset); + if (! skip) + bfd_put_32 (output_bfd, addend, contents + rel->r_offset); + bfd_elf32_swap_reloc_out (output_bfd, &outrel, (((Elf32_External_Rel *) sreloc->contents) + sreloc->reloc_count)); ++sreloc->reloc_count; - if (SGI_COMPAT (output_bfd)) + if (! skip && SGI_COMPAT (output_bfd)) { if (scpt == NULL) continue; @@ -4553,11 +5178,157 @@ contents, rel->r_offset, relocation, addend); } + else if (r_type == R_MIPS_64) + { + bfd_size_type addr; + unsigned long val; + + /* Do a 32 bit relocation, and sign extend to 64 bits. */ + addr = rel->r_offset; + if (bfd_big_endian (input_bfd)) + addr += 4; + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, addr, relocation, + addend); + val = bfd_get_32 (input_bfd, contents + addr); + if ((val & 0x80000000) != 0) + val = 0xffffffff; + else + val = 0; + addr = rel->r_offset; + if (bfd_little_endian (input_bfd)) + addr += 4; + bfd_put_32 (input_bfd, val, contents + addr); + } + else if (r_type == R_MIPS_26 && other == STO_MIPS16) + { + unsigned long insn; + + /* This is a jump to a mips16 routine from a mips32 + routine. We need to change jal into jalx. */ + insn = bfd_get_32 (input_bfd, contents + rel->r_offset); + if (((insn >> 26) & 0x3f) != 0x3 + && ((insn >> 26) & 0x3f) != 0x1d) + { + (*_bfd_error_handler) + ("%s: %s+0x%lx: jump to mips16 routine which is not jal", + bfd_get_filename (input_bfd), + input_section->name, + (unsigned long) rel->r_offset); + bfd_set_error (bfd_error_bad_value); + return false; + } + insn = (insn & 0x3ffffff) | (0x1d << 26); + bfd_put_32 (input_bfd, insn, contents + rel->r_offset); + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, addend); + } + else if (r_type == R_MIPS16_26) + { + /* It's easiest to do the normal relocation, and then + dig out the instruction and swap the first word the + way the mips16 expects it. If this is little endian, + though, we need to swap the two words first, and then + swap them back again later, so that the address looks + right. */ + + if (bfd_little_endian (input_bfd)) + { + unsigned long insn; + + insn = bfd_get_32 (input_bfd, contents + rel->r_offset); + insn = ((insn >> 16) & 0xffff) | ((insn & 0xffff) << 16); + bfd_put_32 (input_bfd, insn, contents + rel->r_offset); + } + + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, addend); + if (r == bfd_reloc_ok) + { + unsigned long insn; + + if (bfd_little_endian (input_bfd)) + { + insn = bfd_get_32 (input_bfd, contents + rel->r_offset); + insn = ((insn >> 16) & 0xffff) | ((insn & 0xffff) << 16); + bfd_put_32 (input_bfd, insn, contents + rel->r_offset); + } + + insn = bfd_get_16 (input_bfd, contents + rel->r_offset); + insn = ((insn & 0xfc00) + | ((insn & 0x1f) << 5) + | ((insn & 0x3e0) >> 5)); + /* If this is a jump to a 32 bit routine, then make + it jalx. */ + if (other != STO_MIPS16) + insn |= 0x400; + bfd_put_16 (input_bfd, insn, contents + rel->r_offset); + } + } + else if (r_type == R_MIPS16_GPREL) + { + unsigned short extend, insn; + bfd_byte buf[4]; + unsigned long final; + + /* Extract the addend into buf, run the regular reloc, + and stuff the resulting value back into the + instructions. */ + if (rel->r_offset > input_section->_raw_size) + r = bfd_reloc_outofrange; + else + { + extend = bfd_get_16 (input_bfd, contents + rel->r_offset); + insn = bfd_get_16 (input_bfd, contents + rel->r_offset + 2); + bfd_put_32 (input_bfd, + (((extend & 0x1f) << 11) + | (extend & 0x7e0) + | (insn & 0x1f)), + buf); + r = _bfd_final_link_relocate (howto, input_bfd, + input_section, buf, + (bfd_vma) 0, relocation, + addend); + final = bfd_get_32 (input_bfd, buf); + bfd_put_16 (input_bfd, + ((extend & 0xf800) + | ((final >> 11) & 0x1f) + | (final & 0x7e0)), + contents + rel->r_offset); + bfd_put_16 (input_bfd, + ((insn & 0xffe0) + | (final & 0x1f)), + contents + rel->r_offset + 2); + } + } else r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents, rel->r_offset, relocation, addend); + /* The jal instruction can only jump to an address which is + divisible by 4, and it can only jump to an address with + the same upper 4 bits as the PC. */ + if (r == bfd_reloc_ok + && (r_type == R_MIPS16_26 || r_type == R_MIPS_26)) + { + bfd_vma addr; + + addr = relocation; + if (other == STO_MIPS16) + addr &= ~ (bfd_vma) 1; + addr += addend; + if ((addr & 3) != 0 + || ((addr & 0xf0000000) + != ((input_section->output_section->vma + + input_section->output_offset + + rel->r_offset) + & 0xf0000000))) + r = bfd_reloc_overflow; + } + if (SGI_COMPAT (abfd) && scpt != NULL && (input_section->flags & SEC_ALLOC) != 0) @@ -4639,6 +5410,25 @@ return true; } + +/* This hook function is called before the linker writes out a global + symbol. This is where we undo the increment of the value for a + mips16 symbol. */ + +/*ARGSIGNORED*/ +static boolean +mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) + bfd *abfd; + struct bfd_link_info *info; + const char *name; + Elf_Internal_Sym *sym; + asection *input_sec; +{ + if (sym->st_other == STO_MIPS16 + && (sym->st_value & 1) != 0) + --sym->st_value; + return true; +} /* Functions for the dynamic linker. */ @@ -4660,7 +5450,7 @@ const char * const *namep; flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_READONLY); + | SEC_LINKER_CREATED | SEC_READONLY); /* Mips ABI requests the .dynamic section to be read only. */ s = bfd_get_section_by_name (abfd, ".dynamic"); @@ -4745,7 +5535,7 @@ get_elf_backend_data (abfd)->collect, (struct bfd_link_hash_entry **) &h))) return false; - h->elf_link_hash_flags ^=~ ELF_LINK_NON_ELF; + h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; h->type = STT_SECTION; @@ -4792,7 +5582,8 @@ if (bfd_get_section_by_name (abfd, ".compact_rel") == NULL) { - flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_READONLY; + flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED + | SEC_READONLY); s = bfd_make_section (abfd, ".compact_rel"); if (s == NULL @@ -4805,7 +5596,7 @@ return true; } - + /* Create the .got section to hold the global offset table. */ static boolean @@ -4822,7 +5613,8 @@ if (bfd_get_section_by_name (abfd, ".got") != NULL) return true; - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY; + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); s = bfd_make_section (abfd, ".got"); if (s == NULL @@ -4857,6 +5649,7 @@ return false; g->global_gotsym = 0; g->local_gotno = MIPS_RESERVED_GOTNO; + g->assigned_gotno = MIPS_RESERVED_GOTNO; if (elf_section_data (s) == NULL) { s->used_by_bfd = @@ -4879,6 +5672,7 @@ asection *sec; const Elf_Internal_Rela *relocs; { + const char *name; bfd *dynobj; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; @@ -4897,7 +5691,182 @@ sym_hashes = elf_sym_hashes (abfd); extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info; - sgot = NULL; + /* Check for the mips16 stub sections. */ + + name = bfd_get_section_name (abfd, sec); + if (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0) + { + unsigned long r_symndx; + + /* Look at the relocation information to figure out which symbol + this is for. */ + + r_symndx = ELF32_R_SYM (relocs->r_info); + + if (r_symndx < extsymoff + || sym_hashes[r_symndx - extsymoff] == NULL) + { + asection *o; + + /* This stub is for a local symbol. This stub will only be + needed if there is some relocation in this BFD, other + than a 16 bit function call, which refers to this symbol. */ + for (o = abfd->sections; o != NULL; o = o->next) + { + Elf_Internal_Rela *sec_relocs; + const Elf_Internal_Rela *r, *rend; + + /* We can ignore stub sections when looking for relocs. */ + if ((o->flags & SEC_RELOC) == 0 + || o->reloc_count == 0 + || strncmp (bfd_get_section_name (abfd, o), FN_STUB, + sizeof FN_STUB - 1) == 0 + || strncmp (bfd_get_section_name (abfd, o), CALL_STUB, + sizeof CALL_STUB - 1) == 0 + || strncmp (bfd_get_section_name (abfd, o), CALL_FP_STUB, + sizeof CALL_FP_STUB - 1) == 0) + continue; + + sec_relocs = (_bfd_elf32_link_read_relocs + (abfd, o, (PTR) NULL, + (Elf_Internal_Rela *) NULL, + info->keep_memory)); + if (sec_relocs == NULL) + return false; + + rend = sec_relocs + o->reloc_count; + for (r = sec_relocs; r < rend; r++) + if (ELF32_R_SYM (r->r_info) == r_symndx + && ELF32_R_TYPE (r->r_info) != R_MIPS16_26) + break; + + if (! info->keep_memory) + free (sec_relocs); + + if (r < rend) + break; + } + + if (o == NULL) + { + /* There is no non-call reloc for this stub, so we do + not need it. Since this function is called before + the linker maps input sections to output sections, we + can easily discard it by setting the SEC_EXCLUDE + flag. */ + sec->flags |= SEC_EXCLUDE; + return true; + } + + /* Record this stub in an array of local symbol stubs for + this BFD. */ + if (elf_tdata (abfd)->local_stubs == NULL) + { + unsigned long symcount; + asection **n; + + if (elf_bad_symtab (abfd)) + symcount = symtab_hdr->sh_size / sizeof (Elf32_External_Sym); + else + symcount = symtab_hdr->sh_info; + n = (asection **) bfd_zalloc (abfd, + symcount * sizeof (asection *)); + if (n == NULL) + return false; + elf_tdata (abfd)->local_stubs = n; + } + + elf_tdata (abfd)->local_stubs[r_symndx] = sec; + + /* We don't need to set mips16_stubs_seen in this case. + That flag is used to see whether we need to look through + the global symbol table for stubs. We don't need to set + it here, because we just have a local stub. */ + } + else + { + struct mips_elf_link_hash_entry *h; + + h = ((struct mips_elf_link_hash_entry *) + sym_hashes[r_symndx - extsymoff]); + + /* H is the symbol this stub is for. */ + + h->fn_stub = sec; + mips_elf_hash_table (info)->mips16_stubs_seen = true; + } + } + else if (strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0 + || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) + { + unsigned long r_symndx; + struct mips_elf_link_hash_entry *h; + asection **loc; + + /* Look at the relocation information to figure out which symbol + this is for. */ + + r_symndx = ELF32_R_SYM (relocs->r_info); + + if (r_symndx < extsymoff + || sym_hashes[r_symndx - extsymoff] == NULL) + { + /* This stub was actually built for a static symbol defined + in the same file. We assume that all static symbols in + mips16 code are themselves mips16, so we can simply + discard this stub. Since this function is called before + the linker maps input sections to output sections, we can + easily discard it by setting the SEC_EXCLUDE flag. */ + sec->flags |= SEC_EXCLUDE; + return true; + } + + h = ((struct mips_elf_link_hash_entry *) + sym_hashes[r_symndx - extsymoff]); + + /* H is the symbol this stub is for. */ + + if (strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) + loc = &h->call_fp_stub; + else + loc = &h->call_stub; + + /* If we already have an appropriate stub for this function, we + don't need another one, so we can discard this one. Since + this function is called before the linker maps input sections + to output sections, we can easily discard it by setting the + SEC_EXCLUDE flag. We can also discard this section if we + happen to already know that this is a mips16 function; it is + not necessary to check this here, as it is checked later, but + it is slightly faster to check now. */ + if (*loc != NULL || h->root.other == STO_MIPS16) + { + sec->flags |= SEC_EXCLUDE; + return true; + } + + *loc = sec; + mips_elf_hash_table (info)->mips16_stubs_seen = true; + } + + if (dynobj == NULL) + { + sgot = NULL; + g = NULL; + } + else + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + if (sgot == NULL) + g = NULL; + else + { + BFD_ASSERT (elf_section_data (sgot) != NULL); + g = (struct mips_got_info *) elf_section_data (sgot)->tdata; + BFD_ASSERT (g != NULL); + } + } + sreloc = NULL; rel_end = relocs + sec->reloc_count; @@ -4911,10 +5880,19 @@ if (r_symndx < extsymoff) h = NULL; else - h = sym_hashes[r_symndx - extsymoff]; + { + h = sym_hashes[r_symndx - extsymoff]; + + /* This may be an indirect symbol created because of a version. */ + if (h != NULL) + { + while (h->root.type == bfd_link_hash_indirect) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } + } /* Some relocs require a global offset table. */ - if (dynobj == NULL) + if (dynobj == NULL || sgot == NULL) { switch (ELF32_R_TYPE (rel->r_info)) { @@ -4924,9 +5902,23 @@ case R_MIPS_CALL_LO16: case R_MIPS_GOT_HI16: case R_MIPS_GOT_LO16: - elf_hash_table (info)->dynobj = dynobj = abfd; + if (dynobj == NULL) + elf_hash_table (info)->dynobj = dynobj = abfd; if (! mips_elf_create_got_section (dynobj, info)) return false; + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + BFD_ASSERT (elf_section_data (sgot) != NULL); + g = (struct mips_got_info *) elf_section_data (sgot)->tdata; + BFD_ASSERT (g != NULL); + break; + + case R_MIPS_32: + case R_MIPS_REL32: + if (dynobj == NULL + && (info->shared || h != NULL) + && (sec->flags & SEC_ALLOC) != 0) + elf_hash_table (info)->dynobj = dynobj = abfd; break; default: @@ -4940,17 +5932,16 @@ case R_MIPS_CALL_HI16: case R_MIPS_CALL_LO16: /* This symbol requires a global offset table entry. */ - if (sgot == NULL) + + if (h == NULL) { - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); + (*_bfd_error_handler) + ("%s: CALL16 reloc at 0x%lx not against global symbol", + bfd_get_filename (abfd), (unsigned long) rel->r_offset); + bfd_set_error (bfd_error_bad_value); + return false; } - BFD_ASSERT (h != NULL); - /* Make sure this symbol is output as a dynamic symbol. */ if (h->dynindx == -1) { @@ -4984,14 +5975,6 @@ case R_MIPS_GOT_HI16: case R_MIPS_GOT_LO16: /* This symbol requires a global offset table entry. */ - if (sgot == NULL) - { - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - } if (h != NULL) { @@ -5024,37 +6007,39 @@ if ((info->shared || h != NULL) && (sec->flags & SEC_ALLOC) != 0) { + if (sreloc == NULL) + { + const char *name = ".rel.dyn"; + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + sreloc = bfd_make_section (dynobj, name); + if (sreloc == NULL + || ! bfd_set_section_flags (dynobj, sreloc, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || ! bfd_set_section_alignment (dynobj, sreloc, + 4)) + return false; + } + } if (info->shared) { /* When creating a shared object, we must copy these reloc types into the output file as R_MIPS_REL32 - relocs. We create the .rel.dyn reloc section in - dynobj and make room for this reloc. */ - if (sreloc == NULL) + relocs. We make room for this reloc in the + .rel.dyn reloc section */ + if (sreloc->_raw_size == 0) { - const char *name = ".rel.dyn"; - - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - { - sreloc = bfd_make_section (dynobj, name); - if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, sreloc, - 4)) - return false; - - /* Add a null element. */ - sreloc->_raw_size += sizeof (Elf32_External_Rel); - ++sreloc->reloc_count; - } + /* Add a null element. */ + sreloc->_raw_size += sizeof (Elf32_External_Rel); + ++sreloc->reloc_count; } - sreloc->_raw_size += sizeof (Elf32_External_Rel); } else @@ -5086,6 +6071,24 @@ default: break; } + + /* If this reloc is not a 16 bit call, and it has a global + symbol, then we will need the fn_stub if there is one. + References from a stub section do not count. */ + if (h != NULL + && ELF32_R_TYPE (rel->r_info) != R_MIPS16_26 + && strncmp (bfd_get_section_name (abfd, sec), FN_STUB, + sizeof FN_STUB - 1) != 0 + && strncmp (bfd_get_section_name (abfd, sec), CALL_STUB, + sizeof CALL_STUB - 1) != 0 + && strncmp (bfd_get_section_name (abfd, sec), CALL_FP_STUB, + sizeof CALL_FP_STUB - 1) != 0) + { + struct mips_elf_link_hash_entry *mh; + + mh = (struct mips_elf_link_hash_entry *) h; + mh->need_fn_stub = true; + } } return true; @@ -5130,6 +6133,12 @@ s = bfd_get_section_by_name (dynobj, ".rel.dyn"); BFD_ASSERT (s != NULL); + if (s->_raw_size == 0) + { + /* Make room for a null element. */ + s->_raw_size += sizeof (Elf32_External_Rel); + ++s->reloc_count; + } s->_raw_size += hmips->mips_32_relocs * sizeof (Elf32_External_Rel); } @@ -5183,6 +6192,80 @@ return true; } +/* This function is called after all the input files have been read, + and the input sections have been assigned to output sections. We + check for any mips16 stub sections that we can discard. */ + +static boolean mips_elf_check_mips16_stubs + PARAMS ((struct mips_elf_link_hash_entry *, PTR)); + +static boolean +mips_elf_always_size_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + if (info->relocateable + || ! mips_elf_hash_table (info)->mips16_stubs_seen) + return true; + + mips_elf_link_hash_traverse (mips_elf_hash_table (info), + mips_elf_check_mips16_stubs, + (PTR) NULL); + + return true; +} + +/* Check the mips16 stubs for a particular symbol, and see if we can + discard them. */ + +/*ARGSUSED*/ +static boolean +mips_elf_check_mips16_stubs (h, data) + struct mips_elf_link_hash_entry *h; + PTR data; +{ + if (h->fn_stub != NULL + && ! h->need_fn_stub) + { + /* We don't need the fn_stub; the only references to this symbol + are 16 bit calls. Clobber the size to 0 to prevent it from + being included in the link. */ + h->fn_stub->_raw_size = 0; + h->fn_stub->_cooked_size = 0; + h->fn_stub->flags &= ~ SEC_RELOC; + h->fn_stub->reloc_count = 0; + h->fn_stub->flags |= SEC_EXCLUDE; + } + + if (h->call_stub != NULL + && h->root.other == STO_MIPS16) + { + /* We don't need the call_stub; this is a 16 bit function, so + calls from other 16 bit functions are OK. Clobber the size + to 0 to prevent it from being included in the link. */ + h->call_stub->_raw_size = 0; + h->call_stub->_cooked_size = 0; + h->call_stub->flags &= ~ SEC_RELOC; + h->call_stub->reloc_count = 0; + h->call_stub->flags |= SEC_EXCLUDE; + } + + if (h->call_fp_stub != NULL + && h->root.other == STO_MIPS16) + { + /* We don't need the call_stub; this is a 16 bit function, so + calls from other 16 bit functions are OK. Clobber the size + to 0 to prevent it from being included in the link. */ + h->call_fp_stub->_raw_size = 0; + h->call_fp_stub->_cooked_size = 0; + h->call_fp_stub->flags &= ~ SEC_RELOC; + h->call_fp_stub->reloc_count = 0; + h->call_fp_stub->flags |= SEC_EXCLUDE; + } + + return true; +} + /* Set the sizes of the dynamic sections. */ static boolean @@ -5256,7 +6339,7 @@ of the dynobj section names depend upon the input files. */ name = bfd_get_section_name (dynobj, s); - if ((s->flags & SEC_IN_MEMORY) == 0) + if ((s->flags & SEC_LINKER_CREATED) == 0) continue; strip = false; @@ -5267,6 +6350,7 @@ strip = true; else { + const char *outname; asection *target; /* If this relocation section applies to a read only @@ -5275,9 +6359,11 @@ assert a DT_TEXTREL entry rather than testing whether there exists a relocation to a read only section or not. */ - target = bfd_get_section_by_name (output_bfd, name + 4); + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 4); if ((target != NULL && (target->flags & SEC_READONLY) != 0) - || strcmp (name, ".rel.dyn") == 0) + || strcmp (outname, ".rel.dyn") == 0) reltext = true; /* We use the reloc_count field as a counter if we need @@ -5516,18 +6602,19 @@ } } - s = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (s != NULL); - BFD_ASSERT (elf_section_data (s) != NULL); - g = (struct mips_got_info *) elf_section_data (s)->tdata; - BFD_ASSERT (g != NULL); - - /* If there are no global got symbols, fake the last symbol so for - safety. */ - if (g->global_gotsym) - g->global_gotsym += c; - else - g->global_gotsym = elf_hash_table (info)->dynsymcount - 1; + if (sgot != NULL) + { + BFD_ASSERT (elf_section_data (sgot) != NULL); + g = (struct mips_got_info *) elf_section_data (sgot)->tdata; + BFD_ASSERT (g != NULL); + + /* If there are no global got symbols, fake the last symbol so + for safety. */ + if (g->global_gotsym) + g->global_gotsym += c; + else + g->global_gotsym = elf_hash_table (info)->dynsymcount - 1; + } } return true; @@ -5666,7 +6753,7 @@ sym->st_value = mips_elf_hash_table (info)->procedure_count; sym->st_shndx = SHN_ABS; } - else if (sym->st_shndx != SHN_UNDEF) + else if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS) { if (h->type == STT_FUNC) sym->st_shndx = SHN_MIPS_TEXT; @@ -5697,6 +6784,11 @@ } } + /* If this is a mips16 symbol, force the value to be even. */ + if (sym->st_other == STO_MIPS16 + && (sym->st_value & 1) != 0) + --sym->st_value; + return true; } @@ -5717,17 +6809,21 @@ sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); + if (sgot == NULL) + g = NULL; + else + { + BFD_ASSERT (elf_section_data (sgot) != NULL); + g = (struct mips_got_info *) elf_section_data (sgot)->tdata; + BFD_ASSERT (g != NULL); + } if (elf_hash_table (info)->dynamic_sections_created) { Elf32_External_Dyn *dyncon, *dynconend; BFD_ASSERT (sdyn != NULL); + BFD_ASSERT (g != NULL); dyncon = (Elf32_External_Dyn *) sdyn->contents; dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); @@ -5811,7 +6907,7 @@ time ((time_t *) &dyn.d_un.d_val); bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; - + case DT_MIPS_ICHECKSUM: /* XXX FIXME: */ break; @@ -5873,13 +6969,14 @@ /* 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. */ - if (sgot->_raw_size > 0) + if (sgot != NULL && sgot->_raw_size > 0) { bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); bfd_put_32 (output_bfd, (bfd_vma) 0x80000000, sgot->contents + 4); } - elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + if (sgot != NULL) + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; { asection *sdynsym; @@ -5982,7 +7079,7 @@ + sizeof (Elf32_External_compact_rel)); cpt.reserved0 = 0; cpt.reserved1 = 0; - bfd_elf32_swap_compact_rel_out (output_bfd, &cpt, + bfd_elf32_swap_compact_rel_out (output_bfd, &cpt, ((Elf32_External_compact_rel *) s->contents)); @@ -6002,7 +7099,7 @@ /* Clean up a first relocation in .rel.dyn. */ s = bfd_get_section_by_name (dynobj, ".rel.dyn"); - if (s != NULL) + if (s != NULL && s->_raw_size > 0) memset (s->contents, 0, sizeof (Elf32_External_Rel)); } @@ -6267,7 +7364,8 @@ _bfd_mips_elf_final_write_processing #define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap -#define bfd_elf32_bfd_is_local_label mips_elf_is_local_label +#define bfd_elf32_bfd_is_local_label_name \ + mips_elf_is_local_label_name #define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents #define bfd_elf32_bfd_link_hash_table_create \ @@ -6284,9 +7382,13 @@ #define elf_backend_check_relocs mips_elf_check_relocs #define elf_backend_adjust_dynamic_symbol \ mips_elf_adjust_dynamic_symbol +#define elf_backend_always_size_sections \ + mips_elf_always_size_sections #define elf_backend_size_dynamic_sections \ mips_elf_size_dynamic_sections #define elf_backend_relocate_section mips_elf_relocate_section +#define elf_backend_link_output_symbol_hook \ + mips_elf_link_output_symbol_hook #define elf_backend_finish_dynamic_symbol \ mips_elf_finish_dynamic_symbol #define elf_backend_finish_dynamic_sections \ diff -urN binutils-2.7/bfd/elf32-ppc.c binutils-2.8/bfd/elf32-ppc.c --- binutils-2.7/bfd/elf32-ppc.c Thu Jul 4 12:18:41 1996 +++ binutils-2.8/bfd/elf32-ppc.c Wed Apr 30 12:56:04 1997 @@ -1,5 +1,5 @@ /* PowerPC-specific support for 32-bit ELF - Copyright 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -104,6 +104,8 @@ static void ppc_elf_info_to_howto PARAMS ((bfd *abfd, arelent *cache_ptr, Elf32_Internal_Rela *dst)); static void ppc_elf_howto_init PARAMS ((void)); +static bfd_reloc_status_type ppc_elf_addr16_ha_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static boolean ppc_elf_set_private_flags PARAMS ((bfd *, flagword)); static boolean ppc_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *)); static boolean ppc_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); @@ -114,6 +116,8 @@ static boolean ppc_elf_section_from_shdr PARAMS ((bfd *, Elf32_Internal_Shdr *, char *)); +static boolean ppc_elf_fake_sections + PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *)); static elf_linker_section_t *ppc_elf_create_linker_section PARAMS ((bfd *abfd, @@ -276,7 +280,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc_elf_addr16_ha_reloc, /* special_function */ "R_PPC_ADDR16_HA", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1052,6 +1056,44 @@ cache_ptr->howto = ppc_elf_howto_table[ELF32_R_TYPE (dst->r_info)]; } +/* Handle the R_PPC_ADDR16_HA reloc. */ + +static bfd_reloc_status_type +ppc_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_vma relocation; + + if (output_bfd != NULL) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + + reloc_entry->addend += (relocation & 0x8000) << 1; + + return bfd_reloc_continue; +} + /* Function to set whether a module needs the -mrelocatable bit set. */ static boolean @@ -1073,10 +1115,8 @@ bfd *ibfd; bfd *obfd; { - /* This function is selected based on the input vector. We only - want to copy information over if the output BFD also uses Elf - format. */ - if (bfd_get_flavour (obfd) != bfd_target_elf_flavour) + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) return true; BFD_ASSERT (!elf_flags_init (obfd) @@ -1112,10 +1152,8 @@ return false; } - /* This function is selected based on the input vector. We only - want to copy information over if the output BFD also uses Elf - format. */ - if (bfd_get_flavour (obfd) != bfd_target_elf_flavour) + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) return true; new_flags = elf_elfheader (ibfd)->e_flags; @@ -1150,8 +1188,11 @@ ("%s: compiled normally and linked with modules compiled with -mrelocatable", bfd_get_filename (ibfd)); } - else if ((new_flags & EF_PPC_RELOCATABLE_LIB) != 0) - elf_elfheader (obfd)->e_flags |= EF_PPC_RELOCATABLE_LIB; + /* If -mrelocatable-lib is linked with an object without -mrelocatable-lib, turn off + the -mrelocatable-lib, since at least one module isn't relocatable. */ + else if ((old_flags & EF_PPC_RELOCATABLE_LIB) != 0 + && (new_flags & EF_PPC_RELOCATABLE_LIB) == 0) + elf_elfheader (obfd)->e_flags &= ~EF_PPC_RELOCATABLE_LIB; /* Do not warn about eabi vs. V.4 mismatch, just or in the bit if any module uses it */ @@ -1210,7 +1251,7 @@ /* Set up any other section flags and such that may be necessary. */ -boolean +static boolean ppc_elf_fake_sections (abfd, shdr, asect) bfd *abfd; Elf32_Internal_Shdr *shdr; @@ -1251,7 +1292,8 @@ defaults.which = which; defaults.hole_written_p = false; defaults.alignment = 2; - defaults.flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY; + defaults.flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED); switch (which) { @@ -1432,6 +1474,15 @@ /* Make room for this entry. */ s->_raw_size += PLT_ENTRY_SIZE; +#if 0 + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + + s = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += 4; +#endif + /* We also need to make an entry in the .rela.plt section. */ s = bfd_get_section_by_name (dynobj, ".rela.plt"); @@ -1476,20 +1527,17 @@ s = bfd_get_section_by_name (dynobj, ".dynbss"); BFD_ASSERT (s != NULL); - /* If the symbol is currently defined in the .bss section of the - dynamic object, then it is OK to simply initialize it to zero. - If the symbol is in some other section, we must generate a - R_PPC_COPY reloc to tell the dynamic linker to copy the initial - value out of the dynamic object and into the runtime process - image. We need to remember the offset into the .rela.bss section - we are going to use. */ - if ((h->root.u.def.section->flags & SEC_LOAD) != 0) + /* We must generate a R_PPC_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { asection *srel; srel = bfd_get_section_by_name (dynobj, ".rela.bss"); BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf32_External_Rel); + srel->_raw_size += sizeof (Elf32_External_Rela); h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; } @@ -1570,17 +1618,11 @@ s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } - - /* Make space for the trailing nop in .plt. */ - s = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (s != NULL); - if (s->_raw_size > 0) - s->_raw_size += 4; } else { /* We may have created entries in the .rela.got, .rela.sdata, and - .rela.sdata2 section2. However, if we are not creating the + .rela.sdata2 sections. However, if we are not creating the dynamic sections, we will not actually use these entries. Reset the size of .rela.got, et al, which will cause it to get stripped from the output file below. */ @@ -1606,7 +1648,7 @@ const char *name; boolean strip; - if ((s->flags & SEC_IN_MEMORY) == 0) + if ((s->flags & SEC_LINKER_CREATED) == 0) continue; /* It's OK to base decisions on the section name, because none @@ -1652,6 +1694,8 @@ than .rel.plt. */ if (strcmp (name, ".rela.plt") != 0) { + const char *outname; + relocs = true; /* If this relocation section applies to a read only @@ -1659,7 +1703,9 @@ entry. The entries in the .rel.plt section really apply to the .got section, which we created ourselves and so know is not readonly. */ - target = bfd_get_section_by_name (output_bfd, name + 4); + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 4); if (target != NULL && (target->flags & SEC_READONLY) != 0) reltext = true; @@ -1780,8 +1826,8 @@ struct elf_link_hash_entry **sym_hashes; const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; + bfd_vma *local_got_offsets; elf_linker_section_t *got; - elf_linker_section_t *plt; elf_linker_section_t *sdata; elf_linker_section_t *sdata2; asection *sreloc; @@ -1795,14 +1841,9 @@ bfd_get_filename (abfd)); #endif - /* Create the linker generated sections all the time so that the special - symbols are created. */ - if ((got = elf_linker_section (abfd, LINKER_SECTION_GOT)) == NULL) - { - got = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_GOT); - if (!got) - ret = false; - } + /* Create the linker generated sections all the time so that the + special symbols are created. The .got section is an exception, + so that we don't waste space allocating it when it is not needed. */ #if 0 if ((plt = elf_linker_section (abfd, LINKER_SECTION_PLT)) == NULL) @@ -1828,9 +1869,17 @@ ret = false; } + if ((got = elf_linker_section (abfd, LINKER_SECTION_GOT)) == NULL) + { + got = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_GOT); + if (!got) + ret = false; + } + dynobj = elf_hash_table (info)->dynobj; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); + local_got_offsets = elf_local_got_offsets (abfd); sreloc = NULL; @@ -1877,6 +1926,18 @@ break; } + if (got == NULL + && (got = elf_linker_section (abfd, LINKER_SECTION_GOT)) == NULL) + { + got = ppc_elf_create_linker_section (abfd, info, + LINKER_SECTION_GOT); + if (!got) + { + ret = false; + break; + } + } + if (got->rel_section == NULL && (h != NULL || info->shared) && !_bfd_elf_make_linker_section_rela (dynobj, got, 2)) @@ -1901,6 +1962,18 @@ break; } + if (got == NULL + && (got = elf_linker_section (abfd, LINKER_SECTION_GOT)) == NULL) + { + got = ppc_elf_create_linker_section (abfd, info, + LINKER_SECTION_GOT); + if (!got) + { + ret = false; + break; + } + } + if (got->rel_section == NULL && (h != NULL || info->shared) && !_bfd_elf_make_linker_section_rela (dynobj, got, 2)) @@ -1967,6 +2040,10 @@ case R_PPC_SECTOFF_HA: break; + /* This refers only to functions defined in the shared library */ + case R_PPC_LOCAL24PC: + break; + /* When creating a shared object, we must copy these relocs into the output file. We create a reloc section in dynobj and make room for the reloc. */ @@ -1984,9 +2061,12 @@ /* fall through */ default: - if (info->shared - && (sec->flags & SEC_ALLOC) != 0) + if (info->shared) { +#ifdef DEBUG + fprintf (stderr, "ppc_elf_check_relocs need to create relocation for %s\n", + (h && h->root.root.string) ? h->root.root.string : ""); +#endif if (sreloc == NULL) { const char *name; @@ -2015,6 +2095,7 @@ | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY)) || ! bfd_set_section_alignment (dynobj, sreloc, 2)) { @@ -2056,8 +2137,28 @@ elf_linker_section_t *sdata = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA); if (!sdata->bss_section) { - sdata->bss_section = bfd_make_section (elf_hash_table (info)->dynobj, sdata->bss_name); - sdata->bss_section->flags = (sdata->bss_section->flags & ~SEC_LOAD) | SEC_IS_COMMON; + /* We don't go through bfd_make_section, because we don't + want to attach this common section to DYNOBJ. The linker + will move the symbols to the appropriate output section + when it defines common symbols. */ + sdata->bss_section = ((asection *) + bfd_zalloc (abfd, sizeof (asection))); + if (sdata->bss_section == NULL) + return false; + sdata->bss_section->name = sdata->bss_name; + sdata->bss_section->flags = SEC_IS_COMMON; + sdata->bss_section->output_section = sdata->bss_section; + sdata->bss_section->symbol = + (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + sdata->bss_section->symbol_ptr_ptr = + (asymbol **) bfd_zalloc (abfd, sizeof (asymbol *)); + if (sdata->bss_section->symbol == NULL + || sdata->bss_section->symbol_ptr_ptr == NULL) + return false; + sdata->bss_section->symbol->name = sdata->bss_name; + sdata->bss_section->symbol->flags = BSF_SECTION_SYM; + sdata->bss_section->symbol->section = sdata->bss_section; + *sdata->bss_section->symbol_ptr_ptr = sdata->bss_section->symbol; } *secp = sdata->bss_section; @@ -2344,6 +2445,7 @@ elf_linker_section_t *sdata2 = (dynobj) ? elf_linker_section (dynobj, LINKER_SECTION_SDATA2) : NULL; Elf_Internal_Rela *rel = relocs; Elf_Internal_Rela *relend = relocs + input_section->reloc_count; + asection *sreloc = NULL; boolean ret = true; long insn; @@ -2436,11 +2538,62 @@ || h->root.type == bfd_link_hash_defweak) { sec = h->root.u.def.section; - if (!sec || !sec->output_section) + if ((r_type == R_PPC_PLT32 + && h->plt_offset != (bfd_vma) -1) + || ((r_type == R_PPC_GOT16 + || r_type == R_PPC_GOT16_LO + || r_type == R_PPC_GOT16_HI + || r_type == R_PPC_GOT16_HA) + && elf_hash_table (info)->dynamic_sections_created + && (! info->shared + || ! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || (info->shared + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + && (input_section->flags & SEC_ALLOC) != 0 + && (r_type == R_PPC_ADDR32 + || r_type == R_PPC_ADDR24 + || r_type == R_PPC_ADDR16 + || r_type == R_PPC_ADDR16_LO + || r_type == R_PPC_ADDR16_HI + || r_type == R_PPC_ADDR16_HA + || r_type == R_PPC_ADDR14 + || r_type == R_PPC_ADDR14_BRTAKEN + || r_type == R_PPC_ADDR14_BRNTAKEN + || r_type == R_PPC_PLTREL24 + || r_type == R_PPC_COPY + || r_type == R_PPC_GLOB_DAT + || r_type == R_PPC_JMP_SLOT + || r_type == R_PPC_UADDR32 + || r_type == R_PPC_UADDR16 + || r_type == R_PPC_REL32 + || r_type == R_PPC_SDAREL16 + || r_type == R_PPC_EMB_NADDR32 + || r_type == R_PPC_EMB_NADDR16 + || r_type == R_PPC_EMB_NADDR16_LO + || r_type == R_PPC_EMB_NADDR16_HI + || r_type == R_PPC_EMB_NADDR16_HA + || r_type == R_PPC_EMB_SDAI16 + || r_type == R_PPC_EMB_SDA2I16 + || r_type == R_PPC_EMB_SDA2REL + || r_type == R_PPC_EMB_SDA21 + || r_type == R_PPC_EMB_MRKREF + || r_type == R_PPC_EMB_BIT_FLD + || r_type == R_PPC_EMB_RELSDA + || ((r_type == R_PPC_REL24 + || r_type == R_PPC_REL14 + || r_type == R_PPC_REL14_BRTAKEN + || r_type == R_PPC_REL14_BRNTAKEN + || r_type == R_PPC_RELATIVE) + && strcmp (h->root.root.string, + "_GLOBAL_OFFSET_TABLE_") != 0)))) { - (*_bfd_error_handler) ("%s: Section in shared library for symbol %s\n", - bfd_get_filename (input_bfd), - sym_name); + /* In these cases, we don't need the relocation + value. We check specially because in some + obscure cases sec->output_section will be NULL. */ relocation = 0; } else @@ -2476,6 +2629,17 @@ continue; /* relocations that need no special processing */ + case (int)R_PPC_LOCAL24PC: + break; + + case (int)R_PPC_REL24: + case (int)R_PPC_REL14: + if (h != NULL + && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + break; + /* fall through */ + + /* Relocations that need to be propigated if this is a shared object */ case (int)R_PPC_NONE: case (int)R_PPC_ADDR32: case (int)R_PPC_ADDR24: @@ -2483,11 +2647,134 @@ case (int)R_PPC_ADDR16_LO: case (int)R_PPC_ADDR16_HI: case (int)R_PPC_ADDR14: - case (int)R_PPC_REL24: - case (int)R_PPC_REL14: case (int)R_PPC_UADDR32: case (int)R_PPC_UADDR16: case (int)R_PPC_REL32: + case (int)R_PPC_PLTREL24: + if (info->shared) + { + Elf_Internal_Rela outrel; + boolean skip; + +#ifdef DEBUG + fprintf (stderr, "ppc_elf_relocate_section need to create relocation for %s\n", + (h && h->root.root.string) ? h->root.root.string : ""); +#endif + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return false; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + skip = false; + + if (elf_section_data (input_section)->stab_info == NULL) + outrel.r_offset = rel->r_offset; + else + { + bfd_vma off; + + off = (_bfd_stab_section_offset + (output_bfd, &elf_hash_table (info)->stab_info, + input_section, + &elf_section_data (input_section)->stab_info, + rel->r_offset)); + if (off == (bfd_vma) -1) + skip = true; + outrel.r_offset = off; + } + + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + /* h->dynindx may be -1 if this symbol was marked to + become local. */ + else if (h != NULL + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + { + BFD_ASSERT (h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + outrel.r_addend = rel->r_addend; + } + else + { + if (r_type == R_PPC_ADDR32) + { + outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + long indx; + + if (h == NULL) + sec = local_sections[r_symndx]; + else + { + BFD_ASSERT (h->root.type == bfd_link_hash_defined + || (h->root.type + == bfd_link_hash_defweak)); + sec = h->root.u.def.section; + } + if (sec != NULL && bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { + bfd_set_error (bfd_error_bad_value); + return false; + } + else + { + asection *osec; + + osec = sec->output_section; + indx = elf_section_data (osec)->dynindx; + if (indx == 0) + abort (); + } + + outrel.r_info = ELF32_R_INFO (indx, r_type); + outrel.r_addend = relocation + rel->r_addend; + } + } + + bfd_elf32_swap_reloca_out (output_bfd, &outrel, + (((Elf32_External_Rela *) + sreloc->contents) + + sreloc->reloc_count)); + ++sreloc->reloc_count; + + /* This reloc will be computed at runtime, so there's no + need to do anything now, unless this is a RELATIVE + reloc in an unallocated section. */ + if (skip + || (input_section->flags & SEC_ALLOC) != 0 + || ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE) + continue; + } break; /* branch taken prediction relocations */ @@ -2684,12 +2971,10 @@ case (int)R_PPC_EMB_MRKREF: continue; - case (int)R_PPC_PLTREL24: case (int)R_PPC_COPY: case (int)R_PPC_GLOB_DAT: case (int)R_PPC_JMP_SLOT: case (int)R_PPC_RELATIVE: - case (int)R_PPC_LOCAL24PC: case (int)R_PPC_PLT32: case (int)R_PPC_PLTREL32: case (int)R_PPC_PLT16_LO: diff -urN binutils-2.7/bfd/elf32-sh.c binutils-2.8/bfd/elf32-sh.c --- binutils-2.7/bfd/elf32-sh.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/elf32-sh.c Wed Apr 30 12:56:04 1997 @@ -0,0 +1,1905 @@ +/* Hitachi SH specific support for 32-bit ELF + Copyright 1996 Free Software Foundation, Inc. + Contributed by Ian Lance Taylor, Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" + +static bfd_reloc_status_type sh_elf_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type sh_elf_ignore_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type *sh_elf_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void sh_elf_info_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static boolean sh_elf_relax_section + PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); +static boolean sh_elf_relax_delete_bytes + PARAMS ((bfd *, asection *, bfd_vma, int)); +static boolean sh_elf_align_loads + PARAMS ((bfd *, asection *, Elf_Internal_Rela *, bfd_byte *, boolean *)); +static boolean sh_elf_swap_insns + PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); +static boolean sh_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_byte *sh_elf_get_relocated_section_contents + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, boolean, asymbol **)); + +enum sh_reloc_type +{ + R_SH_NONE = 0, + R_SH_DIR32, + R_SH_REL32, + R_SH_DIR8WPN, + R_SH_IND12W, + R_SH_DIR8WPL, + R_SH_DIR8WPZ, + R_SH_DIR8BP, + R_SH_DIR8W, + R_SH_DIR8L, + FIRST_INVALID_RELOC, + LAST_INVALID_RELOC = 24, + /* The remaining relocs are a GNU extension used for relaxation. We + use the same constants as COFF uses, not that it really matters. */ + R_SH_SWITCH16 = 25, + R_SH_SWITCH32, + R_SH_USES, + R_SH_COUNT, + R_SH_ALIGN, + R_SH_CODE, + R_SH_DATA, + R_SH_LABEL, + R_SH_max +}; + +static reloc_howto_type sh_elf_howto_table[] = +{ + /* No relocation. */ + HOWTO (R_SH_NONE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + sh_elf_reloc, /* special_function */ + "R_SH_NONE", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + false), /* pcrel_offset */ + + /* 32 bit absolute relocation. Setting partial_inplace to true and + src_mask to a non-zero value is similar to the COFF toolchain. */ + HOWTO (R_SH_DIR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_elf_reloc, /* special_function */ + "R_SH_DIR32", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* 32 bit PC relative relocation. */ + HOWTO (R_SH_REL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_reloc, /* special_function */ + "R_SH_REL32", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + true), /* pcrel_offset */ + + /* 8 bit PC relative branch divided by 2. */ + HOWTO (R_SH_DIR8WPN, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_reloc, /* special_function */ + "R_SH_DIR8WPN", /* name */ + true, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + true), /* pcrel_offset */ + + /* 12 bit PC relative branch divided by 2. */ + HOWTO (R_SH_IND12W, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_reloc, /* special_function */ + "R_SH_IND12W", /* name */ + true, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + true), /* pcrel_offset */ + + /* 8 bit unsigned PC relative divided by 4. */ + HOWTO (R_SH_DIR8WPL, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_reloc, /* special_function */ + "R_SH_DIR8WPL", /* name */ + true, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + true), /* pcrel_offset */ + + /* 8 bit unsigned PC relative divided by 2. */ + HOWTO (R_SH_DIR8WPZ, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_reloc, /* special_function */ + "R_SH_DIR8WPZ", /* name */ + true, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + true), /* pcrel_offset */ + + /* 8 bit GBR relative. FIXME: This only makes sense if we have some + special symbol for the GBR relative area, and that is not + implemented. */ + HOWTO (R_SH_DIR8BP, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_reloc, /* special_function */ + "R_SH_DIR8BP", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + true), /* pcrel_offset */ + + /* 8 bit GBR relative divided by 2. FIXME: This only makes sense if + we have some special symbol for the GBR relative area, and that + is not implemented. */ + HOWTO (R_SH_DIR8W, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_reloc, /* special_function */ + "R_SH_DIR8W", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + true), /* pcrel_offset */ + + /* 8 bit GBR relative divided by 4. FIXME: This only makes sense if + we have some special symbol for the GBR relative area, and that + is not implemented. */ + HOWTO (R_SH_DIR8L, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_reloc, /* special_function */ + "R_SH_DIR8L", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + true), /* pcrel_offset */ + + { 10 }, + { 11 }, + { 12 }, + { 13 }, + { 14 }, + { 15 }, + { 16 }, + { 17 }, + { 18 }, + { 19 }, + { 20 }, + { 21 }, + { 22 }, + { 23 }, + { 24 }, + + /* The remaining relocs are a GNU extension used for relaxing. The + final pass of the linker never needs to do anything with any of + these relocs. Any required operations are handled by the + relaxation code. */ + + /* A 16 bit switch table entry. This is generated for an expression + such as ``.word L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SWITCH16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + true), /* pcrel_offset */ + + /* A 32 bit switch table entry. This is generated for an expression + such as ``.long L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SWITCH32", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + true), /* pcrel_offset */ + + /* Indicates a .uses pseudo-op. The compiler will generate .uses + pseudo-ops when it finds a function call which can be relaxed. + The offset field holds the PC relative offset to the instruction + which loads the register used in the function call. */ + HOWTO (R_SH_USES, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_USES", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + true), /* pcrel_offset */ + + /* The assembler will generate this reloc for addresses referred to + by the register loads associated with USES relocs. The offset + field holds the number of times the address is referenced in the + object file. */ + HOWTO (R_SH_COUNT, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_COUNT", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + true), /* pcrel_offset */ + + /* Indicates an alignment statement. The offset field is the power + of 2 to which subsequent portions of the object file must be + aligned. */ + HOWTO (R_SH_ALIGN, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_ALIGN", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + true), /* pcrel_offset */ + + /* The assembler will generate this reloc before a block of + instructions. A section should be processed as assumining it + contains data, unless this reloc is seen. */ + HOWTO (R_SH_CODE, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_CODE", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + true), /* pcrel_offset */ + + /* The assembler will generate this reloc after a block of + instructions when it sees data that is not instructions. */ + HOWTO (R_SH_DATA, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DATA", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + true), /* pcrel_offset */ + + /* The assembler generates this reloc for each label within a block + of instructions. This permits the linker to avoid swapping + instructions which are the targets of branches. */ + HOWTO (R_SH_LABEL, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_LABEL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + true) /* pcrel_offset */ +}; + +/* This function is used for normal relocs. This is like the COFF + function, and is almost certainly incorrect for other ELF targets. */ + +static bfd_reloc_status_type +sh_elf_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, + error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol_in; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + unsigned long insn; + bfd_vma sym_value; + enum sh_reloc_type r_type; + bfd_vma addr = reloc_entry->address; + bfd_byte *hit_data = addr + (bfd_byte *) data; + + r_type = (enum sh_reloc_type) reloc_entry->howto->type; + + if (output_bfd != NULL) + { + /* Partial linking--do nothing. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Almost all relocs have to do with relaxing. If any work must be + done for them, it has been done in sh_relax_section. */ + if (r_type != R_SH_DIR32 + && (r_type != R_SH_IND12W + || (symbol_in->flags & BSF_LOCAL) != 0)) + return bfd_reloc_ok; + + if (symbol_in != NULL + && bfd_is_und_section (symbol_in->section)) + return bfd_reloc_undefined; + + if (bfd_is_com_section (symbol_in->section)) + sym_value = 0; + else + sym_value = (symbol_in->value + + symbol_in->section->output_section->vma + + symbol_in->section->output_offset); + + switch (r_type) + { + case R_SH_DIR32: + insn = bfd_get_32 (abfd, hit_data); + insn += sym_value + reloc_entry->addend; + bfd_put_32 (abfd, insn, hit_data); + break; + case R_SH_IND12W: + insn = bfd_get_16 (abfd, hit_data); + sym_value += reloc_entry->addend; + sym_value -= (input_section->output_section->vma + + input_section->output_offset + + addr + + 4); + sym_value += (insn & 0xfff) << 1; + if (insn & 0x800) + sym_value -= 0x1000; + insn = (insn & 0xf000) | (sym_value & 0xfff); + bfd_put_16 (abfd, insn, hit_data); + if (sym_value < (bfd_vma) -0x1000 || sym_value >= 0x1000) + return bfd_reloc_overflow; + break; + default: + abort (); + break; + } + + return bfd_reloc_ok; +} + +/* This function is used for relocs which are only used for relaxing, + which the linker should otherwise ignore. */ + +static bfd_reloc_status_type +sh_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + if (output_bfd != NULL) + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; +} + +/* This structure is used to map BFD reloc codes to SH ELF relocs. */ + +struct elf_reloc_map +{ + unsigned char bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +/* An array mapping BFD reloc codes to SH ELF relocs. */ + +static const struct elf_reloc_map sh_reloc_map[] = +{ + { BFD_RELOC_NONE, R_SH_NONE }, + { BFD_RELOC_32, R_SH_DIR32 }, + { BFD_RELOC_CTOR, R_SH_DIR32 }, + { BFD_RELOC_32_PCREL, R_SH_REL32 }, + { BFD_RELOC_SH_PCDISP8BY2, R_SH_DIR8WPN }, + { BFD_RELOC_SH_PCDISP12BY2, R_SH_IND12W }, + { BFD_RELOC_SH_PCRELIMM8BY2, R_SH_DIR8WPZ }, + { BFD_RELOC_SH_PCRELIMM8BY4, R_SH_DIR8WPL }, + { BFD_RELOC_SH_SWITCH16, R_SH_SWITCH16 }, + { BFD_RELOC_SH_SWITCH32, R_SH_SWITCH32 }, + { BFD_RELOC_SH_USES, R_SH_USES }, + { BFD_RELOC_SH_COUNT, R_SH_COUNT }, + { BFD_RELOC_SH_ALIGN, R_SH_ALIGN }, + { BFD_RELOC_SH_CODE, R_SH_CODE }, + { BFD_RELOC_SH_DATA, R_SH_DATA }, + { BFD_RELOC_SH_LABEL, R_SH_LABEL } +}; + +/* Given a BFD reloc code, return the howto structure for the + corresponding SH ELf reloc. */ + +static reloc_howto_type * +sh_elf_reloc_type_lookup (abfd, code) + bfd *abfd; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; i < sizeof (sh_reloc_map) / sizeof (struct elf_reloc_map); i++) + { + if (sh_reloc_map[i].bfd_reloc_val == code) + return &sh_elf_howto_table[(int) sh_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Given an ELF reloc, fill in the howto field of a relent. */ + +static void +sh_elf_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r; + + r = ELF32_R_TYPE (dst->r_info); + + BFD_ASSERT (r < (unsigned int) R_SH_max); + BFD_ASSERT (r < FIRST_INVALID_RELOC || r > LAST_INVALID_RELOC); + + cache_ptr->howto = &sh_elf_howto_table[r]; +} + +/* This function handles relaxing for SH ELF. See the corresponding + function in coff-sh.c for a description of what this does. FIXME: + There is a lot of duplication here between this code and the COFF + specific code. The format of relocs and symbols is wound deeply + into this code, but it would still be better if the duplication + could be eliminated somehow. Note in particular that although both + functions use symbols like R_SH_CODE, those symbols have different + values; in coff-sh.c they come from include/coff/sh.h, whereas here + they come from enum sh_reloc_type in this file. */ + +static boolean +sh_elf_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_Rela *internal_relocs; + Elf_Internal_Rela *free_relocs = NULL; + boolean have_code; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + bfd_byte *free_contents = NULL; + Elf32_External_Sym *extsyms = NULL; + Elf32_External_Sym *free_extsyms = NULL; + + *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; + + internal_relocs = (_bfd_elf32_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + if (! link_info->keep_memory) + free_relocs = internal_relocs; + + have_code = false; + + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma laddr, paddr, symval; + unsigned short insn; + Elf_Internal_Rela *irelfn, *irelscan, *irelcount; + bfd_signed_vma foff; + + if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_CODE) + have_code = true; + + if (ELF32_R_TYPE (irel->r_info) != (int) R_SH_USES) + continue; + + /* Get the section contents. */ + if (contents == NULL) + { + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + free_contents = contents; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* The r_addend field of the R_SH_USES reloc will point us to + the register load. The 4 is because the r_addend field is + computed as though it were a jump offset, which are based + from 4 bytes after the jump instruction. */ + laddr = irel->r_offset + 4 + irel->r_addend; + if (laddr >= sec->_raw_size) + { + (*_bfd_error_handler) ("%s: 0x%lx: warning: bad R_SH_USES offset", + bfd_get_filename (abfd), + (unsigned long) irel->r_offset); + continue; + } + insn = bfd_get_16 (abfd, contents + laddr); + + /* If the instruction is not mov.l NN,rN, we don't know what to + do. */ + if ((insn & 0xf000) != 0xd000) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x", + bfd_get_filename (abfd), (unsigned long) irel->r_offset, insn)); + continue; + } + + /* Get the address from which the register is being loaded. The + displacement in the mov.l instruction is quadrupled. It is a + displacement from four bytes after the movl instruction, but, + before adding in the PC address, two least significant bits + of the PC are cleared. We assume that the section is aligned + on a four byte boundary. */ + paddr = insn & 0xff; + paddr *= 4; + paddr += (laddr + 4) &~ 3; + if (paddr >= sec->_raw_size) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: bad R_SH_USES load offset", + bfd_get_filename (abfd), (unsigned long) irel->r_offset)); + continue; + } + + /* Get the reloc for the address from which the register is + being loaded. This reloc will tell us which function is + actually being called. */ + for (irelfn = internal_relocs; irelfn < irelend; irelfn++) + if (irelfn->r_offset == paddr + && ELF32_R_TYPE (irelfn->r_info) == (int) R_SH_DIR32) + break; + if (irelfn >= irelend) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: could not find expected reloc", + bfd_get_filename (abfd), (unsigned long) paddr)); + continue; + } + + /* Read the local symbols. */ + if (extsyms == NULL) + { + if (symtab_hdr->contents != NULL) + extsyms = (Elf32_External_Sym *) symtab_hdr->contents; + else + { + extsyms = ((Elf32_External_Sym *) + bfd_malloc (symtab_hdr->sh_info + * sizeof (Elf32_External_Sym))); + if (extsyms == NULL) + goto error_return; + free_extsyms = extsyms; + if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_read (extsyms, sizeof (Elf32_External_Sym), + symtab_hdr->sh_info, abfd) + != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) + goto error_return; + } + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irelfn->r_info) < symtab_hdr->sh_info) + { + Elf_Internal_Sym isym; + + /* A local symbol. */ + bfd_elf32_swap_symbol_in (abfd, + extsyms + ELF32_R_SYM (irelfn->r_info), + &isym); + + if (isym.st_shndx != _bfd_elf_section_from_bfd_section (abfd, sec)) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: symbol in unexpected section", + bfd_get_filename (abfd), (unsigned long) paddr)); + continue; + } + + symval = (isym.st_value + + sec->output_section->vma + + sec->output_offset); + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + indx = ELF32_R_SYM (irelfn->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + { + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + } + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + + symval += bfd_get_32 (abfd, contents + paddr); + + /* See if this function call can be shortened. */ + foff = (symval + - (irel->r_offset + + sec->output_section->vma + + sec->output_offset + + 4)); + if (foff < -0x1000 || foff >= 0x1000) + { + /* After all that work, we can't shorten this function call. */ + continue; + } + + /* Shorten the function call. */ + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* Replace the jsr with a bsr. */ + + /* Change the R_SH_USES reloc into an R_SH_IND12W reloc, and + replace the jsr with a bsr. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irelfn->r_info), R_SH_IND12W); + if (ELF32_R_SYM (irelfn->r_info) < symtab_hdr->sh_info) + { + /* If this needs to be changed because of future relaxing, + it will be handled here like other internal IND12W + relocs. */ + bfd_put_16 (abfd, + 0xb000 | ((foff >> 1) & 0xfff), + contents + irel->r_offset); + } + else + { + /* We can't fully resolve this yet, because the external + symbol value may be changed by future relaxing. We let + the final link phase handle it. */ + bfd_put_16 (abfd, 0xb000, contents + irel->r_offset); + } + + /* See if there is another R_SH_USES reloc referring to the same + register load. */ + for (irelscan = internal_relocs; irelscan < irelend; irelscan++) + if (ELF32_R_TYPE (irelscan->r_info) == (int) R_SH_USES + && laddr == irelscan->r_offset + 4 + irelscan->r_addend) + break; + if (irelscan < irelend) + { + /* Some other function call depends upon this register load, + and we have not yet converted that function call. + Indeed, we may never be able to convert it. There is + nothing else we can do at this point. */ + continue; + } + + /* Look for a R_SH_COUNT reloc on the location where the + function address is stored. Do this before deleting any + bytes, to avoid confusion about the address. */ + for (irelcount = internal_relocs; irelcount < irelend; irelcount++) + if (irelcount->r_offset == paddr + && ELF32_R_TYPE (irelcount->r_info) == (int) R_SH_COUNT) + break; + + /* Delete the register load. */ + if (! sh_elf_relax_delete_bytes (abfd, sec, laddr, 2)) + goto error_return; + + /* That will change things, so, just in case it permits some + other function call to come within range, we should relax + again. Note that this is not required, and it may be slow. */ + *again = true; + + /* Now check whether we got a COUNT reloc. */ + if (irelcount >= irelend) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: could not find expected COUNT reloc", + bfd_get_filename (abfd), (unsigned long) paddr)); + continue; + } + + /* The number of uses is stored in the r_addend field. We've + just deleted one. */ + if (irelcount->r_addend == 0) + { + ((*_bfd_error_handler) ("%s: 0x%lx: warning: bad count", + bfd_get_filename (abfd), + (unsigned long) paddr)); + continue; + } + + --irelcount->r_addend; + + /* If there are no more uses, we can delete the address. Reload + the address from irelfn, in case it was changed by the + previous call to sh_elf_relax_delete_bytes. */ + if (irelcount->r_addend == 0) + { + if (! sh_elf_relax_delete_bytes (abfd, sec, irelfn->r_offset, 4)) + goto error_return; + } + + /* We've done all we can with that function call. */ + } + + /* Look for load and store instructions that we can align on four + byte boundaries. */ + if (have_code) + { + boolean swapped; + + /* Get the section contents. */ + if (contents == NULL) + { + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + free_contents = contents; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + if (! sh_elf_align_loads (abfd, sec, internal_relocs, contents, + &swapped)) + goto error_return; + + if (swapped) + { + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + } + } + + if (free_relocs != NULL) + { + free (free_relocs); + free_relocs = NULL; + } + + if (free_contents != NULL) + { + if (! link_info->keep_memory) + free (free_contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + free_contents = NULL; + } + + if (free_extsyms != NULL) + { + if (! link_info->keep_memory) + free (free_extsyms); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = extsyms; + } + free_extsyms = NULL; + } + + return true; + + error_return: + if (free_relocs != NULL) + free (free_relocs); + if (free_contents != NULL) + free (free_contents); + if (free_extsyms != NULL) + free (free_extsyms); + return false; +} + +/* Delete some bytes from a section while relaxing. FIXME: There is a + lot of duplication between this function and sh_relax_delete_bytes + in coff-sh.c. */ + +static boolean +sh_elf_relax_delete_bytes (abfd, sec, addr, count) + bfd *abfd; + asection *sec; + bfd_vma addr; + int count; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf32_External_Sym *extsyms; + int shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Rela *irelalign; + bfd_vma toaddr; + Elf32_External_Sym *esym, *esymend; + struct elf_link_hash_entry **sym_hash, **sym_hash_end; + asection *o; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + extsyms = (Elf32_External_Sym *) symtab_hdr->contents; + + shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + /* The deletion must stop at the next ALIGN reloc for an aligment + power larger than the number of bytes we are deleting. */ + + irelalign = NULL; + toaddr = sec->_cooked_size; + + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + for (; irel < irelend; irel++) + { + if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_ALIGN + && irel->r_offset > addr + && count < (1 << irel->r_addend)) + { + irelalign = irel; + toaddr = irel->r_offset; + break; + } + } + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, toaddr - addr - count); + if (irelalign == NULL) + sec->_cooked_size -= count; + else + { + int i; + +#define NOP_OPCODE (0x0009) + + BFD_ASSERT ((count & 1) == 0); + for (i = 0; i < count; i += 2) + bfd_put_16 (abfd, NOP_OPCODE, contents + toaddr - count + i); + } + + /* Adjust all the relocs. */ + for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + { + bfd_vma nraddr, start, stop; + int insn = 0; + Elf_Internal_Sym sym; + int off, adjust, oinsn; + bfd_signed_vma voff; + boolean overflow; + + /* Get the new reloc address. */ + nraddr = irel->r_offset; + if ((irel->r_offset > addr + && irel->r_offset < toaddr) + || (ELF32_R_TYPE (irel->r_info) == (int) R_SH_ALIGN + && irel->r_offset == toaddr)) + nraddr -= count; + + /* See if this reloc was for the bytes we have deleted, in which + case we no longer care about it. Don't delete relocs which + represent addresses, though. */ + if (irel->r_offset >= addr + && irel->r_offset < addr + count + && ELF32_R_TYPE (irel->r_info) != (int) R_SH_ALIGN + && ELF32_R_TYPE (irel->r_info) != (int) R_SH_CODE + && ELF32_R_TYPE (irel->r_info) != (int) R_SH_DATA) + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + (int) R_SH_NONE); + + /* If this is a PC relative reloc, see if the range it covers + includes the bytes we have deleted. */ + switch ((enum sh_reloc_type) ELF32_R_TYPE (irel->r_info)) + { + default: + break; + + case R_SH_DIR8WPN: + case R_SH_IND12W: + case R_SH_DIR8WPZ: + case R_SH_DIR8WPL: + start = irel->r_offset; + insn = bfd_get_16 (abfd, contents + nraddr); + break; + } + + switch ((enum sh_reloc_type) ELF32_R_TYPE (irel->r_info)) + { + default: + start = stop = addr; + break; + + case R_SH_DIR32: + /* If this reloc is against a symbol defined in this + section, and the symbol will not be adjusted below, we + must check the addend to see it will put the value in + range to be adjusted, and hence must be changed. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + bfd_elf32_swap_symbol_in (abfd, + extsyms + ELF32_R_SYM (irel->r_info), + &sym); + if (sym.st_shndx == shndx + && (sym.st_value <= addr + || sym.st_value >= toaddr)) + { + bfd_vma val; + + val = bfd_get_32 (abfd, contents + nraddr); + val += sym.st_value; + if (val >= addr && val < toaddr) + bfd_put_32 (abfd, val - count, contents + nraddr); + } + } + start = stop = addr; + break; + + case R_SH_DIR8WPN: + off = insn & 0xff; + if (off & 0x80) + off -= 0x100; + stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); + break; + + case R_SH_IND12W: + if (ELF32_R_SYM (irel->r_info) >= symtab_hdr->sh_info) + start = stop = addr; + else + { + off = insn & 0xfff; + if (off & 0x800) + off -= 0x1000; + stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); + } + break; + + case R_SH_DIR8WPZ: + off = insn & 0xff; + stop = start + 4 + off * 2; + break; + + case R_SH_DIR8WPL: + off = insn & 0xff; + stop = (start &~ (bfd_vma) 3) + 4 + off * 4; + break; + + case R_SH_SWITCH16: + case R_SH_SWITCH32: + /* These relocs types represent + .word L2-L1 + The r_offset field holds the difference between the reloc + address and L1. That is the start of the reloc, and + adding in the contents gives us the top. We must adjust + both the r_offset field and the section contents. */ + + start = irel->r_offset; + stop = (bfd_vma) ((bfd_signed_vma) start - (long) irel->r_addend); + + if (start > addr + && start < toaddr + && (stop <= addr || stop >= toaddr)) + irel->r_addend += count; + else if (stop > addr + && stop < toaddr + && (start <= addr || start >= toaddr)) + irel->r_addend -= count; + + start = stop; + + if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_SWITCH16) + voff = bfd_get_signed_16 (abfd, contents + nraddr); + else + voff = bfd_get_signed_32 (abfd, contents + nraddr); + stop = (bfd_vma) ((bfd_signed_vma) start + voff); + + break; + + case R_SH_USES: + start = irel->r_offset; + stop = (bfd_vma) ((bfd_signed_vma) start + + (long) irel->r_addend + + 4); + break; + } + + if (start > addr + && start < toaddr + && (stop <= addr || stop >= toaddr)) + adjust = count; + else if (stop > addr + && stop < toaddr + && (start <= addr || start >= toaddr)) + adjust = - count; + else + adjust = 0; + + if (adjust != 0) + { + oinsn = insn; + overflow = false; + switch ((enum sh_reloc_type) ELF32_R_TYPE (irel->r_info)) + { + default: + abort (); + break; + + case R_SH_DIR8WPN: + case R_SH_DIR8WPZ: + insn += adjust / 2; + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = true; + bfd_put_16 (abfd, insn, contents + nraddr); + break; + + case R_SH_IND12W: + insn += adjust / 2; + if ((oinsn & 0xf000) != (insn & 0xf000)) + overflow = true; + bfd_put_16 (abfd, insn, contents + nraddr); + break; + + case R_SH_DIR8WPL: + BFD_ASSERT (adjust == count || count >= 4); + if (count >= 4) + insn += adjust / 4; + else + { + if ((irel->r_offset & 3) == 0) + ++insn; + } + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = true; + bfd_put_16 (abfd, insn, contents + nraddr); + break; + + case R_SH_SWITCH16: + voff += adjust; + if (voff < - 0x8000 || voff >= 0x8000) + overflow = true; + bfd_put_signed_16 (abfd, voff, contents + nraddr); + break; + + case R_SH_SWITCH32: + voff += adjust; + bfd_put_signed_32 (abfd, voff, contents + nraddr); + break; + + case R_SH_USES: + irel->r_addend += adjust; + break; + } + + if (overflow) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: fatal: reloc overflow while relaxing", + bfd_get_filename (abfd), (unsigned long) irel->r_offset)); + bfd_set_error (bfd_error_bad_value); + return false; + } + } + + irel->r_offset = nraddr; + } + + /* Look through all the other sections. If there contain any IMM32 + relocs against internal symbols which we are not going to adjust + below, we may need to adjust the addends. */ + for (o = abfd->sections; o != NULL; o = o->next) + { + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *irelscan, *irelscanend; + bfd_byte *ocontents; + + if (o == sec + || (o->flags & SEC_RELOC) == 0 + || o->reloc_count == 0) + continue; + + /* We always cache the relocs. Perhaps, if info->keep_memory is + false, we should free them, if we are permitted to, when we + leave sh_coff_relax_section. */ + internal_relocs = (_bfd_elf32_link_read_relocs + (abfd, o, (PTR) NULL, (Elf_Internal_Rela *) NULL, + true)); + if (internal_relocs == NULL) + return false; + + ocontents = NULL; + irelscanend = internal_relocs + o->reloc_count; + for (irelscan = internal_relocs; irelscan < irelscanend; irelscan++) + { + Elf_Internal_Sym sym; + + if (ELF32_R_TYPE (irelscan->r_info) != (int) R_SH_DIR32) + continue; + + if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info) + continue; + + bfd_elf32_swap_symbol_in (abfd, + extsyms + ELF32_R_SYM (irelscan->r_info), + &sym); + + if (sym.st_shndx == shndx + && (sym.st_value <= addr + || sym.st_value >= toaddr)) + { + bfd_vma val; + + if (ocontents == NULL) + { + if (elf_section_data (o)->this_hdr.contents != NULL) + ocontents = elf_section_data (o)->this_hdr.contents; + else + { + /* We always cache the section contents. + Perhaps, if info->keep_memory is false, we + should free them, if we are permitted to, + when we leave sh_coff_relax_section. */ + ocontents = (bfd_byte *) bfd_malloc (o->_raw_size); + if (ocontents == NULL) + return false; + if (! bfd_get_section_contents (abfd, o, ocontents, + (file_ptr) 0, + o->_raw_size)) + return false; + elf_section_data (o)->this_hdr.contents = ocontents; + } + } + + val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); + val += sym.st_value; + if (val >= addr && val < toaddr) + bfd_put_32 (abfd, val - count, + ocontents + irelscan->r_offset); + } + } + } + + /* Adjust all the symbols. */ + esym = extsyms; + esymend = esym + symtab_hdr->sh_info; + for (; esym < esymend; esym++) + { + Elf_Internal_Sym isym; + + bfd_elf32_swap_symbol_in (abfd, esym, &isym); + + if (isym.st_shndx == shndx + && isym.st_value > addr + && isym.st_value < toaddr) + { + isym.st_value -= count; + bfd_elf32_swap_symbol_out (abfd, &isym, esym); + } + } + + sym_hash = elf_sym_hashes (abfd); + sym_hash_end = (sym_hash + + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info)); + for (; sym_hash < sym_hash_end; sym_hash++) + { + if (((*sym_hash)->root.type == bfd_link_hash_defined + || (*sym_hash)->root.type == bfd_link_hash_defweak) + && (*sym_hash)->root.u.def.section == sec + && (*sym_hash)->root.u.def.value > addr + && (*sym_hash)->root.u.def.value < toaddr) + { + (*sym_hash)->root.u.def.value -= count; + } + } + + /* See if we can move the ALIGN reloc forward. We have adjusted + r_offset for it already. */ + if (irelalign != NULL) + { + bfd_vma alignto, alignaddr; + + alignto = BFD_ALIGN (toaddr, 1 << irelalign->r_addend); + alignaddr = BFD_ALIGN (irelalign->r_offset, + 1 << irelalign->r_addend); + if (alignto != alignaddr) + { + /* Tail recursion. */ + return sh_elf_relax_delete_bytes (abfd, sec, alignaddr, + alignto - alignaddr); + } + } + + return true; +} + +/* Look for loads and stores which we can align to four byte + boundaries. This is like sh_align_loads in coff-sh.c. */ + +static boolean +sh_elf_align_loads (abfd, sec, internal_relocs, contents, pswapped) + bfd *abfd; + asection *sec; + Elf_Internal_Rela *internal_relocs; + bfd_byte *contents; + boolean *pswapped; +{ + Elf_Internal_Rela *irel, *irelend; + bfd_vma *labels = NULL; + bfd_vma *label, *label_end; + + *pswapped = false; + + irelend = internal_relocs + sec->reloc_count; + + /* Get all the addresses with labels on them. */ + labels = (bfd_vma *) bfd_malloc (sec->reloc_count * sizeof (bfd_vma)); + if (labels == NULL) + goto error_return; + label_end = labels; + for (irel = internal_relocs; irel < irelend; irel++) + { + if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_LABEL) + { + *label_end = irel->r_offset; + ++label_end; + } + } + + /* Note that the assembler currently always outputs relocs in + address order. If that ever changes, this code will need to sort + the label values and the relocs. */ + + label = labels; + + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma start, stop; + + if (ELF32_R_TYPE (irel->r_info) != (int) R_SH_CODE) + continue; + + start = irel->r_offset; + + for (irel++; irel < irelend; irel++) + if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_DATA) + break; + if (irel < irelend) + stop = irel->r_offset; + else + stop = sec->_cooked_size; + + if (! _bfd_sh_align_load_span (abfd, sec, contents, sh_elf_swap_insns, + (PTR) internal_relocs, &label, + label_end, start, stop, pswapped)) + goto error_return; + } + + free (labels); + + return true; + + error_return: + if (labels != NULL) + free (labels); + return false; +} + +/* Swap two SH instructions. This is like sh_swap_insns in coff-sh.c. */ + +static boolean +sh_elf_swap_insns (abfd, sec, relocs, contents, addr) + bfd *abfd; + asection *sec; + PTR relocs; + bfd_byte *contents; + bfd_vma addr; +{ + Elf_Internal_Rela *internal_relocs = (Elf_Internal_Rela *) relocs; + unsigned short i1, i2; + Elf_Internal_Rela *irel, *irelend; + + /* Swap the instructions themselves. */ + i1 = bfd_get_16 (abfd, contents + addr); + i2 = bfd_get_16 (abfd, contents + addr + 2); + bfd_put_16 (abfd, i2, contents + addr); + bfd_put_16 (abfd, i1, contents + addr + 2); + + /* Adjust all reloc addresses. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + enum sh_reloc_type type; + int add; + + /* There are a few special types of relocs that we don't want to + adjust. These relocs do not apply to the instruction itself, + but are only associated with the address. */ + type = (enum sh_reloc_type) ELF32_R_TYPE (irel->r_info); + if (type == R_SH_ALIGN + || type == R_SH_CODE + || type == R_SH_DATA + || type == R_SH_LABEL) + continue; + + /* If an R_SH_USES reloc points to one of the addresses being + swapped, we must adjust it. It would be incorrect to do this + for a jump, though, since we want to execute both + instructions after the jump. (We have avoided swapping + around a label, so the jump will not wind up executing an + instruction it shouldn't). */ + if (type == R_SH_USES) + { + bfd_vma off; + + off = irel->r_offset + 4 + irel->r_addend; + if (off == addr) + irel->r_offset += 2; + else if (off == addr + 2) + irel->r_offset -= 2; + } + + if (irel->r_offset == addr) + { + irel->r_offset += 2; + add = -2; + } + else if (irel->r_offset == addr + 2) + { + irel->r_offset -= 2; + add = 2; + } + else + add = 0; + + if (add != 0) + { + bfd_byte *loc; + unsigned short insn, oinsn; + boolean overflow; + + loc = contents + irel->r_offset; + overflow = false; + switch (type) + { + default: + break; + + case R_SH_DIR8WPN: + case R_SH_DIR8WPZ: + insn = bfd_get_16 (abfd, loc); + oinsn = insn; + insn += add / 2; + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = true; + bfd_put_16 (abfd, insn, loc); + break; + + case R_SH_IND12W: + insn = bfd_get_16 (abfd, loc); + oinsn = insn; + insn += add / 2; + if ((oinsn & 0xf000) != (insn & 0xf000)) + overflow = true; + bfd_put_16 (abfd, insn, loc); + break; + + case R_SH_DIR8WPL: + /* This reloc ignores the least significant 3 bits of + the program counter before adding in the offset. + This means that if ADDR is at an even address, the + swap will not affect the offset. If ADDR is an at an + odd address, then the instruction will be crossing a + four byte boundary, and must be adjusted. */ + if ((addr & 3) != 0) + { + insn = bfd_get_16 (abfd, loc); + oinsn = insn; + insn += add / 2; + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = true; + bfd_put_16 (abfd, insn, loc); + } + + break; + } + + if (overflow) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: fatal: reloc overflow while relaxing", + bfd_get_filename (abfd), (unsigned long) irel->r_offset)); + bfd_set_error (bfd_error_bad_value); + return false; + } + } + } + + return true; +} + +/* Relocate an SH ELF section. */ + +static boolean +sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + + if (info->relocateable) + { + /* This is a relocateable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + sec = local_sections[r_symndx]; + rel->r_addend += sec->output_offset + sym->st_value; + } + } + + continue; + } + + r_type = ELF32_R_TYPE (rel->r_info); + + /* Many of the relocs are only used for relaxing, and are + handled entirely by the relaxation code. */ + if (r_type > (int) LAST_INVALID_RELOC) + continue; + + if (r_type < 0 + || r_type >= (int) FIRST_INVALID_RELOC) + { + bfd_set_error (bfd_error_bad_value); + return false; + } + + /* FIXME: This is certainly incorrect. However, it is how the + COFF linker works. */ + if (r_type != (int) R_SH_DIR32 + && r_type != (int) R_SH_IND12W) + continue; + + howto = sh_elf_howto_table + r_type; + + r_symndx = ELF32_R_SYM (rel->r_info); + + /* This is a final link. */ + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + /* There is nothing to be done for an internal IND12W + relocation. FIXME: This is probably wrong, but it's how + the COFF relocations work. */ + if (r_type == (int) R_SH_IND12W) + continue; + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + } + else + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else if (h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset))) + return false; + relocation = 0; + } + } + + /* FIXME: This is how the COFF relocations work. */ + if (r_type == (int) R_SH_IND12W) + relocation -= 4; + + /* FIXME: We should use the addend, but the COFF relocations + don't. */ + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, 0); + + if (r != bfd_reloc_ok) + { + switch (r) + { + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL) + return false; + if (*name == '\0') + name = bfd_section_name (input_bfd, sec); + } + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return false; + } + break; + } + } + } + + return true; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + which uses sh_elf_relocate_section. */ + +static bfd_byte * +sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order, + data, relocateable, symbols) + bfd *output_bfd; + struct bfd_link_info *link_info; + struct bfd_link_order *link_order; + bfd_byte *data; + boolean relocateable; + asymbol **symbols; +{ + Elf_Internal_Shdr *symtab_hdr; + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf32_External_Sym *external_syms = NULL; + Elf_Internal_Sym *internal_syms = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocateable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocateable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + Elf_Internal_Sym *isymp; + asection **secpp; + Elf32_External_Sym *esym, *esymend; + + if (symtab_hdr->contents != NULL) + external_syms = (Elf32_External_Sym *) symtab_hdr->contents; + else + { + external_syms = ((Elf32_External_Sym *) + bfd_malloc (symtab_hdr->sh_info + * sizeof (Elf32_External_Sym))); + if (external_syms == NULL && symtab_hdr->sh_info > 0) + goto error_return; + if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_read (external_syms, sizeof (Elf32_External_Sym), + symtab_hdr->sh_info, input_bfd) + != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) + goto error_return; + } + + internal_relocs = (_bfd_elf32_link_read_relocs + (input_bfd, input_section, (PTR) NULL, + (Elf_Internal_Rela *) NULL, false)); + if (internal_relocs == NULL) + goto error_return; + + internal_syms = ((Elf_Internal_Sym *) + bfd_malloc (symtab_hdr->sh_info + * sizeof (Elf_Internal_Sym))); + if (internal_syms == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + sections = (asection **) bfd_malloc (symtab_hdr->sh_info + * sizeof (asection *)); + if (sections == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + isymp = internal_syms; + secpp = sections; + esym = external_syms; + esymend = esym + symtab_hdr->sh_info; + for (; esym < esymend; ++esym, ++isymp, ++secpp) + { + asection *isec; + + bfd_elf32_swap_symbol_in (input_bfd, esym, isymp); + + if (isymp->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isymp->st_shndx > 0 && isymp->st_shndx < SHN_LORESERVE) + isec = bfd_section_from_elf_index (input_bfd, isymp->st_shndx); + else if (isymp->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isymp->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else + { + /* Who knows? */ + isec = NULL; + } + + *secpp = isec; + } + + if (! sh_elf_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + internal_syms, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + sections = NULL; + if (internal_syms != NULL) + free (internal_syms); + internal_syms = NULL; + if (external_syms != NULL && symtab_hdr->contents == NULL) + free (external_syms); + external_syms = NULL; + if (internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + internal_relocs = NULL; + } + + return data; + + error_return: + if (internal_relocs != NULL + && internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + if (external_syms != NULL && symtab_hdr->contents == NULL) + free (external_syms); + if (internal_syms != NULL) + free (internal_syms); + if (sections != NULL) + free (sections); + return NULL; +} + +#define TARGET_BIG_SYM bfd_elf32_sh_vec +#define TARGET_BIG_NAME "elf32-sh" +#define TARGET_LITTLE_SYM bfd_elf32_shl_vec +#define TARGET_LITTLE_NAME "elf32-shl" +#define ELF_ARCH bfd_arch_sh +#define ELF_MACHINE_CODE EM_SH +#define ELF_MAXPAGESIZE 0x1 + +#define elf_symbol_leading_char '_' + +#define bfd_elf32_bfd_reloc_type_lookup sh_elf_reloc_type_lookup +#define elf_info_to_howto sh_elf_info_to_howto +#define bfd_elf32_bfd_relax_section sh_elf_relax_section +#define elf_backend_relocate_section sh_elf_relocate_section +#define bfd_elf32_bfd_get_relocated_section_contents \ + sh_elf_get_relocated_section_contents + +#include "elf32-target.h" diff -urN binutils-2.7/bfd/elf32-sparc.c binutils-2.8/bfd/elf32-sparc.c --- binutils-2.7/bfd/elf32-sparc.c Thu Jul 4 12:18:43 1996 +++ binutils-2.8/bfd/elf32-sparc.c Wed Apr 30 12:56:04 1997 @@ -1,5 +1,5 @@ /* SPARC-specific support for 32-bit ELF - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -64,7 +64,7 @@ static bfd_reloc_status_type sparc_elf_wdisp16_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -reloc_howto_type _bfd_sparc_elf_howto_table[] = +reloc_howto_type _bfd_sparc_elf_howto_table[] = { HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true), HOWTO(R_SPARC_8, 0,0, 8,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_8", false,0,0x000000ff,true), @@ -394,6 +394,7 @@ | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY)) || ! bfd_set_section_alignment (dynobj, srelgot, 2)) return false; @@ -512,8 +513,7 @@ case R_SPARC_13: case R_SPARC_LO10: case R_SPARC_UA32: - if (info->shared - && (sec->flags & SEC_ALLOC) != 0) + if (info->shared) { /* When creating a shared object, we must copy these relocs into the output file. We create a reloc @@ -536,14 +536,15 @@ sreloc = bfd_get_section_by_name (dynobj, name); if (sreloc == NULL) { + flagword flags; + sreloc = bfd_make_section (dynobj, name); + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0) + flags |= SEC_ALLOC | SEC_LOAD; if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_READONLY)) + || ! bfd_set_section_flags (dynobj, sreloc, flags) || ! bfd_set_section_alignment (dynobj, sreloc, 2)) return false; } @@ -592,9 +593,17 @@ /* 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). The STT_NOTYPE + condition is a hack specifically for the Oracle libraries + delivered for Solaris; for some inexplicable reason, they define + some of their functions as STT_NOTYPE when they really should be + STT_FUNC. */ if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 + || (h->type == STT_NOTYPE + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && (h->root.u.def.section->flags & SEC_CODE) != 0)) { if (! elf_hash_table (info)->dynamic_sections_created) { @@ -682,14 +691,11 @@ s = bfd_get_section_by_name (dynobj, ".dynbss"); BFD_ASSERT (s != NULL); - /* If the symbol is currently defined in the .bss section of the - dynamic object, then it is OK to simply initialize it to zero. - If the symbol is in some other section, we must generate a - R_SPARC_COPY reloc to tell the dynamic linker to copy the initial - value out of the dynamic object and into the runtime process - image. We need to remember the offset into the .rel.bss section - we are going to use. */ - if ((h->root.u.def.section->flags & SEC_LOAD) != 0) + /* We must generate a R_SPARC_COPY reloc to tell the dynamic linker + to copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rel.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { asection *srel; @@ -778,7 +784,7 @@ const char *name; boolean strip; - if ((s->flags & SEC_IN_MEMORY) == 0) + if ((s->flags & SEC_LINKER_CREATED) == 0) continue; /* It's OK to base decisions on the section name, because none @@ -804,11 +810,14 @@ } else { + const char *outname; asection *target; /* If this relocation section applies to a read only section, then we probably need a DT_TEXTREL entry. */ - target = bfd_get_section_by_name (output_bfd, name + 5); + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 5); if (target != NULL && (target->flags & SEC_READONLY) != 0) reltext = true; @@ -861,12 +870,10 @@ return false; } - if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)) - return false; - if (relplt) { - if (! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) + if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0) + || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA) || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)) return false; @@ -886,26 +893,34 @@ } /* If we are generating a shared library, we generate a section - symbol for each output section. These are local symbols, which - means that they must come first in the dynamic symbol table. - That means we must increment the dynamic symbol index of every - other dynamic symbol. */ + symbol for each output section for which we might need to copy + relocs. These are local symbols, which means that they must come + first in the dynamic symbol table. That means we must increment + the dynamic symbol index of every other dynamic symbol. */ if (info->shared) { - int c, i; + int c; - c = bfd_count_sections (output_bfd); - elf_link_hash_traverse (elf_hash_table (info), - elf32_sparc_adjust_dynindx, - (PTR) &c); - elf_hash_table (info)->dynsymcount += c; - - for (i = 1, s = output_bfd->sections; s != NULL; s = s->next, i++) + c = 0; + for (s = output_bfd->sections; s != NULL; s = s->next) { - elf_section_data (s)->dynindx = i; + if ((s->flags & SEC_LINKER_CREATED) != 0 + || (s->flags & SEC_ALLOC) == 0 + || (s->flags & SEC_LOAD) == 0) + continue; + + elf_section_data (s)->dynindx = c + 1; + /* These symbols will have no names, so we don't need to fiddle with dynstr_index. */ + + ++c; } + + elf_link_hash_traverse (elf_hash_table (info), + elf32_sparc_adjust_dynindx, + (PTR) &c); + elf_hash_table (info)->dynsymcount += c; } return true; @@ -1043,7 +1058,6 @@ && (! info->symbolic || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - && (input_section->flags & SEC_ALLOC) != 0 && (r_type == R_SPARC_8 || r_type == R_SPARC_16 || r_type == R_SPARC_32 @@ -1232,10 +1246,10 @@ case R_SPARC_13: case R_SPARC_LO10: case R_SPARC_UA32: - if (info->shared - && (input_section->flags & SEC_ALLOC) != 0) + if (info->shared) { Elf_Internal_Rela outrel; + boolean skip; /* When generating a shared object, these relocations are copied into the output file to be resolved at run @@ -1261,13 +1275,35 @@ BFD_ASSERT (sreloc != NULL); } - outrel.r_offset = (rel->r_offset - + input_section->output_section->vma - + input_section->output_offset); - if (h != NULL - && (! info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) + skip = false; + + if (elf_section_data (input_section)->stab_info == NULL) + outrel.r_offset = rel->r_offset; + else + { + bfd_vma off; + + off = (_bfd_stab_section_offset + (output_bfd, &elf_hash_table (info)->stab_info, + input_section, + &elf_section_data (input_section)->stab_info, + rel->r_offset)); + if (off == (bfd_vma) -1) + skip = true; + outrel.r_offset = off; + } + + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + /* h->dynindx may be -1 if the symbol was marked to + become local. */ + else if (h != NULL + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) { BFD_ASSERT (h->dynindx != -1); outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); @@ -1322,13 +1358,18 @@ ++sreloc->reloc_count; /* This reloc will be computed at runtime, so there's no - need to do anything now. */ - continue; + need to do anything now, unless this is a RELATIVE + reloc in an unallocated section. */ + if (skip + || (input_section->flags & SEC_ALLOC) != 0 + || ELF32_R_TYPE (outrel.r_info) != R_SPARC_RELATIVE) + continue; } + break; default: break; - } + } if (r_type != R_SPARC_WDISP16) r = _bfd_final_link_relocate (howto, input_bfd, input_section, @@ -1620,6 +1661,7 @@ asection *sdynsym; asection *s; Elf_Internal_Sym sym; + int c; /* Set up the section symbols for the output sections. */ @@ -1631,10 +1673,14 @@ sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); sym.st_other = 0; + c = 0; for (s = output_bfd->sections; s != NULL; s = s->next) { int indx; + if (elf_section_data (s)->dynindx == 0) + continue; + sym.st_value = s->vma; indx = elf_section_data (s)->this_idx; @@ -1645,12 +1691,13 @@ (PTR) (((Elf32_External_Sym *) sdynsym->contents) + elf_section_data (s)->dynindx)); + + ++c; } /* Set the sh_info field of the output .dynsym section to the index of the first global symbol. */ - elf_section_data (sdynsym->output_section)->this_hdr.sh_info = - bfd_count_sections (output_bfd) + 1; + elf_section_data (sdynsym->output_section)->this_hdr.sh_info = c + 1; } return true; @@ -1673,10 +1720,8 @@ { boolean error; - /* This function is selected based on the input vector. We only - want to copy information over if the output BFD also uses Elf - format. */ - if (bfd_get_flavour (obfd) != bfd_target_elf_flavour) + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) return true; error = false; diff -urN binutils-2.7/bfd/elf64-alpha.c binutils-2.8/bfd/elf64-alpha.c --- binutils-2.7/bfd/elf64-alpha.c Thu Jul 4 12:18:48 1996 +++ binutils-2.8/bfd/elf64-alpha.c Wed Apr 30 12:56:04 1997 @@ -1,5 +1,5 @@ -/* ALPHA-specific support for 64-bit ELF - Copyright 1996 Free Software Foundation, Inc. +/* Alpha specific support for 64-bit ELF + Copyright 1996, 1997 Free Software Foundation, Inc. Contributed by Richard Henderson . This file is part of BFD, the Binary File Descriptor library. @@ -46,6 +46,7 @@ #define ECOFF_64 #include "ecoffswap.h" +static boolean elf64_alpha_mkobject PARAMS ((bfd *)); static struct bfd_hash_entry * elf64_alpha_link_hash_newfunc PARAMS((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); static struct bfd_link_hash_table * elf64_alpha_bfd_link_hash_table_create @@ -53,18 +54,12 @@ static bfd_reloc_status_type elf64_alpha_reloc_nil PARAMS((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type elf64_alpha_reloc_bad + PARAMS((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_reloc_status_type elf64_alpha_do_reloc_gpdisp PARAMS((bfd *, bfd_vma, bfd_byte *, bfd_byte *)); static bfd_reloc_status_type elf64_alpha_reloc_gpdisp PARAMS((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type elf64_alpha_reloc_op_push - PARAMS((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type elf64_alpha_reloc_op_store - PARAMS((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type elf64_alpha_reloc_op_psub - PARAMS((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type elf64_alpha_reloc_op_prshift - PARAMS((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static reloc_howto_type * elf64_alpha_bfd_reloc_type_lookup PARAMS((bfd *, bfd_reloc_code_real_type)); @@ -86,8 +81,8 @@ static boolean elf64_alpha_read_ecoff_info PARAMS((bfd *, asection *, struct ecoff_debug_info *)); -static boolean elf64_alpha_is_local_label - PARAMS((bfd *, asymbol *)); +static boolean elf64_alpha_is_local_label_name + PARAMS((bfd *, const char *)); static boolean elf64_alpha_find_nearest_line PARAMS((bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *)); @@ -99,6 +94,18 @@ static boolean elf64_alpha_output_extsym PARAMS((struct alpha_elf_link_hash_entry *, PTR)); +static boolean elf64_alpha_can_merge_gots + PARAMS((bfd *, bfd *)); +static void elf64_alpha_merge_gots + PARAMS((bfd *, bfd *)); +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 void elf64_alpha_strip_section_from_output PARAMS ((asection *)); +static boolean elf64_alpha_always_size_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static boolean elf64_alpha_calc_dynrel_sizes + PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *)); static boolean elf64_alpha_check_relocs PARAMS((bfd *, struct bfd_link_info *, asection *sec, const Elf_Internal_Rela *)); @@ -120,9 +127,6 @@ PARAMS((bfd *, struct bfd_link_info *)); -#define alpha_elf_tdata(bfd) \ - ((struct alpha_elf_obj_tdata *)elf_tdata(bfd)->tdata) - struct alpha_elf_link_hash_entry { struct elf_link_hash_entry root; @@ -130,11 +134,50 @@ /* External symbol information. */ EXTR esym; - unsigned char flags; + /* Cumulative flags for all the .got entries. */ + int flags; + /* Contexts (LITUSE) in which a literal was referenced. */ -#define ALPHA_ELF_LINK_HASH_LU_ADDR 01 -#define ALPHA_ELF_LINK_HASH_LU_MEM 02 -#define ALPHA_ELF_LINK_HASH_LU_FUNC 04 +#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 + + /* Used to implement multiple .got subsections. */ + struct alpha_elf_got_entry + { + struct alpha_elf_got_entry *next; + + /* which .got subsection? */ + bfd *gotobj; + + /* the addend in effect for this entry. */ + bfd_vma addend; + + /* the .got offset for this entry. */ + int got_offset; + + int flags; + + /* An additional flag. */ +#define ALPHA_ELF_GOT_ENTRY_RELOCS_DONE 0x10 + } *got_entries; + + /* used to count non-got, non-plt relocations for delayed sizing + of relocation sections. */ + struct alpha_elf_reloc_entry + { + struct alpha_elf_reloc_entry *next; + + /* which .reloc section? */ + asection *srel; + + /* what kind of relocation? */ + unsigned long rtype; + + /* how many did we find? */ + unsigned long count; + } *reloc_entries; }; /* Alpha ELF linker hash table. */ @@ -142,6 +185,10 @@ struct alpha_elf_link_hash_table { struct elf_link_hash_table root; + + /* The head of a list of .got subsections linked through + alpha_elf_tdata(abfd)->got_link_next. */ + bfd *got_list; }; /* Look up an entry in a Alpha ELF linker hash table. */ @@ -164,6 +211,19 @@ #define alpha_elf_hash_table(p) \ ((struct alpha_elf_link_hash_table *) ((p)->hash)) +/* Get the object's symbols as our own entry type. */ + +#define alpha_elf_sym_hashes(abfd) \ + ((struct alpha_elf_link_hash_entry **)elf_sym_hashes(abfd)) + +/* Should we do dynamic things to this symbol? */ + +#define alpha_elf_dynamic_symbol_p(h, info) \ + (((info)->shared && !(info)->symbolic && (h)->dynindx != -1) \ + || (((h)->elf_link_hash_flags \ + & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)) \ + == (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))) + /* Create an entry in a Alpha ELF linker hash table. */ static struct bfd_hash_entry * @@ -196,6 +256,8 @@ not been set. -1 means there is no associated ifd. */ ret->esym.ifd = -2; ret->flags = 0; + ret->got_entries = NULL; + ret->reloc_entries = NULL; } return (struct bfd_hash_entry *) ret; @@ -224,7 +286,66 @@ return &ret->root.root; } +/* We have some private fields hanging off of the elf_tdata structure. */ + +struct alpha_elf_obj_tdata +{ + struct elf_obj_tdata root; + + /* For every input file, these are the got entries for that object's + local symbols. */ + struct alpha_elf_got_entry ** local_got_entries; + + /* For every input file, this is the object that owns the got that + this input file uses. */ + bfd *gotobj; + + /* For every got, this is a linked list through the objects using this got */ + bfd *in_got_link_next; + + /* For every got, this is a link to the next got subsegment. */ + bfd *got_link_next; + + /* 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 the sum of the number of *entries* required + to hold all of the member object's local got. */ + int n_local_got_entries; +}; + +#define alpha_elf_tdata(abfd) \ + ((struct alpha_elf_obj_tdata *) (abfd)->tdata.any) + +static boolean +elf64_alpha_mkobject (abfd) + bfd *abfd; +{ + abfd->tdata.any = bfd_zalloc (abfd, sizeof (struct alpha_elf_obj_tdata)); + if (abfd->tdata.any == NULL) + return false; + return true; +} + +static boolean +elf64_alpha_object_p (abfd) + bfd *abfd; +{ + /* Allocate our special target data. */ + struct alpha_elf_obj_tdata *new_tdata; + new_tdata = bfd_zalloc (abfd, sizeof (struct alpha_elf_obj_tdata)); + if (new_tdata == NULL) + return false; + new_tdata->root = *abfd->tdata.elf_obj_data; + abfd->tdata.any = new_tdata; + /* Set the right machine number for an Alpha ELF file. */ + return bfd_default_set_arch_mach (abfd, bfd_arch_alpha, 0); +} + /* 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) @@ -301,13 +422,13 @@ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ 0, /* special_function */ - "LITERAL", /* name */ + "ELF_LITERAL", /* name */ false, /* partial_inplace */ 0xffff, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ - /* This reloc only appears immediately following a LITERAL reloc. + /* This reloc only appears immediately following an ELF_LITERAL reloc. It identifies a use of the literal. The symbol index is special: 1 means the literal address is in the base register of a memory format instruction; 2 means the literal address is in the byte @@ -336,7 +457,7 @@ current location; the load will always be done against a register holding the current address. - NOTE: Unlike ECOFF, partial inplace relocation is not done. If + NOTE: Unlike ECOFF, partial in-place relocation is not done. If any offset is present in the instructions, it is an offset from the register to the ldah instruction. This lets us avoid any stupid hackery like inventing a gp value to do partial relocation @@ -441,7 +562,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_op_push, /* special_function */ + elf64_alpha_reloc_bad, /* special_function */ "OP_PUSH", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -457,7 +578,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_op_store, /* special_function */ + elf64_alpha_reloc_bad, /* special_function */ "OP_STORE", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -473,7 +594,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_op_psub, /* special_function */ + elf64_alpha_reloc_bad, /* special_function */ "OP_PSUB", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -489,7 +610,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_op_prshift, /* special_function */ + elf64_alpha_reloc_bad, /* special_function */ "OP_PRSHIFT", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -508,7 +629,7 @@ "COPY", false, 0, - 0, + 0, true), HOWTO (R_ALPHA_GLOB_DAT, @@ -522,7 +643,7 @@ "GLOB_DAT", false, 0, - 0, + 0, true), HOWTO (R_ALPHA_JMP_SLOT, @@ -547,13 +668,15 @@ 0, complain_overflow_dont, bfd_elf_generic_reloc, - "RELATIVE", + "RELATIVE", false, 0, 0, true) }; +/* A relocation function which doesn't do anything. */ + static bfd_reloc_status_type elf64_alpha_reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message) bfd *abfd; @@ -569,18 +692,38 @@ return bfd_reloc_ok; } +/* A relocation function used for an unsupported reloc. */ + +static bfd_reloc_status_type +elf64_alpha_reloc_bad (abfd, reloc, sym, data, sec, output_bfd, error_message) + bfd *abfd; + arelent *reloc; + asymbol *sym; + PTR data; + asection *sec; + bfd *output_bfd; + char **error_message; +{ + if (output_bfd) + reloc->address += sec->output_offset; + return bfd_reloc_notsupported; +} + +/* Do the work of the GPDISP relocation. */ + static bfd_reloc_status_type elf64_alpha_do_reloc_gpdisp (abfd, gpdisp, p_ldah, p_lda) bfd *abfd; bfd_vma gpdisp; - bfd_byte *p_ldah, *p_lda; + bfd_byte *p_ldah; + bfd_byte *p_lda; { bfd_reloc_status_type ret = bfd_reloc_ok; bfd_vma addend; unsigned long i_ldah, i_lda; - i_ldah = bfd_get_32(abfd, p_ldah); - i_lda = bfd_get_32(abfd, p_lda); + i_ldah = bfd_get_32 (abfd, p_ldah); + i_lda = bfd_get_32 (abfd, p_lda); /* Complain if the instructions are not correct. */ if (((i_ldah >> 26) & 0x3f) != 0x09 @@ -594,7 +737,7 @@ gpdisp += addend; - if ((bfd_signed_vma)gpdisp < -(bfd_signed_vma)0x80000000 + if ((bfd_signed_vma) gpdisp < -(bfd_signed_vma)0x80000000 || gpdisp >= 0x7fff8000) ret = bfd_reloc_overflow; @@ -609,6 +752,8 @@ return ret; } +/* The special function for the GPDISP reloc. */ + static bfd_reloc_status_type elf64_alpha_reloc_gpdisp (abfd, reloc_entry, sym, data, input_section, output_bfd, err_msg) @@ -635,7 +780,7 @@ reloc_entry->address + reloc_entry->addend > input_section->_cooked_size) return bfd_reloc_outofrange; - /* The gp used in the portion of the output object to which this + /* The gp used in the portion of the output object to which this input object belongs is cached on the input bfd. */ gp = _bfd_get_gp_value (abfd); @@ -643,184 +788,18 @@ + input_section->output_offset + reloc_entry->address); - p_ldah = (bfd_byte *)data + reloc_entry->address; + p_ldah = (bfd_byte *) data + reloc_entry->address; p_lda = p_ldah + reloc_entry->addend; ret = elf64_alpha_do_reloc_gpdisp (abfd, gp - relocation, p_ldah, p_lda); /* Complain if the instructions are not correct. */ if (ret == bfd_reloc_dangerous) - { - *err_msg = "GPDISP relocation did not find ldah and lda instructions"; - } + *err_msg = "GPDISP relocation did not find ldah and lda instructions"; return ret; } -/* Due to the nature of the stack operations, I don't think more - that one entry is useful. Test this theory by setting the - stack size to a minimum. */ -/* FIXME: BFD should not use static variables. */ -#define OP_STACK_SIZE 1 -static bfd_vma elf64_alpha_op_stack[OP_STACK_SIZE]; -static int elf64_alpha_op_tos; - -static bfd_reloc_status_type -elf64_alpha_reloc_op_push (abfd, reloc_entry, sym, data, input_section, - output_bfd, err_msg) - bfd *abfd; - arelent *reloc_entry; - asymbol *sym; - PTR data; - asection *input_section; - bfd *output_bfd; - char **err_msg; -{ - bfd_reloc_status_type r = bfd_reloc_ok; - bfd_vma value; - - /* Don't do anything if we're not doing a final link. */ - if (output_bfd) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (elf64_alpha_op_tos >= OP_STACK_SIZE) - { - *err_msg = "operation stack overflow"; - return bfd_reloc_dangerous; - } - - /* Get the symbol value. */ - /* FIXME: We should fail if this is a dynamic symbol. Check on that. */ - if (bfd_is_und_section (sym->section)) - r = bfd_reloc_undefined; - if (bfd_is_com_section (sym->section)) - value = 0; - else - value = sym->value; - value += sym->section->output_section->vma; - value += sym->section->output_offset; - value += reloc_entry->addend; - - elf64_alpha_op_stack[elf64_alpha_op_tos++] = value; - - return r; -} - -static bfd_reloc_status_type -elf64_alpha_reloc_op_store (abfd, reloc_entry, sym, data, input_section, - output_bfd, err_msg) - bfd *abfd; - arelent *reloc_entry; - asymbol *sym; - PTR data; - asection *input_section; - bfd *output_bfd; - char **err_msg; -{ - int size, offset; - bfd_vma value; - - /* Don't do anything before the final link. */ - if (output_bfd) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (elf64_alpha_op_tos <= 0) - { - *err_msg = "operation stack underflow"; - return bfd_reloc_dangerous; - } - - /* The offset and size for this reloc are encoded into the addend - field by alpha_adjust_reloc_in. */ - offset = (reloc_entry->addend >> 8) & 0xff; - size = reloc_entry->addend & 0xff; - - value = bfd_get_64 (abfd, data + reloc_entry->address); - value &= ~((((bfd_vma)1 << size) - 1) << offset); - value |= (elf64_alpha_op_stack[--elf64_alpha_op_tos] - & (((bfd_vma)1 << size) - 1)) << offset; - bfd_put_64 (abfd, value, data + reloc_entry->address); - - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -elf64_alpha_reloc_op_psub (abfd, reloc_entry, sym, data, input_section, - output_bfd, err_msg) - bfd *abfd; - arelent *reloc_entry; - asymbol *sym; - PTR data; - asection *input_section; - bfd *output_bfd; - char **err_msg; -{ - bfd_reloc_status_type r; - bfd_vma value; - - /* Don't do anything before the final link. */ - if (output_bfd) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (elf64_alpha_op_tos <= 0) - { - *err_msg = "operation stack underflow"; - return bfd_reloc_dangerous; - } - - if (bfd_is_und_section (sym->section)) - r = bfd_reloc_undefined; - if (bfd_is_com_section (sym->section)) - value = 0; - else - value = sym->value; - value += sym->section->output_section->vma; - value += sym->section->output_offset; - value += reloc_entry->addend; - - elf64_alpha_op_stack[elf64_alpha_op_tos-1] -= value; - - return r; -} - -static bfd_reloc_status_type -elf64_alpha_reloc_op_prshift (abfd, reloc_entry, sym, data, input_section, - output_bfd, err_msg) - bfd *abfd; - arelent *reloc_entry; - asymbol *sym; - PTR data; - asection *input_section; - bfd *output_bfd; - char **err_msg; -{ - /* Don't do anything before the final link. */ - if (output_bfd) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (elf64_alpha_op_tos <= 0) - { - *err_msg = "operation stack underflow"; - return bfd_reloc_dangerous; - } - - elf64_alpha_op_stack[elf64_alpha_op_tos-1] >>= reloc_entry->addend; - - return bfd_reloc_ok; -} - /* A mapping from BFD reloc types to Alpha ELF reloc types. */ struct elf_reloc_map @@ -836,20 +815,14 @@ {BFD_RELOC_64, R_ALPHA_REFQUAD}, {BFD_RELOC_CTOR, R_ALPHA_REFQUAD}, {BFD_RELOC_GPREL32, R_ALPHA_GPREL32}, - {BFD_RELOC_ALPHA_LITERAL, R_ALPHA_LITERAL}, + {BFD_RELOC_ALPHA_ELF_LITERAL, R_ALPHA_LITERAL}, {BFD_RELOC_ALPHA_LITUSE, R_ALPHA_LITUSE}, {BFD_RELOC_ALPHA_GPDISP, R_ALPHA_GPDISP}, - {BFD_RELOC_23_PCREL_S2, R_ALPHA_BRADDR}, - {BFD_RELOC_ALPHA_HINT, R_ALPHA_HINT}, - {BFD_RELOC_16_PCREL, R_ALPHA_SREL16}, - {BFD_RELOC_32_PCREL, R_ALPHA_SREL32}, - {BFD_RELOC_64_PCREL, R_ALPHA_SREL64}, -#if 0 - {BFD_RELOC_ALPHA_OP_PUSH, R_ALPHA_OP_PUSH}, - {BFD_RELOC_ALPHA_OP_STORE, R_ALPHA_OP_STORE}, - {BFD_RELOC_ALPHA_OP_PSUB, R_ALPHA_OP_PSUB}, - {BFD_RELOC_ALPHA_OP_PRSHIFT, R_ALPHA_OP_PRSHIFT} -#endif + {BFD_RELOC_23_PCREL_S2, R_ALPHA_BRADDR}, + {BFD_RELOC_ALPHA_HINT, R_ALPHA_HINT}, + {BFD_RELOC_16_PCREL, R_ALPHA_SREL16}, + {BFD_RELOC_32_PCREL, R_ALPHA_SREL32}, + {BFD_RELOC_64_PCREL, R_ALPHA_SREL64}, }; /* Given a BFD reloc type, return a HOWTO structure. */ @@ -897,20 +870,11 @@ #define PLT_ENTRY_WORD2 0x239c0000 /* lda $28, 0($28) */ #define PLT_ENTRY_WORD3 0xc3e00000 /* br $31, plt0 */ -#define RESERVED_GOT_ENTRIES 1 +#define MAX_GOT_ENTRIES (64*1024 / 8) #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so" -/* Set the right machine number for an Alpha ELF file. */ - -static boolean -elf64_alpha_object_p (abfd) - bfd *abfd; -{ - return bfd_default_set_arch_mach (abfd, bfd_arch_alpha, 0); -} - -/* Handle a alpha specific section when reading an object file. This +/* Handle an Alpha specific section when reading an object file. This is called when elfcode.h finds a section with an unknown type. FIXME: We need to handle the SHF_MIPS_GPREL flag, but I'm not sure how to. */ @@ -1023,16 +987,18 @@ hdr->sh_entsize = 0; hdr->sh_info = SIZEOF_ALPHA_DYNSYM_SECNAMES; } +#endif else if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0 || strcmp (name, ".lit4") == 0 || strcmp (name, ".lit8") == 0) hdr->sh_flags |= SHF_ALPHA_GPREL; -#endif return true; } +/* Return the number of additional phdrs we will need. */ + static int elf64_alpha_additional_program_headers (abfd) bfd *abfd; @@ -1059,62 +1025,40 @@ return ret; } +/* Create the .got section. */ + static boolean elf64_alpha_create_got_section(abfd, info) bfd *abfd; struct bfd_link_info *info; { asection *s; - struct elf_link_hash_entry *h; if (bfd_get_section_by_name (abfd, ".got")) return true; - s = bfd_make_section(abfd, ".rela.got"); - if (s == NULL - || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_READONLY)) - || !bfd_set_section_alignment (abfd, s, 3)) - return false; - - s = bfd_make_section(abfd, ".got"); + s = bfd_make_section (abfd, ".got"); if (s == NULL || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS | SEC_IN_MEMORY)) + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED)) || !bfd_set_section_alignment (abfd, s, 3)) return false; - s->_raw_size = RESERVED_GOT_ENTRIES * 8; - - /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got - (or .got.plt) section. We don't do this in the linker script - because we don't want to define the symbol if we are not creating - a global offset table. */ - h = NULL; - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, (bfd_vma) 0, - (const char *) NULL, false, get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (info->shared - && ! _bfd_elf_link_record_dynamic_symbol (info, h)) - return false; - - elf_hash_table (info)->hgot = h; + alpha_elf_tdata (abfd)->got = s; return true; } +/* Create all the dynamic sections. */ + static boolean elf64_alpha_create_dynamic_sections (abfd, info) bfd *abfd; struct bfd_link_info *info; { - register asection *s; + asection *s; struct elf_link_hash_entry *h; /* We need to create .plt, .rela.plt, .got, and .rela.got sections. */ @@ -1122,7 +1066,9 @@ s = bfd_make_section (abfd, ".plt"); if (s == NULL || ! bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_CODE)) || ! bfd_set_section_alignment (abfd, s, 3)) return false; @@ -1146,21 +1092,51 @@ s = bfd_make_section (abfd, ".rela.plt"); if (s == NULL || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_READONLY)) + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) || ! bfd_set_section_alignment (abfd, s, 3)) return false; + /* We may or may not have created a .got section for this object, but + we definitely havn't done the rest of the work. */ + if (!elf64_alpha_create_got_section (abfd, info)) return false; - return true; -} + s = bfd_make_section(abfd, ".rela.got"); + if (s == NULL + || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (abfd, s, 3)) + return false; + + /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the + dynobj's .got section. We don't do this in the linker script + because we don't want to define the symbol if we are not creating + a global offset table. */ + h = NULL; + if (!(_bfd_generic_link_add_one_symbol + (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, + alpha_elf_tdata(abfd)->got, (bfd_vma) 0, (const char *) NULL, + false, get_elf_backend_data (abfd)->collect, + (struct bfd_link_hash_entry **) &h))) + return false; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + + if (info->shared + && ! _bfd_elf_link_record_dynamic_symbol (info, h)) + return false; -/* The structure of the runtile procedure descriptor created by the - loader for use by the static exception system. */ + elf_hash_table (info)->hgot = h; -/* FIXME */ + return true; +} /* Read ECOFF debugging information from a .mdebug section into a ecoff_debug_info structure. */ @@ -1255,11 +1231,11 @@ /* Alpha ELF local labels start with '$'. */ static boolean -elf64_alpha_is_local_label (abfd, symbol) +elf64_alpha_is_local_label_name (abfd, name) bfd *abfd; - asymbol *symbol; + const char *name; { - return symbol->name[0] == '$'; + return name[0] == '$'; } /* Alpha ELF follows MIPS ELF in using a special find_nearest_line @@ -1435,7 +1411,7 @@ else { name = bfd_section_name (output_section->owner, output_section); - + if (strcmp (name, ".text") == 0) h->esym.asym.sc = scText; else if (strcmp (name, ".data") == 0) @@ -1485,23 +1461,23 @@ { /* Set type and value for a symbol with a function stub. */ h->esym.asym.st = stProc; - sec = h->root.root.u.def.section; + sec = bfd_get_section_by_name (einfo->abfd, ".plt"); if (sec == NULL) - h->esym.asym.value = 0; + h->esym.asym.value = 0; else - { - output_section = sec->output_section; - if (output_section != NULL) - h->esym.asym.value = (h->root.plt_offset - + sec->output_offset - + output_section->vma); - else - h->esym.asym.value = 0; - } + { + output_section = sec->output_section; + if (output_section != NULL) + h->esym.asym.value = (h->root.plt_offset + + sec->output_offset + + output_section->vma); + else + h->esym.asym.value = 0; + } #if 0 /* FIXME? */ h->esym.ifd = 0; #endif - } + } if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap, h->root.root.root.string, @@ -1523,9 +1499,10 @@ struct bfd_link_info *info; asection *s; struct ecoff_debug_info *debug; - */ - +*/ +/* Handle dynamic relocations when doing an Alpha ELF link. */ + static boolean elf64_alpha_check_relocs (abfd, info, sec, relocs) bfd *abfd; @@ -1534,287 +1511,700 @@ const Elf_Internal_Rela *relocs; { bfd *dynobj; - asection *sgot; - asection *srelgot; asection *sreloc; + const char *rel_sec_name; Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; + 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; if (info->relocateable) return true; - sgot = srelgot = sreloc = NULL; - symtab_hdr = &elf_tdata(abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes(abfd); dynobj = elf_hash_table(info)->dynobj; - if (dynobj) - { - sgot = bfd_get_section_by_name(dynobj, ".got"); - srelgot = bfd_get_section_by_name(dynobj, ".rela.got"); - } + if (dynobj == NULL) + elf_hash_table(info)->dynobj = dynobj = abfd; + + sreloc = NULL; + 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; relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; ++rel) { - unsigned long r_symndx; + unsigned long r_symndx, r_type; struct alpha_elf_link_hash_entry *h; r_symndx = ELF64_R_SYM (rel->r_info); if (r_symndx < symtab_hdr->sh_info) h = NULL; else - h = ((struct alpha_elf_link_hash_entry *) - sym_hashes[r_symndx - symtab_hdr->sh_info]); + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + h->root.elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; + } + r_type = ELF64_R_TYPE (rel->r_info); + + 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) + { + gotent = ((struct alpha_elf_got_entry *) + bfd_alloc (abfd, + sizeof (struct alpha_elf_got_entry))); + if (!gotent) + return false; + + gotent->gotobj = abfd; + gotent->addend = rel->r_addend; + gotent->got_offset = -1; + gotent->flags = 0; + + gotent->next = h->got_entries; + h->got_entries = gotent; + + alpha_elf_tdata (abfd)->total_got_entries++; + } + } + else + { + /* This is a local .got entry -- record for merge. */ + if (!local_got_entries) + { + size_t size; + size = (symtab_hdr->sh_info + * 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); + 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) + { + gotent = ((struct alpha_elf_got_entry *) + bfd_alloc (abfd, + sizeof (struct alpha_elf_got_entry))); + if (!gotent) + return false; + + gotent->gotobj = abfd; + gotent->addend = rel->r_addend; + gotent->got_offset = -1; + gotent->flags = 0; + + 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++; + } + } + + /* 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 */ + + case R_ALPHA_GPDISP: + case R_ALPHA_GPREL32: + /* We don't actually use the .got here, but the sections must + be created before the linker maps input sections to output + sections. */ + if (!got_created) + { + if (!elf64_alpha_create_got_section (abfd, info)) + return false; + + /* Make sure the object's gotobj is set to itself so + that we default to every object with its own .got. + We'll merge .gots later once we've collected each + object's info. */ + alpha_elf_tdata(abfd)->gotobj = abfd; + + got_created = 1; + } + break; + + case R_ALPHA_SREL16: + case R_ALPHA_SREL32: + case R_ALPHA_SREL64: + if (h == NULL) + break; + /* FALLTHRU */ + + case R_ALPHA_REFLONG: + case R_ALPHA_REFQUAD: + if (rel_sec_name == NULL) + { + rel_sec_name = (bfd_elf_string_from_elf_section + (abfd, elf_elfheader(abfd)->e_shstrndx, + elf_section_data(sec)->rel_hdr.sh_name)); + if (rel_sec_name == NULL) + return false; + + BFD_ASSERT (strncmp (rel_sec_name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + rel_sec_name+5) == 0); + } + + /* We need to create the section here now whether we eventually + use it or not so that it gets mapped to an output section by + the linker. If not used, we'll kill it in + size_dynamic_sections. */ + if (sreloc == NULL) + { + sreloc = bfd_get_section_by_name (dynobj, rel_sec_name); + if (sreloc == NULL) + { + sreloc = bfd_make_section (dynobj, rel_sec_name); + if (sreloc == NULL + || !bfd_set_section_flags (dynobj, sreloc, + (SEC_ALLOC|SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (dynobj, sreloc, 3)) + return false; + } + } + + if (h) + { + /* Since we havn't seen all of the input symbols yet, we + don't know whether we'll actually need a dynamic relocation + entry for this reloc. So make a record of it. Once we + find out if this thing needs dynamic relocation we'll + expand the relocation sections by the appropriate amount. */ + + struct alpha_elf_reloc_entry *rent; + + for (rent = h->reloc_entries; rent; rent = rent->next) + if (rent->rtype == r_type && rent->srel == sreloc) + break; + + if (!rent) + { + rent = ((struct alpha_elf_reloc_entry *) + bfd_alloc (abfd, + sizeof (struct alpha_elf_reloc_entry))); + if (!rent) + return false; + + rent->srel = sreloc; + rent->rtype = r_type; + rent->count = 1; + + rent->next = h->reloc_entries; + h->reloc_entries = rent; + } + else + rent->count++; + } + else if (info->shared) + { + /* If this is a shared library, we need a RELATIVE reloc. */ + sreloc->_raw_size += sizeof (Elf64_External_Rela); + } + break; + } + } + + return true; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static boolean +elf64_alpha_adjust_dynamic_symbol (info, h) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; +{ + bfd *dynobj; + asection *s; + struct alpha_elf_link_hash_entry *ah; + + dynobj = elf_hash_table(info)->dynobj; + ah = (struct alpha_elf_link_hash_entry *)h; + + /* Now that we've seen all of the input symbols, finalize our decision + about whether this symbol should get a .plt entry. */ + + if (h->root.type != bfd_link_hash_undefweak + && alpha_elf_dynamic_symbol_p (h, info) + && ((h->type == STT_FUNC + && !(ah->flags & ALPHA_ELF_LINK_HASH_LU_ADDR)) + || (h->type == STT_NOTYPE + && 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 + somewhere later. But for now don't bother. */ + && ah->got_entries) + { + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + + s = bfd_get_section_by_name(dynobj, ".plt"); + if (!s && !elf64_alpha_create_dynamic_sections (dynobj, info)) + return false; + + /* The first bit of the .plt is reserved. */ + if (s->_raw_size == 0) + s->_raw_size = PLT_HEADER_SIZE; + + h->plt_offset = s->_raw_size; + s->_raw_size += PLT_ENTRY_SIZE; + + /* If this symbol is not defined in a regular file, and we are not + generating a shared library, then set the symbol to the location + in the .plt. This is required to make function pointers compare + equal between the normal executable and the shared library. */ + if (!info->shared) + { + h->root.u.def.section = s; + h->root.u.def.value = h->plt_offset; + } + + /* We also need a JMP_SLOT entry in the .rela.plt section. */ + s = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += sizeof (Elf64_External_Rela); + + return true; + } + else + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return true; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. The Alpha, since it uses .got entries for all + symbols even in regular objects, does not need the hackery of a + .dynbss section and COPY dynamic relocations. */ + + return true; +} + +/* Is it possible to merge two object file's .got tables? */ + +static boolean +elf64_alpha_can_merge_gots (a, b) + bfd *a, *b; +{ + int total = alpha_elf_tdata (a)->total_got_entries; + + /* Trivial quick fallout test. */ + if (total + alpha_elf_tdata (b)->total_got_entries <= MAX_GOT_ENTRIES) + return true; + + /* By their nature, local .got entries cannot be merged. */ + if ((total += alpha_elf_tdata (b)->n_local_got_entries) > MAX_GOT_ENTRIES) + return false; + + /* Failing the common trivial comparison, we must effectively + perform the merge. Not actually performing the merge means that + we don't have to store undo information in case we fail. */ + { + struct alpha_elf_link_hash_entry **hashes = alpha_elf_sym_hashes(b); + Elf_Internal_Shdr *symtab_hdr = &elf_tdata(b)->symtab_hdr; + int i, n; + + n = symtab_hdr->sh_size / symtab_hdr->sh_entsize - symtab_hdr->sh_info; + for (i = 0; i < n; ++i) + { + struct alpha_elf_got_entry *ae, *be; + for (be = hashes[i]->got_entries; be ; be = be->next) + { + if (be->gotobj != b) + continue; + + for (ae = hashes[i]->got_entries; ae ; ae = ae->next) + if (ae->gotobj == a && ae->addend == be->addend) + goto global_found; + + if (++total > MAX_GOT_ENTRIES) + return false; + global_found:; + } + } + } + + return true; +} + +/* Actually merge two .got tables. */ + +static void +elf64_alpha_merge_gots (a, b) + bfd *a, *b; +{ + int total = alpha_elf_tdata(a)->total_got_entries; + + /* Remember local expansion. */ + { + int e = alpha_elf_tdata(b)->n_local_got_entries; + total += e; + alpha_elf_tdata(a)->n_local_got_entries += e; + } + + /* Let the local .got entries know they are part of a new subsegment. */ + { + struct alpha_elf_got_entry **local_got_entries; + local_got_entries = alpha_elf_tdata(b)->local_got_entries; + if (local_got_entries) + { + int i, n; + + n = elf_tdata(b)->symtab_hdr.sh_info; + for (i = 0; i < n; ++i) + { + struct alpha_elf_got_entry *gotent; + for (gotent = local_got_entries[i]; gotent; gotent = gotent->next) + gotent->gotobj = a; + } + } + } + + /* Merge the global .got entries. */ + { + struct alpha_elf_link_hash_entry **hashes = alpha_elf_sym_hashes(b); + Elf_Internal_Shdr *symtab_hdr = &elf_tdata(b)->symtab_hdr; + int i, n; + + n = symtab_hdr->sh_size / symtab_hdr->sh_entsize - symtab_hdr->sh_info; + for (i = 0; i < n; ++i) + { + struct alpha_elf_got_entry *ae, *be, **pbe, **start; + start = &hashes[i]->got_entries; + for (pbe = start, be = *start; be ; pbe = &be->next, be = be->next) + { + if (be->gotobj != b) + continue; + + for (ae = *start; ae ; ae = ae->next) + if (ae->gotobj == a && ae->addend == be->addend) + { + ae->flags |= be->flags; + *pbe = be->next; + goto global_found; + } + be->gotobj = a; + total += 1; + + global_found:; + } + } + } + + alpha_elf_tdata(a)->total_got_entries = total; + alpha_elf_tdata(b)->gotobj = a; +} + +/* Calculate the offsets for the got entries. */ + +static boolean +elf64_alpha_calc_got_offsets_for_symbol (h, arg) + struct alpha_elf_link_hash_entry *h; + PTR arg; +{ + struct alpha_elf_got_entry *gotent; + + for (gotent = h->got_entries; gotent; gotent = gotent->next) + { + bfd_size_type *plge = &alpha_elf_tdata (gotent->gotobj)->got->_raw_size; + gotent->got_offset = *plge; + *plge += 8; + } + + return true; +} + +static void +elf64_alpha_calc_got_offsets (info) + struct bfd_link_info *info; +{ + bfd *i, *got_list = alpha_elf_hash_table(info)->got_list; + + /* First, zero out the .got sizes, as we may be recalculating the + .got after optimizing it. */ + for (i = got_list; i ; i = alpha_elf_tdata(i)->got_link_next) + alpha_elf_tdata(i)->got->_raw_size = 0; + + /* Next, fill in the offsets for all the global entries. */ + alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), + elf64_alpha_calc_got_offsets_for_symbol, + NULL); + + /* Finally, fill in the offsets for the local entries. */ + for (i = got_list; i ; i = alpha_elf_tdata(i)->got_link_next) + { + bfd_size_type got_offset = alpha_elf_tdata(i)->got->_raw_size; + bfd *j; + + for (j = i; j ; j = alpha_elf_tdata(j)->in_got_link_next) + { + 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) + { + gotent->got_offset = got_offset; + got_offset += 8; + } + } - switch (ELF64_R_TYPE (rel->r_info)) - { - case R_ALPHA_LITERAL: - /* If this is a load of a function symbol and we are building a - shared library or calling a shared library, then we need a - .plt entry as well. - - We can tell if it is a function either by noticing the - type of the symbol, or, if the type is undefined, by - noticing that we have a LITUSE(3) reloc next. - - Note that it is not fatal to be wrong guessing that a symbol - is an object, but it is fatal to be wrong guessing that a - symbol is a function. - - Furthermore, the .plt trampoline does not give constant - function addresses, so if we ever see a function's address - taken, we cannot do lazy binding on that function. */ + alpha_elf_tdata(i)->got->_raw_size = got_offset; + } +} - if (h) - { - if (rel+1 < relend - && ELF64_R_TYPE (rel[1].r_info) == R_ALPHA_LITUSE) - { - switch (rel[1].r_addend) - { - case 1: /* Memory reference */ - h->flags |= ALPHA_ELF_LINK_HASH_LU_MEM; - break; - case 3: /* Call reference */ - h->flags |= ALPHA_ELF_LINK_HASH_LU_FUNC; - break; - } - } - else - h->flags |= ALPHA_ELF_LINK_HASH_LU_ADDR; +/* Remove a section from the output BFD. */ - if (h->root.root.type != bfd_link_hash_undefweak - && (info->shared - || !(h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR)) - && (h->root.type == STT_FUNC - || (h->root.type == STT_NOTYPE - && (h->flags & ALPHA_ELF_LINK_HASH_LU_FUNC)))) - { - h->root.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - } - } +static void +elf64_alpha_strip_section_from_output (s) + asection *s; +{ + asection **spp; - if (dynobj == NULL) - { - elf_hash_table(info)->dynobj = dynobj = abfd; + for (spp = &s->output_section->owner->sections; + *spp != s->output_section; + spp = &(*spp)->next) + continue; + *spp = s->output_section->next; + --s->output_section->owner->section_count; +} - /* Create the .got section. */ - if (!elf64_alpha_create_got_section(dynobj, info)) - return false; +/* Constructs the gots. */ - sgot = bfd_get_section_by_name(dynobj, ".got"); - srelgot = bfd_get_section_by_name(dynobj, ".rela.got"); - } +static boolean +elf64_alpha_always_size_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *i, *got_list, *cur_got_obj, **cur_got_tail; + int ngots; - if (h != NULL) - { - if (h->root.got_offset != MINUS_ONE) - { - /* We have already allocated space in this .got. */ - break; - } + if (info->relocateable) + return true; - /* Make sure this becomes a dynamic symbol. */ - if (h->root.dynindx == -1 - && ! _bfd_elf_link_record_dynamic_symbol (info, &h->root)) - return false; + ngots = 0; + got_list = NULL; + cur_got_obj = NULL; + cur_got_tail = NULL; + for (i = info->input_bfds; i ; i = i->link_next) + { + bfd *this_got = alpha_elf_tdata (i)->gotobj; - /* Reserve space for a reloc even if we won't use it. */ - srelgot->_raw_size += sizeof(Elf64_External_Rela); + /* Don't play if there is no .got for this input file. */ + if (this_got == NULL) + continue; - /* Create the relocation in adjust_dynamic_symbol */ + if (alpha_elf_tdata (this_got)->total_got_entries > MAX_GOT_ENTRIES) + { + /* Yikes! A single object file has too many entries. */ + (*_bfd_error_handler) + ("%s: .got subsegment exceeds 64K (size %d)", + bfd_get_filename(i), + alpha_elf_tdata(this_got)->total_got_entries * 8); + return false; + } - h->root.got_offset = sgot->_raw_size; - sgot->_raw_size += 8; + if (cur_got_obj) + { + if (elf64_alpha_can_merge_gots (cur_got_obj, i)) + { + elf64_alpha_merge_gots (cur_got_obj, i); + *cur_got_tail = i; } else { - bfd_vma *lgotoff = elf_local_got_offsets(abfd); - if (lgotoff == NULL) - { - size_t size; - - size = elf_tdata(abfd)->symtab_hdr.sh_info * sizeof(bfd_vma); - lgotoff = (bfd_vma *)bfd_alloc(abfd, size); - if (lgotoff == NULL) - return false; - - elf_local_got_offsets(abfd) = lgotoff; - memset(lgotoff, -1, size); - } - - if (lgotoff[ELF64_R_SYM(rel->r_info)] != MINUS_ONE) - { - /* We have already allocated space in the .got. */ - break; - } - lgotoff[ELF64_R_SYM(rel->r_info)] = sgot->_raw_size; - sgot->_raw_size += 8; - - if (info->shared) + if (++ngots == 2) { - /* If we are generating a shared object, we need to - output a R_ALPHA_RELATIVE reloc so that the dynamic - linker can adjust this GOT entry. */ - srelgot->_raw_size += sizeof(Elf64_External_Rela); - } + (*info->callbacks->warning) + (info, "using multiple gp values", (char *) NULL, + output_bfd, (asection *) NULL, (bfd_vma) 0); + } + *cur_got_tail = NULL; + alpha_elf_tdata(cur_got_obj)->got_link_next = got_list; + got_list = cur_got_obj; + cur_got_obj = i; } - break; - - case R_ALPHA_SREL16: - case R_ALPHA_SREL32: - case R_ALPHA_SREL64: - if (h == NULL) - break; - /* FALLTHRU */ + } + else + { + ++ngots; + cur_got_obj = i; + } + cur_got_tail = &alpha_elf_tdata(i)->in_got_link_next; + } - case R_ALPHA_REFLONG: - case R_ALPHA_REFQUAD: - if (info->shared - || (h != NULL - && !(h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR))) - { - /* When creating a shared object or referring to a symbol in - a shared object, we must copy these relocs into the - object file. We create a reloc section in dynobj and - make room for the reloc. */ - if (sreloc == NULL) - { - const char *name; - name = (bfd_elf_string_from_elf_section - (abfd, elf_elfheader(abfd)->e_shstrndx, - elf_section_data(sec)->rel_hdr.sh_name)); - if (name == NULL) - return false; + if (cur_got_obj) + alpha_elf_tdata (cur_got_obj)->got_link_next = got_list; + alpha_elf_hash_table (info)->got_list = got_list = cur_got_obj; - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (abfd, sec), - name+5) == 0); + /* Once the gots have been merged, fill in the got offsets for everything + therein. */ + elf64_alpha_calc_got_offsets (info); - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - { - sreloc = bfd_make_section (dynobj, name); - if (sreloc == NULL - || !bfd_set_section_flags (dynobj, sreloc, - (SEC_ALLOC|SEC_LOAD - |SEC_HAS_CONTENTS - |SEC_IN_MEMORY - |SEC_READONLY)) - || !bfd_set_section_alignment (dynobj, sreloc, 3)) - return false; - } - } - sreloc->_raw_size += sizeof (Elf64_External_Rela); - } - break; + /* Allocate space for all of the .got subsections. */ + for (i = got_list; i ; i = alpha_elf_tdata(i)->got_link_next) + { + asection *s = alpha_elf_tdata(i)->got; + if (s->_raw_size > 0) + { + s->contents = (bfd_byte *) bfd_zalloc (i, s->_raw_size); + if (s->contents == NULL) + return false; } } return true; } -/* Adjust a symbol defined by a dynamic object and referenced by a - regular object. The current definition is in some section of the - dynamic object, but we're not including those sections. We have to - change the definition to something the rest of the link can - understand. */ +/* Work out the sizes of the dynamic relocation entries. */ static boolean -elf64_alpha_adjust_dynamic_symbol (info, h) +elf64_alpha_calc_dynrel_sizes (h, info) + struct alpha_elf_link_hash_entry *h; struct bfd_link_info *info; - struct elf_link_hash_entry *h; { - bfd *dynobj; - asection *s; - - dynobj = elf_hash_table(info)->dynobj; - - /* If this is a function, put it in the procedure linkage table. We - will fill in the contents of the procedure linkage table later, - though we could actually do it here. */ - - if (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - { - /* We hadn't seen all of the input symbols or all of the relocations - when we guessed that we needed a .plt entry. Revise our decision. */ - if ((!info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - || (((struct alpha_elf_link_hash_entry *) h)->flags - & ALPHA_ELF_LINK_HASH_LU_ADDR)) - { - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - return true; - } - - s = bfd_get_section_by_name(dynobj, ".plt"); - BFD_ASSERT(s != NULL); - - /* The first bit of the .plt is reserved. */ - if (s->_raw_size == 0) - s->_raw_size = PLT_HEADER_SIZE; + /* If the symbol was defined as a common symbol in a regular object + file, and there was no definition in any dynamic object, then the + linker will have allocated space for the symbol in a common + section but the ELF_LINK_HASH_DEF_REGULAR flag will not have been + set. This is done for dynamic symbols in + elf_adjust_dynamic_symbol but this is not done for non-dynamic + symbols, somehow. */ + if (((h->root.elf_link_hash_flags + & (ELF_LINK_HASH_DEF_REGULAR + | ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_DEF_DYNAMIC)) + == ELF_LINK_HASH_REF_REGULAR) + && (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->plt_offset = s->_raw_size; + /* If the symbol is dynamic, we'll need all the relocations in their + natural form. */ + if (alpha_elf_dynamic_symbol_p (&h->root, info)) + { + struct alpha_elf_reloc_entry *relent; - /* If this symbol is not defined in a regular file, and we are not - generating a shared library, then set the symbol to the location - in the .plt. This is required to make function pointers compare - equal between the normal executable and the shared library. */ - if (!info->shared) + for (relent = h->reloc_entries; relent; relent = relent->next) { - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; + relent->srel->_raw_size += + sizeof (Elf64_External_Rela) * relent->count; } - s->_raw_size += PLT_ENTRY_SIZE; - - /* We also need an entry in the .rela.plt section. */ - s = bfd_get_section_by_name(dynobj, ".rela.plt"); - BFD_ASSERT(s != NULL); - s->_raw_size += sizeof(Elf64_External_Rela); + /* Only add a .rela.got entry if we're not using a .plt entry. */ + if (h->root.plt_offset == MINUS_ONE) + { + bfd *dynobj = elf_hash_table(info)->dynobj; + struct alpha_elf_got_entry *gotent; + bfd_size_type count = 0; + asection *srel; - return true; + for (gotent = h->got_entries; gotent ; gotent = gotent->next) + count++; + if (count > 0) + { + srel = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf64_External_Rela) * count; + } + } } - - /* If this is a weak symbol, and there is a real definition, the - processor independent code will have arranged for us to see the - real definition first, and we can just use the same value. */ - if (h->weakdef != NULL) + /* Otherwise, shared objects require RELATIVE relocs for all REFQUAD + and REFLONG relocations. */ + else if (info->shared) { - BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined - || h->weakdef->root.type == bfd_link_hash_defweak); - h->root.u.def.section = h->weakdef->root.u.def.section; - h->root.u.def.value = h->weakdef->root.u.def.value; - return true; - } + struct alpha_elf_reloc_entry *relent; - /* This is a reference to a symbol defined by a dynamic object which - is not a function. The Alpha, since it uses .got entries for - symbols even in regular objects, does not need the hackery of a - .dynbss section and COPY dynamic relocations. */ + 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; + } + } return true; } @@ -1834,28 +2224,45 @@ dynobj = elf_hash_table(info)->dynobj; BFD_ASSERT(dynobj != NULL); - if (elf_hash_table(info)->dynamic_sections_created) + if (elf_hash_table (info)->dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ if (!info->shared) { - s = bfd_get_section_by_name(dynobj, ".interp"); - BFD_ASSERT(s != NULL); + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; - s->contents = (unsigned char *)ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + + /* Now that we've seen all of the input files, we can decide which + symbols need dynamic relocation entries and which don't. We've + 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; + + 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); } } - else - { - /* We may have created entries in the .rela.got section. - However, if we are not creating the dynamic sections, we will - not actually use these entries. Reset the size of .rel.got, - which will cause it to get stripped from the output file - below. */ - s = bfd_get_section_by_name (dynobj, ".rela.got"); - if (s != NULL) - s->_raw_size = 0; - } + /* else we're not dynamic and by definition we don't need such things. */ /* The check_relocs and adjust_dynamic_symbol entry points have determined the sizes of the various dynamic sections. Allocate @@ -1867,12 +2274,12 @@ const char *name; boolean strip; - if (!(s->flags & SEC_IN_MEMORY)) + if (!(s->flags & SEC_LINKER_CREATED)) continue; /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name(dynobj, s); + name = bfd_get_section_name (dynobj, s); /* If we don't need this section, strip it from the output file. This is to handle .rela.bss and .rela.plt. We must create it @@ -1884,17 +2291,20 @@ strip = false; - if (strncmp(name, ".rela", 5) == 0) + if (strncmp (name, ".rela", 5) == 0) { strip = (s->_raw_size == 0); if (!strip) { + const char *outname; asection *target; /* If this relocation section applies to a read only section, then we probably need a DT_TEXTREL entry. */ - target = bfd_get_section_by_name (output_bfd, name + 5); + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 5); if (target != NULL && (target->flags & SEC_READONLY) != 0) reltext = true; @@ -1907,60 +2317,49 @@ s->reloc_count = 0; } } - else if (strcmp(name, ".got") == 0) - { - /* If we are generating a shared library, we generate a - section symbol for each output section. These are local - symbols, which means that they must come first in the - dynamic symbol table. That means we must increment the - dynamic symbol index of every other dynamic symbol. */ - if (info->shared) - { - long c[2], i; - asection *p; - - c[0] = 0; - c[1] = bfd_count_sections(output_bfd); - - elf_link_hash_traverse (elf_hash_table(info), - elf64_alpha_adjust_dynindx, - (PTR)c); - elf_hash_table (info)->dynsymcount += c[1]; - - for (i = 3, p = output_bfd->sections; - p != NULL; - p = p->next, i++) - { - elf_section_data (p)->dynindx = i; - /* These symbols will have no names, so we don't need to - fiddle with dynstr_index. */ - } - } - } else if (strcmp (name, ".plt") != 0) { - /* It's not one of our sections, so don't allocate space. */ + /* It's not one of our dynamic sections, so don't allocate space. */ continue; } if (strip) + elf64_alpha_strip_section_from_output (s); + else { - asection **spp; + /* Allocate memory for the section contents. */ + s->contents = (bfd_byte *) bfd_zalloc(dynobj, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return false; + } + } - for (spp = &s->output_section->owner->sections; - *spp != s->output_section; - spp = &(*spp)->next) - continue; - *spp = s->output_section->next; - --s->output_section->owner->section_count; + /* If we are generating a shared library, we generate a section + symbol for each output section. These are local symbols, which + means that they must come first in the dynamic symbol table. + That means we must increment the dynamic symbol index of every + other dynamic symbol. */ + if (info->shared) + { + long c[2], i; + asection *p; - continue; - } + c[0] = 0; + c[1] = bfd_count_sections (output_bfd); - /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_zalloc(dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return false; + elf_hash_table (info)->dynsymcount += c[1]; + elf_link_hash_traverse (elf_hash_table(info), + elf64_alpha_adjust_dynindx, + (PTR) c); + + for (i = 1, p = output_bfd->sections; + p != NULL; + p = p->next, i++) + { + elf_section_data (p)->dynindx = i; + /* These symbols will have no names, so we don't need to + fiddle with dynstr_index. */ + } } if (elf_hash_table (info)->dynamic_sections_created) @@ -2036,28 +2435,32 @@ Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - asection *sec, *sgot, *splt; - bfd *dynobj; + asection *sec, *sgot, *srel, *srelgot; + bfd *dynobj, *gotobj; bfd_vma gp; - symtab_hdr = &elf_tdata(input_bfd)->symtab_hdr; + 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"); + } /* Find the gp value for this input bfd. */ sgot = NULL; gp = 0; - dynobj = elf_hash_table(info)->dynobj; - if (dynobj) + gotobj = alpha_elf_tdata (input_bfd)->gotobj; + if (gotobj) { - sgot = bfd_get_section_by_name (dynobj, ".got"); - splt = bfd_get_section_by_name (dynobj, ".plt"); - - gp = _bfd_get_gp_value(dynobj); + sgot = alpha_elf_tdata (gotobj)->got; + gp = _bfd_get_gp_value (gotobj); if (gp == 0) { gp = (sgot->output_section->vma + sgot->output_offset + 0x8000); - _bfd_set_gp_value(dynobj, gp); + _bfd_set_gp_value (gotobj, gp); } } @@ -2068,7 +2471,7 @@ int r_type; reloc_howto_type *howto; unsigned long r_symndx; - struct elf_link_hash_entry *h; + struct alpha_elf_link_hash_entry *h; Elf_Internal_Sym *sym; bfd_vma relocation; bfd_vma addend; @@ -2119,43 +2522,27 @@ } else { - h = elf_sym_hashes(input_bfd)[r_symndx - symtab_hdr->sh_info]; + h = alpha_elf_sym_hashes (input_bfd)[r_symndx - symtab_hdr->sh_info]; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *)h->root.u.i.link; - - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - - /* If the symbol was defined as a common symbol in a - regular object file, and there was no definition in - any dynamic object, then the linker will have - allocated space for the symbol in a common section - but the ELF_LINK_HASH_DEF_REGULAR flag will not have - been set. This is done for dynamic symbols in - elf_adjust_dynamic_symbol but this is not done for - non-dynamic symbols, somehow. */ - if ((h->elf_link_hash_flags - & (ELF_LINK_HASH_DEF_REGULAR - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_DYNAMIC)) - == ELF_LINK_HASH_REF_REGULAR - && !(sec->owner->flags & DYNAMIC)) - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + while (h->root.root.type == bfd_link_hash_indirect + || h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; + + 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 rth_notdef if ((r_type == R_ALPHA_LITERAL && elf_hash_table(info)->dynamic_sections_created && (!info->shared || !info->symbolic - || !(h->elf_link_hash_flags + || !(h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) || (info->shared && (!info->symbolic - || !(h->elf_link_hash_flags + || !(h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) && (input_section->flags & SEC_ALLOC) && (r_type == R_ALPHA_REFLONG @@ -2175,19 +2562,19 @@ #endif /* rth_notdef */ else { - relocation = (h->root.u.def.value + relocation = (h->root.root.u.def.value + sec->output_section->vma + sec->output_offset); } } - else if (h->root.type == bfd_link_hash_undefweak) + else if (h->root.root.type == bfd_link_hash_undefweak) relocation = 0; else if (info->shared && !info->symbolic) relocation = 0; else { if (!((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, + (info, h->root.root.root.string, input_bfd, input_section, rel->r_offset))) return false; relocation = 0; @@ -2201,6 +2588,8 @@ { bfd_byte *p_ldah, *p_lda; + BFD_ASSERT(gp != 0); + relocation = (input_section->output_section->vma + input_section->output_offset + rel->r_offset); @@ -2217,63 +2606,80 @@ case R_ALPHA_OP_STORE: case R_ALPHA_OP_PSUB: case R_ALPHA_OP_PRSHIFT: - /* FIXME */ + /* We hate these silly beasts. */ abort(); case R_ALPHA_LITERAL: { - bfd_vma gotoff; + struct alpha_elf_got_entry *gotent; - BFD_ASSERT(gp != 0); BFD_ASSERT(sgot != NULL); + BFD_ASSERT(gp != 0); + if (h != NULL) { - gotoff = h->got_offset; + gotent = h->got_entries; + while (gotent->gotobj != gotobj || gotent->addend != addend) + gotent = gotent->next; + + /* 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); + + /* The dynamic relocations for the .got entries are + done in finish_dynamic_symbol. */ + + gotent->flags |= ALPHA_ELF_GOT_ENTRY_RELOCS_DONE; + } } else { - gotoff = elf_local_got_offsets (input_bfd)[r_symndx]; - - /* Use the lsb as a flag indicating that we've already - output the relocation entry. */ - if (info->shared) - if (gotoff & 1) - gotoff &= ~(bfd_vma)1; - else - { - asection *srel; - Elf_Internal_Rela outrel; + gotent = (alpha_elf_tdata(input_bfd)-> + local_got_entries[r_symndx]); + while (gotent->addend != addend) + gotent = gotent->next; + + if (!(gotent->flags & ALPHA_ELF_GOT_ENTRY_RELOCS_DONE)) + { + bfd_put_64 (output_bfd, relocation+addend, + sgot->contents + gotent->got_offset); + + /* Local got entries need RELATIVE relocs in shared + libraries. */ + if (info->shared) + { + 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 = 0; + + bfd_elf64_swap_reloca_out (output_bfd, &outrel, + ((Elf64_External_Rela *) + srelgot->contents) + + srelgot->reloc_count++); + } - srel = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT(srel != NULL); - - outrel.r_offset = (sgot->output_section->vma - + sgot->output_offset + gotoff); - outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE); - outrel.r_addend = 0; - - bfd_elf64_swap_reloca_out (output_bfd, &outrel, - ((Elf64_External_Rela *) - srel->contents) - + srel->reloc_count++); - - elf_local_got_offsets (input_bfd)[r_symndx] |= 1; - } + gotent->flags |= ALPHA_ELF_GOT_ENTRY_RELOCS_DONE; + } } - /* Initialize the .got entry. */ - bfd_put_64 (output_bfd, relocation, sgot->contents + gotoff); - /* Figure the gprel relocation. */ addend = 0; relocation = (sgot->output_section->vma + sgot->output_offset - + gotoff); + + gotent->got_offset); relocation -= gp; } /* overflow handled by _bfd_final_link_relocate */ goto default_reloc; - + case R_ALPHA_GPREL32: BFD_ASSERT(gp != 0); relocation -= gp; @@ -2285,44 +2691,73 @@ the instruction rather than the end. */ addend -= 4; goto default_reloc; - + case R_ALPHA_REFLONG: case R_ALPHA_REFQUAD: - if (info->shared - || (h && !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - asection *srel; - const char *name; - Elf_Internal_Rela outrel; - - 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); - - outrel.r_offset = (input_section->output_section->vma - + input_section->output_offset - + rel->r_offset); - outrel.r_addend = 0; - if (h) - { - BFD_ASSERT(h->dynindx != -1); - outrel.r_info = ELF64_R_INFO(h->dynindx, r_type); - relocation = 0; - } - else - { - outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE); - } + { + Elf_Internal_Rela outrel; + boolean skip; - bfd_elf64_swap_reloca_out (output_bfd, &outrel, - ((Elf64_External_Rela *) - srel->contents) - + srel->reloc_count++); - } + /* Careful here to remember RELATIVE relocations for global + variables for symbolic shared objects. */ + + if (h && alpha_elf_dynamic_symbol_p (&h->root, info)) + { + BFD_ASSERT(h->root.dynindx != -1); + outrel.r_info = ELF64_R_INFO(h->root.dynindx, r_type); + outrel.r_addend = addend; + addend = 0, relocation = 0; + } + else if (info->shared) + { + outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE); + outrel.r_addend = 0; + } + 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); + } + + skip = false; + + if (elf_section_data (input_section)->stab_info == NULL) + outrel.r_offset = rel->r_offset; + else + { + bfd_vma off; + + off = (_bfd_stab_section_offset + (output_bfd, &elf_hash_table (info)->stab_info, + input_section, + &elf_section_data (input_section)->stab_info, + rel->r_offset)); + if (off == (bfd_vma) -1) + skip = true; + outrel.r_offset = off; + } + + if (! skip) + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + else + memset (&outrel, 0, sizeof outrel); + + bfd_elf64_swap_reloca_out (output_bfd, &outrel, + ((Elf64_External_Rela *) + srel->contents) + + srel->reloc_count++); + } goto default_reloc; default: @@ -2343,7 +2778,7 @@ const char *name; if (h != NULL) - name = h->root.root.string; + name = h->root.root.root.string; else { name = (bfd_elf_string_from_elf_section @@ -2383,26 +2818,30 @@ if (h->plt_offset != MINUS_ONE) { + /* Fill in the .plt entry for this symbol. */ asection *splt, *sgot, *srel; Elf_Internal_Rela outrel; bfd_vma got_addr, plt_addr; bfd_vma plt_index; + struct alpha_elf_got_entry *gotent; - /* This symbol has an entry in the procedure linkage table. */ + BFD_ASSERT (h->dynindx != -1); - BFD_ASSERT(h->dynindx != -1); - BFD_ASSERT(h->got_offset != MINUS_ONE); + /* The first .got entry will be updated by the .plt with the + address of the target function. */ + gotent = ((struct alpha_elf_link_hash_entry *) h)->got_entries; + BFD_ASSERT (gotent && gotent->addend == 0); - splt = bfd_get_section_by_name(dynobj, ".plt"); - BFD_ASSERT(splt != NULL); - srel = bfd_get_section_by_name(dynobj, ".rela.plt"); - BFD_ASSERT(srel != NULL); - sgot = bfd_get_section_by_name(dynobj, ".got"); - BFD_ASSERT(sgot != NULL); + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL); + srel = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (srel != NULL); + sgot = alpha_elf_tdata (gotent->gotobj)->got; + BFD_ASSERT (sgot != NULL); got_addr = (sgot->output_section->vma - + sgot->output_offset - + h->got_offset); + + sgot->output_offset + + gotent->got_offset); plt_addr = (splt->output_section->vma + splt->output_offset + h->plt_offset); @@ -2422,7 +2861,7 @@ insn1 = PLT_ENTRY_WORD1 | (hi & 0xffff); insn2 = PLT_ENTRY_WORD2 | (lo & 0xffff); insn3 = PLT_ENTRY_WORD3 | ((-(h->plt_offset + 12) >> 2) & 0x1fffff); - + bfd_put_32 (output_bfd, insn1, splt->contents + h->plt_offset); bfd_put_32 (output_bfd, insn2, splt->contents + h->plt_offset + 4); bfd_put_32 (output_bfd, insn3, splt->contents + h->plt_offset + 8); @@ -2444,38 +2883,45 @@ sym->st_shndx = SHN_UNDEF; } - /* Fill in the entry in the global offset table. */ - bfd_put_64 (output_bfd, plt_addr, sgot->contents + h->got_offset); + /* Fill in the entries in the .got. */ + bfd_put_64 (output_bfd, plt_addr, sgot->contents + gotent->got_offset); + + /* Subsequent .got entries will continue to bounce through the .plt. */ + while ((gotent = gotent->next) != NULL) + { + sgot = alpha_elf_tdata(gotent->gotobj)->got; + BFD_ASSERT(sgot != NULL); + BFD_ASSERT(gotent->addend == 0); + + bfd_put_64 (output_bfd, plt_addr, + sgot->contents + gotent->got_offset); + } } - else if (h->got_offset != MINUS_ONE) + else if (alpha_elf_dynamic_symbol_p (h, info)) { - asection *sgot, *srel; + /* Fill in the dynamic relocations for this symbol's .got entries. */ + asection *srel; Elf_Internal_Rela outrel; + struct alpha_elf_got_entry *gotent; - BFD_ASSERT(h->dynindx != -1); - - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); srel = bfd_get_section_by_name (dynobj, ".rela.got"); BFD_ASSERT (srel != NULL); - outrel.r_offset = (sgot->output_section->vma - + sgot->output_offset - + h->got_offset); - outrel.r_addend = 0; - if (info->shared - && info->symbolic - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE); - else - { - bfd_put_64(output_bfd, (bfd_vma)0, sgot->contents + h->got_offset); - outrel.r_info = ELF64_R_INFO(h->dynindx, R_ALPHA_GLOB_DAT); + 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; + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + gotent->got_offset); + outrel.r_addend = gotent->addend; + + bfd_elf64_swap_reloca_out (output_bfd, &outrel, + ((Elf64_External_Rela *)srel->contents + + srel->reloc_count++)); } - - bfd_elf64_swap_reloca_out (output_bfd, &outrel, - ((Elf64_External_Rela *)srel->contents - + srel->reloc_count++)); } /* Mark some specially defined symbols as absolute. */ @@ -2496,7 +2942,6 @@ { bfd *dynobj; asection *sdyn; - asection *sgot; dynobj = elf_hash_table (info)->dynobj; sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); @@ -2534,8 +2979,8 @@ case DT_RELASZ: /* My interpretation of the TIS v1.1 ELF document indicates that RELASZ should not include JMPREL. This is not what - the rest of the BFD does. It is, however, what the - glibc ld.so wants. Do this fixup here until we found + the rest of the BFD does. It is, however, what the + glibc ld.so wants. Do this fixup here until we found out who is right. */ s = bfd_get_section_by_name (output_bfd, ".rela.plt"); if (s) @@ -2567,32 +3012,16 @@ bfd_put_32 (output_bfd, PLT_HEADER_WORD2, splt->contents + 4); bfd_put_32 (output_bfd, PLT_HEADER_WORD3, splt->contents + 8); bfd_put_32 (output_bfd, PLT_HEADER_WORD4, splt->contents + 12); - + /* The next two words will be filled in by ld.so */ bfd_put_64 (output_bfd, 0, splt->contents + 16); bfd_put_64 (output_bfd, 0, splt->contents + 24); - elf_section_data (splt->output_section)->this_hdr.sh_entsize = + elf_section_data (splt->output_section)->this_hdr.sh_entsize = PLT_HEADER_SIZE; } } - /* Set the first entry in the global offset table to the address of - the dynamic section. */ - sgot = bfd_get_section_by_name (dynobj, ".got"); - if (sgot && sgot->_raw_size > 0) - { - if (sdyn == NULL) - bfd_put_64 (output_bfd, (bfd_vma)0, sgot->contents); - else - bfd_put_64 (output_bfd, - sdyn->output_section->vma + sdyn->output_offset, - sgot->contents); - - elf_section_data (sgot->output_section)->this_hdr.sh_entsize = - 8 * RESERVED_GOT_ENTRIES; - } - if (info->shared) { asection *sdynsym; @@ -2801,7 +3230,7 @@ } else esym.asym.value = last; - + if (! bfd_ecoff_debug_one_external (abfd, &debug, swap, name[i], &esym)) return false; @@ -2919,7 +3348,9 @@ rtproc_sec = bfd_get_section_by_name (abfd, ".rtproc"); if (rtproc_sec == NULL) { - flagword flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY + flagword flags = (SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY); rtproc_sec = bfd_make_section (abfd, ".rtproc"); @@ -3188,6 +3619,27 @@ /* Now write out the computed sections. */ + /* The .got subsections... */ + { + bfd *i, *dynobj = elf_hash_table(info)->dynobj; + for (i = alpha_elf_hash_table(info)->got_list; + i != NULL; + i = alpha_elf_tdata(i)->got_link_next) + { + asection *sgot; + + /* elf_bfd_final_link already did everything in dynobj. */ + if (i == dynobj) + continue; + + sgot = alpha_elf_tdata(i)->got; + if (! bfd_set_section_contents (abfd, sgot->output_section, + sgot->contents, sgot->output_offset, + sgot->_raw_size)) + return false; + } + } + #ifdef ERIC_neverdef if (reginfo_sec != (asection *) NULL) { @@ -3291,8 +3743,11 @@ #define elf_info_to_howto \ elf64_alpha_info_to_howto +#define bfd_elf64_mkobject \ + elf64_alpha_mkobject #define elf_backend_object_p \ - elf64_alpha_object_p + elf64_alpha_object_p + #define elf_backend_section_from_shdr \ elf64_alpha_section_from_shdr #define elf_backend_fake_sections \ @@ -3300,8 +3755,8 @@ #define elf_backend_additional_program_headers \ elf64_alpha_additional_program_headers -#define bfd_elf64_bfd_is_local_label \ - elf64_alpha_is_local_label +#define bfd_elf64_bfd_is_local_label_name \ + elf64_alpha_is_local_label_name #define bfd_elf64_find_nearest_line \ elf64_alpha_find_nearest_line @@ -3311,6 +3766,8 @@ elf64_alpha_create_dynamic_sections #define elf_backend_adjust_dynamic_symbol \ elf64_alpha_adjust_dynamic_symbol +#define elf_backend_always_size_sections \ + elf64_alpha_always_size_sections #define elf_backend_size_dynamic_sections \ elf64_alpha_size_dynamic_sections #define elf_backend_relocate_section \ diff -urN binutils-2.7/bfd/elf64-mips.c binutils-2.8/bfd/elf64-mips.c --- binutils-2.7/bfd/elf64-mips.c Thu Jul 4 12:18:48 1996 +++ binutils-2.8/bfd/elf64-mips.c Wed Apr 30 12:56:05 1997 @@ -22,11 +22,14 @@ The MIPS 64-bit ELF ABI uses an unusual reloc format. This file overrides the usual ELF reloc handling, and handles reading and - writing the relocations here. */ + writing the relocations here. + + The MIPS 64-bit ELF ABI also uses an unusual archive map format. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" +#include "aout/ar.h" #include "bfdlink.h" #include "genlink.h" #include "elf-bfd.h" @@ -63,12 +66,15 @@ static boolean mips_elf64_slurp_one_reloc_table PARAMS ((bfd *, asection *, asymbol **, const Elf_Internal_Shdr *)); static boolean mips_elf64_slurp_reloc_table - PARAMS ((bfd *, asection *, asymbol **)); + PARAMS ((bfd *, asection *, asymbol **, boolean)); static void mips_elf64_write_relocs PARAMS ((bfd *, asection *, PTR)); static boolean mips_elf64_section_from_shdr PARAMS ((bfd *, Elf_Internal_Shdr *, char *)); static boolean mips_elf64_section_processing PARAMS ((bfd *, Elf_Internal_Shdr *)); +static boolean mips_elf64_slurp_armap PARAMS ((bfd *)); +static boolean mips_elf64_write_armap + PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); /* The relocation types. */ @@ -1537,13 +1543,20 @@ associated with a single data section. */ static boolean -mips_elf64_slurp_reloc_table (abfd, asect, symbols) +mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) bfd *abfd; asection *asect; asymbol **symbols; + boolean dynamic; { struct bfd_elf_section_data * const d = elf_section_data (asect); + if (dynamic) + { + bfd_set_error (bfd_error_invalid_operation); + return false; + } + if (asect->relocation != NULL || (asect->flags & SEC_RELOC) == 0 || asect->reloc_count == 0) @@ -1829,6 +1842,215 @@ return _bfd_mips_elf_section_processing (abfd, hdr); } +/* Irix 6 defines a brand new archive map format, so that they can + have archives more than 4 GB in size. */ + +/* Read an Irix 6 armap. */ + +static boolean +mips_elf64_slurp_armap (abfd) + bfd *abfd; +{ + struct artdata *ardata = bfd_ardata (abfd); + char nextname[17]; + file_ptr arhdrpos; + bfd_size_type i, parsed_size, nsymz, stringsize, carsym_size, ptrsize; + struct areltdata *mapdata; + bfd_byte int_buf[8]; + char *stringbase; + bfd_byte *raw_armap = NULL; + carsym *carsyms; + + ardata->symdefs = NULL; + + /* Get the name of the first element. */ + arhdrpos = bfd_tell (abfd); + i = bfd_read ((PTR) nextname, 1, 16, abfd); + if (i == 0) + return true; + if (i != 16) + return false; + + if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0) + return false; + + /* Archives with traditional armaps are still permitted. */ + if (strncmp (nextname, "/ ", 16) == 0) + return bfd_slurp_armap (abfd); + + if (strncmp (nextname, "/SYM64/ ", 16) != 0) + { + bfd_has_map (abfd) = false; + return true; + } + + mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); + if (mapdata == NULL) + return false; + parsed_size = mapdata->parsed_size; + bfd_release (abfd, (PTR) mapdata); + + if (bfd_read (int_buf, 1, 8, abfd) != 8) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_malformed_archive); + return false; + } + + nsymz = bfd_getb64 (int_buf); + stringsize = parsed_size - 8 * nsymz - 8; + + carsym_size = nsymz * sizeof (carsym); + ptrsize = 8 * nsymz; + + ardata->symdefs = (carsym *) bfd_zalloc (abfd, carsym_size + stringsize + 1); + if (ardata->symdefs == NULL) + return false; + carsyms = ardata->symdefs; + stringbase = ((char *) ardata->symdefs) + carsym_size; + + raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize); + if (raw_armap == NULL) + goto error_return; + + if (bfd_read (raw_armap, 1, ptrsize, abfd) != ptrsize + || bfd_read (stringbase, 1, stringsize, abfd) != stringsize) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_malformed_archive); + goto error_return; + } + + for (i = 0; i < nsymz; i++) + { + carsyms->file_offset = bfd_getb64 (raw_armap + i * 8); + carsyms->name = stringbase; + stringbase += strlen (stringbase) + 1; + ++carsyms; + } + *stringbase = '\0'; + + ardata->symdef_count = nsymz; + ardata->first_file_filepos = arhdrpos + sizeof (struct ar_hdr) + parsed_size; + + bfd_has_map (abfd) = true; + bfd_release (abfd, raw_armap); + + return true; + + error_return: + if (raw_armap != NULL) + bfd_release (abfd, raw_armap); + if (ardata->symdefs != NULL) + bfd_release (abfd, ardata->symdefs); + return false; +} + +/* Write out an Irix 6 armap. The Irix 6 tools are supposed to be + able to handle ordinary ELF armaps, but at least on Irix 6.2 the + linker crashes. */ + +static boolean +mips_elf64_write_armap (arch, elength, map, symbol_count, stridx) + bfd *arch; + unsigned int elength; + struct orl *map; + unsigned int symbol_count; + int stridx; +{ + unsigned int ranlibsize = (symbol_count * 8) + 8; + unsigned int stringsize = stridx; + unsigned int mapsize = stringsize + ranlibsize; + file_ptr archive_member_file_ptr; + bfd *current = arch->archive_head; + unsigned int count; + struct ar_hdr hdr; + unsigned int i; + int padding; + bfd_byte buf[8]; + + padding = BFD_ALIGN (mapsize, 8) - mapsize; + mapsize += padding; + + /* work out where the first object file will go in the archive */ + archive_member_file_ptr = (mapsize + + elength + + sizeof (struct ar_hdr) + + SARMAG); + + memset ((char *) (&hdr), 0, sizeof (struct ar_hdr)); + strcpy (hdr.ar_name, "/SYM64/"); + sprintf (hdr.ar_size, "%-10d", (int) mapsize); + sprintf (hdr.ar_date, "%ld", (long) time (NULL)); + /* This, at least, is what Intel coff sets the values to.: */ + sprintf ((hdr.ar_uid), "%d", 0); + sprintf ((hdr.ar_gid), "%d", 0); + sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0); + strncpy (hdr.ar_fmag, ARFMAG, 2); + + for (i = 0; i < sizeof (struct ar_hdr); i++) + if (((char *) (&hdr))[i] == '\0') + (((char *) (&hdr))[i]) = ' '; + + /* Write the ar header for this item and the number of symbols */ + + if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), arch) + != sizeof (struct ar_hdr)) + return false; + + bfd_putb64 (symbol_count, buf); + if (bfd_write (buf, 1, 8, arch) != 8) + return false; + + /* Two passes, first write the file offsets for each symbol - + remembering that each offset is on a two byte boundary. */ + + /* Write out the file offset for the file associated with each + symbol, and remember to keep the offsets padded out. */ + + current = arch->archive_head; + count = 0; + while (current != (bfd *) NULL && count < symbol_count) + { + /* For each symbol which is used defined in this object, write out + the object file's address in the archive */ + + while (((bfd *) (map[count]).pos) == current) + { + bfd_putb64 (archive_member_file_ptr, buf); + if (bfd_write (buf, 1, 8, arch) != 8) + return false; + count++; + } + /* Add size of this archive entry */ + archive_member_file_ptr += (arelt_size (current) + + sizeof (struct ar_hdr)); + /* remember about the even alignment */ + archive_member_file_ptr += archive_member_file_ptr % 2; + current = current->next; + } + + /* now write the strings themselves */ + for (count = 0; count < symbol_count; count++) + { + size_t len = strlen (*map[count].name) + 1; + + if (bfd_write (*map[count].name, 1, len, arch) != len) + return false; + } + + /* The spec says that this should be padded to an 8 byte boundary. + However, the Irix 6.2 tools do not appear to do this. */ + while (padding != 0) + { + if (bfd_write ("", 1, 1, arch) != 1) + return false; + --padding; + } + + return true; +} + /* ECOFF swapping routines. These are used when dealing with the .mdebug section, which is in the ECOFF debugging format. */ static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap = @@ -1927,5 +2149,24 @@ #define bfd_elf64_bfd_merge_private_bfd_data \ _bfd_mips_elf_merge_private_bfd_data #define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags + +#define bfd_elf64_archive_functions +#define bfd_elf64_archive_slurp_armap mips_elf64_slurp_armap +#define bfd_elf64_archive_slurp_extended_name_table \ + _bfd_archive_coff_slurp_extended_name_table +#define bfd_elf64_archive_construct_extended_name_table \ + _bfd_archive_coff_construct_extended_name_table +#define bfd_elf64_archive_truncate_arname \ + _bfd_archive_coff_truncate_arname +#define bfd_elf64_archive_write_armap mips_elf64_write_armap +#define bfd_elf64_archive_read_ar_hdr _bfd_archive_coff_read_ar_hdr +#define bfd_elf64_archive_openr_next_archived_file \ + _bfd_archive_coff_openr_next_archived_file +#define bfd_elf64_archive_get_elt_at_index \ + _bfd_archive_coff_get_elt_at_index +#define bfd_elf64_archive_generic_stat_arch_elt \ + _bfd_archive_coff_generic_stat_arch_elt +#define bfd_elf64_archive_update_armap_timestamp \ + _bfd_archive_coff_update_armap_timestamp #include "elf64-target.h" diff -urN binutils-2.7/bfd/elfcode.h binutils-2.8/bfd/elfcode.h --- binutils-2.7/bfd/elfcode.h Thu Jul 4 12:18:50 1996 +++ binutils-2.8/bfd/elfcode.h Wed Apr 30 12:56:05 1997 @@ -1,5 +1,5 @@ /* ELF executable support for BFD. - Copyright 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, from information published in "UNIX System V Release 4, Programmers Guide: ANSI C and @@ -68,6 +68,7 @@ #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" +#include "fnmatch.h" /* Renaming structures, typedefs, macros and functions to be size-specific. */ #define Elf_External_Ehdr NAME(Elf,External_Ehdr) @@ -141,7 +142,7 @@ #define LOG_FILE_ALIGN 2 #endif -/* Forward declarations of static functions */ +/* Static functions */ static void elf_swap_ehdr_in PARAMS ((bfd *, const Elf_External_Ehdr *, Elf_Internal_Ehdr *)); @@ -154,15 +155,15 @@ #define elf_stringtab_init _bfd_elf_stringtab_init -extern struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void)); #define section_from_elf_index bfd_section_from_elf_index -extern boolean bfd_section_from_phdr PARAMS ((bfd *, Elf_Internal_Phdr *, - int)); -static boolean elf_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **)); +static boolean elf_slurp_reloc_table + PARAMS ((bfd *, asection *, asymbol **, boolean)); static void write_relocs PARAMS ((bfd *, asection *, PTR)); +static boolean elf_file_p PARAMS ((Elf_External_Ehdr *)); + #ifdef DEBUG static void elf_debug_section PARAMS ((int, Elf_Internal_Shdr *)); static void elf_debug_file PARAMS ((Elf_Internal_Ehdr *)); @@ -457,6 +458,7 @@ struct elf_backend_data *ebd; struct elf_obj_tdata *preserved_tdata = elf_tdata (abfd); struct elf_obj_tdata *new_tdata = NULL; + asection *s; /* Read in the ELF header in external format. */ @@ -588,6 +590,15 @@ goto got_no_match; elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex); elf_elfsections (abfd)[shindex] = i_shdrp + shindex; + + /* If the section is loaded, but not page aligned, clear + D_PAGED. */ + if ((i_shdrp[shindex].sh_flags & SHF_ALLOC) != 0 + && i_shdrp[shindex].sh_type != SHT_NOBITS + && (((i_shdrp[shindex].sh_addr - i_shdrp[shindex].sh_offset) + % ebd->maxpagesize) + != 0)) + abfd->flags &= ~D_PAGED; } if (i_ehdrp->e_shstrndx) { @@ -651,6 +662,25 @@ goto got_wrong_format_error; } + /* If we have created any reloc sections that are associated with + debugging sections, mark the reloc sections as debugging as well. */ + for (s = abfd->sections; s != NULL; s = s->next) + { + if ((elf_section_data (s)->this_hdr.sh_type == SHT_REL + || elf_section_data (s)->this_hdr.sh_type == SHT_RELA) + && elf_section_data (s)->this_hdr.sh_info > 0) + { + unsigned long targ_index; + asection *targ_sec; + + targ_index = elf_section_data (s)->this_hdr.sh_info; + targ_sec = bfd_section_from_elf_index (abfd, targ_index); + if (targ_sec != NULL + && (targ_sec->flags & SEC_DEBUGGING) != 0) + s->flags |= SEC_DEBUGGING; + } + } + return (abfd->xvec); got_wrong_format_error: @@ -738,6 +768,8 @@ sym = *ptr->sym_ptr_ptr; if (sym == last_sym) n = last_sym_idx; + else if (bfd_is_abs_section (sym->section) && sym->value == 0) + n = STN_UNDEF; else { last_sym = sym; @@ -750,7 +782,8 @@ last_sym_idx = n; } - if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec + if ((*ptr->sym_ptr_ptr)->the_bfd != NULL + && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec && ! _bfd_elf_validate_reloc (abfd, ptr)) { *failedp = true; @@ -892,11 +925,13 @@ boolean dynamic; { Elf_Internal_Shdr *hdr; + Elf_Internal_Shdr *verhdr; long symcount; /* Number of external ELF symbols */ elf_symbol_type *sym; /* Pointer to current bfd symbol */ elf_symbol_type *symbase; /* Buffer for generated bfd symbols */ Elf_Internal_Sym i_sym; Elf_External_Sym *x_symp = NULL; + Elf_External_Versym *x_versymp = NULL; /* Read each raw ELF symbol, converting from external ELF form to internal ELF form, and then using the information to create a @@ -908,10 +943,28 @@ space left over at the end. When we have all the symbols, we build the caller's pointer vector. */ - if (dynamic) - hdr = &elf_tdata (abfd)->dynsymtab_hdr; + if (! dynamic) + { + hdr = &elf_tdata (abfd)->symtab_hdr; + verhdr = NULL; + } else - hdr = &elf_tdata (abfd)->symtab_hdr; + { + hdr = &elf_tdata (abfd)->dynsymtab_hdr; + if (elf_dynversym (abfd) == 0) + verhdr = NULL; + else + verhdr = &elf_tdata (abfd)->dynversym_hdr; + if ((elf_tdata (abfd)->dynverdef_section != 0 + && elf_tdata (abfd)->verdef == NULL) + || (elf_tdata (abfd)->dynverref_section != 0 + && elf_tdata (abfd)->verref == NULL)) + { + if (! _bfd_elf_slurp_version_tables (abfd)) + return -1; + } + } + if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) == -1) return -1; @@ -941,6 +994,37 @@ if (bfd_read ((PTR) x_symp, sizeof (Elf_External_Sym), symcount, abfd) != symcount * sizeof (Elf_External_Sym)) goto error_return; + + /* Read the raw ELF version symbol information. */ + + if (verhdr != NULL + && verhdr->sh_size / sizeof (Elf_External_Versym) != symcount) + { + (*_bfd_error_handler) + ("%s: version count (%ld) does not match symbol count (%ld)", + abfd->filename, + (long) (verhdr->sh_size / sizeof (Elf_External_Versym)), + symcount); + + /* Slurp in the symbols without the version information, + since that is more helpful than just quitting. */ + verhdr = NULL; + } + + if (verhdr != NULL) + { + if (bfd_seek (abfd, verhdr->sh_offset, SEEK_SET) != 0) + goto error_return; + + x_versymp = (Elf_External_Versym *) bfd_malloc (verhdr->sh_size); + if (x_versymp == NULL && verhdr->sh_size != 0) + goto error_return; + + if (bfd_read ((PTR) x_versymp, 1, verhdr->sh_size, abfd) + != verhdr->sh_size) + goto error_return; + } + /* Skip first symbol, which is a null dummy. */ for (i = 1; i < symcount; i++) { @@ -989,7 +1073,10 @@ else sym->symbol.section = bfd_abs_section_ptr; - sym->symbol.value -= sym->symbol.section->vma; + /* If this is a relocateable file, then the symbol value is + already section relative. */ + if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0) + sym->symbol.value -= sym->symbol.section->vma; switch (ELF_ST_BIND (i_sym.st_info)) { @@ -1025,6 +1112,14 @@ if (dynamic) sym->symbol.flags |= BSF_DYNAMIC; + if (x_versymp != NULL) + { + Elf_Internal_Versym iversym; + + _bfd_elf_swap_versym_in (abfd, x_versymp + i, &iversym); + sym->version = iversym.vs_vers; + } + /* Do some backend-specific processing on this symbol. */ { struct elf_backend_data *ebd = get_elf_backend_data (abfd); @@ -1061,10 +1156,14 @@ *symptrs = 0; /* Final null pointer */ } + if (x_versymp != NULL) + free (x_versymp); if (x_symp != NULL) free (x_symp); return symcount; error_return: + if (x_versymp != NULL) + free (x_versymp); if (x_symp != NULL) free (x_symp); return -1; @@ -1073,13 +1172,16 @@ /* Read in and swap the external relocs. */ static boolean -elf_slurp_reloc_table (abfd, asect, symbols) +elf_slurp_reloc_table (abfd, asect, symbols, dynamic) bfd *abfd; asection *asect; asymbol **symbols; + boolean dynamic; { struct elf_backend_data * const ebd = get_elf_backend_data (abfd); struct bfd_elf_section_data * const d = elf_section_data (asect); + Elf_Internal_Shdr *rel_hdr; + bfd_size_type reloc_count; PTR allocated = NULL; bfd_byte *native_relocs; arelent *relents; @@ -1087,37 +1189,51 @@ unsigned int i; int entsize; - if (asect->relocation != NULL - || (asect->flags & SEC_RELOC) == 0 - || asect->reloc_count == 0) + if (asect->relocation != NULL) return true; - BFD_ASSERT (asect->rel_filepos == d->rel_hdr.sh_offset - && (asect->reloc_count - == d->rel_hdr.sh_size / d->rel_hdr.sh_entsize)); + if (! dynamic) + { + if ((asect->flags & SEC_RELOC) == 0 + || asect->reloc_count == 0) + return true; + + rel_hdr = &d->rel_hdr; + reloc_count = asect->reloc_count; + + BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset + && reloc_count == rel_hdr->sh_size / rel_hdr->sh_entsize); + } + else + { + if (asect->_raw_size == 0) + return true; + + rel_hdr = &d->this_hdr; + reloc_count = rel_hdr->sh_size / rel_hdr->sh_entsize; + } - allocated = (PTR) bfd_malloc ((size_t) d->rel_hdr.sh_size); + allocated = (PTR) bfd_malloc ((size_t) rel_hdr->sh_size); if (allocated == NULL) goto error_return; - if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0 - || (bfd_read (allocated, 1, d->rel_hdr.sh_size, abfd) - != d->rel_hdr.sh_size)) + if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd) + != rel_hdr->sh_size)) goto error_return; native_relocs = (bfd_byte *) allocated; - relents = ((arelent *) - bfd_alloc (abfd, asect->reloc_count * sizeof (arelent))); + relents = (arelent *) bfd_alloc (abfd, reloc_count * sizeof (arelent)); if (relents == NULL) goto error_return; - entsize = d->rel_hdr.sh_entsize; + entsize = rel_hdr->sh_entsize; BFD_ASSERT (entsize == sizeof (Elf_External_Rel) || entsize == sizeof (Elf_External_Rela)); for (i = 0, relent = relents; - i < asect->reloc_count; + i < reloc_count; i++, relent++, native_relocs += entsize) { Elf_Internal_Rela rela; @@ -1135,8 +1251,9 @@ /* The address of an ELF reloc is section relative for an object file, and absolute for an executable file or shared library. - The address of a BFD reloc is always section relative. */ - if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) + The address of a normal BFD reloc is always section relative, + and the address of a dynamic reloc is absolute.. */ + if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 || dynamic) relent->address = rela.r_offset; else relent->address = rela.r_offset - asect->vma; diff -urN binutils-2.7/bfd/elfcore.h binutils-2.8/bfd/elfcore.h --- binutils-2.7/bfd/elfcore.h Thu Jul 4 12:18:50 1996 +++ binutils-2.8/bfd/elfcore.h Wed Apr 30 12:56:06 1997 @@ -1,5 +1,5 @@ /* ELF core file support for BFD. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -31,6 +31,12 @@ #else #define get_thread(STATUS) (((prstatus_t *)(STATUS))->pr_pid) #endif + +static boolean bfd_prstatus PARAMS ((bfd *, char *, int, long, int)); +static boolean bfd_prpsinfo PARAMS ((bfd *, char *, int, long)); +static boolean bfd_fpregset PARAMS ((bfd *, char *, int, long, int)); +static boolean elf_corefile_note PARAMS ((bfd *, Elf_Internal_Phdr *)); + #else #define bfd_prstatus(abfd, descdata, descsz, filepos, thread) true #define bfd_fpregset(abfd, descdata, descsz, filepos, thread) true diff -urN binutils-2.7/bfd/elflink.c binutils-2.8/bfd/elflink.c --- binutils-2.7/bfd/elflink.c Thu Jul 4 12:18:51 1996 +++ binutils-2.8/bfd/elflink.c Wed Apr 30 12:56:06 1997 @@ -1,5 +1,5 @@ /* ELF linking support for BFD. - Copyright 1995 Free Software Foundation, Inc. + Copyright 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -38,7 +38,8 @@ if (bfd_get_section_by_name (abfd, ".got") != NULL) return true; - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY; + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); s = bfd_make_section (abfd, ".got"); if (s == NULL @@ -95,7 +96,8 @@ /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and .rel[a].bss sections. */ - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY; + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); s = bfd_make_section (abfd, ".plt"); if (s == NULL @@ -184,6 +186,10 @@ if (h->dynindx == -1) { struct bfd_strtab_hash *dynstr; + char *p, *alc; + const char *name; + boolean copy; + bfd_size_type indx; h->dynindx = elf_hash_table (info)->dynsymcount; ++elf_hash_table (info)->dynsymcount; @@ -197,11 +203,34 @@ return false; } - h->dynstr_index = ((unsigned long) - _bfd_stringtab_add (dynstr, h->root.root.string, - true, false)); - if (h->dynstr_index == (unsigned long) -1) + /* We don't put any version information in the dynamic string + table. */ + name = h->root.root.string; + p = strchr (name, ELF_VER_CHR); + if (p == NULL) + { + alc = NULL; + copy = false; + } + else + { + alc = bfd_malloc (p - name + 1); + if (alc == NULL) + return false; + strncpy (alc, name, p - name); + alc[p - name] = '\0'; + name = alc; + copy = true; + } + + indx = _bfd_stringtab_add (dynstr, name, true, copy); + + if (alc != NULL) + free (alc); + + if (indx == (bfd_size_type) -1) return false; + h->dynstr_index = indx; } return true; @@ -239,9 +268,9 @@ /* See if the sections already exist */ lsect->section = s = bfd_get_section_by_name (dynobj, lsect->name); - if (!s) + if (!s || (s->flags & defaults->flags) != defaults->flags) { - lsect->section = s = bfd_make_section (dynobj, lsect->name); + lsect->section = s = bfd_make_section_anyway (dynobj, lsect->name); if (s == NULL) return (elf_linker_section_t *)0; @@ -316,12 +345,18 @@ } } +#if 0 + /* This does not make sense. The sections which may exist in the + object file have nothing to do with the sections we want to + create. */ + /* Find the related sections if they have been created */ if (lsect->bss_name && !lsect->bss_section) lsect->bss_section = bfd_get_section_by_name (dynobj, lsect->bss_name); if (lsect->rel_name && !lsect->rel_section) lsect->rel_section = bfd_get_section_by_name (dynobj, lsect->rel_name); +#endif return lsect; } @@ -367,6 +402,7 @@ | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY)) || ! bfd_set_section_alignment (dynobj, lsect->rel_section, alignment)) return false; @@ -374,4 +410,3 @@ return true; } - diff -urN binutils-2.7/bfd/elflink.h binutils-2.8/bfd/elflink.h --- binutils-2.7/bfd/elflink.h Thu Jul 4 12:18:53 1996 +++ binutils-2.8/bfd/elflink.h Wed Apr 30 12:56:06 1997 @@ -1,5 +1,5 @@ /* ELF linker support. - Copyright 1995, 1996 Free Software Foundation, Inc. + Copyright 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -23,12 +23,18 @@ PARAMS ((bfd *, struct bfd_link_info *)); static boolean elf_link_add_archive_symbols PARAMS ((bfd *, struct bfd_link_info *)); -static Elf_Internal_Rela *elf_link_read_relocs - PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean)); static boolean elf_export_symbol PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf_adjust_dynamic_symbol PARAMS ((struct elf_link_hash_entry *, PTR)); +static boolean elf_link_find_version_dependencies + PARAMS ((struct elf_link_hash_entry *, PTR)); +static boolean elf_link_find_version_dependencies + PARAMS ((struct elf_link_hash_entry *, PTR)); +static boolean elf_link_assign_sym_version + PARAMS ((struct elf_link_hash_entry *, PTR)); +static boolean elf_link_renumber_dynsyms + PARAMS ((struct elf_link_hash_entry *, PTR)); /* This struct is used to pass information to routines called via elf_link_hash_traverse which must return failure. */ @@ -37,7 +43,7 @@ { boolean failed; struct bfd_link_info *info; -}; +}; /* Given an ELF BFD, add symbols to the global hash table as appropriate. */ @@ -149,8 +155,36 @@ h = elf_link_hash_lookup (elf_hash_table (info), symdef->name, false, false, false); - if (h == (struct elf_link_hash_entry *) NULL) + + if (h == NULL) + { + char *p, *copy; + + /* If this is a default version (the name contains @@), + look up the symbol again without the version. The + effect is that references to the symbol without the + version will be matched by the default symbol in the + archive. */ + + p = strchr (symdef->name, ELF_VER_CHR); + if (p == NULL || p[1] != ELF_VER_CHR) + continue; + + copy = bfd_alloc (abfd, p - symdef->name + 1); + if (copy == NULL) + goto error_return; + memcpy (copy, symdef->name, p - symdef->name); + copy[p - symdef->name] = '\0'; + + h = elf_link_hash_lookup (elf_hash_table (info), copy, + false, false, false); + + bfd_release (abfd, copy); + } + + if (h == NULL) continue; + if (h->root.type != bfd_link_hash_undefined) { if (h->root.type != bfd_link_hash_undefweak) @@ -248,6 +282,9 @@ Elf_External_Sym *buf = NULL; struct elf_link_hash_entry **sym_hash; boolean dynamic; + bfd_byte *dynver = NULL; + Elf_External_Versym *extversym = NULL; + Elf_External_Versym *ever; Elf_External_Dyn *dynbuf = NULL; struct elf_link_hash_entry *weaks; Elf_External_Sym *esym; @@ -256,6 +293,22 @@ add_symbol_hook = get_elf_backend_data (abfd)->elf_add_symbol_hook; collect = get_elf_backend_data (abfd)->collect; + if ((abfd->flags & DYNAMIC) == 0) + dynamic = false; + else + { + dynamic = true; + + /* You can't use -r against a dynamic object. Also, there's no + hope of using a dynamic object which does not exactly match + the format of the output file. */ + if (info->relocateable || info->hash->creator != abfd->xvec) + { + bfd_set_error (bfd_error_invalid_operation); + goto error_return; + } + } + /* As a GNU extension, any input sections which are named .gnu.warning.SYMBOL are treated as warning symbols for the given symbol. This differs from .gnu.warning sections, which generate @@ -274,6 +327,37 @@ char *msg; bfd_size_type sz; + name += sizeof ".gnu.warning." - 1; + + /* If this is a shared object, then look up the symbol + in the hash table. If it is there, and it is already + been defined, then we will not be using the entry + from this shared object, so we don't need to warn. + FIXME: If we see the definition in a regular object + later on, we will warn, but we shouldn't. The only + fix is to keep track of what warnings we are supposed + to emit, and then handle them all at the end of the + link. */ + if (dynamic && abfd->xvec == info->hash->creator) + { + struct elf_link_hash_entry *h; + + h = elf_link_hash_lookup (elf_hash_table (info), name, + false, false, true); + + /* FIXME: What about bfd_link_hash_common? */ + if (h != NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) + { + /* We don't want to issue this warning. Clobber + the section size so that the warning does not + get copied into the output file. */ + s->_raw_size = 0; + continue; + } + } + sz = bfd_section_size (abfd, s); msg = (char *) bfd_alloc (abfd, sz); if (msg == NULL) @@ -283,10 +367,8 @@ goto error_return; if (! (_bfd_generic_link_add_one_symbol - (info, abfd, - name + sizeof ".gnu.warning." - 1, - BSF_WARNING, s, (bfd_vma) 0, msg, false, collect, - (struct bfd_link_hash_entry **) NULL))) + (info, abfd, name, BSF_WARNING, s, (bfd_vma) 0, msg, + false, collect, (struct bfd_link_hash_entry **) NULL))) goto error_return; if (! info->relocateable) @@ -299,17 +381,89 @@ } } - /* A stripped shared library might only have a dynamic symbol table, - not a regular symbol table. In that case we can still go ahead - and link using the dynamic symbol table. */ - if (elf_onesymtab (abfd) == 0 - && elf_dynsymtab (abfd) != 0) + /* If this is a dynamic object, we always link against the .dynsym + symbol table, not the .symtab symbol table. The dynamic linker + will only see the .dynsym symbol table, so there is no reason to + look at .symtab for a dynamic object. */ + + if (! dynamic || elf_dynsymtab (abfd) == 0) + hdr = &elf_tdata (abfd)->symtab_hdr; + else + hdr = &elf_tdata (abfd)->dynsymtab_hdr; + + if (dynamic) { - elf_onesymtab (abfd) = elf_dynsymtab (abfd); - elf_tdata (abfd)->symtab_hdr = elf_tdata (abfd)->dynsymtab_hdr; + /* Read in any version definitions. */ + + if (elf_dynverdef (abfd) != 0) + { + Elf_Internal_Shdr *verdefhdr; + bfd_byte *dynver; + int i; + const Elf_External_Verdef *extverdef; + Elf_Internal_Verdef *intverdef; + + verdefhdr = &elf_tdata (abfd)->dynverdef_hdr; + elf_tdata (abfd)->verdef = + ((Elf_Internal_Verdef *) + bfd_zalloc (abfd, + verdefhdr->sh_info * sizeof (Elf_Internal_Verdef))); + if (elf_tdata (abfd)->verdef == NULL) + goto error_return; + + dynver = (bfd_byte *) bfd_malloc (verdefhdr->sh_size); + if (dynver == NULL) + goto error_return; + + if (bfd_seek (abfd, verdefhdr->sh_offset, SEEK_SET) != 0 + || (bfd_read ((PTR) dynver, 1, verdefhdr->sh_size, abfd) + != verdefhdr->sh_size)) + goto error_return; + + extverdef = (const Elf_External_Verdef *) dynver; + intverdef = elf_tdata (abfd)->verdef; + for (i = 0; i < verdefhdr->sh_info; i++, intverdef++) + { + const Elf_External_Verdaux *extverdaux; + Elf_Internal_Verdaux intverdaux; + + _bfd_elf_swap_verdef_in (abfd, extverdef, intverdef); + + /* Pick up the name of the version. */ + extverdaux = ((const Elf_External_Verdaux *) + ((bfd_byte *) extverdef + intverdef->vd_aux)); + _bfd_elf_swap_verdaux_in (abfd, extverdaux, &intverdaux); + + intverdef->vd_bfd = abfd; + intverdef->vd_nodename = + bfd_elf_string_from_elf_section (abfd, verdefhdr->sh_link, + intverdaux.vda_name); + + extverdef = ((const Elf_External_Verdef *) + ((bfd_byte *) extverdef + intverdef->vd_next)); + } + + free (dynver); + dynver = NULL; + } + + /* Read in the symbol versions, but don't bother to convert them + to internal format. */ + if (elf_dynversym (abfd) != 0) + { + Elf_Internal_Shdr *versymhdr; + + versymhdr = &elf_tdata (abfd)->dynversym_hdr; + extversym = (Elf_External_Versym *) bfd_malloc (hdr->sh_size); + if (extversym == NULL) + goto error_return; + if (bfd_seek (abfd, versymhdr->sh_offset, SEEK_SET) != 0 + || (bfd_read ((PTR) extversym, 1, versymhdr->sh_size, abfd) + != versymhdr->sh_size)) + goto error_return; + } } - hdr = &elf_tdata (abfd)->symtab_hdr; symcount = hdr->sh_size / sizeof (Elf_External_Sym); /* The sh_info field of the symtab header tells us where the @@ -340,10 +494,8 @@ goto error_return; elf_sym_hashes (abfd) = sym_hash; - if (elf_elfheader (abfd)->e_type != ET_DYN) + if (! dynamic) { - dynamic = false; - /* If we are creating a shared library, create all the dynamic sections immediately. We need to attach them to something, so we attach them to this BFD, provided it is the right @@ -365,18 +517,6 @@ bfd_size_type oldsize; bfd_size_type strindex; - dynamic = true; - - /* You can't use -r against a dynamic object. Also, there's no - hope of using a dynamic object which does not exactly match - the format of the output file. */ - if (info->relocateable - || info->hash->creator != abfd->xvec) - { - bfd_set_error (bfd_error_invalid_operation); - goto error_return; - } - /* Find the name to use in a DT_NEEDED entry that refers to this object. If the object has a DT_SONAME entry, we use it. Otherwise, if the generic linker stuck something in @@ -512,6 +652,8 @@ { if (buf != NULL) free (buf); + if (extversym != NULL) + free (extversym); return true; } } @@ -537,8 +679,11 @@ weaks = NULL; + ever = extversym != NULL ? extversym + extsymoff : NULL; esymend = buf + extsymcount; - for (esym = buf; esym < esymend; esym++, sym_hash++) + for (esym = buf; + esym < esymend; + esym++, sym_hash++, ever = (ever != NULL ? ever + 1 : NULL)) { Elf_Internal_Sym sym; int bind; @@ -587,10 +732,10 @@ else if (sym.st_shndx > 0 && sym.st_shndx < SHN_LORESERVE) { sec = section_from_elf_index (abfd, sym.st_shndx); - if (sec != NULL) - value -= sec->vma; - else + if (sec == NULL) sec = bfd_abs_section_ptr; + else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0) + value -= sec->vma; } else if (sym.st_shndx == SHN_ABS) sec = bfd_abs_section_ptr; @@ -639,6 +784,60 @@ type_change_ok = get_elf_backend_data (abfd)->type_change_ok; if (info->hash->creator->flavour == bfd_target_elf_flavour) { + Elf_Internal_Versym iver; + int vernum; + boolean override; + + if (ever != NULL) + { + _bfd_elf_swap_versym_in (abfd, ever, &iver); + vernum = iver.vs_vers & VERSYM_VERSION; + + /* If this is a hidden symbol, or if it is not version + 1, we append the version name to the symbol name. + However, we do not modify a non-hidden absolute + symbol, because it might be the version symbol + itself. FIXME: What if it isn't? */ + if ((iver.vs_vers & VERSYM_HIDDEN) != 0 + || (vernum > 1 && ! bfd_is_abs_section (sec))) + { + const char *verstr; + int namelen, newlen; + char *newname, *p; + + if (vernum > elf_tdata (abfd)->dynverdef_hdr.sh_info) + { + (*_bfd_error_handler) + ("%s: %s: invalid version %d (max %d)", + abfd->filename, name, vernum, + elf_tdata (abfd)->dynverdef_hdr.sh_info); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + else if (vernum > 1) + verstr = elf_tdata (abfd)->verdef[vernum - 1].vd_nodename; + else + verstr = ""; + + namelen = strlen (name); + newlen = namelen + strlen (verstr) + 2; + if ((iver.vs_vers & VERSYM_HIDDEN) == 0) + ++newlen; + + newname = (char *) bfd_alloc (abfd, newlen); + if (newname == NULL) + goto error_return; + strcpy (newname, name); + p = newname + namelen; + *p++ = ELF_VER_CHR; + if ((iver.vs_vers & VERSYM_HIDDEN) == 0) + *p++ = ELF_VER_CHR; + strcpy (p, verstr); + + name = newname; + } + } + /* We need to look up the symbol now in order to get some of the dynamic object handling right. We pass the hash table entry in to _bfd_generic_link_add_one_symbol so @@ -662,9 +861,11 @@ h = (struct elf_link_hash_entry *) h->root.u.i.link; /* It's OK to change the type if it used to be a weak - definition. */ + definition, or if the current definition is weak (and + hence might be ignored). */ if (h->root.type == bfd_link_hash_defweak - || h->root.type == bfd_link_hash_undefweak) + || h->root.type == bfd_link_hash_undefweak + || bind == STB_WEAK) type_change_ok = true; /* It's OK to change the size if it used to be a weak @@ -674,19 +875,60 @@ || h->root.type == bfd_link_hash_undefined) size_change_ok = true; + override = false; + /* If we are looking at a dynamic object, and this is a definition, we need to see if it has already been defined by some other object. If it has, we want to use the existing definition, and we do not want to report a multiple symbol definition error; we do this by - clobbering sec to be bfd_und_section_ptr. */ + clobbering sec to be bfd_und_section_ptr. We treat a + common symbol as a definition if the symbol in the shared + library is a function, since common symbols always + represent variables; this can cause confusion in + principle, but any such confusion would seem to indicate + an erroneous program or shared library. */ if (dynamic && definition) { if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak || (h->root.type == bfd_link_hash_common - && bind == STB_WEAK)) + && (bind == STB_WEAK + || ELF_ST_TYPE (sym.st_info) == STT_FUNC))) + { + override = true; + sec = bfd_und_section_ptr; + definition = false; + size_change_ok = true; + if (h->root.type == bfd_link_hash_common) + type_change_ok = true; + } + } + + /* If we already have a common symbol, and the symbol in the + shared library is in an uninitialized section, then treat + the shared library symbol as a common symbol. This will + not always be correct, but it should do little harm. */ + if (dynamic + && definition + && h->root.type == bfd_link_hash_common + && (sec->flags & SEC_ALLOC) != 0 + && (sec->flags & SEC_LOAD) == 0) + { + if (! ((*info->callbacks->multiple_common) + (info, h->root.root.string, + h->root.u.c.p->section->owner, bfd_link_hash_common, + h->root.u.c.size, abfd, bfd_link_hash_common, + sym.st_size))) + goto error_return; + + /* If the symbol in the shared library is smaller than + the one we already have, then override it to stick + with the larger symbol. Set SIZE_CHANGE_OK because + we only want to warn if requested with --warn-common. */ + if (sym.st_size < h->size) { + override = true; sec = bfd_und_section_ptr; definition = false; size_change_ok = true; @@ -700,22 +942,37 @@ objects, even if they are defined after the dynamic object in the link. */ if (! dynamic - && definition + && (definition + || (bfd_is_com_section (sec) + && (h->root.type == bfd_link_hash_defweak + || h->type == STT_FUNC))) && (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (bfd_get_flavour (h->root.u.def.section->owner) - == bfd_target_elf_flavour) - && (elf_elfheader (h->root.u.def.section->owner)->e_type - == ET_DYN)) + && (h->root.u.def.section->owner->flags & DYNAMIC) != 0) { + override = true; /* Change the hash table entry to undefined, and let _bfd_generic_link_add_one_symbol do the right thing with the new definition. */ h->root.type = bfd_link_hash_undefined; h->root.u.undef.abfd = h->root.u.def.section->owner; size_change_ok = true; + if (bfd_is_com_section (sec)) + type_change_ok = true; + + /* This union may have been set to be non-NULL when this + symbol was seen in a dynamic object. We must force + the union to be NULL, so that it is correct for a + regular symbol. */ + h->verinfo.vertree = NULL; } + + if (ever != NULL + && ! override + && vernum > 1 + && (h->verinfo.verdef == NULL || definition)) + h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1]; } if (! (_bfd_generic_link_add_one_symbol @@ -791,12 +1048,15 @@ h->type = ELF_ST_TYPE (sym.st_info); } + if (sym.st_other != 0 + && (definition || h->other == 0)) + h->other = sym.st_other; + /* Set a flag in the hash table entry indicating the type of reference or definition we just found. Keep a count of the number of dynamic symbols we find. A dynamic symbol is one which is referenced or defined by both a regular - object and a shared object, or one which is referenced or - defined by more than one shared object. */ + object and a shared object. */ old_flags = h->elf_link_hash_flags; dynsym = false; if (! dynamic) @@ -816,16 +1076,294 @@ new_flag = ELF_LINK_HASH_REF_DYNAMIC; else new_flag = ELF_LINK_HASH_DEF_DYNAMIC; - if ((old_flags & new_flag) != 0 - || (old_flags & (ELF_LINK_HASH_DEF_REGULAR - | ELF_LINK_HASH_REF_REGULAR)) != 0 + if ((old_flags & (ELF_LINK_HASH_DEF_REGULAR + | ELF_LINK_HASH_REF_REGULAR)) != 0 || (h->weakdef != NULL - && (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_REF_DYNAMIC)) != 0)) + && ! new_weakdef + && h->weakdef->dynindx != -1)) dynsym = true; } h->elf_link_hash_flags |= new_flag; + + /* If this symbol has a version, and it is the default + version, we create an indirect symbol from the default + name to the fully decorated name. This will cause + external references which do not specify a version to be + bound to this version of the symbol. */ + if (definition) + { + char *p; + + p = strchr (name, ELF_VER_CHR); + if (p != NULL && p[1] == ELF_VER_CHR) + { + char *shortname; + struct elf_link_hash_entry *hold; + + shortname = bfd_hash_allocate (&info->hash->table, + p - name + 1); + if (shortname == NULL) + goto error_return; + strncpy (shortname, name, p - name); + shortname[p - name] = '\0'; + + /* First look to see if we have an existing symbol + with this name. */ + hold = elf_link_hash_lookup (elf_hash_table (info), + shortname, false, false, + false); + + /* If we are looking at a normal object, and the + symbol was seen in a shared object, clobber the + definition in the shared object. */ + if (hold != NULL + && ! dynamic + && (hold->root.type == bfd_link_hash_defined + || hold->root.type == bfd_link_hash_defweak) + && (hold->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && ((hold->root.u.def.section->owner->flags & DYNAMIC) + != 0)) + { + /* Change the hash table entry to undefined, so + that _bfd_generic_link_add_one_symbol will do + the right thing. */ + hold->root.type = bfd_link_hash_undefined; + hold->root.u.undef.abfd = + hold->root.u.def.section->owner; + hold->verinfo.vertree = NULL; + hold = NULL; + } + + /* If we are looking at a shared object, and we have + already seen this symbol defined elsewhere, then + don't try to define it again. */ + if (hold != NULL + && dynamic + && (hold->root.type == bfd_link_hash_defined + || hold->root.type == bfd_link_hash_defweak + || hold->root.type == bfd_link_hash_indirect + || (hold->root.type == bfd_link_hash_common + && (bind == STB_WEAK + || ELF_ST_TYPE (sym.st_info) == STT_FUNC)))) + { + /* Don't add an indirect symbol. */ + } + else + { + struct elf_link_hash_entry *hi; + + hi = NULL; + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, shortname, BSF_INDIRECT, + bfd_ind_section_ptr, (bfd_vma) 0, name, false, + collect, (struct bfd_link_hash_entry **) &hi))) + goto error_return; + + /* If there is a duplicate definition somewhere, + then HI may not point to an indirect symbol. + We will have reported an error to the user in + that case. */ + + if (hi->root.type == bfd_link_hash_indirect) + { + hi->elf_link_hash_flags &= ~ ELF_LINK_NON_ELF; + + /* If the symbol became indirect, then we + assume that we have not seen a definition + before. */ + BFD_ASSERT ((hi->elf_link_hash_flags + & (ELF_LINK_HASH_DEF_DYNAMIC + | ELF_LINK_HASH_DEF_REGULAR)) + == 0); + + /* Copy down any references that we may have + already seen to the symbol which just + became indirect. */ + h->elf_link_hash_flags |= + (hi->elf_link_hash_flags + & (ELF_LINK_HASH_REF_DYNAMIC + | ELF_LINK_HASH_REF_REGULAR)); + + /* Copy over the global table offset entry. + This may have been already set up by a + check_relocs routine. */ + if (h->got_offset == (bfd_vma) -1) + { + h->got_offset = hi->got_offset; + hi->got_offset = (bfd_vma) -1; + } + BFD_ASSERT (hi->got_offset == (bfd_vma) -1); + + if (h->dynindx == -1) + { + h->dynindx = hi->dynindx; + h->dynstr_index = hi->dynstr_index; + hi->dynindx = -1; + hi->dynstr_index = 0; + } + BFD_ASSERT (hi->dynindx == -1); + + /* FIXME: There may be other information to + copy over for particular targets. */ + + /* See if the new flags lead us to realize + that the symbol must be dynamic. */ + if (! dynsym) + { + if (! dynamic) + { + if (info->shared + || ((hi->elf_link_hash_flags + & ELF_LINK_HASH_REF_DYNAMIC) + != 0)) + dynsym = true; + } + else + { + if ((hi->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0) + dynsym = true; + } + } + } + } + + /* We also need to define an indirection from the + nondefault version of the symbol. */ + + shortname = bfd_hash_allocate (&info->hash->table, + strlen (name)); + if (shortname == NULL) + goto error_return; + strncpy (shortname, name, p - name); + strcpy (shortname + (p - name), p + 1); + + /* First look to see if we have an existing symbol + with this name. */ + hold = elf_link_hash_lookup (elf_hash_table (info), + shortname, false, false, + false); + + /* If we are looking at a normal object, and the + symbol was seen in a shared object, clobber the + definition in the shared object. */ + if (hold != NULL + && ! dynamic + && (hold->root.type == bfd_link_hash_defined + || hold->root.type == bfd_link_hash_defweak) + && (hold->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && ((hold->root.u.def.section->owner->flags & DYNAMIC) + != 0)) + { + /* Change the hash table entry to undefined, so + that _bfd_generic_link_add_one_symbol will do + the right thing. */ + hold->root.type = bfd_link_hash_undefined; + hold->root.u.undef.abfd = + hold->root.u.def.section->owner; + hold->verinfo.vertree = NULL; + hold = NULL; + } + + /* If we are looking at a shared object, and we have + already seen this symbol defined elsewhere, then + don't try to define it again. */ + if (hold != NULL + && dynamic + && (hold->root.type == bfd_link_hash_defined + || hold->root.type == bfd_link_hash_defweak + || hold->root.type == bfd_link_hash_indirect + || (hold->root.type == bfd_link_hash_common + && (bind == STB_WEAK + || ELF_ST_TYPE (sym.st_info) == STT_FUNC)))) + { + /* Don't add an indirect symbol. */ + } + else + { + struct elf_link_hash_entry *hi; + + hi = NULL; + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, shortname, BSF_INDIRECT, + bfd_ind_section_ptr, (bfd_vma) 0, name, false, + collect, (struct bfd_link_hash_entry **) &hi))) + goto error_return; + + /* If there is a duplicate definition somewhere, + then HI may not point to an indirect symbol. + We will have reported an error to the user in + that case. */ + + if (hi->root.type == bfd_link_hash_indirect) + { + hi->elf_link_hash_flags &= ~ ELF_LINK_NON_ELF; + + /* If the symbol became indirect, then we + assume that we have not seen a definition + before. */ + BFD_ASSERT ((hi->elf_link_hash_flags + & (ELF_LINK_HASH_DEF_DYNAMIC + | ELF_LINK_HASH_DEF_REGULAR)) + == 0); + + /* Copy down any references that we may have + already seen to the symbol which just + became indirect. */ + h->elf_link_hash_flags |= + (hi->elf_link_hash_flags + & (ELF_LINK_HASH_REF_DYNAMIC + | ELF_LINK_HASH_REF_REGULAR)); + + /* Copy over the global table offset entry. + This may have been already set up by a + check_relocs routine. */ + if (h->got_offset == (bfd_vma) -1) + { + h->got_offset = hi->got_offset; + hi->got_offset = (bfd_vma) -1; + } + BFD_ASSERT (hi->got_offset == (bfd_vma) -1); + + if (h->dynindx == -1) + { + h->dynindx = hi->dynindx; + h->dynstr_index = hi->dynstr_index; + hi->dynindx = -1; + hi->dynstr_index = 0; + } + BFD_ASSERT (hi->dynindx == -1); + + /* FIXME: There may be other information to + copy over for particular targets. */ + + /* See if the new flags lead us to realize + that the symbol must be dynamic. */ + if (! dynsym) + { + if (! dynamic) + { + if (info->shared + || ((hi->elf_link_hash_flags + & ELF_LINK_HASH_REF_DYNAMIC) + != 0)) + dynsym = true; + } + else + { + if ((hi->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0) + dynsym = true; + } + } + } + } + } + } + if (dynsym && h->dynindx == -1) { if (! _bfd_elf_link_record_dynamic_symbol (info, h)) @@ -898,6 +1436,18 @@ goto error_return; } + /* If the real definition is in the list of dynamic + symbols, make sure the weak definition is put there + as well. If we don't do this, then the dynamic + loader might not merge the entries for the real + definition and the weak definition. */ + if (h->dynindx != -1 + && hlook->dynindx == -1) + { + if (! _bfd_elf_link_record_dynamic_symbol (info, hlook)) + goto error_return; + } + break; } } @@ -909,6 +1459,12 @@ buf = NULL; } + if (extversym != NULL) + { + free (extversym); + extversym = NULL; + } + /* If this object is the same format as the output object, and it is not a shared library, then let the backend look through the relocs. @@ -939,18 +1495,15 @@ boolean ok; if ((o->flags & SEC_RELOC) == 0 - || o->reloc_count == 0) + || o->reloc_count == 0 + || ((info->strip == strip_all || info->strip == strip_debugger) + && (o->flags & SEC_DEBUGGING) != 0)) continue; - /* I believe we can ignore the relocs for any section which - does not form part of the final process image, such as a - debugging section. */ - if ((o->flags & SEC_ALLOC) == 0) - continue; - - internal_relocs = elf_link_read_relocs (abfd, o, (PTR) NULL, - (Elf_Internal_Rela *) NULL, - info->keep_memory); + internal_relocs = (NAME(_bfd_elf,link_read_relocs) + (abfd, o, (PTR) NULL, + (Elf_Internal_Rela *) NULL, + info->keep_memory)); if (internal_relocs == NULL) goto error_return; @@ -1000,6 +1553,10 @@ free (buf); if (dynbuf != NULL) free (dynbuf); + if (dynver != NULL) + free (dynver); + if (extversym != NULL) + free (extversym); return false; } @@ -1031,7 +1588,8 @@ /* Note that we set the SEC_IN_MEMORY flag for all of these sections. */ - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY; + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED); /* A dynamically linked executable has a .interp section, but a shared library does not. */ @@ -1043,6 +1601,26 @@ return false; } + /* Create sections to hold version informations. These are removed + if they are not needed. */ + s = bfd_make_section (abfd, ".gnu.version_d"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, 2)) + return false; + + s = bfd_make_section (abfd, ".gnu.version"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, 1)) + return false; + + s = bfd_make_section (abfd, ".gnu.version_r"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, 2)) + return false; + s = bfd_make_section (abfd, ".dynsym"); if (s == NULL || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) @@ -1150,8 +1728,9 @@ value is allocated using either malloc or bfd_alloc, according to the KEEP_MEMORY argument. */ -static Elf_Internal_Rela * -elf_link_read_relocs (abfd, o, external_relocs, internal_relocs, keep_memory) +Elf_Internal_Rela * +NAME(_bfd_elf,link_read_relocs) (abfd, o, external_relocs, internal_relocs, + keep_memory) bfd *abfd; asection *o; PTR external_relocs; @@ -1236,7 +1815,7 @@ /* Cache the results for next time, if we can. */ if (keep_memory) elf_section_data (o)->relocs = internal_relocs; - + if (alloc1 != NULL) free (alloc1); @@ -1311,16 +1890,50 @@ return true; } +/* This structure is used to pass information to + elf_link_assign_sym_version. */ + +struct elf_assign_sym_version_info +{ + /* Output BFD. */ + bfd *output_bfd; + /* General link information. */ + struct bfd_link_info *info; + /* Version tree. */ + struct bfd_elf_version_tree *verdefs; + /* Whether we are exporting all dynamic symbols. */ + boolean export_dynamic; + /* Whether we removed any symbols from the dynamic symbol table. */ + boolean removed_dynamic; + /* Whether we had a failure. */ + boolean failed; +}; + +/* This structure is used to pass information to + elf_link_find_version_dependencies. */ + +struct elf_find_verdep_info +{ + /* Output BFD. */ + bfd *output_bfd; + /* General link information. */ + struct bfd_link_info *info; + /* The number of dependencies. */ + unsigned int vers; + /* Whether we had a failure. */ + boolean failed; +}; /* Array used to determine the number of hash table buckets to use based on the number of symbols there are. If there are fewer than 3 symbols we use 1 bucket, fewer than 17 symbols we use 3 buckets, fewer than 37 we use 17 buckets, and so forth. We never use more - than 521 buckets. */ + than 32771 buckets. */ static const size_t elf_buckets[] = { - 1, 3, 17, 37, 67, 97, 131, 197, 263, 521, 0 + 1, 3, 17, 37, 67, 97, 131, 197, 263, 521, 1031, 2053, 4099, 8209, + 16411, 32771, 0 }; /* Set up the sizes and contents of the ELF dynamic sections. This is @@ -1330,22 +1943,38 @@ boolean NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, - export_dynamic, info, sinterpptr) + export_dynamic, filter_shlib, + auxiliary_filters, info, sinterpptr, + verdefs) bfd *output_bfd; const char *soname; const char *rpath; boolean export_dynamic; + const char *filter_shlib; + const char * const *auxiliary_filters; struct bfd_link_info *info; asection **sinterpptr; + struct bfd_elf_version_tree *verdefs; { + bfd_size_type soname_indx; bfd *dynobj; struct elf_backend_data *bed; + bfd_size_type old_dynsymcount; *sinterpptr = NULL; + soname_indx = -1; + if (info->hash->creator->flavour != bfd_target_elf_flavour) return true; + /* The backend may have to create some sections regardless of whether + we're dynamic or not. */ + bed = get_elf_backend_data (output_bfd); + if (bed->elf_backend_always_size_sections + && ! (*bed->elf_backend_always_size_sections) (output_bfd, info)) + return false; + dynobj = elf_hash_table (info)->dynobj; /* If there were no dynamic objects in the link, there is nothing to @@ -1378,14 +2007,12 @@ if (soname != NULL) { - bfd_size_type indx; - - indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, soname, - true, true); - if (indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, DT_SONAME, indx)) + soname_indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, + soname, true, true); + if (soname_indx == (bfd_size_type) -1 + || ! elf_add_dynamic_entry (info, DT_SONAME, soname_indx)) return false; - } + } if (info->symbolic) { @@ -1404,6 +2031,33 @@ return false; } + if (filter_shlib != NULL) + { + bfd_size_type indx; + + indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, + filter_shlib, true, true); + if (indx == (bfd_size_type) -1 + || ! elf_add_dynamic_entry (info, DT_FILTER, indx)) + return false; + } + + if (auxiliary_filters != NULL) + { + const char * const *p; + + for (p = auxiliary_filters; *p != NULL; p++) + { + bfd_size_type indx; + + indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, + *p, true, true); + if (indx == (bfd_size_type) -1 + || ! elf_add_dynamic_entry (info, DT_AUXILIARY, indx)) + return false; + } + } + /* Find all symbols which were defined in a dynamic object and make the backend pick a reasonable value for them. */ eif.failed = false; @@ -1447,7 +2101,7 @@ /* The backend must work out the sizes of all the other dynamic sections. */ - bed = get_elf_backend_data (output_bfd); + old_dynsymcount = elf_hash_table (info)->dynsymcount; if (! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info)) return false; @@ -1458,33 +2112,382 @@ size_t i; size_t bucketcount = 0; Elf_Internal_Sym isym; + struct elf_assign_sym_version_info sinfo; - /* Set the size of the .dynsym and .hash sections. We counted - the number of dynamic symbols in elf_link_add_object_symbols. - We will build the contents of .dynsym and .hash when we build - the final symbol table, because until then we do not know the - correct value to give the symbols. We built the .dynstr - section as we went along in elf_link_add_object_symbols. */ - dynsymcount = elf_hash_table (info)->dynsymcount; - s = bfd_get_section_by_name (dynobj, ".dynsym"); + /* Set up the version definition section. */ + s = bfd_get_section_by_name (dynobj, ".gnu.version_d"); BFD_ASSERT (s != NULL); - s->_raw_size = dynsymcount * sizeof (Elf_External_Sym); - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return false; - /* The first entry in .dynsym is a dummy symbol. */ - isym.st_value = 0; - isym.st_size = 0; - isym.st_name = 0; - isym.st_info = 0; - isym.st_other = 0; - isym.st_shndx = 0; - elf_swap_symbol_out (output_bfd, &isym, - (PTR) (Elf_External_Sym *) s->contents); + /* Attach all the symbols to their version information. This + may cause some symbols to be unexported. */ + sinfo.output_bfd = output_bfd; + sinfo.info = info; + sinfo.verdefs = verdefs; + sinfo.export_dynamic = export_dynamic; + sinfo.removed_dynamic = false; + sinfo.failed = false; - for (i = 0; elf_buckets[i] != 0; i++) - { + elf_link_hash_traverse (elf_hash_table (info), + elf_link_assign_sym_version, + (PTR) &sinfo); + if (sinfo.failed) + return false; + + /* We may have created additional version definitions if we are + just linking a regular application. */ + verdefs = sinfo.verdefs; + + if (verdefs == NULL) + { + asection **spp; + + /* Don't include this section in the output file. */ + for (spp = &output_bfd->sections; + *spp != s->output_section; + spp = &(*spp)->next) + ; + *spp = s->output_section->next; + --output_bfd->section_count; + } + else + { + unsigned int cdefs; + bfd_size_type size; + struct bfd_elf_version_tree *t; + bfd_byte *p; + Elf_Internal_Verdef def; + Elf_Internal_Verdaux defaux; + + if (sinfo.removed_dynamic) + { + /* Some dynamic symbols were changed to be local + symbols. In this case, we renumber all of the + dynamic symbols, so that we don't have a hole. If + the backend changed dynsymcount, then assume that the + new symbols are at the start. This is the case on + the MIPS. FIXME: The names of the removed symbols + will still be in the dynamic string table, wasting + space. */ + elf_hash_table (info)->dynsymcount = + 1 + (elf_hash_table (info)->dynsymcount - old_dynsymcount); + elf_link_hash_traverse (elf_hash_table (info), + elf_link_renumber_dynsyms, + (PTR) info); + } + + cdefs = 0; + size = 0; + + /* Make space for the base version. */ + size += sizeof (Elf_External_Verdef); + size += sizeof (Elf_External_Verdaux); + ++cdefs; + + for (t = verdefs; t != NULL; t = t->next) + { + struct bfd_elf_version_deps *n; + + size += sizeof (Elf_External_Verdef); + size += sizeof (Elf_External_Verdaux); + ++cdefs; + + for (n = t->deps; n != NULL; n = n->next) + size += sizeof (Elf_External_Verdaux); + } + + s->_raw_size = size; + s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return false; + + /* Fill in the version definition section. */ + + p = s->contents; + + def.vd_version = VER_DEF_CURRENT; + def.vd_flags = VER_FLG_BASE; + def.vd_ndx = 1; + def.vd_cnt = 1; + def.vd_aux = sizeof (Elf_External_Verdef); + def.vd_next = (sizeof (Elf_External_Verdef) + + sizeof (Elf_External_Verdaux)); + + if (soname_indx != -1) + { + def.vd_hash = bfd_elf_hash ((const unsigned char *) soname); + defaux.vda_name = soname_indx; + } + else + { + const char *name; + bfd_size_type indx; + + name = output_bfd->filename; + def.vd_hash = bfd_elf_hash ((const unsigned char *) name); + indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, + name, true, false); + if (indx == (bfd_size_type) -1) + return false; + defaux.vda_name = indx; + } + defaux.vda_next = 0; + + _bfd_elf_swap_verdef_out (output_bfd, &def, + (Elf_External_Verdef *)p); + p += sizeof (Elf_External_Verdef); + _bfd_elf_swap_verdaux_out (output_bfd, &defaux, + (Elf_External_Verdaux *) p); + p += sizeof (Elf_External_Verdaux); + + for (t = verdefs; t != NULL; t = t->next) + { + unsigned int cdeps; + struct bfd_elf_version_deps *n; + struct elf_link_hash_entry *h; + + cdeps = 0; + for (n = t->deps; n != NULL; n = n->next) + ++cdeps; + + /* Add a symbol representing this version. */ + h = NULL; + if (! (_bfd_generic_link_add_one_symbol + (info, dynobj, t->name, BSF_GLOBAL, bfd_abs_section_ptr, + (bfd_vma) 0, (const char *) NULL, false, + get_elf_backend_data (dynobj)->collect, + (struct bfd_link_hash_entry **) &h))) + return false; + h->elf_link_hash_flags &= ~ ELF_LINK_NON_ELF; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + h->verinfo.vertree = t; + + if (! _bfd_elf_link_record_dynamic_symbol (info, h)) + return false; + + def.vd_version = VER_DEF_CURRENT; + def.vd_flags = 0; + if (t->globals == NULL && t->locals == NULL && ! t->used) + def.vd_flags |= VER_FLG_WEAK; + def.vd_ndx = t->vernum + 1; + def.vd_cnt = cdeps + 1; + def.vd_hash = bfd_elf_hash ((const unsigned char *) t->name); + def.vd_aux = sizeof (Elf_External_Verdef); + if (t->next != NULL) + def.vd_next = (sizeof (Elf_External_Verdef) + + (cdeps + 1) * sizeof (Elf_External_Verdaux)); + else + def.vd_next = 0; + + _bfd_elf_swap_verdef_out (output_bfd, &def, + (Elf_External_Verdef *) p); + p += sizeof (Elf_External_Verdef); + + defaux.vda_name = h->dynstr_index; + if (t->deps == NULL) + defaux.vda_next = 0; + else + defaux.vda_next = sizeof (Elf_External_Verdaux); + t->name_indx = defaux.vda_name; + + _bfd_elf_swap_verdaux_out (output_bfd, &defaux, + (Elf_External_Verdaux *) p); + p += sizeof (Elf_External_Verdaux); + + for (n = t->deps; n != NULL; n = n->next) + { + defaux.vda_name = n->version_needed->name_indx; + if (n->next == NULL) + defaux.vda_next = 0; + else + defaux.vda_next = sizeof (Elf_External_Verdaux); + + _bfd_elf_swap_verdaux_out (output_bfd, &defaux, + (Elf_External_Verdaux *) p); + p += sizeof (Elf_External_Verdaux); + } + } + + if (! elf_add_dynamic_entry (info, DT_VERDEF, 0) + || ! elf_add_dynamic_entry (info, DT_VERDEFNUM, cdefs)) + return false; + + elf_tdata (output_bfd)->cverdefs = cdefs; + } + + /* Work out the size of the version reference section. */ + + s = bfd_get_section_by_name (dynobj, ".gnu.version_r"); + BFD_ASSERT (s != NULL); + { + struct elf_find_verdep_info sinfo; + + sinfo.output_bfd = output_bfd; + sinfo.info = info; + sinfo.vers = elf_tdata (output_bfd)->cverdefs; + if (sinfo.vers == 0) + sinfo.vers = 1; + sinfo.failed = false; + + elf_link_hash_traverse (elf_hash_table (info), + elf_link_find_version_dependencies, + (PTR) &sinfo); + + if (elf_tdata (output_bfd)->verref == NULL) + { + asection **spp; + + /* We don't have any version definitions, so we can just + remove the section. */ + + for (spp = &output_bfd->sections; + *spp != s->output_section; + spp = &(*spp)->next) + ; + *spp = s->output_section->next; + --output_bfd->section_count; + } + else + { + Elf_Internal_Verneed *t; + unsigned int size; + unsigned int crefs; + bfd_byte *p; + + /* Build the version definition section. */ + size = 0; + crefs = 0; + for (t = elf_tdata (output_bfd)->verref; + t != NULL; + t = t->vn_nextref) + { + Elf_Internal_Vernaux *a; + + size += sizeof (Elf_External_Verneed); + ++crefs; + for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) + size += sizeof (Elf_External_Vernaux); + } + + s->_raw_size = size; + s->contents = (bfd_byte *) bfd_alloc (output_bfd, size); + if (s->contents == NULL) + return false; + + p = s->contents; + for (t = elf_tdata (output_bfd)->verref; + t != NULL; + t = t->vn_nextref) + { + unsigned int caux; + Elf_Internal_Vernaux *a; + bfd_size_type indx; + + caux = 0; + for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) + ++caux; + + t->vn_version = VER_NEED_CURRENT; + t->vn_cnt = caux; + indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, + t->vn_bfd->filename, true, false); + if (indx == (bfd_size_type) -1) + return false; + t->vn_file = indx; + t->vn_aux = sizeof (Elf_External_Verneed); + if (t->vn_nextref == NULL) + t->vn_next = 0; + else + t->vn_next = (sizeof (Elf_External_Verneed) + + caux * sizeof (Elf_External_Vernaux)); + + _bfd_elf_swap_verneed_out (output_bfd, t, + (Elf_External_Verneed *) p); + p += sizeof (Elf_External_Verneed); + + for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) + { + a->vna_hash = bfd_elf_hash ((const unsigned char *) + a->vna_nodename); + indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, + a->vna_nodename, true, false); + if (indx == (bfd_size_type) -1) + return false; + a->vna_name = indx; + if (a->vna_nextptr == NULL) + a->vna_next = 0; + else + a->vna_next = sizeof (Elf_External_Vernaux); + + _bfd_elf_swap_vernaux_out (output_bfd, a, + (Elf_External_Vernaux *) p); + p += sizeof (Elf_External_Vernaux); + } + } + + if (! elf_add_dynamic_entry (info, DT_VERNEED, 0) + || ! elf_add_dynamic_entry (info, DT_VERNEEDNUM, crefs)) + return false; + + elf_tdata (output_bfd)->cverrefs = crefs; + } + } + + dynsymcount = elf_hash_table (info)->dynsymcount; + + /* Work out the size of the symbol version section. */ + s = bfd_get_section_by_name (dynobj, ".gnu.version"); + BFD_ASSERT (s != NULL); + if (dynsymcount == 0 + || (verdefs == NULL && elf_tdata (output_bfd)->verref == NULL)) + { + asection **spp; + + /* We don't need any symbol versions; just discard the + section. */ + for (spp = &output_bfd->sections; + *spp != s->output_section; + spp = &(*spp)->next) + ; + *spp = s->output_section->next; + --output_bfd->section_count; + } + else + { + s->_raw_size = dynsymcount * sizeof (Elf_External_Versym); + s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); + if (s->contents == NULL) + return false; + + if (! elf_add_dynamic_entry (info, DT_VERSYM, 0)) + return false; + } + + /* Set the size of the .dynsym and .hash sections. We counted + the number of dynamic symbols in elf_link_add_object_symbols. + We will build the contents of .dynsym and .hash when we build + the final symbol table, because until then we do not know the + correct value to give the symbols. We built the .dynstr + section as we went along in elf_link_add_object_symbols. */ + s = bfd_get_section_by_name (dynobj, ".dynsym"); + BFD_ASSERT (s != NULL); + s->_raw_size = dynsymcount * sizeof (Elf_External_Sym); + s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return false; + + /* The first entry in .dynsym is a dummy symbol. */ + isym.st_value = 0; + isym.st_size = 0; + isym.st_name = 0; + isym.st_info = 0; + isym.st_other = 0; + isym.st_shndx = 0; + elf_swap_symbol_out (output_bfd, &isym, + (PTR) (Elf_External_Sym *) s->contents); + + for (i = 0; elf_buckets[i] != 0; i++) + { bucketcount = elf_buckets[i]; if (dynsymcount < elf_buckets[i + 1]) break; @@ -1514,32 +2517,6 @@ return true; } - -/* This routine is used to export all defined symbols into the dynamic - symbol table. It is called via elf_link_hash_traverse. */ - -static boolean -elf_export_symbol (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_info_failed *eif = (struct elf_info_failed *) data; - - if (h->dynindx == -1 - && (h->elf_link_hash_flags - & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0) - { - if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h)) - { - eif->failed = true; - return false; - } - } - - return true; -} - - /* Make the backend pick a good value for a dynamic symbol. This is called via elf_link_hash_traverse, and also calls itself recursively. */ @@ -1553,6 +2530,10 @@ bfd *dynobj; struct elf_backend_data *bed; + /* Ignore indirect symbols. These are added by the versioning code. */ + if (h->root.type == bfd_link_hash_indirect) + return true; + /* If this symbol was mentioned in a non-ELF file, try to set DEF_REGULAR and REF_REGULAR correctly. This is the only way to permit a non-ELF file to correctly refer to a symbol defined in @@ -1696,6 +2677,359 @@ return true; } +/* This routine is used to export all defined symbols into the dynamic + symbol table. It is called via elf_link_hash_traverse. */ + +static boolean +elf_export_symbol (h, data) + struct elf_link_hash_entry *h; + PTR data; +{ + struct elf_info_failed *eif = (struct elf_info_failed *) data; + + /* Ignore indirect symbols. These are added by the versioning code. */ + if (h->root.type == bfd_link_hash_indirect) + return true; + + if (h->dynindx == -1 + && (h->elf_link_hash_flags + & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0) + { + if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h)) + { + eif->failed = true; + return false; + } + } + + return true; +} + +/* Look through the symbols which are defined in other shared + libraries and referenced here. Update the list of version + dependencies. This will be put into the .gnu.version_r section. + This function is called via elf_link_hash_traverse. */ + +static boolean +elf_link_find_version_dependencies (h, data) + struct elf_link_hash_entry *h; + PTR data; +{ + struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data; + Elf_Internal_Verneed *t; + Elf_Internal_Vernaux *a; + + /* We only care about symbols defined in shared objects with version + information. */ + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + || h->dynindx == -1 + || h->verinfo.verdef == NULL) + return true; + + /* See if we already know about this version. */ + for (t = elf_tdata (rinfo->output_bfd)->verref; t != NULL; t = t->vn_nextref) + { + if (t->vn_bfd == h->verinfo.verdef->vd_bfd) + continue; + + for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) + if (a->vna_nodename == h->verinfo.verdef->vd_nodename) + return true; + + break; + } + + /* This is a new version. Add it to tree we are building. */ + + if (t == NULL) + { + t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->output_bfd, sizeof *t); + if (t == NULL) + { + rinfo->failed = true; + return false; + } + + t->vn_bfd = h->verinfo.verdef->vd_bfd; + t->vn_nextref = elf_tdata (rinfo->output_bfd)->verref; + elf_tdata (rinfo->output_bfd)->verref = t; + } + + a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->output_bfd, sizeof *a); + + /* Note that we are copying a string pointer here, and testing it + above. If bfd_elf_string_from_elf_section is ever changed to + discard the string data when low in memory, this will have to be + fixed. */ + a->vna_nodename = h->verinfo.verdef->vd_nodename; + + a->vna_flags = h->verinfo.verdef->vd_flags; + a->vna_nextptr = t->vn_auxptr; + + h->verinfo.verdef->vd_exp_refno = rinfo->vers; + ++rinfo->vers; + + a->vna_other = h->verinfo.verdef->vd_exp_refno + 1; + + t->vn_auxptr = a; + + return true; +} + +/* Figure out appropriate versions for all the symbols. We may not + have the version number script until we have read all of the input + files, so until that point we don't know which symbols should be + local. This function is called via elf_link_hash_traverse. */ + +static boolean +elf_link_assign_sym_version (h, data) + struct elf_link_hash_entry *h; + PTR data; +{ + struct elf_assign_sym_version_info *sinfo = + (struct elf_assign_sym_version_info *) data; + struct bfd_link_info *info = sinfo->info; + char *p; + + /* We only need version numbers for symbols defined in regular + objects. */ + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + return true; + + p = strchr (h->root.root.string, ELF_VER_CHR); + if (p != NULL && h->verinfo.vertree == NULL) + { + struct bfd_elf_version_tree *t; + boolean hidden; + + hidden = true; + + /* There are two consecutive ELF_VER_CHR characters if this is + not a hidden symbol. */ + ++p; + if (*p == ELF_VER_CHR) + { + hidden = false; + ++p; + } + + /* If there is no version string, we can just return out. */ + if (*p == '\0') + { + if (hidden) + h->elf_link_hash_flags |= ELF_LINK_HIDDEN; + return true; + } + + /* Look for the version. If we find it, it is no longer weak. */ + for (t = sinfo->verdefs; t != NULL; t = t->next) + { + if (strcmp (t->name, p) == 0) + { + h->verinfo.vertree = t; + t->used = true; + + /* See if there is anything to force this symbol to + local scope. */ + if (t->locals != NULL) + { + int len; + char *alc; + struct bfd_elf_version_expr *d; + + len = p - h->root.root.string; + alc = bfd_alloc (sinfo->output_bfd, len); + if (alc == NULL) + return false; + strncpy (alc, h->root.root.string, len - 1); + alc[len - 1] = '\0'; + if (alc[len - 2] == ELF_VER_CHR) + alc[len - 2] = '\0'; + + for (d = t->locals; d != NULL; d = d->next) + { + if ((d->match[0] == '*' && d->match[1] == '\0') + || fnmatch (d->match, alc, 0) == 0) + { + if (h->dynindx != -1 + && info->shared + && ! sinfo->export_dynamic + && (h->elf_link_hash_flags + & ELF_LINK_HASH_NEEDS_PLT) == 0) + { + sinfo->removed_dynamic = true; + h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; + h->dynindx = -1; + /* FIXME: The name of the symbol has + already been recorded in the dynamic + string table section. */ + } + + break; + } + } + + bfd_release (sinfo->output_bfd, alc); + } + + break; + } + } + + /* If we are building an application, we need to create a + version node for this version. */ + if (t == NULL && ! info->shared) + { + struct bfd_elf_version_tree **pp; + int version_index; + + /* If we aren't going to export this symbol, we don't need + to worry about it. */ + if (h->dynindx == -1) + return true; + + t = ((struct bfd_elf_version_tree *) + bfd_alloc (sinfo->output_bfd, sizeof *t)); + if (t == NULL) + { + sinfo->failed = true; + return false; + } + + t->next = NULL; + t->name = p; + t->globals = NULL; + t->locals = NULL; + t->deps = NULL; + t->name_indx = (unsigned int) -1; + t->used = true; + + version_index = 1; + for (pp = &sinfo->verdefs; *pp != NULL; pp = &(*pp)->next) + ++version_index; + t->vernum = version_index; + + *pp = t; + + h->verinfo.vertree = t; + } + else if (t == NULL) + { + /* We could not find the version for a symbol when + generating a shared archive. Return an error. */ + (*_bfd_error_handler) + ("%s: undefined version name %s", + bfd_get_filename (sinfo->output_bfd), h->root.root.string); + bfd_set_error (bfd_error_bad_value); + sinfo->failed = true; + return false; + } + + if (hidden) + h->elf_link_hash_flags |= ELF_LINK_HIDDEN; + } + + /* If we don't have a version for this symbol, see if we can find + something. */ + if (h->verinfo.vertree == NULL && sinfo->verdefs != NULL) + { + struct bfd_elf_version_tree *t; + struct bfd_elf_version_tree *deflt; + struct bfd_elf_version_expr *d; + + /* See if can find what version this symbol is in. If the + symbol is supposed to eb local, then don't actually register + it. */ + deflt = NULL; + for (t = sinfo->verdefs; t != NULL; t = t->next) + { + if (t->globals != NULL) + { + for (d = t->globals; d != NULL; d = d->next) + { + if (fnmatch (d->match, h->root.root.string, 0) == 0) + { + h->verinfo.vertree = t; + break; + } + } + + if (d != NULL) + break; + } + + if (t->locals != NULL) + { + for (d = t->locals; d != NULL; d = d->next) + { + if (d->match[0] == '*' && d->match[1] == '\0') + deflt = t; + else if (fnmatch (d->match, h->root.root.string, 0) == 0) + { + h->verinfo.vertree = t; + if (h->dynindx != -1 + && info->shared + && ! sinfo->export_dynamic + && (h->elf_link_hash_flags + & ELF_LINK_HASH_NEEDS_PLT) == 0) + { + sinfo->removed_dynamic = true; + h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; + h->dynindx = -1; + /* FIXME: The name of the symbol has already + been recorded in the dynamic string table + section. */ + } + break; + } + } + + if (d != NULL) + break; + } + } + + if (deflt != NULL && h->verinfo.vertree == NULL) + { + h->verinfo.vertree = deflt; + if (h->dynindx != -1 + && info->shared + && ! sinfo->export_dynamic + && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0) + { + sinfo->removed_dynamic = true; + h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; + h->dynindx = -1; + /* FIXME: The name of the symbol has already been + recorded in the dynamic string table section. */ + } + } + } + + return true; +} + +/* This function is used to renumber the dynamic symbols, if some of + them are removed because they are marked as local. This is called + via elf_link_hash_traverse. */ + +static boolean +elf_link_renumber_dynsyms (h, data) + struct elf_link_hash_entry *h; + PTR data; +{ + struct bfd_link_info *info = (struct bfd_link_info *) data; + + if (h->dynindx != -1) + { + h->dynindx = elf_hash_table (info)->dynsymcount; + ++elf_hash_table (info)->dynsymcount; + } + + return true; +} + /* Final phase of ELF linker. */ /* A structure we use to avoid passing large numbers of arguments. */ @@ -1712,6 +3046,8 @@ asection *dynsym_sec; /* .hash section. */ asection *hash_sec; + /* symbol version section (.gnu.version). */ + asection *symver_sec; /* Buffer large enough to hold contents of any section. */ bfd_byte *contents; /* Buffer large enough to hold external relocs of any section. */ @@ -1751,14 +3087,14 @@ PARAMS ((bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *)); -/* This struct is used to pass information to routines called via - elf_link_hash_traverse which must return failure. */ +/* This struct is used to pass information to elf_link_output_extsym. */ -struct elf_finfo_failed +struct elf_outext_info { boolean failed; + boolean localsyms; struct elf_final_link_info *finfo; -}; +}; /* Do the final step of an ELF link. */ @@ -1783,7 +3119,7 @@ Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symstrtab_hdr; struct elf_backend_data *bed = get_elf_backend_data (abfd); - struct elf_finfo_failed eif; + struct elf_outext_info eoinfo; if (info->shared) abfd->flags |= DYNAMIC; @@ -1796,17 +3132,22 @@ finfo.symstrtab = elf_stringtab_init (); if (finfo.symstrtab == NULL) return false; + if (! dynamic) { finfo.dynsym_sec = NULL; finfo.hash_sec = NULL; + finfo.symver_sec = NULL; } else { finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym"); finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash"); BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL); + finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version"); + /* Note that it is OK if symver_sec is NULL. */ } + finfo.contents = NULL; finfo.external_relocs = NULL; finfo.internal_relocs = NULL; @@ -1855,7 +3196,8 @@ /* We are interested in just local symbols, not all symbols. */ - if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour) + if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour + && (sec->owner->flags & DYNAMIC) == 0) { size_t sym_count; @@ -2018,7 +3360,6 @@ outputting relocs. */ if (info->strip != strip_all || info->relocateable) { - elfsym.st_value = 0; elfsym.st_size = 0; elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); elfsym.st_other = 0; @@ -2028,6 +3369,10 @@ if (o != NULL) o->target_index = abfd->symcount; elfsym.st_shndx = i; + if (info->relocateable || o == NULL) + elfsym.st_value = 0; + else + elfsym.st_value = o->vma; if (! elf_link_output_sym (&finfo, (const char *) NULL, &elfsym, o)) goto error_return; @@ -2114,6 +3459,23 @@ /* That wrote out all the local symbols. Finish up the symbol table with the global symbols. */ + if (info->strip != strip_all && info->shared) + { + /* Output any global symbols that got converted to local in a + version script. We do this in a separate step since ELF + requires all local symbols to appear prior to any global + symbols. FIXME: We should only do this if some global + symbols were, in fact, converted to become local. FIXME: + Will this work correctly with the Irix 5 linker? */ + eoinfo.failed = false; + eoinfo.finfo = &finfo; + eoinfo.localsyms = true; + elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym, + (PTR) &eoinfo); + if (eoinfo.failed) + return false; + } + /* The sh_info field records the index of the first non local symbol. */ symtab_hdr->sh_info = abfd->symcount; @@ -2121,11 +3483,12 @@ elf_section_data (finfo.dynsym_sec->output_section)->this_hdr.sh_info = 1; /* We get the global symbols from the hash table. */ - eif.failed = false; - eif.finfo = &finfo; + eoinfo.failed = false; + eoinfo.localsyms = false; + eoinfo.finfo = &finfo; elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym, - (PTR) &eif); - if (eif.failed) + (PTR) &eoinfo); + if (eoinfo.failed) return false; /* Flush all symbols to the file. */ @@ -2174,7 +3537,7 @@ { if (*rel_hash == NULL) continue; - + BFD_ASSERT ((*rel_hash)->indx >= 0); if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel)) @@ -2277,6 +3640,15 @@ goto get_vma; case DT_SYMTAB: name = ".dynsym"; + goto get_vma; + case DT_VERDEF: + name = ".gnu.version_d"; + goto get_vma; + case DT_VERNEED: + name = ".gnu.version_r"; + goto get_vma; + case DT_VERSYM: + name = ".gnu.version"; get_vma: o = bfd_get_section_by_name (abfd, name); BFD_ASSERT (o != NULL); @@ -2328,11 +3700,10 @@ if ((o->flags & SEC_HAS_CONTENTS) == 0 || o->_raw_size == 0) continue; - if ((o->flags & SEC_IN_MEMORY) == 0) + if ((o->flags & SEC_LINKER_CREATED) == 0) { /* At this point, we are only interested in sections - created by elf_link_create_dynamic_sections. FIXME: - This test is fragile. */ + created by elf_link_create_dynamic_sections. */ continue; } if ((elf_section_data (o->output_section)->this_hdr.sh_type @@ -2502,19 +3873,35 @@ } /* Add an external symbol to the symbol table. This is called from - the hash table traversal routine. */ + the hash table traversal routine. When generating a shared object, + we go through the symbol table twice. The first time we output + anything that might have been forced to local scope in a version + script. The second time we output the symbols that are still + global symbols. */ static boolean elf_link_output_extsym (h, data) struct elf_link_hash_entry *h; PTR data; { - struct elf_finfo_failed *eif = (struct elf_finfo_failed *) data; - struct elf_final_link_info *finfo = eif->finfo; + struct elf_outext_info *eoinfo = (struct elf_outext_info *) data; + struct elf_final_link_info *finfo = eoinfo->finfo; boolean strip; Elf_Internal_Sym sym; asection *input_sec; + /* Decide whether to output this symbol in this pass. */ + if (eoinfo->localsyms) + { + if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + return true; + } + else + { + if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + return true; + } + /* If we are not creating a shared library, and this symbol is referenced by a shared library but is not defined anywhere, then warn that it is undefined. If we do not do this, the runtime @@ -2532,7 +3919,7 @@ (finfo->info, h->root.root.string, h->root.u.undef.abfd, (asection *) NULL, 0))) { - eif->failed = true; + eoinfo->failed = true; return false; } } @@ -2564,9 +3951,11 @@ sym.st_value = 0; sym.st_size = h->size; - sym.st_other = 0; - if (h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_defweak) + sym.st_other = h->other; + if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + sym.st_info = ELF_ST_INFO (STB_LOCAL, h->type); + else if (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_defweak) sym.st_info = ELF_ST_INFO (STB_WEAK, h->type); else sym.st_info = ELF_ST_INFO (STB_GLOBAL, h->type); @@ -2599,7 +3988,7 @@ input_sec->output_section); if (sym.st_shndx == (unsigned short) -1) { - eif->failed = true; + eoinfo->failed = true; return false; } @@ -2612,9 +4001,8 @@ } else { - BFD_ASSERT ((bfd_get_flavour (input_sec->owner) - == bfd_target_elf_flavour) - && elf_elfheader (input_sec->owner)->e_type == ET_DYN); + BFD_ASSERT (input_sec->owner == NULL + || (input_sec->owner->flags & DYNAMIC) != 0); sym.st_shndx = SHN_UNDEF; input_sec = bfd_und_section_ptr; } @@ -2628,9 +4016,20 @@ break; case bfd_link_hash_indirect: + /* These symbols are created by symbol versioning. They point + to the decorated version of the name. For example, if the + symbol foo@@GNU_1.2 is the default, which should be used when + foo is used with no version, then we add an indirect symbol + foo which points to foo@@GNU_1.2. We ignore these symbols, + since the indirected symbol is already in the hash table. If + the indirect symbol is non-ELF, fall through and output it. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_ELF) == 0) + return true; + + /* Fall through. */ case bfd_link_hash_warning: - /* We can't represent these symbols in ELF. A warning symbol - may have come from a .gnu.warning.SYMBOL section anyhow. We + /* We can't represent these symbols in ELF, although a warning + symbol may have come from a .gnu.warning.SYMBOL section. We just put the target symbol in the hash table. If the target symbol does not really exist, don't do anything. */ if (h->root.u.i.link->type == bfd_link_hash_new) @@ -2646,6 +4045,8 @@ && elf_hash_table (finfo->info)->dynamic_sections_created) { struct elf_backend_data *bed; + char *p, *copy; + const char *name; size_t bucketcount; size_t bucket; bfd_byte *bucketpos; @@ -2660,7 +4061,7 @@ if (! ((*bed->elf_backend_finish_dynamic_symbol) (finfo->output_bfd, finfo->info, h, &sym))) { - eif->failed = true; + eoinfo->failed = true; return false; } @@ -2669,9 +4070,22 @@ finfo->dynsym_sec->contents) + h->dynindx)); + /* We didn't include the version string in the dynamic string + table, so we must not consider it in the hash table. */ + name = h->root.root.string; + p = strchr (name, ELF_VER_CHR); + if (p == NULL) + copy = NULL; + else + { + copy = bfd_alloc (finfo->output_bfd, p - name + 1); + strncpy (copy, name, p - name); + copy[p - name] = '\0'; + name = copy; + } + bucketcount = elf_hash_table (finfo->info)->bucketcount; - bucket = (bfd_elf_hash ((const unsigned char *) h->root.root.string) - % bucketcount); + bucket = bfd_elf_hash ((const unsigned char *) name) % bucketcount; bucketpos = ((bfd_byte *) finfo->hash_sec->contents + (bucket + 2) * (ARCH_SIZE / 8)); chain = get_word (finfo->output_bfd, bucketpos); @@ -2679,6 +4093,37 @@ put_word (finfo->output_bfd, chain, ((bfd_byte *) finfo->hash_sec->contents + (bucketcount + 2 + h->dynindx) * (ARCH_SIZE / 8))); + + if (copy != NULL) + bfd_release (finfo->output_bfd, copy); + + if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL) + { + Elf_Internal_Versym iversym; + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + if (h->verinfo.verdef == NULL) + iversym.vs_vers = 0; + else + iversym.vs_vers = h->verinfo.verdef->vd_exp_refno + 1; + } + else + { + if (h->verinfo.vertree == NULL) + iversym.vs_vers = 1; + else + iversym.vs_vers = h->verinfo.vertree->vernum + 1; + } + + if ((h->elf_link_hash_flags & ELF_LINK_HIDDEN) != 0) + iversym.vs_vers |= VERSYM_HIDDEN; + + _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, + (((Elf_External_Versym *) + finfo->symver_sec->contents) + + h->dynindx)); + } } /* If we're stripping it, then it was just a dynamic symbol, and @@ -2690,7 +4135,7 @@ if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec)) { - eif->failed = true; + eoinfo->failed = true; return false; } @@ -2715,6 +4160,7 @@ Elf_Internal_Shdr *symtab_hdr; size_t locsymcount; size_t extsymoff; + Elf_External_Sym *external_syms; Elf_External_Sym *esym; Elf_External_Sym *esymend; Elf_Internal_Sym *isym; @@ -2729,7 +4175,7 @@ /* If this is a dynamic object, we don't want to do anything here: we don't want the local symbols, and we don't want the section contents. */ - if (elf_elfheader (input_bfd)->e_type == ET_DYN) + if ((input_bfd->flags & DYNAMIC) != 0) return true; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -2745,16 +4191,23 @@ } /* Read the local symbols. */ - if (locsymcount > 0 - && (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (finfo->external_syms, sizeof (Elf_External_Sym), + if (symtab_hdr->contents != NULL) + external_syms = (Elf_External_Sym *) symtab_hdr->contents; + else if (locsymcount == 0) + external_syms = NULL; + else + { + external_syms = finfo->external_syms; + if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_read (external_syms, sizeof (Elf_External_Sym), locsymcount, input_bfd) - != locsymcount * sizeof (Elf_External_Sym)))) - return false; + != locsymcount * sizeof (Elf_External_Sym))) + return false; + } /* Swap in the local symbols and write out the ones which we know are going into the output file. */ - esym = finfo->external_syms; + esym = external_syms; esymend = esym + locsymcount; isym = finfo->internal_syms; pindex = finfo->indices; @@ -2794,7 +4247,7 @@ *ppsection = isec; /* Don't output the first, undefined, symbol. */ - if (esym == finfo->external_syms) + if (esym == external_syms) continue; /* If we are stripping all symbols, we don't want to output this @@ -2815,9 +4268,22 @@ if (finfo->info->discard == discard_all) continue; + /* If this symbol is defined in a section which we are + discarding, we don't need to keep it, but note that + linker_mark is only reliable for sections that have contents. + For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE + as well as linker_mark. */ + if (isym->st_shndx > 0 + && isym->st_shndx < SHN_LORESERVE + && isec != NULL + && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0) + || (! finfo->info->relocateable + && (isec->flags & SEC_EXCLUDE) != 0))) + continue; + /* Get the name of the symbol. */ name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, - isym->st_name); + isym->st_name); if (name == NULL) return false; @@ -2826,8 +4292,7 @@ && (bfd_hash_lookup (finfo->info->keep_hash, name, false, false) == NULL)) || (finfo->info->discard == discard_l - && strncmp (name, finfo->info->lprefix, - finfo->info->lprefix_len) == 0)) + && bfd_is_local_label_name (input_bfd, name))) continue; /* If we get here, we are going to output this symbol. */ @@ -2860,6 +4325,8 @@ /* Relocate the contents of each section. */ for (o = input_bfd->sections; o != NULL; o = o->next) { + bfd_byte *contents; + if (! o->linker_mark) { /* This section was omitted from the link. */ @@ -2870,28 +4337,35 @@ || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0)) continue; - if ((o->flags & SEC_IN_MEMORY) != 0 - && input_bfd == elf_hash_table (finfo->info)->dynobj) + if ((o->flags & SEC_LINKER_CREATED) != 0) { - /* Section was created by elf_link_create_dynamic_sections. - FIXME: This test is fragile. */ + /* Section was created by elf_link_create_dynamic_sections + or somesuch. */ continue; } - /* Read the contents of the section. */ - if (! bfd_get_section_contents (input_bfd, o, finfo->contents, - (file_ptr) 0, o->_raw_size)) - return false; + /* Get the contents of the section. They have been cached by a + relaxation routine. Note that o is a section in an input + file, so the contents field will not have been set by any of + the routines which work on output files. */ + if (elf_section_data (o)->this_hdr.contents != NULL) + contents = elf_section_data (o)->this_hdr.contents; + else + { + contents = finfo->contents; + if (! bfd_get_section_contents (input_bfd, o, contents, + (file_ptr) 0, o->_raw_size)) + return false; + } if ((o->flags & SEC_RELOC) != 0) { Elf_Internal_Rela *internal_relocs; /* Get the swapped relocs. */ - internal_relocs = elf_link_read_relocs (input_bfd, o, - finfo->external_relocs, - finfo->internal_relocs, - false); + internal_relocs = (NAME(_bfd_elf,link_read_relocs) + (input_bfd, o, finfo->external_relocs, + finfo->internal_relocs, false)); if (internal_relocs == NULL && o->reloc_count > 0) return false; @@ -2917,8 +4391,7 @@ the addend to be adjusted. */ if (! (*relocate_section) (output_bfd, finfo->info, - input_bfd, o, - finfo->contents, + input_bfd, o, contents, internal_relocs, finfo->internal_syms, finfo->sections)) @@ -2985,8 +4458,13 @@ { /* I suppose the backend ought to fill in the section of any STT_SECTION symbol against a - processor specific section. */ - if (sec != NULL && bfd_is_abs_section (sec)) + processor specific section. If we have + discarded a section, the output_section will + be the absolute section. */ + if (sec != NULL + && (bfd_is_abs_section (sec) + || (sec->output_section != NULL + && bfd_is_abs_section (sec->output_section)))) r_symndx = 0; else if (sec == NULL || sec->owner == NULL) { @@ -3091,7 +4569,7 @@ if (elf_section_data (o)->stab_info == NULL) { if (! bfd_set_section_contents (output_bfd, o->output_section, - finfo->contents, o->output_offset, + contents, o->output_offset, (o->_cooked_size != 0 ? o->_cooked_size : o->_raw_size))) @@ -3099,9 +4577,9 @@ } else { - if (! _bfd_write_section_stabs (output_bfd, o, - &elf_section_data (o)->stab_info, - finfo->contents)) + if (! (_bfd_write_section_stabs + (output_bfd, &elf_hash_table (finfo->info)->stab_info, + o, &elf_section_data (o)->stab_info, contents))) return false; } } diff -urN binutils-2.7/bfd/elfxx-target.h binutils-2.8/bfd/elfxx-target.h --- binutils-2.7/bfd/elfxx-target.h Thu Jul 4 12:18:54 1996 +++ binutils-2.8/bfd/elfxx-target.h Wed Apr 30 12:56:07 1997 @@ -1,5 +1,5 @@ /* Target definitions for NN-bit ELF - Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -80,7 +80,10 @@ bfd_generic_get_relocated_section_contents #endif +#ifndef bfd_elfNN_bfd_relax_section #define bfd_elfNN_bfd_relax_section bfd_generic_relax_section +#endif + #define bfd_elfNN_bfd_make_debug_symbol \ ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr) @@ -109,17 +112,17 @@ #define bfd_elfNN_bfd_set_private_flags \ ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true) #endif -#ifndef bfd_elfNN_bfd_is_local_label -#define bfd_elfNN_bfd_is_local_label bfd_generic_is_local_label +#ifndef bfd_elfNN_bfd_is_local_label_name +#define bfd_elfNN_bfd_is_local_label_name _bfd_elf_is_local_label_name #endif #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound #define bfd_elfNN_get_dynamic_reloc_upper_bound \ - _bfd_nodynamic_get_dynamic_reloc_upper_bound + _bfd_elf_get_dynamic_reloc_upper_bound #endif #ifndef bfd_elfNN_canonicalize_dynamic_reloc #define bfd_elfNN_canonicalize_dynamic_reloc \ - _bfd_nodynamic_canonicalize_dynamic_reloc + _bfd_elf_canonicalize_dynamic_reloc #endif #ifdef elf_backend_relocate_section @@ -143,6 +146,22 @@ #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section #endif +#ifndef bfd_elfNN_archive_p +#define bfd_elfNN_archive_p bfd_generic_archive_p +#endif + +#ifndef bfd_elfNN_write_archive_contents +#define bfd_elfNN_write_archive_contents _bfd_write_archive_contents +#endif + +#ifndef bfd_elfNN_mkobject +#define bfd_elfNN_mkobject bfd_elf_mkobject +#endif + +#ifndef bfd_elfNN_mkarchive +#define bfd_elfNN_mkarchive _bfd_generic_mkarchive +#endif + #ifndef elf_symbol_leading_char #define elf_symbol_leading_char 0 #endif @@ -205,6 +224,9 @@ #ifndef elf_backend_adjust_dynamic_symbol #define elf_backend_adjust_dynamic_symbol 0 #endif +#ifndef elf_backend_always_size_sections +#define elf_backend_always_size_sections 0 +#endif #ifndef elf_backend_size_dynamic_sections #define elf_backend_size_dynamic_sections 0 #endif @@ -274,6 +296,7 @@ elf_backend_create_dynamic_sections, elf_backend_check_relocs, elf_backend_adjust_dynamic_symbol, + elf_backend_always_size_sections, elf_backend_size_dynamic_sections, elf_backend_relocate_section, elf_backend_finish_dynamic_symbol, @@ -309,7 +332,7 @@ /* object_flags: mask of all file flags */ (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), - + /* section_flags: mask of all section flags */ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES), @@ -342,28 +365,32 @@ /* bfd_check_format: check the format of a file being read */ { _bfd_dummy_target, /* unknown format */ bfd_elfNN_object_p, /* assembler/linker output (object file) */ - bfd_generic_archive_p, /* an archive */ + bfd_elfNN_archive_p, /* an archive */ bfd_elfNN_core_file_p /* a core file */ }, /* bfd_set_format: set the format of a file being written */ { bfd_false, - bfd_elf_mkobject, - _bfd_generic_mkarchive, + bfd_elfNN_mkobject, + bfd_elfNN_mkarchive, bfd_false }, /* bfd_write_contents: write cached information into a file being written */ { bfd_false, bfd_elfNN_write_object_contents, - _bfd_write_archive_contents, + bfd_elfNN_write_archive_contents, bfd_false }, BFD_JUMP_TABLE_GENERIC (bfd_elfNN), BFD_JUMP_TABLE_COPY (bfd_elfNN), BFD_JUMP_TABLE_CORE (bfd_elfNN), +#ifdef bfd_elfNN_archive_functions + BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive), +#else BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), +#endif BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN), BFD_JUMP_TABLE_RELOCS (bfd_elfNN), BFD_JUMP_TABLE_WRITE (bfd_elfNN), @@ -393,7 +420,7 @@ /* object_flags: mask of all file flags */ (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), - + /* section_flags: mask of all section flags */ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES), @@ -426,28 +453,32 @@ /* bfd_check_format: check the format of a file being read */ { _bfd_dummy_target, /* unknown format */ bfd_elfNN_object_p, /* assembler/linker output (object file) */ - bfd_generic_archive_p, /* an archive */ + bfd_elfNN_archive_p, /* an archive */ bfd_elfNN_core_file_p /* a core file */ }, /* bfd_set_format: set the format of a file being written */ { bfd_false, - bfd_elf_mkobject, - _bfd_generic_mkarchive, + bfd_elfNN_mkobject, + bfd_elfNN_mkarchive, bfd_false }, /* bfd_write_contents: write cached information into a file being written */ { bfd_false, bfd_elfNN_write_object_contents, - _bfd_write_archive_contents, + bfd_elfNN_write_archive_contents, bfd_false }, BFD_JUMP_TABLE_GENERIC (bfd_elfNN), BFD_JUMP_TABLE_COPY (bfd_elfNN), BFD_JUMP_TABLE_CORE (bfd_elfNN), +#ifdef bfd_elfNN_archive_functions + BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive), +#else BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), +#endif BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN), BFD_JUMP_TABLE_RELOCS (bfd_elfNN), BFD_JUMP_TABLE_WRITE (bfd_elfNN), diff -urN binutils-2.7/bfd/evax-alpha.c binutils-2.8/bfd/evax-alpha.c --- binutils-2.7/bfd/evax-alpha.c Thu Jul 4 12:18:55 1996 +++ binutils-2.8/bfd/evax-alpha.c Wed Apr 30 12:56:07 1997 @@ -1,6 +1,6 @@ -/* evax-alpha.c -- BFD back-end for ALPHA EVAX (openVMS/AXP) files. - Copyright 1996 Free Software Foundation, Inc. - Written by Klaus Kämpf (kkaempf@progis.de) +/* evax-alpha.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files. + Copyright 1996, 1997 Free Software Foundation, Inc. + Written by Klaus K"ampf (kkaempf@progis.de) of proGIS Softwareentwicklung, Aachen, Germany This program is free software; you can redistribute it and/or modify @@ -78,7 +78,7 @@ PARAMS ((bfd *abfd, PTR file, asymbol *symbol, bfd_print_symbol_type how)); static void evax_get_symbol_info PARAMS ((bfd *abfd, asymbol *symbol, symbol_info *ret)); -static boolean evax_bfd_is_local_label PARAMS ((bfd *abfd, asymbol *symbol)); +static boolean evax_bfd_is_local_label_name PARAMS ((bfd *abfd, const char *)); static alent *evax_get_lineno PARAMS ((bfd *abfd, asymbol *symbol)); static boolean evax_find_nearest_line PARAMS ((bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset, @@ -137,32 +137,20 @@ false, /* data byte order is little */ false, /* header byte order is little */ - (HAS_RELOC | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */ + (HAS_RELOC | HAS_SYMS + | WP_TEXT | D_PAGED), /* object flags */ + (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_CODE | SEC_DATA + | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */ 0, /* symbol_leading_char */ ' ', /* ar_pad_char */ 15, /* ar_max_namelen */ - bfd_getl64, /* bfd_getx64 */ - bfd_getl_signed_64, /* bfd_getx_signed_64 */ - bfd_putl64, /* bfd_putx64 */ - bfd_getl32, /* bfd_getx32 */ - bfd_getl_signed_32, /* bfd_getx_signed_32 */ - bfd_putl32, /* bfd_putx32 */ - bfd_getl16, /* bfd_getx16 */ - bfd_getl_signed_16, /* bfd_getx_signed_16 */ - bfd_putl16, /* bfd_putx16 */ - bfd_getl64, /* bfd_h_getx64 */ - bfd_getl_signed_64, /* bfd_h_getx_signed_64 */ - bfd_putl64, /* bfd_h_putx64 */ - bfd_getl32, /* bfd_h_getx32 */ - bfd_getl_signed_32, /* bfd_h_getx_signed_32 */ - bfd_putl32, /* bfd_h_putx32 */ - bfd_getl16, /* bfd_h_getx16 */ - bfd_getl_signed_16, /* bfd_h_getx_signed_16 */ - bfd_putl16, /* bfd_h_putx16 */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, {_bfd_dummy_target, evax_object_p, /* bfd_check_format */ evax_archive_p, _bfd_dummy_target}, @@ -208,7 +196,6 @@ PRIV(buf_size) = 0; PRIV(rec_length) = 0; PRIV(file_format) = FF_UNKNOWN; - PRIV(filename) = NULL; PRIV(fixup_done) = false; PRIV(sections) = NULL; @@ -247,11 +234,8 @@ goto evax_init_no_mem2; } - for (i=0; inext; - free (er); - er = er1; - } - PRIV(evax_reloc_table)[i] = NULL; } free (abfd->tdata.any); @@ -1034,9 +1003,9 @@ PRIV(symcache) = symbols; bfd_hash_traverse(PRIV(evax_symbol_table), copy_symbols, (PTR)abfd); - symbols[bfd_get_symcount(abfd)] = NULL; + symbols[PRIV(egsd_sym_count)] = NULL; - return bfd_get_symcount(abfd); + return PRIV(egsd_sym_count); } @@ -1167,14 +1136,14 @@ a compiler generated local label, else return false. */ static boolean -evax_bfd_is_local_label (abfd, symbol) +evax_bfd_is_local_label_name (abfd, name) bfd *abfd; - asymbol *symbol; + const char *name; { #if EVAX_DEBUG - evax_debug (1, "evax_bfd_is_local_label(%p, %p)\n", abfd, symbol); + evax_debug (1, "evax_bfd_is_local_label_name(%p, %s)\n", abfd, name); #endif - return false; + return name[0] == '$'; } @@ -1317,8 +1286,6 @@ bfd *output_bfd; char **error_message; { - evax_reloc *er; - #if EVAX_DEBUG evax_debug (1, "reloc_nil(abfd %p, output_bfd %p)\n", abfd, output_bfd); evax_debug (2, "In section %s, symbol %s\n", @@ -1331,23 +1298,6 @@ /* _bfd_hexdump (2, data, bfd_get_reloc_size(reloc->howto),0); */ #endif - er = (evax_reloc *)malloc (sizeof(evax_reloc)); - if (er == NULL) - { - bfd_set_error (bfd_error_no_memory); - return bfd_reloc_notsupported; /* FIXME */ - } - er->section = sec; - er->reloc = reloc; - er->next = NULL; - if (PRIV(evax_reloc_table)[sec->index] == NULL) - { - PRIV(evax_reloc_table)[sec->index] = er; - } - else - { - er->next = PRIV(evax_reloc_table)[sec->index]; - } return bfd_reloc_ok; } @@ -1541,47 +1491,32 @@ 0, /* dst_mask */ false), /* pcrel_offset */ - /* Switch table, 32bit relocation. */ - HOWTO (ALPHA_R_SWREL32, /* type */ + /* A 32 bit reference to a symbol. */ + HOWTO (ALPHA_R_REFLONG, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ + complain_overflow_bitfield, /* complain_on_overflow */ reloc_nil, /* special_function */ - "SWREL32", /* name */ - false, /* partial_inplace */ + "REFLONG", /* name */ + true, /* partial_inplace */ 0xffffffff, /* src_mask */ 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ - /* Switch table, 64bit relocation. */ - HOWTO (ALPHA_R_SWREL64, /* type */ + /* A 64 bit reference to a procedure, written as 32 bit value. */ + HOWTO (ALPHA_R_CODEADDR, /* type */ 0, /* rightshift */ 4, /* size (0 = byte, 1 = short, 2 = long) */ 64, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ + complain_overflow_signed,/* complain_on_overflow */ reloc_nil, /* special_function */ - "SWREL64", /* name */ + "CODEADDR", /* name */ false, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 32 bit reference to a symbol. */ - HOWTO (ALPHA_R_REFLONG, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - reloc_nil, /* special_function */ - "REFLONG", /* name */ - true, /* partial_inplace */ 0xffffffff, /* src_mask */ 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ @@ -1614,15 +1549,7 @@ case BFD_RELOC_32_PCREL: alpha_type = ALPHA_R_SREL32; break; case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break; case BFD_RELOC_ALPHA_LINKAGE: alpha_type = ALPHA_R_LINKAGE; break; - case BFD_RELOC_SWREL32: alpha_type = ALPHA_R_SWREL32; break; - case BFD_RELOC_SWREL64: alpha_type = ALPHA_R_SWREL64; break; -#if 0 - case ???: alpha_type = ALPHA_R_OP_PUSH; break; - case ???: alpha_type = ALPHA_R_OP_STORE; break; - case ???: alpha_type = ALPHA_R_OP_PSUB; break; - case ???: alpha_type = ALPHA_R_OP_PRSHIFT;break; - case ???: alpha_type = ALPHA_R_GPVALUE; break; -#endif + case BFD_RELOC_ALPHA_CODEADDR: alpha_type = ALPHA_R_CODEADDR; break; default: (*_bfd_error_handler) ("reloc (%d) is *UNKNOWN*", code); return (const struct reloc_howto_struct *) NULL; @@ -1675,6 +1602,7 @@ #if EVAX_DEBUG evax_debug (1, "evax_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n", abfd, section->name, location, (long int)offset, (int)count); + evax_debug (2, "secraw %d, seccooked %d\n", (int)section->_raw_size, (int)section->_cooked_size); #endif return _bfd_save_evax_section(abfd, section, location, offset, count); } diff -urN binutils-2.7/bfd/evax-egsd.c binutils-2.8/bfd/evax-egsd.c --- binutils-2.7/bfd/evax-egsd.c Thu Jul 4 12:18:56 1996 +++ binutils-2.8/bfd/evax-egsd.c Wed Apr 30 12:56:07 1997 @@ -1,10 +1,10 @@ -/* evax-egsd.c -- BFD back-end for ALPHA EVAX (openVMS/AXP) files. - Copyright 1996 Free Software Foundation Inc. +/* evax-egsd.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files. + Copyright 1996, 1997 Free Software Foundation Inc. go and read the openVMS linker manual (esp. appendix B) if you don't know what's going on here :-) - Written by Klaus Kämpf (kkaempf@progis.de) + Written by Klaus K"ampf (kkaempf@progis.de) of proGIS Softwareentwicklung, Aachen, Germany This program is free software; you can redistribute it and/or modify @@ -43,6 +43,8 @@ #define EVAX_BSS_NAME "$BSS$" #define EVAX_READONLY_NAME "$READONLY$" #define EVAX_LITERAL_NAME "$LITERAL$" +#define EVAX_COMMON_NAME "$COMMON$" +#define EVAX_LOCAL_NAME "$LOCAL$" struct sec_flags_struct { char *name; /* name of section */ @@ -261,7 +263,7 @@ return -1; old_flags = bfd_getl16 (evax_rec + 6); section->_raw_size = bfd_getl32 (evax_rec + 8); /* allocation */ - new_flags = evax_secflag_by_name (name, section->_raw_size); + new_flags = evax_secflag_by_name (name, (int) section->_raw_size); if (old_flags & EGPS_S_V_REL) new_flags |= SEC_RELOC; if (!bfd_set_section_flags (abfd, section, new_flags)) @@ -271,14 +273,13 @@ if ((base_addr % align_addr) != 0) base_addr += (align_addr - (base_addr % align_addr)); section->vma = (bfd_vma)base_addr; - base_addr += section->_raw_size; /* FIXME: should be cooked size */ - section->contents = (unsigned char *) malloc (section->_raw_size); + base_addr += section->_raw_size; + section->contents = ((unsigned char *) + bfd_malloc (section->_raw_size)); if (section->contents == NULL) - { - bfd_set_error (bfd_error_no_memory); - return -1; - } - memset (section->contents, 0, section->_raw_size); + return -1; + memset (section->contents, 0, (size_t) section->_raw_size); + section->_cooked_size = section->_raw_size; #if EVAX_DEBUG evax_debug(3, "egsd psc %d (%s, flags %04x=%s) ", section->index, name, old_flags, flag2str(gpsflagdesc, old_flags)); @@ -319,11 +320,12 @@ } else /* symbol reference */ { -#if EVAX_DEBUG - evax_debug(3, "egsd sym ref #%d (%s, %04x=%s)\n", abfd->symcount, evax_rec+9, old_flags, flag2str(gsyflagdesc, old_flags)); -#endif symbol->name = _bfd_evax_save_counted_string ((char *)evax_rec+8); +#if EVAX_DEBUG + evax_debug(3, "egsd sym ref #%d (%s, %04x=%s)\n", abfd->symcount, + symbol->name, old_flags, flag2str(gsyflagdesc, old_flags)); +#endif symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME); } @@ -463,6 +465,10 @@ sname = EVAX_READONLY_NAME; else if ((*sname == 'l') && (strcmp (sname, "literal") == 0)) sname = EVAX_LITERAL_NAME; + else if ((*sname == 'c') && (strcmp (sname, "comm") == 0)) + sname = EVAX_COMMON_NAME; + else if ((*sname == 'l') && (strcmp (sname, "lcomm") == 0)) + sname = EVAX_LOCAL_NAME; } _bfd_evax_output_begin (abfd, EGSD_S_C_PSC, -1); @@ -497,6 +503,14 @@ } old_flags = symbol->flags; + if ((*(symbol->section->name+1) == 'c') + && (strcmp (symbol->section->name+1, "comm") == 0) + && (strcmp (symbol->name, ".comm") != 0)) + old_flags |= BSF_GLOBAL; + + if (old_flags & BSF_FILE) + continue; + if (((old_flags & BSF_GLOBAL) == 0) /* not xdef */ && (!bfd_is_und_section (symbol->section))) /* and not xref */ continue; /* dont output */ @@ -552,24 +566,7 @@ _bfd_evax_output_long (abfd, symbol->section->index);/* L_PSINDX, FIXME */ } } - if (strlen ((char *)symbol->name) > 198) - { - (*_bfd_error_handler) ("Name '%s' too long\n", symbol->name); - abort (); - } - nptr = (char *)symbol->name; - uptr = uname; - while (*nptr) - { - if (islower (*nptr)) - *uptr = toupper (*nptr); - else - *uptr = *nptr; - uptr++; - nptr++; - } - *uptr = 0; - _bfd_evax_output_counted (abfd, uname); + _bfd_evax_output_counted (abfd, _bfd_evax_length_hash_symbol (abfd, symbol->name)); _bfd_evax_output_flush (abfd); diff -urN binutils-2.7/bfd/evax-emh.c binutils-2.8/bfd/evax-emh.c --- binutils-2.7/bfd/evax-emh.c Thu Jul 4 12:18:56 1996 +++ binutils-2.8/bfd/evax-emh.c Wed Apr 30 12:56:07 1997 @@ -1,11 +1,11 @@ -/* evax-emh.c -- BFD back-end for ALPHA EVAX (openVMS/AXP) files. - Copyright 1996 Free Software Foundation, Inc. +/* evax-emh.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files. + Copyright 1996, 1997 Free Software Foundation, Inc. EMH record handling functions and EEOM record handling functions - Written by Klaus Kämpf (kkaempf@progis.de) + Written by Klaus K"ampf (kkaempf@progis.de) of proGIS Softwareentwicklung, Aachen, Germany This program is free software; you can redistribute it and/or modify @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include +#include #include "bfd.h" #include "sysdep.h" @@ -124,27 +125,50 @@ } -#if 0 +/*-----------------------------------------------------------------------------*/ +/* Output routines. */ -/* register a file name */ -int -_bfd_evax_register_filename (abfd, name) - bfd *abfd; - char *name; +/* Manufacure a VMS like time on a unix based system. + stolen from obj-vms.c */ + +static unsigned char * +get_vms_time_string () { - if (PRIV(filename) != NULL) - { + static unsigned char tbuf[18]; +#ifndef VMS +#include +#include + + char *pnt; + time_t timeb; + time (&timeb); + pnt = ctime (&timeb); + pnt[3] = 0; + pnt[7] = 0; + pnt[10] = 0; + pnt[16] = 0; + pnt[24] = 0; + sprintf (tbuf, "%2s-%3s-%s %s", pnt + 8, pnt + 4, pnt + 20, pnt + 11); +#else +#include + struct + { + int Size; + unsigned char *Ptr; + } Descriptor; + Descriptor.Size = 17; + Descriptor.Ptr = tbuf; + sys$asctim (0, &Descriptor, 0, 0); +#endif /* not VMS */ + #if EVAX_DEBUG - evax_debug(3, "Second filename %s, first was %s\n", name, PRIV(filename)); + evax_debug (6, "vmstimestring:'%s'\n", tbuf); #endif - return -1; - } - PRIV(filename) = strdup (name); - return 0; + + return tbuf; } -#endif /* 0 */ /* write object header for bfd abfd */ @@ -152,7 +176,11 @@ _bfd_evax_write_emh (abfd) bfd *abfd; { - char *name; + asymbol *symbol; + int symnum; + int had_case = 0; + int had_file = 0; + #if EVAX_DEBUG evax_debug (2, "evax_write_emh(%p)\n", abfd); @@ -167,16 +195,52 @@ _bfd_evax_output_long (abfd, 0); _bfd_evax_output_long (abfd, 0); _bfd_evax_output_long (abfd, MAX_OUTREC_SIZE); - if (bfd_get_filename (abfd) != NULL) + + if (bfd_get_filename (abfd) != 0) { - name = strdup (bfd_get_filename (abfd)); - _bfd_evax_output_counted (abfd, _bfd_evax_basename (name)); + /* strip path and suffix information */ + + char *fname, *fout, *fptr; + + fname = strdup (bfd_get_filename (abfd)); + if (fname == 0) + { + bfd_set_error (bfd_error_no_memory); + return -1; + } + fout = strrchr (fname, ']'); + if (fout == 0) + fout = strchr (fname, ':'); + if (fout != 0) + fout++; + else + fout = fname; + + /* strip .obj suffix */ + + fptr = strrchr (fname, '.'); + if ((fptr != 0) + && (strcasecmp (fptr, ".OBJ") == 0)) + *fptr = 0; + + fptr = fout; + while (*fptr != 0) + { + if (islower (*fptr)) + *fptr = toupper (*fptr); + fptr++; + if ((*fptr == ';') + || ((fptr - fout) > 31)) + *fptr = 0; + } + _bfd_evax_output_counted (abfd, fout); + free (fname); } else _bfd_evax_output_counted (abfd, "NONAME"); + _bfd_evax_output_counted (abfd, BFD_VERSION); - _bfd_evax_output_dump (abfd, (unsigned char *)_bfd_get_vms_time_string (), - 17); + _bfd_evax_output_dump (abfd, get_vms_time_string (), 17); _bfd_evax_output_fill (abfd, 0, 17); _bfd_evax_output_flush (abfd); @@ -189,10 +253,36 @@ /* SRC */ _bfd_evax_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_SRC); - if (PRIV(filename) != 0) - _bfd_evax_output_dump (abfd, (unsigned char *)PRIV(filename), strlen (PRIV(filename))); - else - _bfd_evax_output_dump (abfd, (unsigned char *)"noname", 6); + + for (symnum = 0; symnum < abfd->symcount; symnum++) + { + symbol = abfd->outsymbols[symnum]; + + if (symbol->flags & BSF_FILE) + { + char *s; + + if (strncmp ((char *)symbol->name, "name[6] - '0'; + PRIV(flag_show_after_trunc) = symbol->name[7] - '0'; + + if (had_file) + break; + had_case = 1; + continue; + } + + _bfd_evax_output_dump (abfd, (char *)symbol->name, strlen (symbol->name)); + if (had_case) + break; + had_file = 1; + } + } + + if (symnum == abfd->symcount) + _bfd_evax_output_dump (abfd, "noname", 6); + _bfd_evax_output_flush (abfd); /* TTL */ diff -urN binutils-2.7/bfd/evax-etir.c binutils-2.8/bfd/evax-etir.c --- binutils-2.7/bfd/evax-etir.c Thu Jul 4 12:19:00 1996 +++ binutils-2.8/bfd/evax-etir.c Wed Apr 30 12:56:07 1997 @@ -1,11 +1,11 @@ -/* evax-etir.c -- BFD back-end for ALPHA EVAX (openVMS/AXP) files. - Copyright 1996 Free Software Foundation, Inc. +/* evax-etir.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files. + Copyright 1996, 1997 Free Software Foundation, Inc. ETIR record handling functions go and read the openVMS linker manual (esp. appendix B) if you don't know what's going on here :-) - Written by Klaus Kämpf (kkaempf@progis.de) + Written by Klaus K"ampf (kkaempf@progis.de) of proGIS Softwareentwicklung, Aachen, Germany This program is free software; you can redistribute it and/or modify @@ -875,7 +875,7 @@ arg: */ case ETIR_S_C_STC_NBH_PS: - (*_bfd_error_handler) ("ETIR_S_C_STC_xx: (%d) not supported", cmd); +/* FIXME (*_bfd_error_handler) ("ETIR_S_C_STC_xx: (%d) not supported", cmd); */ break; default: @@ -1121,8 +1121,6 @@ asection *section; evax_section *sptr; int nextoffset; - char uname[200]; - char *nptr, *uptr; #if EVAX_DEBUG evax_debug (2, "evax_write_etir(%p)\n", abfd); @@ -1247,19 +1245,8 @@ _bfd_evax_output_begin (abfd, ETIR_S_C_STO_GBL_LW, -1); - uptr = uname; - nptr = (char *)sym->name; - while (*nptr) - { - if (islower (*nptr)) - *uptr = toupper (*nptr); - else - *uptr = *nptr; - nptr++; - uptr++; - } - *uptr = 0; - _bfd_evax_output_counted (abfd, uname); + _bfd_evax_output_counted (abfd, + _bfd_evax_length_hash_symbol (abfd, sym->name)); _bfd_evax_output_flush (abfd); } else if (bfd_is_abs_section (sym->section)) @@ -1324,19 +1311,8 @@ _bfd_evax_output_begin (abfd, ETIR_S_C_STO_GBL, -1); - uptr = uname; - nptr = (char *)sym->name; - while (*nptr) - { - if (islower (*nptr)) - *uptr = toupper (*nptr); - else - *uptr = *nptr; - nptr++; - uptr++; - } - *uptr = 0; - _bfd_evax_output_counted (abfd, uname); + _bfd_evax_output_counted (abfd, + _bfd_evax_length_hash_symbol (abfd, sym->name)); _bfd_evax_output_flush (abfd); } else if (bfd_is_abs_section (sym->section)) @@ -1397,42 +1373,12 @@ evax_output_begin(abfd, ETIR_S_C_STO_HINT_GBL, -1); evax_output_long(abfd, (unsigned long)(sec->index)); evax_output_quad(abfd, (uquad)addr); - uptr = uname; - nptr = (char *)(*(*rptr)->sym_ptr_ptr)->name; - while (*nptr) - { - if (islower (*nptr)) - *uptr = toupper (*nptr); - else - *uptr = *nptr; - nptr++; - uptr++; - } - *uptr = 0; - evax_output_counted(abfd, uname); + evax_output_counted(abfd, _bfd_evax_length_hash_symbol (abfd, sym->name)); evax_output_flush(abfd); #endif } break; -#if 0 - case ALPHA_R_BRADDR: - break; - case ALPHA_R_SREL16: - break; - case ALPHA_R_SREL32: - break; - case ALPHA_R_SREL64: - break; - case ALPHA_R_OP_PUSH: - break; - case ALPHA_R_OP_STORE: - break; - case ALPHA_R_OP_PSUB: - break; - case ALPHA_R_OP_PRSHIFT: - break; -#endif case ALPHA_R_LINKAGE: { if (_bfd_evax_output_check (abfd, 64) < 0) @@ -1447,20 +1393,29 @@ _bfd_evax_output_long (abfd, (unsigned long)PRIV(evax_linkage_index)); PRIV(evax_linkage_index) += 2; - uptr = uname; - nptr = (char *)(*(*rptr)->sym_ptr_ptr)->name; - while (*nptr) + _bfd_evax_output_counted (abfd, + _bfd_evax_length_hash_symbol (abfd, sym->name)); + _bfd_evax_output_byte (abfd, 0); + _bfd_evax_output_flush (abfd); + } + break; + + case ALPHA_R_CODEADDR: + { + if (_bfd_evax_output_check (abfd, + strlen((char *)sym->name)) + < 0) { - if (islower (*nptr)) - *uptr = toupper (*nptr); - else - *uptr = *nptr; - nptr++; - uptr++; + end_etir_record (abfd); + start_etir_record (abfd, + section->index, + vaddr, false); } - *uptr = 0; - _bfd_evax_output_counted (abfd, uname); - _bfd_evax_output_byte (abfd, 0); + _bfd_evax_output_begin (abfd, + ETIR_S_C_STO_CA, + -1); + _bfd_evax_output_counted (abfd, + _bfd_evax_length_hash_symbol (abfd, sym->name)); _bfd_evax_output_flush (abfd); } break; diff -urN binutils-2.7/bfd/evax-misc.c binutils-2.8/bfd/evax-misc.c --- binutils-2.7/bfd/evax-misc.c Thu Jul 4 12:19:02 1996 +++ binutils-2.8/bfd/evax-misc.c Wed Apr 30 12:56:07 1997 @@ -1,6 +1,7 @@ -/* evax-misc.c -- Miscellaneous functions for ALPHA EVAX (openVMS/AXP) files. - Copyright 1996 Free Software Foundation, Inc. - Written by Klaus Kämpf (kkaempf@progis.de) +/* evax-misc.c -- Miscellaneous functions for ALPHA EVAX (openVMS/Alpha) files. + Copyright 1996, 1997 Free Software Foundation, Inc. + + Written by Klaus K"ampf (kkaempf@progis.de) of proGIS Softwareentwicklung, Aachen, Germany This program is free software; you can redistribute it and/or modify @@ -558,23 +559,20 @@ { evax_section *sptr, *newptr; - newptr = (evax_section *) bfd_zalloc (abfd, sizeof (evax_section)); - if (newptr == (evax_section *)NULL) - { - bfd_set_error (bfd_error_no_memory); - return NULL; - } sptr = PRIV(evax_section_table)[section->index]; - if (sptr == NULL) - { - PRIV(evax_section_table)[section->index] = (evax_section *)newptr; - } - else - { - while (sptr->next != NULL) - sptr = sptr->next; - sptr->next = newptr; - } + if (sptr != NULL) + return sptr; + + newptr = (evax_section *) bfd_malloc (sizeof (evax_section)); + if (newptr == (evax_section *) NULL) + return NULL; + newptr->contents = (unsigned char *) bfd_alloc (abfd, (int)section->_raw_size); + if (newptr->contents == (unsigned char *)NULL) + return NULL; + newptr->offset = 0; + newptr->size = section->_raw_size; + newptr->next = 0; + PRIV(evax_section_table)[section->index] = newptr; return newptr; } @@ -602,20 +600,7 @@ sptr = add_new_contents (abfd, section); if (sptr == NULL) return false; - sptr->contents = (unsigned char *) bfd_alloc (abfd, (int)count); - if (sptr->contents == (unsigned char *)NULL) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - memcpy (sptr->contents, data, (int)count); - sptr->offset = (bfd_vma)offset; - sptr->size = count; - -#if EVAX_DEBUG - evax_debug (6, "_bfd_save_evax_section sptr = %08lx\n", sptr); - _bfd_hexdump (6, data, count, (int)offset); -#endif + memcpy (sptr->contents + offset, data, (size_t) count); return true; } @@ -968,98 +953,82 @@ return; } -/*-----------------------------------------------------------------------------*/ +/* this hash routine borrowed from GNU-EMACS, and strengthened slightly ERY*/ + +static int +hash_string (ptr) + const char *ptr; +{ + register const unsigned char *p = (unsigned char *) ptr; + register const unsigned char *end = p + strlen (ptr); + register unsigned char c; + register int hash = 0; -/* Return basename (stripped of directory information) of filename */ + while (p != end) + { + c = *p++; + hash = ((hash << 3) + (hash << 15) + (hash >> 28) + c); + } + return hash; +} + +/* Generate a length-hashed VMS symbol name (limited to 64 chars). */ char * -_bfd_evax_basename (name) - char *name; +_bfd_evax_length_hash_symbol (abfd, in) + bfd *abfd; + const char *in; { - char *ptr; + long int init; + long int result; + int in_len; + char *pnt = 0; + char *new_name; + const char *old_name; + int i; + static char outbuf[65]; + char *out = outbuf; #if EVAX_DEBUG - evax_debug (6, "_bfd_evax_basename %s -> ", name); + evax_debug(4, "_bfd_evax_length_hash_symbol \"%s\"\n", in); #endif -#ifndef VMS - /* assume unix host */ - ptr = strrchr (name, '.'); - if (ptr) - *ptr = 0; - ptr = strrchr (name, '/'); - if (ptr) - *ptr++ = 0; - else - ptr = name; -#else - /* assume vms host */ - ptr = strrchr (name, '.'); - if (ptr) - { - *ptr = 0; - ptr = name; - } - else - { - ptr = strrchr (name, ']'); - if (ptr) - *ptr++ = 0; - else - { - ptr = strrchr (name, ':'); - if (ptr) - *ptr++ = 0; - else - ptr = name; - } - } -#endif + new_name = out; /* save this for later. */ -#if EVAX_DEBUG - evax_debug (6, "%s\n", ptr); -#endif + /* We may need to truncate the symbol, save the hash for later. */ - return ptr; -} + in_len = strlen (in); + result = (in_len > 64) ? hash_string (in) : 0; -/* Manufacure a VMS like time on a unix based system. - stolen from obj-vms.c */ + old_name = in; -char * -_bfd_get_vms_time_string () -{ - static char tbuf[18]; -#ifndef VMS -#include -#include + /* Do the length checking. */ + + if (in_len <= 64) + i = in_len; + else + i = 55; - char *pnt; - time_t timeb; - time (&timeb); - pnt = ctime (&timeb); - pnt[3] = 0; - pnt[7] = 0; - pnt[10] = 0; - pnt[16] = 0; - pnt[24] = 0; - sprintf (tbuf, "%2s-%3s-%s %s", pnt + 8, pnt + 4, pnt + 20, pnt + 11); -#else -#include - struct - { - int Size; - char *Ptr; - } Descriptor; - Descriptor.Size = 17; - Descriptor.Ptr = tbuf; - sys$asctim (0, &Descriptor, 0, 0); -#endif /* not VMS */ + strncpy (out, in, i); + in += i; + out += i; + + if ((in_len > 64) + && PRIV(flag_hash_long_names)) + sprintf (out, "_%08x", result); + else + *out = 0; #if EVAX_DEBUG - evax_debug (6, "vmstimestring:'%s'\n", tbuf); + evax_debug(4, "--> [%d]\"%s\"\n", strlen (outbuf), outbuf); #endif - return tbuf; + if (in_len > 64 + && PRIV(flag_hash_long_names) + && PRIV(flag_show_after_trunc)) + printf ("Symbol %s replaced by %s\n", old_name, new_name); + + return outbuf; } + diff -urN binutils-2.7/bfd/evax.h binutils-2.8/bfd/evax.h --- binutils-2.7/bfd/evax.h Thu Jul 4 12:19:02 1996 +++ binutils-2.8/bfd/evax.h Wed Apr 30 12:56:08 1997 @@ -1,6 +1,7 @@ -/* evax.h -- Header file for ALPHA EVAX (openVMS/AXP) support. - Copyright 1996 Free Software Foundation, Inc. - Written by Klaus Kämpf (kkaempf@progis.de) +/* evax.h -- Header file for ALPHA EVAX (openVMS/Alpha) support. + Copyright 1996, 1997 Free Software Foundation, Inc. + + Written by Klaus K"ampf (kkaempf@progis.de) of proGIS Softwareentwicklung, Aachen, Germany This file is part of BFD, the Binary File Descriptor library. @@ -178,9 +179,8 @@ #define ALPHA_R_OP_PSUB 9 #define ALPHA_R_OP_PRSHIFT 10 #define ALPHA_R_LINKAGE 11 -#define ALPHA_R_SWREL32 12 -#define ALPHA_R_SWREL64 13 -#define ALPHA_R_REFLONG 14 +#define ALPHA_R_REFLONG 12 +#define ALPHA_R_CODEADDR 13 /* Object language definitions. */ @@ -281,7 +281,6 @@ #define EVAX_SECTION_COUNT 32 struct evax_private_data_struct { - char *filename; /* Filename of object file */ boolean fixup_done; /* Flag to indicate if all section pointers and PRIV(sections) are set up correctly */ @@ -305,7 +304,6 @@ int stackptr; evax_section *evax_section_table[EVAX_SECTION_COUNT]; - evax_reloc *evax_reloc_table[EVAX_SECTION_COUNT]; struct bfd_hash_table *evax_symbol_table; struct symbol_cache_entry **symcache; @@ -331,6 +329,9 @@ int evax_linkage_index; + /* see tc-alpha.c of gas for a description. */ + int flag_hash_long_names; /* -+, hash instead of truncate */ + int flag_show_after_trunc; /* -H, show hashing/truncation */ }; #define PRIV(name) ((struct evax_private_data_struct *)abfd->tdata.any)->name @@ -376,7 +377,6 @@ extern void _bfd_evax_output_dump PARAMS ((bfd *abfd, unsigned char *data, int length)); extern void _bfd_evax_output_fill PARAMS ((bfd *abfd, int value, int length)); -extern char *_bfd_get_vms_time_string PARAMS ((void)); -extern char *_bfd_evax_basename PARAMS ((char *name)); +extern char *_bfd_evax_length_hash_symbol PARAMS ((bfd *abfd, const char *in)); #endif /* EVAX_H */ diff -urN binutils-2.7/bfd/filemode.c binutils-2.8/bfd/filemode.c --- binutils-2.7/bfd/filemode.c Thu Jul 4 12:19:03 1996 +++ binutils-2.8/bfd/filemode.c Wed Apr 30 12:56:08 1997 @@ -15,6 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "sysdep.h" #include #include diff -urN binutils-2.7/bfd/freebsd.h binutils-2.8/bfd/freebsd.h --- binutils-2.7/bfd/freebsd.h Thu Jul 4 12:19:03 1996 +++ binutils-2.8/bfd/freebsd.h Wed Apr 30 12:56:08 1997 @@ -25,11 +25,11 @@ #define TEXT_START_ADDR 0 #define N_GETMAGIC_NET(exec) \ - (ntohl ((exec).a_info) & 0xffff) + ((exec).a_info & 0xffff) #define N_GETMID_NET(exec) \ - ((ntohl ((exec).a_info) >> 16) & 0x3ff) + (((exec).a_info >> 16) & 0x3ff) #define N_GETFLAG_NET(ex) \ - ((ntohl ((exec).a_info) >> 26) & 0x3f) + (((exec).a_info >> 26) & 0x3f) #define N_MACHTYPE(exec) \ ((enum machine_type) \ @@ -55,8 +55,9 @@ #include "libbfd.h" #include "libaout.h" -/* On FreeBSD, the magic number is always in correct endian format */ -#define NO_SWAP_MAGIC +/* On FreeBSD, the magic number is always in ntohl's "network" (big-endian) + format. I think. */ +#define SWAP_MAGIC(ext) bfd_getb32 (ext) #define MY_write_object_contents MY(write_object_contents) diff -urN binutils-2.7/bfd/hash.c binutils-2.8/bfd/hash.c --- binutils-2.7/bfd/hash.c Thu Jul 4 12:19:04 1996 +++ binutils-2.8/bfd/hash.c Wed Apr 30 12:56:09 1997 @@ -1,5 +1,5 @@ /* hash.c -- hash table routines for BFD - Copyright (C) 1993, 94 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 1997 Free Software Foundation, Inc. Written by Steve Chamberlain This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,7 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "obstack.h" +#include "objalloc.h" /* SECTION @@ -77,9 +77,9 @@ different value for this argument. @findex bfd_hash_allocate - <> will create an obstack which will be + <> will create an objalloc which will be used to allocate new entries. You may allocate memory on this - obstack using <>. + objalloc using <>. @findex bfd_hash_table_free Use <> to free up all the memory that has @@ -111,7 +111,7 @@ If the @var{create} argument is <>, and a new entry is created, the @var{copy} argument is used to decide whether to - copy the string onto the hash table obstack or not. If + copy the string onto the hash table objalloc or not. If @var{copy} is passed as <>, you must be careful not to deallocate or modify the string as long as the hash table exists. @@ -293,10 +293,6 @@ <> in aoutx.h. */ -/* Obstack allocation and deallocation routines. */ -#define obstack_chunk_alloc malloc -#define obstack_chunk_free free - /* The default number of entries to use when creating a hash table. */ #define DEFAULT_SIZE (4051) @@ -313,14 +309,16 @@ unsigned int alloc; alloc = size * sizeof (struct bfd_hash_entry *); - if (!obstack_begin (&table->memory, alloc)) + + table->memory = (PTR) objalloc_create (); + if (table->memory == NULL) { bfd_set_error (bfd_error_no_memory); return false; } table->table = ((struct bfd_hash_entry **) - obstack_alloc (&table->memory, alloc)); - if (!table->table) + objalloc_alloc ((struct objalloc *) table->memory, alloc)); + if (table->table == NULL) { bfd_set_error (bfd_error_no_memory); return false; @@ -349,7 +347,8 @@ bfd_hash_table_free (table) struct bfd_hash_table *table; { - obstack_free (&table->memory, (PTR) NULL); + objalloc_free ((struct objalloc *) table->memory); + table->memory = NULL; } /* Look up a string in a hash table. */ @@ -400,7 +399,8 @@ { char *new; - new = (char *) obstack_alloc (&table->memory, len + 1); + new = (char *) objalloc_alloc ((struct objalloc *) table->memory, + len + 1); if (!new) { bfd_set_error (bfd_error_no_memory); @@ -467,7 +467,7 @@ { PTR ret; - ret = obstack_alloc (&table->memory, size); + ret = objalloc_alloc ((struct objalloc *) table->memory, size); if (ret == NULL && size != 0) bfd_set_error (bfd_error_no_memory); return ret; diff -urN binutils-2.7/bfd/hosts/alphavms.h binutils-2.8/bfd/hosts/alphavms.h --- binutils-2.7/bfd/hosts/alphavms.h Thu Jul 4 12:20:18 1996 +++ binutils-2.8/bfd/hosts/alphavms.h Wed Apr 30 12:56:31 1997 @@ -62,4 +62,8 @@ #define NO_FCNTL 1 +#ifndef O_ACCMODE +#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) +#endif + extern int getpagesize PARAMS ((void)); diff -urN binutils-2.7/bfd/hosts/i386bsd.h binutils-2.8/bfd/hosts/i386bsd.h --- binutils-2.7/bfd/hosts/i386bsd.h Thu Jul 4 12:20:19 1996 +++ binutils-2.8/bfd/hosts/i386bsd.h Wed Apr 30 12:56:32 1997 @@ -3,6 +3,13 @@ #include #include +/* Recent versions of FreeBSD don't define NBPG. */ +#ifndef NBPG +#ifdef PAGE_SIZE +#define NBPG PAGE_SIZE +#endif +#endif + #define HOST_PAGE_SIZE NBPG #define HOST_MACHINE_ARCH bfd_arch_i386 #define HOST_TEXT_START_ADDR USRTEXT diff -urN binutils-2.7/bfd/hp300hpux.c binutils-2.8/bfd/hp300hpux.c --- binutils-2.7/bfd/hp300hpux.c Thu Jul 4 12:19:09 1996 +++ binutils-2.8/bfd/hp300hpux.c Wed Apr 30 12:56:10 1997 @@ -396,7 +396,12 @@ default: abort (); case N_UNDF | N_EXT: - new_type = N_WEAKU; + /* If the value is nonzero, then just treat this as a + common symbol. I don't know if this is correct in + all cases, but it is more correct than treating it as + a weak undefined symbol. */ + if (cache_ptr->symbol.value == 0) + new_type = N_WEAKU; break; case N_ABS | N_EXT: new_type = N_WEAKA; diff -urN binutils-2.7/bfd/hppabsd-core.c binutils-2.8/bfd/hppabsd-core.c --- binutils-2.7/bfd/hppabsd-core.c Thu Jul 4 12:19:10 1996 +++ binutils-2.8/bfd/hppabsd-core.c Wed Apr 30 12:56:10 1997 @@ -1,5 +1,5 @@ /* BFD back-end for HPPA BSD core files. - Copyright 1993, 1994 Free Software Foundation, Inc. + Copyright 1993, 94, 95, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -235,7 +235,8 @@ #define hppabsd_core_get_symtab _bfd_nosymbols_get_symtab #define hppabsd_core_print_symbol _bfd_nosymbols_print_symbol #define hppabsd_core_get_symbol_info _bfd_nosymbols_get_symbol_info -#define hppabsd_core_bfd_is_local_label _bfd_nosymbols_bfd_is_local_label +#define hppabsd_core_bfd_is_local_label_name \ + _bfd_nosymbols_bfd_is_local_label_name #define hppabsd_core_get_lineno _bfd_nosymbols_get_lineno #define hppabsd_core_find_nearest_line _bfd_nosymbols_find_nearest_line #define hppabsd_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff -urN binutils-2.7/bfd/hpux-core.c binutils-2.8/bfd/hpux-core.c --- binutils-2.7/bfd/hpux-core.c Thu Jul 4 12:19:10 1996 +++ binutils-2.8/bfd/hpux-core.c Wed Apr 30 12:56:10 1997 @@ -1,5 +1,5 @@ /* BFD back-end for HP/UX core files. - Copyright 1993, 1994 Free Software Foundation, Inc. + Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Stu Grossman, Cygnus Support. Converted to back-end form by Ian Lance Taylor, Cygnus SUpport @@ -67,6 +67,8 @@ #define core_signal(bfd) (core_hdr(bfd)->sig) #define core_command(bfd) (core_hdr(bfd)->cmd) +static void swap_abort PARAMS ((void)); + static asection * make_bfd_asection (abfd, name, flags, _raw_size, vma, alignment_power) bfd *abfd; @@ -203,7 +205,8 @@ #define hpux_core_get_symtab _bfd_nosymbols_get_symtab #define hpux_core_print_symbol _bfd_nosymbols_print_symbol #define hpux_core_get_symbol_info _bfd_nosymbols_get_symbol_info -#define hpux_core_bfd_is_local_label _bfd_nosymbols_bfd_is_local_label +#define hpux_core_bfd_is_local_label_name \ + _bfd_nosymbols_bfd_is_local_label_name #define hpux_core_get_lineno _bfd_nosymbols_get_lineno #define hpux_core_find_nearest_line _bfd_nosymbols_find_nearest_line #define hpux_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol @@ -211,7 +214,7 @@ #define hpux_core_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol /* If somebody calls any byte-swapping routines, shoot them. */ -void +static void swap_abort() { abort(); /* This way doesn't require any declaration for ANSI to fuck up */ diff -urN binutils-2.7/bfd/i386aout.c binutils-2.8/bfd/i386aout.c --- binutils-2.7/bfd/i386aout.c Thu Jul 4 12:19:10 1996 +++ binutils-2.8/bfd/i386aout.c Wed Apr 30 12:56:10 1997 @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries. - Copyright 1990, 91, 92, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -75,6 +75,7 @@ static CONST struct aout_backend_data MY(backend_data) = { 0, /* zmagic contiguous */ 1, /* text incl header */ + 0, /* entry is text address */ 0, /* exec_hdr_flags */ 0, /* text vma? */ MY(set_sizes), diff -urN binutils-2.7/bfd/i386linux.c binutils-2.8/bfd/i386linux.c --- binutils-2.7/bfd/i386linux.c Thu Jul 4 12:19:12 1996 +++ binutils-2.8/bfd/i386linux.c Wed Apr 30 12:56:11 1997 @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored i386 a.out binaries. - Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -24,6 +24,8 @@ #define N_SHARED_LIB(x) 0 #define BYTES_IN_WORD 4 +#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN) + #include "bfd.h" #include "sysdep.h" #include "libbfd.h" @@ -44,6 +46,9 @@ static void MY_final_link_callback PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); +static boolean i386linux_bfd_final_link + PARAMS ((bfd *, struct bfd_link_info *)); +static boolean i386linux_write_object_contents PARAMS ((bfd *)); static boolean i386linux_bfd_final_link (abfd, info) diff -urN binutils-2.7/bfd/i386mach3.c binutils-2.8/bfd/i386mach3.c --- binutils-2.7/bfd/i386mach3.c Thu Jul 4 12:19:12 1996 +++ binutils-2.8/bfd/i386mach3.c Wed Apr 30 12:56:11 1997 @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries. - Copyright (C) 1990, 1991 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 93, 94, 95, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -50,6 +50,7 @@ static CONST struct aout_backend_data MY(backend_data) = { 0, /* zmagic contiguous */ 1, /* text incl header */ + 0, /* entry is text address */ 0, /* exec_hdr_flags */ 0, /* text vma? */ MY(set_sizes), diff -urN binutils-2.7/bfd/i386msdos.c binutils-2.8/bfd/i386msdos.c --- binutils-2.7/bfd/i386msdos.c Thu Jul 4 12:19:13 1996 +++ binutils-2.8/bfd/i386msdos.c Wed Apr 30 12:56:11 1997 @@ -1,5 +1,5 @@ /* BFD back-end for MS-DOS executables. - Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Bryan Ford of the University of Utah. Contributed by the Center for Software Science at the @@ -180,7 +180,7 @@ #define msdos_get_symbol_info _bfd_nosymbols_get_symbol_info #define msdos_find_nearest_line _bfd_nosymbols_find_nearest_line #define msdos_get_lineno _bfd_nosymbols_get_lineno -#define msdos_bfd_is_local_label _bfd_nosymbols_bfd_is_local_label +#define msdos_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name #define msdos_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define msdos_read_minisymbols _bfd_nosymbols_read_minisymbols #define msdos_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol diff -urN binutils-2.7/bfd/ieee.c binutils-2.8/bfd/ieee.c --- binutils-2.7/bfd/ieee.c Thu Jul 4 12:19:15 1996 +++ binutils-2.8/bfd/ieee.c Wed Apr 30 12:56:12 1997 @@ -1,5 +1,7 @@ /* BFD back-end for ieee-695 objects. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. + Written by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -1001,6 +1003,29 @@ ieee_data_type *ieee; unsigned int index; { + if (index >= ieee->section_table_size) + { + unsigned int c, i; + asection **n; + + c = ieee->section_table_size; + if (c == 0) + c = 20; + while (c <= index) + c *= 2; + + n = ((asection **) + bfd_realloc (ieee->section_table, c * sizeof (asection *))); + if (n == NULL) + return NULL; + + for (i = ieee->section_table_size; i < c; i++) + n[i] = NULL; + + ieee->section_table = n; + ieee->section_table_size = c; + } + if (ieee->section_table[index] == (asection *) NULL) { char *tmp = bfd_alloc (abfd, 11); @@ -1040,8 +1065,6 @@ unsigned int section_index; next_byte (&(ieee->h)); section_index = must_parse_int (&(ieee->h)); - /* Fixme to be nice about a silly number of sections */ - BFD_ASSERT (section_index < NSECTIONS); section = get_section_entry (abfd, ieee, section_index); @@ -1218,15 +1241,18 @@ bfd *abfd; { char *library; - boolean loop; unsigned int i; unsigned char buffer[512]; file_ptr buffer_offset = 0; ieee_ar_data_type *save = abfd->tdata.ieee_ar_data; ieee_ar_data_type *ieee; - abfd->tdata.ieee_ar_data = (ieee_ar_data_type *) bfd_alloc (abfd, sizeof (ieee_ar_data_type)); + unsigned int alc_elts; + ieee_ar_obstack_type *elts = NULL; + + abfd->tdata.ieee_ar_data = + (ieee_ar_data_type *) bfd_alloc (abfd, sizeof (ieee_ar_data_type)); if (!abfd->tdata.ieee_ar_data) - return NULL; + goto error_return; ieee = IEEE_AR_DATA (abfd); /* FIXME: Check return value. I'm not sure whether it needs to read @@ -1241,7 +1267,7 @@ if (this_byte (&(ieee->h)) != Module_Beginning) { abfd->tdata.ieee_ar_data = save; - return (const bfd_target *) NULL; + goto error_return; } next_byte (&(ieee->h)); @@ -1250,7 +1276,7 @@ { bfd_release (abfd, ieee); abfd->tdata.ieee_ar_data = save; - return (const bfd_target *) NULL; + goto error_return; } /* Throw away the filename */ read_id (&(ieee->h)); @@ -1262,43 +1288,65 @@ must_parse_int (&(ieee->h)); /* And the two dummy numbers */ must_parse_int (&(ieee->h)); - loop = true; + alc_elts = 10; + elts = (ieee_ar_obstack_type *) bfd_malloc (alc_elts * sizeof *elts); + if (elts == NULL) + goto error_return; + /* Read the index of the BB table */ - while (loop) + while (1) { - ieee_ar_obstack_type t; - int rec = read_2bytes (&(ieee->h)); - if (rec == (int) ieee_assign_value_to_variable_enum) - { - must_parse_int (&(ieee->h)); - t.file_offset = must_parse_int (&(ieee->h)); - t.abfd = (bfd *) NULL; - ieee->element_count++; - - bfd_alloc_grow (abfd, (PTR) &t, sizeof t); - - /* Make sure that we don't go over the end of the buffer */ - - if ((size_t) ieee_pos (abfd) > sizeof (buffer) / 2) - { - /* Past half way, reseek and reprime */ - buffer_offset += ieee_pos (abfd); - if (bfd_seek (abfd, buffer_offset, SEEK_SET) != 0) - return NULL; - /* FIXME: Check return value. I'm not sure whether it - needs to read the entire buffer or not. */ - bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd); - ieee->h.first_byte = buffer; - ieee->h.input_p = buffer; - } + int rec; + ieee_ar_obstack_type *t; + + rec = read_2bytes (&(ieee->h)); + if (rec != (int) ieee_assign_value_to_variable_enum) + break; + + if (ieee->element_count >= alc_elts) + { + ieee_ar_obstack_type *n; + + alc_elts *= 2; + n = ((ieee_ar_obstack_type *) + bfd_realloc (elts, alc_elts * sizeof *elts)); + if (n == NULL) + goto error_return; + elts = n; + } + + t = &elts[ieee->element_count]; + ieee->element_count++; + + must_parse_int (&(ieee->h)); + t->file_offset = must_parse_int (&(ieee->h)); + t->abfd = (bfd *) NULL; + + /* Make sure that we don't go over the end of the buffer */ + + if ((size_t) ieee_pos (abfd) > sizeof (buffer) / 2) + { + /* Past half way, reseek and reprime */ + buffer_offset += ieee_pos (abfd); + if (bfd_seek (abfd, buffer_offset, SEEK_SET) != 0) + goto error_return; + /* FIXME: Check return value. I'm not sure whether it needs + to read the entire buffer or not. */ + bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd); + ieee->h.first_byte = buffer; + ieee->h.input_p = buffer; } - else - loop = false; } - ieee->elements = (ieee_ar_obstack_type *) bfd_alloc_finish (abfd); - if (!ieee->elements) - return (const bfd_target *) NULL; + ieee->elements = ((ieee_ar_obstack_type *) + bfd_alloc (abfd, + ieee->element_count * sizeof *ieee->elements)); + if (ieee->elements == NULL) + goto error_return; + memcpy (ieee->elements, elts, + ieee->element_count * sizeof *ieee->elements); + free (elts); + elts = NULL; /* Now scan the area again, and replace BB offsets with file */ /* offsets */ @@ -1306,7 +1354,7 @@ for (i = 2; i < ieee->element_count; i++) { if (bfd_seek (abfd, ieee->elements[i].file_offset, SEEK_SET) != 0) - return NULL; + goto error_return; /* FIXME: Check return value. I'm not sure whether it needs to read the entire buffer or not. */ bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd); @@ -1327,8 +1375,14 @@ } } -/* abfd->has_armap = ;*/ + /* abfd->has_armap = ;*/ + return abfd->xvec; + + error_return: + if (elts != NULL) + free (elts); + return NULL; } static boolean @@ -1372,7 +1426,8 @@ ieee->external_reference_min_index = IEEE_REFERENCE_BASE; ieee->external_reference_max_index = 0; ieee->h.abfd = abfd; - memset ((PTR) ieee->section_table, 0, sizeof (ieee->section_table)); + ieee->section_table = NULL; + ieee->section_table_size = 0; processor = ieee->mb.processor = read_id (&(ieee->h)); if (strcmp (processor, "LIBRARY") == 0) @@ -1802,6 +1857,10 @@ break; case ieee_value_starting_address_enum & 0xff: + next_byte (&(ieee->h)); + if (this_byte (&(ieee->h)) == ieee_function_either_open_b_enum) + next_byte (&(ieee->h)); + abfd->start_address = must_parse_int (&(ieee->h)); /* We've got to the end of the data now - */ return true; default: @@ -2037,7 +2096,7 @@ ((bfd_byte) (s->index + IEEE_SECTION_NUMBER_BASE))) - || ! ieee_write_int (abfd, s->vma)) + || ! ieee_write_int (abfd, s->lma)) return false; } } @@ -2074,7 +2133,7 @@ return false; if ((abfd->flags & EXEC_P) != 0 && relocs_to_go == 0) { - if (! ieee_write_int (abfd, s->vma)) + if (! ieee_write_int (abfd, s->lma)) return false; } else @@ -2275,7 +2334,7 @@ || ! ieee_write_byte (abfd, (bfd_byte) (s->index + IEEE_SECTION_NUMBER_BASE)) - || ! ieee_write_int (abfd, s->vma) + || ! ieee_write_int (abfd, s->lma) || ! ieee_write_byte (abfd, ieee_repeat_data_enum) || ! ieee_write_int (abfd, s->_raw_size) || ! ieee_write_byte (abfd, ieee_load_constant_bytes_enum) @@ -2495,7 +2554,7 @@ s = ieee->section_table[section_number]; if (s->output_section) { - value = s->output_section->vma; + value = s->output_section->lma; } else { @@ -3136,7 +3195,8 @@ { if (section->contents == NULL) { - section->contents = bfd_alloc (abfd, section->_raw_size); + section->contents = ((unsigned char *) + bfd_alloc (abfd, section->_raw_size)); if (section->contents == NULL) return false; } @@ -3179,7 +3239,6 @@ for (q = abfd->outsymbols; *q != (asymbol *) NULL; q++) { asymbol *p = *q; - hadone = true; if (bfd_is_und_section (p->section)) { /* This must be a symbol reference .. */ @@ -3189,6 +3248,7 @@ return false; p->value = reference_index; reference_index++; + hadone = true; } else if (bfd_is_com_section (p->section)) { @@ -3203,6 +3263,7 @@ return false; p->value = reference_index; reference_index++; + hadone = true; } else if (p->flags & BSF_GLOBAL) { @@ -3255,6 +3316,7 @@ } p->value = public_index; public_index++; + hadone = true; } else { @@ -3695,7 +3757,7 @@ #define ieee_update_armap_timestamp bfd_true #define ieee_get_elt_at_index _bfd_generic_get_elt_at_index -#define ieee_bfd_is_local_label bfd_generic_is_local_label +#define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name #define ieee_get_lineno _bfd_nosymbols_get_lineno #define ieee_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define ieee_read_minisymbols _bfd_generic_read_minisymbols @@ -3727,7 +3789,7 @@ HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* leading underscore */ + '_', /* leading underscore */ ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, diff -urN binutils-2.7/bfd/ihex.c binutils-2.8/bfd/ihex.c --- binutils-2.7/bfd/ihex.c Thu Jul 4 12:19:16 1996 +++ binutils-2.8/bfd/ihex.c Wed Apr 30 12:56:12 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Intel Hex objects. - Copyright 1995 Free Software Foundation, Inc. + Copyright 1995, 1996, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor of Cygnus Support . This file is part of BFD, the Binary File Descriptor library. @@ -142,6 +142,7 @@ static asymbol *ihex_make_empty_symbol PARAMS ((bfd *)); static boolean ihex_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +static int ihex_sizeof_headers PARAMS ((bfd *, boolean)); /* The number of bytes we put on one line during output. */ @@ -269,11 +270,10 @@ bfd *abfd; { bfd_vma segbase; - bfd_vma extbase; asection *sec; int lineno; boolean error; - bfd_byte *buf; + bfd_byte *buf = NULL; size_t bufsize; int c; @@ -282,12 +282,10 @@ abfd->start_address = 0; - extbase = 0; segbase = 0; sec = NULL; lineno = 1; error = false; - buf = NULL; bufsize = 0; while ((c = ihex_get_byte (abfd, &error)) != EOF) { @@ -378,7 +376,7 @@ case 0: /* This is a data record. */ if (sec != NULL - && sec->vma + sec->_raw_size == extbase + segbase + addr) + && sec->vma + sec->_raw_size == segbase + addr) { /* This data goes at the end of the section we are currently building. */ @@ -398,8 +396,8 @@ if (sec == NULL) goto error_return; sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; - sec->vma = extbase + segbase + addr; - sec->lma = extbase + segbase + addr; + sec->vma = segbase + addr; + sec->lma = segbase + addr; sec->_raw_size = len; sec->filepos = pos; } @@ -570,7 +568,7 @@ { int c; bfd_byte *p; - bfd_byte *buf; + bfd_byte *buf = NULL; size_t bufsize; boolean error; @@ -578,7 +576,6 @@ goto error_return; p = contents; - buf = NULL; bufsize = 0; error = false; while ((c = ihex_get_byte (abfd, &error)) != EOF) @@ -793,11 +790,9 @@ ihex_write_object_contents (abfd) bfd *abfd; { - bfd_vma extbase; bfd_vma segbase; struct ihex_data_list *l; - extbase = 0; segbase = 0; for (l = abfd->tdata.ihex_data->head; l != NULL; l = l->next) { @@ -816,7 +811,7 @@ if (now > CHUNK) now = CHUNK; - if (where > extbase + segbase + 0xffff) + if (where > segbase + 0xffff) { bfd_byte addr[2]; @@ -824,15 +819,15 @@ if (where <= 0xfffff) { segbase = where & 0xf0000; - addr[0] = (segbase >> 12) & 0xff; - addr[1] = (segbase >> 4) & 0xff; + addr[0] = (bfd_byte)(segbase >> 12) & 0xff; + addr[1] = (bfd_byte)(segbase >> 4) & 0xff; if (! ihex_write_record (abfd, 2, 0, 2, addr)) return false; } else { - extbase = where & 0xffff0000; - if (where > extbase + 0xffff) + segbase = where & 0xffff0000; + if (where > segbase + 0xffff) { char buf[20]; @@ -843,15 +838,14 @@ bfd_set_error (bfd_error_bad_value); return false; } - addr[0] = (extbase >> 24) & 0xff; - addr[1] = (extbase >> 16) & 0xff; + addr[0] = (bfd_byte)(segbase >> 24) & 0xff; + addr[1] = (bfd_byte)(segbase >> 16) & 0xff; if (! ihex_write_record (abfd, 2, 0, 4, addr)) return false; } } - if (! ihex_write_record (abfd, now, where - (extbase + segbase), - 0, p)) + if (! ihex_write_record (abfd, now, where - segbase, 0, p)) return false; where += now; @@ -869,19 +863,19 @@ if (start <= 0xfffff) { - startbuf[0] = ((start & 0xf0000) >> 12) & 0xff; + startbuf[0] = (bfd_byte)((start & 0xf0000) >> 12) & 0xff; startbuf[1] = 0; - startbuf[2] = (start >> 8) & 0xff; - startbuf[3] = start & 0xff; + startbuf[2] = (bfd_byte)(start >> 8) & 0xff; + startbuf[3] = (bfd_byte)start & 0xff; if (! ihex_write_record (abfd, 4, 0, 3, startbuf)) return false; } else { - startbuf[0] = (start >> 24) & 0xff; - startbuf[1] = (start >> 16) & 0xff; - startbuf[2] = (start >> 8) & 0xff; - startbuf[3] = start & 0xff; + startbuf[0] = (bfd_byte)(start >> 24) & 0xff; + startbuf[1] = (bfd_byte)(start >> 16) & 0xff; + startbuf[2] = (bfd_byte)(start >> 8) & 0xff; + startbuf[3] = (bfd_byte)start & 0xff; if (! ihex_write_record (abfd, 4, 0, 5, startbuf)) return false; } @@ -949,7 +943,7 @@ ((long (*) PARAMS ((bfd *, asymbol **))) bfd_0l) #define ihex_print_symbol _bfd_nosymbols_print_symbol #define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info -#define ihex_bfd_is_local_label _bfd_nosymbols_bfd_is_local_label +#define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name #define ihex_get_lineno _bfd_nosymbols_get_lineno #define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line #define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff -urN binutils-2.7/bfd/irix-core.c binutils-2.8/bfd/irix-core.c --- binutils-2.7/bfd/irix-core.c Thu Jul 4 12:19:18 1996 +++ binutils-2.8/bfd/irix-core.c Wed Apr 30 12:56:12 1997 @@ -1,5 +1,5 @@ /* BFD back-end for Irix core files. - Copyright 1993, 1994 Free Software Foundation, Inc. + Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Stu Grossman, Cygnus Support. Converted to back-end form by Ian Lance Taylor, Cygnus Support @@ -40,6 +40,16 @@ #define core_signal(bfd) (core_hdr(bfd)->sig) #define core_command(bfd) (core_hdr(bfd)->cmd) +static asection *make_bfd_asection + PARAMS ((bfd *, CONST char *, flagword, bfd_size_type, bfd_vma, file_ptr)); +static const bfd_target *irix_core_core_file_p PARAMS ((bfd *)); +static char *irix_core_core_file_failing_command PARAMS ((bfd *)); +static int irix_core_core_file_failing_signal PARAMS ((bfd *)); +static boolean irix_core_core_file_matches_executable_p + PARAMS ((bfd *, bfd *)); +static asymbol *irix_core_make_empty_symbol PARAMS ((bfd *)); +static void swap_abort PARAMS ((void)); + static asection * make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) bfd *abfd; @@ -82,7 +92,10 @@ return 0; } - if (coreout.c_magic != CORE_MAGIC +#ifndef CORE_MAGICN32 +#define CORE_MAGICN32 CORE_MAGIC +#endif + if ((coreout.c_magic != CORE_MAGIC && coreout.c_magic != CORE_MAGICN32) || coreout.c_version != CORE_VERSION1) return 0; @@ -130,8 +143,7 @@ SEC_ALLOC+SEC_LOAD+SEC_HAS_CONTENTS, vmap.v_len, vmap.v_vaddr, - vmap.v_offset, - 2)) + vmap.v_offset)) return NULL; } @@ -194,7 +206,8 @@ #define irix_core_get_symtab _bfd_nosymbols_get_symtab #define irix_core_print_symbol _bfd_nosymbols_print_symbol #define irix_core_get_symbol_info _bfd_nosymbols_get_symbol_info -#define irix_core_bfd_is_local_label _bfd_nosymbols_bfd_is_local_label +#define irix_core_bfd_is_local_label_name \ + _bfd_nosymbols_bfd_is_local_label_name #define irix_core_get_lineno _bfd_nosymbols_get_lineno #define irix_core_find_nearest_line _bfd_nosymbols_find_nearest_line #define irix_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol @@ -202,7 +215,7 @@ #define irix_core_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol /* If somebody calls any byte-swapping routines, shoot them. */ -void +static void swap_abort() { abort(); /* This way doesn't require any declaration for ANSI to fuck up */ diff -urN binutils-2.7/bfd/libaout.h binutils-2.8/bfd/libaout.h --- binutils-2.7/bfd/libaout.h Thu Jul 4 12:19:21 1996 +++ binutils-2.8/bfd/libaout.h Wed Apr 30 12:56:12 1997 @@ -1,5 +1,5 @@ /* BFD back-end data structures for a.out (and similar) files. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -105,6 +105,12 @@ If not, the text section starts on the next page. */ unsigned char text_includes_header; + /* If this flag is set, then if the entry address is not in the + first SEGMENT_SIZE bytes of the text section, it is taken to be + the address of the start of the text section. This can be useful + for kernels. */ + unsigned char entry_is_text_address; + /* The value to pass to N_SET_FLAGS. */ unsigned char exec_hdr_flags; @@ -216,17 +222,24 @@ M_29K = 101, /* AMD 29000 */ M_386_DYNIX = 102, /* Sequent running dynix */ M_ARM = 103, /* Advanced Risc Machines ARM */ + M_SPARCLET = 131, /* SPARClet = M_SPARC + 128 */ M_386_NETBSD = 134, /* NetBSD/i386 binary */ M_68K_NETBSD = 135, /* NetBSD/m68k binary */ M_68K4K_NETBSD = 136, /* NetBSD/m68k4k binary */ M_532_NETBSD = 137, /* NetBSD/ns32k binary */ M_SPARC_NETBSD = 138, /* NetBSD/sparc binary */ - M_SPARCLET = 142, /* SPARClet */ + M_SPARCLET_1 = 147, /* 0x93, reserved */ M_MIPS1 = 151, /* MIPS R2000/R3000 binary */ M_MIPS2 = 152, /* MIPS R4000/R6000 binary */ + M_SPARCLET_2 = 163, /* 0xa3, reserved */ + M_SPARCLET_3 = 179, /* 0xb3, reserved */ + M_SPARCLET_4 = 195, /* 0xc3, reserved */ M_HP200 = 200, /* HP 200 (68010) BSD binary */ M_HP300 = (300 % 256), /* HP 300 (68020+68881) BSD binary */ - M_HPUX = (0x20c % 256)/* HP 200/300 HPUX binary */ + M_HPUX = (0x20c % 256), /* HP 200/300 HPUX binary */ + M_SPARCLET_5 = 211, /* 0xd3, reserved */ + M_SPARCLET_6 = 227, /* 0xe3, reserved */ + M_SPARCLET_7 = 243 /* 0xf3, reserved */ }; #define N_DYNAMIC(exec) ((exec).a_info & 0x80000000) @@ -554,8 +567,8 @@ #define NO_WRITE_HEADER_KLUDGE 0 #endif -#ifndef aout_32_bfd_is_local_label -#define aout_32_bfd_is_local_label bfd_generic_is_local_label +#ifndef aout_32_bfd_is_local_label_name +#define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name #endif #ifndef WRITE_HEADERS diff -urN binutils-2.7/bfd/libbfd-in.h binutils-2.8/bfd/libbfd-in.h --- binutils-2.7/bfd/libbfd-in.h Thu Jul 4 12:19:22 1996 +++ binutils-2.8/bfd/libbfd-in.h Wed Apr 30 12:56:12 1997 @@ -1,6 +1,6 @@ /* libbfd.h -- Declarations used by bfd library *implementation*. (This include file is not for users of the library.) - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. ** NOTE: libbfd.h is a GENERATED file. Don't change it; instead, @@ -87,15 +87,11 @@ extern bfd_error_handler_type _bfd_error_handler; -/* These routines allocate and free things on the BFD's obstack. */ +/* These routines allocate and free things on the BFD's objalloc. */ -PTR bfd_alloc PARAMS ((bfd *abfd, size_t size)); -PTR bfd_zalloc PARAMS ((bfd *abfd, size_t size)); -void bfd_alloc_grow PARAMS ((bfd *abfd, PTR thing, size_t size)); -PTR bfd_alloc_finish PARAMS ((bfd *abfd)); -PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t wanted)); - -#define bfd_release(x,y) (void) obstack_free(&(x->memory),y) +extern PTR bfd_alloc PARAMS ((bfd *, size_t)); +extern PTR bfd_zalloc PARAMS ((bfd *, size_t)); +extern void bfd_release PARAMS ((bfd *, PTR)); bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd)); bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index)); @@ -259,8 +255,8 @@ ((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void) #define _bfd_nosymbols_get_symbol_info \ ((void (*) PARAMS ((bfd *, asymbol *, symbol_info *))) bfd_void) -#define _bfd_nosymbols_bfd_is_local_label \ - ((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false) +#define _bfd_nosymbols_bfd_is_local_label_name \ + ((boolean (*) PARAMS ((bfd *, const char *))) bfd_false) #define _bfd_nosymbols_get_lineno \ ((alent *(*) PARAMS ((bfd *, asymbol *))) bfd_nullvoidptr) #define _bfd_nosymbols_find_nearest_line \ @@ -339,7 +335,7 @@ /* Generic routine to determine of the given symbol is a local label. */ -extern boolean bfd_generic_is_local_label PARAMS ((bfd *, asymbol *)); +extern boolean bfd_generic_is_local_label_name PARAMS ((bfd *, const char *)); /* Generic minisymbol routines. */ extern long _bfd_generic_read_minisymbols @@ -433,12 +429,18 @@ /* Write out the .stab section when linking stabs in sections. */ extern boolean _bfd_write_section_stabs - PARAMS ((bfd *, asection *, PTR *, bfd_byte *)); + PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_byte *)); /* Write out the .stabstr string table when linking stabs in sections. */ extern boolean _bfd_write_stab_strings PARAMS ((bfd *, PTR *)); +/* Find an offset within a .stab section when linking stabs in + sections. */ + +extern bfd_vma _bfd_stab_section_offset + PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_vma)); + /* Create a string table. */ extern struct bfd_strtab_hash *_bfd_stringtab_init PARAMS ((void)); @@ -486,7 +488,7 @@ /* List of supported target vectors, and the default vector (if bfd_default_vector[0] is NULL, there is no default). */ extern const bfd_target * const bfd_target_vector[]; -extern const bfd_target * const bfd_default_vector[]; +extern const bfd_target *bfd_default_vector[]; /* Functions shared by the ECOFF and MIPS ELF backends, which have no other common header files. */ @@ -505,6 +507,14 @@ extern bfd_vma _bfd_get_gp_value PARAMS ((bfd *)); extern void _bfd_set_gp_value PARAMS ((bfd *, bfd_vma)); + +/* Function shared by the COFF and ELF SH backends, which have no + other common header files. */ + +extern boolean _bfd_sh_align_load_span + PARAMS ((bfd *, asection *, bfd_byte *, + boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma), + PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *)); /* And more follows */ diff -urN binutils-2.7/bfd/libbfd.c binutils-2.8/bfd/libbfd.c --- binutils-2.7/bfd/libbfd.c Thu Jul 4 12:19:27 1996 +++ binutils-2.8/bfd/libbfd.c Wed Apr 30 12:56:13 1997 @@ -1,5 +1,5 @@ /* Assorted BFD support routines, only used internally. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -22,6 +22,10 @@ #include "sysdep.h" #include "libbfd.h" +#ifndef HAVE_GETPAGESIZE +#define getpagesize() 2048 +#endif + static int real_read PARAMS ((PTR, size_t, size_t, FILE *)); /* @@ -303,6 +307,12 @@ windowp->i = 0; windowp->size = 0; } + +/* Currently, if USE_MMAP is undefined, none if the window stuff is + used. Okay, so it's mis-named. At least the command-line option + "--without-mmap" is more obvious than "--without-windows" or some + such. */ +#ifdef USE_MMAP #undef HAVE_MPROTECT /* code's not tested yet */ @@ -317,12 +327,6 @@ static int debug_windows; -/* Currently, if USE_MMAP is undefined, none if the window stuff is - used. Okay, so it's mis-named. At least the command-line option - "--without-mmap" is more obvious than "--without-windows" or some - such. */ -#ifdef USE_MMAP - void bfd_free_window (windowp) bfd_window *windowp; @@ -359,7 +363,6 @@ /* There should be no more references to i at this point. */ free (i); } -#endif static int ok_to_map = 1; @@ -375,10 +378,6 @@ bfd_window_internal *i = windowp->i; size_t size_to_alloc = size; -#ifndef USE_MMAP - abort (); -#endif - if (debug_windows) fprintf (stderr, "bfd_get_file_window (%p, %6ld, %6ld, %p<%p,%lx,%p>, %d)", abfd, (long) offset, (long) size, @@ -511,6 +510,8 @@ return true; } +#endif /* USE_MMAP */ + bfd_size_type bfd_write (ptr, size, nitems, abfd) CONST PTR ptr; @@ -1178,12 +1179,12 @@ } boolean -bfd_generic_is_local_label (abfd, sym) +bfd_generic_is_local_label_name (abfd, name) bfd *abfd; - asymbol *sym; + const char *name; { char locals_prefix = (bfd_get_symbol_leading_char (abfd) == '_') ? 'L' : '.'; - return (sym->name[0] == locals_prefix); + return (name[0] == locals_prefix); } diff -urN binutils-2.7/bfd/libbfd.h binutils-2.8/bfd/libbfd.h --- binutils-2.7/bfd/libbfd.h Thu Jul 4 12:30:44 1996 +++ binutils-2.8/bfd/libbfd.h Wed Apr 30 12:56:13 1997 @@ -1,6 +1,6 @@ /* libbfd.h -- Declarations used by bfd library *implementation*. (This include file is not for users of the library.) - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. ** NOTE: libbfd.h is a GENERATED file. Don't change it; instead, @@ -87,15 +87,11 @@ extern bfd_error_handler_type _bfd_error_handler; -/* These routines allocate and free things on the BFD's obstack. */ +/* These routines allocate and free things on the BFD's objalloc. */ -PTR bfd_alloc PARAMS ((bfd *abfd, size_t size)); -PTR bfd_zalloc PARAMS ((bfd *abfd, size_t size)); -void bfd_alloc_grow PARAMS ((bfd *abfd, PTR thing, size_t size)); -PTR bfd_alloc_finish PARAMS ((bfd *abfd)); -PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t wanted)); - -#define bfd_release(x,y) (void) obstack_free(&(x->memory),y) +extern PTR bfd_alloc PARAMS ((bfd *, size_t)); +extern PTR bfd_zalloc PARAMS ((bfd *, size_t)); +extern void bfd_release PARAMS ((bfd *, PTR)); bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd)); bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index)); @@ -259,8 +255,8 @@ ((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void) #define _bfd_nosymbols_get_symbol_info \ ((void (*) PARAMS ((bfd *, asymbol *, symbol_info *))) bfd_void) -#define _bfd_nosymbols_bfd_is_local_label \ - ((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false) +#define _bfd_nosymbols_bfd_is_local_label_name \ + ((boolean (*) PARAMS ((bfd *, const char *))) bfd_false) #define _bfd_nosymbols_get_lineno \ ((alent *(*) PARAMS ((bfd *, asymbol *))) bfd_nullvoidptr) #define _bfd_nosymbols_find_nearest_line \ @@ -339,7 +335,7 @@ /* Generic routine to determine of the given symbol is a local label. */ -extern boolean bfd_generic_is_local_label PARAMS ((bfd *, asymbol *)); +extern boolean bfd_generic_is_local_label_name PARAMS ((bfd *, const char *)); /* Generic minisymbol routines. */ extern long _bfd_generic_read_minisymbols @@ -433,12 +429,18 @@ /* Write out the .stab section when linking stabs in sections. */ extern boolean _bfd_write_section_stabs - PARAMS ((bfd *, asection *, PTR *, bfd_byte *)); + PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_byte *)); /* Write out the .stabstr string table when linking stabs in sections. */ extern boolean _bfd_write_stab_strings PARAMS ((bfd *, PTR *)); +/* Find an offset within a .stab section when linking stabs in + sections. */ + +extern bfd_vma _bfd_stab_section_offset + PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_vma)); + /* Create a string table. */ extern struct bfd_strtab_hash *_bfd_stringtab_init PARAMS ((void)); @@ -486,7 +488,7 @@ /* List of supported target vectors, and the default vector (if bfd_default_vector[0] is NULL, there is no default). */ extern const bfd_target * const bfd_target_vector[]; -extern const bfd_target * const bfd_default_vector[]; +extern const bfd_target *bfd_default_vector[]; /* Functions shared by the ECOFF and MIPS ELF backends, which have no other common header files. */ @@ -506,6 +508,14 @@ extern bfd_vma _bfd_get_gp_value PARAMS ((bfd *)); extern void _bfd_set_gp_value PARAMS ((bfd *, bfd_vma)); +/* Function shared by the COFF and ELF SH backends, which have no + other common header files. */ + +extern boolean _bfd_sh_align_load_span + PARAMS ((bfd *, asection *, bfd_byte *, + boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma), + PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *)); + /* And more follows */ void @@ -540,6 +550,7 @@ "BFD_RELOC_64", "BFD_RELOC_32", "BFD_RELOC_26", + "BFD_RELOC_24", "BFD_RELOC_16", "BFD_RELOC_14", "BFD_RELOC_8", @@ -586,8 +597,6 @@ "BFD_RELOC_LO10", "BFD_RELOC_GPREL16", "BFD_RELOC_GPREL32", - "BFD_RELOC_SWREL32", - "BFD_RELOC_SWREL64", "BFD_RELOC_I960_CALLJ", "BFD_RELOC_NONE", "BFD_RELOC_SPARC_WDISP22", @@ -625,11 +634,14 @@ "BFD_RELOC_ALPHA_GPDISP_LO16", "BFD_RELOC_ALPHA_GPDISP", "BFD_RELOC_ALPHA_LITERAL", + "BFD_RELOC_ALPHA_ELF_LITERAL", "BFD_RELOC_ALPHA_LITUSE", "BFD_RELOC_ALPHA_HINT", "BFD_RELOC_ALPHA_LINKAGE", - "BFD_RELOC_ALPHA_BASEREG", + "BFD_RELOC_ALPHA_CODEADDR", "BFD_RELOC_MIPS_JMP", + "BFD_RELOC_MIPS16_JMP", + "BFD_RELOC_MIPS16_GPREL", "BFD_RELOC_HI16", "BFD_RELOC_HI16_S", "BFD_RELOC_LO16", @@ -704,6 +716,48 @@ "BFD_RELOC_ARM_LDR_IMM", "BFD_RELOC_ARM_LITERAL", "BFD_RELOC_ARM_IN_POOL", + "BFD_RELOC_ARM_OFFSET_IMM8", + "BFD_RELOC_ARM_HWLITERAL", + "BFD_RELOC_ARM_THUMB_ADD", + "BFD_RELOC_ARM_THUMB_IMM", + "BFD_RELOC_ARM_THUMB_SHIFT", + "BFD_RELOC_ARM_THUMB_OFFSET", + "BFD_RELOC_SH_PCDISP8BY2", + "BFD_RELOC_SH_PCDISP12BY2", + "BFD_RELOC_SH_IMM4", + "BFD_RELOC_SH_IMM4BY2", + "BFD_RELOC_SH_IMM4BY4", + "BFD_RELOC_SH_IMM8", + "BFD_RELOC_SH_IMM8BY2", + "BFD_RELOC_SH_IMM8BY4", + "BFD_RELOC_SH_PCRELIMM8BY2", + "BFD_RELOC_SH_PCRELIMM8BY4", + "BFD_RELOC_SH_SWITCH16", + "BFD_RELOC_SH_SWITCH32", + "BFD_RELOC_SH_USES", + "BFD_RELOC_SH_COUNT", + "BFD_RELOC_SH_ALIGN", + "BFD_RELOC_SH_CODE", + "BFD_RELOC_SH_DATA", + "BFD_RELOC_SH_LABEL", + + "BFD_RELOC_D10V_10_PCREL_R", + "BFD_RELOC_D10V_10_PCREL_L", + "BFD_RELOC_D10V_18", + "BFD_RELOC_D10V_18_PCREL", + + + "BFD_RELOC_M32R_24", + "BFD_RELOC_M32R_10_PCREL", + "BFD_RELOC_M32R_18_PCREL", + "BFD_RELOC_M32R_26_PCREL", + "BFD_RELOC_M32R_HI16_ULO", + "BFD_RELOC_M32R_HI16_SLO", + "BFD_RELOC_M32R_LO16", + "BFD_RELOC_M32R_SDA16", + + "BFD_RELOC_MN10300_32_PCREL", + "BFD_RELOC_MN10300_16_PCREL", "@@overflow: BFD_RELOC_UNUSED@@", }; #endif diff -urN binutils-2.7/bfd/libcoff-in.h binutils-2.8/bfd/libcoff-in.h --- binutils-2.7/bfd/libcoff-in.h Thu Jul 4 12:19:28 1996 +++ binutils-2.8/bfd/libcoff-in.h Wed Apr 30 12:56:13 1997 @@ -1,5 +1,6 @@ /* BFD COFF object file private structure. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. Written by Cygnus Support. ** NOTE: libcoff.h is a GENERATED file. Don't change it; instead, @@ -296,6 +297,7 @@ bfd_print_symbol_type how)); extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *ret)); +extern boolean _bfd_coff_is_local_label_name PARAMS ((bfd *, const char *)); extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR, unsigned long)); extern boolean coff_find_nearest_line PARAMS ((bfd *, @@ -504,6 +506,13 @@ extern boolean _bfd_ppc_xcoff_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, struct internal_reloc *, struct internal_syment *, asection **)); + +/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the + linker, and so should start with bfd and be declared in bfd.h. */ + +extern boolean ppc_allocate_toc_section PARAMS ((struct bfd_link_info *)); +extern boolean ppc_process_before_allocation + PARAMS ((bfd *, struct bfd_link_info *)); /* And more taken from the source .. */ diff -urN binutils-2.7/bfd/libcoff.h binutils-2.8/bfd/libcoff.h --- binutils-2.7/bfd/libcoff.h Thu Jul 4 12:19:28 1996 +++ binutils-2.8/bfd/libcoff.h Wed Apr 30 12:56:13 1997 @@ -1,5 +1,6 @@ /* BFD COFF object file private structure. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. Written by Cygnus Support. ** NOTE: libcoff.h is a GENERATED file. Don't change it; instead, @@ -296,6 +297,7 @@ bfd_print_symbol_type how)); extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *ret)); +extern boolean _bfd_coff_is_local_label_name PARAMS ((bfd *, const char *)); extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR, unsigned long)); extern boolean coff_find_nearest_line PARAMS ((bfd *, @@ -505,6 +507,13 @@ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, struct internal_reloc *, struct internal_syment *, asection **)); +/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the + linker, and so should start with bfd and be declared in bfd.h. */ + +extern boolean ppc_allocate_toc_section PARAMS ((struct bfd_link_info *)); +extern boolean ppc_process_before_allocation + PARAMS ((bfd *, struct bfd_link_info *)); + /* And more taken from the source .. */ typedef struct coff_ptr_struct @@ -630,6 +639,7 @@ unsigned int _bfd_linesz; boolean _bfd_coff_long_filenames; boolean _bfd_coff_long_section_names; + unsigned int _bfd_coff_default_section_alignment_power; void (*_bfd_coff_swap_filehdr_in) PARAMS (( bfd *abfd, PTR ext, @@ -699,7 +709,7 @@ boolean (*_bfd_coff_sym_is_global) PARAMS (( bfd *abfd, struct internal_syment *)); - void (*_bfd_coff_compute_section_file_positions) PARAMS (( + boolean (*_bfd_coff_compute_section_file_positions) PARAMS (( bfd *abfd)); boolean (*_bfd_coff_start_final_link) PARAMS (( bfd *output_bfd, @@ -783,6 +793,8 @@ #define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames) #define bfd_coff_long_section_names(abfd) \ (coff_backend_info (abfd)->_bfd_coff_long_section_names) +#define bfd_coff_default_section_alignment_power(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) #define bfd_coff_swap_filehdr_in(abfd, i,o) \ ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) diff -urN binutils-2.7/bfd/libecoff.h binutils-2.8/bfd/libecoff.h --- binutils-2.7/bfd/libecoff.h Thu Jul 4 12:19:29 1996 +++ binutils-2.8/bfd/libecoff.h Wed Apr 30 12:56:14 1997 @@ -1,5 +1,5 @@ /* BFD ECOFF object file private structure. - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -139,6 +139,11 @@ the memory just for the infrequently called find_nearest_line. */ struct ecoff_find_line *find_line_info; + /* Whether the .rdata section is in the text segment for this + particular ECOFF file. This is not valid until + ecoff_compute_section_file_positions is called. */ + boolean rdata_in_text; + } ecoff_data_type; /* Each canonical asymbol really looks like this. */ @@ -298,8 +303,8 @@ PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); extern void _bfd_ecoff_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); -extern boolean _bfd_ecoff_bfd_is_local_label - PARAMS ((bfd *, asymbol *)); +extern boolean _bfd_ecoff_bfd_is_local_label_name + PARAMS ((bfd *, const char *)); #define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno extern boolean _bfd_ecoff_find_nearest_line PARAMS ((bfd *, asection *, asymbol **, bfd_vma offset, diff -urN binutils-2.7/bfd/libieee.h binutils-2.8/bfd/libieee.h --- binutils-2.7/bfd/libieee.h Thu Jul 4 12:19:30 1996 +++ binutils-2.8/bfd/libieee.h Wed Apr 30 12:56:14 1997 @@ -1,5 +1,5 @@ /* IEEE-695 object file formats: definitions internal to BFD. - Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. Written by Cygnus Support. Mostly Steve Chamberlain's fault. This file is part of BFD, the Binary File Descriptor library. @@ -60,9 +60,6 @@ } ieee_per_section_type; #define ieee_per_section(x) ((ieee_per_section_type *)((x)->used_by_bfd)) -/* FIXME! There should be no limit to the number of sections! */ -#define NSECTIONS 20 - typedef struct { unsigned char *input_p; @@ -77,7 +74,8 @@ boolean read_data; file_ptr output_cursor; /* Map of section indexes to section ptrs */ - asection * section_table[NSECTIONS]; + asection **section_table; + unsigned int section_table_size; ieee_address_descriptor_type ad; ieee_module_begin_type mb; ieee_w_variable_type w; diff -urN binutils-2.7/bfd/liboasys.h binutils-2.8/bfd/liboasys.h --- binutils-2.7/bfd/liboasys.h Thu Jul 4 12:19:30 1996 +++ binutils-2.8/bfd/liboasys.h Wed Apr 30 12:56:14 1997 @@ -1,5 +1,5 @@ /* BFD internal declarations for Oasys file format handling. - Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. Scrawled by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -70,7 +70,6 @@ } oasys_ar_data_type; typedef struct _oasys_data { - struct obstack oasys_obstack; char *strings; asymbol *symbols; unsigned int symbol_string_length; diff -urN binutils-2.7/bfd/linker.c binutils-2.8/bfd/linker.c --- binutils-2.7/bfd/linker.c Thu Jul 4 12:19:33 1996 +++ binutils-2.8/bfd/linker.c Wed Apr 30 12:56:15 1997 @@ -1,5 +1,5 @@ /* linker.c -- BFD linker routines - Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 1997 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. @@ -395,8 +395,7 @@ is used to further controls which local symbols are included in the output file. If the value is <>, then all local symbols which begin with a certain prefix are discarded; - this prefix is described by the <> and - <> fields of the <> structure. + this is controlled by the <> entry point. The a.out backend handles symbols by calling <> on each input BFD and then @@ -1940,6 +1939,12 @@ abfd->symcount = 0; outsymalloc = 0; + /* Mark all sections which will be included in the output file. */ + for (o = abfd->sections; o != NULL; o = o->next) + for (p = o->link_order_head; p != NULL; p = p->next) + if (p->type == bfd_indirect_link_order) + p->u.indirect.section->linker_mark = true; + /* Build the output symbol table. */ for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) if (! _bfd_generic_link_output_symbols (abfd, sub, info, &outsymalloc)) @@ -2267,10 +2272,7 @@ output = false; break; case discard_l: - if (bfd_asymbol_name (sym)[0] == info->lprefix[0] - && (info->lprefix_len == 1 - || strncmp (bfd_asymbol_name (sym), info->lprefix, - info->lprefix_len) == 0)) + if (bfd_is_local_label (input_bfd, sym)) output = false; else output = true; @@ -2291,6 +2293,15 @@ else abort (); + /* If this symbol is in a section which is not being included + in the output file, then we don't want to output the symbol. + + Gross. .bss and similar sections won't have the linker_mark + field set. */ + if ((sym->section->flags & SEC_HAS_CONTENTS) != 0 + && sym->section->linker_mark == false) + output = false; + if (output) { if (! generic_add_output_symbol (output_bfd, psymalloc, sym)) @@ -2529,7 +2540,7 @@ struct bfd_link_order *new; new = ((struct bfd_link_order *) - bfd_alloc_by_size_t (abfd, sizeof (struct bfd_link_order))); + bfd_alloc (abfd, sizeof (struct bfd_link_order))); if (!new) return NULL; @@ -2650,7 +2661,11 @@ because somebody is attempting to link together different types of object files. Handling this case correctly is difficult, and sometimes impossible. */ - abort (); + (*_bfd_error_handler) + ("Attempt to do relocateable link with %s input and %s output", + bfd_get_target (input_bfd), bfd_get_target (output_bfd)); + bfd_set_error (bfd_error_wrong_format); + return false; } if (! generic_linker) diff -urN binutils-2.7/bfd/m68klinux.c binutils-2.8/bfd/m68klinux.c --- binutils-2.7/bfd/m68klinux.c Thu Jul 4 12:19:34 1996 +++ binutils-2.8/bfd/m68klinux.c Wed Apr 30 12:56:16 1997 @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored m68k a.out binaries. - Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -24,6 +24,8 @@ #define N_SHARED_LIB(x) 0 #define BYTES_IN_WORD 4 +#define MACHTYPE_OK(mtype) ((mtype) == M_68020 || (mtype) == M_UNKNOWN) + #include "bfd.h" #include "sysdep.h" #include "libbfd.h" @@ -45,6 +47,9 @@ static void MY_final_link_callback PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); +static boolean m68klinux_bfd_final_link + PARAMS ((bfd *, struct bfd_link_info *)); +static boolean m68klinux_write_object_contents PARAMS ((bfd *)); static boolean m68klinux_bfd_final_link (abfd, info) diff -urN binutils-2.7/bfd/m68knetbsd.c binutils-2.8/bfd/m68knetbsd.c --- binutils-2.7/bfd/m68knetbsd.c Thu Jul 4 12:19:34 1996 +++ binutils-2.8/bfd/m68knetbsd.c Wed Apr 30 12:56:16 1997 @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/m68k a.out-ish binaries. - Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 94, 95, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -20,8 +20,7 @@ #define BYTES_IN_WORD 4 #define TARGET_IS_BIG_ENDIAN_P -#define TARGET_PAGE_SIZE 8192 -#define SEGMENT_SIZE 8192 +#define TARGET_PAGE_SIZE 0x2000 #define DEFAULT_ARCH bfd_arch_m68k #define MACHTYPE_OK(mtype) \ diff -urN binutils-2.7/bfd/makefile.vms binutils-2.8/bfd/makefile.vms --- binutils-2.7/bfd/makefile.vms Thu Jul 4 12:19:34 1996 +++ binutils-2.8/bfd/makefile.vms Wed Apr 30 12:56:16 1997 @@ -1,12 +1,11 @@ # -# Makefile for bfd library under openVMS/AXP +# Makefile for bfd library under openVMS/Alpha # # For use with gnu-make for vms # -# Created by Klaus Kaempf, kkaempf@progis.de +# Created by Klaus K"ampf, kkaempf@progis.de # # -CC=gcc OBJS=archive.obj,archures.obj,bfd.obj,cache.obj,coffgen.obj,corefile.obj,format.obj,\ init.obj,libbfd.obj,opncls.obj,reloc.obj,section.obj,syms.obj,targets.obj,\ @@ -15,14 +14,15 @@ cpu-alpha.obj ifeq ($(CC),gcc) -DEFS=/define=(SELECT_VECS="&evax_alpha_vec",SELECT_ARCHITECTURES="&bfd_alpha_arch","unlink=remove") +DEFS=/define=(SELECT_VECS="&evax_alpha_vec",SELECT_ARCHITECTURES="&bfd_alpha_arch",\ +"HAVE_evax_alpha_vec=1") CFLAGS=/include=([],[-.include])$(DEFS) else DEFS=/define=(DEFAULT_VECTOR="evax_alpha_vec",SELECT_VECS="&evax_alpha_vec",\ -SELECT_ARCHITECTURES="&bfd_alpha_arch","unlink=remove",\ +SELECT_ARCHITECTURES="&bfd_alpha_arch","unlink=remove","const=",\ "_bfd_generic_get_section_contents_in_window"="_bfd_generic_get_win_section_cont",\ "_bfd_elf_section_from_bfd_section"="_bfd_elf_sec_from_bfd_sec") -CFLAGS=/machine/list=cc.s/noopt/debug/include=([],[-.include])$(DEFS) +CFLAGS=/noopt/debug/include=([],[-.include])$(DEFS)/warnings=disable=(missingreturn,implicitfunc) endif @@ -33,8 +33,25 @@ sysdep.h: [.hosts]alphavms.h config.h $(CP) $< $@ -bfd.h: bfd.h-vms - $(CP) $< $@ +bfd.h: bfd-in2.h + $$ @configure -config.h: config.h-vms - $(CP) $< $@ +targmatch.h: bfd.h +config.h: bfd.h + +evax-alpha.c: evax.h +evax-emh.c: evax.h +evax-egsd.c: evax.h +evax-etir.c: evax.h +evax-misc.c: evax.h +targets.c: targmatch.h + + +clean: + $$ purge + $(RM) libbfd.olb; + $(RM) sysdep.h; + $(RM) bfd.h; + $(RM) targmatch.h; + $(RM) config.h; + $(RM) *.obj; diff -urN binutils-2.7/bfd/mipsbsd.c binutils-2.8/bfd/mipsbsd.c --- binutils-2.7/bfd/mipsbsd.c Thu Jul 4 12:19:34 1996 +++ binutils-2.8/bfd/mipsbsd.c Wed Apr 30 12:56:17 1997 @@ -1,5 +1,5 @@ /* BFD backend for MIPS BSD (a.out) binaries. - Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc. Written by Ralph Campbell. This file is part of BFD, the Binary File Descriptor library. @@ -376,6 +376,7 @@ static CONST struct aout_backend_data MY(backend_data) = { 0, /* zmagic contiguous */ 1, /* text incl header */ + 0, /* entry is text address */ 0, /* exec_hdr_flags */ TARGET_PAGE_SIZE, /* text vma */ MY_set_sizes, diff -urN binutils-2.7/bfd/mpw-config.in binutils-2.8/bfd/mpw-config.in --- binutils-2.7/bfd/mpw-config.in Thu Jul 4 12:19:34 1996 +++ binutils-2.8/bfd/mpw-config.in Wed Apr 30 12:56:17 1997 @@ -5,37 +5,43 @@ Set selarchs "&bfd_{target_cpu}_arch" Set defvec "" Set selvecs "" +Set havevecs "" If "{target_canonical}" =~ /m68k-apple-macos/ Set BFD_BACKENDS '"{o}"coff-m68k.c.o "{o}"cofflink.c.o' Set defvec m68kcoff_vec Set selvecs '&m68kcoff_vec' + Set havevecs '-d HAVE_m68kcoff_vec' Else If "{target_canonical}" =~ /powerpc-apple-macos/ Set BFD_BACKENDS '"{o}"coff-pmac.c.o "{o}"xcofflink.c.o' Set defvec pmac_xcoff_vec Set selvecs '&pmac_xcoff_vec' + Set havevecs '-d HAVE_pmac_xcoff_vec' Set selarchs "&bfd_powerpc_arch" -Else If "{target_canonical}" =~ /i386-unknown-go32/ +Else If "{target_canonical}" =~ /i386-\Option-x-go32/ Set BFD_BACKENDS '"{o}"coff-i386.c.o' Set defvec i386coff_vec Set selvecs '&i386coff_vec' + Set havevecs '-d HAVE_i386coff_vec' Else If "{target_canonical}" =~ /mips-\Option-x-\Option-x/ - Set BFD_BACKENDS '"{o}"coff-mips.c.o "{o}"ecoff.c.o "{o}"ecofflink.c.o' + Set BFD_BACKENDS '"{o}"coff-mips.c.o "{o}"ecoff.c.o "{o}"ecofflink.c.o "{o}"elf32.c.o "{o}"elf32-mips.c.o "{o}"elflink.c.o' Set defvec ecoff_big_vec - Set selvecs '&ecoff_big_vec,&ecoff_little_vec' + Set selvecs '&ecoff_big_vec,&ecoff_little_vec,&bfd_elf32_bigmips_vec' + Set havevecs '-d HAVE_ecoff_big_vec -d HAVE_ecoff_little_vec -d HAVE_bfd_elf32_bigmips_vec' -Else If "{target_canonical}" =~ /sh-hitachi-hms/ +Else If "{target_canonical}" =~ /sh-\Option-x-hms/ Set BFD_BACKENDS '"{o}"coff-sh.c.o "{o}"cofflink.c.o' Set defvec shcoff_vec Set selvecs '&shcoff_vec,&shlcoff_vec' + Set havevecs '-d HAVE_shcoff_vec -d HAVE_shlcoff_vec' End If Set ta `echo {selarchs} | sed -e 's/&bfd_/{o}cpu-/g' -e 's/_arch/.c.o/g'` -Set tdefaults "-d DEFAULT_VECTOR={defvec} -d SELECT_VECS={selvecs} -d SELECT_ARCHITECTURES={selarchs}" +Set tdefaults "-d DEFAULT_VECTOR={defvec} -d SELECT_VECS={selvecs} -d SELECT_ARCHITECTURES={selarchs} {havevecs}" Echo '# From mpw-config.in' > "{o}"mk.tmp Echo 'WORDSIZE = 32' >> "{o}"mk.tmp @@ -54,11 +60,18 @@ # We can only handle 32-bit targets right now. sed -e 's/@WORDSIZE@/32/' \Option-d + -e 's/@wordsize@/32/' \Option-d -e "s/@VERSION@/`Catenate {srcdir}VERSION`/" \Option-d + -e 's/@BFD_HOST_64_BIT_DEFINED@/0/' \Option-d + -e 's/@BFD_HOST_64_BIT@//' \Option-d + -e 's/@BFD_HOST_U_64_BIT@//' \Option-d -e 's/@BFD_HOST_64BIT_LONG@/0/' \Option-d "{srcdir}"bfd-in2.h >"{o}"bfd.h-new MoveIfChange "{o}"bfd.h-new "{o}"bfd.h + +sed -e 's/NN/32/g' "{srcdir}"elfxx-target.h >"{o}"elf32-target.h-new +MoveIfChange "{o}"elf32-target.h-new "{o}"elf32-target.h # Pre-expand some macros in coffswap.h, so MPW C doesn't choke. diff -urN binutils-2.7/bfd/mpw-make.sed binutils-2.8/bfd/mpw-make.sed --- binutils-2.7/bfd/mpw-make.sed Thu Jul 4 12:19:34 1996 +++ binutils-2.8/bfd/mpw-make.sed Wed Apr 30 12:56:17 1997 @@ -4,13 +4,16 @@ /HDEFINES/s/@HDEFINES@// /TDEFINES/s/@TDEFINES@// -/INCDIR=/s/"{srcdir}":/"{topsrcdir}"/ -/^CSEARCH = .*$/s/$/ -i "{INCDIR}":mpw: -i ::extra-include:/ - -/WORDSIZE/s/^WORDSIZE = /#WORDSIZE = / -/BFD_MACHINES/s/^BFD_MACHINES = /#BFD_MACHINES = / -/BFD_BACKENDS/s/^BFD_BACKENDS = /#BFD_BACKENDS = / -/TDEFAULTS/s/^TDEFAULTS = /#TDEFAULTS = / +# Fix pathnames to include directories. +/^INCDIR = /s/^INCDIR = .*$/INCDIR = "{topsrcdir}"include/ +/^CSEARCH = /s/$/ -i "{INCDIR}":mpw: -i ::extra-include:/ + +# Comment out setting of vars, configure script will add these itself. +/^WORDSIZE =/s/^/#/ +# /^ALL_BACKENDS/s/^/#/ +/^BFD_BACKENDS/s/^/#/ +/^BFD_MACHINES/s/^/#/ +/^TDEFAULTS/s/^/#/ # Remove extra, useless, "all". /^all \\Option-f _oldest/,/^$/d @@ -23,11 +26,19 @@ /BFD_H/s/^{BFD_H}/#{BFD_H}/ +# Add explicit srcdir paths to special files. +/config.bfd/s/ config.bfd/ "{s}"config.bfd/g +/targmatch.sed/s/ targmatch.sed/ "{s}"targmatch.sed/g + # Point at include files that are always in the objdir. /bfd/s/"{s}"bfd\.h/"{o}"bfd.h/g /config/s/"{s}"config\.h/"{o}"config.h/g +/targmatch/s/"{s}"targmatch\.h/"{o}"targmatch.h/g +/targmatch/s/^targmatch\.h/"{o}"targmatch.h/ /elf32-target/s/"{s}"elf32-target\.h/"{o}"elf32-target.h/g +/elf32-target/s/^elf32-target\.h/"{o}"elf32-target.h/ /elf64-target/s/"{s}"elf64-target\.h/"{o}"elf64-target.h/g +/elf64-target/s/^elf64-target\.h/"{o}"elf64-target.h/ /"{s}"{INCDIR}/s/"{s}"{INCDIR}/"{INCDIR}"/g @@ -57,11 +68,11 @@ # MPW Make doesn't know about $<. /"{o}"targets.c.o \\Option-f "{s}"targets.c Makefile/,/^$/c\ "{o}"targets.c.o \\Option-f "{s}"targets.c Makefile\ - {CC} {ALL_CFLAGS} {TDEFAULTS} "{s}"targets.c -o "{o}"targets.c.o + {CC} @DASH_C_FLAG@ {ALL_CFLAGS} {TDEFAULTS} "{s}"targets.c -o "{o}"targets.c.o /"{o}"archures.c.o \\Option-f "{s}"archures.c Makefile/,/^$/c\ "{o}"archures.c.o \\Option-f "{s}"archures.c Makefile\ - {CC} {ALL_CFLAGS} {TDEFAULTS} "{s}"archures.c -o "{o}"archures.c.o + {CC} @DASH_C_FLAG@ {ALL_CFLAGS} {TDEFAULTS} "{s}"archures.c -o "{o}"archures.c.o # Remove the .h rebuilding rules, we don't currently have a doc subdir, # or a way to build the prototype-hacking tool that's in it. diff -urN binutils-2.7/bfd/netbsd-core.c binutils-2.8/bfd/netbsd-core.c --- binutils-2.7/bfd/netbsd-core.c Thu Jul 4 12:19:36 1996 +++ binutils-2.8/bfd/netbsd-core.c Wed Apr 30 12:56:17 1997 @@ -46,6 +46,7 @@ static int netbsd_core_core_file_failing_signal PARAMS ((bfd *abfd)); static boolean netbsd_core_core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd)); +static void swap_abort PARAMS ((void)); /* Handle NetBSD-style core dump file. */ diff -urN binutils-2.7/bfd/netbsd.h binutils-2.8/bfd/netbsd.h --- binutils-2.7/bfd/netbsd.h Thu Jul 4 12:19:38 1996 +++ binutils-2.8/bfd/netbsd.h Wed Apr 30 12:56:18 1997 @@ -1,5 +1,5 @@ /* BFD back-end definitions used by all NetBSD targets. - Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,10 +18,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* NetBSD fits its header into the start of its text segment */ -#define N_HEADER_IN_TEXT(x) 1 +/* This is the normal load address for executables. */ #define TEXT_START_ADDR TARGET_PAGE_SIZE +/* NetBSD ZMAGIC has its header in the text segment. */ +#define N_HEADER_IN_TEXT(x) 1 + +/* Determine if this is a shared library using the flags. */ +#define N_SHARED_LIB(x) (N_DYNAMIC(x)) + +/* We have 6 bits of flags and 10 bits of machine ID. */ #define N_MACHTYPE(exec) \ ((enum machine_type)(((exec).a_info >> 16) & 0x03ff)) #define N_FLAGS(exec) \ @@ -47,6 +53,9 @@ format. */ #define SWAP_MAGIC(ext) bfd_getb32 (ext) +/* On NetBSD, the entry point may be taken to be the start of the text + section. */ +#define MY_entry_is_text_address 1 #define MY_write_object_contents MY(write_object_contents) static boolean MY(write_object_contents) PARAMS ((bfd *abfd)); diff -urN binutils-2.7/bfd/nlm-target.h binutils-2.8/bfd/nlm-target.h --- binutils-2.7/bfd/nlm-target.h Thu Jul 4 12:19:39 1996 +++ binutils-2.8/bfd/nlm-target.h Wed Apr 30 12:56:18 1997 @@ -1,5 +1,5 @@ /* Target definitions for 32/64-bit NLM (NetWare Loadable Module) - Copyright (C) 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -24,7 +24,7 @@ #define nlm_make_empty_symbol nlmNAME(make_empty_symbol) #define nlm_print_symbol nlmNAME(print_symbol) #define nlm_get_symbol_info nlmNAME(get_symbol_info) -#define nlm_bfd_is_local_label bfd_generic_is_local_label +#define nlm_bfd_is_local_label_name bfd_generic_is_local_label_name #define nlm_get_lineno _bfd_nosymbols_get_lineno #define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line #define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff -urN binutils-2.7/bfd/oasys.c binutils-2.8/bfd/oasys.c --- binutils-2.7/bfd/oasys.c Thu Jul 4 12:19:49 1996 +++ binutils-2.8/bfd/oasys.c Wed Apr 30 12:56:21 1997 @@ -1,5 +1,5 @@ /* BFD back-end for oasys objects. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support, . This file is part of BFD, the Binary File Descriptor library. @@ -1458,7 +1458,7 @@ #define oasys_get_elt_at_index _bfd_generic_get_elt_at_index #define oasys_update_armap_timestamp bfd_true -#define oasys_bfd_is_local_label bfd_generic_is_local_label +#define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name #define oasys_get_lineno _bfd_nosymbols_get_lineno #define oasys_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define oasys_read_minisymbols _bfd_generic_read_minisymbols diff -urN binutils-2.7/bfd/opncls.c binutils-2.8/bfd/opncls.c --- binutils-2.7/bfd/opncls.c Thu Jul 4 12:19:50 1996 +++ binutils-2.8/bfd/opncls.c Wed Apr 30 12:56:21 1997 @@ -1,5 +1,7 @@ /* opncls.c -- open and close a BFD. - Copyright (C) 1990 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. + Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -20,8 +22,8 @@ #include "bfd.h" #include "sysdep.h" +#include "objalloc.h" #include "libbfd.h" -#include "obstack.h" #ifndef S_IXUSR #define S_IXUSR 0100 /* Execute by owner. */ @@ -36,14 +38,7 @@ /* fdopen is a loser -- we should use stdio exclusively. Unfortunately if we do that we can't use fcntl. */ - -#define obstack_chunk_alloc malloc -#define obstack_chunk_free free - -#ifndef HAVE_GETPAGESIZE -#define getpagesize() 2048 -#endif - +/* FIXME: This is no longer used. */ long _bfd_chunksize = -1; /* Return a new BFD. All BFD's are allocated through this routine. */ @@ -53,25 +48,15 @@ { bfd *nbfd; - nbfd = (bfd *)bfd_zmalloc (sizeof (bfd)); - if (!nbfd) - return 0; - - if (_bfd_chunksize <= 0) - { - _bfd_chunksize = getpagesize (); - if (_bfd_chunksize <= 0) - _bfd_chunksize = 2048; - /* Leave some slush space, since many malloc implementations - prepend a header, and may wind up wasting another page - because of it. */ - _bfd_chunksize -= 32; - } + nbfd = (bfd *) bfd_zmalloc (sizeof (bfd)); + if (nbfd == NULL) + return NULL; - if (!obstack_begin(&nbfd->memory, _bfd_chunksize)) + nbfd->memory = (PTR) objalloc_create (); + if (nbfd->memory == NULL) { bfd_set_error (bfd_error_no_memory); - return 0; + return NULL; } nbfd->arch_info = &bfd_default_arch_struct; @@ -79,16 +64,16 @@ nbfd->direction = no_direction; nbfd->iostream = NULL; nbfd->where = 0; - nbfd->sections = (asection *)NULL; + nbfd->sections = (asection *) NULL; nbfd->format = bfd_unknown; - nbfd->my_archive = (bfd *)NULL; + nbfd->my_archive = (bfd *) NULL; nbfd->origin = 0; nbfd->opened_once = false; nbfd->output_has_begun = false; nbfd->section_count = 0; - nbfd->usrdata = (PTR)NULL; + nbfd->usrdata = (PTR) NULL; nbfd->cacheable = false; - nbfd->flags = NO_FLAGS; + nbfd->flags = BFD_NO_FLAGS; nbfd->mtime_set = false; return nbfd; @@ -102,7 +87,7 @@ { bfd *nbfd; - nbfd = _bfd_new_bfd(); + nbfd = _bfd_new_bfd (); nbfd->xvec = obfd->xvec; nbfd->my_archive = obfd; nbfd->direction = read_direction; @@ -142,28 +127,34 @@ bfd *nbfd; const bfd_target *target_vec; - nbfd = _bfd_new_bfd(); + nbfd = _bfd_new_bfd (); if (nbfd == NULL) return NULL; target_vec = bfd_find_target (target, nbfd); - if (target_vec == NULL) { - bfd_set_error (bfd_error_invalid_target); - return NULL; - } + if (target_vec == NULL) + { + objalloc_free ((struct objalloc *) nbfd->memory); + free (nbfd); + bfd_set_error (bfd_error_invalid_target); + return NULL; + } nbfd->filename = filename; nbfd->direction = read_direction; - if (bfd_open_file (nbfd) == NULL) { - bfd_set_error (bfd_error_system_call); /* File didn't exist, or some such */ - bfd_release(nbfd,0); - return NULL; - } + if (bfd_open_file (nbfd) == NULL) + { + /* File didn't exist, or some such */ + bfd_set_error (bfd_error_system_call); + objalloc_free ((struct objalloc *) nbfd->memory); + free (nbfd); + return NULL; + } + return nbfd; } - /* Don't try to `optimize' this function: o - We lock using stack space so that interrupting the locking @@ -216,17 +207,20 @@ #endif if (fdflags == -1) return NULL; - nbfd = _bfd_new_bfd(); - + nbfd = _bfd_new_bfd (); if (nbfd == NULL) return NULL; target_vec = bfd_find_target (target, nbfd); - if (target_vec == NULL) { - bfd_set_error (bfd_error_invalid_target); - return NULL; - } -#if defined(VMS) || defined(__GO32__) || defined (WINGDB) + if (target_vec == NULL) + { + bfd_set_error (bfd_error_invalid_target); + objalloc_free ((struct objalloc *) nbfd->memory); + free (nbfd); + return NULL; + } + +#if defined(VMS) || defined(__GO32__) nbfd->iostream = (PTR)fopen(filename, FOPEN_RB); #else /* (O_ACCMODE) parens are to avoid Ultrix header file bug */ @@ -237,10 +231,13 @@ default: abort (); } #endif - if (nbfd->iostream == NULL) { - (void) obstack_free (&nbfd->memory, (PTR)0); - return NULL; - } + + if (nbfd->iostream == NULL) + { + objalloc_free ((struct objalloc *) nbfd->memory); + free (nbfd); + return NULL; + } /* OK, put everything where it belongs */ @@ -250,15 +247,20 @@ be written through, although doing so requires that we end the previous clause with a preposition. */ /* (O_ACCMODE) parens are to avoid Ultrix header file bug */ - switch (fdflags & (O_ACCMODE)) { - case O_RDONLY: nbfd->direction = read_direction; break; - case O_WRONLY: nbfd->direction = write_direction; break; - case O_RDWR: nbfd->direction = both_direction; break; - default: abort (); - } - + switch (fdflags & O_ACCMODE) + { + case O_RDONLY: nbfd->direction = read_direction; break; + case O_WRONLY: nbfd->direction = write_direction; break; + case O_RDWR: nbfd->direction = both_direction; break; + default: abort (); + } + if (! bfd_cache_init (nbfd)) - return NULL; + { + objalloc_free ((struct objalloc *) nbfd->memory); + free (nbfd); + return NULL; + } nbfd->opened_once = true; return nbfd; @@ -269,7 +271,7 @@ bfd_openstreamr SYNOPSIS - bfd *bfd_openstreamr(); + bfd *bfd_openstreamr(const char *, const char *, PTR); DESCRIPTION @@ -278,11 +280,12 @@ */ bfd * -bfd_openstreamr (filename, target, stream) +bfd_openstreamr (filename, target, streamarg) const char *filename; const char *target; - FILE *stream; + PTR streamarg; { + FILE *stream = (FILE *) streamarg; bfd *nbfd; const bfd_target *target_vec; @@ -294,6 +297,8 @@ if (target_vec == NULL) { bfd_set_error (bfd_error_invalid_target); + objalloc_free ((struct objalloc *) nbfd->memory); + free (nbfd); return NULL; } @@ -302,7 +307,11 @@ nbfd->direction = read_direction; if (! bfd_cache_init (nbfd)) - return NULL; + { + objalloc_free ((struct objalloc *) nbfd->memory); + free (nbfd); + return NULL; + } return nbfd; } @@ -340,21 +349,29 @@ /* nbfd has to point to head of malloc'ed block so that bfd_close may reclaim it correctly. */ - nbfd = _bfd_new_bfd(); + nbfd = _bfd_new_bfd (); if (nbfd == NULL) return NULL; target_vec = bfd_find_target (target, nbfd); - if (target_vec == NULL) return NULL; + if (target_vec == NULL) + { + objalloc_free ((struct objalloc *) nbfd->memory); + free (nbfd); + return NULL; + } nbfd->filename = filename; nbfd->direction = write_direction; - if (bfd_open_file (nbfd) == NULL) { - bfd_set_error (bfd_error_system_call); /* File not writeable, etc */ - (void) obstack_free (&nbfd->memory, (PTR)0); - return NULL; + if (bfd_open_file (nbfd) == NULL) + { + bfd_set_error (bfd_error_system_call); /* File not writeable, etc */ + objalloc_free ((struct objalloc *) nbfd->memory); + free (nbfd); + return NULL; } + return nbfd; } @@ -373,7 +390,7 @@ and closed. If the created file is executable, then <> is called to mark it as such. - All memory attached to the BFD's obstacks is released. + All memory attached to the BFD is released. The file descriptor associated with the BFD is closed (even if it was passed in to BFD by <>). @@ -418,8 +435,8 @@ } } - (void) obstack_free (&abfd->memory, (PTR)0); - (void) free (abfd); + objalloc_free ((struct objalloc *) abfd->memory); + free (abfd); return ret; } @@ -440,7 +457,7 @@ If the created file is executable, then <> is called to mark it as such. - All memory attached to the BFD's obstacks is released. + All memory attached to the BFD is released. RETURNS <> is returned if all is ok, otherwise <>. @@ -472,39 +489,13 @@ & (buf.st_mode | ((S_IXUSR | S_IXGRP | S_IXOTH) &~ mask)))); } } - (void) obstack_free (&abfd->memory, (PTR)0); - (void) free(abfd); - return ret; -} - - -/* -FUNCTION - bfd_alloc_size -SYNOPSIS - bfd_size_type bfd_alloc_size(bfd *abfd); - -DESCRIPTION - Return the number of bytes in the obstacks connected to @var{abfd}. + objalloc_free ((struct objalloc *) abfd->memory); + free (abfd); -*/ - -bfd_size_type -bfd_alloc_size (abfd) - bfd *abfd; -{ - struct _obstack_chunk *chunk = abfd->memory.chunk; - size_t size = 0; - while (chunk) { - size += chunk->limit - &(chunk->contents[0]); - chunk = chunk->prev; - } - return size; + return ret; } - - /* FUNCTION bfd_create @@ -525,81 +516,64 @@ CONST char *filename; bfd *templ; { - bfd *nbfd = _bfd_new_bfd(); - if (nbfd == (bfd *)NULL) - return (bfd *)NULL; + bfd *nbfd; + + nbfd = _bfd_new_bfd (); + if (nbfd == NULL) + return NULL; nbfd->filename = filename; - if(templ) { + if (templ) nbfd->xvec = templ->xvec; - } nbfd->direction = no_direction; - bfd_set_format(nbfd, bfd_object); + bfd_set_format (nbfd, bfd_object); return nbfd; } /* INTERNAL_FUNCTION - bfd_alloc_by_size_t + bfd_alloc SYNOPSIS - PTR bfd_alloc_by_size_t(bfd *abfd, size_t wanted); + PTR bfd_alloc (bfd *abfd, size_t wanted); DESCRIPTION - Allocate a block of @var{wanted} bytes of memory in the obstack - attatched to <> and return a pointer to it. + Allocate a block of @var{wanted} bytes of memory attached to + <> and return a pointer to it. */ PTR -bfd_alloc_by_size_t (abfd, size) +bfd_alloc (abfd, size) bfd *abfd; size_t size; { PTR ret; - ret = obstack_alloc (&(abfd->memory), size); + ret = objalloc_alloc (abfd->memory, (unsigned long) size); if (ret == NULL) bfd_set_error (bfd_error_no_memory); return ret; } -void -bfd_alloc_grow (abfd, ptr, size) - bfd *abfd; - PTR ptr; - size_t size; -{ - (void) obstack_grow(&(abfd->memory), ptr, size); -} - PTR -bfd_alloc_finish (abfd) +bfd_zalloc (abfd, size) bfd *abfd; + size_t size; { - PTR ret; + PTR res; - ret = obstack_finish (&(abfd->memory)); - if (ret == NULL) - bfd_set_error (bfd_error_no_memory); - return ret; + res = bfd_alloc (abfd, size); + if (res) + memset (res, 0, size); + return res; } -PTR -bfd_alloc (abfd, size) - bfd *abfd; - size_t size; -{ - return bfd_alloc_by_size_t(abfd, (size_t)size); -} +/* Free a block allocated for a BFD. */ -PTR -bfd_zalloc (abfd, size) +void +bfd_release (abfd, block) bfd *abfd; - size_t size; + PTR block; { - PTR res; - res = bfd_alloc(abfd, size); - if (res) - memset(res, 0, (size_t)size); - return res; + objalloc_free_block ((struct objalloc *) abfd->memory, block); } diff -urN binutils-2.7/bfd/osf-core.c binutils-2.8/bfd/osf-core.c --- binutils-2.7/bfd/osf-core.c Thu Jul 4 12:19:50 1996 +++ binutils-2.8/bfd/osf-core.c Wed Apr 30 12:56:21 1997 @@ -1,5 +1,5 @@ /* BFD back-end for OSF/1 core files. - Copyright 1993, 1994 Free Software Foundation, Inc. + Copyright 1993, 94, 95, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -189,7 +189,7 @@ #define osf_core_get_symtab _bfd_nosymbols_get_symtab #define osf_core_print_symbol _bfd_nosymbols_print_symbol #define osf_core_get_symbol_info _bfd_nosymbols_get_symbol_info -#define osf_core_bfd_is_local_label _bfd_nosymbols_bfd_is_local_label +#define osf_core_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name #define osf_core_get_lineno _bfd_nosymbols_get_lineno #define osf_core_find_nearest_line _bfd_nosymbols_find_nearest_line #define osf_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff -urN binutils-2.7/bfd/peicode.h binutils-2.8/bfd/peicode.h --- binutils-2.7/bfd/peicode.h Thu Jul 4 12:19:52 1996 +++ binutils-2.8/bfd/peicode.h Wed Apr 30 12:56:22 1997 @@ -1,5 +1,5 @@ /* Support for the generic parts of most COFF variants, for BFD. - Copyright 1995, 1996 Free Software Foundation, Inc. + Copyright 1995, 1996, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -193,7 +193,31 @@ #define PUT_SCNHDR_LNNOPTR bfd_h_put_32 #endif - +static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR)); +static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int coff_swap_filehdr_out PARAMS ((bfd *, PTR, PTR)); +static void coff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int coff_swap_sym_out PARAMS ((bfd *, PTR, PTR)); +static void coff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +static unsigned int coff_swap_aux_out + PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +static void coff_swap_lineno_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int coff_swap_lineno_out PARAMS ((bfd *, PTR, PTR)); +static void coff_swap_aouthdr_in PARAMS ((bfd *, PTR, PTR)); +static void add_data_entry + PARAMS ((bfd *, struct internal_extra_pe_aouthdr *, int, char *, bfd_vma)); +static unsigned int coff_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR)); +static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int coff_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR)); +static boolean pe_print_idata PARAMS ((bfd *, PTR)); +static boolean pe_print_edata PARAMS ((bfd *, PTR)); +static boolean pe_print_pdata PARAMS ((bfd *, PTR)); +static boolean pe_print_reloc PARAMS ((bfd *, PTR)); +static boolean pe_print_private_bfd_data PARAMS ((bfd *, PTR)); +static boolean pe_mkobject PARAMS ((bfd *)); +static PTR pe_mkobject_hook PARAMS ((bfd *, PTR, PTR)); +static boolean pe_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *)); /**********************************************************************/ @@ -1177,8 +1201,8 @@ /**********************************************************************/ static boolean pe_print_idata(abfd, vfile) - bfd*abfd; - void *vfile; + bfd *abfd; + PTR vfile; { FILE *file = vfile; bfd_byte *data = 0; @@ -1388,9 +1412,9 @@ } static boolean -pe_print_edata(abfd, vfile) - bfd*abfd; - void *vfile; +pe_print_edata (abfd, vfile) + bfd *abfd; + PTR vfile; { FILE *file = vfile; bfd_byte *data = 0; @@ -1573,9 +1597,9 @@ } static boolean -pe_print_pdata(abfd, vfile) - bfd*abfd; - void *vfile; +pe_print_pdata (abfd, vfile) + bfd *abfd; + PTR vfile; { FILE *file = vfile; bfd_byte *data = 0; @@ -1697,9 +1721,9 @@ }; static boolean -pe_print_reloc(abfd, vfile) - bfd*abfd; - void *vfile; +pe_print_reloc (abfd, vfile) + bfd *abfd; + PTR vfile; { FILE *file = vfile; bfd_byte *data = 0; @@ -1928,6 +1952,10 @@ bfd *obfd; asection *osec; { + if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour + || bfd_get_flavour (obfd) != bfd_target_coff_flavour) + return true; + if (coff_section_data (ibfd, isec) != NULL && pei_section_data (ibfd, isec) != NULL) { diff -urN binutils-2.7/bfd/ppcboot.c binutils-2.8/bfd/ppcboot.c --- binutils-2.7/bfd/ppcboot.c Thu Jul 4 12:19:52 1996 +++ binutils-2.8/bfd/ppcboot.c Wed Apr 30 12:56:22 1997 @@ -1,5 +1,5 @@ /* BFD back-end for PPCbug boot records. - Copyright 1996 Free Software Foundation, Inc. + Copyright 1996, 1997 Free Software Foundation, Inc. Written by Michael Meissner, Cygnus Support, This file is part of BFD, the Binary File Descriptor library. @@ -85,6 +85,8 @@ static boolean ppcboot_mkobject PARAMS ((bfd *)); static const bfd_target *ppcboot_object_p PARAMS ((bfd *)); +static boolean ppcboot_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); static boolean ppcboot_get_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); static long ppcboot_get_symtab_upper_bound PARAMS ((bfd *)); @@ -95,6 +97,7 @@ static boolean ppcboot_set_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); static int ppcboot_sizeof_headers PARAMS ((bfd *, boolean)); +static boolean ppcboot_bfd_print_private_bfd_data PARAMS ((bfd *, PTR)); #define ppcboot_set_tdata(abfd, ptr) ((abfd)->tdata.any = (PTR) (ptr)) #define ppcboot_get_tdata(abfd) ((ppcboot_data_t *) ((abfd)->tdata.any)) @@ -113,7 +116,7 @@ /* Set the architecture to PowerPC */ -boolean +static boolean ppcboot_set_arch_mach (abfd, arch, machine) bfd *abfd; enum bfd_architecture arch; @@ -344,7 +347,7 @@ bfd_symbol_info (symbol, ret); } -#define ppcboot_bfd_is_local_label bfd_generic_is_local_label +#define ppcboot_bfd_is_local_label_name bfd_generic_is_local_label_name #define ppcboot_get_lineno _bfd_nosymbols_get_lineno #define ppcboot_find_nearest_line _bfd_nosymbols_find_nearest_line #define ppcboot_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol @@ -356,10 +359,6 @@ #define ppcboot_canonicalize_reloc \ ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l) #define ppcboot_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup - -/* Set the architecture of a ppcboot file. */ -#define ppcboot_set_arch_mach ppcboot_set_arch_mach - /* Write section contents of a ppcboot file. */ @@ -405,15 +404,15 @@ /* Print out the program headers. */ -boolean +static boolean ppcboot_bfd_print_private_bfd_data (abfd, farg) bfd *abfd; PTR farg; { FILE *f = (FILE *)farg; ppcboot_data_t *tdata = ppcboot_get_tdata (abfd); - long entry_offset = bfd_getl_signed_32 ((PTR) &tdata->header.entry_offset); - long length = bfd_getl_signed_32 ((PTR) &tdata->header.length); + long entry_offset = bfd_getl_signed_32 ((PTR) tdata->header.entry_offset); + long length = bfd_getl_signed_32 ((PTR) tdata->header.length); int i; fprintf (f, "\nppcboot header:\n"); @@ -431,8 +430,8 @@ for (i = 0; i < 4; i++) { - long sector_begin = bfd_getl_signed_32 ((PTR) &tdata->header.partition[i].sector_begin); - long sector_length = bfd_getl_signed_32 ((PTR) &tdata->header.partition[i].sector_length); + long sector_begin = bfd_getl_signed_32 ((PTR) tdata->header.partition[i].sector_begin); + long sector_length = bfd_getl_signed_32 ((PTR) tdata->header.partition[i].sector_length); /* Skip all 0 entries */ if (!tdata->header.partition[i].partition_begin.ind diff -urN binutils-2.7/bfd/ptrace-core.c binutils-2.8/bfd/ptrace-core.c --- binutils-2.7/bfd/ptrace-core.c Thu Jul 4 12:19:52 1996 +++ binutils-2.8/bfd/ptrace-core.c Wed Apr 30 12:56:22 1997 @@ -57,6 +57,7 @@ int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd)); boolean ptrace_unix_core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd)); +static void swap_abort PARAMS ((void)); /* ARGSUSED */ const bfd_target * @@ -172,7 +173,7 @@ } /* If somebody calls any byte-swapping routines, shoot them. */ -void +static void swap_abort() { abort(); /* This way doesn't require any declaration for ANSI to fuck up */ diff -urN binutils-2.7/bfd/reloc.c binutils-2.8/bfd/reloc.c --- binutils-2.7/bfd/reloc.c Thu Jul 4 12:30:39 1996 +++ binutils-2.8/bfd/reloc.c Wed Apr 30 12:56:23 1997 @@ -1,5 +1,6 @@ /* BFD support for handling relocation entries. - Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -138,7 +139,7 @@ type which modifies the bottom two bytes of a four byte word would not touch the first byte pointed to in a big endian world. - + o <> The <> is a value provided by the back end to be added (!) @@ -288,7 +289,7 @@ . .struct reloc_howto_struct .{ -. {* The type field has mainly a documetary use - the back end can +. {* The type field has mainly a documentary use - the back end can . do what it wants with it, though normally the back end's . external idea of what a reloc number is stored . in this field. For example, a PC relative word relocation @@ -428,6 +429,7 @@ case 2: return 4; case 3: return 0; case 4: return 8; + case 8: return 16; case -2: return 4; default: abort (); } @@ -871,20 +873,18 @@ break; case 1: - if (relocation) - { - short x = bfd_get_16 (abfd, (bfd_byte *) data + addr); - DOIT (x); - bfd_put_16 (abfd, x, (unsigned char *) data + addr); - } + { + short x = bfd_get_16 (abfd, (bfd_byte *) data + addr); + DOIT (x); + bfd_put_16 (abfd, x, (unsigned char *) data + addr); + } break; case 2: - if (relocation) - { - long x = bfd_get_32 (abfd, (bfd_byte *) data + addr); - DOIT (x); - bfd_put_32 (abfd, x, (bfd_byte *) data + addr); - } + { + long x = bfd_get_32 (abfd, (bfd_byte *) data + addr); + DOIT (x); + bfd_put_32 (abfd, x, (bfd_byte *) data + addr); + } break; case -2: { @@ -910,12 +910,11 @@ case 4: #ifdef BFD64 - if (relocation) - { - bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + addr); - DOIT (x); - bfd_put_64 (abfd, x, (bfd_byte *) data + addr); - } + { + bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + addr); + DOIT (x); + bfd_put_64 (abfd, x, (bfd_byte *) data + addr); + } #else abort (); #endif @@ -1075,12 +1074,12 @@ { /* This is a partial relocation, but inplace, so modify the reloc record a bit. - + If we've relocated with a symbol with a section, change into a ref to the section belonging to the symbol. */ - + reloc_entry->address += input_section->output_offset; - + /* WTF?? */ if (abfd->xvec->flavour == bfd_target_coff_flavour && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0 @@ -1092,10 +1091,10 @@ /* For m68k-coff, the addend was being subtracted twice during relocation with -r. Removing the line below this comment fixes that problem; see PR 2953. - + However, Ian wrote the following, regarding removing the line below, which explains why it is still enabled: --djm - + If you put a patch like that into BFD you need to check all the COFF linkers. I am fairly certain that patch will break coff-i386 (e.g., SCO); see coff_i386_reloc in coff-i386.c where I worked around the @@ -1331,20 +1330,18 @@ break; case 1: - if (relocation) - { - short x = bfd_get_16 (abfd, (bfd_byte *) data); - DOIT (x); - bfd_put_16 (abfd, x, (unsigned char *) data); - } + { + short x = bfd_get_16 (abfd, (bfd_byte *) data); + DOIT (x); + bfd_put_16 (abfd, x, (unsigned char *) data); + } break; case 2: - if (relocation) - { - long x = bfd_get_32 (abfd, (bfd_byte *) data); - DOIT (x); - bfd_put_32 (abfd, x, (bfd_byte *) data); - } + { + long x = bfd_get_32 (abfd, (bfd_byte *) data); + DOIT (x); + bfd_put_32 (abfd, x, (bfd_byte *) data); + } break; case -2: { @@ -1360,12 +1357,11 @@ break; case 4: - if (relocation) - { - bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data); - DOIT (x); - bfd_put_64 (abfd, x, (bfd_byte *) data); - } + { + bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data); + DOIT (x); + bfd_put_64 (abfd, x, (bfd_byte *) data); + } break; default: return bfd_reloc_other; @@ -1668,6 +1664,8 @@ ENUMX BFD_RELOC_26 ENUMX + BFD_RELOC_24 +ENUMX BFD_RELOC_16 ENUMX BFD_RELOC_14 @@ -1801,15 +1799,6 @@ ENUM - BFD_RELOC_SWREL32 -ENUMX - BFD_RELOC_SWREL64 -ENUMDOC - For openVMS/Alpha systems, these are displacements for switch -tables. - - -ENUM BFD_RELOC_I960_CALLJ ENUMDOC Reloc types used for i960/b.out. @@ -1918,6 +1907,8 @@ ENUM BFD_RELOC_ALPHA_LITERAL ENUMX + BFD_RELOC_ALPHA_ELF_LITERAL +ENUMX BFD_RELOC_ALPHA_LITUSE ENUMDOC The Alpha LITERAL/LITUSE relocs are produced by a symbol reference; @@ -1929,6 +1920,12 @@ in with the file's GP value on reading, for convenience, as with the GPDISP_LO16 reloc. + The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16. + It should refer to the symbol to be referenced, as with 16_GOTOFF, + but it generates output not based on the position within the .got + section, but relative to the GP value chosen for the file during the + final link stage. + The LITUSE reloc, on the instruction using the loaded address, gives information to the linker that it might be able to use to optimize away some literal section references. The symbol is ignored (read @@ -1950,13 +1947,14 @@ ENUM BFD_RELOC_ALPHA_LINKAGE ENUMDOC - The LINKAGE relocation outputs a special code in the object file, - the rest is handled by the linker. + The LINKAGE relocation outputs a linkage pair in the object file, + which is filled by the linker. ENUM - BFD_RELOC_ALPHA_BASEREG + BFD_RELOC_ALPHA_CODEADDR ENUMDOC - The BASEREG relocation calculates differences to basereg. + The CODEADDR relocation outputs a STO_CA in the object file, + which is filled by the linker. ENUM BFD_RELOC_MIPS_JMP @@ -1965,6 +1963,16 @@ simple reloc otherwise. ENUM + BFD_RELOC_MIPS16_JMP +ENUMDOC + The MIPS16 jump instruction. + +ENUM + BFD_RELOC_MIPS16_GPREL +ENUMDOC + MIPS16 GP relative reloc. + +ENUM BFD_RELOC_HI16 ENUMDOC High 16 bits of 32-bit value; simple reloc. @@ -2158,11 +2166,141 @@ BFD_RELOC_ARM_LITERAL ENUMX BFD_RELOC_ARM_IN_POOL +ENUMX + BFD_RELOC_ARM_OFFSET_IMM8 +ENUMX + BFD_RELOC_ARM_HWLITERAL +ENUMX + BFD_RELOC_ARM_THUMB_ADD +ENUMX + BFD_RELOC_ARM_THUMB_IMM +ENUMX + BFD_RELOC_ARM_THUMB_SHIFT +ENUMX + BFD_RELOC_ARM_THUMB_OFFSET ENUMDOC These relocs are only used within the ARM assembler. They are not (at present) written to any object files. +ENUM + BFD_RELOC_SH_PCDISP8BY2 +ENUMX + BFD_RELOC_SH_PCDISP12BY2 +ENUMX + BFD_RELOC_SH_IMM4 +ENUMX + BFD_RELOC_SH_IMM4BY2 +ENUMX + BFD_RELOC_SH_IMM4BY4 +ENUMX + BFD_RELOC_SH_IMM8 +ENUMX + BFD_RELOC_SH_IMM8BY2 +ENUMX + BFD_RELOC_SH_IMM8BY4 +ENUMX + BFD_RELOC_SH_PCRELIMM8BY2 +ENUMX + BFD_RELOC_SH_PCRELIMM8BY4 +ENUMX + BFD_RELOC_SH_SWITCH16 +ENUMX + BFD_RELOC_SH_SWITCH32 +ENUMX + BFD_RELOC_SH_USES +ENUMX + BFD_RELOC_SH_COUNT +ENUMX + BFD_RELOC_SH_ALIGN +ENUMX + BFD_RELOC_SH_CODE +ENUMX + BFD_RELOC_SH_DATA +ENUMX + BFD_RELOC_SH_LABEL +ENUMDOC + Hitachi SH relocs. Not all of these appear in object files. + +COMMENT + +COMMENT +ENUM + BFD_RELOC_D10V_10_PCREL_R +ENUMDOC + Mitsubishi D10V relocs. + This is a 10-bit reloc with the right 2 bits + assumed to be 0. +ENUM + BFD_RELOC_D10V_10_PCREL_L +ENUMDOC + Mitsubishi D10V relocs. + This is a 10-bit reloc with the right 2 bits + assumed to be 0. This is the same as the previous reloc + except it is in the left container, i.e., + shifted left 15 bits. +ENUM + BFD_RELOC_D10V_18 +ENUMDOC + This is an 18-bit reloc with the right 2 bits + assumed to be 0. +ENUM + BFD_RELOC_D10V_18_PCREL +ENUMDOC + This is an 18-bit reloc with the right 2 bits + assumed to be 0. +COMMENT + COMMENT + +ENUM + BFD_RELOC_M32R_24 +ENUMDOC + Mitsubishi M32R relocs. + This is a 24 bit absolute address. +ENUM + BFD_RELOC_M32R_10_PCREL +ENUMDOC + This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0. +ENUM + BFD_RELOC_M32R_18_PCREL +ENUMDOC + This is an 18-bit reloc with the right 2 bits assumed to be 0. +ENUM + BFD_RELOC_M32R_26_PCREL +ENUMDOC + This is a 26-bit reloc with the right 2 bits assumed to be 0. +ENUM + BFD_RELOC_M32R_HI16_ULO +ENUMDOC + This is a 16-bit reloc containing the high 16 bits of an address + used when the lower 16 bits are treated as unsigned. +ENUM + BFD_RELOC_M32R_HI16_SLO +ENUMDOC + This is a 16-bit reloc containing the high 16 bits of an address + used when the lower 16 bits are treated as signed. +ENUM + BFD_RELOC_M32R_LO16 +ENUMDOC + This is a 16-bit reloc containing the lower 16 bits of an address. +ENUM + BFD_RELOC_M32R_SDA16 +ENUMDOC + This is a 16-bit reloc containing the small data area offset for use in + add3, load, and store instructions. + +COMMENT + +ENUM + BFD_RELOC_MN10300_32_PCREL +ENUMDOC + This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the + instruction. +ENUM + BFD_RELOC_MN10300_16_PCREL +ENUMDOC + This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the + instruction. ENDSENUM BFD_RELOC_UNUSED CODE_FRAGMENT diff -urN binutils-2.7/bfd/reloc16.c binutils-2.8/bfd/reloc16.c --- binutils-2.7/bfd/reloc16.c Thu Jul 4 12:19:56 1996 +++ binutils-2.8/bfd/reloc16.c Wed Apr 30 12:56:23 1997 @@ -1,5 +1,5 @@ /* 8 and 16 bit COFF relocation functions, for BFD. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -36,7 +36,6 @@ #include "bfd.h" #include "sysdep.h" -#include "obstack.h" #include "libbfd.h" #include "bfdlink.h" #include "genlink.h" @@ -223,11 +222,12 @@ } } while (another_pass); + + free((char *)shrinks); } input_section->_cooked_size -= shrink; free((char *)reloc_vector); - free((char *)shrinks); return true; } diff -urN binutils-2.7/bfd/riscix.c binutils-2.8/bfd/riscix.c --- binutils-2.7/bfd/riscix.c Thu Jul 4 12:19:57 1996 +++ binutils-2.8/bfd/riscix.c Wed Apr 30 12:56:23 1997 @@ -1,5 +1,5 @@ /* BFD back-end for RISC iX (Acorn, arm) binaries. - Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) This file is part of BFD, the Binary File Descriptor library. @@ -89,7 +89,6 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "assert.h" #define WRITE_HEADERS(abfd, execp) \ { \ @@ -267,6 +266,7 @@ #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define MY_final_link_callback should_not_be_used #define MY_bfd_final_link _bfd_generic_final_link #define MY_bfd_reloc_type_lookup riscix_reloc_type_lookup @@ -453,7 +453,7 @@ for (count = 0; count++ < section->reloc_count;) { c = tblptr->howto - NAME(aout,std_howto_table); - assert (c < RISCIX_TABLE_SIZE); + BFD_ASSERT (c < RISCIX_TABLE_SIZE); tblptr->howto = &riscix_std_reloc_howto[c]; *relptr++ = tblptr++; @@ -496,7 +496,7 @@ execp = abfd->tdata.aout_data->a.hdr; /* Set the file flags */ - abfd->flags = NO_FLAGS; + abfd->flags = BFD_NO_FLAGS; if (execp->a_drsize || execp->a_trsize) abfd->flags |= HAS_RELOC; /* Setting of EXEC_P has been deferred to the bottom of this function */ diff -urN binutils-2.7/bfd/rs6000-core.c binutils-2.8/bfd/rs6000-core.c --- binutils-2.7/bfd/rs6000-core.c Thu Jul 4 12:19:58 1996 +++ binutils-2.8/bfd/rs6000-core.c Wed Apr 30 12:56:23 1997 @@ -1,5 +1,5 @@ /* IBM RS/6000 "XCOFF" back-end for BFD. - Copyright (C) 1990, 1991, 1995 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. FIXME: Can someone provide a transliteration of this name into ASCII? Using the following chars caused a compiler warning on HIUX (so I replaced them with octal escapes), and isn't useful without an understanding of what @@ -288,33 +288,72 @@ bfd *core_bfd; bfd *exec_bfd; { - FILE *fd; struct core_dump coredata; struct ld_info ldinfo; - char pathname [1024]; + int size; + char *path, *s; + size_t alloc; const char *str1, *str2; + boolean ret; - /* Use bfd_xxx routines, rather than O/S primitives, do error checking!! - FIXMEmgo */ - /* Actually should be able to use bfd_get_section_contents now that - we have a .ldinfo section. */ - fd = fopen (core_bfd->filename, FOPEN_RB); - - fread (&coredata, sizeof (struct core_dump), 1, fd); - fseek (fd, (long)coredata.c_tab, 0); - fread (&ldinfo, (char*)&ldinfo.ldinfo_filename[0] - (char*)&ldinfo.ldinfo_next, - 1, fd); - fscanf (fd, "%s", pathname); + if (bfd_seek (core_bfd, 0, SEEK_SET) != 0 + || bfd_read (&coredata, sizeof coredata, 1, core_bfd) != sizeof coredata) + return false; + + if (bfd_seek (core_bfd, (long) coredata.c_tab, SEEK_SET) != 0) + return false; + + size = (char *) &ldinfo.ldinfo_filename[0] - (char *) &ldinfo.ldinfo_next; + if (bfd_read (&ldinfo, size, 1, core_bfd) != size) + return false; + + alloc = 100; + path = bfd_malloc (alloc); + if (path == NULL) + return false; + s = path; + + while (1) + { + if (bfd_read (s, 1, 1, core_bfd) != 1) + { + free (path); + return false; + } + if (*s == '\0') + break; + ++s; + if (s == path + alloc) + { + char *n; + + alloc *= 2; + n = bfd_realloc (path, alloc); + if (n == NULL) + { + free (path); + return false; + } + s = n + (path - s); + path = n; + } + } - str1 = strrchr (pathname, '/'); + str1 = strrchr (path, '/'); str2 = strrchr (exec_bfd->filename, '/'); /* step over character '/' */ - str1 = str1 ? str1+1 : &pathname[0]; - str2 = str2 ? str2+1 : exec_bfd->filename; + str1 = str1 != NULL ? str1 + 1 : path; + str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename; + + if (strcmp (str1, str2) == 0) + ret = true; + else + ret = false; + + free (path); - fclose (fd); - return strcmp (str1, str2) == 0; + return ret; } char * diff -urN binutils-2.7/bfd/section.c binutils-2.8/bfd/section.c --- binutils-2.7/bfd/section.c Thu Jul 4 12:19:59 1996 +++ binutils-2.8/bfd/section.c Wed Apr 30 12:56:23 1997 @@ -1,5 +1,6 @@ /* Object file "section" support for the BFD library. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -297,6 +298,12 @@ . contents. *} .#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000 . +. {* This section was created by the linker as part of dynamic +. relocation or other arcane processing. It is skipped when +. going through the first-pass output, trusting that someone +. else up the line will take care of it later. *} +.#define SEC_LINKER_CREATED 0x800000 +. . {* End of section flags. *} . . {* Some internal packed boolean fields. *} @@ -552,7 +559,7 @@ o <> - If output has already started for this BFD. o <> - - If obstack alloc fails. + If memory allocation fails. */ @@ -584,7 +591,7 @@ Return <> and set <> on error; possible errors are: o <> - If output has already started for @var{abfd}. - o <> - If obstack alloc fails. + o <> - If memory allocation fails. */ sec_ptr @@ -1010,6 +1017,6 @@ Not enough memory exists to create private data for @var{osec}. .#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ -. BFD_SEND (ibfd, _bfd_copy_private_section_data, \ +. BFD_SEND (obfd, _bfd_copy_private_section_data, \ . (ibfd, isection, obfd, osection)) */ diff -urN binutils-2.7/bfd/som.c binutils-2.8/bfd/som.c --- binutils-2.7/bfd/som.c Thu Jul 4 12:20:04 1996 +++ binutils-2.8/bfd/som.c Wed Apr 30 12:56:23 1997 @@ -1,5 +1,5 @@ /* bfd back-end for HP PA-RISC SOM objects. - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996 + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Contributed by the Center for Software Science at the @@ -174,7 +174,7 @@ static boolean som_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *)); #define som_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data #define som_bfd_set_private_flags _bfd_generic_bfd_set_private_flags -static boolean som_bfd_is_local_label PARAMS ((bfd *, asymbol *)); +static boolean som_bfd_is_local_label_name PARAMS ((bfd *, const char *)); static boolean som_set_section_contents PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); static boolean som_get_section_contents PARAMS ((bfd *, sec_ptr, PTR, @@ -1438,17 +1438,18 @@ and a field selector, return one or more appropriate SOM relocations. */ int ** -hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff) +hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff, sym) bfd *abfd; int base_type; int format; enum hppa_reloc_field_selector_type_alt field; int sym_diff; + asymbol *sym; { int *final_type, **final_types; - final_types = (int **) bfd_alloc_by_size_t (abfd, sizeof (int *) * 6); - final_type = (int *) bfd_alloc_by_size_t (abfd, sizeof (int)); + final_types = (int **) bfd_alloc (abfd, sizeof (int *) * 6); + final_type = (int *) bfd_alloc (abfd, sizeof (int)); if (!final_types || !final_type) return NULL; @@ -1472,7 +1473,7 @@ case e_tsel: case e_ltsel: case e_rtsel: - final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); if (!final_types[0]) return NULL; if (field == e_tsel) @@ -1488,7 +1489,7 @@ case e_lssel: case e_rssel: - final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_S_MODE; @@ -1499,7 +1500,7 @@ case e_lsel: case e_rsel: - final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_N_MODE; @@ -1510,7 +1511,7 @@ case e_ldsel: case e_rdsel: - final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_D_MODE; @@ -1521,7 +1522,7 @@ case e_lrsel: case e_rrsel: - final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_R_MODE; @@ -1531,7 +1532,7 @@ break; case e_nsel: - final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_N1SEL; @@ -1542,11 +1543,11 @@ case e_nlsel: case e_nlrsel: - final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_N0SEL; - final_types[1] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int)); + final_types[1] = (int *) bfd_alloc (abfd, sizeof (int)); if (!final_types[1]) return NULL; if (field == e_nlsel) @@ -1565,10 +1566,10 @@ /* The difference of two symbols needs *very* special handling. */ if (sym_diff) { - final_types[0] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int)); - final_types[1] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int)); - final_types[2] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int)); - final_types[3] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int)); + final_types[0] = (int *)bfd_alloc (abfd, sizeof (int)); + final_types[1] = (int *)bfd_alloc (abfd, sizeof (int)); + final_types[2] = (int *)bfd_alloc (abfd, sizeof (int)); + final_types[3] = (int *)bfd_alloc (abfd, sizeof (int)); if (!final_types[0] || !final_types[1] || !final_types[2]) return NULL; if (field == e_fsel) @@ -1604,10 +1605,33 @@ *final_type = R_DLT_REL; /* A relocation in the data space is always a full 32bits. */ else if (format == 32) - *final_type = R_DATA_ONE_SYMBOL; + { + *final_type = R_DATA_ONE_SYMBOL; + + /* If there's no SOM symbol type associated with this BFD + symbol, then set the symbol type to ST_DATA. + Only do this if the type is going to default later when + we write the object file. + + This is done so that the linker never encounters an + R_DATA_ONE_SYMBOL reloc involving an ST_CODE symbol. + + This allows the compiler to generate exception handling + tables. + + Note that one day we may need to also emit BEGIN_BRTAB and + END_BRTAB to prevent the linker from optimizing away insns + in exception handling regions. */ + if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_UNKNOWN + && (sym->flags & BSF_SECTION_SYM) == 0 + && (sym->flags & BSF_FUNCTION) == 0 + && ! bfd_is_com_section (sym->section)) + som_symbol_data (sym)->som_type = SYMBOL_TYPE_DATA; + } break; + case R_HPPA_GOTOFF: /* More PLABEL special cases. */ if (field == e_psel @@ -1620,10 +1644,10 @@ /* The difference of two symbols needs *very* special handling. */ if (sym_diff) { - final_types[0] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int)); - final_types[1] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int)); - final_types[2] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int)); - final_types[3] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int)); + final_types[0] = (int *)bfd_alloc (abfd, sizeof (int)); + final_types[1] = (int *)bfd_alloc (abfd, sizeof (int)); + final_types[2] = (int *)bfd_alloc (abfd, sizeof (int)); + final_types[3] = (int *)bfd_alloc (abfd, sizeof (int)); if (!final_types[0] || !final_types[1] || !final_types[2]) return NULL; if (field == e_fsel) @@ -1687,7 +1711,7 @@ return 0; /* Set BFD flags based on what information is available in the SOM. */ - abfd->flags = NO_FLAGS; + abfd->flags = BFD_NO_FLAGS; if (file_hdrp->symbol_total) abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; @@ -1990,18 +2014,24 @@ goto error_return; } - /* Yow! there is no subspace within the space which actually - has initialized information in it; this should never happen - as far as I know. */ + /* This can happen for a .o which defines symbols in otherwise + empty subspaces. */ if (!save_subspace.file_loc_init_value) - goto error_return; - - /* Setup the sizes for the space section based upon the info in the - last subspace of the space. */ - space_asect->_cooked_size = save_subspace.subspace_start - - space_asect->vma + save_subspace.subspace_length; - space_asect->_raw_size = save_subspace.file_loc_init_value - - space_asect->filepos + save_subspace.initialization_length; + { + space_asect->_cooked_size = 0; + space_asect->_raw_size = 0; + } + else + { + /* Setup the sizes for the space section based upon the info in the + last subspace of the space. */ + space_asect->_cooked_size = (save_subspace.subspace_start + - space_asect->vma + + save_subspace.subspace_length); + space_asect->_raw_size = (save_subspace.file_loc_init_value + - space_asect->filepos + + save_subspace.initialization_length); + } } /* Now that we've read in all the subspace records, we need to assign a target index to each subspace. */ @@ -3729,9 +3759,8 @@ info->arg_reloc = som_symbol_data (sym)->tc_data.hppa_arg_reloc; } - /* If the type is unknown at this point, it should be ST_DATA or - ST_CODE (function/ST_ENTRY symbols were handled as special - cases above). */ + /* For unknown symbols set the symbol's type based on the symbol's + section (ST_DATA for DATA sections, ST_CODE for CODE sections). */ else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_UNKNOWN) { if (sym->section->flags & SEC_CODE) @@ -3739,6 +3768,9 @@ else info->symbol_type = ST_DATA; } + + else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_UNKNOWN) + info->symbol_type = ST_DATA; /* From now on it's a very simple mapping. */ else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_ABSOLUTE) @@ -4217,11 +4249,11 @@ } static boolean -som_bfd_is_local_label (abfd, sym) +som_bfd_is_local_label_name (abfd, name) bfd *abfd; - asymbol *sym; + const char *name; { - return (sym->name[0] == 'L' && sym->name[1] == '$'); + return (name[0] == 'L' && name[1] == '$'); } /* Count or process variable-length SOM fixup records. diff -urN binutils-2.7/bfd/som.h binutils-2.8/bfd/som.h --- binutils-2.7/bfd/som.h Thu Jul 4 12:20:04 1996 +++ binutils-2.8/bfd/som.h Wed Apr 30 12:55:47 1997 @@ -222,5 +222,6 @@ void bfd_som_set_symbol_type PARAMS ((asymbol *, unsigned int)); boolean bfd_som_attach_aux_hdr PARAMS ((bfd *, int, char *)); int ** hppa_som_gen_reloc_type - PARAMS ((bfd *, int, int, enum hppa_reloc_field_selector_type_alt, int)); + PARAMS ((bfd *, int, int, enum hppa_reloc_field_selector_type_alt, + int, asymbol *)); #endif /* _SOM_H */ diff -urN binutils-2.7/bfd/sparclinux.c binutils-2.8/bfd/sparclinux.c --- binutils-2.7/bfd/sparclinux.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/sparclinux.c Wed Apr 30 12:56:28 1997 @@ -0,0 +1,770 @@ +/* BFD back-end for linux flavored sparc a.out binaries. + Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. */ + +#define TARGET_PAGE_SIZE 4096 +#define ZMAGIC_DISK_BLOCK_SIZE 1024 +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#define TEXT_START_ADDR 0x0 +#define N_SHARED_LIB(x) 0 +#define BYTES_IN_WORD 4 + +#define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_UNKNOWN) + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "aout/aout64.h" +#include "aout/stab_gnu.h" +#include "aout/ar.h" +#include "libaout.h" /* BFD a.out internal data structures */ + +#define DEFAULT_ARCH bfd_arch_sparc +#define MY(OP) CAT(sparclinux_,OP) +#define TARGETNAME "a.out-sparc-linux" + +extern const bfd_target MY(vec); + +/* We always generate QMAGIC files in preference to ZMAGIC files. It + would be possible to make this a linker option, if that ever + becomes important. */ + +static void MY_final_link_callback + PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); + +static boolean sparclinux_bfd_final_link + PARAMS ((bfd *abfd, struct bfd_link_info *info)); + +static boolean +sparclinux_bfd_final_link (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + obj_aout_subformat (abfd) = q_magic_format; + return NAME(aout,final_link) (abfd, info, MY_final_link_callback); +} + +#define MY_bfd_final_link sparclinux_bfd_final_link + +/* Set the machine type correctly. */ + +static boolean sparclinux_write_object_contents PARAMS ((bfd *abfd)); + +static boolean +sparclinux_write_object_contents (abfd) + bfd *abfd; +{ + struct external_exec exec_bytes; + struct internal_exec *execp = exec_hdr (abfd); + + N_SET_MACHTYPE (*execp, M_SPARC); + + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + + WRITE_HEADERS(abfd, execp); + + return true; +} + +#define MY_write_object_contents sparclinux_write_object_contents +/* Code to link against Linux a.out shared libraries. */ + +/* See if a symbol name is a reference to the global offset table. */ + +#ifndef GOT_REF_PREFIX +#define GOT_REF_PREFIX "__GOT_" +#endif + +#define IS_GOT_SYM(name) \ + (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0) + +/* See if a symbol name is a reference to the procedure linkage table. */ + +#ifndef PLT_REF_PREFIX +#define PLT_REF_PREFIX "__PLT_" +#endif + +#define IS_PLT_SYM(name) \ + (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0) + +/* This string is used to generate specialized error messages. */ + +#ifndef NEEDS_SHRLIB +#define NEEDS_SHRLIB "__NEEDS_SHRLIB_" +#endif + +/* This special symbol is a set vector that contains a list of + pointers to fixup tables. It will be present in any dynamicly + linked file. The linker generated fixup table should also be added + to the list, and it should always appear in the second slot (the + first one is a dummy with a magic number that is defined in + crt0.o). */ + +#ifndef SHARABLE_CONFLICTS +#define SHARABLE_CONFLICTS "__SHARABLE_CONFLICTS__" +#endif + +/* We keep a list of fixups. The terminology is a bit strange, but + each fixup contains two 32 bit numbers. A regular fixup contains + an address and a pointer, and at runtime we should store the + address at the location pointed to by the pointer. A builtin fixup + contains two pointers, and we should read the address using one + pointer and store it at the location pointed to by the other + pointer. Builtin fixups come into play when we have duplicate + __GOT__ symbols for the same variable. The builtin fixup will copy + the GOT pointer from one over into the other. */ + +struct fixup +{ + struct fixup *next; + struct linux_link_hash_entry *h; + bfd_vma value; + + /* Nonzero if this is a jump instruction that needs to be fixed, + zero if this is just a pointer */ + char jump; + + char builtin; +}; + +/* We don't need a special hash table entry structure, but we do need + to keep some information between linker passes, so we use a special + hash table. */ + +struct linux_link_hash_entry +{ + struct aout_link_hash_entry root; +}; + +struct linux_link_hash_table +{ + struct aout_link_hash_table root; + + /* First dynamic object found in link. */ + bfd *dynobj; + + /* Number of fixups. */ + size_t fixup_count; + + /* Number of builtin fixups. */ + size_t local_builtins; + + /* List of fixups. */ + struct fixup *fixup_list; +}; + +static struct bfd_hash_entry *linux_link_hash_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static struct bfd_link_hash_table *linux_link_hash_table_create + PARAMS ((bfd *)); +static struct fixup *new_fixup + PARAMS ((struct bfd_link_info *, struct linux_link_hash_entry *, + bfd_vma, int)); +static boolean linux_link_create_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static boolean linux_add_one_symbol + PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *, + bfd_vma, const char *, boolean, boolean, + struct bfd_link_hash_entry **)); +static boolean linux_tally_symbols + PARAMS ((struct linux_link_hash_entry *, PTR)); +static boolean linux_finish_dynamic_link + PARAMS ((bfd *, struct bfd_link_info *)); + +/* Routine to create an entry in an Linux link hash table. */ + +static struct bfd_hash_entry * +linux_link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct linux_link_hash_entry *ret = (struct linux_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct linux_link_hash_entry *) NULL) + ret = ((struct linux_link_hash_entry *) + bfd_hash_allocate (table, sizeof (struct linux_link_hash_entry))); + if (ret == NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct linux_link_hash_entry *) + NAME(aout,link_hash_newfunc) ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != NULL) + { + /* Set local fields; there aren't any. */ + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create a Linux link hash table. */ + +static struct bfd_link_hash_table * +linux_link_hash_table_create (abfd) + bfd *abfd; +{ + struct linux_link_hash_table *ret; + + ret = ((struct linux_link_hash_table *) + bfd_alloc (abfd, sizeof (struct linux_link_hash_table))); + if (ret == (struct linux_link_hash_table *) NULL) + return (struct bfd_link_hash_table *) NULL; + if (! NAME(aout,link_hash_table_init) (&ret->root, abfd, + linux_link_hash_newfunc)) + { + free (ret); + return (struct bfd_link_hash_table *) NULL; + } + + ret->dynobj = NULL; + ret->fixup_count = 0; + ret->local_builtins = 0; + ret->fixup_list = NULL; + + return &ret->root.root; +} + +/* Look up an entry in a Linux link hash table. */ + +#define linux_link_hash_lookup(table, string, create, copy, follow) \ + ((struct linux_link_hash_entry *) \ + aout_link_hash_lookup (&(table)->root, (string), (create), (copy),\ + (follow))) + +/* Traverse a Linux link hash table. */ + +#define linux_link_hash_traverse(table, func, info) \ + (aout_link_hash_traverse \ + (&(table)->root, \ + (boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \ + (info))) + +/* Get the Linux link hash table from the info structure. This is + just a cast. */ + +#define linux_hash_table(p) ((struct linux_link_hash_table *) ((p)->hash)) + +/* Store the information for a new fixup. */ + +static struct fixup * +new_fixup (info, h, value, builtin) + struct bfd_link_info *info; + struct linux_link_hash_entry *h; + bfd_vma value; + int builtin; +{ + struct fixup *f; + + f = (struct fixup *) bfd_hash_allocate (&info->hash->table, + sizeof (struct fixup)); + if (f == NULL) + return f; + f->next = linux_hash_table (info)->fixup_list; + linux_hash_table (info)->fixup_list = f; + f->h = h; + f->value = value; + f->builtin = builtin; + f->jump = 0; + ++linux_hash_table (info)->fixup_count; + return f; +} + +/* We come here once we realize that we are going to link to a shared + library. We need to create a special section that contains the + fixup table, and we ultimately need to add a pointer to this into + the set vector for SHARABLE_CONFLICTS. At this point we do not + know the size of the section, but that's OK - we just need to + create it for now. */ + +static boolean +linux_link_create_dynamic_sections (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + flagword flags; + register asection *s; + + /* Note that we set the SEC_IN_MEMORY flag. */ + flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY; + + /* We choose to use the name ".linux-dynamic" for the fixup table. + Why not? */ + s = bfd_make_section (abfd, ".linux-dynamic"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags) + || ! bfd_set_section_alignment (abfd, s, 2)) + return false; + s->_raw_size = 0; + s->contents = 0; + + return true; +} + +/* Function to add a single symbol to the linker hash table. This is + a wrapper around _bfd_generic_link_add_one_symbol which handles the + tweaking needed for dynamic linking support. */ + +static boolean +linux_add_one_symbol (info, abfd, name, flags, section, value, string, + copy, collect, hashp) + struct bfd_link_info *info; + bfd *abfd; + const char *name; + flagword flags; + asection *section; + bfd_vma value; + const char *string; + boolean copy; + boolean collect; + struct bfd_link_hash_entry **hashp; +{ + struct linux_link_hash_entry *h; + boolean insert; + + /* Look up and see if we already have this symbol in the hash table. + If we do, and the defining entry is from a shared library, we + need to create the dynamic sections. + + FIXME: What if abfd->xvec != info->hash->creator? We may want to + be able to link Linux a.out and ELF objects together, but serious + confusion is possible. */ + + insert = false; + + if (! info->relocateable + && linux_hash_table (info)->dynobj == NULL + && strcmp (name, SHARABLE_CONFLICTS) == 0 + && (flags & BSF_CONSTRUCTOR) != 0 + && abfd->xvec == info->hash->creator) + { + if (! linux_link_create_dynamic_sections (abfd, info)) + return false; + linux_hash_table (info)->dynobj = abfd; + insert = true; + } + + if (bfd_is_abs_section (section) + && abfd->xvec == info->hash->creator) + { + h = linux_link_hash_lookup (linux_hash_table (info), name, false, + false, false); + if (h != NULL + && (h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak)) + { + struct fixup *f; + + if (hashp != NULL) + *hashp = (struct bfd_link_hash_entry *) h; + + f = new_fixup (info, h, value, ! IS_PLT_SYM (name)); + if (f == NULL) + return false; + f->jump = IS_PLT_SYM (name); + + return true; + } + } + + /* Do the usual procedure for adding a symbol. */ + if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, + value, string, copy, collect, + hashp)) + return false; + + /* Insert a pointer to our table in the set vector. The dynamic + linker requires this information */ + if (insert) + { + asection *s; + + /* Here we do our special thing to add the pointer to the + dynamic section in the SHARABLE_CONFLICTS set vector. */ + s = bfd_get_section_by_name (linux_hash_table (info)->dynobj, + ".linux-dynamic"); + BFD_ASSERT (s != NULL); + + if (! (_bfd_generic_link_add_one_symbol + (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS, + BSF_GLOBAL | BSF_CONSTRUCTOR, s, 0, NULL, false, false, NULL))) + return false; + } + + return true; +} + +/* We will crawl the hash table and come here for every global symbol. + We will examine each entry and see if there are indications that we + need to add a fixup. There are two possible cases - one is where + you have duplicate definitions of PLT or GOT symbols - these will + have already been caught and added as "builtin" fixups. If we find + that the corresponding non PLT/GOT symbol is also present, we + convert it to a regular fixup instead. + + This function is called via linux_link_hash_traverse. */ + +static boolean +linux_tally_symbols (h, data) + struct linux_link_hash_entry *h; + PTR data; +{ + struct bfd_link_info *info = (struct bfd_link_info *) data; + struct fixup *f, *f1; + int is_plt; + struct linux_link_hash_entry *h1, *h2; + boolean exists; + + if (h->root.root.type == bfd_link_hash_undefined + && strncmp (h->root.root.root.string, NEEDS_SHRLIB, + sizeof NEEDS_SHRLIB - 1) == 0) + { + const char *name; + char *p; + char *alloc = NULL; + + name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1; + p = strrchr (name, '_'); + if (p != NULL) + alloc = (char *) bfd_malloc (strlen (name) + 1); + + if (p == NULL || alloc == NULL) + (*_bfd_error_handler) ("Output file requires shared library `%s'\n", + name); + else + { + strcpy (alloc, name); + p = strrchr (alloc, '_'); + *p++ = '\0'; + (*_bfd_error_handler) + ("Output file requires shared library `%s.so.%s'\n", + alloc, p); + free (alloc); + } + + abort (); + } + + /* If this symbol is not a PLT/GOT, we do not even need to look at + it. */ + is_plt = IS_PLT_SYM (h->root.root.root.string); + + if (is_plt || IS_GOT_SYM (h->root.root.root.string)) + { + /* Look up this symbol twice. Once just as a regular lookup, + and then again following all of the indirect links until we + reach a real symbol. */ + h1 = linux_link_hash_lookup (linux_hash_table (info), + (h->root.root.root.string + + sizeof PLT_REF_PREFIX - 1), + false, false, true); + /* h2 does not follow indirect symbols. */ + h2 = linux_link_hash_lookup (linux_hash_table (info), + (h->root.root.root.string + + sizeof PLT_REF_PREFIX - 1), + false, false, false); + + /* The real symbol must exist but if it is also an ABS symbol, + there is no need to have a fixup. This is because they both + came from the same library. If on the other hand, we had to + use an indirect symbol to get to the real symbol, we add the + fixup anyway, since there are cases where these symbols come + from different shared libraries */ + if (h1 != NULL + && (((h1->root.root.type == bfd_link_hash_defined + || h1->root.root.type == bfd_link_hash_defweak) + && ! bfd_is_abs_section (h1->root.root.u.def.section)) + || h2->root.root.type == bfd_link_hash_indirect)) + { + /* See if there is a "builtin" fixup already present + involving this symbol. If so, convert it to a regular + fixup. In the end, this relaxes some of the requirements + about the order of performing fixups. */ + exists = false; + for (f1 = linux_hash_table (info)->fixup_list; + f1 != NULL; + f1 = f1->next) + { + if ((f1->h != h && f1->h != h1) + || (! f1->builtin && ! f1->jump)) + continue; + if (f1->h == h1) + exists = true; + if (! exists + && bfd_is_abs_section (h->root.root.u.def.section)) + { + f = new_fixup (info, h1, f1->h->root.root.u.def.value, 0); + f->jump = is_plt; + } + f1->h = h1; + f1->jump = is_plt; + f1->builtin = 0; + exists = true; + } + if (! exists + && bfd_is_abs_section (h->root.root.u.def.section)) + { + f = new_fixup (info, h1, h->root.root.u.def.value, 0); + if (f == NULL) + { + /* FIXME: No way to return error. */ + abort (); + } + f->jump = is_plt; + } + } + + /* Quick and dirty way of stripping these symbols from the + symtab. */ + if (bfd_is_abs_section (h->root.root.u.def.section)) + h->root.written = true; + } + + return true; +} + +/* This is called to set the size of the .linux-dynamic section is. + It is called by the Linux linker emulation before_allocation + routine. We have finished reading all of the input files, and now + we just scan the hash tables to find out how many additional fixups + are required. */ + +boolean +bfd_sparclinux_size_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + struct fixup *f; + asection *s; + + if (output_bfd->xvec != &MY(vec)) + return true; + + /* First find the fixups... */ + linux_link_hash_traverse (linux_hash_table (info), + linux_tally_symbols, + (PTR) info); + + /* If there are builtin fixups, leave room for a marker. This is + used by the dynamic linker so that it knows that all that follow + are builtin fixups instead of regular fixups. */ + for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) + { + if (f->builtin) + { + ++linux_hash_table (info)->fixup_count; + ++linux_hash_table (info)->local_builtins; + break; + } + } + + if (linux_hash_table (info)->dynobj == NULL) + { + if (linux_hash_table (info)->fixup_count > 0) + abort (); + return true; + } + + /* Allocate memory for our fixup table. We will fill it in later. */ + s = bfd_get_section_by_name (linux_hash_table (info)->dynobj, + ".linux-dynamic"); + if (s != NULL) + { + s->_raw_size = 8 + linux_hash_table (info)->fixup_count * 8; + s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); + if (s->contents == NULL) + return false; + memset (s->contents, 0, (size_t) s->_raw_size); + } + + return true; +} + +/* We come here once we are ready to actually write the fixup table to + the output file. Scan the fixup tables and so forth and generate + the stuff we need. */ + +static boolean +linux_finish_dynamic_link (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + asection *s, *os, *is; + bfd_byte *fixup_table; + struct linux_link_hash_entry *h; + struct fixup *f; + unsigned int new_addr; + int section_offset; + unsigned int fixups_written; + + if (linux_hash_table (info)->dynobj == NULL) + return true; + + s = bfd_get_section_by_name (linux_hash_table (info)->dynobj, + ".linux-dynamic"); + BFD_ASSERT (s != NULL); + os = s->output_section; + fixups_written = 0; + +#ifdef LINUX_LINK_DEBUG + printf ("Fixup table file offset: %x VMA: %x\n", + os->filepos + s->output_offset, + os->vma + s->output_offset); +#endif + + fixup_table = s->contents; + bfd_put_32 (output_bfd, linux_hash_table (info)->fixup_count, fixup_table); + fixup_table += 4; + + /* Fill in fixup table. */ + for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) + { + if (f->builtin) + continue; + + if (f->h->root.root.type != bfd_link_hash_defined + && f->h->root.root.type != bfd_link_hash_defweak) + { + (*_bfd_error_handler) + ("Symbol %s not defined for fixups\n", + f->h->root.root.root.string); + continue; + } + + is = f->h->root.root.u.def.section; + section_offset = is->output_section->vma + is->output_offset; + new_addr = f->h->root.root.u.def.value + section_offset; + +#ifdef LINUX_LINK_DEBUG + printf ("Fixup(%d) %s: %x %x\n",f->jump, f->h->root.root.string, + new_addr, f->value); +#endif + + if (f->jump) + { + /* Relative address */ + new_addr = new_addr - (f->value + 5); + bfd_put_32 (output_bfd, new_addr, fixup_table); + fixup_table += 4; + bfd_put_32 (output_bfd, f->value + 1, fixup_table); + fixup_table += 4; + } + else + { + bfd_put_32 (output_bfd, new_addr, fixup_table); + fixup_table += 4; + bfd_put_32 (output_bfd, f->value, fixup_table); + fixup_table += 4; + } + ++fixups_written; + } + + if (linux_hash_table (info)->local_builtins != 0) + { + /* Special marker so we know to switch to the other type of fixup */ + bfd_put_32 (output_bfd, 0, fixup_table); + fixup_table += 4; + bfd_put_32 (output_bfd, 0, fixup_table); + fixup_table += 4; + ++fixups_written; + for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) + { + if (! f->builtin) + continue; + + if (f->h->root.root.type != bfd_link_hash_defined + && f->h->root.root.type != bfd_link_hash_defweak) + { + (*_bfd_error_handler) + ("Symbol %s not defined for fixups\n", + f->h->root.root.root.string); + continue; + } + + is = f->h->root.root.u.def.section; + section_offset = is->output_section->vma + is->output_offset; + new_addr = f->h->root.root.u.def.value + section_offset; + +#ifdef LINUX_LINK_DEBUG + printf ("Fixup(B) %s: %x %x\n", f->h->root.root.string, + new_addr, f->value); +#endif + + bfd_put_32 (output_bfd, new_addr, fixup_table); + fixup_table += 4; + bfd_put_32 (output_bfd, f->value, fixup_table); + fixup_table += 4; + ++fixups_written; + } + } + + if (linux_hash_table (info)->fixup_count != fixups_written) + { + (*_bfd_error_handler) ("Warning: fixup count mismatch\n"); + while (linux_hash_table (info)->fixup_count > fixups_written) + { + bfd_put_32 (output_bfd, 0, fixup_table); + fixup_table += 4; + bfd_put_32 (output_bfd, 0, fixup_table); + fixup_table += 4; + ++fixups_written; + } + } + + h = linux_link_hash_lookup (linux_hash_table (info), + "__BUILTIN_FIXUPS__", + false, false, false); + + if (h != NULL + && (h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak)) + { + is = h->root.root.u.def.section; + section_offset = is->output_section->vma + is->output_offset; + new_addr = h->root.root.u.def.value + section_offset; + +#ifdef LINUX_LINK_DEBUG + printf ("Builtin fixup table at %x\n", new_addr); +#endif + + bfd_put_32 (output_bfd, new_addr, fixup_table); + } + else + bfd_put_32 (output_bfd, 0, fixup_table); + + if (bfd_seek (output_bfd, os->filepos + s->output_offset, SEEK_SET) != 0) + return false; + + if (bfd_write ((PTR) s->contents, 1, s->_raw_size, output_bfd) + != s->_raw_size) + return false; + + return true; +} + +#define MY_bfd_link_hash_table_create linux_link_hash_table_create +#define MY_add_one_symbol linux_add_one_symbol +#define MY_finish_dynamic_link linux_finish_dynamic_link + +#define MY_zmagic_contiguous 1 + +#include "aout-target.h" diff -urN binutils-2.7/bfd/sparclynx.c binutils-2.8/bfd/sparclynx.c --- binutils-2.7/bfd/sparclynx.c Thu Jul 4 12:20:04 1996 +++ binutils-2.8/bfd/sparclynx.c Wed Apr 30 12:55:44 1997 @@ -1,5 +1,5 @@ /* BFD support for Sparc binaries under LynxOS. - Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -228,7 +228,7 @@ static CONST struct aout_backend_data sparclynx_aout_backend = { - 0, 1, 1, 0, sparclynx_set_sizes, 0, + 0, 1, 0, 1, 0, sparclynx_set_sizes, 0, 0, /* add_dynamic_symbols */ 0, /* add_one_symbol */ 0, /* link_dynamic_object */ diff -urN binutils-2.7/bfd/sparcnetbsd.c binutils-2.8/bfd/sparcnetbsd.c --- binutils-2.7/bfd/sparcnetbsd.c Thu Jul 4 12:20:04 1996 +++ binutils-2.8/bfd/sparcnetbsd.c Wed Apr 30 12:56:28 1997 @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/sparc a.out-ish binaries. - Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 94, 95, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -20,8 +20,9 @@ #define BYTES_IN_WORD 4 #define TARGET_IS_BIG_ENDIAN_P -#define TARGET_PAGE_SIZE 4096 -#define SEGMENT_SIZE 4096 +/* SPARC chips use either 4K or 8K pages, but object files always + assume 8K page alignment so they will work on either one. */ +#define TARGET_PAGE_SIZE 0x2000 #define DEFAULT_ARCH bfd_arch_sparc #define MACHTYPE_OK(mtype) ((mtype) == M_SPARC_NETBSD || (mtype) == M_UNKNOWN) diff -urN binutils-2.7/bfd/srec.c binutils-2.8/bfd/srec.c --- binutils-2.7/bfd/srec.c Thu Jul 4 12:20:05 1996 +++ binutils-2.8/bfd/srec.c Wed Apr 30 12:56:28 1997 @@ -1,5 +1,5 @@ /* BFD back-end for s-record objects. - Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . This file is part of BFD, the Binary File Descriptor library. @@ -109,6 +109,9 @@ #include "libiberty.h" #include +static void srec_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); +static void srec_print_symbol + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); static void srec_init PARAMS ((void)); static boolean srec_mkobject PARAMS ((bfd *)); static int srec_get_byte PARAMS ((bfd *, boolean *)); @@ -123,6 +126,20 @@ const bfd_byte *)); static boolean srec_write_header PARAMS ((bfd *)); static boolean srec_write_symbols PARAMS ((bfd *)); +static boolean srec_new_symbol PARAMS ((bfd *, const char *, bfd_vma)); +static boolean srec_get_section_contents + PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); +static boolean srec_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +static boolean srec_set_section_contents + PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); +static boolean internal_srec_write_object_contents PARAMS ((bfd *, int)); +static boolean srec_write_object_contents PARAMS ((bfd *)); +static boolean symbolsrec_write_object_contents PARAMS ((bfd *)); +static int srec_sizeof_headers PARAMS ((bfd *, boolean)); +static asymbol *srec_make_empty_symbol PARAMS ((bfd *)); +static long srec_get_symtab_upper_bound PARAMS ((bfd *)); +static long srec_get_symtab PARAMS ((bfd *, asymbol **)); /* Macros for converting between hex and binary. */ @@ -317,6 +334,7 @@ bfd_byte *buf = NULL; size_t bufsize = 0; asection *sec = NULL; + char *symbuf = NULL; if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) goto error_return; @@ -357,78 +375,107 @@ break; case ' ': - { - char *symname; - bfd_vma symval; + do + { + unsigned int alc; + char *p, *symname; + bfd_vma symval; + + /* Starting a symbol definition. */ + while ((c = srec_get_byte (abfd, &error)) != EOF + && (c == ' ' || c == '\t')) + ; - /* Starting a symbol definition. */ - while ((c = srec_get_byte (abfd, &error)) != EOF - && (c == ' ' || c == '\t')) - ; - if (c == EOF) - { - srec_bad_byte (abfd, lineno, c, error); - goto error_return; - } + if (c == '\n') + break; - obstack_1grow (&abfd->memory, c); - while ((c = srec_get_byte (abfd, &error)) != EOF - && ! isspace (c)) - obstack_1grow (&abfd->memory, c); - if (c == EOF) - { - srec_bad_byte (abfd, lineno, c, error); - goto error_return; - } + if (c == EOF) + { + srec_bad_byte (abfd, lineno, c, error); + goto error_return; + } - symname = obstack_finish (&abfd->memory); - if (symname == NULL) - { - bfd_set_error (bfd_error_no_memory); + alc = 10; + symbuf = (char *) bfd_malloc (alc + 1); + if (symbuf == NULL) goto error_return; - } - - while ((c = srec_get_byte (abfd, &error)) != EOF - && (c == ' ' || c == '\t')) - ; - if (c == EOF) - { - srec_bad_byte (abfd, lineno, c, error); + + p = symbuf; + + *p++ = c; + while ((c = srec_get_byte (abfd, &error)) != EOF + && ! isspace (c)) + { + if (p - symbuf >= alc) + { + char *n; + + alc *= 2; + n = (char *) bfd_realloc (symbuf, alc + 1); + if (n == NULL) + goto error_return; + p = n + (p - symbuf); + symbuf = n; + } + + *p++ = c; + } + + if (c == EOF) + { + srec_bad_byte (abfd, lineno, c, error); + goto error_return; + } + + *p++ = '\0'; + symname = bfd_alloc (abfd, p - symbuf); + if (symname == NULL) goto error_return; - } + strcpy (symname, symbuf); + free (symbuf); + symbuf = NULL; + + while ((c = srec_get_byte (abfd, &error)) != EOF + && (c == ' ' || c == '\t')) + ; + if (c == EOF) + { + srec_bad_byte (abfd, lineno, c, error); + goto error_return; + } - /* Skip a dollar sign before the hex value. */ - if (c == '$') - { - c = srec_get_byte (abfd, &error); - if (c == EOF) - { - srec_bad_byte (abfd, lineno, c, error); - goto error_return; - } - } + /* Skip a dollar sign before the hex value. */ + if (c == '$') + { + c = srec_get_byte (abfd, &error); + if (c == EOF) + { + srec_bad_byte (abfd, lineno, c, error); + goto error_return; + } + } - symval = 0; - while (ISHEX (c)) - { - symval <<= 4; - symval += NIBBLE (c); - c = srec_get_byte (abfd, &error); - } + symval = 0; + while (ISHEX (c)) + { + symval <<= 4; + symval += NIBBLE (c); + c = srec_get_byte (abfd, &error); + } - if (c == EOF || ! isspace (c)) - { - srec_bad_byte (abfd, lineno, c, error); + if (! srec_new_symbol (abfd, symname, symval)) goto error_return; - } + } + while (c == ' ' || c == '\t'); - if (! srec_new_symbol (abfd, symname, symval)) + if (c != '\n') + { + srec_bad_byte (abfd, lineno, c, error); goto error_return; + } - if (c == '\n') - ++lineno; + ++lineno; - } break; case 'S': @@ -564,6 +611,8 @@ return true; error_return: + if (symbuf != NULL) + free (symbuf); if (buf != NULL) free (buf); return false; @@ -1169,7 +1218,7 @@ } /*ARGSUSED*/ -void +static void srec_get_symbol_info (ignore_abfd, symbol, ret) bfd *ignore_abfd; asymbol *symbol; @@ -1179,7 +1228,7 @@ } /*ARGSUSED*/ -void +static void srec_print_symbol (ignore_abfd, afile, symbol, how) bfd *ignore_abfd; PTR afile; @@ -1205,7 +1254,7 @@ #define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #define srec_new_section_hook _bfd_generic_new_section_hook -#define srec_bfd_is_local_label bfd_generic_is_local_label +#define srec_bfd_is_local_label_name bfd_generic_is_local_label_name #define srec_get_lineno _bfd_nosymbols_get_lineno #define srec_find_nearest_line _bfd_nosymbols_find_nearest_line #define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff -urN binutils-2.7/bfd/stabs.c binutils-2.8/bfd/stabs.c --- binutils-2.7/bfd/stabs.c Thu Jul 4 12:20:05 1996 +++ binutils-2.8/bfd/stabs.c Wed Apr 30 12:56:28 1997 @@ -1,5 +1,5 @@ /* Stabs in sections linking support. - Copyright 1996 Free Software Foundation, Inc. + Copyright 1996, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -101,6 +101,16 @@ /* This is a linked list of N_BINCL symbols which should be converted into N_EXCL symbols. */ struct stab_excl_list *excls; + + /* This is used to map input stab offsets within their sections + to output stab offsets, to take into account stabs that have + been deleted. If it is NULL, the output offsets are the same + as the input offsets, because no stabs have been deleted from + this section. Otherwise the i'th entry is the number of + bytes of stabs that have been deleted prior to the i'th + stab. */ + bfd_size_type *cumulative_skips; + /* This is an array of string indices. For each stab symbol, we store the string index here. If a stab symbol should not be included in the final output, the string index is -1. */ @@ -166,6 +176,7 @@ asection *stabstrsec; PTR *psecinfo; { + boolean first; struct stab_info *sinfo; bfd_size_type count; struct stab_section_info *secinfo; @@ -196,10 +207,25 @@ return true; } + if ((stabsec->output_section != NULL + && bfd_is_abs_section (stabsec->output_section)) + || (stabstrsec->output_section != NULL + && bfd_is_abs_section (stabstrsec->output_section))) + { + /* At least one of the sections is being discarded from the + link, so we should just ignore them. */ + return true; + } + + first = false; + if (*psinfo == NULL) { /* Initialize the stabs information we need to keep track of. */ + first = true; *psinfo = (PTR) bfd_alloc (abfd, sizeof (struct stab_info)); + if (*psinfo == NULL) + goto error_return; sinfo = (struct stab_info *) *psinfo; sinfo->strings = _bfd_stringtab_init (); if (sinfo->strings == NULL) @@ -227,6 +253,7 @@ secinfo = (struct stab_section_info *) *psecinfo; secinfo->excls = NULL; + secinfo->cumulative_skips = NULL; memset (secinfo->stridxs, 0, count * sizeof (bfd_size_type)); /* Read the stabs information from abfd. */ @@ -268,12 +295,16 @@ if (type == 0) { /* Special type 0 stabs indicate the offset to the next - string table. We don't copy these into the output file. */ + string table. We only copy the very first one. */ stroff = next_stroff; next_stroff += bfd_get_32 (abfd, sym + 8); - *pstridx = (bfd_size_type) -1; - ++skip; - continue; + if (! first) + { + *pstridx = (bfd_size_type) -1; + ++skip; + continue; + } + first = false; } /* Store the string in the hash table, and record the index. */ @@ -351,6 +382,8 @@ /* Record this symbol, so that we can set the value correctly. */ ne = (struct stab_excl_list *) bfd_alloc (abfd, sizeof *ne); + if (ne == NULL) + goto error_return; ne->offset = sym - stabbuf; ne->val = val; ne->type = N_BINCL; @@ -411,7 +444,9 @@ } free (stabbuf); + stabbuf = NULL; free (stabstrbuf); + stabstrbuf = NULL; /* We need to set the section sizes such that the linker will compute the output section sizes correctly. We set the .stab @@ -426,6 +461,33 @@ stabstrsec->flags |= SEC_EXCLUDE; sinfo->stabstr->_cooked_size = _bfd_stringtab_size (sinfo->strings); + /* Calculate the `cumulative_skips' array now that stabs have been + deleted for this section. */ + + if (skip != 0) + { + bfd_size_type i, offset; + bfd_size_type *pskips; + + secinfo->cumulative_skips = + (bfd_size_type *) bfd_alloc (abfd, count * sizeof (bfd_size_type)); + if (secinfo->cumulative_skips == NULL) + goto error_return; + + pskips = secinfo->cumulative_skips; + pstridx = secinfo->stridxs; + offset = 0; + + for (i = 0; i < count; i++, pskips++, pstridx++) + { + *pskips = offset; + if (*pstridx == (bfd_size_type) -1) + offset += STABSIZE; + } + + BFD_ASSERT (offset != 0); + } + return true; error_return: @@ -440,17 +502,20 @@ contents. */ boolean -_bfd_write_section_stabs (output_bfd, stabsec, psecinfo, contents) +_bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents) bfd *output_bfd; + PTR *psinfo; asection *stabsec; PTR *psecinfo; bfd_byte *contents; { + struct stab_info *sinfo; struct stab_section_info *secinfo; struct stab_excl_list *e; bfd_byte *sym, *tosym, *symend; bfd_size_type *pstridx; + sinfo = (struct stab_info *) *psinfo; secinfo = (struct stab_section_info *) *psecinfo; if (secinfo == NULL) @@ -482,6 +547,21 @@ if (tosym != sym) memcpy (tosym, sym, STABSIZE); bfd_put_32 (output_bfd, *pstridx, tosym + STRDXOFF); + + if (sym[TYPEOFF] == 0) + { + /* This is the header symbol for the stabs section. We + don't really need one, since we have merged all the + input stabs sections into one, but we generate one + for the benefit of readers which expect to see one. */ + BFD_ASSERT (sym == contents); + bfd_put_32 (output_bfd, _bfd_stringtab_size (sinfo->strings), + tosym + VALOFF); + bfd_put_16 (output_bfd, + stabsec->output_section->_raw_size / STABSIZE - 1, + tosym + DESCOFF); + } + tosym += STABSIZE; } } @@ -525,4 +605,41 @@ bfd_hash_table_free (&sinfo->includes.root); return true; +} + +/* Adjust an address in the .stab section. Given OFFSET within + STABSEC, this returns the new offset in the adjusted stab section, + or -1 if the address refers to a stab which has been removed. */ + +bfd_vma +_bfd_stab_section_offset (output_bfd, psinfo, stabsec, psecinfo, offset) + bfd *output_bfd; + PTR *psinfo; + asection *stabsec; + PTR *psecinfo; + bfd_vma offset; +{ + struct stab_section_info *secinfo; + + secinfo = (struct stab_section_info *) *psecinfo; + + if (secinfo == NULL) + return offset; + + if (offset >= stabsec->_raw_size) + return offset - (stabsec->_cooked_size - stabsec->_raw_size); + + if (secinfo->cumulative_skips) + { + bfd_vma i; + + i = offset / STABSIZE; + + if (secinfo->stridxs [i] == (bfd_size_type) -1) + return (bfd_vma) -1; + + return offset - secinfo->cumulative_skips [i]; + } + + return offset; } diff -urN binutils-2.7/bfd/sunos.c binutils-2.8/bfd/sunos.c --- binutils-2.7/bfd/sunos.c Thu Jul 4 12:20:07 1996 +++ binutils-2.8/bfd/sunos.c Wed Apr 30 12:56:28 1997 @@ -650,6 +650,9 @@ /* Whether we need the dynamic sections. */ boolean dynamic_sections_needed; + /* Whether we need the .got table. */ + boolean got_needed; + /* The number of dynamic symbols. */ size_t dynsymcount; @@ -659,6 +662,9 @@ /* The list of dynamic objects needed by dynamic objects included in the link. */ struct bfd_link_needed_list *needed; + + /* The offset of __GLOBAL_OFFSET_TABLE_ into the .got section. */ + bfd_vma got_base; }; /* Routine to create an entry in an SunOS link hash table. */ @@ -718,9 +724,11 @@ ret->dynobj = NULL; ret->dynamic_sections_created = false; ret->dynamic_sections_needed = false; + ret->got_needed = false; ret->dynsymcount = 0; ret->bucketcount = 0; ret->needed = NULL; + ret->got_base = 0; return &ret->root.root; } @@ -831,16 +839,19 @@ sunos_hash_table (info)->dynamic_sections_created = true; } - if (needed && ! sunos_hash_table (info)->dynamic_sections_needed) + if ((needed && ! sunos_hash_table (info)->dynamic_sections_needed) + || info->shared) { bfd *dynobj; dynobj = sunos_hash_table (info)->dynobj; s = bfd_get_section_by_name (dynobj, ".got"); - s->_raw_size = BYTES_IN_WORD; + if (s->_raw_size == 0) + s->_raw_size = BYTES_IN_WORD; sunos_hash_table (info)->dynamic_sections_needed = true; + sunos_hash_table (info)->got_needed = true; } return true; @@ -863,12 +874,15 @@ unsigned long need; /* Make sure we have all the required sections. */ - if (! sunos_create_dynamic_sections (abfd, info, - (((abfd->flags & DYNAMIC) != 0 - && ! info->relocateable) - ? true - : false))) - return false; + if (info->hash->creator == abfd->xvec) + { + if (! sunos_create_dynamic_sections (abfd, info, + (((abfd->flags & DYNAMIC) != 0 + && ! info->relocateable) + ? true + : false))) + return false; + } /* There is nothing else to do for a normal object. */ if ((abfd->flags & DYNAMIC) == 0) @@ -950,7 +964,10 @@ unsigned long name, flags; unsigned short major_vno, minor_vno; struct bfd_link_needed_list *needed, **pp; + char *namebuf, *p; + size_t alc; bfd_byte b; + char *namecopy; if (bfd_seek (abfd, need, SEEK_SET) != 0 || bfd_read (buf, 1, 16, abfd) != 16) @@ -961,8 +978,8 @@ name = bfd_get_32 (abfd, buf); flags = bfd_get_32 (abfd, buf + 4); - major_vno = bfd_get_16 (abfd, buf + 8); - minor_vno = bfd_get_16 (abfd, buf + 10); + major_vno = (unsigned short)bfd_get_16 (abfd, buf + 8); + minor_vno = (unsigned short)bfd_get_16 (abfd, buf + 10); need = bfd_get_32 (abfd, buf + 12); needed = ((struct bfd_link_needed_list *) @@ -972,33 +989,91 @@ needed->by = abfd; /* We return the name as [-l]name[.maj][.min]. */ + alc = 30; + namebuf = (char *) bfd_malloc (alc + 1); + if (namebuf == NULL) + return false; + p = namebuf; if ((flags & 0x80000000) != 0) - bfd_alloc_grow (abfd, "-l", 2); + { + *p++ = '-'; + *p++ = 'l'; + } if (bfd_seek (abfd, name, SEEK_SET) != 0) - return false; + { + free (namebuf); + return false; + } + do { if (bfd_read (&b, 1, 1, abfd) != 1) - return false; - bfd_alloc_grow (abfd, &b, 1); + { + free (namebuf); + return false; + } + + if (p - namebuf >= alc) + { + char *n; + + alc *= 2; + n = (char *) bfd_realloc (namebuf, alc + 1); + if (n == NULL) + { + free (namebuf); + return false; + } + p = n + (p - namebuf); + namebuf = n; + } + + *p++ = b; } while (b != '\0'); - if (major_vno != 0) + + if (major_vno == 0) + *p = '\0'; + else { - char verbuf[30]; + char majbuf[30]; + char minbuf[30]; + + sprintf (majbuf, ".%d", major_vno); + if (minor_vno == 0) + minbuf[0] = '\0'; + else + sprintf (minbuf, ".%d", minor_vno); - sprintf (verbuf, ".%d", major_vno); - bfd_alloc_grow (abfd, verbuf, strlen (verbuf)); - if (minor_vno != 0) + if ((p - namebuf) + strlen (majbuf) + strlen (minbuf) >= alc) { - sprintf (verbuf, ".%d", minor_vno); - bfd_alloc_grow (abfd, verbuf, strlen (verbuf)); + char *n; + + alc = (p - namebuf) + strlen (majbuf) + strlen (minbuf); + n = (char *) bfd_realloc (namebuf, alc + 1); + if (n == NULL) + { + free (namebuf); + return false; + } + p = n + (p - namebuf); + namebuf = n; } + + strcpy (p, majbuf); + strcat (p, minbuf); } - needed->name = bfd_alloc_finish (abfd); - if (needed->name == NULL) - return false; + + namecopy = bfd_alloc (abfd, strlen (namebuf) + 1); + if (namecopy == NULL) + { + free (namebuf); + return false; + } + strcpy (namecopy, namebuf); + free (namebuf); + needed->name = namecopy; needed->next = NULL; @@ -1238,6 +1313,9 @@ *sneedptr = NULL; *srulesptr = NULL; + if (info->relocateable) + return true; + if (output_bfd->xvec != &MY(vec)) return true; @@ -1264,7 +1342,8 @@ /* If there were no dynamic objects in the link, and we don't need to build a global offset table, there is nothing to do here. */ - if (! sunos_hash_table (info)->dynamic_sections_needed) + if (! sunos_hash_table (info)->dynamic_sections_needed + && ! sunos_hash_table (info)->got_needed) return true; /* If __GLOBAL_OFFSET_TABLE_ was mentioned, define it. */ @@ -1280,83 +1359,103 @@ } h->root.root.type = bfd_link_hash_defined; h->root.root.u.def.section = bfd_get_section_by_name (dynobj, ".got"); - h->root.root.u.def.value = 0; + + /* If the .got section is more than 0x1000 bytes, we set + __GLOBAL_OFFSET_TABLE_ to be 0x1000 bytes into the section, + so that 13 bit relocations have a greater chance of working. */ + s = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (s != NULL); + if (s->_raw_size >= 0x1000) + h->root.root.u.def.value = 0x1000; + else + h->root.root.u.def.value = 0; + + sunos_hash_table (info)->got_base = h->root.root.u.def.value; } - /* The .dynamic section is always the same size. */ - s = bfd_get_section_by_name (dynobj, ".dynamic"); - BFD_ASSERT (s != NULL); - s->_raw_size = (sizeof (struct external_sun4_dynamic) - + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE - + sizeof (struct external_sun4_dynamic_link)); - - /* Set the size of the .dynsym and .hash sections. We counted the - number of dynamic symbols as we read the input files. We will - build the dynamic symbol table (.dynsym) and the hash table - (.hash) when we build the final symbol table, because until then - we do not know the correct value to give the symbols. We build - the dynamic symbol string table (.dynstr) in a traversal of the - symbol table using sunos_scan_dynamic_symbol. */ - s = bfd_get_section_by_name (dynobj, ".dynsym"); - BFD_ASSERT (s != NULL); - s->_raw_size = dynsymcount * sizeof (struct external_nlist); - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return false; - - /* The number of buckets is just the number of symbols divided by - four. To compute the final size of the hash table, we must - actually compute the hash table. Normally we need exactly as - many entries in the hash table as there are dynamic symbols, but - if some of the buckets are not used we will need additional - entries. In the worst case, every symbol will hash to the same - bucket, and we will need BUCKETCOUNT - 1 extra entries. */ - if (dynsymcount >= 4) - bucketcount = dynsymcount / 4; - else if (dynsymcount > 0) - bucketcount = dynsymcount; - else - bucketcount = 1; - 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); - if (s->contents == NULL && dynsymcount > 0) - return false; - memset (s->contents, 0, 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; - - sunos_hash_table (info)->bucketcount = bucketcount; - - /* Scan all the symbols, place them in the dynamic symbol table, and - build the dynamic hash table. We reuse dynsymcount as a counter - for the number of symbols we have added so far. */ - sunos_hash_table (info)->dynsymcount = 0; - sunos_link_hash_traverse (sunos_hash_table (info), - sunos_scan_dynamic_symbol, - (PTR) info); - BFD_ASSERT (sunos_hash_table (info)->dynsymcount == dynsymcount); - - /* The SunOS native linker seems to align the total size of the - symbol strings to a multiple of 8. I don't know if this is - important, but it can't hurt much. */ - s = bfd_get_section_by_name (dynobj, ".dynstr"); - BFD_ASSERT (s != NULL); - if ((s->_raw_size & 7) != 0) + /* If there are any shared objects in the link, then we need to set + up the dynamic linking information. */ + if (sunos_hash_table (info)->dynamic_sections_needed) { - bfd_size_type add; - bfd_byte *contents; + *sdynptr = bfd_get_section_by_name (dynobj, ".dynamic"); - add = 8 - (s->_raw_size & 7); - contents = (bfd_byte *) bfd_realloc (s->contents, - (size_t) (s->_raw_size + add)); - if (contents == NULL) + /* The .dynamic section is always the same size. */ + s = *sdynptr; + BFD_ASSERT (s != NULL); + s->_raw_size = (sizeof (struct external_sun4_dynamic) + + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE + + sizeof (struct external_sun4_dynamic_link)); + + /* Set the size of the .dynsym and .hash sections. We counted + the number of dynamic symbols as we read the input files. We + will build the dynamic symbol table (.dynsym) and the hash + table (.hash) when we build the final symbol table, because + until then we do not know the correct value to give the + symbols. We build the dynamic symbol string table (.dynstr) + in a traversal of the symbol table using + sunos_scan_dynamic_symbol. */ + s = bfd_get_section_by_name (dynobj, ".dynsym"); + BFD_ASSERT (s != NULL); + s->_raw_size = dynsymcount * sizeof (struct external_nlist); + s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) return false; - memset (contents + s->_raw_size, 0, (size_t) add); - s->contents = contents; - s->_raw_size += add; + + /* The number of buckets is just the number of symbols divided + by four. To compute the final size of the hash table, we + must actually compute the hash table. Normally we need + exactly as many entries in the hash table as there are + dynamic symbols, but if some of the buckets are not used we + will need additional entries. In the worst case, every + symbol will hash to the same bucket, and we will need + BUCKETCOUNT - 1 extra entries. */ + if (dynsymcount >= 4) + bucketcount = dynsymcount / 4; + else if (dynsymcount > 0) + bucketcount = dynsymcount; + else + bucketcount = 1; + 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); + if (s->contents == NULL && dynsymcount > 0) + return false; + memset (s->contents, 0, 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; + + sunos_hash_table (info)->bucketcount = bucketcount; + + /* Scan all the symbols, place them in the dynamic symbol table, + and build the dynamic hash table. We reuse dynsymcount as a + counter for the number of symbols we have added so far. */ + sunos_hash_table (info)->dynsymcount = 0; + sunos_link_hash_traverse (sunos_hash_table (info), + sunos_scan_dynamic_symbol, + (PTR) info); + BFD_ASSERT (sunos_hash_table (info)->dynsymcount == dynsymcount); + + /* The SunOS native linker seems to align the total size of the + symbol strings to a multiple of 8. I don't know if this is + important, but it can't hurt much. */ + s = bfd_get_section_by_name (dynobj, ".dynstr"); + BFD_ASSERT (s != NULL); + if ((s->_raw_size & 7) != 0) + { + bfd_size_type add; + bfd_byte *contents; + + add = 8 - (s->_raw_size & 7); + contents = (bfd_byte *) bfd_realloc (s->contents, + (size_t) (s->_raw_size + add)); + if (contents == NULL) + return false; + memset (contents + s->_raw_size, 0, (size_t) add); + s->contents = contents; + s->_raw_size += add; + } } /* Now that we have worked out the sizes of the procedure linkage @@ -1402,7 +1501,6 @@ if (s->contents == NULL) return false; - *sdynptr = bfd_get_section_by_name (dynobj, ".dynamic"); *sneedptr = bfd_get_section_by_name (dynobj, ".need"); *srulesptr = bfd_get_section_by_name (dynobj, ".rules"); @@ -1562,12 +1660,20 @@ if (dynobj == NULL) { - if (! sunos_create_dynamic_sections (abfd, info, true)) + asection *sgot; + + if (! sunos_create_dynamic_sections (abfd, info, false)) return false; dynobj = sunos_hash_table (info)->dynobj; splt = bfd_get_section_by_name (dynobj, ".plt"); srel = bfd_get_section_by_name (dynobj, ".dynrel"); BFD_ASSERT (splt != NULL && srel != NULL); + + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + if (sgot->_raw_size == 0) + sgot->_raw_size = BYTES_IN_WORD; + sunos_hash_table (info)->got_needed = true; } BFD_ASSERT ((h->flags & SUNOS_REF_REGULAR) != 0); @@ -1709,13 +1815,18 @@ { if (dynobj == NULL) { - if (! sunos_create_dynamic_sections (abfd, info, true)) + if (! sunos_create_dynamic_sections (abfd, info, false)) return false; dynobj = sunos_hash_table (info)->dynobj; splt = bfd_get_section_by_name (dynobj, ".plt"); sgot = bfd_get_section_by_name (dynobj, ".got"); srel = bfd_get_section_by_name (dynobj, ".dynrel"); BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); + + /* Make sure we have an initial entry in the .got table. */ + if (sgot->_raw_size == 0) + sgot->_raw_size = BYTES_IN_WORD; + sunos_hash_table (info)->got_needed = true; } if (r_extern) @@ -1822,13 +1933,18 @@ if (dynobj == NULL) { - if (! sunos_create_dynamic_sections (abfd, info, true)) + if (! sunos_create_dynamic_sections (abfd, info, false)) return false; dynobj = sunos_hash_table (info)->dynobj; splt = bfd_get_section_by_name (dynobj, ".plt"); sgot = bfd_get_section_by_name (dynobj, ".got"); srel = bfd_get_section_by_name (dynobj, ".dynrel"); BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); + + /* Make sure we have an initial entry in the .got table. */ + if (sgot->_raw_size == 0) + sgot->_raw_size = BYTES_IN_WORD; + sunos_hash_table (info)->got_needed = true; } BFD_ASSERT (r_type == RELOC_JMP_TBL @@ -2057,92 +2173,6 @@ asection *s; struct external_nlist *outsym; - if (h->dynindx < 0) - return true; - - switch (h->root.root.type) - { - default: - case bfd_link_hash_new: - abort (); - /* Avoid variable not initialized warnings. */ - return true; - case bfd_link_hash_undefined: - type = N_UNDF | N_EXT; - val = 0; - break; - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - { - asection *sec; - asection *output_section; - - sec = h->root.root.u.def.section; - output_section = sec->output_section; - BFD_ASSERT (bfd_is_abs_section (output_section) - || output_section->owner == output_bfd); - if (h->plt_offset != 0 - && (h->flags & SUNOS_DEF_REGULAR) == 0) - { - type = N_UNDF | N_EXT; - val = 0; - } - else - { - if (output_section == obj_textsec (output_bfd)) - type = (h->root.root.type == bfd_link_hash_defined - ? N_TEXT - : N_WEAKT); - else if (output_section == obj_datasec (output_bfd)) - type = (h->root.root.type == bfd_link_hash_defined - ? N_DATA - : N_WEAKD); - else if (output_section == obj_bsssec (output_bfd)) - type = (h->root.root.type == bfd_link_hash_defined - ? N_BSS - : N_WEAKB); - else - type = (h->root.root.type == bfd_link_hash_defined - ? N_ABS - : N_WEAKA); - type |= N_EXT; - val = (h->root.root.u.def.value - + output_section->vma - + sec->output_offset); - } - } - break; - case bfd_link_hash_common: - type = N_UNDF | N_EXT; - val = h->root.root.u.c.size; - break; - case bfd_link_hash_undefweak: - type = N_WEAKU; - val = 0; - break; - case bfd_link_hash_indirect: - case bfd_link_hash_warning: - /* FIXME: Ignore these for now. The circumstances under which - they should be written out are not clear to me. */ - return true; - } - - s = bfd_get_section_by_name (sunos_hash_table (info)->dynobj, ".dynsym"); - BFD_ASSERT (s != NULL); - outsym = ((struct external_nlist *) - (s->contents + h->dynindx * EXTERNAL_NLIST_SIZE)); - - bfd_h_put_8 (output_bfd, type, outsym->e_type); - bfd_h_put_8 (output_bfd, 0, outsym->e_other); - - /* FIXME: The native linker doesn't use 0 for desc. It seems to use - one less than the desc value in the shared library, although that - seems unlikely. */ - bfd_h_put_16 (output_bfd, 0, outsym->e_desc); - - PUT_WORD (output_bfd, h->dynstr_index, outsym->e_strx); - PUT_WORD (output_bfd, val, outsym->e_value); - /* If this symbol is in the procedure linkage table, fill in the table entry. */ if (h->plt_offset != 0) @@ -2211,6 +2241,7 @@ result of a JMP_TBL reloc from PIC compiled code. */ if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0) { + BFD_ASSERT (h->dynindx >= 0); BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) < s->_raw_size); p = s->contents + s->reloc_count * obj_reloc_entry_size (output_bfd); @@ -2222,17 +2253,17 @@ PUT_WORD (output_bfd, r_address, srel->r_address); if (bfd_header_big_endian (output_bfd)) { - srel->r_index[0] = h->dynindx >> 16; - srel->r_index[1] = h->dynindx >> 8; - srel->r_index[2] = h->dynindx; + srel->r_index[0] = (bfd_byte)(h->dynindx >> 16); + srel->r_index[1] = (bfd_byte)(h->dynindx >> 8); + srel->r_index[2] = (bfd_byte)(h->dynindx); srel->r_type[0] = (RELOC_STD_BITS_EXTERN_BIG | RELOC_STD_BITS_JMPTABLE_BIG); } else { - srel->r_index[2] = h->dynindx >> 16; - srel->r_index[1] = h->dynindx >> 8; - srel->r_index[0] = h->dynindx; + srel->r_index[2] = (bfd_byte)(h->dynindx >> 16); + srel->r_index[1] = (bfd_byte)(h->dynindx >> 8); + srel->r_index[0] = (bfd_byte)h->dynindx; srel->r_type[0] = (RELOC_STD_BITS_EXTERN_LITTLE | RELOC_STD_BITS_JMPTABLE_LITTLE); } @@ -2245,18 +2276,18 @@ PUT_WORD (output_bfd, r_address, erel->r_address); if (bfd_header_big_endian (output_bfd)) { - erel->r_index[0] = h->dynindx >> 16; - erel->r_index[1] = h->dynindx >> 8; - erel->r_index[2] = h->dynindx; + erel->r_index[0] = (bfd_byte)(h->dynindx >> 16); + erel->r_index[1] = (bfd_byte)(h->dynindx >> 8); + erel->r_index[2] = (bfd_byte)h->dynindx; erel->r_type[0] = (RELOC_EXT_BITS_EXTERN_BIG | (RELOC_JMP_SLOT << RELOC_EXT_BITS_TYPE_SH_BIG)); } else { - erel->r_index[2] = h->dynindx >> 16; - erel->r_index[1] = h->dynindx >> 8; - erel->r_index[0] = h->dynindx; + erel->r_index[2] = (bfd_byte)(h->dynindx >> 16); + erel->r_index[1] = (bfd_byte)(h->dynindx >> 8); + erel->r_index[0] = (bfd_byte)h->dynindx; erel->r_type[0] = (RELOC_EXT_BITS_EXTERN_LITTLE | (RELOC_JMP_SLOT << RELOC_EXT_BITS_TYPE_SH_LITTLE)); @@ -2268,6 +2299,96 @@ } } + /* If this is not a dynamic symbol, we don't have to do anything + else. We only check this after handling the PLT entry, because + we can have a PLT entry for a nondynamic symbol when linking PIC + compiled code from a regular object. */ + if (h->dynindx < 0) + return true; + + switch (h->root.root.type) + { + default: + case bfd_link_hash_new: + abort (); + /* Avoid variable not initialized warnings. */ + return true; + case bfd_link_hash_undefined: + type = N_UNDF | N_EXT; + val = 0; + break; + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + { + asection *sec; + asection *output_section; + + sec = h->root.root.u.def.section; + output_section = sec->output_section; + BFD_ASSERT (bfd_is_abs_section (output_section) + || output_section->owner == output_bfd); + if (h->plt_offset != 0 + && (h->flags & SUNOS_DEF_REGULAR) == 0) + { + type = N_UNDF | N_EXT; + val = 0; + } + else + { + if (output_section == obj_textsec (output_bfd)) + type = (h->root.root.type == bfd_link_hash_defined + ? N_TEXT + : N_WEAKT); + else if (output_section == obj_datasec (output_bfd)) + type = (h->root.root.type == bfd_link_hash_defined + ? N_DATA + : N_WEAKD); + else if (output_section == obj_bsssec (output_bfd)) + type = (h->root.root.type == bfd_link_hash_defined + ? N_BSS + : N_WEAKB); + else + type = (h->root.root.type == bfd_link_hash_defined + ? N_ABS + : N_WEAKA); + type |= N_EXT; + val = (h->root.root.u.def.value + + output_section->vma + + sec->output_offset); + } + } + break; + case bfd_link_hash_common: + type = N_UNDF | N_EXT; + val = h->root.root.u.c.size; + break; + case bfd_link_hash_undefweak: + type = N_WEAKU; + val = 0; + break; + case bfd_link_hash_indirect: + case bfd_link_hash_warning: + /* FIXME: Ignore these for now. The circumstances under which + they should be written out are not clear to me. */ + return true; + } + + s = bfd_get_section_by_name (sunos_hash_table (info)->dynobj, ".dynsym"); + BFD_ASSERT (s != NULL); + outsym = ((struct external_nlist *) + (s->contents + h->dynindx * EXTERNAL_NLIST_SIZE)); + + bfd_h_put_8 (output_bfd, type, outsym->e_type); + bfd_h_put_8 (output_bfd, 0, outsym->e_other); + + /* FIXME: The native linker doesn't use 0 for desc. It seems to use + one less than the desc value in the shared library, although that + seems unlikely. */ + bfd_h_put_16 (output_bfd, 0, outsym->e_desc); + + PUT_WORD (output_bfd, h->dynstr_index, outsym->e_strx); + PUT_WORD (output_bfd, val, outsym->e_value); + return true; } @@ -2439,9 +2560,9 @@ srel->r_address); if (bfd_header_big_endian (dynobj)) { - srel->r_index[0] = indx >> 16; - srel->r_index[1] = indx >> 8; - srel->r_index[2] = indx; + srel->r_index[0] = (bfd_byte)(indx >> 16); + srel->r_index[1] = (bfd_byte)(indx >> 8); + srel->r_index[2] = (bfd_byte)indx; if (h == NULL) srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_BIG; else @@ -2453,9 +2574,9 @@ } else { - srel->r_index[2] = indx >> 16; - srel->r_index[1] = indx >> 8; - srel->r_index[0] = indx; + srel->r_index[2] = (bfd_byte)(indx >> 16); + srel->r_index[1] = (bfd_byte)(indx >> 8); + srel->r_index[0] = (bfd_byte)indx; if (h == NULL) srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_LITTLE; else @@ -2478,9 +2599,9 @@ erel->r_address); if (bfd_header_big_endian (dynobj)) { - erel->r_index[0] = indx >> 16; - erel->r_index[1] = indx >> 8; - erel->r_index[2] = indx; + erel->r_index[0] = (bfd_byte)(indx >> 16); + erel->r_index[1] = (bfd_byte)(indx >> 8); + erel->r_index[2] = (bfd_byte)indx; if (h == NULL) erel->r_type[0] = RELOC_32 << RELOC_EXT_BITS_TYPE_SH_BIG; @@ -2491,9 +2612,9 @@ } else { - erel->r_index[2] = indx >> 16; - erel->r_index[1] = indx >> 8; - erel->r_index[0] = indx; + erel->r_index[2] = (bfd_byte)(indx >> 16); + erel->r_index[1] = (bfd_byte)(indx >> 8); + erel->r_index[0] = (bfd_byte)indx; if (h == NULL) erel->r_type[0] = RELOC_32 << RELOC_EXT_BITS_TYPE_SH_LITTLE; @@ -2512,7 +2633,9 @@ *got_offsetp |= 1; } - *relocationp = sgot->vma + (*got_offsetp &~ 1); + *relocationp = (sgot->vma + + (*got_offsetp &~ 1) + - sunos_hash_table (info)->got_base); /* There is nothing else to do for a base relative reloc. */ return true; @@ -2569,15 +2692,15 @@ srel->r_address); if (bfd_header_big_endian (dynobj)) { - srel->r_index[0] = indx >> 16; - srel->r_index[1] = indx >> 8; - srel->r_index[2] = indx; + srel->r_index[0] = (bfd_byte)(indx >> 16); + srel->r_index[1] = (bfd_byte)(indx >> 8); + srel->r_index[2] = (bfd_byte)indx; } else { - srel->r_index[2] = indx >> 16; - srel->r_index[1] = indx >> 8; - srel->r_index[0] = indx; + srel->r_index[2] = (bfd_byte)(indx >> 16); + srel->r_index[1] = (bfd_byte)(indx >> 8); + srel->r_index[0] = (bfd_byte)indx; } } else @@ -2592,15 +2715,15 @@ erel->r_address); if (bfd_header_big_endian (dynobj)) { - erel->r_index[0] = indx >> 16; - erel->r_index[1] = indx >> 8; - erel->r_index[2] = indx; + erel->r_index[0] = (bfd_byte)(indx >> 16); + erel->r_index[1] = (bfd_byte)(indx >> 8); + erel->r_index[2] = (bfd_byte)indx; } else { - erel->r_index[2] = indx >> 16; - erel->r_index[1] = indx >> 8; - erel->r_index[0] = indx; + erel->r_index[2] = (bfd_byte)(indx >> 16); + erel->r_index[1] = (bfd_byte)(indx >> 8); + erel->r_index[0] = (bfd_byte)indx; } } @@ -2623,10 +2746,9 @@ asection *o; asection *s; asection *sdyn; - struct external_sun4_dynamic esd; - struct external_sun4_dynamic_link esdl; - if (! sunos_hash_table (info)->dynamic_sections_needed) + if (! sunos_hash_table (info)->dynamic_sections_needed + && ! sunos_hash_table (info)->got_needed) return true; dynobj = sunos_hash_table (info)->dynobj; @@ -2663,7 +2785,7 @@ dynamic information, unless this is a shared library. */ s = bfd_get_section_by_name (dynobj, ".got"); BFD_ASSERT (s != NULL); - if (info->shared) + if (info->shared || sdyn->_raw_size == 0) PUT_WORD (dynobj, 0, s->contents); else PUT_WORD (dynobj, sdyn->output_section->vma + sdyn->output_offset, @@ -2683,90 +2805,98 @@ } } - /* Finish up the dynamic link information. */ - PUT_WORD (dynobj, (bfd_vma) 3, esd.ld_version); - PUT_WORD (dynobj, - sdyn->output_section->vma + sdyn->output_offset + sizeof esd, - esd.ldd); - PUT_WORD (dynobj, - (sdyn->output_section->vma - + sdyn->output_offset - + sizeof esd - + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE), - esd.ld); + if (sdyn->_raw_size > 0) + { + struct external_sun4_dynamic esd; + struct external_sun4_dynamic_link esdl; - if (! bfd_set_section_contents (abfd, sdyn->output_section, &esd, - sdyn->output_offset, sizeof esd)) - return false; + /* Finish up the dynamic link information. */ + PUT_WORD (dynobj, (bfd_vma) 3, esd.ld_version); + PUT_WORD (dynobj, + sdyn->output_section->vma + sdyn->output_offset + sizeof esd, + esd.ldd); + PUT_WORD (dynobj, + (sdyn->output_section->vma + + sdyn->output_offset + + sizeof esd + + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE), + esd.ld); + if (! bfd_set_section_contents (abfd, sdyn->output_section, &esd, + sdyn->output_offset, sizeof esd)) + return false; - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_loaded); + PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_loaded); - s = bfd_get_section_by_name (dynobj, ".need"); - if (s == NULL || s->_raw_size == 0) - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_need); - else - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_need); + s = bfd_get_section_by_name (dynobj, ".need"); + if (s == NULL || s->_raw_size == 0) + PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_need); + else + PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, + esdl.ld_need); - s = bfd_get_section_by_name (dynobj, ".rules"); - if (s == NULL || s->_raw_size == 0) - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_rules); - else - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_rules); + s = bfd_get_section_by_name (dynobj, ".rules"); + if (s == NULL || s->_raw_size == 0) + PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_rules); + else + PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, + esdl.ld_rules); - s = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->vma + s->output_offset, esdl.ld_got); + s = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (s != NULL); + PUT_WORD (dynobj, s->output_section->vma + s->output_offset, + esdl.ld_got); - s = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->vma + s->output_offset, esdl.ld_plt); - PUT_WORD (dynobj, s->_raw_size, esdl.ld_plt_sz); + s = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (s != NULL); + PUT_WORD (dynobj, s->output_section->vma + s->output_offset, + esdl.ld_plt); + PUT_WORD (dynobj, s->_raw_size, esdl.ld_plt_sz); - s = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (s != NULL); - BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) == s->_raw_size); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_rel); + s = bfd_get_section_by_name (dynobj, ".dynrel"); + BFD_ASSERT (s != NULL); + BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) + == s->_raw_size); + PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, + esdl.ld_rel); - s = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_hash); + s = bfd_get_section_by_name (dynobj, ".hash"); + BFD_ASSERT (s != NULL); + PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, + esdl.ld_hash); - s = bfd_get_section_by_name (dynobj, ".dynsym"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_stab); + s = bfd_get_section_by_name (dynobj, ".dynsym"); + BFD_ASSERT (s != NULL); + PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, + esdl.ld_stab); - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_stab_hash); + PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_stab_hash); - PUT_WORD (dynobj, (bfd_vma) sunos_hash_table (info)->bucketcount, - esdl.ld_buckets); + PUT_WORD (dynobj, (bfd_vma) sunos_hash_table (info)->bucketcount, + esdl.ld_buckets); - s = bfd_get_section_by_name (dynobj, ".dynstr"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_symbols); - PUT_WORD (dynobj, s->_raw_size, esdl.ld_symb_size); - - /* The size of the text area is the size of the .text section - rounded up to a page boundary. FIXME: Should the page size be - conditional on something? */ - PUT_WORD (dynobj, - BFD_ALIGN (obj_textsec (abfd)->_raw_size, 0x2000), - esdl.ld_text); + s = bfd_get_section_by_name (dynobj, ".dynstr"); + BFD_ASSERT (s != NULL); + PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, + esdl.ld_symbols); + PUT_WORD (dynobj, s->_raw_size, esdl.ld_symb_size); + + /* The size of the text area is the size of the .text section + rounded up to a page boundary. FIXME: Should the page size be + conditional on something? */ + PUT_WORD (dynobj, + BFD_ALIGN (obj_textsec (abfd)->_raw_size, 0x2000), + esdl.ld_text); - if (! bfd_set_section_contents (abfd, sdyn->output_section, &esdl, - (sdyn->output_offset - + sizeof esd - + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE), - sizeof esdl)) - return false; + if (! bfd_set_section_contents (abfd, sdyn->output_section, &esdl, + (sdyn->output_offset + + sizeof esd + + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE), + sizeof esdl)) + return false; - abfd->flags |= DYNAMIC; + abfd->flags |= DYNAMIC; + } return true; } diff -urN binutils-2.7/bfd/syms.c binutils-2.8/bfd/syms.c --- binutils-2.7/bfd/syms.c Thu Jul 4 12:20:08 1996 +++ binutils-2.8/bfd/syms.c Wed Apr 30 12:56:28 1997 @@ -1,5 +1,6 @@ /* Generic symbol-table support for the BFD library. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -87,7 +88,7 @@ | process_symbol (symbol_table[i]); | } - All storage for the symbols themselves is in an obstack + All storage for the symbols themselves is in an objalloc connected to the BFD; it is freed when the BFD is closed. @@ -307,6 +308,8 @@ #include "bfdlink.h" #include "aout/stab_gnu.h" +static char coff_section_type PARAMS ((const char *)); + /* DOCDD INODE @@ -340,8 +343,35 @@ DESCRIPTION Return true if the given symbol @var{sym} in the BFD @var{abfd} is a compiler generated local label, else return false. -.#define bfd_is_local_label(abfd, sym) \ -. BFD_SEND (abfd, _bfd_is_local_label,(abfd, sym)) +*/ + +boolean +bfd_is_local_label (abfd, sym) + bfd *abfd; + asymbol *sym; +{ + if ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0) + return false; + if (sym->name == NULL) + return false; + return bfd_is_local_label_name (abfd, sym->name); +} + +/* +FUNCTION + bfd_is_local_label_name + +SYNOPSIS + boolean bfd_is_local_label_name(bfd *abfd, const char *name); + +DESCRIPTION + Return true if a symbol with the name @var{name} in the BFD + @var{abfd} is a compiler generated local label, else return + false. This just checks whether the name has the form of a + local label. + +.#define bfd_is_local_label_name(abfd, name) \ +. BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) */ /* @@ -504,7 +534,7 @@ static char coff_section_type (s) - char *s; + const char *s; { CONST struct section_to_type *t; @@ -596,12 +626,6 @@ ret->name = symbol->name; } -void -bfd_symbol_is_absolute () -{ - abort (); -} - /* FUNCTION bfd_copy_private_symbol_data @@ -619,7 +643,7 @@ Not enough memory exists to create private data for @var{osec}. .#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ -. BFD_SEND (ibfd, _bfd_copy_private_symbol_data, \ +. BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ . (ibfd, isymbol, obfd, osymbol)) */ diff -urN binutils-2.7/bfd/sysdep.h binutils-2.8/bfd/sysdep.h --- binutils-2.7/bfd/sysdep.h Thu Jul 4 12:20:08 1996 +++ binutils-2.8/bfd/sysdep.h Wed Apr 30 12:56:28 1997 @@ -1,5 +1,5 @@ /* sysdep.h -- handle host dependencies for the BFD library - Copyright 1995 Free Software Foundation, Inc. + Copyright 1995, 1996 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -34,7 +34,7 @@ #include #include -#ifndef errno +#if !(defined(errno) || defined(_MSC_VER) && defined(_INC_ERRNO)) extern int errno; #endif @@ -46,7 +46,6 @@ #else extern char *strchr (); extern char *strrchr (); -extern char *strstr (); #endif #endif @@ -103,12 +102,24 @@ #define SEEK_CUR 1 #endif +#ifdef NEED_DECLARATION_STRSTR +extern char *strstr (); +#endif + #ifdef NEED_DECLARATION_MALLOC extern PTR malloc (); #endif +#ifdef NEED_DECLARATION_REALLOC +extern PTR realloc (); +#endif + #ifdef NEED_DECLARATION_FREE extern void free (); +#endif + +#ifdef NEED_DECLARATION_GETENV +extern char *getenv (); #endif #endif /* ! defined (BFD_SYSDEP_H) */ diff -urN binutils-2.7/bfd/targets.c binutils-2.8/bfd/targets.c --- binutils-2.7/bfd/targets.c Thu Jul 4 12:30:40 1996 +++ binutils-2.8/bfd/targets.c Wed Apr 30 12:56:28 1997 @@ -1,5 +1,5 @@ /* Generic target-file-type support for the BFD library. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -21,6 +21,7 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" +#include "fnmatch.h" /* SECTION @@ -179,7 +180,7 @@ . enum bfd_endian header_byteorder; A mask of all the flags which an executable may have set - -from the set <>, <>, ...<>. +from the set <>, <>, ...<>. . flagword object_flags; @@ -339,7 +340,7 @@ .CAT(NAME,_make_empty_symbol),\ .CAT(NAME,_print_symbol),\ .CAT(NAME,_get_symbol_info),\ -.CAT(NAME,_bfd_is_local_label),\ +.CAT(NAME,_bfd_is_local_label_name),\ .CAT(NAME,_get_lineno),\ .CAT(NAME,_find_nearest_line),\ .CAT(NAME,_bfd_make_debug_symbol),\ @@ -358,7 +359,7 @@ . struct symbol_cache_entry *, . symbol_info *)); .#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e)) -. boolean (*_bfd_is_local_label) PARAMS ((bfd *, asymbol *)); +. boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *)); . . alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); . boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd, @@ -485,23 +486,31 @@ extern const bfd_target bfd_elf32_big_generic_vec; extern const bfd_target bfd_elf32_bigmips_vec; extern const bfd_target bfd_elf64_bigmips_vec; +extern const bfd_target bfd_elf32_d10v_vec; extern const bfd_target bfd_elf32_hppa_vec; extern const bfd_target bfd_elf32_i386_vec; extern const bfd_target bfd_elf32_i860_vec; extern const bfd_target bfd_elf32_little_generic_vec; extern const bfd_target bfd_elf32_littlemips_vec; extern const bfd_target bfd_elf64_littlemips_vec; +extern const bfd_target bfd_elf32_m32r_vec; extern const bfd_target bfd_elf32_m68k_vec; extern const bfd_target bfd_elf32_m88k_vec; +extern const bfd_target bfd_elf32_mn10200_vec; +extern const bfd_target bfd_elf32_mn10300_vec; extern const bfd_target bfd_elf32_powerpc_vec; extern const bfd_target bfd_elf32_powerpcle_vec; +extern const bfd_target bfd_elf32_sh_vec; +extern const bfd_target bfd_elf32_shl_vec; extern const bfd_target bfd_elf32_sparc_vec; extern const bfd_target bfd_elf64_big_generic_vec; extern const bfd_target bfd_elf64_little_generic_vec; extern const bfd_target bfd_elf64_sparc_vec; +extern const bfd_target bsd_ecoffalpha_little_vec; extern const bfd_target demo_64_vec; extern const bfd_target ecoff_big_vec; extern const bfd_target ecoff_little_vec; +extern const bfd_target ecoff_biglittle_vec; extern const bfd_target ecoffalpha_little_vec; extern const bfd_target evax_alpha_vec; extern const bfd_target h8300coff_vec; @@ -540,6 +549,7 @@ extern const bfd_target m68klynx_aout_vec; extern const bfd_target m68klynx_coff_vec; extern const bfd_target m68knetbsd_vec; +extern const bfd_target m68ksysvcoff_vec; extern const bfd_target m68k4knetbsd_vec; extern const bfd_target m88kbcs_vec; extern const bfd_target m88kmach3_vec; @@ -557,6 +567,8 @@ extern const bfd_target rs6000coff_vec; extern const bfd_target shcoff_vec; extern const bfd_target shlcoff_vec; +extern const bfd_target sparcle_aout_vec; +extern const bfd_target sparclinux_vec; extern const bfd_target sparclynx_aout_vec; extern const bfd_target sparclynx_coff_vec; extern const bfd_target sparcnetbsd_vec; @@ -584,6 +596,7 @@ extern const bfd_target hpux_core_vec; extern const bfd_target hppabsd_core_vec; extern const bfd_target irix_core_vec; +extern const bfd_target netbsd_core_vec; extern const bfd_target osf_core_vec; extern const bfd_target sco_core_vec; extern const bfd_target trad_core_vec; @@ -627,6 +640,7 @@ #ifdef BFD64 &bfd_elf64_bigmips_vec, #endif + &bfd_elf32_d10v_vec, &bfd_elf32_hppa_vec, &bfd_elf32_i386_vec, &bfd_elf32_i860_vec, @@ -635,6 +649,9 @@ #ifdef BFD64 &bfd_elf64_littlemips_vec, #endif + &bfd_elf32_m32r_vec, + &bfd_elf32_mn10200_vec, + &bfd_elf32_mn10300_vec, &bfd_elf32_m68k_vec, &bfd_elf32_m88k_vec, &bfd_elf32_sparc_vec, @@ -646,6 +663,9 @@ #if 0 &bfd_elf64_sparc_vec, #endif +#ifdef BFD64 + &bsd_ecoffalpha_little_vec, +#endif /* We don't include cisco_core_vec. Although it has a magic number, the magic number isn't at the beginning of the file, and thus might spuriously match other kinds of files. */ @@ -654,6 +674,7 @@ #endif &ecoff_big_vec, &ecoff_little_vec, + &ecoff_biglittle_vec, #ifdef BFD64 &ecoffalpha_little_vec, &evax_alpha_vec, @@ -717,6 +738,7 @@ &m68klynx_aout_vec, &m68klynx_coff_vec, &m68knetbsd_vec, + &m68ksysvcoff_vec, &m88kbcs_vec, &m88kmach3_vec, &newsos3_vec, @@ -749,6 +771,8 @@ &ppcboot_vec, &shcoff_vec, &shlcoff_vec, + &sparcle_aout_vec, + &sparclinux_vec, &sparclynx_aout_vec, &sparclynx_coff_vec, &sparcnetbsd_vec, @@ -802,7 +826,7 @@ /* bfd_default_vector[0] contains either the address of the default vector, if there is one, or zero if there isn't. */ -const bfd_target * const bfd_default_vector[] = { +const bfd_target *bfd_default_vector[] = { #ifdef DEFAULT_VECTOR &DEFAULT_VECTOR, #endif @@ -813,6 +837,88 @@ names of the matching targets in an array. This variable is the maximum number of entries that the array could possibly need. */ const size_t _bfd_target_vector_entries = sizeof(bfd_target_vector)/sizeof(*bfd_target_vector); + +/* This array maps configuration triplets onto BFD vectors. */ + +struct targmatch +{ + /* The configuration triplet. */ + const char *triplet; + /* The BFD vector. If this is NULL, then the vector is found by + searching forward for the next structure with a non NULL vector + field. */ + const bfd_target *vector; +}; + +/* targmatch.h is built by Makefile out of config.bfd. */ +static const struct targmatch bfd_target_match[] = { +#include "targmatch.h" + { NULL, NULL } +}; + +static const bfd_target *find_target PARAMS ((const char *)); + +/* Find a target vector, given a name or configuration triplet. */ + +static const bfd_target * +find_target (name) + const char *name; +{ + const bfd_target * const *target; + const struct targmatch *match; + + for (target = &bfd_target_vector[0]; *target != NULL; target++) + if (strcmp (name, (*target)->name) == 0) + return *target; + + /* If we couldn't match on the exact name, try matching on the + configuration triplet. FIXME: We should run the triplet through + config.sub first, but that is hard. */ + for (match = &bfd_target_match[0]; match->triplet != NULL; match++) + { + if (fnmatch (match->triplet, name, 0) == 0) + { + while (match->vector == NULL) + ++match; + return match->vector; + break; + } + } + + bfd_set_error (bfd_error_invalid_target); + return NULL; +} + +/* +FUNCTION + bfd_set_default_target + +SYNOPSIS + boolean bfd_set_default_target (const char *name); + +DESCRIPTION + Set the default target vector to use when recognizing a BFD. + This takes the name of the target, which may be a BFD target + name or a configuration triplet. +*/ + +boolean +bfd_set_default_target (name) + const char *name; +{ + const bfd_target *target; + + if (bfd_default_vector[0] != NULL + && strcmp (name, bfd_default_vector[0]->name) == 0) + return true; + + target = find_target (name); + if (target == NULL) + return false; + + bfd_default_vector[0] = target; + return true; +} /* FUNCTION @@ -835,31 +941,37 @@ const bfd_target * bfd_find_target (target_name, abfd) - CONST char *target_name; + const char *target_name; bfd *abfd; { - const bfd_target * const *target; - extern char *getenv (); - CONST char *targname = (target_name ? target_name : - (CONST char *) getenv ("GNUTARGET")); + const char *targname; + const bfd_target *target; + + if (target_name != NULL) + targname = target_name; + else + targname = getenv ("GNUTARGET"); /* This is safe; the vector cannot be null */ - if (targname == NULL || !strcmp (targname, "default")) { - abfd->target_defaulted = true; - return abfd->xvec = bfd_target_vector[0]; - } + if (targname == NULL || strcmp (targname, "default") == 0) + { + abfd->target_defaulted = true; + if (bfd_default_vector[0] != NULL) + abfd->xvec = bfd_default_vector[0]; + else + abfd->xvec = bfd_target_vector[0]; + return abfd->xvec; + } abfd->target_defaulted = false; - for (target = &bfd_target_vector[0]; *target != NULL; target++) { - if (!strcmp (targname, (*target)->name)) - return abfd->xvec = *target; - } + target = find_target (targname); + if (target == NULL) + return NULL; - bfd_set_error (bfd_error_invalid_target); - return NULL; + abfd->xvec = target; + return target; } - /* FUNCTION diff -urN binutils-2.7/bfd/targmatch.sed binutils-2.8/bfd/targmatch.sed --- binutils-2.7/bfd/targmatch.sed Wed Dec 31 19:00:00 1969 +++ binutils-2.8/bfd/targmatch.sed Wed Apr 30 12:56:28 1997 @@ -0,0 +1,28 @@ +1,/START OF targmatch.h/ d +/END OF targmatch.h/,$ d +s/^#if/KEEP #if/ +s/^#endif/KEEP #endif/ +s/^[ ]*#.*$// +s/^KEEP #/#/ +s/[ ]*\\$// +t lab1 + :lab1 +s/[| ][| ]*\([^|() ][^|() ]*\)[ ]*|/{ "\1", NULL },/g +s/[| ][| ]*\([^|() ][^|() ]*\)[ ]*)/{ "\1",/g +t lab2 +s/^[ ]*targ_defvec=\([^ ]*\)/#if !defined (SELECT_VECS) || defined (HAVE_\1)/ +t lab3 +s/.*=.*// +s/;;// +b + :lab2 +H +d + :lab3 +G +s/\(defined (HAVE_\)\([^)]*\)\(.*\)/\1\2\3\ +\&\2 },\ +#endif/ +p +s/.*//g +h diff -urN binutils-2.7/bfd/tekhex.c binutils-2.8/bfd/tekhex.c --- binutils-2.7/bfd/tekhex.c Thu Jul 4 12:20:09 1996 +++ binutils-2.8/bfd/tekhex.c Wed Apr 30 12:56:28 1997 @@ -1,6 +1,5 @@ /* BFD backend for Extended Tektronix Hex Format objects. - Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. - + Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . This file is part of BFD, the Binary File Descriptor library. @@ -100,6 +99,35 @@ (d)[0] = digs[((x)>>4)&0xf]; #define ISHEX(x) hex_p(x) +static void tekhex_init PARAMS ((void)); +static bfd_vma getvalue PARAMS ((char **)); +static void tekhex_print_symbol + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); +static void tekhex_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); +static asymbol *tekhex_make_empty_symbol PARAMS ((bfd *)); +static int tekhex_sizeof_headers PARAMS ((bfd *, boolean)); +static boolean tekhex_write_object_contents PARAMS ((bfd *)); +static void out PARAMS ((bfd *, int, char *, char *)); +static void writesym PARAMS ((char **, CONST char *)); +static void writevalue PARAMS ((char **, bfd_vma)); +static boolean tekhex_set_section_contents + PARAMS ((bfd*, sec_ptr, PTR, file_ptr, bfd_size_type)); +static boolean tekhex_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +static boolean tekhex_get_section_contents + PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); +static void move_section_contents + PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type, boolean)); +static const bfd_target *tekhex_object_p PARAMS ((bfd *)); +static boolean tekhex_mkobject PARAMS ((bfd *)); +static long tekhex_get_symtab_upper_bound PARAMS ((bfd *)); +static long tekhex_get_symtab PARAMS ((bfd *, asymbol **)); +static void pass_over PARAMS ((bfd *, void (*)(bfd*, int, char *))); +static void first_phase PARAMS ((bfd *, int, char *)); +static void insert_byte PARAMS ((bfd *, int, bfd_vma)); +static struct data_struct *find_chunk PARAMS ((bfd *, bfd_vma)); +static unsigned int getsym PARAMS ((char *, char **)); + /* Here's an example %3A6C6480004E56FFFC4E717063B0AEFFFC6D0652AEFFFC60F24E5E4E75 @@ -314,7 +342,7 @@ return len; } -struct data_struct * +static struct data_struct * find_chunk (abfd, vma) bfd *abfd; bfd_vma vma; @@ -364,7 +392,7 @@ static void first_phase (abfd, type, src) bfd *abfd; - char type; + int type; char *src; { asection *section = bfd_abs_section_ptr; @@ -453,9 +481,9 @@ record. */ static void - pass_over (abfd, func) +pass_over (abfd, func) bfd *abfd; - void (*func) (); + void (*func) PARAMS ((bfd *, int, char *)); { unsigned int chars_on_line; boolean eof = false; @@ -499,11 +527,10 @@ } -long +static long tekhex_get_symtab (abfd, table) bfd *abfd; asymbol **table; - { tekhex_symbol_type *p = abfd->tdata.tekhex_data->symbols; unsigned int c = bfd_get_symcount (abfd); @@ -518,7 +545,7 @@ return bfd_get_symcount (abfd); } -long +static long tekhex_get_symtab_upper_bound (abfd) bfd *abfd; { @@ -615,6 +642,7 @@ } } + static boolean tekhex_get_section_contents (abfd, section, locationp, offset, count) bfd *abfd; @@ -632,7 +660,7 @@ return false; } -boolean +static boolean tekhex_set_arch_mach (abfd, arch, machine) bfd *abfd; enum bfd_architecture arch; @@ -749,7 +777,7 @@ static void out (abfd, type, start, end) bfd *abfd; - char type; + int type; char *start; char *end; { @@ -894,7 +922,7 @@ } static int - tekhex_sizeof_headers (abfd, exec) +tekhex_sizeof_headers (abfd, exec) bfd *abfd; boolean exec; @@ -959,7 +987,7 @@ #define tekhex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #define tekhex_new_section_hook _bfd_generic_new_section_hook -#define tekhex_bfd_is_local_label bfd_generic_is_local_label +#define tekhex_bfd_is_local_label_name bfd_generic_is_local_label_name #define tekhex_get_lineno _bfd_nosymbols_get_lineno #define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line #define tekhex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff -urN binutils-2.7/bfd/trad-core.c binutils-2.8/bfd/trad-core.c --- binutils-2.7/bfd/trad-core.c Thu Jul 4 12:20:09 1996 +++ binutils-2.8/bfd/trad-core.c Wed Apr 30 12:56:28 1997 @@ -55,6 +55,7 @@ int trad_unix_core_file_failing_signal PARAMS ((bfd *abfd)); boolean trad_unix_core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd)); +static void swap_abort PARAMS ((void)); /* Handle 4.2-style (and perhaps also sysV-style) core dump file. */ @@ -257,7 +258,7 @@ } /* If somebody calls any byte-swapping routines, shoot them. */ -void +static void swap_abort() { abort(); /* This way doesn't require any declaration for ANSI to fuck up */ diff -urN binutils-2.7/bfd/versados.c binutils-2.8/bfd/versados.c --- binutils-2.7/bfd/versados.c Thu Jul 4 12:20:10 1996 +++ binutils-2.8/bfd/versados.c Wed Apr 30 12:56:29 1997 @@ -1,10 +1,9 @@ /* BFD back-end for VERSAdos-E objects. + Copyright 1995, 96, 1997 Free Software Foundation, Inc. + Written by Steve Chamberlain of Cygnus Support . Versados is a Motorola trademark. - Copyright 1995 Free Software Foundation, Inc. - Written by Steve Chamberlain of Cygnus Support . - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify @@ -850,7 +849,7 @@ #define versados_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #define versados_new_section_hook _bfd_generic_new_section_hook -#define versados_bfd_is_local_label bfd_generic_is_local_label +#define versados_bfd_is_local_label_name bfd_generic_is_local_label_name #define versados_get_lineno _bfd_nosymbols_get_lineno #define versados_find_nearest_line _bfd_nosymbols_find_nearest_line #define versados_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol diff -urN binutils-2.7/bfd/xcofflink.c binutils-2.8/bfd/xcofflink.c --- binutils-2.7/bfd/xcofflink.c Thu Jul 4 12:20:14 1996 +++ binutils-2.8/bfd/xcofflink.c Wed Apr 30 12:56:29 1997 @@ -1,5 +1,5 @@ /* POWER/PowerPC XCOFF linker support. - Copyright 1995, 1996 Free Software Foundation, Inc. + Copyright 1995, 1996, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor , Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -256,7 +256,7 @@ set), this is the offset in toc_section. */ bfd_vma toc_offset; /* If the TOC entry comes from an input file, this is set to the - symbo lindex of the C_HIDEXT XMC_TC symbol. */ + symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol. */ long toc_indx; } u; @@ -269,7 +269,9 @@ /* The .loader symbol table entry, if there is one. */ struct internal_ldsym *ldsym; - /* The .loader symbol table index. */ + /* If XCOFF_BUILT_LDSYM is set, this is the .loader symbol table + index. If XCOFF_BUILD_LDSYM is clear, and XCOFF_IMPORT is set, + this is the l_ifile value. */ long ldindx; /* Some linker flags. */ @@ -300,6 +302,8 @@ #define XCOFF_HAS_SIZE (04000) /* Symbol is a function descriptor. */ #define XCOFF_DESCRIPTOR (010000) + /* Multiple definitions have been for the symbol. */ +#define XCOFF_MULTIPLY_DEFINED (020000) /* The storage mapping class. */ unsigned char smclas; @@ -441,6 +445,7 @@ PARAMS ((bfd *, const struct internal_ldrel *, struct external_ldrel *)); static struct bfd_hash_entry *xcoff_link_hash_newfunc PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static boolean xcoff_get_section_contents PARAMS ((bfd *, asection *)); static struct internal_reloc *xcoff_read_internal_relocs PARAMS ((bfd *, asection *, boolean, bfd_byte *, boolean, struct internal_reloc *)); @@ -457,6 +462,8 @@ static boolean xcoff_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *)); static boolean xcoff_link_add_dynamic_symbols PARAMS ((bfd *, struct bfd_link_info *)); +static boolean xcoff_mark_symbol + PARAMS ((struct bfd_link_info *, struct xcoff_link_hash_entry *)); static boolean xcoff_mark PARAMS ((struct bfd_link_info *, asection *)); static void xcoff_sweep PARAMS ((struct bfd_link_info *)); static boolean xcoff_build_ldsyms @@ -1061,12 +1068,21 @@ { case bfd_object: return xcoff_link_add_object_symbols (abfd, info); + case bfd_archive: - /* We need to look through the archive for stripped dynamic - objects, because they will not appear in the archive map even - though they should, perhaps, be included. Also, if the - linker has no map, we just consider each object file in turn, - since that apparently is what the AIX native linker does. */ + /* If the archive has a map, do the usual search. We then need + to check the archive for stripped dynamic objects, because + they will not appear in the archive map even though they + should, perhaps, be included. If the archive has no map, we + just consider each object file in turn, since that apparently + is what the AIX native linker does. */ + if (bfd_has_map (abfd)) + { + if (! (_bfd_generic_link_add_archive_symbols + (abfd, info, xcoff_link_check_archive_element))) + return false; + } + { bfd *member; @@ -1087,15 +1103,10 @@ } member = bfd_openr_next_archived_file (abfd, member); } - - if (! bfd_has_map (abfd)) - return true; - - /* Now do the usual search. */ - return (_bfd_generic_link_add_archive_symbols - (abfd, info, xcoff_link_check_archive_element)); } + return true; + default: bfd_set_error (bfd_error_wrong_format); return false; @@ -1402,6 +1413,8 @@ bfd_byte *linenos; } *reloc_info = NULL; + keep_syms = obj_coff_keep_syms (abfd); + if ((abfd->flags & DYNAMIC) != 0 && ! info->static_link) { @@ -1565,7 +1578,6 @@ } /* Don't let the linker relocation routines discard the symbols. */ - keep_syms = obj_coff_keep_syms (abfd); obj_coff_keep_syms (abfd) = true; csect = NULL; @@ -2082,7 +2094,8 @@ /* Check for magic symbol names. */ if ((smtyp == XTY_SD || smtyp == XTY_CM) - && aux.x_csect.x_smclas != XMC_TC) + && aux.x_csect.x_smclas != XMC_TC + && aux.x_csect.x_smclas != XMC_TD) { int i; @@ -2123,12 +2136,25 @@ || sym._n._n_n._n_offset == 0) copy = true; + /* The AIX linker appears to only detect multiple symbol + definitions when there is a reference to the symbol. If + a symbol is defined multiple times, and the only + references are from the same object file, the AIX linker + appears to permit it. It does not merge the different + definitions, but handles them independently. On the + other hand, if there is a reference, the linker reports + an error. + + This matters because the AIX header + file actually defines an initialized array, so we have to + actually permit that to work. + + We also have to handle the case of statically linking a + shared object, which will cause symbol redefinitions, + although this is an easier case to detect. */ + if (info->hash->creator == abfd->xvec) { - /* If we are statically linking a shared object, it is - OK for symbol redefinitions to occur. I can't figure - out just what the XCOFF linker is doing, but - something like this is required for -bnso to work. */ if (! bfd_is_und_section (section)) *sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info), name, true, copy, false); @@ -2143,25 +2169,71 @@ && ! bfd_is_und_section (section) && ! bfd_is_com_section (section)) { - /* If the existing symbol is to global linkage code, - and this symbol is not global linkage code, then - replace the existing symbol. */ + /* This is a second definition of a defined symbol. */ if ((abfd->flags & DYNAMIC) != 0 && ((*sym_hash)->smclas != XMC_GL || aux.x_csect.x_smclas == XMC_GL || ((*sym_hash)->root.u.def.section->owner->flags & DYNAMIC) == 0)) { + /* The new symbol is from a shared library, and + either the existing symbol is not global + linkage code or this symbol is global linkage + code. If the existing symbol is global + linkage code and the new symbol is not, then + we want to use the new symbol. */ section = bfd_und_section_ptr; value = 0; } else if (((*sym_hash)->root.u.def.section->owner->flags & DYNAMIC) != 0) { + /* The existing symbol is from a shared library. + Replace it. */ (*sym_hash)->root.type = bfd_link_hash_undefined; (*sym_hash)->root.u.undef.abfd = (*sym_hash)->root.u.def.section->owner; } + else if ((*sym_hash)->root.next != NULL + || info->hash->undefs_tail == &(*sym_hash)->root) + { + /* This symbol has been referenced. In this + case, we just continue and permit the + multiple definition error. See the comment + above about the behaviour of the AIX linker. */ + } + else if ((*sym_hash)->smclas == aux.x_csect.x_smclas) + { + /* The symbols are both csects of the same + class. There is at least a chance that this + is a semi-legitimate redefinition. */ + section = bfd_und_section_ptr; + value = 0; + (*sym_hash)->flags |= XCOFF_MULTIPLY_DEFINED; + } + } + else if (((*sym_hash)->flags & XCOFF_MULTIPLY_DEFINED) != 0 + && ((*sym_hash)->root.type == bfd_link_hash_defined + || (*sym_hash)->root.type == bfd_link_hash_defweak) + && (bfd_is_und_section (section) + || bfd_is_com_section (section))) + { + /* This is a reference to a multiply defined symbol. + Report the error now. See the comment above + about the behaviour of the AIX linker. We could + also do this with warning symbols, but I'm not + sure the XCOFF linker is wholly prepared to + handle them, and that would only be a warning, + not an error. */ + if (! ((*info->callbacks->multiple_definition) + (info, (*sym_hash)->root.root.string, + (bfd *) NULL, (asection *) NULL, 0, + (*sym_hash)->root.u.def.section->owner, + (*sym_hash)->root.u.def.section, + (*sym_hash)->root.u.def.value))) + goto error_return; + /* Try not to give this error too many times. */ + (*sym_hash)->flags &= ~XCOFF_MULTIPLY_DEFINED; } } @@ -2494,6 +2566,61 @@ h->root.u.def.section = bfd_abs_section_ptr; h->root.u.def.value = ldsym.l_value; } + + /* If this symbol defines a function descriptor, then it + implicitly defines the function code as well. */ + if (h->smclas == XMC_DS + || (h->smclas == XMC_XO && name[0] != '.')) + h->flags |= XCOFF_DESCRIPTOR; + if ((h->flags & XCOFF_DESCRIPTOR) != 0) + { + struct xcoff_link_hash_entry *hds; + + hds = h->descriptor; + if (hds == NULL) + { + char *dsnm; + + dsnm = bfd_malloc (strlen (name) + 2); + if (dsnm == NULL) + return false; + dsnm[0] = '.'; + strcpy (dsnm + 1, name); + hds = xcoff_link_hash_lookup (xcoff_hash_table (info), dsnm, + true, true, true); + free (dsnm); + if (hds == NULL) + return false; + + if (hds->root.type == bfd_link_hash_new) + { + hds->root.type = bfd_link_hash_undefined; + hds->root.u.undef.abfd = abfd; + /* We do not want to add this to the undefined + symbol list. */ + } + + hds->descriptor = h; + h->descriptor = hds; + } + + hds->flags |= XCOFF_DEF_DYNAMIC; + if (hds->smclas == XMC_UA) + hds->smclas = XMC_PR; + + /* An absolute symbol appears to actually define code, not a + function descriptor. This is how some math functions are + implemented on AIX 4.1. */ + if (h->smclas == XMC_XO + && (hds->root.type == bfd_link_hash_undefined + || hds->root.type == bfd_link_hash_undefweak)) + { + hds->smclas = XMC_XO; + hds->root.type = bfd_link_hash_defined; + hds->root.u.def.section = bfd_abs_section_ptr; + hds->root.u.def.value = ldsym.l_value; + } + } } if (buf != NULL && ! coff_section_data (abfd, lsec)->keep_contents) @@ -2674,7 +2801,6 @@ && h->root.root.string[0] == '.' && h->descriptor != NULL && ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0 - || info->shared || ((h->descriptor->flags & XCOFF_IMPORT) != 0 && (h->descriptor->flags & XCOFF_DEF_REGULAR) == 0)))) @@ -2824,16 +2950,12 @@ h->root.u.def.value = val; } - if (h->ldsym == NULL) - { - h->ldsym = ((struct internal_ldsym *) - bfd_zalloc (output_bfd, sizeof (struct internal_ldsym))); - if (h->ldsym == NULL) - return false; - } - + /* We overload the ldindx field to hold the l_ifile value for this + symbol. */ + BFD_ASSERT (h->ldsym == NULL); + BFD_ASSERT ((h->flags & XCOFF_BUILT_LDSYM) == 0); if (imppath == NULL) - h->ldsym->l_ifile = (bfd_size_type) -1; + h->ldindx = -1; else { unsigned int c; @@ -2866,7 +2988,7 @@ *pp = n; } - h->ldsym->l_ifile = c; + h->ldindx = c; } return true; @@ -3299,7 +3421,7 @@ xcoff_data (sub)->debug_indices = debug_index; /* Grab the contents of the .debug section. We use malloc and - copy the neams into the debug stringtab, rather than + copy the names into the debug stringtab, rather than bfd_alloc, because I expect that, when linking many files together, many of the strings will be the same. Storing the strings in the hash table should save space in this case. */ @@ -3400,7 +3522,47 @@ if (ldinfo->export_defineds && (h->flags & XCOFF_DEF_REGULAR) != 0 && h->root.root.string[0] != '.') - h->flags |= XCOFF_EXPORT; + { + boolean export; + + /* We don't export a symbol which is being defined by an object + included from an archive which contains a shared object. The + rationale is that if an archive contains both an unshared and + a shared object, then there must be some reason that the + unshared object is unshared, and we don't want to start + providing a shared version of it. In particular, this solves + a bug involving the _savefNN set of functions. gcc will call + those functions without providing a slot to restore the TOC, + so it is essential that these functions be linked in directly + and not from a shared object, which means that a shared + object which also happens to link them in must not export + them. This is confusing, but I haven't been able to think of + a different approach. Note that the symbols can, of course, + be exported explicitly. */ + export = true; + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->root.u.def.section->owner != NULL + && h->root.u.def.section->owner->my_archive != NULL) + { + bfd *arbfd, *member; + + arbfd = h->root.u.def.section->owner->my_archive; + member = bfd_openr_next_archived_file (arbfd, (bfd *) NULL); + while (member != NULL) + { + if ((member->flags & DYNAMIC) != 0) + { + export = false; + break; + } + member = bfd_openr_next_archived_file (arbfd, member); + } + } + + if (export) + h->flags |= XCOFF_EXPORT; + } /* We don't want to garbage collect symbols which are not defined in XCOFF files. This is a convenient place to mark them. */ @@ -3413,17 +3575,16 @@ != ldinfo->info->hash->creator))) h->flags |= XCOFF_MARK; - /* If this symbol is called and defined in a dynamic object, or not - defined at all when building a shared object, or imported, then - we need to set up global linkage code for it. (Unless we did - garbage collection and we didn't need this symbol.) */ + /* If this symbol is called and defined in a dynamic object, or it + is imported, then we need to set up global linkage code for it. + (Unless we did garbage collection and we didn't need this + symbol.) */ if ((h->flags & XCOFF_CALLED) != 0 && (h->root.type == bfd_link_hash_undefined || h->root.type == bfd_link_hash_undefweak) && h->root.root.string[0] == '.' && h->descriptor != NULL && ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0 - || ldinfo->info->shared || ((h->descriptor->flags & XCOFF_IMPORT) != 0 && (h->descriptor->flags & XCOFF_DEF_REGULAR) == 0)) && (! xcoff_hash_table (ldinfo->info)->gc @@ -3502,11 +3663,10 @@ else { (*_bfd_error_handler) - ("attempt to export undefined symbol `%s'", + ("warning: attempt to export undefined symbol `%s'", h->root.root.string); - ldinfo->failed = true; - bfd_set_error (bfd_error_invalid_operation); - return false; + h->ldsym = NULL; + return true; } } @@ -3554,20 +3714,19 @@ /* We need to add this symbol to the .loader symbols. */ - /* h->ldsym will already have been allocated for an explicitly - imported symbol. */ + BFD_ASSERT (h->ldsym == NULL); + h->ldsym = ((struct internal_ldsym *) + bfd_zalloc (ldinfo->output_bfd, + sizeof (struct internal_ldsym))); if (h->ldsym == NULL) { - h->ldsym = ((struct internal_ldsym *) - bfd_zalloc (ldinfo->output_bfd, - sizeof (struct internal_ldsym))); - if (h->ldsym == NULL) - { - ldinfo->failed = true; - return false; - } + ldinfo->failed = true; + return false; } + if ((h->flags & XCOFF_IMPORT) != 0) + h->ldsym->l_ifile = h->ldindx; + /* The first 3 symbol table indices are reserved to indicate the sections. */ h->ldindx = ldinfo->ldsym_count + 3; @@ -3742,7 +3901,6 @@ saw_contents = true; for (op = &abfd->sections; *op != NULL; op = &(*op)->next) { - (*op)->target_index = indx; if (strcmp ((*op)->name, ".pad") == 0) saw_contents = false; else if (((*op)->flags & SEC_HAS_CONTENTS) != 0 @@ -3811,7 +3969,8 @@ } } - bfd_coff_compute_section_file_positions (abfd); + if (! bfd_coff_compute_section_file_positions (abfd)) + goto error_return; } /* Allocate space for the pointers we need to keep for the relocs. */ @@ -3902,9 +4061,9 @@ /* Figure out the largest number of symbols in an input BFD. Take the opportunity to clear the output_has_begun fields of all the - input BFD's. We want at least 4 symbols, since that is the + input BFD's. We want at least 6 symbols, since that is the number which xcoff_write_global_symbol may need. */ - max_sym_count = 4; + max_sym_count = 6; for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) { size_t sz; @@ -4029,12 +4188,9 @@ /* Now that we have written out all the global symbols, we know the symbol indices to use for relocs against them, and we can finally write out the relocs. */ - external_relocs = (bfd_byte *) malloc (max_output_reloc_count * relsz); + external_relocs = (bfd_byte *) bfd_malloc (max_output_reloc_count * relsz); if (external_relocs == NULL && max_output_reloc_count != 0) - { - bfd_set_error (bfd_error_no_memory); - goto error_return; - } + goto error_return; for (o = abfd->sections; o != NULL; o = o->next) { @@ -4552,8 +4708,7 @@ && (isym.n_sclass != C_EXT && (isym.n_sclass != C_HIDEXT || smtyp != XTY_SD)) - && strncmp (name, finfo->info->lprefix, - finfo->info->lprefix_len) == 0)) + && bfd_is_local_label_name (input_bfd, name))) skip = true; } @@ -5120,6 +5275,7 @@ { struct xcoff_link_hash_entry *h = NULL; struct internal_ldrel ldrel; + boolean quiet; *rel_hash = NULL; @@ -5133,6 +5289,7 @@ { h = obj_xcoff_sym_hashes (input_bfd)[r_symndx]; if (h != NULL + && h->smclas != XMC_TD && (irel->r_type == R_TOC || irel->r_type == R_GL || irel->r_type == R_TCL @@ -5244,6 +5401,7 @@ } } + quiet = false; switch (irel->r_type) { default: @@ -5295,7 +5453,17 @@ } else { - if (h->ldindx < 0) + if (! finfo->info->relocateable + && (h->flags & XCOFF_DEF_DYNAMIC) == 0 + && (h->flags & XCOFF_IMPORT) == 0) + { + /* We already called the undefined_symbol + callback for this relocation, in + _bfd_ppc_xcoff_relocate_section. Don't + issue any more warnings. */ + quiet = true; + } + if (h->ldindx < 0 && ! quiet) { (*_bfd_error_handler) ("%s: `%s' in loader reloc but not loader sym", @@ -5309,7 +5477,8 @@ ldrel.l_rtype = (irel->r_size << 8) | irel->r_type; ldrel.l_rsecnm = o->output_section->target_index; if (xcoff_hash_table (finfo->info)->textro - && strcmp (o->output_section->name, ".text") == 0) + && strcmp (o->output_section->name, ".text") == 0 + && ! quiet) { (*_bfd_error_handler) ("%s: loader reloc in read-only section %s", @@ -5376,6 +5545,7 @@ union internal_auxent aux; output_bfd = finfo->output_bfd; + outsym = finfo->outsyms; /* If this symbol was garbage collected, just skip it. */ if (xcoff_hash_table (finfo->info)->gc @@ -5484,6 +5654,8 @@ int oindx; struct internal_reloc *irel; struct internal_ldrel ldrel; + struct internal_syment irsym; + union internal_auxent iraux; tocsec = h->toc_section; osec = tocsec->output_section; @@ -5511,6 +5683,63 @@ ldrel.l_rsecnm = oindx; xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel); ++finfo->ldrel; + + /* We need to emit a symbol to define a csect which holds the + reloc. */ + if (strlen (h->root.root.string) <= SYMNMLEN) + strncpy (irsym._n._n_name, h->root.root.string, SYMNMLEN); + else + { + boolean hash; + bfd_size_type indx; + + hash = true; + if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0) + hash = false; + indx = _bfd_stringtab_add (finfo->strtab, h->root.root.string, hash, + false); + if (indx == (bfd_size_type) -1) + return false; + irsym._n._n_n._n_zeroes = 0; + irsym._n._n_n._n_offset = STRING_SIZE_SIZE + indx; + } + + irsym.n_value = irel->r_vaddr; + irsym.n_scnum = osec->target_index; + irsym.n_sclass = C_HIDEXT; + irsym.n_type = T_NULL; + irsym.n_numaux = 1; + + bfd_coff_swap_sym_out (output_bfd, (PTR) &irsym, (PTR) outsym); + outsym += bfd_coff_symesz (output_bfd); + + memset (&iraux, 0, sizeof iraux); + iraux.x_csect.x_smtyp = XTY_SD; + iraux.x_csect.x_scnlen.l = 4; + iraux.x_csect.x_smclas = XMC_TC; + + bfd_coff_swap_aux_out (output_bfd, (PTR) &iraux, T_NULL, C_HIDEXT, 0, 1, + (PTR) outsym); + outsym += bfd_coff_auxesz (output_bfd); + + if (h->indx >= 0) + { + /* We aren't going to write out the symbols below, so we + need to write them out now. */ + if (bfd_seek (output_bfd, + (obj_sym_filepos (output_bfd) + + (obj_raw_syment_count (output_bfd) + * bfd_coff_symesz (output_bfd))), + SEEK_SET) != 0 + || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1, + output_bfd) + != (bfd_size_type) (outsym - finfo->outsyms))) + return false; + obj_raw_syment_count (output_bfd) += + (outsym - finfo->outsyms) / bfd_coff_symesz (output_bfd); + + outsym = finfo->outsyms; + } } /* If this symbol is a specially defined function descriptor, write @@ -5618,7 +5847,10 @@ } if (h->indx >= 0) - return true; + { + BFD_ASSERT (outsym == finfo->outsyms); + return true; + } if (h->indx != -2 && (finfo->info->strip == strip_all @@ -5626,13 +5858,17 @@ && (bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string, false, false) == NULL)))) - return true; + { + BFD_ASSERT (outsym == finfo->outsyms); + return true; + } if (h->indx != -2 && (h->flags & (XCOFF_REF_REGULAR | XCOFF_DEF_REGULAR)) == 0) - return true; - - outsym = finfo->outsyms; + { + BFD_ASSERT (outsym == finfo->outsyms); + return true; + } memset (&aux, 0, sizeof aux); @@ -5664,6 +5900,16 @@ isym.n_sclass = C_EXT; aux.x_csect.x_smtyp = XTY_ER; } + else if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->smclas == XMC_XO) + { + BFD_ASSERT (bfd_is_abs_section (h->root.u.def.section)); + isym.n_value = h->root.u.def.value; + isym.n_scnum = N_UNDEF; + isym.n_sclass = C_EXT; + aux.x_csect.x_smtyp = XTY_ER; + } else if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { @@ -5714,8 +5960,9 @@ (PTR) outsym); outsym += bfd_coff_auxesz (output_bfd); - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->smclas != XMC_XO) { /* We just output an SD symbol. Now output an LD symbol. */ @@ -6086,6 +6333,10 @@ (info, h->root.root.string, input_bfd, input_section, rel->r_vaddr - input_section->vma))) return false; + + /* Don't try to process the reloc. It can't help, and + it may generate another error. */ + continue; } } @@ -6148,21 +6399,23 @@ address instruction which may be changed to a load instruction. FIXME: I don't know if this is the correct implementation. */ - if (h != NULL && h->toc_section == NULL) - { - (*_bfd_error_handler) - ("%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry", - bfd_get_filename (input_bfd), rel->r_vaddr, - h->root.root.string); - bfd_set_error (bfd_error_bad_value); - return false; - } - if (h != NULL) + if (h != NULL && h->smclas != XMC_TD) { + if (h->toc_section == NULL) + { + (*_bfd_error_handler) + ("%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry", + bfd_get_filename (input_bfd), rel->r_vaddr, + h->root.root.string); + bfd_set_error (bfd_error_bad_value); + return false; + } + BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0); val = (h->toc_section->output_section->vma + h->toc_section->output_offset); } + val = ((val - xcoff_data (output_bfd)->toc) - (sym->n_value - xcoff_data (input_bfd)->toc)); addend = 0; diff -urN binutils-2.7/binutils/ChangeLog binutils-2.8/binutils/ChangeLog --- binutils-2.7/binutils/ChangeLog Mon Jul 8 15:32:39 1996 +++ binutils-2.8/binutils/ChangeLog Wed Apr 30 12:59:00 1997 @@ -1,6 +1,574 @@ -Mon Jul 8 15:32:25 1996 Ian Lance Taylor +Fri Apr 25 14:22:08 1997 H.J. Lu - * Released binutils 2.7. + * Makefile.in (maintainer-clean realclean): Change *.info* + to binutils.info* to save sysroff.info. + +Mon Apr 14 11:52:39 1997 Ian Lance Taylor + + From Thomas Graichen : + * Makefile.in: Always use $(SHELL) when running move-if-change. + * configure.in: Use ${CONFIG_SHELL} when running $ac_config_sub. + * configure: Rebuild. + +Fri Apr 4 13:28:02 1997 Ian Lance Taylor + + * configure.in: Add AC_FUNC_ALLOCA. + * configure, config.in: Rebuild. + * bucomm.h: Add alloca handling, copied from gas/as.h. + * dlltool.c: Add #pragma alloca for AIX to start of file. + * nlmconv.c: Likewise. + + * Makefile.in (distclean): Remove site.exp and site.bak. Remove + everything that clean removes. + +Thu Apr 3 18:53:31 1997 Ian Lance Taylor + + * Makefile.in (VERSION): Set to 2.8. + +Tue Apr 1 16:21:44 1997 Klaus Kaempf + + * configure.com: New file. + * config.h-vms: Remove file. + * makefile.vms: Update for new configure scheme. + +Mon Mar 31 15:30:43 1997 Philippe De Muyter + + * objcopy.c (make_same_dates): Use statbuf, not buf, if not + HAVE_GOOD_UTIME_H. + +Fri Mar 28 17:57:53 1997 Alan Modra + + * Makefile.in ($(OBJDUMP_PROG)): Don't link against BFDLIB twice. + * configure.in: Add AC_ARG_ENABLE for commonbfdlib. If it is set, + set OPCODES to empty. + * configure: Rebuild. + +Thu Mar 27 16:03:02 1997 Ian Lance Taylor + + Based on patch from Marty Leisner : + * objcopy.c: Include or . + (strip_options): Add "preserve-dates". + (copy_options): Likewise. + (copy_usage): Mention -p and --preserve-dates. + (strip_usage): Likewise. + (make_same_dates): New static function. + (strip_main): Handle -p. + (copy_main): Likewise. + * binutils.texi, strip.1, objcopy.1: Document new option. + + addr2line.c contributed by Ulrich Lauther + : + * addr2line.c: New file. + * Makefile.in: Rebuild dependencies. + (ADDR2LINE_PROG): New variable. + (MANPAGES): Add addr2line. + (PROGS): Add $(ADDR2LINE_PROG). + (CFILES): Add addr2line.c. + ($(ADDR2LINE_PROG)): New target. + * binutils.texi: Document addr2line. + * addr2line.1: New file. + + * version.c (print_version): Update copyright date. + +Mon Mar 24 10:52:45 1997 Andreas Schwab + + * objdump.c (disassemble_data): Don't exit if a file cannot be + disassembled, instead just return. + +Thu Mar 20 21:16:51 1997 Jeffrey A Law (law@cygnus.com) + + * size.c (usage): Make definition match its prototype. + (display_bfd, lprint_number, rprint_number): Likewise. + (print_berkeley_format, sysv_internal_printer): Likewise. + (print_sysv_format): Likewise. + * nm.c (set_print_radix, set_output_format): Likewise. + * objcopy.c (filter_bytes): Likewise. + +Tue Mar 18 16:39:55 1997 H.J. Lu + + * Many files: Add function prototypes. + * ar.c (mri_emul, get_pos_bfd): Make static. + * arlex.l: Include "libiberty.h". Don't declare strdup. Use + xstrdup rather than strdup. + * arparse.y (yyerror): Make argument const. Correct typo. + * arsup.c (strdup): Don't declare. + (ar_save): Use xstrdup rather than strdup. + * filemode.c: Include "bucomm.h". + * nm.c (usage): Make static. + (print_symname): Make format and name const. + * objcopy.c (cat): Remove. + (copy_archive): Make output_target const. Use concat, not cat. + (copy_file, simple_copy, smart_rename): Make arguments const. + * objdump.c (read_section_stabs): Likewise. + (print_section_stabs): Likewise. + (display_target_tables): Don't declare getenv. + * strings.c (strings_object_file): Change file to const. + (print_strings): Change filename to const. + * Makefile.in: Rebuild dependencies. + +Tue Mar 18 11:37:24 1997 Ian Lance Taylor + + * configure.in: Add BFD_NEED_DECLARATION(getenv). + * acconfig.h: Add NEED_DECLARATION_GETENV. + * bucomm.h (getenv): Declare if NEED_DECLARATION_GETENV. + * configure, config.in: Rebuild. + * nlmconv.c (getenv): Don't declare. + + * Makefile.in: Rebuild dependencies. + +Sat Mar 15 15:35:56 1997 Ian Lance Taylor + + Based on patches from Jamie Lokier : + * objdump.c: Include "demangle.h". + (do_demangle): New static variable. + (usage): Mention -C/--demangle. + (long_options): Add "demangle". + (objdump_print_symname): New static function. + (objdump_print_addr_with_sym): Use objdump_print_symname. + (disassemble_bytes): Likewise. + (dump_reloc_set): Likewise. + (dump_symbols): Demangle symbol name. + (main): Handle -C. + * binutils.texi, objdump.1: Document -C/--demangle. + + * objdump.c (usage): Mention --no-show-raw-insn. + (long_options): Add "no-show-raw-insn". + (disassemble_bytes): Handle --no-show-raw-insn. + * binutils.texi, objdump.1: Document --no-show-raw-insn. + +Wed Mar 12 11:42:00 1997 Andreas Schwab + + * rddbg.c (free_saved_stabs): Set the strings to NULL after being + freed. + +Fri Feb 28 17:18:45 1997 Ian Lance Taylor + + * bucomm.c (set_default_bfd_target): New function. + * bucomm.h (set_default_bfd_target): Declare. + * ar.c (main): Call set_default_bfd_target. + * nlmconv.c (main): Likewise. + * nm.c (main): Likewise. + * objcopy.c (main): Likewise. + * objdump.c (main): Likewise. + * size.c (main): Likewise. + * strings.c (main): Likewise. + * Makefile.in (bucomm.o): New target, to define TARGET. + +Tue Feb 25 21:28:38 1997 Ian Lance Taylor + + * objdump.c (adjust_section_vma): New static variable. + (usage): Mention --adjust-section-vma. + (OPTION_ADJUST_VMA): Define. + (long_options): Add "addjust-vma". + (display_bfd): If adjust_section_vma is not 0, add it to all the + section addresses. + (main): Handle OPTION_ADJUST_VMA. + * binutils.texi, objdump.1: Document --adjust-vma. + +Fri Feb 14 18:46:47 1997 Ian Lance Taylor + + * nm.c (print_symbol): Cache the BFD as well as the symbols and + relocs, and don't try to use the symbols or relocs with a + different BFD. + +Thu Feb 13 21:34:43 1997 Klaus Kaempf (kkaempf@progis.de) + + * config.h-vms: sbrk() is provided on openVMS/Alpha. + * makefile.vms: allow compiling with current gcc snapshot. + +Thu Feb 13 20:14:40 1997 Ian Lance Taylor + + * arsup.c, coffgrok.c, dlltool.c, nlmconv.c: Use xmalloc rather + than malloc. + +Wed Feb 12 16:12:02 1997 Ian Lance Taylor + + * objdump.c (disassemble_data): Correct VMA argument to + find_symbol_for_address. Improve handling of code with no symbol + followed by code with a symbol. + +Wed Feb 12 12:16:47 1997 Andreas Schwab + + * objdump.c (disassemble_bytes): Make output of raw instructions + work better for non-standard values of bytes_per_chunk and + bytes_per_line. + +Thu Feb 6 14:14:59 1997 Martin M. Hunt + + * objdump.c (disassemble_bytes): Added code to allow some control + over the way raw instructions are displayed. + +Thu Feb 6 12:36:03 1997 Ian Lance Taylor + + * stabs.c (struct bincl_file): Add next_stack field. + (push_bincl): Put the new file on both bincl_list and + bincl_stack. Clear the file_types field. + (pop_bincl): Use the next_stack field when popping the stack. + Don't put the file on bincl_list. + (find_excl): Include the file name when warning about an unfound + N_EXCL. + + * debug.c (debug_type_samep): Don't crash if we are passed NULL. + +Thu Feb 6 11:54:24 1997 Alan Modra + + * objcopy.1: Add missing space after .B. + +Fri Jan 31 10:33:07 1997 Andreas Schwab + + * objdump.c (disassemble_data): Initialize `aux.require_sec'. + +Wed Jan 29 13:21:21 1997 Ian Lance Taylor + + * objdump.c (objdump_print_value): Add skip_zeroes parameter. + Change all callers. + (objdump_print_addr_with_sym): Likewise. Call objdump_print_value + to print address. + (objdump_print_addr): New static function. + (objdump_print_address): Just call objdump_print_addr. + (disassemble_bytes): Print real address, not function offset. + Skip a certain number of leading zeroes. + + * objdump.c (disassemble_zeroes): New static variable. + (usage): Mention --disassemble-zeroes. + (long_options): Add "disassemble-zeroes". + (disassemble_bytes): Check disassemble_zeroes. + +Tue Jan 28 16:47:26 1997 Ian Lance Taylor + + * objdump.c (disassemble_bytes): Don't skip zeroes if the + disassembler has told us that we are in a branch delay slot. + +Mon Jan 20 14:24:04 1997 Ian Lance Taylor + + * size.c (berkeley_sum): Rewrite. Skip sections which are not + SEC_ALLOC. Count SEC_READONLY sections as text. + +Tue Jan 14 15:14:14 1997 Ian Lance Taylor + + * Makefile.in (maintainer-clean realclean): Remove *.info*, not + just *.info. From H.J. Lu . + +Tue Dec 31 15:42:54 1996 Ian Lance Taylor + + * Makefile.in (ALL_CFLAGS): Add -D_GNU_SOURCE. + +Fri Dec 27 11:19:26 1996 Ian Lance Taylor + + * configure.in: Work around bug in AC_FUNC_VFORK in autoconf 2.12. + * configure: Rebuild. + +Thu Dec 19 13:11:20 1996 Ian Lance Taylor + + Based on patch from Andrew J Klossner : + * objcopy.c (OPTION_WEAKEN): Define. + (copy_options): Add "weaken". + (copy_usage): Mention --weaken. + (weaken): New static variable. + (filter_symbols): Handle weaken. + (copy_object): Call filter_symbols if weaken. + (copy_main): Handle OPTION_WEAKEN. + * binutils.texi, objcopy.1: Document --weaken. + +Wed Dec 18 22:49:13 1996 Stan Shebs + + * mpw-make.sed: Use NewFolderRecursive for installation. + +Sat Dec 7 10:17:25 1996 Jeffrey A Law (law@cygnus.com) + + * Makefile.in (install): Add "else true" clause to cater to + broken "make" on some systems. + +Fri Dec 6 17:21:41 1996 Ian Lance Taylor + + * ieee.c (parse_ieee_bb): Always initialize namcopy to avoid gcc + warning about uninitialized variable. + (ieee_read_cxx_class): Likewise, for pf. + (ieee_enum_type): Likewise, for i. + +Tue Nov 26 17:01:25 1996 Ian Lance Taylor + + * wrstabs.c (stab_array_type): Add casts when printing + bfd_signed_vma values. + + * configure: Rebuild with autoconf 2.12. + +Mon Nov 25 16:53:18 1996 Ian Lance Taylor + + * objdump.c (disassemble_data): Don't crash if there is no + symbol. + +Fri Nov 22 17:29:14 1996 Andreas Schwab + + * ar.c (open_inarch): Don't call bfd_openr with a null name. + +Fri Nov 1 12:08:13 1996 Ian Lance Taylor + + * binutils.texi: Add section on reporting bugs. + +Thu Oct 31 18:20:53 1996 Ian Lance Taylor + + * stabs.c (struct stab_handle): Add bincl_list field. + (parse_stab): Pass value to push_bincl. Call find_excl for + N_EXCL. + (struct bincl_file): Add hash, file and file_types fields. + (push_bincl): Add hash parameter. Save it in the new hash field. + Save the file number in the new file field. + (pop_bincl): Put the bincl_file on bincl_list, rather than freeing + it. Save the file types in the new file_types field. + (find_excl): New static function. + + * ieee.c (ieee_lineno): Don't compare line number addresses to + info->highaddr (undo part of October 28 patch). + +Tue Oct 29 16:40:22 1996 Ian Lance Taylor + + * objdump.c (objdump_print_value): Don't print the empty string + for zero. + +Mon Oct 28 16:58:14 1996 Ian Lance Taylor + + * stabs.c (struct stab_handle): Add function_end field. + (start_stab): Initialize function_end. + (finish_stab): Pass info->function_end to debug_end_function. + (parse_stab): If info->function_end is set, use it as the address + which ends a function. + + * ieee.c (ieee_array_type): Remember the correct size. + + * ieee.c (ieee_finish_compilation_unit): Permit coalescing ranges + that are up to 0x1000 bytes apart, not just 64. + (ieee_add_bb11_blocks): Don't bother to emit a BB11 that is less + than 0x100 bytes. + (ieee_lineno): Only emit line numbers that are less than + info->highaddr. + +Fri Oct 25 12:12:17 1996 Ian Lance Taylor + + * ieee.c (struct ieee_defined_enum): Add defined field. + (ieee_enum_type): If the enum tag has been seen before but not + defined, reuse the same type index, and define it. + (ieee_tag_type): If this enum has not been defined, add an + undefined entry to the list of enums. + + * objdump.c (disassemble_bytes): Let the disassembler override the + number of bytes printed on a line. + +Thu Oct 24 16:42:10 1996 Ian Lance Taylor + + * objdump.c (prefix_addresses): New static variable. + (long_options): Add "prefix-addresses". + (compare_symbols): Sort BSF_FUNCTION symbols before other + symbols. + (find_symbol_for_address): New static function, broken out of + objdump_print_address. + (objdump_print_addr_with_sym): New static function, broken out of + objdump_print_address. + (objdump_print_address): Call new functions. + (disassemble_bytes): New static function, broken out of + disassemble_data. Change disassembly format, unless + prefix_addresses is set. + (disassemble_data): Call disassemble_bytes. Unless + prefix_addresses is set, disassemble in chunks headed by a + symbol. + * binutils.texi, objdump.1: Document --prefix-addresses. + + * rddbg.c (read_section_stabs_debugging_info): Preserve the + backslash when concatenating multiple stabs strings. + +Thu Oct 10 11:36:31 1996 Doug Evans + + * dlltool.c (scan_open_obj_file): Fix loop exit test. + Add missing parameter to def_exports. + +Tue Oct 8 12:06:17 1996 Ian Lance Taylor + + * Makefile.in (LEX_OPTIONS): Set to empty string. -I -Cem is the + default for flex, and is not recognized by lex. + +Thu Oct 3 17:41:23 1996 Ian Lance Taylor + + * binutils.texi (Target Selection): Document that you can now + specify targets using configuration triplets. + + * ar.c (usage): Declare. Make sure all callers pass an argument. + +Thu Oct 3 15:39:42 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) + + * Makefile.in (clean): Remove config.log. + +Wed Oct 2 15:49:16 1996 Klaus Kaempf + + * makefile.vms: Bump version date. + +Tue Oct 1 15:00:59 1996 Ian Lance Taylor + + * version.c (print_version): New function. + * bucomm.h (print_version): Declare. + * ar.c (program_version): Don't declare. + (do_show_version): Remove. + (usage): Add help parameter. Print bug report address. + (main): Set is_ranlib at start. Check for --help and --version. + Call print_version, not do_show_version. + * nlmconv.c (program_version): Don't declare. + (main): Call print_version. + (show_usage): Print bug report address. + * nm.c (program_version, print_version): Don't declare. + (usage): Print bug report address. + (main): Call print_version. + * objcopy.c (program_version): Don't declare. + (copy_usage): Print bug report address. + (strip_usage): Likewise. + (strip_main): Call print_version. + (copy_main): Likewise. + * objdump.c (program_version): Don't declare. + (usage): Print bug report address. + (main): Call print_version. + * size.c (program_version): Don't declare. + (usage): Print bug report address. + (main): Call print_version. + * strings.c (program_version): Don't declare. + (main): Call print_version. + (usage): Print bug report address. + * Makefile.in: Update dependencies. + +Thu Sep 19 14:53:15 1996 Ian Lance Taylor + + * ieee.c: Revert Monday's reflocalp patch, and apply this patch + instead: + (write_ieee_debugging_info): Write a dummy type at the end of the + global type block. + +Mon Sep 16 15:30:54 1996 Ian Lance Taylor + + * ieee.c (struct ieee_write_type): Add reflocalp field. + (ieee_pointer_type): Set reflocalp after pushing type. + (ieee_function_type): If reflocalp is set, make this type local. + (ieee_range_type, ieee_array_type, ieee_set_type): Likewise. + (ieee_const_type, ieee_volatile_type): Likewise. + (ieee_struct_field, ieee_class_baseclass): Likewise. + + * ieee.c (struct ieee_info): Add global_types field. + (parse_ieee_bb): When starting a BB1, initialize the types field + to the global_types field. + (parse_ieee_be): When ending a BB2, copy the types field to the + global_types field. + +Fri Sep 13 17:32:21 1996 Ian Lance Taylor + + * objcopy.c (change_leading_char): New static variable. + (OPTION_CHANGE_LEADING_CHAR): Define. + (copy_options): Add "change-leading-char". + (copy_usage): Mention --change-leading-char. + (filter_symbols): Add obfd parameter. Change all callers. + Implement change_leading_char. + (copy_object): Call filter_symbols if change_leading_char. + (copy_main): Handle OPTION_CHANGE_LEADING_CHAR. + * binutils.texi, objcopy.1: Document --change-leading-char. + +Tue Sep 3 14:05:29 1996 Ian Lance Taylor + + * ieee.c (ieee_enum_type): Don't check index into a NULL names + array. + * nm.c (sort_symbols_by_size): Always initialize next. + * rdcoff.c (parse_coff_type): Warn about an incomprehensible + type rather than crashing. + * rddbg.c (read_symbol_stabs_debugging_info): Initialize f. + * stabs.c (parse_stab_members): Set context in all cases. + +Thu Aug 29 16:56:52 1996 Michael Meissner + + * configure.in (i[345]86-*-*): Recognize i686 for pentium pro. + * configure: Regenerate. + +Thu Aug 29 11:29:20 1996 Ian Lance Taylor + + * objdump.c (L_tmpnam): Never define. + (display_target_list): Use choose_temp_base instead of tmpnam. + (display_info_table): Likewise. + +Tue Aug 27 18:15:01 1996 Ian Lance Taylor + + * stabs.c (parse_stab): An N_FUN symbol with an empty string + indicates the end of a function. + +Thu Aug 22 17:08:00 1996 Ian Lance Taylor + + * wrstabs.c (struct string_hash_entry): Add next field. + (struct stab_write_handle): Change strings to a pointer to + string_hash_entry. Add last_strings field. Remove strings_alloc + field. + (string_hash_newfunc): Initialize next field. + (stab_write_symbol): Copy string into hash table rather than into + buffer. Keep a list of hash table entries. + (write_stabs_in_sections_debugging_info): Initialize last_string. + Copy strings from list of hash table entries in memory. + (stab_modify_type): If the entry on the stack is a definition, + make a new definition rather than failing an assert. + (stab_array_type): The size is only zero if high is strictly less + than low. + + * ieee.c (struct ieee_info): Add saw_filename field. + (parse_ieee): Initialize saw_filename. + (parse_ieee_bb): Set saw_filename for a BB1 or BB2. In a BB1, + discard the current variables and types. In a BB10, if no + filename has been seen, call debug_set_filename. + (parse_ieee_ty): In case 'g', the type is optional. + + * prdbg.c (pr_fix_visibility): Don't abort on + DEBUG_VISIBILITY_IGNORE. + + * debug.c (debug_name_type): Correct error message. + + * configure.in: Substitute HLDENV. + * configure: Rebuild. + * Makefile.in (HLDENV): New variable. Use it whenever linking a + program. + +Thu Aug 15 19:30:41 1996 Stan Shebs + + * mpw-make.sed: Add symbolic doublequotes around the version + number. + +Thu Aug 8 12:27:52 1996 Klaus Kaempf + + * makefile.vms: Add better support for DEC C compilation. + Add new macros as in Makefile.in. + +Wed Aug 7 14:27:33 1996 Philippe De Muyter + + * configure.in: Call BFD_NEED_DECLARATION on strstr and sbrk. + * acconfig.h (NEED_DECLARATION_STRSTR): New macro. + (NEED_DECLARATION_SBRK): New macro. + * configure, config.in: Rebuild. + * bucomm.h (strstr): Declare if NEED_DECLARATION_STRSTR. + (sbrk): Declare if HAVE_SBRK and NEED_DECLARATION_SBRK. + + * prdbg.c (pr_end_struct_type): Avoid using a string constant in + assert, for the benefit of broken assert macros. + +Fri Jul 26 14:06:50 1996 Ian Lance Taylor + + * objdump.c (disassemble_data): Set disasm_info.flavour from + abfd. + +Tue Jul 23 13:59:54 1996 Ian Lance Taylor + + * dlltool.c (secdata): In non DLLTOOL_PPC case, change alignment + of .text section to 2. + +Mon Jul 22 08:46:15 1996 Stu Grossman (grossman@lisa.cygnus.com) + + * objdump.c (dump_section_stabs): Fix test for stabs sections + ending with numbers. This fixes a problem with .stab being + confused with .stab.index. + +Wed Jul 10 13:32:28 1996 Ian Lance Taylor + + * stabs.c (stab_demangle_fund_type): Return a void * for a + template, rather than simply aborting. + +Mon Jul 8 15:28:05 1996 Ian Lance Taylor * ar.c (open_inarch): Add file parameter. Change all callers. If this is a newly created archive, set the target based on the @@ -9,7 +577,9 @@ Thu Jul 4 12:00:55 1996 Ian Lance Taylor - * Makefile.in (VERSION): Set to 2.7. + * Makefile.in (VERSION): Set to cygnus-2.7.1. + + * Released binutils 2.7. * rdcoff.c (parse_coff): Get address to pass to debug_end_function from function size, not value of .ef symbol. From Ning @@ -3386,7 +3956,6 @@ Thu Jun 3 10:40:19 1993 Jeffrey Osier (jeffrey@cygnus.com) * Makefile.in: added c++filt and objcopy to MANPAGES variable - * .Sanitize: keep c++filt.1 and objcopy.1 Thu Jun 3 00:32:52 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) @@ -4269,7 +4838,7 @@ Local Variables: -mode: indented-text +mode: change-log left-margin: 8 fill-column: 74 version-control: never diff -urN binutils-2.7/binutils/Makefile.in binutils-2.8/binutils/Makefile.in --- binutils-2.7/binutils/Makefile.in Mon Jul 15 15:08:34 1996 +++ binutils-2.8/binutils/Makefile.in Wed Apr 30 13:06:18 1997 @@ -1,5 +1,5 @@ # Makefile for GNU binary-file utilities -# Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. +# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. # This file is part of GNU binutils. @@ -57,6 +57,7 @@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ HLDFLAGS = @HLDFLAGS@ +HLDENV = @HLDENV@ RPATH_ENVVAR = @RPATH_ENVVAR@ MAKEINFO = makeinfo TEXI2DVI = texi2dvi @@ -70,12 +71,11 @@ SYMLINK = ln -s BISON = bison -y -# Comment these out if using lex. -LEX_OPTIONS = -I -Cem +LEX_OPTIONS = LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` # Distribution version -VERSION=2.7 +VERSION=2.8 # Distribution name DIST_NAME=binutils-${VERSION} @@ -101,14 +101,16 @@ # Note: This one is used as the installed name too, unlike the above. DEMANGLER_PROG=c++filt +ADDR2LINE_PROG=addr2line + NLMCONV_PROG=nlmconv DLLTOOL_PROG=dlltool SRCONV_PROG=srconv sysdump coffdump -MANPAGES= ar nm objdump ranlib size strings strip objcopy nlmconv +MANPAGES= ar nm objdump ranlib size strings strip objcopy addr2line nlmconv -PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ +PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) $(ADDR2LINE_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ STAGESTUFF = $(PROGS) *.o # Files that can be generated, but should be in the distribution. # Don't build $(DEMANGLER_PROG).1, since its name may vary with the @@ -125,14 +127,14 @@ INCLUDES = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) DEP = mkdep -ALL_CFLAGS = $(INCLUDES) @HDEFINES@ $(CFLAGS) +ALL_CFLAGS = -D_GNU_SOURCE $(INCLUDES) @HDEFINES@ $(CFLAGS) HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h -CFILES = ar.c arsup.c bucomm.c coffdump.c coffgrok.c debug.c dlltool.c \ - filemode.c ieee.c is-ranlib.c is-strip.c maybe-ranlib.c \ +CFILES = addr2line.c ar.c arsup.c bucomm.c coffdump.c coffgrok.c debug.c \ + dlltool.c filemode.c ieee.c is-ranlib.c is-strip.c maybe-ranlib.c \ maybe-strip.c nlmconv.c nm.c not-ranlib.c not-strip.c \ objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \ stabs.c strings.c sysdump.c version.c wrstabs.c @@ -245,42 +247,42 @@ dvi: binutils.dvi $(SIZE_PROG): $(ADDL_DEPS) size.o - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(SIZE_PROG) size.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(SIZE_PROG) size.o $(ADDL_LIBS) $(EXTRALIBS) $(OBJCOPY_PROG): $(ADDL_DEPS) objcopy.o not-strip.o $(WRITE_DEBUG_OBJS) - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o not-strip.o $(WRITE_DEBUG_OBJS) $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o not-strip.o $(WRITE_DEBUG_OBJS) $(ADDL_LIBS) $(EXTRALIBS) $(STRINGS_PROG): $(ADDL_DEPS) strings.o - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(STRINGS_PROG) strings.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(STRINGS_PROG) strings.o $(ADDL_LIBS) $(EXTRALIBS) $(STRIP_PROG): $(ADDL_DEPS) objcopy.o is-strip.o $(WRITE_DEBUG_OBJS) - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(STRIP_PROG) objcopy.o is-strip.o $(WRITE_DEBUG_OBJS) $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(STRIP_PROG) objcopy.o is-strip.o $(WRITE_DEBUG_OBJS) $(ADDL_LIBS) $(EXTRALIBS) $(NM_PROG): $(ADDL_DEPS) nm.o - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(NM_PROG) nm.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(NM_PROG) nm.o $(ADDL_LIBS) $(EXTRALIBS) -#libbfd is searched twice here ($(BFDLIB) and $(ADDL_LIBS)) because when a -#shared libbfd is built with --enable-commonbfdlib, all of libopcodes is -#available in libbfd.so and we don't want to link anything from libopcodes.a $(OBJDUMP_PROG): $(ADDL_DEPS) objdump.o prdbg.o $(DEBUG_OBJS) $(OPCODES_DEP) - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJDUMP_PROG) objdump.o prdbg.o $(DEBUG_OBJS) $(BFDLIB) $(OPCODES) $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJDUMP_PROG) objdump.o prdbg.o $(DEBUG_OBJS) $(OPCODES) $(ADDL_LIBS) $(EXTRALIBS) underscore.c: stamp-under ; @true stamp-under: Makefile echo '/*WARNING: This file is automatically generated!*/' >underscore.t echo "int prepends_underscore = @UNDERSCORE@;" >>underscore.t - $(srcdir)/../move-if-change underscore.t underscore.c + $(SHELL) $(srcdir)/../move-if-change underscore.t underscore.c touch stamp-under version.o: version.c Makefile $(CC) -DVERSION='"$(VERSION)"' $(ALL_CFLAGS) -c $(srcdir)/version.c +bucomm.o: bucomm.c Makefile + $(CC) -DTARGET='"@target@"' $(ALL_CFLAGS) -c $(srcdir)/bucomm.c + cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h $(CC) -c -DMAIN -DVERSION='"$(VERSION)"' $(ALL_CFLAGS) $(BASEDIR)/libiberty/cplus-dem.c $(DEMANGLER_PROG): cplus-dem.o $(LIBIBERTY) underscore.o $(DEMANGLER_PROG).1 - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(DEMANGLER_PROG) cplus-dem.o $(LIBIBERTY) $(EXTRALIBS) underscore.o + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(DEMANGLER_PROG) cplus-dem.o $(LIBIBERTY) $(EXTRALIBS) underscore.o arparse.c: arparse.y $(BISON) $(BISONFLAGS) $(srcdir)/arparse.y @@ -296,10 +298,13 @@ mv lex.yy.c arlex.c $(AR_PROG): $(ADDL_DEPS) ar.o arparse.o arlex.o not-ranlib.o arsup.o - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o arparse.o arlex.o arsup.o not-ranlib.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o arparse.o arlex.o arsup.o not-ranlib.o $(ADDL_LIBS) $(EXTRALIBS) $(RANLIB_PROG): $(ADDL_DEPS) ar.o is-ranlib.o arparse.o arlex.o arsup.o - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(RANLIB_PROG) ar.o arparse.o arlex.o arsup.o is-ranlib.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(RANLIB_PROG) ar.o arparse.o arlex.o arsup.o is-ranlib.o $(ADDL_LIBS) $(EXTRALIBS) + +$(ADDR2LINE_PROG): $(ADDL_DEPS) addr2line.o + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(ADDR2LINE_PROG) addr2line.o $(ADDL_LIBS) $(EXTRALIBS) # This rule creates a single binary that switches between ar and ranlib # by looking at argv[0]. Use this kludge to save some disk space. @@ -309,14 +314,14 @@ # Alternatively, you can install ranlib.sh as ranlib. ar_with_ranlib: $(ADDL_DEPS) ar.o maybe-ranlib.o - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(EXTRALIBS) -rm -f $(RANLIB_PROG) -ln $(AR_PROG) $(RANLIB_PROG) # objcopy and strip in one binary that uses argv[0] to decide its action. objcopy_with_strip: $(ADDL_DEPS) objcopy.o maybe-strip.o - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o maybe-strip.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o maybe-strip.o $(ADDL_LIBS) $(EXTRALIBS) -rm -f $(STRIP_PROG) -ln $(OBJCOPY_PROG) $(STRIP_PROG) @@ -362,10 +367,10 @@ fi srconv: srconv.o coffgrok.o $(ADDL_DEPS) - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ srconv.o coffgrok.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ srconv.o coffgrok.o $(ADDL_LIBS) $(EXTRALIBS) dlltool: dlltool.o defparse.o deflex.o cplus-dem.o $(ADDL_DEPS) - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ dlltool.o defparse.o deflex.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ dlltool.o defparse.o deflex.o $(ADDL_LIBS) $(EXTRALIBS) defparse.c:defparse.y $(BISON) $(BISONFLAGS) $(srcdir)/defparse.y @@ -382,10 +387,10 @@ $(CC) -c @DLLTOOL_DEFS@ $(ALL_CFLAGS) $(srcdir)/dlltool.c coffdump: coffdump.o coffgrok.o $(ADDL_DEPS) - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ coffdump.o coffgrok.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ coffdump.o coffgrok.o $(ADDL_LIBS) $(EXTRALIBS) sysdump: sysdump.o $(ADDL_DEPS) - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ sysdump.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ sysdump.o $(ADDL_LIBS) $(EXTRALIBS) # Depend upon sysinfo.c to avoid building both nlmheader.c and sysinfo.c # simultaneously. @@ -401,7 +406,7 @@ $(CC) -c -DLD_NAME="\"$${ldname}\"" @NLMCONV_DEFS@ $(ALL_CFLAGS) $(srcdir)/nlmconv.c $(NLMCONV_PROG): nlmconv.o nlmheader.o $(ADDL_DEPS) - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ nlmconv.o nlmheader.o $(ADDL_LIBS) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ nlmconv.o nlmheader.o $(ADDL_LIBS) $(EXTRALIBS) # Targets to rebuild dependencies in this Makefile. # Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES). @@ -415,7 +420,7 @@ rm -f .dep2 echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2 $(DEP) -f .dep2 $(ALL_CFLAGS) $? - $(srcdir)/../move-if-change .dep2 .dep1 + $(SHELL) $(srcdir)/../move-if-change .dep2 .dep1 dep.sed: dep-in.sed config.status sed <$(srcdir)/dep-in.sed >dep.sed \ @@ -426,12 +431,12 @@ dep: .dep sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile cat .dep >> tmp-Makefile - $(srcdir)/../move-if-change tmp-Makefile Makefile + $(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile dep-in: .dep sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in cat .dep >> tmp-Makefile.in - $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in + $(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in .PHONY: dep dep-in @@ -515,20 +520,22 @@ ### mostlyclean: - -rm -f *.o *~ \#* core binutils.?? binutils.??? y.output config.log + -rm -f *.o *~ \#* core binutils.?? binutils.??? y.output -rm -rf tmpdir clean: mostlyclean -rm -f $(PROGS) $(DEMANGLER_PROG).1 stamp-under -rm -f underscore.c sysroff sysroff.c sysroff.h sysinfo dep.sed distclean: -rm -f Makefile config.status *.o *~ \#* core y.* - -rm -f binutils.?? binutils.??s binutils.aux binutils.log binutils.toc + -rm -f binutils.?? binutils.??? binutils.aux binutils.log binutils.toc -rm -f $(PROGS) underscore.c config.h stamp-h config.cache config.log - -rm -f dep.sed stamp-under $(DEMANGLER_PROG).1 + -rm -f dep.sed stamp-under $(DEMANGLER_PROG).1 site.bak site.exp + -rm -f sysroff sysroff.c sysroff.h sysinfo + -rm -rf tmpdir maintainer-clean realclean: clean distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." - -rm -f $(DISTSTUFF) *.info TAGS + -rm -f $(DISTSTUFF) binutils.info* TAGS etags tags: TAGS @@ -554,6 +561,7 @@ k=`echo $$j | sed '$(program_transform_name)'`; \ ln $(bindir)/$$k $(tooldir)/bin/$$j >/dev/null 2>/dev/null \ || $(INSTALL_PROGRAM) $$i $(tooldir)/bin/$$j; \ + else true; \ fi; \ done @@ -576,7 +584,6 @@ # Making a dist: # cvs rtag binutils-x-yy ld+utils # cvs co -r binutils-x-yy ld+utils -# Sanitize # cd {HERE}; make dist [-f Makefile.in] dist: $(DIST_NAME).tar.z @@ -648,101 +655,94 @@ # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. -ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h \ - $(INCDIR)/libiberty.h $(INCDIR)/progress.h bucomm.h \ - config.h $(INCDIR)/fopen-same.h $(INCDIR)/aout/ar.h \ - $(BFDDIR)/libbfd.h arsup.h +addr2line.o: addr2line.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h +ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h arsup.h arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h arsup.h $(INCDIR)/libiberty.h bucomm.h \ - config.h $(INCDIR)/fopen-same.h + arsup.h $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/fopen-same.h bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h $(INCDIR)/libiberty.h bucomm.h \ - config.h $(INCDIR)/fopen-same.h + $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/fopen-same.h coffdump.o: coffdump.c coffgrok.h bucomm.h config.h \ $(INCDIR)/fopen-same.h coffgrok.o: coffgrok.c bucomm.h config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ coffgrok.h debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + debug.h dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h $(INCDIR)/libiberty.h bucomm.h \ - config.h $(INCDIR)/fopen-same.h $(INCDIR)/getopt.h \ - $(INCDIR)/demangle.h + $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/getopt.h $(INCDIR)/demangle.h filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h -ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h \ - $(INCDIR)/ieee.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h + bucomm.h config.h $(INCDIR)/fopen-same.h +ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/ieee.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + debug.h budbg.h is-ranlib.o: is-ranlib.c is-strip.o: is-strip.c maybe-ranlib.o: maybe-ranlib.c maybe-strip.o: maybe-strip.c nlmconv.o: nlmconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h $(INCDIR)/libiberty.h bucomm.h \ - config.h $(INCDIR)/fopen-same.h $(BFDDIR)/libnlm.h \ - $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h \ - nlmconv.h -nm.o: nm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h \ - $(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/getopt.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ranlib.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h + $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(BFDDIR)/libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + $(INCDIR)/nlm/external.h nlmconv.h +nm.o: nm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/progress.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/getopt.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ranlib.h \ + $(INCDIR)/demangle.h $(INCDIR)/libiberty.h not-ranlib.o: not-ranlib.c not-strip.o: not-strip.c objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h $(INCDIR)/progress.h bucomm.h config.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h \ - budbg.h + $(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/getopt.h $(INCDIR)/libiberty.h budbg.h objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h $(INCDIR)/getopt.h $(INCDIR)/progress.h \ - bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/dis-asm.h \ - $(INCDIR)/libiberty.h debug.h budbg.h $(INCDIR)/aout/aout64.h + $(INCDIR)/getopt.h $(INCDIR)/progress.h bucomm.h config.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/aout/aout64.h prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + debug.h budbg.h rdcoff.o: rdcoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h $(INCDIR)/coff/internal.h bucomm.h \ - config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/demangle.h debug.h budbg.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h + $(INCDIR)/coff/internal.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ + budbg.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h rddbg.o: rddbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h -size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h \ - $(INCDIR)/getopt.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + debug.h budbg.h +size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h srconv.o: srconv.c bucomm.h config.h $(INCDIR)/fopen-same.h \ sysroff.h coffgrok.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h sysroff.c stabs.o: stabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ - budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def strings.o: strings.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - sysroff.h sysroff.c -version.o: version.c + bucomm.h config.h $(INCDIR)/fopen-same.h sysroff.h \ + sysroff.c +version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + debug.h budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def underscore.o: underscore.c arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - arsup.h -arlex.o: arlex.c arparse.h + bucomm.h config.h $(INCDIR)/fopen-same.h arsup.h +arlex.o: arlex.c $(INCDIR)/libiberty.h arparse.h sysroff.o: sysroff.c sysinfo.o: sysinfo.c syslex.o: syslex.c sysinfo.h defparse.o: defparse.c deflex.o: deflex.c defparse.h -nlmheader.o: nlmheader.c ../bfd/bfd.h $(INCDIR)/obstack.h \ - bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h \ - $(INCDIR)/nlm/internal.h nlmconv.h +nlmheader.o: nlmheader.c ../bfd/bfd.h bucomm.h config.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + nlmconv.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff -urN binutils-2.7/binutils/NEWS binutils-2.8/binutils/NEWS --- binutils-2.7/binutils/NEWS Thu Jul 4 12:23:23 1996 +++ binutils-2.8/binutils/NEWS Wed Apr 30 12:59:01 1997 @@ -1,6 +1,32 @@ -*- text -*- -Changes since binutils 2.6 +Changes in binutils 2.8: + +* The objdump disassembly format has been changed, and hopefully improved. Use + the new --prefix-addresses option to get the old format. There are also new + --disassemble-zeroes and --no-show-raw-insn options which affect disassembler + output. + +* Formats may now be specified as configuration triplets. For example, + objdump -b i386-pc-linux. The triplets are not passed through config.sub, + so they must be in canonical form. + +* Added new addr2line program. This uses the debugging information to convert + an address into a file name and line number within a program. + +* Added --change-leading-char argument to objcopy. + +* Added --weaken argument to objcopy. + +* objdump --dynamic-reloc now works on ELF executables and shared libraries. + +* Added --adjust-vma option to objdump. + +* Added -C/--demangle option to objdump. + +* Added -p/--preserve-dates option to strip and objcopy. + +Changes in binutils 2.7: * Added --enable-shared and --enable-commonbfdlib options to configure. @@ -18,7 +44,7 @@ * Added support for Alpha OpenVMS/AXP. -Changes since binutils 2.5 +Changes in binutils 2.6: * Added -N/--strip-symbol and -K/--keep-symbol arguments to strip and objcopy. @@ -30,7 +56,7 @@ * ar and ranlib now work on AIX. The tools are now built by default on AIX. -Changes since binutils 2.4 +Changes in binutils 2.5: * Changed objdump -dr to dump the relocs interspersed with the assembly listing, for a more useful listing of relocateable files. @@ -43,7 +69,7 @@ * strip and objcopy should now be able to handle dynamically linked ELF executables. -Changes since binutils 2.3 +Changes in binutils 2.4: * Support for HP-PA (by Jeff Law), i386 Mach (by David Mackenzie), RS/6000 and PowerPC (except ar and ranlib; by Ian Taylor). @@ -53,7 +79,7 @@ * Programs `strip' and `objcopy' will not attempt to write dynamically linked ELF output files, since BFD currently can't create them properly. -Changes since binutils 2.2 +Changes in binutils 2.3: * A new --stabs argument has been added to objdump to dump stabs sections in ELF and COFF files. @@ -63,7 +89,7 @@ * The strings program has been added. -Changes since binutils 2.1 +Changes in binutils 2.2: * The 'copy' program has been renamed to 'objcopy', for consistency with 'objdump', and because 'copy' might more plausibly be used as a synonym for @@ -86,7 +112,7 @@ * There is the beginnings of a test suite. -Changes since binutils 2.0 +Changes in binutils 2.1: * There is now support for writing ECOFF files, so ld and the other utilities should work on Risc/Ultrix and Irix. Please let us know how well this works. diff -urN binutils-2.7/binutils/README binutils-2.8/binutils/README --- binutils-2.7/binutils/README Thu Jul 4 12:23:23 1996 +++ binutils-2.8/binutils/README Wed Apr 30 12:59:01 1997 @@ -7,48 +7,27 @@ As of version 2.5, the assembler (as) is also included in this package, in ../gas. Assembler-specific notes can be found in ../gas/README. -These programs have been tested on various architectures. -However, since this is a beta release taken directly from an -evolving source tree, there might be some problems. In particular, -the programs have not been ported to as many machines as the -old binutils. There are also features of the old versions -that are missing on the new programs. We would appreciate -patches to make things run on other machines; especially welcome -are fixes for what used to work on the old programs! -(See ./TODO, as well a ../bfd/TODO and ../ld/TODO.) - Recent changes are in ./NEWS, ../ld/NEWS, and ../gas/NEWS. Unpacking and Installation -- quick overview -========================== +============================================ -In this release, the binary utilities, the linker, the generic GNU include -files, the BFD ("binary file description") library, gprof, and getopt all -have directories of their own underneath the binutils-2.7 directory. -The idea is that a variety of GNU tools can -share a common copy of these things. Configuration scripts and -makefiles exist to cruise up and down this directory tree and -automatically build all the pieces in the right order. - -When you unpack the binutils-2.7.tar.gz file, you'll get a directory -called something like `binutils-2.7', which contains: - - COPYING bfd/ configure* libiberty/ - COPYING.LIB binutils/ configure.in move-if-change* - CYGNUS build-all.mk etc/ opcodes/ - ChangeLog config/ gprof/ test-build.mk - Makefile.in config.guess* inc +When you unpack the binutils-2.8.tar.gz file, you'll get a directory +called something like `binutils-2.8', which contains various files and +directories. Most of the files in the top directory are for +information and for configuration. The actual source code is in +subdirectories. To build binutils, you can just do: - cd binutils-2.7 + cd binutils-2.8 ./configure [ --enable-targets='target1,target2...' ] make make install # copies the programs files into /usr/local/bin # by default. -This will configure and build all the libraries as well as binutils -and the linker. +This will configure and build all the libraries as well as the +assembler, the binutils, and the linker. The --enable-targets option adds support for more binary file formats besides the default. By default, support for only the @@ -59,7 +38,7 @@ ./configure --enable-targets=sun3,rs6000-aix,decstation The name 'all' compiles in support for all valid BFD targets (this was -the default in previous releases): +the default in releases before 2.3): ./configure --enable-targets=all @@ -71,8 +50,8 @@ libraries. This will only work on certain systems, and currently will only work when compiling with gcc. You can use arguments with the --enable-shared option to indicate that only certain libraries should -be built shared; for example, --enable-shared=bfd. The only -possibilities in a binutils release are bfd and opcodes. +be built shared; for example, --enable-shared=bfd. The only potential +shared libraries in a binutils release are bfd and opcodes. The binutils will be linked against the shared libraries. The build step will attempt to place the correct library in the runtime search @@ -86,7 +65,7 @@ libiberty libraries. It will be installed as libbfd. This option will make the binutils programs as small as possible. -To build under openVMS/AXP, see the file make-all.com in the top level +To build under openVMS/AXP, see the file makefile.vms in the top level directory. If you don't have ar @@ -110,7 +89,7 @@ Porting ======= -Binutils-2.7 supports many different architectures, but there +Binutils-2.8 supports many different architectures, but there are many more not supported, including some that were supported by earlier versions. We are hoping for volunteers to improve this situation. @@ -120,18 +99,9 @@ in ../bfd/doc. The file ../gdb/doc/gdbint.texinfo (distributed with gdb-4.x) may also be of help. -If your system uses some variant of old-style a.out-format, -you can start with a copy of bfd/newsos3.c, and edit it to fit. -(You may also need to tweak bfd/aout-target.h.) -Alternatively, you could use the host-aout.c target. This is a -special kludge that only works for native (non-cross) configurations. - Reporting bugs ============== -If you can't track down a bug and send suggestions/patches -for fixes, you should probably *not* be using this release. -We have little time to spend tracking down whatever random bugs you -may run into (except for configurations that Cygnus supports for -its customers). The general place to send bug reports or patches -is to bug-gnu-utils@prep.ai.mit.edu; you can also send them directly -to raeburn@cygnus.com or ian@cygnus.com. +Send bug reports and patches to bug-gnu-utils@prep.ai.mit.edu. Always +mention the version number you are running; this is printed by running +any of the binutils with the --version option. We appreciate reports +about bugs, but we do not promise to fix them. diff -urN binutils-2.7/binutils/TODO binutils-2.8/binutils/TODO --- binutils-2.7/binutils/TODO Thu Jul 4 12:23:23 1996 +++ binutils-2.8/binutils/TODO Wed Dec 31 19:00:00 1969 @@ -1,13 +0,0 @@ -o - strip - Make faster by using ftruncate if available (and format is suitable). - -o - objdump - Add option to demangle C++ names. - -o - nm, BFD - Print more information about the symbols for more object file formats. - Print the symbol size in POSIX format. - -o - See also ../ld/TODO and ../bfd/TODO. - -o - objdump -d: Print relocatable addresses intelligently. diff -urN binutils-2.7/binutils/acconfig.h binutils-2.8/binutils/acconfig.h --- binutils-2.7/binutils/acconfig.h Thu Jul 4 12:23:23 1996 +++ binutils-2.8/binutils/acconfig.h Wed Apr 30 12:59:00 1997 @@ -1,6 +1,15 @@ +/* Whether strstr must be declared even if is included. */ +#undef NEED_DECLARATION_STRSTR + /* Whether fprintf must be declared even if is included. */ #undef NEED_DECLARATION_FPRINTF + +/* Whether sbrk must be declared even if is included. */ +#undef NEED_DECLARATION_SBRK + +/* Whether getenv must be declared even if is included. */ +#undef NEED_DECLARATION_GETENV @TOP@ /* Is the type time_t defined in ? */ diff -urN binutils-2.7/binutils/addr2line.1 binutils-2.8/binutils/addr2line.1 --- binutils-2.7/binutils/addr2line.1 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/binutils/addr2line.1 Wed Apr 30 12:59:02 1997 @@ -0,0 +1,127 @@ +.\" Copyright (c) 1997 Free Software Foundation +.\" See COPYING for conditions for redistribution +.TH addr2line 1 "27 March 1997" "Cygnus Solutions" "GNU Development Tools" +.de BP +.sp +.ti \-.2i +\(** +.. + +.SH NAME +addr2line \- convert addresses into file names and line numbers + +.SH SYNOPSIS +.hy 0 +.na +.TP +.B addr2line +.RB "[\|" "\-b\ "\c +.I bfdname\c +.RB " | " "\-\-target="\c +.I bfdname\c +\&\|] +.RB "[\|" \-C | \-\-demangle "\|]" +.RB "[\|" "\-e\ "\c +.I filename\c +.RB " | " "\-\-exe="\c +.I filename\c +\&\|] +.RB "[\|" \-f | \-\-functions "\|]" +.RB "[\|" \-s | \-\-basenames "\|]" +.RB "[\|" \-H | \-\-help "\|]" +.RB "[\|" \-V | \-\-version "\|]" +.RB "[\|" addr addr ... "\|]" +.ad b +.hy 1 +.SH DESCRIPTION +\c +.B addr2line +translates program addresses into file names and line numbers. Given +an address and an executable, it uses the debugging information in the +executable to figure out which file name and line number are +associated with a given address. + +The executable to use is specified with the +.B \-e +option. The default is +.B a.out\c +\&. + +.B addr2line +has two modes of operation. + +In the first, hexadecimal addresses are specified on the command line, +and +.B addr2line +displays the file name and line number for each address. + +In the second, +.B addr2line +reads hexadecimal addresses from standard input, and prints the file +name and line number for each address on standard output. In this +mode, +.B addr2line +may be used in a pipe to convert dynamically chosen addresses. + +The format of the output is FILENAME:LINENO. The file name and line +number for each address is printed on a separate line. If the +.B \-f +option is used, then each FILENAME:LINENO line is preceded by a +FUNCTIONNAME line which is the name of the function containing the +address. + +If the file name or function name can not be determined, +.B addr2line +will print two question marks in their place. If the line number can +not be determined, +.B addr2line +will print 0. + +.SH OPTIONS +.TP +.BI "\-b " "bfdname"\c +.TP +.BI "\-\-target=" "bfdname" +Specify the object-code format for the object files to be +\c +.I bfdname\c +\&. + +.TP +.B \-C +.TP +.B \-\-demangle +Decode (\fIdemangle\fP) low-level symbol names into user-level names. +Besides removing any initial underscore prepended by the system, this +makes C++ function names readable. + +.TP +.BI "\-e " "filename"\c +.TP +.BI "\-\-exe=" "filename" +Specify the name of the executable for which addresses should be +translated. The default file is +.B a.out\c +\&. + +.TP +.B \-f +.TP +.B \-\-functions +Display function names as well as file and line number information. + +.TP +.B \-s +.TP +.B \-\-basenames +Display only the base of each file name. + +.SH "SEE ALSO" +.RB "`\|" binutils "\|'" +entry in +.B +info\c +\&; +.I +The GNU Binary Utilities\c +\&, Roland H. Pesch (October 1991). diff -urN binutils-2.7/binutils/addr2line.c binutils-2.8/binutils/addr2line.c --- binutils-2.7/binutils/addr2line.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/binutils/addr2line.c Wed Apr 30 12:59:02 1997 @@ -0,0 +1,324 @@ +/* addr2line.c -- convert addresses to line number and function name + Copyright 1997 Free Software Foundation, Inc. + Contributed by Ulrich Lauther + + This file is part of GNU Binutils. + + 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Derived from objdump.c and nm.c by Ulrich.Lauther@zfe.siemens.de + + Usage: + addr2line [options] addr addr ... + or + addr2line [options] + + both forms write results to stdout, the second form reads addresses + to be converted from stdin. */ + +#include +#include + +#include "bfd.h" +#include "getopt.h" +#include "libiberty.h" +#include "demangle.h" +#include "bucomm.h" + +extern char *program_version; + +static boolean with_functions; /* -f, show function names. */ +static boolean do_demangle; /* -C, demangle names. */ +static boolean base_names; /* -s, strip directory names. */ + +static int naddr; /* Number of addresses to process. */ +static char **addr; /* Hex addresses to process. */ + +static asymbol **syms; /* Symbol table. */ + +static struct option long_options[] = +{ + {"basenames", no_argument, NULL, 's'}, + {"demangle", no_argument, NULL, 'C'}, + {"exe", required_argument, NULL, 'e'}, + {"functions", no_argument, NULL, 'f'}, + {"target", required_argument, NULL, 'b'}, + {"help", no_argument, NULL, 'H'}, + {"version", no_argument, NULL, 'V'}, + {0, no_argument, 0, 0} +}; + +static void usage PARAMS ((FILE *, int)); +static void slurp_symtab PARAMS ((bfd *)); +static void find_address_in_section PARAMS ((bfd *, asection *, PTR)); +static void translate_addresses PARAMS ((bfd *)); +static void process_file PARAMS ((const char *, const char *)); + +/* Print a usage message to STREAM and exit with STATUS. */ + +static void +usage (stream, status) + FILE *stream; + int status; +{ + fprintf (stream, "\ +Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n\ + [-e executable] [--exe=executable] [--demangle]\n\ + [--basenames] [--functions] [addr addr ...]\n", + program_name); + list_supported_targets (program_name, stream); + if (status == 0) + fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); + exit (status); +} + +/* Read in the symbol table. */ + +static void +slurp_symtab (abfd) + bfd *abfd; +{ + long storage; + long symcount; + + if ((bfd_get_file_flags (abfd) & HAS_SYMS) == 0) + return; + + storage = bfd_get_symtab_upper_bound (abfd); + if (storage < 0) + bfd_fatal (bfd_get_filename (abfd)); + + syms = (asymbol **) xmalloc (storage); + + symcount = bfd_canonicalize_symtab (abfd, syms); + if (symcount < 0) + bfd_fatal (bfd_get_filename (abfd)); +} + +/* These global variables are used to pass information between + translate_addresses and find_address_in_section. */ + +static bfd_vma pc; +static const char *filename; +static const char *functionname; +static unsigned int line; +static boolean found; + +/* Look for an address in a section. This is called via + bfd_map_over_sections. */ + +static void +find_address_in_section (abfd, section, data) + bfd *abfd; + asection *section; + PTR data; +{ + bfd_vma vma; + + if (found) + return; + + if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0) + return; + + vma = bfd_get_section_vma (abfd, section); + if (pc < vma) + return; + + found = bfd_find_nearest_line (abfd, section, syms, pc - vma, + &filename, &functionname, &line); +} + +/* Read hexadecimal addresses from stdin, translate into + file_name:line_number and optionally function name. */ + +static void +translate_addresses (abfd) + bfd *abfd; +{ + int read_stdin = (naddr == 0); + + for (;;) + { + if (read_stdin) + { + char addr_hex[100]; + + if (fgets (addr_hex, sizeof addr_hex, stdin) == NULL) + break; + pc = strtol (addr_hex, NULL, 16); + } + else + { + if (naddr <= 0) + break; + --naddr; + pc = strtol (*addr++, NULL, 16); + } + + found = false; + bfd_map_over_sections (abfd, find_address_in_section, (PTR) NULL); + + if (! found) + { + if (with_functions) + printf ("??\n"); + printf ("??:0\n"); + } + else + { + if (with_functions) + { + if (*functionname == '\0') + printf ("??\n"); + else if (! do_demangle) + printf ("%s\n", functionname); + else + { + char *res; + + res = cplus_demangle (functionname, DMGL_ANSI | DMGL_PARAMS); + if (res == NULL) + printf ("%s\n", functionname); + else + { + printf ("%s\n", res); + free (res); + } + } + } + + if (base_names) + { + char *h; + + h = strrchr (filename, '/'); + if (h != NULL) + filename = h + 1; + } + + printf ("%s:%u\n", filename, line); + } + + /* fflush() is essential for using this command as a server + child process that reads addresses from a pipe and responds + with line number information, processing one address at a + time. */ + fflush (stdout); + } +} + +/* Process a file. */ + +static void +process_file (filename, target) + const char *filename; + const char *target; +{ + bfd *abfd; + char **matching; + + abfd = bfd_openr (filename, target); + if (abfd == NULL) + bfd_fatal (filename); + + if (bfd_check_format (abfd, bfd_archive)) + fatal ("%s: can not get addresses from archive", filename); + + if (! bfd_check_format_matches (abfd, bfd_object, &matching)) + { + bfd_nonfatal (bfd_get_filename (abfd)); + if (bfd_get_error () == bfd_error_file_ambiguously_recognized) + { + list_matching_formats (matching); + free (matching); + } + xexit (1); + } + + slurp_symtab (abfd); + + translate_addresses (abfd); + + if (syms != NULL) + { + free (syms); + syms = NULL; + } + + bfd_close (abfd); +} + +int +main (argc, argv) + int argc; + char **argv; +{ + char *filename; + char *target; + int c; + + program_name = *argv; + xmalloc_set_program_name (program_name); + + bfd_init (); + set_default_bfd_target (); + + filename = NULL; + target = NULL; + while ((c = getopt_long (argc, argv, "b:Ce:sfHV", long_options, (int *) 0)) + != EOF) + { + switch (c) + { + case 0: + break; /* we've been given a long option */ + case 'b': + target = optarg; + break; + case 'C': + do_demangle = true; + break; + case 'e': + filename = optarg; + break; + case 's': + base_names = true; + break; + case 'f': + with_functions = true; + break; + case 'V': + print_version ("addr2line"); + break; + case 'H': + usage (stdout, 0); + break; + default: + usage (stderr, 1); + break; + } + } + + if (filename == NULL) + filename = "a.out"; + + addr = argv + optind; + naddr = argc - optind; + + process_file (filename, target); + + return 0; +} diff -urN binutils-2.7/binutils/ar.c binutils-2.8/binutils/ar.c --- binutils-2.7/binutils/ar.c Mon Jul 8 15:32:16 1996 +++ binutils-2.8/binutils/ar.c Wed Apr 30 12:59:03 1997 @@ -1,5 +1,5 @@ /* ar.c - Archive modify and extract. - Copyright 1991, 92, 93, 94 Free Software Foundation, Inc. + Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -54,7 +54,10 @@ struct ar_hdr * bfd_special_undocumented_glue PARAMS ((bfd * abfd, char *filename)); -/* Forward declarations */ +/* Static declarations */ + +static void +mri_emul PARAMS ((void)); static const char * normalize PARAMS ((const char *, bfd *)); @@ -94,6 +97,9 @@ static void ranlib_touch PARAMS ((const char *archname)); + +static void +usage PARAMS ((int)); /** Globals and flags */ @@ -139,12 +145,15 @@ pos_default, pos_before, pos_after, pos_end } postype = pos_default; +static bfd ** +get_pos_bfd PARAMS ((bfd **, enum pos)); + /* Whether to truncate names of files stored in the archive. */ static boolean ar_truncate = false; int interactive = 0; -void +static void mri_emul () { interactive = isatty (fileno (stdin)); @@ -207,28 +216,28 @@ boolean operation_alters_arch = false; -extern char *program_version; - -void -do_show_version () +static void +usage (help) + int help; { - printf ("GNU %s version %s\n", program_name, program_version); - xexit (0); -} + FILE *s; -void -usage () -{ - if (is_ranlib == 0) - fprintf (stderr, "\ + s = help ? stdout : stderr; + if (! is_ranlib) + fprintf (s, "\ Usage: %s [-]{dmpqrtx}[abcilosuvV] [member-name] archive-file file...\n\ %s -M [= 6 + && strcmp (temp + strlen (temp) - 6, "ranlib") == 0) + is_ranlib = 1; + else + is_ranlib = 0; + } + + if (argc > 1 && argv[1][0] == '-') + { + if (strcmp (argv[1], "--help") == 0) + usage (1); + else if (strcmp (argv[1], "--version") == 0) + { + if (is_ranlib) + print_version ("ranlib"); + else + print_version ("ar"); + } + } + START_PROGRESS (program_name, 0); bfd_init (); + set_default_bfd_target (); + show_version = 0; xatexit (remove_output); - temp = strrchr (program_name, '/'); - if (temp == (char *) NULL) - temp = program_name; /* shouldn't happen, but... */ - else - ++temp; - if (is_ranlib > 0 || (is_ranlib < 0 && strcmp (temp, "ranlib") == 0)) + if (is_ranlib) { boolean touch = false; - is_ranlib = 1; - if (argc < 2) - usage (); + if (argc < 2 || strcmp (argv[1], "--help") == 0) + usage (0); if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "-v") == 0 || strncmp (argv[1], "--v", 3) == 0) - do_show_version (); + print_version ("ranlib"); arg_index = 1; if (strcmp (argv[1], "-t") == 0) { @@ -345,8 +378,6 @@ } xexit (0); } - else - is_ranlib = 0; if (argc == 2 && strcmp (argv[1], "-M") == 0) { @@ -355,7 +386,7 @@ } if (argc < 2) - usage (); + usage (0); arg_ptr = argv[1]; @@ -440,15 +471,15 @@ break; default: fprintf (stderr, "%s: illegal option -- %c\n", program_name, c); - usage (); + usage (0); } } if (show_version) - do_show_version (); + print_version ("ar"); if (argc < 3) - usage (); + usage (0); if (mri_mode) { @@ -583,8 +614,6 @@ if (stat (archive_filename, &sbuf) != 0) { - bfd *obj; - #ifndef __GO32__ /* KLUDGE ALERT! Temporary fix until I figger why @@ -605,12 +634,17 @@ /* Try to figure out the target to use for the archive from the first object on the list. */ - obj = bfd_openr (file, NULL); - if (obj != NULL) + if (file != NULL) { - if (bfd_check_format (obj, bfd_object)) - target = bfd_get_target (obj); - (void) bfd_close (obj); + bfd *obj; + + obj = bfd_openr (file, NULL); + if (obj != NULL) + { + if (bfd_check_format (obj, bfd_object)) + target = bfd_get_target (obj); + (void) bfd_close (obj); + } } /* Create an empty archive. */ @@ -968,7 +1002,7 @@ into when altering. DEFAULT_POS should be how to interpret pos_default, and should be a pos value. */ -bfd ** +static bfd ** get_pos_bfd (contents, default_pos) bfd **contents; enum pos default_pos; diff -urN binutils-2.7/binutils/arlex.c binutils-2.8/binutils/arlex.c --- binutils-2.7/binutils/arlex.c Mon Jul 15 12:22:12 1996 +++ binutils-2.8/binutils/arlex.c Wed Apr 30 12:59:03 1997 @@ -470,7 +470,7 @@ #line 2 "./arlex.l" /* arlex.l - Strange script language lexer */ -/* Copyright (C) 1992 Free Software Foundation, Inc. +/* Copyright (C) 1992, 95, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -495,10 +495,11 @@ */ #define DONTDECLARE_MALLOC #include +#include "libiberty.h" #include "arparse.h" -extern char *strdup(); + int linenumber; -#line 502 "lex.yy.c" +#line 503 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -645,10 +646,10 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 33 "./arlex.l" +#line 34 "./arlex.l" -#line 652 "lex.yy.c" +#line 653 "lex.yy.c" if ( yy_init ) { @@ -733,208 +734,208 @@ case 1: YY_RULE_SETUP -#line 35 "./arlex.l" +#line 36 "./arlex.l" { return ADDLIB; } YY_BREAK case 2: YY_RULE_SETUP -#line 36 "./arlex.l" +#line 37 "./arlex.l" { return ADDMOD; } YY_BREAK case 3: YY_RULE_SETUP -#line 37 "./arlex.l" +#line 38 "./arlex.l" { return CLEAR; } YY_BREAK case 4: YY_RULE_SETUP -#line 38 "./arlex.l" +#line 39 "./arlex.l" { return CREATE; } YY_BREAK case 5: YY_RULE_SETUP -#line 39 "./arlex.l" +#line 40 "./arlex.l" { return DELETE; } YY_BREAK case 6: YY_RULE_SETUP -#line 40 "./arlex.l" +#line 41 "./arlex.l" { return DIRECTORY; } YY_BREAK case 7: YY_RULE_SETUP -#line 41 "./arlex.l" +#line 42 "./arlex.l" { return END; } YY_BREAK case 8: YY_RULE_SETUP -#line 42 "./arlex.l" +#line 43 "./arlex.l" { return EXTRACT; } YY_BREAK case 9: YY_RULE_SETUP -#line 43 "./arlex.l" +#line 44 "./arlex.l" { return FULLDIR; } YY_BREAK case 10: YY_RULE_SETUP -#line 44 "./arlex.l" +#line 45 "./arlex.l" { return HELP; } YY_BREAK case 11: YY_RULE_SETUP -#line 45 "./arlex.l" +#line 46 "./arlex.l" { return LIST; } YY_BREAK case 12: YY_RULE_SETUP -#line 46 "./arlex.l" +#line 47 "./arlex.l" { return OPEN; } YY_BREAK case 13: YY_RULE_SETUP -#line 47 "./arlex.l" +#line 48 "./arlex.l" { return REPLACE; } YY_BREAK case 14: YY_RULE_SETUP -#line 48 "./arlex.l" +#line 49 "./arlex.l" { return VERBOSE; } YY_BREAK case 15: YY_RULE_SETUP -#line 49 "./arlex.l" +#line 50 "./arlex.l" { return SAVE; } YY_BREAK case 16: YY_RULE_SETUP -#line 50 "./arlex.l" +#line 51 "./arlex.l" { return ADDLIB; } YY_BREAK case 17: YY_RULE_SETUP -#line 51 "./arlex.l" +#line 52 "./arlex.l" { return ADDMOD; } YY_BREAK case 18: YY_RULE_SETUP -#line 52 "./arlex.l" +#line 53 "./arlex.l" { return CLEAR; } YY_BREAK case 19: YY_RULE_SETUP -#line 53 "./arlex.l" +#line 54 "./arlex.l" { return CREATE; } YY_BREAK case 20: YY_RULE_SETUP -#line 54 "./arlex.l" +#line 55 "./arlex.l" { return DELETE; } YY_BREAK case 21: YY_RULE_SETUP -#line 55 "./arlex.l" +#line 56 "./arlex.l" { return DIRECTORY; } YY_BREAK case 22: YY_RULE_SETUP -#line 56 "./arlex.l" +#line 57 "./arlex.l" { return END; } YY_BREAK case 23: YY_RULE_SETUP -#line 57 "./arlex.l" +#line 58 "./arlex.l" { return EXTRACT; } YY_BREAK case 24: YY_RULE_SETUP -#line 58 "./arlex.l" +#line 59 "./arlex.l" { return FULLDIR; } YY_BREAK case 25: YY_RULE_SETUP -#line 59 "./arlex.l" +#line 60 "./arlex.l" { return HELP; } YY_BREAK case 26: YY_RULE_SETUP -#line 60 "./arlex.l" +#line 61 "./arlex.l" { return LIST; } YY_BREAK case 27: YY_RULE_SETUP -#line 61 "./arlex.l" +#line 62 "./arlex.l" { return OPEN; } YY_BREAK case 28: YY_RULE_SETUP -#line 62 "./arlex.l" +#line 63 "./arlex.l" { return REPLACE; } YY_BREAK case 29: YY_RULE_SETUP -#line 63 "./arlex.l" +#line 64 "./arlex.l" { return VERBOSE; } YY_BREAK case 30: YY_RULE_SETUP -#line 64 "./arlex.l" +#line 65 "./arlex.l" { return SAVE; } YY_BREAK case 31: YY_RULE_SETUP -#line 65 "./arlex.l" +#line 66 "./arlex.l" { linenumber ++; } YY_BREAK case 32: YY_RULE_SETUP -#line 66 "./arlex.l" +#line 67 "./arlex.l" { return '('; } YY_BREAK case 33: YY_RULE_SETUP -#line 67 "./arlex.l" +#line 68 "./arlex.l" { return ')'; } YY_BREAK case 34: YY_RULE_SETUP -#line 68 "./arlex.l" +#line 69 "./arlex.l" { return ','; } YY_BREAK case 35: YY_RULE_SETUP -#line 69 "./arlex.l" +#line 70 "./arlex.l" { - yylval.name = strdup(yytext); + yylval.name = xstrdup (yytext); return FILENAME; } YY_BREAK case 36: YY_RULE_SETUP -#line 73 "./arlex.l" +#line 74 "./arlex.l" { } YY_BREAK case 37: YY_RULE_SETUP -#line 74 "./arlex.l" +#line 75 "./arlex.l" { } YY_BREAK case 38: YY_RULE_SETUP -#line 75 "./arlex.l" +#line 76 "./arlex.l" { } YY_BREAK case 39: YY_RULE_SETUP -#line 76 "./arlex.l" +#line 77 "./arlex.l" { linenumber ++; return NEWLINE; } YY_BREAK case 40: YY_RULE_SETUP -#line 78 "./arlex.l" +#line 79 "./arlex.l" ECHO; YY_BREAK -#line 938 "lex.yy.c" +#line 939 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1794,7 +1795,7 @@ return 0; } #endif -#line 78 "./arlex.l" +#line 79 "./arlex.l" #ifndef yywrap /* Needed for lex, though not flex. */ diff -urN binutils-2.7/binutils/arlex.l binutils-2.8/binutils/arlex.l --- binutils-2.7/binutils/arlex.l Thu Jul 4 12:23:24 1996 +++ binutils-2.8/binutils/arlex.l Wed Apr 30 12:59:03 1997 @@ -1,7 +1,7 @@ %{ /* arlex.l - Strange script language lexer */ -/* Copyright (C) 1992 Free Software Foundation, Inc. +/* Copyright (C) 1992, 95, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -26,8 +26,9 @@ */ #define DONTDECLARE_MALLOC #include +#include "libiberty.h" #include "arparse.h" -extern char *strdup(); + int linenumber; %} %% @@ -67,7 +68,7 @@ ")" { return ')'; } "," { return ','; } [A-Za-z0-9/$:.\-\_]+ { - yylval.name = strdup(yytext); + yylval.name = xstrdup (yytext); return FILENAME; } "*".* { } diff -urN binutils-2.7/binutils/arparse.c binutils-2.8/binutils/arparse.c --- binutils-2.7/binutils/arparse.c Mon Jul 15 12:22:11 1996 +++ binutils-2.8/binutils/arparse.c Wed Apr 30 12:59:04 1997 @@ -27,7 +27,7 @@ /* arparse.y - Stange script language parser */ -/* Copyright (C) 1992 Free Software Foundation, Inc. +/* Copyright (C) 1992, 93, 95, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -55,8 +55,9 @@ #include "bucomm.h" #include "arsup.h" extern int verbose; +static int yyerror PARAMS ((const char *)); -#line 34 "./arparse.y" +#line 35 "./arparse.y" typedef union { char *name; struct list *list ; @@ -152,11 +153,11 @@ #if YYDEBUG != 0 static const short yyrline[] = { 0, - 64, 66, 68, 70, 73, 76, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 96, 101, 106, 111, 115, 120, 125, 132, 137, - 143, 147, 154, 157, 160, 163, 167, 174, 178, 180, - 184 + 65, 67, 69, 71, 74, 77, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 97, 102, 107, 112, 116, 121, 126, 133, 138, + 144, 148, 155, 158, 161, 164, 168, 175, 179, 181, + 185 }; static const char * const yytname[] = { "$","error","$undefined.","NEWLINE", @@ -723,83 +724,83 @@ switch (yyn) { case 1: -#line 65 "./arparse.y" +#line 66 "./arparse.y" { prompt(); ; break;} case 5: -#line 74 "./arparse.y" +#line 75 "./arparse.y" { prompt(); ; break;} case 18: -#line 89 "./arparse.y" +#line 90 "./arparse.y" { ar_end(); return 0; ; break;} case 20: -#line 91 "./arparse.y" +#line 92 "./arparse.y" { yyerror("foo"); ; break;} case 22: -#line 98 "./arparse.y" +#line 99 "./arparse.y" { ar_extract(yyvsp[0].list); ; break;} case 23: -#line 103 "./arparse.y" +#line 104 "./arparse.y" { ar_replace(yyvsp[0].list); ; break;} case 24: -#line 108 "./arparse.y" +#line 109 "./arparse.y" { ar_clear(); ; break;} case 25: -#line 113 "./arparse.y" +#line 114 "./arparse.y" { ar_delete(yyvsp[0].list); ; break;} case 26: -#line 117 "./arparse.y" +#line 118 "./arparse.y" { ar_addmod(yyvsp[0].list); ; break;} case 27: -#line 122 "./arparse.y" +#line 123 "./arparse.y" { ar_list(); ; break;} case 28: -#line 127 "./arparse.y" +#line 128 "./arparse.y" { ar_save(); ; break;} case 29: -#line 134 "./arparse.y" +#line 135 "./arparse.y" { ar_open(yyvsp[0].name,0); ; break;} case 30: -#line 139 "./arparse.y" +#line 140 "./arparse.y" { ar_open(yyvsp[0].name,1); ; break;} case 31: -#line 145 "./arparse.y" +#line 146 "./arparse.y" { ar_addlib(yyvsp[-1].name,yyvsp[0].list); ; break;} case 32: -#line 149 "./arparse.y" +#line 150 "./arparse.y" { ar_directory(yyvsp[-2].name, yyvsp[-1].list, yyvsp[0].name); ; break;} case 33: -#line 156 "./arparse.y" +#line 157 "./arparse.y" { yyval.name = yyvsp[0].name; ; break;} case 34: -#line 157 "./arparse.y" +#line 158 "./arparse.y" { yyval.name = 0; ; break;} case 35: -#line 162 "./arparse.y" +#line 163 "./arparse.y" { yyval.list = yyvsp[-1].list; ; break;} case 36: -#line 164 "./arparse.y" +#line 165 "./arparse.y" { yyval.list = 0; ; break;} case 37: -#line 169 "./arparse.y" +#line 170 "./arparse.y" { struct list *n = (struct list *) malloc(sizeof(struct list)); n->next = yyvsp[-2].list; n->name = yyvsp[0].name; @@ -807,11 +808,11 @@ ; break;} case 38: -#line 174 "./arparse.y" +#line 175 "./arparse.y" { yyval.list = 0; ; break;} case 41: -#line 186 "./arparse.y" +#line 187 "./arparse.y" { verbose = !verbose; ; break;} } @@ -1012,15 +1013,15 @@ yystate = yyn; goto yynewstate; } -#line 190 "./arparse.y" - +#line 191 "./arparse.y" -int -yyerror(x) -char *x; +static int +yyerror (x) + const char *x; { extern int linenumber; - printf("Synax error in archive script, line %d\n", linenumber + 1); + + printf ("Syntax error in archive script, line %d\n", linenumber + 1); return 0; } diff -urN binutils-2.7/binutils/arparse.y binutils-2.8/binutils/arparse.y --- binutils-2.7/binutils/arparse.y Thu Jul 4 12:23:25 1996 +++ binutils-2.8/binutils/arparse.y Wed Apr 30 12:59:04 1997 @@ -1,7 +1,7 @@ %{ /* arparse.y - Stange script language parser */ -/* Copyright (C) 1992 Free Software Foundation, Inc. +/* Copyright (C) 1992, 93, 95, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -29,6 +29,7 @@ #include "bucomm.h" #include "arsup.h" extern int verbose; +static int yyerror PARAMS ((const char *)); %} %union { @@ -189,12 +190,12 @@ %% - -int -yyerror(x) -char *x; +static int +yyerror (x) + const char *x; { extern int linenumber; - printf("Synax error in archive script, line %d\n", linenumber + 1); + + printf ("Syntax error in archive script, line %d\n", linenumber + 1); return 0; } diff -urN binutils-2.7/binutils/arsup.c binutils-2.8/binutils/arsup.c --- binutils-2.7/binutils/arsup.c Mon Jul 8 15:32:17 1996 +++ binutils-2.8/binutils/arsup.c Wed Apr 30 12:59:04 1997 @@ -1,5 +1,5 @@ /* arsup.c - Archive support for MRI compatibility - Copyright (C) 1992 Free Software Foundation, Inc. + Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -38,8 +38,6 @@ extern int verbose; -extern char *strdup(); - static void map_over_list (arch, function, list) bfd *arch; @@ -159,7 +157,7 @@ int t) { - char *tname = (char *) malloc(strlen(name)+10); + char *tname = (char *) xmalloc (strlen (name) + 10); real_name = name; sprintf(tname, "%s-tmp", name); obfd = bfd_openw(tname, NULL); @@ -319,7 +317,7 @@ maybequit(); } else { - char *ofilename = strdup(bfd_get_filename (obfd)); + char *ofilename = xstrdup (bfd_get_filename (obfd)); bfd_close(obfd); rename (ofilename, real_name); diff -urN binutils-2.7/binutils/binutils.info binutils-2.8/binutils/binutils.info --- binutils-2.7/binutils/binutils.info Mon Jul 15 15:14:12 1996 +++ binutils-2.8/binutils/binutils.info Wed Apr 30 13:12:44 1997 @@ -1,4 +1,4 @@ -This is Info file binutils.info, produced by Makeinfo-1.55 from the +This is Info file binutils.info, produced by Makeinfo-1.64 from the input file ./binutils.texi. START-INFO-DIR-ENTRY @@ -7,8 +7,8 @@ "strings", "strip", and "ranlib". END-INFO-DIR-ENTRY - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, -Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -24,1750 +24,33 @@ versions.  -File: binutils.info, Node: Top, Next: ar, Prev: (DIR), Up: (DIR) - -Introduction -************ - - This brief manual contains preliminary documentation for the GNU -binary utilities (collectively version 2.7): - -* Menu: - -* ar:: Create, modify, and extract from archives -* nm:: List symbols from object files -* objcopy:: Copy and translate object files -* objdump:: Display information from object files -* ranlib:: Generate index to archive contents -* size:: List section sizes and total size -* strings:: List printable strings from files -* strip:: Discard symbols -* c++filt:: Filter to demangle encoded C++ symbols -* nlmconv:: Converts object code into an NLM -* Selecting The Target System:: How these utilities determine the target. -* Index:: - - -File: binutils.info, Node: ar, Next: nm, Prev: Top, Up: Top - -ar -** - - ar [-]P[MOD [RELPOS]] ARCHIVE [MEMBER...] - ar -M [ '), and continues executing even after errors. If you -redirect standard input to a script file, no prompts are issued, and -`ar' abandons execution (with a nonzero exit code) on any error. - - The `ar' command language is *not* designed to be equivalent to the -command-line options; in fact, it provides somewhat less control over -archives. The only purpose of the command language is to ease the -transition to GNU `ar' for developers who already have scripts written -for the MRI "librarian" program. - - The syntax for the `ar' command language is straightforward: - * commands are recognized in upper or lower case; for example, `LIST' - is the same as `list'. In the following descriptions, commands are - shown in upper case for clarity. - - * a single command may appear on each line; it is the first word on - the line. - - * empty lines are allowed, and have no effect. - - * comments are allowed; text after either of the characters `*' or - `;' is ignored. - - * Whenever you use a list of names as part of the argument to an `ar' - command, you can separate the individual names with either commas - or blanks. Commas are shown in the explanations below, for - clarity. - - * `+' is used as a line continuation character; if `+' appears at - the end of a line, the text on the following line is considered - part of the current command. - - Here are the commands you can use in `ar' scripts, or when using -`ar' interactively. Three of them have special significance: - - `OPEN' or `CREATE' specify a "current archive", which is a temporary -file required for most of the other commands. - - `SAVE' commits the changes so far specified by the script. Prior to -`SAVE', commands affect only the temporary copy of the current archive. - -`ADDLIB ARCHIVE' -`ADDLIB ARCHIVE (MODULE, MODULE, ... MODULE)' - Add all the contents of ARCHIVE (or, if specified, each named - MODULE from ARCHIVE) to the current archive. - - Requires prior use of `OPEN' or `CREATE'. - -`ADDMOD MEMBER, MEMBER, ... MEMBER' - Add each named MEMBER as a module in the current archive. - - Requires prior use of `OPEN' or `CREATE'. - -`CLEAR' - Discard the contents of the current archive, cancelling the effect - of any operations since the last `SAVE'. May be executed (with no - effect) even if no current archive is specified. - -`CREATE ARCHIVE' - Creates an archive, and makes it the current archive (required for - many other commands). The new archive is created with a temporary - name; it is not actually saved as ARCHIVE until you use `SAVE'. - You can overwrite existing archives; similarly, the contents of any - existing file named ARCHIVE will not be destroyed until `SAVE'. - -`DELETE MODULE, MODULE, ... MODULE' - Delete each listed MODULE from the current archive; equivalent to - `ar -d ARCHIVE MODULE ... MODULE'. - - Requires prior use of `OPEN' or `CREATE'. - -`DIRECTORY ARCHIVE (MODULE, ... MODULE)' -`DIRECTORY ARCHIVE (MODULE, ... MODULE) OUTPUTFILE' - List each named MODULE present in ARCHIVE. The separate command - `VERBOSE' specifies the form of the output: when verbose output is - off, output is like that of `ar -t ARCHIVE MODULE...'. When - verbose output is on, the listing is like `ar -tv ARCHIVE - MODULE...'. - - Output normally goes to the standard output stream; however, if you - specify OUTPUTFILE as a final argument, `ar' directs the output to - that file. - -`END' - Exit from `ar', with a `0' exit code to indicate successful - completion. This command does not save the output file; if you - have changed the current archive since the last `SAVE' command, - those changes are lost. - -`EXTRACT MODULE, MODULE, ... MODULE' - Extract each named MODULE from the current archive, writing them - into the current directory as separate files. Equivalent to `ar -x - ARCHIVE MODULE...'. - - Requires prior use of `OPEN' or `CREATE'. - -`LIST' - Display full contents of the current archive, in "verbose" style - regardless of the state of `VERBOSE'. The effect is like `ar tv - ARCHIVE'). (This single command is a GNU `ld' enhancement, rather - than present for MRI compatibility.) - - Requires prior use of `OPEN' or `CREATE'. - -`OPEN ARCHIVE' - Opens an existing archive for use as the current archive (required - for many other commands). Any changes as the result of subsequent - commands will not actually affect ARCHIVE until you next use - `SAVE'. - -`REPLACE MODULE, MODULE, ... MODULE' - In the current archive, replace each existing MODULE (named in the - `REPLACE' arguments) from files in the current working directory. - To execute this command without errors, both the file, and the - module in the current archive, must exist. - - Requires prior use of `OPEN' or `CREATE'. - -`VERBOSE' - Toggle an internal flag governing the output from `DIRECTORY'. - When the flag is on, `DIRECTORY' output matches output from `ar - -tv '.... - -`SAVE' - Commit your changes to the current archive, and actually save it - as a file with the name specified in the last `CREATE' or `OPEN' - command. - - Requires prior use of `OPEN' or `CREATE'. - - -File: binutils.info, Node: nm, Next: objcopy, Prev: ar, Up: Top - -nm -** - - nm [ -a | --debug-syms ] [ -g | --extern-only ] - [ -B ] [ -C | --demangle ] [ -D | --dynamic ] - [ -s | --print-armap ] [ -A | -o | --print-file-name ] - [ -n | -v | --numeric-sort ] [ -p | --no-sort ] - [ -r | --reverse-sort ] [ --size-sort ] [ -u | --undefined-only ] - [ -t RADIX | --radix=RADIX ] [ -P | --portability ] - [ --target=BFDNAME ] [ -f FORMAT | --format=FORMAT ] - [ --defined-only ] [-l | --line-numbers ] - [ --no-demangle ] [ -V | --version ] [ --help ] [ OBJFILE... ] - - GNU `nm' lists the symbols from object files OBJFILE.... If no -object files are listed as arguments, `nm' assumes `a.out'. - - For each symbol, `nm' shows: - - * The symbol value, in the radix selected by options (see below), or - hexadecimal by default. - - * The symbol type. At least the following types are used; others - are, as well, depending on the object file format. If lowercase, - the symbol is local; if uppercase, the symbol is global (external). - - `A' - The symbol's value is absolute, and will not be changed by - further linking. - - `B' - The symbol is in the uninitialized data section (known as - BSS). - - `C' - The symbol is common. Common symbols are uninitialized data. - When linking, multiple common symbols may appear with the - same name. If the symbol is defined anywhere, the common - symbols are treated as undefined references. For more - details on common symbols, see the discussion of -warn-common - in *Note Linker options: (ld.info)Options. - - `D' - The symbol is in the initialized data section. - - `G' - The symbol is in an initialized data section for small - objects. Some object file formats permit more efficient - access to small data objects, such as a global int variable - as opposed to a large global array. - - `I' - The symbol is an indirect reference to another symbol. This - is a GNU extension to the a.out object file format which is - rarely used. - - `N' - The symbol is a debugging symbol. - - `R' - The symbol is in a read only data section. - - `S' - The symbol is in an uninitialized data section for small - objects. - - `T' - The symbol is in the text (code) section. - - `U' - The symbol is undefined. - - `W' - The symbol is weak. When a weak defined symbol is linked - with a normal defined symbol, the normal defined symbol is - used with no error. When a weak undefined symbol is linked - and the symbol is not defined, the value of the weak symbol - becomes zero with no error. - - `-' - The symbol is a stabs symbol in an a.out object file. In - this case, the next values printed are the stabs other field, - the stabs desc field, and the stab type. Stabs symbols are - used to hold debugging information; for more information, see - *Note Stabs: (stabs.info)Top. - - `?' - The symbol type is unknown, or object file format specific. - - * The symbol name. - - The long and short forms of options, shown here as alternatives, are -equivalent. - -`-A' -`-o' -`--print-file-name' - Precede each symbol by the name of the input file (or archive - element) in which it was found, rather than identifying the input - file once only, before all of its symbols. - -`-a' -`--debug-syms' - Display all symbols, even debugger-only symbols; normally these - are not listed. - -`-B' - The same as `--format=bsd' (for compatibility with the MIPS `nm'). - -`-C' -`--demangle' - Decode ("demangle") low-level symbol names into user-level names. - Besides removing any initial underscore prepended by the system, - this makes C++ function names readable. *Note c++filt::, for more - information on demangling. - -`--no-demangle' - Do not demangle low-level symbol names. This is the default. - -`-D' -`--dynamic' - Display the dynamic symbols rather than the normal symbols. This - is only meaningful for dynamic objects, such as certain types of - shared libraries. - -`-f FORMAT' -`--format=FORMAT' - Use the output format FORMAT, which can be `bsd', `sysv', or - `posix'. The default is `bsd'. Only the first character of - FORMAT is significant; it can be either upper or lower case. - -`-g' -`--extern-only' - Display only external symbols. - -`-l' -`--line-numbers' - For each symbol, use debugging information to try to find a - filename and line number. For a defined symbol, look for the line - number of the address of the symbol. For an undefined symbol, - look for the line number of a relocation entry which refers to the - symbol. If line number information can be found, print it after - the other symbol information. - -`-n' -`-v' -`--numeric-sort' - Sort symbols numerically by their addresses, rather than - alphabetically by their names. - -`-p' -`--no-sort' - Do not bother to sort the symbols in any order; print them in the - order encountered. - -`-P' -`--portability' - Use the POSIX.2 standard output format instead of the default - format. Equivalent to `-f posix'. - -`-s' -`--print-armap' - When listing symbols from archive members, include the index: a - mapping (stored in the archive by `ar' or `ranlib') of which - modules contain definitions for which names. - -`-r' -`--reverse-sort' - Reverse the order of the sort (whether numeric or alphabetic); let - the last come first. - -`--size-sort' - Sort symbols by size. The size is computed as the difference - between the value of the symbol and the value of the symbol with - the next higher value. The size of the symbol is printed, rather - than the value. - -`-t RADIX' -`--radix=RADIX' - Use RADIX as the radix for printing the symbol values. It must be - `d' for decimal, `o' for octal, or `x' for hexadecimal. - -`--target=BFDNAME' - Specify an object code format other than your system's default - format. *Note Target Selection::, for more information. - -`-u' -`--undefined-only' - Display only undefined symbols (those external to each object - file). - -`--defined-only' - Display only defined symbols for each object file. - -`-V' -`--version' - Show the version number of `nm' and exit. - -`--help' - Show a summary of the options to `nm' and exit. - - -File: binutils.info, Node: objcopy, Next: objdump, Prev: nm, Up: Top - -objcopy -******* - - objcopy [ -F BFDNAME | --target=BFDNAME ] - [ -I BFDNAME | --input-target=BFDNAME ] - [ -O BFDNAME | --output-target=BFDNAME ] - [ -S | --strip-all ] [ -g | --strip-debug ] - [ -K SYMBOLNAME | --keep-symbol=SYMBOLNAME ] - [ -N SYMBOLNAME | --strip-symbol=SYMBOLNAME ] - [ -x | --discard-all ] [ -X | --discard-locals ] - [ -b BYTE | --byte=BYTE ] - [ -i INTERLEAVE | --interleave=INTERLEAVE ] - [ -R SECTIONNAME | --remove-section=SECTIONNAME ] - [ --debugging ] - [ --gap-fill=VAL ] [ --pad-to=ADDRESS ] - [ --set-start=VAL ] [ --adjust-start=INCR ] - [ --adjust-vma=INCR ] - [ --adjust-section-vma=SECTION{=,+,-}VAL ] - [ --adjust-warnings ] [ --no-adjust-warnings ] - [ --set-section-flags=SECTION=FLAGS ] - [ --add-section=SECTIONNAME=FILENAME ] - [ --remove-leading-char ] - [ -v | --verbose ] [ -V | --version ] [ --help ] - INFILE [OUTFILE] - - The GNU `objcopy' utility copies the contents of an object file to -another. `objcopy' uses the GNU BFD Library to read and write the -object files. It can write the destination object file in a format -different from that of the source object file. The exact behavior of -`objcopy' is controlled by command-line options. - - `objcopy' creates temporary files to do its translations and deletes -them afterward. `objcopy' uses BFD to do all its translation work; it -has access to all the formats described in BFD and thus is able to -recognize most formats without being told explicitly. *Note BFD: -(ld.info)BFD. - - `objcopy' can be used to generate S-records by using an output -target of `srec' (e.g., use `-O srec'). - - `objcopy' can be used to generate a raw binary file by using an -output target of `binary' (e.g., use `-O binary'). When `objcopy' -generates a raw binary file, it will essentially produce a memory dump -of the contents of the input object file. All symbols and relocation -information will be discarded. The memory dump will start at the load -address of the lowest section copied into the output file. - - When generating an S-record or a raw binary file, it may be helpful -to use `-S' to remove sections containing debugging information. In -some cases `-R' will be useful to remove sections which contain -information which is not needed by the binary file. - -`INFILE' -`OUTFILE' - The source and output files, respectively. If you do not specify - OUTFILE, `objcopy' creates a temporary file and destructively - renames the result with the name of INFILE. - -`-I BFDNAME' -`--input-target=BFDNAME' - Consider the source file's object format to be BFDNAME, rather than - attempting to deduce it. *Note Target Selection::, for more - information. - -`-O BFDNAME' -`--output-target=BFDNAME' - Write the output file using the object format BFDNAME. *Note - Target Selection::, for more information. - -`-F BFDNAME' -`--target=BFDNAME' - Use BFDNAME as the object format for both the input and the output - file; i.e., simply transfer data from source to destination with no - translation. *Note Target Selection::, for more information. - -`-R SECTIONNAME' -`--remove-section=SECTIONNAME' - Remove any section named SECTIONNAME from the output file. This - option may be given more than once. Note that using this option - inappropriately may make the output file unusable. - -`-S' -`--strip-all' - Do not copy relocation and symbol information from the source file. - -`-g' -`--strip-debug' - Do not copy debugging symbols from the source file. - -`--strip-unneeded' - Strip all symbols that are not needed for relocation processing. - -`-K SYMBOLNAME' -`--keep-symbol=SYMBOLNAME' - Copy only symbol SYMBOLNAME from the source file. This option may - be given more than once. - -`-N SYMBOLNAME' -`--strip-symbol=SYMBOLNAME' - Do not copy symbol SYMBOLNAME from the source file. This option - may be given more than once, and may be combined with strip options - other than `-K'. - -`-x' -`--discard-all' - Do not copy non-global symbols from the source file. - -`-X' -`--discard-locals' - Do not copy compiler-generated local symbols. (These usually - start with `L' or `.'.) - -`-b BYTE' -`--byte=BYTE' - Keep only every BYTEth byte of the input file (header data is not - affected). BYTE can be in the range from 0 to INTERLEAVE-1, where - INTERLEAVE is given by the `-i' or `--interleave' option, or the - default of 4. This option is useful for creating files to program - ROM. It is typically used with an `srec' output target. - -`-i INTERLEAVE' -`--interleave=INTERLEAVE' - Only copy one out of every INTERLEAVE bytes. Select which byte to - copy with the -B or `--byte' option. The default is 4. `objcopy' - ignores this option if you do not specify either `-b' or `--byte'. - -`--debugging' - Convert debugging information, if possible. This is not the - default because only certain debugging formats are supported, and - the conversion process can be time consuming. - -`--gap-fill VAL' - Fill gaps between sections with VAL. This is done by increasing - the size of the section with the lower address, and filling in the - extra space created with VAL. - -`--pad-to ADDRESS' - Pad the output file up to the virtual address ADDRESS. This is - done by increasing the size of the last section. The extra space - is filled in with the value specified by `--gap-fill' (default - zero). - -`--set-start VAL' - Set the address of the new file to VAL. Not all object file - formats support setting the start address. - -`--adjust-start INCR' - Adjust the start address by adding INCR. Not all object file - formats support setting the start address. - -`--adjust-vma INCR' - Adjust the address of all sections, as well as the start address, - by adding INCR. Some object file formats do not permit section - addresses to be changed arbitrarily. Note that this does not - relocate the sections; if the program expects sections to be - loaded at a certain address, and this option is used to change the - sections such that they are loaded at a different address, the - program may fail. - -`--adjust-section-vma SECTION{=,+,-}VAL' - Set or adjust the address of the named SECTION. If `=' is used, - the section address is set to VAL. Otherwise, VAL is added to or - subtracted from the section address. See the comments under - `--adjust-vma', above. If SECTION does not exist in the input - file, a warning will be issued, unless `--no-adjust-warnings' is - used. - -`--adjust-warnings' - If `--adjust-section-vma' is used, and the named section does not - exist, issue a warning. This is the default. - -`--no-adjust-warnings' - Do not issue a warning if `--adjust-section-vma' is used, even if - the named section does not exist. - -`--set-section-flags SECTION=FLAGS' - Set the flags for the named section. The FLAGS argument is a - comma separated string of flag names. The recognized names are - `alloc', `load', `readonly', `code', `data', and `rom'. Not all - flags are meaningful for all object file formats. - -`--add-section SECTIONNAME=FILENAME' - Add a new section named SECTIONNAME while copying the file. The - contents of the new section are taken from the file FILENAME. The - size of the section will be the size of the file. This option only - works on file formats which can support sections with arbitrary - names. - -`--remove-leading-char' - If the first character of a global symbol is a special symbol - leading character used by the object file format, remove the - character. The most common symbol leading character is - underscore. This option will remove a leading underscore from all - global symbols. This can be useful if you want to link together - objects of different file formats with different conventions for - symbol names. - -`-V' -`--version' - Show the version number of `objcopy'. - -`-v' -`--verbose' - Verbose output: list all object files modified. In the case of - archives, `objcopy -V' lists all members of the archive. - -`--help' - Show a summary of the options to `objcopy'. - - -File: binutils.info, Node: objdump, Next: ranlib, Prev: objcopy, Up: Top - -objdump -******* - - objdump [ -a | --archive-headers ] - [ -b BFDNAME | --target=BFDNAME ] [ --debugging ] - [ -d | --disassemble ] [ -D | --disassemble-all ] - [ -EB | -EL | --endian={big | little } ] - [ -f | --file-headers ] - [ -h | --section-headers | --headers ] [ -i | --info ] - [ -j SECTION | --section=SECTION ] - [ -l | --line-numbers ] [ -S | --source ] - [ -m MACHINE | --architecture=MACHINE ] - [ -r | --reloc ] [ -R | --dynamic-reloc ] - [ -s | --full-contents ] [ --stabs ] - [ -t | --syms ] [ -T | --dynamic-syms ] [ -x | --all-headers ] - [ -w | --wide ] [ --start-address=ADDRESS ] - [ --stop-address=ADDRESS ] [ --show-raw-insn ] - [ --version ] [ --help ] - OBJFILE... - - `objdump' displays information about one or more object files. The -options control what particular information to display. This -information is mostly useful to programmers who are working on the -compilation tools, as opposed to programmers who just want their -program to compile and work. - - OBJFILE... are the object files to be examined. When you specify -archives, `objdump' shows information on each of the member object -files. - - The long and short forms of options, shown here as alternatives, are -equivalent. At least one option besides `-l' must be given. - -`-a' -`--archive-header' - If any of the OBJFILE files are archives, display the archive - header information (in a format similar to `ls -l'). Besides the - information you could list with `ar tv', `objdump -a' shows the - object file format of each archive member. - -`-b BFDNAME' -`--target=BFDNAME' - Specify that the object-code format for the object files is - BFDNAME. This option may not be necessary; OBJDUMP can - automatically recognize many formats. - - For example, - objdump -b oasys -m vax -h fu.o - - displays summary information from the section headers (`-h') of - `fu.o', which is explicitly identified (`-m') as a VAX object file - in the format produced by Oasys compilers. You can list the - formats available with the `-i' option. *Note Target Selection::, - for more information. - -`--debugging' - Display debugging information. This attempts to parse debugging - information stored in the file and print it out using a C like - syntax. Only certain types of debugging information have been - implemented. - -`-d' -`--disassemble' - Display the assembler mnemonics for the machine instructions from - OBJFILE. This option only disassembles those sections which are - expected to contain instructions. - -`-D' -`--disassemble-all' - Like `-d', but disassemble the contents of all sections, not just - those expected to contain instructions. - -`-EB' -`-EL' -`--endian={big|little}' - Specify the endianness of the object files. This only affects - disassembly. This can be useful when disassembling a file format - which does not describe endianness information, such as S-records. - -`-f' -`--file-header' - Display summary information from the overall header of each of the - OBJFILE files. - -`-h' -`--section-header' -`--header' - Display summary information from the section headers of the object - file. - - File segments may be relocated to nonstandard addresses, for - example by using the `-Ttext', `-Tdata', or `-Tbss' options to - `ld'. However, some object file formats, such as a.out, do not - store the starting address of the file segments. In those - situations, although `ld' relocates the sections correctly, using - `objdump -h' to list the file section headers cannot show the - correct addresses. Instead, it shows the usual addresses, which - are implicit for the target. - -`--help' - Print a summary of the options to `objdump' and exit. - -`-i' -`--info' - Display a list showing all architectures and object formats - available for specification with `-b' or `-m'. - -`-j NAME' -`--section=NAME' - Display information only for section NAME. - -`-l' -`--line-numbers' - Label the display (using debugging information) with the filename - and source line numbers corresponding to the object code or relocs - shown. Only useful with `-d', `-D', or `-r'. - -`-m MACHINE' -`--architecture=MACHINE' - Specify the architecture to use when disassembling object files. - This can be useful when disasembling object files which do not - describe architecture information, such as S-records. You can - list the available architectures with the `-i' option. - -`-r' -`--reloc' - Print the relocation entries of the file. If used with `-d' or - `-D', the relocations are printed interspersed with the - disassembly. - -`-R' -`--dynamic-reloc' - Print the dynamic relocation entries of the file. This is only - meaningful for dynamic objects, such as certain types of shared - libraries. - -`-s' -`--full-contents' - Display the full contents of any sections requested. - -`-S' -`--source' - Display source code intermixed with disassembly, if possible. - Implies `-d'. - -`--show-raw-insn' - When disassembling instructions, print the instruction in hex as - well as in symbolic form. Not all targets handle this correctly - yet. - -`--stabs' - Display the full contents of any sections requested. Display the - contents of the .stab and .stab.index and .stab.excl sections from - an ELF file. This is only useful on systems (such as Solaris 2.0) - in which `.stab' debugging symbol-table entries are carried in an - ELF section. In most other file formats, debugging symbol-table - entries are interleaved with linkage symbols, and are visible in - the `--syms' output. For more information on stabs symbols, see - *Note Stabs: (stabs.info)Top. - -`--start-address=ADDRESS' - Start displaying data at the specified address. This affects the - output of the `-d', `-r' and `-s' options. - -`--stop-address=ADDRESS' - Stop displaying data at the specified address. This affects the - output of the `-d', `-r' and `-s' options. - -`-t' -`--syms' - Print the symbol table entries of the file. This is similar to - the information provided by the `nm' program. - -`-T' -`--dynamic-syms' - Print the dynamic symbol table entries of the file. This is only - meaningful for dynamic objects, such as certain types of shared - libraries. This is similar to the information provided by the `nm' - program when given the `-D' (`--dynamic') option. - -`--version' - Print the version number of `objdump' and exit. - -`-x' -`--all-header' - Display all available header information, including the symbol - table and relocation entries. Using `-x' is equivalent to - specifying all of `-a -f -h -r -t'. - -`-w' -`--wide' - Format some lines for output devices that have more than 80 - columns. - - -File: binutils.info, Node: ranlib, Next: size, Prev: objdump, Up: Top - -ranlib -****** - - ranlib [-vV] ARCHIVE - - `ranlib' generates an index to the contents of an archive and stores -it in the archive. The index lists each symbol defined by a member of -an archive that is a relocatable object file. - - You may use `nm -s' or `nm --print-armap' to list this index. - - An archive with such an index speeds up linking to the library and -allows routines in the library to call each other without regard to -their placement in the archive. - - The GNU `ranlib' program is another form of GNU `ar'; running -`ranlib' is completely equivalent to executing `ar -s'. *Note ar::. - -`-v' -`-V' - Show the version number of `ranlib'. - - -File: binutils.info, Node: size, Next: strings, Prev: ranlib, Up: Top - -size -**** - - size [ -A | -B | --format=COMPATIBILITY ] - [ --help ] [ -d | -o | -x | --radix=NUMBER ] - [ --target=BFDNAME ] [ -V | --version ] - OBJFILE... - - The GNU `size' utility lists the section sizes--and the total -size--for each of the object or archive files OBJFILE in its argument -list. By default, one line of output is generated for each object file -or each module in an archive. - - OBJFILE... are the object files to be examined. - - The command line options have the following meanings: - -`-A' -`-B' -`--format=COMPATIBILITY' - Using one of these options, you can choose whether the output from - GNU `size' resembles output from System V `size' (using `-A', or - `--format=sysv'), or Berkeley `size' (using `-B', or - `--format=berkeley'). The default is the one-line format similar - to Berkeley's. - - Here is an example of the Berkeley (default) format of output from - `size': - size --format=Berkeley ranlib size - text data bss dec hex filename - 294880 81920 11592 388392 5ed28 ranlib - 294880 81920 11888 388688 5ee50 size - - This is the same data, but displayed closer to System V - conventions: - - size --format=SysV ranlib size - ranlib : - section size addr - .text 294880 8192 - .data 81920 303104 - .bss 11592 385024 - Total 388392 - - - size : - section size addr - .text 294880 8192 - .data 81920 303104 - .bss 11888 385024 - Total 388688 - -`--help' - Show a summary of acceptable arguments and options. - -`-d' -`-o' -`-x' -`--radix=NUMBER' - Using one of these options, you can control whether the size of - each section is given in decimal (`-d', or `--radix=10'); octal - (`-o', or `--radix=8'); or hexadecimal (`-x', or `--radix=16'). - In `--radix=NUMBER', only the three values (8, 10, 16) are - supported. The total size is always given in two radices; decimal - and hexadecimal for `-d' or `-x' output, or octal and hexadecimal - if you're using `-o'. - -`--target=BFDNAME' - Specify that the object-code format for OBJFILE is BFDNAME. This - option may not be necessary; `size' can automatically recognize - many formats. *Note Target Selection::, for more information. - -`-V' -`--version' - Display the version number of `size'. - - -File: binutils.info, Node: strings, Next: strip, Prev: size, Up: Top - -strings -******* - - strings [-afov] [-MIN-LEN] [-n MIN-LEN] [-t RADIX] [-] - [--all] [--print-file-name] [--bytes=MIN-LEN] - [--radix=RADIX] [--target=BFDNAME] - [--help] [--version] FILE... - - For each FILE given, GNU `strings' prints the printable character -sequences that are at least 4 characters long (or the number given with -the options below) and are followed by an unprintable character. By -default, it only prints the strings from the initialized and loaded -sections of object files; for other types of files, it prints the -strings from the whole file. - - `strings' is mainly useful for determining the contents of non-text -files. - -`-a' -`--all' -`-' - Do not scan only the initialized and loaded sections of object - files; scan the whole files. - -`-f' -`--print-file-name' - Print the name of the file before each string. - -`--help' - Print a summary of the program usage on the standard output and - exit. - -`-MIN-LEN' -`-n MIN-LEN' -`--bytes=MIN-LEN' - Print sequences of characters that are at least MIN-LEN characters - long, instead of the default 4. - -`-o' - Like `-t o'. Some other versions of `strings' have `-o' act like - `-t d' instead. Since we can not be compatible with both ways, we - simply chose one. - -`-t RADIX' -`--radix=RADIX' - Print the offset within the file before each string. The single - character argument specifies the radix of the offset--`o' for - octal, `x' for hexadecimal, or `d' for decimal. - -`--target=BFDNAME' - Specify an object code format other than your system's default - format. *Note Target Selection::, for more information. - -`-v' -`--version' - Print the program version number on the standard output and exit. - - -File: binutils.info, Node: strip, Next: c++filt, Prev: strings, Up: Top - -strip -***** - - strip [ -F BFDNAME | --target=BFDNAME | --target=BFDNAME ] - [ -I BFDNAME | --input-target=BFDNAME ] - [ -O BFDNAME | --output-target=BFDNAME ] - [ -s | --strip-all ] [ -S | -g | --strip-debug ] - [ -K SYMBOLNAME | --keep-symbol=SYMBOLNAME ] - [ -N SYMBOLNAME | --strip-symbol=SYMBOLNAME ] - [ -x | --discard-all ] [ -X | --discard-locals ] - [ -R SECTIONNAME | --remove-section=SECTIONNAME ] - [ -o FILE ] - [ -v | --verbose ] [ -V | --version ] [ --help ] - OBJFILE... - - GNU `strip' discards all symbols from object files OBJFILE. The -list of object files may include archives. At least one object file -must be given. - - `strip' modifies the files named in its argument, rather than -writing modified copies under different names. - -`-F BFDNAME' -`--target=BFDNAME' - Treat the original OBJFILE as a file with the object code format - BFDNAME, and rewrite it in the same format. *Note Target - Selection::, for more information. - -`--help' - Show a summary of the options to `strip' and exit. - -`-I BFDNAME' -`--input-target=BFDNAME' - Treat the original OBJFILE as a file with the object code format - BFDNAME. *Note Target Selection::, for more information. - -`-O BFDNAME' -`--output-target=BFDNAME' - Replace OBJFILE with a file in the output format BFDNAME. *Note - Target Selection::, for more information. - -`-R SECTIONNAME' -`--remove-section=SECTIONNAME' - Remove any section named SECTIONNAME from the output file. This - option may be given more than once. Note that using this option - inappropriately may make the output file unusable. - -`-s' -`--strip-all' - Remove all symbols. - -`-g' -`-S' -`--strip-debug' - Remove debugging symbols only. - -`--strip-unneeded' - Remove all symbols that are not needed for relocation processing. - -`-K SYMBOLNAME' -`--keep-symbol=SYMBOLNAME' - Keep only symbol SYMBOLNAME from the source file. This option may - be given more than once. - -`-N SYMBOLNAME' -`--strip-symbol=SYMBOLNAME' - Remove symbol SYMBOLNAME from the source file. This option may be - given more than once, and may be combined with strip options other - than `-K'. - -`-o FILE' - Put the stripped output in FILE, rather than replacing the - existing file. When this argument is used, only one OBJFILE - argument may be specified. - -`-x' -`--discard-all' - Remove non-global symbols. - -`-X' -`--discard-locals' - Remove compiler-generated local symbols. (These usually start - with `L' or `.'.) - -`-V' -`--version' - Show the version number for `strip'. - -`-v' -`--verbose' - Verbose output: list all object files modified. In the case of - archives, `strip -v' lists all members of the archive. - - -File: binutils.info, Node: c++filt, Next: nlmconv, Prev: strip, Up: Top - -c++filt -******* - - c++filt [ -_ | --strip-underscores ] - [ -n | --no-strip-underscores ] - [ -s FORMAT | --format=FORMAT ] - [ --help ] [ --version ] [ SYMBOL... ] - - The C++ language provides function overloading, which means that you -can write many functions with the same name (providing each takes -parameters of different types). All C++ function names are encoded -into a low-level assembly label (this process is known as "mangling"). -The `c++filt' program does the inverse mapping: it decodes -("demangles") low-level names into user-level names so that the linker -can keep these overloaded functions from clashing. - - Every alphanumeric word (consisting of letters, digits, underscores, -dollars, or periods) seen in the input is a potential label. If the -label decodes into a C++ name, the C++ name replaces the low-level name -in the output. - - You can use `c++filt' to decipher individual symbols: - - c++filt SYMBOL - - If no SYMBOL arguments are given, `c++filt' reads symbol names from -the standard input and writes the demangled names to the standard -output. All results are printed on the standard output. - -`-_' -`--strip-underscores' - On some systems, both the C and C++ compilers put an underscore in - front of every name. For example, the C name `foo' gets the - low-level name `_foo'. This option removes the initial - underscore. Whether `c++filt' removes the underscore by default - is target dependent. - -`-n' -`--no-strip-underscores' - Do not remove the initial underscore. - -`-s FORMAT' -`--format=FORMAT' - GNU `nm' can decode three different methods of mangling, used by - different C++ compilers. The argument to this option selects which - method it uses: - - `gnu' - the one used by the GNU compiler (the default method) - - `lucid' - the one used by the Lucid compiler - - `arm' - the one specified by the C++ Annotated Reference Manual - -`--help' - Print a summary of the options to `c++filt' and exit. - -`--version' - Print the version number of `c++filt' and exit. - - *Warning:* `c++filt' is a new utility, and the details of its user - interface are subject to change in future releases. In particular, - a command-line option may be required in the the future to decode - a name passed as an argument on the command line; in other words, - - c++filt SYMBOL - - may in a future release become - - c++filt OPTION SYMBOL - - -File: binutils.info, Node: nlmconv, Next: Selecting The Target System, Prev: c++filt, Up: Top - -nlmconv -******* - - `nlmconv' converts a relocatable object file into a NetWare Loadable -Module. - - *Warning:* `nlmconv' is not always built as part of the binary - utilities, since it is only useful for NLM targets. - - nlmconv [ -I BFDNAME | --input-target=BFDNAME ] - [ -O BFDNAME | --output-target=BFDNAME ] - [ -T HEADERFILE | --header-file=HEADERFILE ] - [ -d | --debug] [ -l LINKER | --linker=LINKER ] - [ -h | --help ] [ -V | --version ] - INFILE OUTFILE - - `nlmconv' converts the relocatable `i386' object file INFILE into -the NetWare Loadable Module OUTFILE, optionally reading HEADERFILE for -NLM header information. For instructions on writing the NLM command -file language used in header files, see the `linkers' section, -`NLMLINK' in particular, of the `NLM Development and Tools Overview', -which is part of the NLM Software Developer's Kit ("NLM SDK"), -available from Novell, Inc. `nlmconv' uses the GNU Binary File -Descriptor library to read INFILE; see *Note BFD: (ld.info)BFD, for -more information. - - `nlmconv' can perform a link step. In other words, you can list -more than one object file for input if you list them in the definitions -file (rather than simply specifying one input file on the command line). -In this case, `nlmconv' calls the linker for you. - -`-I BFDNAME' -`--input-target=BFDNAME' - Object format of the input file. `nlmconv' can usually determine - the format of a given file (so no default is necessary). *Note - Target Selection::, for more information. - -`-O BFDNAME' -`--output-target=BFDNAME' - Object format of the output file. `nlmconv' infers the output - format based on the input format, e.g. for a `i386' input file the - output format is `nlm32-i386'. *Note Target Selection::, for more - information. - -`-T HEADERFILE' -`--header-file=HEADERFILE' - Reads HEADERFILE for NLM header information. For instructions on - writing the NLM command file language used in header files, see - see the `linkers' section, of the `NLM Development and Tools - Overview', which is part of the NLM Software Developer's Kit, - available from Novell, Inc. - -`-d' -`--debug' - Displays (on standard error) the linker command line used by - `nlmconv'. - -`-l LINKER' -`--linker=LINKER' - Use LINKER for any linking. LINKER can be an abosolute or a - relative pathname. - -`-h' -`--help' - Prints a usage summary. - -`-V' -`--version' - Prints the version number for `nlmconv'. - - -File: binutils.info, Node: Selecting The Target System, Next: Index, Prev: nlmconv, Up: Top - -Selecting the target system -*************************** - - You can specify three aspects of the target system to the GNU binary -file utilities, each in several ways: - - * the target - - * the architecture - - * the linker emulation (which applies to the linker only) - - In the following summaries, the lists of ways to specify values are -in order of decreasing precedence. The ways listed first override those -listed later. - - The commands to list valid values only list the values for which the -programs you are running were configured. If they were configured with -`--enable-targets=all', the commands list most of the available values, -but a few are left out; not all targets can be configured in at once -because some of them can only be configured "native" (on hosts with the -same type as the target system). - -* Menu: - -* Target Selection:: -* Architecture Selection:: -* Linker Emulation Selection:: - - -File: binutils.info, Node: Target Selection, Next: Architecture Selection, Up: Selecting The Target System - -Target Selection -================ - - A "target" is an object file format. A given target may be -supported for multiple architectures (*note Architecture Selection::.). -A target selection may also have variations for different operating -systems or architectures. - - The command to list valid target values is `objdump -i' (the first -column of output contains the relevant information). - - Some sample values are: `a.out-hp300bsd', `ecoff-littlemips', -`a.out-sunos-big'. - -`objdump' Target ----------------- - - Ways to specify: - - 1. command line option: `-b' or `--target' - - 2. environment variable `GNUTARGET' - - 3. deduced from the input file - -`objcopy' and `strip' Input Target ----------------------------------- - - Ways to specify: - - 1. command line options: `-I' or `--input-target', or `-F' or - `--target' - - 2. environment variable `GNUTARGET' - - 3. deduced from the input file - -`objcopy' and `strip' Output Target ------------------------------------ - - Ways to specify: - - 1. command line options: `-O' or `--output-target', or `-F' or - `--target' - - 2. the input target (see "`objcopy' and `strip' Input Target" above) - - 3. environment variable `GNUTARGET' - - 4. deduced from the input file - -`nm', `size', and `strings' Target ----------------------------------- - - Ways to specify: - - 1. command line option: `--target' - - 2. environment variable `GNUTARGET' - - 3. deduced from the input file - -Linker Input Target -------------------- - - Ways to specify: - - 1. command line option: `-b' or `--format' (*note Options: - (ld.info)Options.) - - 2. script command `TARGET' (*note Option Commands: (ld.info)Option - Commands.) - - 3. environment variable `GNUTARGET' (*note Environment: - (ld.info)Environment.) - - 4. the default target of the selected linker emulation (*note Linker - Emulation Selection::.) - -Linker Output Target --------------------- - - Ways to specify: - - 1. command line option: `-oformat' (*note Options: (ld.info)Options.) - - 2. script command `OUTPUT_FORMAT' (*note Option Commands: - (ld.info)Option Commands.) - - 3. the linker input target (see "Linker Input Target" above) - - -File: binutils.info, Node: Architecture Selection, Next: Linker Emulation Selection, Prev: Target Selection, Up: Selecting The Target System - -Architecture selection -====================== - - An "architecture" is a type of CPU on which an object file is to -run. Its name may contain a colon, separating the name of the -processor family from the name of the particular CPU. - - The command to list valid architecture values is `objdump -i' (the -second column contains the relevant information). - - Sample values: `m68k:68020', `mips:3000', `sparc'. - -`objdump' Architecture ----------------------- - - Ways to specify: - - 1. command line option: `-m' or `--architecture' - - 2. deduced from the input file - -`objcopy', `nm', `size', `strings' Architecture ------------------------------------------------ - - Ways to specify: - - 1. deduced from the input file - -Linker Input Architecture -------------------------- - - Ways to specify: - - 1. deduced from the input file - -Linker Output Architecture --------------------------- - - Ways to specify: - - 1. script command `OUTPUT_ARCH' (*note Option Commands: - (ld.info)Option Commands.) - - 2. the default architecture from the linker output target (*note - Target Selection::.) - - -File: binutils.info, Node: Linker Emulation Selection, Prev: Architecture Selection, Up: Selecting The Target System - -Linker emulation selection -========================== - - A linker "emulation" is a "personality" of the linker, which gives -the linker default values for the other aspects of the target system. -In particular, it consists of - - * the linker script - - * the target - - * several "hook" functions that are run at certain stages of the - linking process to do special things that some targets require - - The command to list valid linker emulation values is `ld -V'. - - Sample values: `hp300bsd', `mipslit', `sun4'. - - Ways to specify: - - 1. command line option: `-m' (*note Options: (ld.info)Options.) - - 2. environment variable `LDEMULATION' - - 3. compiled-in `DEFAULT_EMULATION' from `Makefile', which comes from - `EMUL' in `config/TARGET.mt' - - -File: binutils.info, Node: Index, Prev: Selecting The Target System, Up: Top - -Index -***** - -* Menu: - -* .stab: objdump. -* ar compatibility: ar. -* nm compatibility: nm. -* nm compatibility: nm. -* nm format: nm. -* nm format: nm. -* size display format: size. -* size number format: size. -* all header information, object file: objdump. -* ar: ar. -* architecture: objdump. -* architectures available: objdump. -* archive contents: ranlib. -* archive headers: objdump. -* archives: ar. -* c++filt: c++filt. -* collections of files: ar. -* compatibility, ar: ar. -* contents of archive: ar cmdline. -* creating archives: ar cmdline. -* dates in archive: ar cmdline. -* debug symbols: objdump. -* debugging symbols: nm. -* deleting from archive: ar cmdline. -* demangling C++ symbols: c++filt. -* demangling C++ symbols: nm. -* disassembling object code: objdump. -* disassembly architecture: objdump. -* disassembly endianness: objdump. -* disassembly, with source: objdump. -* discarding symbols: strip. -* dynamic relocation entries, in object file: objdump. -* dynamic symbol table entries, printing: objdump. -* dynamic symbols: nm. -* ELF object file format: objdump. -* endianness: objdump. -* external symbols: nm. -* external symbols: nm. -* external symbols: nm. -* extract from archive: ar cmdline. -* file name: nm. -* header information, all: objdump. -* input file name: nm. -* libraries: ar. -* listings strings: strings. -* machine instructions: objdump. -* moving in archive: ar cmdline. -* MRI compatibility, ar: ar scripts. -* name duplication in archive: ar cmdline. -* name length: ar. -* nm: nm. -* objdump: objdump. -* object code format: objdump. -* object code format: size. -* object code format: strings. -* object code format: nm. -* object file header: objdump. -* object file information: objdump. -* object file sections: objdump. -* object formats available: objdump. -* operations on archive: ar cmdline. -* printing from archive: ar cmdline. -* printing strings: strings. -* quick append to archive: ar cmdline. -* radix for section sizes: size. -* ranlib: ranlib. -* relative placement in archive: ar cmdline. -* relocation entries, in object file: objdump. -* removing symbols: strip. -* repeated names in archive: ar cmdline. -* replacement in archive: ar cmdline. -* scripts, ar: ar scripts. -* section headers: objdump. -* section information: objdump. -* section sizes: size. -* sections, full contents: objdump. -* size: size. -* sorting symbols: nm. -* source disassembly: objdump. -* source file name: nm. -* source filenames for object files: objdump. -* stab: objdump. -* start-address: objdump. -* stop-address: objdump. -* strings: strings. -* strings, printing: strings. -* strip: strip. -* symbol index: ar. -* symbol index: ranlib. -* symbol index, listing: nm. -* symbol line numbers: nm. -* symbol table entries, printing: objdump. -* symbols: nm. -* symbols, discarding: strip. -* undefined symbols: nm. -* undefined symbols: nm. -* Unix compatibility, ar: ar cmdline. -* updating an archive: ar cmdline. -* version: Top. -* wide output, printing: objdump. -* writing archive index: ar cmdline. - - +Indirect: +binutils.info-1: 969 +binutils.info-2: 49335  Tag Table: -Node: Top965 -Node: ar1890 -Node: ar cmdline4056 -Node: ar scripts10816 -Node: nm16497 -Node: objcopy23045 -Node: objdump31490 -Node: ranlib38537 -Node: size39271 -Node: strings41938 -Node: strip43763 -Node: c++filt46635 -Node: nlmconv49194 -Node: Selecting The Target System51817 -Node: Target Selection52825 -Node: Architecture Selection55073 -Node: Linker Emulation Selection56305 -Node: Index57183 +(Indirect) +Node: Top969 +Node: ar2006 +Node: ar cmdline4172 +Node: ar scripts10932 +Node: nm16613 +Node: objcopy23161 +Node: objdump32838 +Node: ranlib41125 +Node: size41859 +Node: strings44526 +Node: strip46351 +Node: c++filt49335 +Node: addr2line51896 +Node: nlmconv54293 +Node: Selecting The Target System56918 +Node: Target Selection57935 +Node: Architecture Selection60635 +Node: Linker Emulation Selection61867 +Node: Reporting Bugs62745 +Node: Bug Criteria63496 +Node: Bug Reporting64042 +Node: Index71031  End Tag Table diff -urN binutils-2.7/binutils/binutils.info-1 binutils-2.8/binutils/binutils.info-1 --- binutils-2.7/binutils/binutils.info-1 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/binutils/binutils.info-1 Wed Apr 30 13:12:44 1997 @@ -0,0 +1,1347 @@ +This is Info file binutils.info, produced by Makeinfo-1.64 from the +input file ./binutils.texi. + +START-INFO-DIR-ENTRY +* Binutils: (binutils). The GNU binary utilities "ar", "objcopy", + "objdump", "nm", "nlmconv", "size", + "strings", "strip", and "ranlib". +END-INFO-DIR-ENTRY + + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, provided also +that the entire resulting derived work is distributed under the terms +of a permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions. + + +File: binutils.info, Node: Top, Next: ar, Up: (dir) + +Introduction +************ + + This brief manual contains preliminary documentation for the GNU +binary utilities (collectively version 2.8): + +* Menu: + +* ar:: Create, modify, and extract from archives +* nm:: List symbols from object files +* objcopy:: Copy and translate object files +* objdump:: Display information from object files +* ranlib:: Generate index to archive contents +* size:: List section sizes and total size +* strings:: List printable strings from files +* strip:: Discard symbols +* c++filt:: Filter to demangle encoded C++ symbols +* addr2line:: Convert addresses to file and line +* nlmconv:: Converts object code into an NLM +* Selecting The Target System:: How these utilities determine the target. +* Reporting Bugs:: Reporting Bugs +* Index:: Index + + +File: binutils.info, Node: ar, Next: nm, Prev: Top, Up: Top + +ar +** + + ar [-]P[MOD [RELPOS]] ARCHIVE [MEMBER...] + ar -M [ '), and continues executing even after errors. If you +redirect standard input to a script file, no prompts are issued, and +`ar' abandons execution (with a nonzero exit code) on any error. + + The `ar' command language is *not* designed to be equivalent to the +command-line options; in fact, it provides somewhat less control over +archives. The only purpose of the command language is to ease the +transition to GNU `ar' for developers who already have scripts written +for the MRI "librarian" program. + + The syntax for the `ar' command language is straightforward: + * commands are recognized in upper or lower case; for example, `LIST' + is the same as `list'. In the following descriptions, commands are + shown in upper case for clarity. + + * a single command may appear on each line; it is the first word on + the line. + + * empty lines are allowed, and have no effect. + + * comments are allowed; text after either of the characters `*' or + `;' is ignored. + + * Whenever you use a list of names as part of the argument to an `ar' + command, you can separate the individual names with either commas + or blanks. Commas are shown in the explanations below, for + clarity. + + * `+' is used as a line continuation character; if `+' appears at + the end of a line, the text on the following line is considered + part of the current command. + + Here are the commands you can use in `ar' scripts, or when using +`ar' interactively. Three of them have special significance: + + `OPEN' or `CREATE' specify a "current archive", which is a temporary +file required for most of the other commands. + + `SAVE' commits the changes so far specified by the script. Prior to +`SAVE', commands affect only the temporary copy of the current archive. + +`ADDLIB ARCHIVE' +`ADDLIB ARCHIVE (MODULE, MODULE, ... MODULE)' + Add all the contents of ARCHIVE (or, if specified, each named + MODULE from ARCHIVE) to the current archive. + + Requires prior use of `OPEN' or `CREATE'. + +`ADDMOD MEMBER, MEMBER, ... MEMBER' + Add each named MEMBER as a module in the current archive. + + Requires prior use of `OPEN' or `CREATE'. + +`CLEAR' + Discard the contents of the current archive, cancelling the effect + of any operations since the last `SAVE'. May be executed (with no + effect) even if no current archive is specified. + +`CREATE ARCHIVE' + Creates an archive, and makes it the current archive (required for + many other commands). The new archive is created with a temporary + name; it is not actually saved as ARCHIVE until you use `SAVE'. + You can overwrite existing archives; similarly, the contents of any + existing file named ARCHIVE will not be destroyed until `SAVE'. + +`DELETE MODULE, MODULE, ... MODULE' + Delete each listed MODULE from the current archive; equivalent to + `ar -d ARCHIVE MODULE ... MODULE'. + + Requires prior use of `OPEN' or `CREATE'. + +`DIRECTORY ARCHIVE (MODULE, ... MODULE)' +`DIRECTORY ARCHIVE (MODULE, ... MODULE) OUTPUTFILE' + List each named MODULE present in ARCHIVE. The separate command + `VERBOSE' specifies the form of the output: when verbose output is + off, output is like that of `ar -t ARCHIVE MODULE...'. When + verbose output is on, the listing is like `ar -tv ARCHIVE + MODULE...'. + + Output normally goes to the standard output stream; however, if you + specify OUTPUTFILE as a final argument, `ar' directs the output to + that file. + +`END' + Exit from `ar', with a `0' exit code to indicate successful + completion. This command does not save the output file; if you + have changed the current archive since the last `SAVE' command, + those changes are lost. + +`EXTRACT MODULE, MODULE, ... MODULE' + Extract each named MODULE from the current archive, writing them + into the current directory as separate files. Equivalent to `ar -x + ARCHIVE MODULE...'. + + Requires prior use of `OPEN' or `CREATE'. + +`LIST' + Display full contents of the current archive, in "verbose" style + regardless of the state of `VERBOSE'. The effect is like `ar tv + ARCHIVE'). (This single command is a GNU `ld' enhancement, rather + than present for MRI compatibility.) + + Requires prior use of `OPEN' or `CREATE'. + +`OPEN ARCHIVE' + Opens an existing archive for use as the current archive (required + for many other commands). Any changes as the result of subsequent + commands will not actually affect ARCHIVE until you next use + `SAVE'. + +`REPLACE MODULE, MODULE, ... MODULE' + In the current archive, replace each existing MODULE (named in the + `REPLACE' arguments) from files in the current working directory. + To execute this command without errors, both the file, and the + module in the current archive, must exist. + + Requires prior use of `OPEN' or `CREATE'. + +`VERBOSE' + Toggle an internal flag governing the output from `DIRECTORY'. + When the flag is on, `DIRECTORY' output matches output from `ar + -tv '.... + +`SAVE' + Commit your changes to the current archive, and actually save it + as a file with the name specified in the last `CREATE' or `OPEN' + command. + + Requires prior use of `OPEN' or `CREATE'. + + +File: binutils.info, Node: nm, Next: objcopy, Prev: ar, Up: Top + +nm +** + + nm [ -a | --debug-syms ] [ -g | --extern-only ] + [ -B ] [ -C | --demangle ] [ -D | --dynamic ] + [ -s | --print-armap ] [ -A | -o | --print-file-name ] + [ -n | -v | --numeric-sort ] [ -p | --no-sort ] + [ -r | --reverse-sort ] [ --size-sort ] [ -u | --undefined-only ] + [ -t RADIX | --radix=RADIX ] [ -P | --portability ] + [ --target=BFDNAME ] [ -f FORMAT | --format=FORMAT ] + [ --defined-only ] [-l | --line-numbers ] + [ --no-demangle ] [ -V | --version ] [ --help ] [ OBJFILE... ] + + GNU `nm' lists the symbols from object files OBJFILE.... If no +object files are listed as arguments, `nm' assumes `a.out'. + + For each symbol, `nm' shows: + + * The symbol value, in the radix selected by options (see below), or + hexadecimal by default. + + * The symbol type. At least the following types are used; others + are, as well, depending on the object file format. If lowercase, + the symbol is local; if uppercase, the symbol is global (external). + + `A' + The symbol's value is absolute, and will not be changed by + further linking. + + `B' + The symbol is in the uninitialized data section (known as + BSS). + + `C' + The symbol is common. Common symbols are uninitialized data. + When linking, multiple common symbols may appear with the + same name. If the symbol is defined anywhere, the common + symbols are treated as undefined references. For more + details on common symbols, see the discussion of -warn-common + in *Note Linker options: (ld.info)Options. + + `D' + The symbol is in the initialized data section. + + `G' + The symbol is in an initialized data section for small + objects. Some object file formats permit more efficient + access to small data objects, such as a global int variable + as opposed to a large global array. + + `I' + The symbol is an indirect reference to another symbol. This + is a GNU extension to the a.out object file format which is + rarely used. + + `N' + The symbol is a debugging symbol. + + `R' + The symbol is in a read only data section. + + `S' + The symbol is in an uninitialized data section for small + objects. + + `T' + The symbol is in the text (code) section. + + `U' + The symbol is undefined. + + `W' + The symbol is weak. When a weak defined symbol is linked + with a normal defined symbol, the normal defined symbol is + used with no error. When a weak undefined symbol is linked + and the symbol is not defined, the value of the weak symbol + becomes zero with no error. + + `-' + The symbol is a stabs symbol in an a.out object file. In + this case, the next values printed are the stabs other field, + the stabs desc field, and the stab type. Stabs symbols are + used to hold debugging information; for more information, see + *Note Stabs: (stabs.info)Top. + + `?' + The symbol type is unknown, or object file format specific. + + * The symbol name. + + The long and short forms of options, shown here as alternatives, are +equivalent. + +`-A' +`-o' +`--print-file-name' + Precede each symbol by the name of the input file (or archive + element) in which it was found, rather than identifying the input + file once only, before all of its symbols. + +`-a' +`--debug-syms' + Display all symbols, even debugger-only symbols; normally these + are not listed. + +`-B' + The same as `--format=bsd' (for compatibility with the MIPS `nm'). + +`-C' +`--demangle' + Decode ("demangle") low-level symbol names into user-level names. + Besides removing any initial underscore prepended by the system, + this makes C++ function names readable. *Note c++filt::, for more + information on demangling. + +`--no-demangle' + Do not demangle low-level symbol names. This is the default. + +`-D' +`--dynamic' + Display the dynamic symbols rather than the normal symbols. This + is only meaningful for dynamic objects, such as certain types of + shared libraries. + +`-f FORMAT' +`--format=FORMAT' + Use the output format FORMAT, which can be `bsd', `sysv', or + `posix'. The default is `bsd'. Only the first character of + FORMAT is significant; it can be either upper or lower case. + +`-g' +`--extern-only' + Display only external symbols. + +`-l' +`--line-numbers' + For each symbol, use debugging information to try to find a + filename and line number. For a defined symbol, look for the line + number of the address of the symbol. For an undefined symbol, + look for the line number of a relocation entry which refers to the + symbol. If line number information can be found, print it after + the other symbol information. + +`-n' +`-v' +`--numeric-sort' + Sort symbols numerically by their addresses, rather than + alphabetically by their names. + +`-p' +`--no-sort' + Do not bother to sort the symbols in any order; print them in the + order encountered. + +`-P' +`--portability' + Use the POSIX.2 standard output format instead of the default + format. Equivalent to `-f posix'. + +`-s' +`--print-armap' + When listing symbols from archive members, include the index: a + mapping (stored in the archive by `ar' or `ranlib') of which + modules contain definitions for which names. + +`-r' +`--reverse-sort' + Reverse the order of the sort (whether numeric or alphabetic); let + the last come first. + +`--size-sort' + Sort symbols by size. The size is computed as the difference + between the value of the symbol and the value of the symbol with + the next higher value. The size of the symbol is printed, rather + than the value. + +`-t RADIX' +`--radix=RADIX' + Use RADIX as the radix for printing the symbol values. It must be + `d' for decimal, `o' for octal, or `x' for hexadecimal. + +`--target=BFDNAME' + Specify an object code format other than your system's default + format. *Note Target Selection::, for more information. + +`-u' +`--undefined-only' + Display only undefined symbols (those external to each object + file). + +`--defined-only' + Display only defined symbols for each object file. + +`-V' +`--version' + Show the version number of `nm' and exit. + +`--help' + Show a summary of the options to `nm' and exit. + + +File: binutils.info, Node: objcopy, Next: objdump, Prev: nm, Up: Top + +objcopy +******* + + objcopy [ -F BFDNAME | --target=BFDNAME ] + [ -I BFDNAME | --input-target=BFDNAME ] + [ -O BFDNAME | --output-target=BFDNAME ] + [ -S | --strip-all ] [ -g | --strip-debug ] + [ -K SYMBOLNAME | --keep-symbol=SYMBOLNAME ] + [ -N SYMBOLNAME | --strip-symbol=SYMBOLNAME ] + [ -x | --discard-all ] [ -X | --discard-locals ] + [ -b BYTE | --byte=BYTE ] + [ -i INTERLEAVE | --interleave=INTERLEAVE ] + [ -R SECTIONNAME | --remove-section=SECTIONNAME ] + [ -p | --preserve-dates ] [ --debugging ] + [ --gap-fill=VAL ] [ --pad-to=ADDRESS ] + [ --set-start=VAL ] [ --adjust-start=INCR ] + [ --adjust-vma=INCR ] + [ --adjust-section-vma=SECTION{=,+,-}VAL ] + [ --adjust-warnings ] [ --no-adjust-warnings ] + [ --set-section-flags=SECTION=FLAGS ] + [ --add-section=SECTIONNAME=FILENAME ] + [ --change-leading-char ] [ --remove-leading-char ] + [ --weaken ] + [ -v | --verbose ] [ -V | --version ] [ --help ] + INFILE [OUTFILE] + + The GNU `objcopy' utility copies the contents of an object file to +another. `objcopy' uses the GNU BFD Library to read and write the +object files. It can write the destination object file in a format +different from that of the source object file. The exact behavior of +`objcopy' is controlled by command-line options. + + `objcopy' creates temporary files to do its translations and deletes +them afterward. `objcopy' uses BFD to do all its translation work; it +has access to all the formats described in BFD and thus is able to +recognize most formats without being told explicitly. *Note BFD: +(ld.info)BFD. + + `objcopy' can be used to generate S-records by using an output +target of `srec' (e.g., use `-O srec'). + + `objcopy' can be used to generate a raw binary file by using an +output target of `binary' (e.g., use `-O binary'). When `objcopy' +generates a raw binary file, it will essentially produce a memory dump +of the contents of the input object file. All symbols and relocation +information will be discarded. The memory dump will start at the load +address of the lowest section copied into the output file. + + When generating an S-record or a raw binary file, it may be helpful +to use `-S' to remove sections containing debugging information. In +some cases `-R' will be useful to remove sections which contain +information which is not needed by the binary file. + +`INFILE' +`OUTFILE' + The source and output files, respectively. If you do not specify + OUTFILE, `objcopy' creates a temporary file and destructively + renames the result with the name of INFILE. + +`-I BFDNAME' +`--input-target=BFDNAME' + Consider the source file's object format to be BFDNAME, rather than + attempting to deduce it. *Note Target Selection::, for more + information. + +`-O BFDNAME' +`--output-target=BFDNAME' + Write the output file using the object format BFDNAME. *Note + Target Selection::, for more information. + +`-F BFDNAME' +`--target=BFDNAME' + Use BFDNAME as the object format for both the input and the output + file; i.e., simply transfer data from source to destination with no + translation. *Note Target Selection::, for more information. + +`-R SECTIONNAME' +`--remove-section=SECTIONNAME' + Remove any section named SECTIONNAME from the output file. This + option may be given more than once. Note that using this option + inappropriately may make the output file unusable. + +`-S' +`--strip-all' + Do not copy relocation and symbol information from the source file. + +`-g' +`--strip-debug' + Do not copy debugging symbols from the source file. + +`--strip-unneeded' + Strip all symbols that are not needed for relocation processing. + +`-K SYMBOLNAME' +`--keep-symbol=SYMBOLNAME' + Copy only symbol SYMBOLNAME from the source file. This option may + be given more than once. + +`-N SYMBOLNAME' +`--strip-symbol=SYMBOLNAME' + Do not copy symbol SYMBOLNAME from the source file. This option + may be given more than once, and may be combined with strip options + other than `-K'. + +`-x' +`--discard-all' + Do not copy non-global symbols from the source file. + +`-X' +`--discard-locals' + Do not copy compiler-generated local symbols. (These usually + start with `L' or `.'.) + +`-b BYTE' +`--byte=BYTE' + Keep only every BYTEth byte of the input file (header data is not + affected). BYTE can be in the range from 0 to INTERLEAVE-1, where + INTERLEAVE is given by the `-i' or `--interleave' option, or the + default of 4. This option is useful for creating files to program + ROM. It is typically used with an `srec' output target. + +`-i INTERLEAVE' +`--interleave=INTERLEAVE' + Only copy one out of every INTERLEAVE bytes. Select which byte to + copy with the -B or `--byte' option. The default is 4. `objcopy' + ignores this option if you do not specify either `-b' or `--byte'. + +`-p' +`--preserve-dates' + Set the access and modification dates of the output file to be the + same as those of the input file. + +`--debugging' + Convert debugging information, if possible. This is not the + default because only certain debugging formats are supported, and + the conversion process can be time consuming. + +`--gap-fill VAL' + Fill gaps between sections with VAL. This is done by increasing + the size of the section with the lower address, and filling in the + extra space created with VAL. + +`--pad-to ADDRESS' + Pad the output file up to the virtual address ADDRESS. This is + done by increasing the size of the last section. The extra space + is filled in with the value specified by `--gap-fill' (default + zero). + +`--set-start VAL' + Set the address of the new file to VAL. Not all object file + formats support setting the start address. + +`--adjust-start INCR' + Adjust the start address by adding INCR. Not all object file + formats support setting the start address. + +`--adjust-vma INCR' + Adjust the address of all sections, as well as the start address, + by adding INCR. Some object file formats do not permit section + addresses to be changed arbitrarily. Note that this does not + relocate the sections; if the program expects sections to be + loaded at a certain address, and this option is used to change the + sections such that they are loaded at a different address, the + program may fail. + +`--adjust-section-vma SECTION{=,+,-}VAL' + Set or adjust the address of the named SECTION. If `=' is used, + the section address is set to VAL. Otherwise, VAL is added to or + subtracted from the section address. See the comments under + `--adjust-vma', above. If SECTION does not exist in the input + file, a warning will be issued, unless `--no-adjust-warnings' is + used. + +`--adjust-warnings' + If `--adjust-section-vma' is used, and the named section does not + exist, issue a warning. This is the default. + +`--no-adjust-warnings' + Do not issue a warning if `--adjust-section-vma' is used, even if + the named section does not exist. + +`--set-section-flags SECTION=FLAGS' + Set the flags for the named section. The FLAGS argument is a + comma separated string of flag names. The recognized names are + `alloc', `load', `readonly', `code', `data', and `rom'. Not all + flags are meaningful for all object file formats. + +`--add-section SECTIONNAME=FILENAME' + Add a new section named SECTIONNAME while copying the file. The + contents of the new section are taken from the file FILENAME. The + size of the section will be the size of the file. This option only + works on file formats which can support sections with arbitrary + names. + +`--change-leading-char' + Some object file formats use special characters at the start of + symbols. The most common such character is underscore, which + compilers often add before every symbol. This option tells + `objcopy' to change the leading character of every symbol when it + converts between object file formats. If the object file formats + use the same leading character, this option has no effect. + Otherwise, it will add a character, or remove a character, or + change a character, as appropriate. + +`--remove-leading-char' + If the first character of a global symbol is a special symbol + leading character used by the object file format, remove the + character. The most common symbol leading character is + underscore. This option will remove a leading underscore from all + global symbols. This can be useful if you want to link together + objects of different file formats with different conventions for + symbol names. This is different from `--change-leading-char' + because it always changes the symbol name when appropriate, + regardless of the object file format of the output file. + +`--weaken' + Change all global symbols in the file to be weak. This can be + useful when building an object which will be linked against other + objects using the `-R' option to the linker. This option is only + effective when using an object file format which supports weak + symbols. + +`-V' +`--version' + Show the version number of `objcopy'. + +`-v' +`--verbose' + Verbose output: list all object files modified. In the case of + archives, `objcopy -V' lists all members of the archive. + +`--help' + Show a summary of the options to `objcopy'. + + +File: binutils.info, Node: objdump, Next: ranlib, Prev: objcopy, Up: Top + +objdump +******* + + objdump [ -a | --archive-headers ] + [ -b BFDNAME | --target=BFDNAME ] [ --debugging ] + [ -C | --demangle ] [ -d | --disassemble ] + [ -D | --disassemble-all ] [ --disassemble-zeroes ] + [ -EB | -EL | --endian={big | little } ] + [ -f | --file-headers ] + [ -h | --section-headers | --headers ] [ -i | --info ] + [ -j SECTION | --section=SECTION ] + [ -l | --line-numbers ] [ -S | --source ] + [ -m MACHINE | --architecture=MACHINE ] + [ -r | --reloc ] [ -R | --dynamic-reloc ] + [ -s | --full-contents ] [ --stabs ] + [ -t | --syms ] [ -T | --dynamic-syms ] [ -x | --all-headers ] + [ -w | --wide ] [ --start-address=ADDRESS ] + [ --stop-address=ADDRESS ] + [ --prefix-addresses] [ --[no-]show-raw-insn ] + [ --adjust-vma=OFFSET ] + [ --version ] [ --help ] + OBJFILE... + + `objdump' displays information about one or more object files. The +options control what particular information to display. This +information is mostly useful to programmers who are working on the +compilation tools, as opposed to programmers who just want their +program to compile and work. + + OBJFILE... are the object files to be examined. When you specify +archives, `objdump' shows information on each of the member object +files. + + The long and short forms of options, shown here as alternatives, are +equivalent. At least one option besides `-l' must be given. + +`-a' +`--archive-header' + If any of the OBJFILE files are archives, display the archive + header information (in a format similar to `ls -l'). Besides the + information you could list with `ar tv', `objdump -a' shows the + object file format of each archive member. + +`--adjust-vma=OFFSET' + When dumping information, first add OFFSET to all the section + addresses. This is useful if the section addresses do not + correspond to the symbol table, which can happen when putting + sections at particular addresses when using a format which can not + represent section addresses, such as a.out. + +`-b BFDNAME' +`--target=BFDNAME' + Specify that the object-code format for the object files is + BFDNAME. This option may not be necessary; OBJDUMP can + automatically recognize many formats. + + For example, + objdump -b oasys -m vax -h fu.o + + displays summary information from the section headers (`-h') of + `fu.o', which is explicitly identified (`-m') as a VAX object file + in the format produced by Oasys compilers. You can list the + formats available with the `-i' option. *Note Target Selection::, + for more information. + +`-C' +`--demangle' + Decode ("demangle") low-level symbol names into user-level names. + Besides removing any initial underscore prepended by the system, + this makes C++ function names readable. *Note c++filt::, for more + information on demangling. + +`--debugging' + Display debugging information. This attempts to parse debugging + information stored in the file and print it out using a C like + syntax. Only certain types of debugging information have been + implemented. + +`-d' +`--disassemble' + Display the assembler mnemonics for the machine instructions from + OBJFILE. This option only disassembles those sections which are + expected to contain instructions. + +`-D' +`--disassemble-all' + Like `-d', but disassemble the contents of all sections, not just + those expected to contain instructions. + +`--prefix-addresses' + When disassembling, print the complete address on each line. This + is the older disassembly format. + +`--disassemble-zeroes' + Normally the disassembly output will skip blocks of zeroes. This + option directs the disassembler to disassemble those blocks, just + like any other data. + +`-EB' +`-EL' +`--endian={big|little}' + Specify the endianness of the object files. This only affects + disassembly. This can be useful when disassembling a file format + which does not describe endianness information, such as S-records. + +`-f' +`--file-header' + Display summary information from the overall header of each of the + OBJFILE files. + +`-h' +`--section-header' +`--header' + Display summary information from the section headers of the object + file. + + File segments may be relocated to nonstandard addresses, for + example by using the `-Ttext', `-Tdata', or `-Tbss' options to + `ld'. However, some object file formats, such as a.out, do not + store the starting address of the file segments. In those + situations, although `ld' relocates the sections correctly, using + `objdump -h' to list the file section headers cannot show the + correct addresses. Instead, it shows the usual addresses, which + are implicit for the target. + +`--help' + Print a summary of the options to `objdump' and exit. + +`-i' +`--info' + Display a list showing all architectures and object formats + available for specification with `-b' or `-m'. + +`-j NAME' +`--section=NAME' + Display information only for section NAME. + +`-l' +`--line-numbers' + Label the display (using debugging information) with the filename + and source line numbers corresponding to the object code or relocs + shown. Only useful with `-d', `-D', or `-r'. + +`-m MACHINE' +`--architecture=MACHINE' + Specify the architecture to use when disassembling object files. + This can be useful when disasembling object files which do not + describe architecture information, such as S-records. You can + list the available architectures with the `-i' option. + +`-r' +`--reloc' + Print the relocation entries of the file. If used with `-d' or + `-D', the relocations are printed interspersed with the + disassembly. + +`-R' +`--dynamic-reloc' + Print the dynamic relocation entries of the file. This is only + meaningful for dynamic objects, such as certain types of shared + libraries. + +`-s' +`--full-contents' + Display the full contents of any sections requested. + +`-S' +`--source' + Display source code intermixed with disassembly, if possible. + Implies `-d'. + +`--show-raw-insn' + When disassembling instructions, print the instruction in hex as + well as in symbolic form. This is the default except when + `--prefix-addresses' is used. + +`--no-show-raw-insn' + When disassembling instructions, do not print the instruction + bytes. This is the default when `--prefix-addresses' is used. + +`--stabs' + Display the full contents of any sections requested. Display the + contents of the .stab and .stab.index and .stab.excl sections from + an ELF file. This is only useful on systems (such as Solaris 2.0) + in which `.stab' debugging symbol-table entries are carried in an + ELF section. In most other file formats, debugging symbol-table + entries are interleaved with linkage symbols, and are visible in + the `--syms' output. For more information on stabs symbols, see + *Note Stabs: (stabs.info)Top. + +`--start-address=ADDRESS' + Start displaying data at the specified address. This affects the + output of the `-d', `-r' and `-s' options. + +`--stop-address=ADDRESS' + Stop displaying data at the specified address. This affects the + output of the `-d', `-r' and `-s' options. + +`-t' +`--syms' + Print the symbol table entries of the file. This is similar to + the information provided by the `nm' program. + +`-T' +`--dynamic-syms' + Print the dynamic symbol table entries of the file. This is only + meaningful for dynamic objects, such as certain types of shared + libraries. This is similar to the information provided by the `nm' + program when given the `-D' (`--dynamic') option. + +`--version' + Print the version number of `objdump' and exit. + +`-x' +`--all-header' + Display all available header information, including the symbol + table and relocation entries. Using `-x' is equivalent to + specifying all of `-a -f -h -r -t'. + +`-w' +`--wide' + Format some lines for output devices that have more than 80 + columns. + + +File: binutils.info, Node: ranlib, Next: size, Prev: objdump, Up: Top + +ranlib +****** + + ranlib [-vV] ARCHIVE + + `ranlib' generates an index to the contents of an archive and stores +it in the archive. The index lists each symbol defined by a member of +an archive that is a relocatable object file. + + You may use `nm -s' or `nm --print-armap' to list this index. + + An archive with such an index speeds up linking to the library and +allows routines in the library to call each other without regard to +their placement in the archive. + + The GNU `ranlib' program is another form of GNU `ar'; running +`ranlib' is completely equivalent to executing `ar -s'. *Note ar::. + +`-v' +`-V' + Show the version number of `ranlib'. + + +File: binutils.info, Node: size, Next: strings, Prev: ranlib, Up: Top + +size +**** + + size [ -A | -B | --format=COMPATIBILITY ] + [ --help ] [ -d | -o | -x | --radix=NUMBER ] + [ --target=BFDNAME ] [ -V | --version ] + OBJFILE... + + The GNU `size' utility lists the section sizes--and the total +size--for each of the object or archive files OBJFILE in its argument +list. By default, one line of output is generated for each object file +or each module in an archive. + + OBJFILE... are the object files to be examined. + + The command line options have the following meanings: + +`-A' +`-B' +`--format=COMPATIBILITY' + Using one of these options, you can choose whether the output from + GNU `size' resembles output from System V `size' (using `-A', or + `--format=sysv'), or Berkeley `size' (using `-B', or + `--format=berkeley'). The default is the one-line format similar + to Berkeley's. + + Here is an example of the Berkeley (default) format of output from + `size': + size --format=Berkeley ranlib size + text data bss dec hex filename + 294880 81920 11592 388392 5ed28 ranlib + 294880 81920 11888 388688 5ee50 size + + This is the same data, but displayed closer to System V + conventions: + + size --format=SysV ranlib size + ranlib : + section size addr + .text 294880 8192 + .data 81920 303104 + .bss 11592 385024 + Total 388392 + + + size : + section size addr + .text 294880 8192 + .data 81920 303104 + .bss 11888 385024 + Total 388688 + +`--help' + Show a summary of acceptable arguments and options. + +`-d' +`-o' +`-x' +`--radix=NUMBER' + Using one of these options, you can control whether the size of + each section is given in decimal (`-d', or `--radix=10'); octal + (`-o', or `--radix=8'); or hexadecimal (`-x', or `--radix=16'). + In `--radix=NUMBER', only the three values (8, 10, 16) are + supported. The total size is always given in two radices; decimal + and hexadecimal for `-d' or `-x' output, or octal and hexadecimal + if you're using `-o'. + +`--target=BFDNAME' + Specify that the object-code format for OBJFILE is BFDNAME. This + option may not be necessary; `size' can automatically recognize + many formats. *Note Target Selection::, for more information. + +`-V' +`--version' + Display the version number of `size'. + + +File: binutils.info, Node: strings, Next: strip, Prev: size, Up: Top + +strings +******* + + strings [-afov] [-MIN-LEN] [-n MIN-LEN] [-t RADIX] [-] + [--all] [--print-file-name] [--bytes=MIN-LEN] + [--radix=RADIX] [--target=BFDNAME] + [--help] [--version] FILE... + + For each FILE given, GNU `strings' prints the printable character +sequences that are at least 4 characters long (or the number given with +the options below) and are followed by an unprintable character. By +default, it only prints the strings from the initialized and loaded +sections of object files; for other types of files, it prints the +strings from the whole file. + + `strings' is mainly useful for determining the contents of non-text +files. + +`-a' +`--all' +`-' + Do not scan only the initialized and loaded sections of object + files; scan the whole files. + +`-f' +`--print-file-name' + Print the name of the file before each string. + +`--help' + Print a summary of the program usage on the standard output and + exit. + +`-MIN-LEN' +`-n MIN-LEN' +`--bytes=MIN-LEN' + Print sequences of characters that are at least MIN-LEN characters + long, instead of the default 4. + +`-o' + Like `-t o'. Some other versions of `strings' have `-o' act like + `-t d' instead. Since we can not be compatible with both ways, we + simply chose one. + +`-t RADIX' +`--radix=RADIX' + Print the offset within the file before each string. The single + character argument specifies the radix of the offset--`o' for + octal, `x' for hexadecimal, or `d' for decimal. + +`--target=BFDNAME' + Specify an object code format other than your system's default + format. *Note Target Selection::, for more information. + +`-v' +`--version' + Print the program version number on the standard output and exit. + + +File: binutils.info, Node: strip, Next: c++filt, Prev: strings, Up: Top + +strip +***** + + strip [ -F BFDNAME | --target=BFDNAME | --target=BFDNAME ] + [ -I BFDNAME | --input-target=BFDNAME ] + [ -O BFDNAME | --output-target=BFDNAME ] + [ -s | --strip-all ] [ -S | -g | --strip-debug ] + [ -K SYMBOLNAME | --keep-symbol=SYMBOLNAME ] + [ -N SYMBOLNAME | --strip-symbol=SYMBOLNAME ] + [ -x | --discard-all ] [ -X | --discard-locals ] + [ -R SECTIONNAME | --remove-section=SECTIONNAME ] + [ -o FILE ] [ -p | --preserve-dates ] + [ -v | --verbose ] [ -V | --version ] [ --help ] + OBJFILE... + + GNU `strip' discards all symbols from object files OBJFILE. The +list of object files may include archives. At least one object file +must be given. + + `strip' modifies the files named in its argument, rather than +writing modified copies under different names. + +`-F BFDNAME' +`--target=BFDNAME' + Treat the original OBJFILE as a file with the object code format + BFDNAME, and rewrite it in the same format. *Note Target + Selection::, for more information. + +`--help' + Show a summary of the options to `strip' and exit. + +`-I BFDNAME' +`--input-target=BFDNAME' + Treat the original OBJFILE as a file with the object code format + BFDNAME. *Note Target Selection::, for more information. + +`-O BFDNAME' +`--output-target=BFDNAME' + Replace OBJFILE with a file in the output format BFDNAME. *Note + Target Selection::, for more information. + +`-R SECTIONNAME' +`--remove-section=SECTIONNAME' + Remove any section named SECTIONNAME from the output file. This + option may be given more than once. Note that using this option + inappropriately may make the output file unusable. + +`-s' +`--strip-all' + Remove all symbols. + +`-g' +`-S' +`--strip-debug' + Remove debugging symbols only. + +`--strip-unneeded' + Remove all symbols that are not needed for relocation processing. + +`-K SYMBOLNAME' +`--keep-symbol=SYMBOLNAME' + Keep only symbol SYMBOLNAME from the source file. This option may + be given more than once. + +`-N SYMBOLNAME' +`--strip-symbol=SYMBOLNAME' + Remove symbol SYMBOLNAME from the source file. This option may be + given more than once, and may be combined with strip options other + than `-K'. + +`-o FILE' + Put the stripped output in FILE, rather than replacing the + existing file. When this argument is used, only one OBJFILE + argument may be specified. + +`-p' +`--preserve-dates' + Preserve the access and modification dates of the file. + +`-x' +`--discard-all' + Remove non-global symbols. + +`-X' +`--discard-locals' + Remove compiler-generated local symbols. (These usually start + with `L' or `.'.) + +`-V' +`--version' + Show the version number for `strip'. + +`-v' +`--verbose' + Verbose output: list all object files modified. In the case of + archives, `strip -v' lists all members of the archive. + diff -urN binutils-2.7/binutils/binutils.info-2 binutils-2.8/binutils/binutils.info-2 --- binutils-2.7/binutils/binutils.info-2 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/binutils/binutils.info-2 Wed Apr 30 13:12:44 1997 @@ -0,0 +1,771 @@ +This is Info file binutils.info, produced by Makeinfo-1.64 from the +input file ./binutils.texi. + +START-INFO-DIR-ENTRY +* Binutils: (binutils). The GNU binary utilities "ar", "objcopy", + "objdump", "nm", "nlmconv", "size", + "strings", "strip", and "ranlib". +END-INFO-DIR-ENTRY + + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, provided also +that the entire resulting derived work is distributed under the terms +of a permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions. + + +File: binutils.info, Node: c++filt, Next: addr2line, Prev: strip, Up: Top + +c++filt +******* + + c++filt [ -_ | --strip-underscores ] + [ -n | --no-strip-underscores ] + [ -s FORMAT | --format=FORMAT ] + [ --help ] [ --version ] [ SYMBOL... ] + + The C++ language provides function overloading, which means that you +can write many functions with the same name (providing each takes +parameters of different types). All C++ function names are encoded +into a low-level assembly label (this process is known as "mangling"). +The `c++filt' program does the inverse mapping: it decodes +("demangles") low-level names into user-level names so that the linker +can keep these overloaded functions from clashing. + + Every alphanumeric word (consisting of letters, digits, underscores, +dollars, or periods) seen in the input is a potential label. If the +label decodes into a C++ name, the C++ name replaces the low-level name +in the output. + + You can use `c++filt' to decipher individual symbols: + + c++filt SYMBOL + + If no SYMBOL arguments are given, `c++filt' reads symbol names from +the standard input and writes the demangled names to the standard +output. All results are printed on the standard output. + +`-_' +`--strip-underscores' + On some systems, both the C and C++ compilers put an underscore in + front of every name. For example, the C name `foo' gets the + low-level name `_foo'. This option removes the initial + underscore. Whether `c++filt' removes the underscore by default + is target dependent. + +`-n' +`--no-strip-underscores' + Do not remove the initial underscore. + +`-s FORMAT' +`--format=FORMAT' + GNU `nm' can decode three different methods of mangling, used by + different C++ compilers. The argument to this option selects which + method it uses: + + `gnu' + the one used by the GNU compiler (the default method) + + `lucid' + the one used by the Lucid compiler + + `arm' + the one specified by the C++ Annotated Reference Manual + +`--help' + Print a summary of the options to `c++filt' and exit. + +`--version' + Print the version number of `c++filt' and exit. + + *Warning:* `c++filt' is a new utility, and the details of its user + interface are subject to change in future releases. In particular, + a command-line option may be required in the the future to decode + a name passed as an argument on the command line; in other words, + + c++filt SYMBOL + + may in a future release become + + c++filt OPTION SYMBOL + + +File: binutils.info, Node: addr2line, Next: nlmconv, Prev: c++filt, Up: Top + +addr2line +********* + + addr2line [ -b BFDNAME | --target=BFDNAME ] + [ -C | --demangle ] + [ -e FILENAME | --exe=FILENAME ] + [ -f | --functions ] [ -s | --basename ] + [ -H | --help ] [ -V | --version ] + [ addr addr ... ] + + `addr2line' translates program addresses into file names and line +numbers. Given an address and an executable, it uses the debugging +information in the executable to figure out which file name and line +number are associated with a given address. + + The executable to use is specified with the `-e' option. The +default is `a.out'. + + `addr2line' has two modes of operation. + + In the first, hexadecimal addresses are specified on the command +line, and `addr2line' displays the file name and line number for each +address. + + In the second, `addr2line' reads hexadecimal addresses from standard +input, and prints the file name and line number for each address on +standard output. In this mode, `addr2line' may be used in a pipe to +convert dynamically chosen addresses. + + The format of the output is `FILENAME:LINENO'. The file name and +line number for each address is printed on a separate line. If the +`-f' option is used, then each `FILENAME:LINENO' line is preceded by a +`FUNCTIONNAME' line which is the name of the function containing the +address. + + If the file name or function name can not be determined, `addr2line' +will print two question marks in their place. If the line number can +not be determined, `addr2line' will print 0. + + The long and short forms of options, shown here as alternatives, are +equivalent. + +`-b BFDNAME' +`--target=BFDNAME' + Specify that the object-code format for the object files is + BFDNAME. + +`-C' +`--demangle' + Decode ("demangle") low-level symbol names into user-level names. + Besides removing any initial underscore prepended by the system, + this makes C++ function names readable. *Note c++filt::, for more + information on demangling. + +`-e FILENAME' +`--exe=FILENAME' + Specify the name of the executable for which addresses should be + translated. The default file is `a.out'. + +`-f' +`--functions' + Display function names as well as file and line number information. + +`-s' +`--basenames' + Display only the base of each file name. + + +File: binutils.info, Node: nlmconv, Next: Selecting The Target System, Prev: addr2line, Up: Top + +nlmconv +******* + + `nlmconv' converts a relocatable object file into a NetWare Loadable +Module. + + *Warning:* `nlmconv' is not always built as part of the binary + utilities, since it is only useful for NLM targets. + + nlmconv [ -I BFDNAME | --input-target=BFDNAME ] + [ -O BFDNAME | --output-target=BFDNAME ] + [ -T HEADERFILE | --header-file=HEADERFILE ] + [ -d | --debug] [ -l LINKER | --linker=LINKER ] + [ -h | --help ] [ -V | --version ] + INFILE OUTFILE + + `nlmconv' converts the relocatable `i386' object file INFILE into +the NetWare Loadable Module OUTFILE, optionally reading HEADERFILE for +NLM header information. For instructions on writing the NLM command +file language used in header files, see the `linkers' section, +`NLMLINK' in particular, of the `NLM Development and Tools Overview', +which is part of the NLM Software Developer's Kit ("NLM SDK"), +available from Novell, Inc. `nlmconv' uses the GNU Binary File +Descriptor library to read INFILE; see *Note BFD: (ld.info)BFD, for +more information. + + `nlmconv' can perform a link step. In other words, you can list +more than one object file for input if you list them in the definitions +file (rather than simply specifying one input file on the command line). +In this case, `nlmconv' calls the linker for you. + +`-I BFDNAME' +`--input-target=BFDNAME' + Object format of the input file. `nlmconv' can usually determine + the format of a given file (so no default is necessary). *Note + Target Selection::, for more information. + +`-O BFDNAME' +`--output-target=BFDNAME' + Object format of the output file. `nlmconv' infers the output + format based on the input format, e.g. for a `i386' input file the + output format is `nlm32-i386'. *Note Target Selection::, for more + information. + +`-T HEADERFILE' +`--header-file=HEADERFILE' + Reads HEADERFILE for NLM header information. For instructions on + writing the NLM command file language used in header files, see + see the `linkers' section, of the `NLM Development and Tools + Overview', which is part of the NLM Software Developer's Kit, + available from Novell, Inc. + +`-d' +`--debug' + Displays (on standard error) the linker command line used by + `nlmconv'. + +`-l LINKER' +`--linker=LINKER' + Use LINKER for any linking. LINKER can be an abosolute or a + relative pathname. + +`-h' +`--help' + Prints a usage summary. + +`-V' +`--version' + Prints the version number for `nlmconv'. + + +File: binutils.info, Node: Selecting The Target System, Next: Reporting Bugs, Prev: nlmconv, Up: Top + +Selecting the target system +*************************** + + You can specify three aspects of the target system to the GNU binary +file utilities, each in several ways: + + * the target + + * the architecture + + * the linker emulation (which applies to the linker only) + + In the following summaries, the lists of ways to specify values are +in order of decreasing precedence. The ways listed first override those +listed later. + + The commands to list valid values only list the values for which the +programs you are running were configured. If they were configured with +`--enable-targets=all', the commands list most of the available values, +but a few are left out; not all targets can be configured in at once +because some of them can only be configured "native" (on hosts with the +same type as the target system). + +* Menu: + +* Target Selection:: +* Architecture Selection:: +* Linker Emulation Selection:: + + +File: binutils.info, Node: Target Selection, Next: Architecture Selection, Up: Selecting The Target System + +Target Selection +================ + + A "target" is an object file format. A given target may be +supported for multiple architectures (*note Architecture Selection::.). +A target selection may also have variations for different operating +systems or architectures. + + The command to list valid target values is `objdump -i' (the first +column of output contains the relevant information). + + Some sample values are: `a.out-hp300bsd', `ecoff-littlemips', +`a.out-sunos-big'. + + You can also specify a target using a configuration triplet. This is +the same sort of name that is passed to configure to specify a target. +When you use a configuration triplet as an argument, it must be fully +canonicalized. You can see the canonical version of a triplet by +running the shell script `config.sub' which is included with the +sources. + + Some sample configuration triplets are: `m68k-hp-bsd', +`mips-dec-ultrix', `sparc-sun-sunos'. + +`objdump' Target +---------------- + + Ways to specify: + + 1. command line option: `-b' or `--target' + + 2. environment variable `GNUTARGET' + + 3. deduced from the input file + +`objcopy' and `strip' Input Target +---------------------------------- + + Ways to specify: + + 1. command line options: `-I' or `--input-target', or `-F' or + `--target' + + 2. environment variable `GNUTARGET' + + 3. deduced from the input file + +`objcopy' and `strip' Output Target +----------------------------------- + + Ways to specify: + + 1. command line options: `-O' or `--output-target', or `-F' or + `--target' + + 2. the input target (see "`objcopy' and `strip' Input Target" above) + + 3. environment variable `GNUTARGET' + + 4. deduced from the input file + +`nm', `size', and `strings' Target +---------------------------------- + + Ways to specify: + + 1. command line option: `--target' + + 2. environment variable `GNUTARGET' + + 3. deduced from the input file + +Linker Input Target +------------------- + + Ways to specify: + + 1. command line option: `-b' or `--format' (*note Options: + (ld.info)Options.) + + 2. script command `TARGET' (*note Option Commands: (ld.info)Option + Commands.) + + 3. environment variable `GNUTARGET' (*note Environment: + (ld.info)Environment.) + + 4. the default target of the selected linker emulation (*note Linker + Emulation Selection::.) + +Linker Output Target +-------------------- + + Ways to specify: + + 1. command line option: `-oformat' (*note Options: (ld.info)Options.) + + 2. script command `OUTPUT_FORMAT' (*note Option Commands: + (ld.info)Option Commands.) + + 3. the linker input target (see "Linker Input Target" above) + + +File: binutils.info, Node: Architecture Selection, Next: Linker Emulation Selection, Prev: Target Selection, Up: Selecting The Target System + +Architecture selection +====================== + + An "architecture" is a type of CPU on which an object file is to +run. Its name may contain a colon, separating the name of the +processor family from the name of the particular CPU. + + The command to list valid architecture values is `objdump -i' (the +second column contains the relevant information). + + Sample values: `m68k:68020', `mips:3000', `sparc'. + +`objdump' Architecture +---------------------- + + Ways to specify: + + 1. command line option: `-m' or `--architecture' + + 2. deduced from the input file + +`objcopy', `nm', `size', `strings' Architecture +----------------------------------------------- + + Ways to specify: + + 1. deduced from the input file + +Linker Input Architecture +------------------------- + + Ways to specify: + + 1. deduced from the input file + +Linker Output Architecture +-------------------------- + + Ways to specify: + + 1. script command `OUTPUT_ARCH' (*note Option Commands: + (ld.info)Option Commands.) + + 2. the default architecture from the linker output target (*note + Target Selection::.) + + +File: binutils.info, Node: Linker Emulation Selection, Prev: Architecture Selection, Up: Selecting The Target System + +Linker emulation selection +========================== + + A linker "emulation" is a "personality" of the linker, which gives +the linker default values for the other aspects of the target system. +In particular, it consists of + + * the linker script + + * the target + + * several "hook" functions that are run at certain stages of the + linking process to do special things that some targets require + + The command to list valid linker emulation values is `ld -V'. + + Sample values: `hp300bsd', `mipslit', `sun4'. + + Ways to specify: + + 1. command line option: `-m' (*note Options: (ld.info)Options.) + + 2. environment variable `LDEMULATION' + + 3. compiled-in `DEFAULT_EMULATION' from `Makefile', which comes from + `EMUL' in `config/TARGET.mt' + + +File: binutils.info, Node: Reporting Bugs, Next: Index, Prev: Selecting The Target System, Up: Top + +Reporting Bugs +************** + + Your bug reports play an essential role in making the binary +utilities reliable. + + Reporting a bug may help you by bringing a solution to your problem, +or it may not. But in any case the principal function of a bug report +is to help the entire community by making the next version of the binary +utilities work better. Bug reports are your contribution to their +maintenance. + + In order for a bug report to serve its purpose, you must include the +information that enables us to fix the bug. + +* Menu: + +* Bug Criteria:: Have you found a bug? +* Bug Reporting:: How to report bugs + + +File: binutils.info, Node: Bug Criteria, Next: Bug Reporting, Up: Reporting Bugs + +Have you found a bug? +===================== + + If you are not sure whether you have found a bug, here are some +guidelines: + + * If a binary utility gets a fatal signal, for any input whatever, + that is a bug. Reliable utilities never crash. + + * If a binary utility produces an error message for valid input, + that is a bug. + + * If you are an experienced user of binary utilities, your + suggestions for improvement are welcome in any case. + + +File: binutils.info, Node: Bug Reporting, Prev: Bug Criteria, Up: Reporting Bugs + +How to report bugs +================== + + A number of companies and individuals offer support for GNU +products. If you obtained the binary utilities from a support +organization, we recommend you contact that organization first. + + You can find contact information for many support companies and +individuals in the file `etc/SERVICE' in the GNU Emacs distribution. + + In any event, we also recommend that you send bug reports for the +binary utilities to `bug-gnu-utils@prep.ai.mit.edu'. + + The fundamental principle of reporting bugs usefully is this: +*report all the facts*. If you are not sure whether to state a fact or +leave it out, state it! + + Often people omit facts because they think they know what causes the +problem and assume that some details do not matter. Thus, you might +assume that the name of a file you use in an example does not matter. +Well, probably it does not, but one cannot be sure. Perhaps the bug is +a stray memory reference which happens to fetch from the location where +that pathname is stored in memory; perhaps, if the pathname were +different, the contents of that location would fool the utility into +doing the right thing despite the bug. Play it safe and give a +specific, complete example. That is the easiest thing for you to do, +and the most helpful. + + Keep in mind that the purpose of a bug report is to enable us to fix +the bug if it is new to us. Therefore, always write your bug reports +on the assumption that the bug has not been reported previously. + + Sometimes people give a few sketchy facts and ask, "Does this ring a +bell?" Those bug reports are useless, and we urge everyone to *refuse +to respond to them* except to chide the sender to report bugs properly. + + To enable us to fix the bug, you should include all these things: + + * The version of the utility. Each utility announces it if you + start it with the `--version' argument. + + Without this, we will not know whether there is any point in + looking for the bug in the current version of the binary utilities. + + * Any patches you may have applied to the source, including any + patches made to the `BFD' library. + + * The type of machine you are using, and the operating system name + and version number. + + * What compiler (and its version) was used to compile the + utilities--e.g. "`gcc-2.7'". + + * The command arguments you gave the utility to observe the bug. To + guarantee you will not omit something important, list them all. A + copy of the Makefile (or the output from make) is sufficient. + + If we were to try to guess the arguments, we would probably guess + wrong and then we might not encounter the bug. + + * A complete input file, or set of input files, that will reproduce + the bug. If the utility is reading an object file or files, then + it is generally most helpful to send the actual object files, + uuencoded if necessary to get them through the mail system. + Making them available for anonymous FTP is not as good, but may be + the only reasonable choice for large object files. + + If the source files were produced exclusively using GNU programs + (e.g., `gcc', `gas', and/or the GNU `ld'), then it may be OK to + send the source files rather than the object files. In this case, + be sure to say exactly what version of `gcc', or whatever, was + used to produce the object files. Also say how `gcc', or + whatever, was configured. + + * A description of what behavior you observe that you believe is + incorrect. For example, "It gets a fatal signal." + + Of course, if the bug is that the utility gets a fatal signal, + then we will certainly notice it. But if the bug is incorrect + output, we might not notice unless it is glaringly wrong. You + might as well not give us a chance to make a mistake. + + Even if the problem you experience is a fatal signal, you should + still say so explicitly. Suppose something strange is going on, + such as, your copy of the utility is out of synch, or you have + encountered a bug in the C library on your system. (This has + happened!) Your copy might crash and ours would not. If you told + us to expect a crash, then when ours fails to crash, we would know + that the bug was not happening for us. If you had not told us to + expect a crash, then we would not be able to draw any conclusion + from our observations. + + * If you wish to suggest changes to the source, send us context + diffs, as generated by `diff' with the `-u', `-c', or `-p' option. + Always send diffs from the old file to the new file. If you even + discuss something in the `ld' source, refer to it by context, not + by line number. + + The line numbers in our development sources will not match those + in your sources. Your line numbers would convey no useful + information to us. + + Here are some things that are not necessary: + + * A description of the envelope of the bug. + + Often people who encounter a bug spend a lot of time investigating + which changes to the input file will make the bug go away and which + changes will not affect it. + + This is often time consuming and not very useful, because the way + we will find the bug is by running a single example under the + debugger with breakpoints, not by pure deduction from a series of + examples. We recommend that you save your time for something else. + + Of course, if you can find a simpler example to report *instead* + of the original one, that is a convenience for us. Errors in the + output will be easier to spot, running under the debugger will take + less time, and so on. + + However, simplification is not vital; if you do not want to do + this, report the bug anyway and send us the entire test case you + used. + + * A patch for the bug. + + A patch for the bug does help us if it is a good one. But do not + omit the necessary information, such as the test case, on the + assumption that a patch is all we need. We might see problems + with your patch and decide to fix the problem another way, or we + might not understand it at all. + + Sometimes with programs as complicated as the binary utilities it + is very hard to construct an example that will make the program + follow a certain path through the code. If you do not send us the + example, we will not be able to construct one, so we will not be + able to verify that the bug is fixed. + + And if we cannot understand what bug you are trying to fix, or why + your patch should be an improvement, we will not install it. A + test case will help us to understand. + + * A guess about what the bug is or what it depends on. + + Such guesses are usually wrong. Even we cannot guess right about + such things without first using the debugger to find the facts. + + +File: binutils.info, Node: Index, Prev: Reporting Bugs, Up: Top + +Index +***** + +* Menu: + +* .stab: objdump. +* ar compatibility: ar. +* nm compatibility: nm. +* nm format: nm. +* size display format: size. +* size number format: size. +* addr2line: addr2line. +* address to file name and line number: addr2line. +* all header information, object file: objdump. +* ar: ar. +* architecture: objdump. +* architectures available: objdump. +* archive contents: ranlib. +* archive headers: objdump. +* archives: ar. +* bug criteria: Bug Criteria. +* bug reports: Bug Reporting. +* bugs: Reporting Bugs. +* bugs, reporting: Bug Reporting. +* c++filt: c++filt. +* collections of files: ar. +* compatibility, ar: ar. +* contents of archive: ar cmdline. +* crash: Bug Criteria. +* creating archives: ar cmdline. +* dates in archive: ar cmdline. +* debug symbols: objdump. +* debugging symbols: nm. +* deleting from archive: ar cmdline. +* demangling C++ symbols: c++filt. +* demangling in nm: nm. +* demangling in objdump <1>: objdump. +* demangling in objdump: addr2line. +* disassembling object code: objdump. +* disassembly architecture: objdump. +* disassembly endianness: objdump. +* disassembly, with source: objdump. +* discarding symbols: strip. +* dynamic relocation entries, in object file: objdump. +* dynamic symbol table entries, printing: objdump. +* dynamic symbols: nm. +* ELF object file format: objdump. +* endianness: objdump. +* error on valid input: Bug Criteria. +* external symbols: nm. +* extract from archive: ar cmdline. +* fatal signal: Bug Criteria. +* file name: nm. +* header information, all: objdump. +* input file name: nm. +* libraries: ar. +* listings strings: strings. +* machine instructions: objdump. +* moving in archive: ar cmdline. +* MRI compatibility, ar: ar scripts. +* name duplication in archive: ar cmdline. +* name length: ar. +* nm: nm. +* objdump: objdump. +* object code format <1>: objdump. +* object code format <2>: strings. +* object code format <3>: nm. +* object code format <4>: size. +* object code format: addr2line. +* object file header: objdump. +* object file information: objdump. +* object file sections: objdump. +* object formats available: objdump. +* operations on archive: ar cmdline. +* printing from archive: ar cmdline. +* printing strings: strings. +* quick append to archive: ar cmdline. +* radix for section sizes: size. +* ranlib: ranlib. +* relative placement in archive: ar cmdline. +* relocation entries, in object file: objdump. +* removing symbols: strip. +* repeated names in archive: ar cmdline. +* replacement in archive: ar cmdline. +* reporting bugs: Reporting Bugs. +* scripts, ar: ar scripts. +* section addresses in objdump: objdump. +* section headers: objdump. +* section information: objdump. +* section sizes: size. +* sections, full contents: objdump. +* size: size. +* sorting symbols: nm. +* source disassembly: objdump. +* source file name: nm. +* source filenames for object files: objdump. +* stab: objdump. +* start-address: objdump. +* stop-address: objdump. +* strings: strings. +* strings, printing: strings. +* strip: strip. +* symbol index <1>: ranlib. +* symbol index: ar. +* symbol index, listing: nm. +* symbol line numbers: nm. +* symbol table entries, printing: objdump. +* symbols: nm. +* symbols, discarding: strip. +* undefined symbols: nm. +* Unix compatibility, ar: ar cmdline. +* updating an archive: ar cmdline. +* version: Top. +* VMA in objdump: objdump. +* wide output, printing: objdump. +* writing archive index: ar cmdline. + + diff -urN binutils-2.7/binutils/binutils.texi binutils-2.8/binutils/binutils.texi --- binutils-2.7/binutils/binutils.texi Thu Jul 4 12:23:26 1996 +++ binutils-2.8/binutils/binutils.texi Wed Apr 30 12:59:05 1997 @@ -13,7 +13,7 @@ @end ifinfo @ifinfo -Copyright @copyright{} 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -41,7 +41,7 @@ @c This file documents the GNU binary utilities "ar", "ld", "objcopy", @c "objdump", "nm", "size", "strings", "strip", and "ranlib". @c -@c Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +@c Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. @c @c This text may be freely distributed under the terms of the GNU @c General Public License. @@ -66,7 +66,7 @@ @end tex @vskip 0pt plus 1filll -Copyright @copyright{} 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -117,6 +117,9 @@ @item c++filt Demangle encoded C++ symbols +@item addr2line +Convert addresses into file names and line numbers + @item nlmconv Convert object code into a Netware Loadable Module @end table @@ -132,9 +135,11 @@ * strings:: List printable strings from files * strip:: Discard symbols * c++filt:: Filter to demangle encoded C++ symbols +* addr2line:: Convert addresses to file and line * nlmconv:: Converts object code into an NLM * Selecting The Target System:: How these utilities determine the target. -* Index:: +* Reporting Bugs:: Reporting Bugs +* Index:: Index @end menu @node ar @@ -692,7 +697,7 @@ @item -C @itemx --demangle -@cindex demangling C++ symbols +@cindex demangling in nm Decode (@dfn{demangle}) low-level symbol names into user-level names. Besides removing any initial underscore prepended by the system, this makes C++ function names readable. @xref{c++filt}, for more information @@ -808,7 +813,7 @@ [ -b @var{byte} | --byte=@var{byte} ] [ -i @var{interleave} | --interleave=@var{interleave} ] [ -R @var{sectionname} | --remove-section=@var{sectionname} ] - [ --debugging ] + [ -p | --preserve-dates ] [ --debugging ] [ --gap-fill=@var{val} ] [ --pad-to=@var{address} ] [ --set-start=@var{val} ] [ --adjust-start=@var{incr} ] [ --adjust-vma=@var{incr} ] @@ -816,7 +821,8 @@ [ --adjust-warnings ] [ --no-adjust-warnings ] [ --set-section-flags=@var{section}=@var{flags} ] [ --add-section=@var{sectionname}=@var{filename} ] - [ --remove-leading-char ] + [ --change-leading-char ] [ --remove-leading-char ] + [ --weaken ] [ -v | --verbose ] [ -V | --version ] [ --help ] @var{infile} [@var{outfile}] @end smallexample @@ -926,6 +932,11 @@ @code{objcopy} ignores this option if you do not specify either @samp{-b} or @samp{--byte}. +@item -p +@itemx --preserve-dates +Set the access and modification dates of the output file to be the same +as those of the input file. + @item --debugging Convert debugging information, if possible. This is not the default because only certain debugging formats are supported, and the @@ -986,13 +997,32 @@ size of the section will be the size of the file. This option only works on file formats which can support sections with arbitrary names. +@item --change-leading-char +Some object file formats use special characters at the start of +symbols. The most common such character is underscore, which compilers +often add before every symbol. This option tells @code{objcopy} to +change the leading character of every symbol when it converts between +object file formats. If the object file formats use the same leading +character, this option has no effect. Otherwise, it will add a +character, or remove a character, or change a character, as +appropriate. + @item --remove-leading-char If the first character of a global symbol is a special symbol leading character used by the object file format, remove the character. The most common symbol leading character is underscore. This option will remove a leading underscore from all global symbols. This can be useful if you want to link together objects of different file formats with -different conventions for symbol names. +different conventions for symbol names. This is different from +@code{--change-leading-char} because it always changes the symbol name +when appropriate, regardless of the object file format of the output +file. + +@item --weaken +Change all global symbols in the file to be weak. This can be useful +when building an object which will be linked against other objects using +the @code{-R} option to the linker. This option is only effective when +using an object file format which supports weak symbols. @item -V @itemx --version @@ -1016,7 +1046,8 @@ @smallexample objdump [ -a | --archive-headers ] [ -b @var{bfdname} | --target=@var{bfdname} ] [ --debugging ] - [ -d | --disassemble ] [ -D | --disassemble-all ] + [ -C | --demangle ] [ -d | --disassemble ] + [ -D | --disassemble-all ] [ --disassemble-zeroes ] [ -EB | -EL | --endian=@{big | little @} ] [ -f | --file-headers ] [ -h | --section-headers | --headers ] [ -i | --info ] @@ -1027,7 +1058,9 @@ [ -s | --full-contents ] [ --stabs ] [ -t | --syms ] [ -T | --dynamic-syms ] [ -x | --all-headers ] [ -w | --wide ] [ --start-address=@var{address} ] - [ --stop-address=@var{address} ] [ --show-raw-insn ] + [ --stop-address=@var{address} ] + [ --prefix-addresses] [ --[no-]show-raw-insn ] + [ --adjust-vma=@var{offset} ] [ --version ] [ --help ] @var{objfile}@dots{} @end smallexample @@ -1054,6 +1087,15 @@ information you could list with @samp{ar tv}, @samp{objdump -a} shows the object file format of each archive member. +@item --adjust-vma=@var{offset} +@cindex section addresses in objdump +@cindex VMA in objdump +When dumping information, first add @var{offset} to all the section +addresses. This is useful if the section addresses do not correspond to +the symbol table, which can happen when putting sections at particular +addresses when using a format which can not represent section addresses, +such as a.out. + @item -b @var{bfdname} @itemx --target=@var{bfdname} @cindex object code format @@ -1072,6 +1114,14 @@ formats available with the @samp{-i} option. @xref{Target Selection}, for more information. +@item -C +@itemx --demangle +@cindex demangling in objdump +Decode (@dfn{demangle}) low-level symbol names into user-level names. +Besides removing any initial underscore prepended by the system, this +makes C++ function names readable. @xref{c++filt}, for more information +on demangling. + @item --debugging Display debugging information. This attempts to parse debugging information stored in the file and print it out using a C like syntax. @@ -1090,6 +1140,15 @@ Like @samp{-d}, but disassemble the contents of all sections, not just those expected to contain instructions. +@item --prefix-addresses +When disassembling, print the complete address on each line. This is +the older disassembly format. + +@item --disassemble-zeroes +Normally the disassembly output will skip blocks of zeroes. This +option directs the disassembler to disassemble those blocks, just like +any other data. + @item -EB @itemx -EL @itemx --endian=@{big|little@} @@ -1181,7 +1240,12 @@ @item --show-raw-insn When disassembling instructions, print the instruction in hex as well as -in symbolic form. Not all targets handle this correctly yet. +in symbolic form. This is the default except when +@code{--prefix-addresses} is used. + +@item --no-show-raw-insn +When disassembling instructions, do not print the instruction bytes. +This is the default when @code{--prefix-addresses} is used. @item --stabs @cindex stab @@ -1446,7 +1510,7 @@ [ -N @var{symbolname} | --strip-symbol=@var{symbolname} ] [ -x | --discard-all ] [ -X | --discard-locals ] [ -R @var{sectionname} | --remove-section=@var{sectionname} ] - [ -o @var{file} ] + [ -o @var{file} ] [ -p | --preserve-dates ] [ -v | --verbose ] [ -V | --version ] [ --help ] @var{objfile}@dots{} @end smallexample @@ -1513,6 +1577,10 @@ existing file. When this argument is used, only one @var{objfile} argument may be specified. +@item -p +@itemx --preserve-dates +Preserve the access and modification dates of the file. + @item -x @itemx --discard-all Remove non-global symbols. @@ -1620,6 +1688,82 @@ @end example @end quotation +@node addr2line +@chapter addr2line + +@kindex addr2line +@cindex address to file name and line number + +@smallexample +addr2line [ -b @var{bfdname} | --target=@var{bfdname} ] + [ -C | --demangle ] + [ -e @var{filename} | --exe=@var{filename} ] + [ -f | --functions ] [ -s | --basename ] + [ -H | --help ] [ -V | --version ] + [ addr addr ... ] +@end smallexample + +@code{addr2line} translates program addresses into file names and line +numbers. Given an address and an executable, it uses the debugging +information in the executable to figure out which file name and line +number are associated with a given address. + +The executable to use is specified with the @code{-e} option. The +default is @file{a.out}. + +@code{addr2line} has two modes of operation. + +In the first, hexadecimal addresses are specified on the command line, +and @code{addr2line} displays the file name and line number for each +address. + +In the second, @code{addr2line} reads hexadecimal addresses from +standard input, and prints the file name and line number for each +address on standard output. In this mode, @code{addr2line} may be used +in a pipe to convert dynamically chosen addresses. + +The format of the output is @samp{FILENAME:LINENO}. The file name and +line number for each address is printed on a separate line. If the +@code{-f} option is used, then each @samp{FILENAME:LINENO} line is +preceded by a @samp{FUNCTIONNAME} line which is the name of the function +containing the address. + +If the file name or function name can not be determined, +@code{addr2line} will print two question marks in their place. If the +line number can not be determined, @code{addr2line} will print 0. + +The long and short forms of options, shown here as alternatives, are +equivalent. + +@table @code +@item -b @var{bfdname} +@itemx --target=@var{bfdname} +@cindex object code format +Specify that the object-code format for the object files is +@var{bfdname}. + +@item -C +@itemx --demangle +@cindex demangling in objdump +Decode (@dfn{demangle}) low-level symbol names into user-level names. +Besides removing any initial underscore prepended by the system, this +makes C++ function names readable. @xref{c++filt}, for more information +on demangling. + +@item -e @var{filename} +@itemx --exe=@var{filename} +Specify the name of the executable for which addresses should be +translated. The default file is @file{a.out}. + +@item -f +@itemx --functions +Display function names as well as file and line number information. + +@item -s +@itemx --basenames +Display only the base of each file name. +@end table + @node nlmconv @chapter nlmconv @@ -1753,6 +1897,16 @@ Some sample values are: @samp{a.out-hp300bsd}, @samp{ecoff-littlemips}, @samp{a.out-sunos-big}. +You can also specify a target using a configuration triplet. This is +the same sort of name that is passed to configure to specify a target. +When you use a configuration triplet as an argument, it must be fully +canonicalized. You can see the canonical version of a triplet by +running the shell script @file{config.sub} which is included with the +sources. + +Some sample configuration triplets are: @samp{m68k-hp-bsd}, +@samp{mips-dec-ultrix}, @samp{sparc-sun-sunos}. + @subheading @code{objdump} Target Ways to specify: @@ -1948,6 +2102,213 @@ compiled-in @code{DEFAULT_EMULATION} from @file{Makefile}, which comes from @code{EMUL} in @file{config/@var{target}.mt} @end enumerate + +@node Reporting Bugs +@chapter Reporting Bugs +@cindex bugs +@cindex reporting bugs + +Your bug reports play an essential role in making the binary utilities +reliable. + +Reporting a bug may help you by bringing a solution to your problem, or +it may not. But in any case the principal function of a bug report is +to help the entire community by making the next version of the binary +utilities work better. Bug reports are your contribution to their +maintenance. + +In order for a bug report to serve its purpose, you must include the +information that enables us to fix the bug. + +@menu +* Bug Criteria:: Have you found a bug? +* Bug Reporting:: How to report bugs +@end menu + +@node Bug Criteria +@section Have you found a bug? +@cindex bug criteria + +If you are not sure whether you have found a bug, here are some guidelines: + +@itemize @bullet +@cindex fatal signal +@cindex crash +@item +If a binary utility gets a fatal signal, for any input whatever, that is +a bug. Reliable utilities never crash. + +@cindex error on valid input +@item +If a binary utility produces an error message for valid input, that is a +bug. + +@item +If you are an experienced user of binary utilities, your suggestions for +improvement are welcome in any case. +@end itemize + +@node Bug Reporting +@section How to report bugs +@cindex bug reports +@cindex bugs, reporting + +A number of companies and individuals offer support for @sc{gnu} +products. If you obtained the binary utilities from a support +organization, we recommend you contact that organization first. + +You can find contact information for many support companies and +individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs +distribution. + +In any event, we also recommend that you send bug reports for the binary +utilities to @samp{bug-gnu-utils@@prep.ai.mit.edu}. + +The fundamental principle of reporting bugs usefully is this: +@strong{report all the facts}. If you are not sure whether to state a +fact or leave it out, state it! + +Often people omit facts because they think they know what causes the +problem and assume that some details do not matter. Thus, you might +assume that the name of a file you use in an example does not matter. +Well, probably it does not, but one cannot be sure. Perhaps the bug is +a stray memory reference which happens to fetch from the location where +that pathname is stored in memory; perhaps, if the pathname were +different, the contents of that location would fool the utility into +doing the right thing despite the bug. Play it safe and give a +specific, complete example. That is the easiest thing for you to do, +and the most helpful. + +Keep in mind that the purpose of a bug report is to enable us to fix the bug if +it is new to us. Therefore, always write your bug reports on the assumption +that the bug has not been reported previously. + +Sometimes people give a few sketchy facts and ask, ``Does this ring a +bell?'' Those bug reports are useless, and we urge everyone to +@emph{refuse to respond to them} except to chide the sender to report +bugs properly. + +To enable us to fix the bug, you should include all these things: + +@itemize @bullet +@item +The version of the utility. Each utility announces it if you start it +with the @samp{--version} argument. + +Without this, we will not know whether there is any point in looking for +the bug in the current version of the binary utilities. + +@item +Any patches you may have applied to the source, including any patches +made to the @code{BFD} library. + +@item +The type of machine you are using, and the operating system name and +version number. + +@item +What compiler (and its version) was used to compile the utilities---e.g. +``@code{gcc-2.7}''. + +@item +The command arguments you gave the utility to observe the bug. To +guarantee you will not omit something important, list them all. A copy +of the Makefile (or the output from make) is sufficient. + +If we were to try to guess the arguments, we would probably guess wrong +and then we might not encounter the bug. + +@item +A complete input file, or set of input files, that will reproduce the +bug. If the utility is reading an object file or files, then it is +generally most helpful to send the actual object files, uuencoded if +necessary to get them through the mail system. Making them available +for anonymous FTP is not as good, but may be the only reasonable choice +for large object files. + +If the source files were produced exclusively using @sc{gnu} programs +(e.g., @code{gcc}, @code{gas}, and/or the @sc{gnu} @code{ld}), then it +may be OK to send the source files rather than the object files. In +this case, be sure to say exactly what version of @code{gcc}, or +whatever, was used to produce the object files. Also say how +@code{gcc}, or whatever, was configured. + +@item +A description of what behavior you observe that you believe is +incorrect. For example, ``It gets a fatal signal.'' + +Of course, if the bug is that the utility gets a fatal signal, then we +will certainly notice it. But if the bug is incorrect output, we might +not notice unless it is glaringly wrong. You might as well not give us +a chance to make a mistake. + +Even if the problem you experience is a fatal signal, you should still +say so explicitly. Suppose something strange is going on, such as, your +copy of the utility is out of synch, or you have encountered a bug in +the C library on your system. (This has happened!) Your copy might +crash and ours would not. If you told us to expect a crash, then when +ours fails to crash, we would know that the bug was not happening for +us. If you had not told us to expect a crash, then we would not be able +to draw any conclusion from our observations. + +@item +If you wish to suggest changes to the source, send us context diffs, as +generated by @code{diff} with the @samp{-u}, @samp{-c}, or @samp{-p} +option. Always send diffs from the old file to the new file. If you +even discuss something in the @code{ld} source, refer to it by context, +not by line number. + +The line numbers in our development sources will not match those in your +sources. Your line numbers would convey no useful information to us. +@end itemize + +Here are some things that are not necessary: + +@itemize @bullet +@item +A description of the envelope of the bug. + +Often people who encounter a bug spend a lot of time investigating +which changes to the input file will make the bug go away and which +changes will not affect it. + +This is often time consuming and not very useful, because the way we +will find the bug is by running a single example under the debugger +with breakpoints, not by pure deduction from a series of examples. +We recommend that you save your time for something else. + +Of course, if you can find a simpler example to report @emph{instead} +of the original one, that is a convenience for us. Errors in the +output will be easier to spot, running under the debugger will take +less time, and so on. + +However, simplification is not vital; if you do not want to do this, +report the bug anyway and send us the entire test case you used. + +@item +A patch for the bug. + +A patch for the bug does help us if it is a good one. But do not omit +the necessary information, such as the test case, on the assumption that +a patch is all we need. We might see problems with your patch and decide +to fix the problem another way, or we might not understand it at all. + +Sometimes with programs as complicated as the binary utilities it is +very hard to construct an example that will make the program follow a +certain path through the code. If you do not send us the example, we +will not be able to construct one, so we will not be able to verify that +the bug is fixed. + +And if we cannot understand what bug you are trying to fix, or why your +patch should be an improvement, we will not install it. A test case will +help us to understand. + +@item +A guess about what the bug is or what it depends on. + +Such guesses are usually wrong. Even we cannot guess right about such +things without first using the debugger to find the facts. +@end itemize @node Index @unnumbered Index diff -urN binutils-2.7/binutils/bucomm.c binutils-2.8/binutils/bucomm.c --- binutils-2.7/binutils/bucomm.c Thu Jul 4 12:23:26 1996 +++ binutils-2.8/binutils/bucomm.c Wed Apr 30 12:59:05 1997 @@ -1,5 +1,5 @@ /* bucomm.c -- Bin Utils COMmon code. - Copyright (C) 1991, 92, 93, 94 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -15,7 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* We might put this in a library someday so it could be dynamically loaded, but for now it's not necessary. */ @@ -96,9 +97,30 @@ } #endif +/* Set the default BFD target based on the configured target. Doing + this permits the binutils to be configured for a particular target, + and linked against a shared BFD library which was configured for a + different target. */ + +void +set_default_bfd_target () +{ + /* The macro TARGET is defined by Makefile. */ + const char *target = TARGET; + + if (! bfd_set_default_target (target)) + { + char *errmsg; + + errmsg = (char *) xmalloc (100 + strlen (target)); + sprintf (errmsg, "can't set BFD default target to `%s'", target); + bfd_fatal (errmsg); + } +} + /* After a false return from bfd_check_format_matches with - bfd_get_error () == bfd_error_file_ambiguously_recognized, print the possible - matching targets. */ + bfd_get_error () == bfd_error_file_ambiguously_recognized, print + the possible matching targets. */ void list_matching_formats (p) diff -urN binutils-2.7/binutils/bucomm.h binutils-2.8/binutils/bucomm.h --- binutils-2.7/binutils/bucomm.h Thu Jul 4 12:23:27 1996 +++ binutils-2.8/binutils/bucomm.h Wed Apr 30 12:59:05 1997 @@ -1,5 +1,5 @@ /* bucomm.h -- binutils common include file. - Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -49,7 +49,6 @@ #else extern char *strchr (); extern char *strrchr (); -extern char *strstr (); #endif #endif @@ -65,6 +64,20 @@ #endif #endif +#ifdef NEED_DECLARATION_STRSTR +extern char *strstr (); +#endif + +#ifdef HAVE_SBRK +#ifdef NEED_DECLARATION_SBRK +extern char *sbrk (); +#endif +#endif + +#ifdef NEED_DECLARATION_GETENV +extern char *getenv (); +#endif + #ifndef O_RDONLY #define O_RDONLY 0 #endif @@ -83,6 +96,23 @@ #define SEEK_END 2 #endif +#ifdef __GNUC__ +# undef alloca +# define alloca __builtin_alloca +#else +# if HAVE_ALLOCA_H +# include +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +# if !defined (__STDC__) && !defined (__hpux) +char *alloca (); +# else +void *alloca (); +# endif /* __STDC__, __hpux */ +# endif /* alloca */ +# endif /* HAVE_ALLOCA_H */ +#endif + /* bucomm.c */ void bfd_nonfatal PARAMS ((CONST char *)); @@ -90,6 +120,8 @@ void fatal PARAMS ((CONST char *, ...)); +void set_default_bfd_target PARAMS ((void)); + void list_matching_formats PARAMS ((char **p)); void list_supported_targets PARAMS ((const char *, FILE *)); @@ -104,6 +136,9 @@ /* filemode.c */ void mode_string PARAMS ((unsigned long mode, char *buf)); + +/* version.c */ +extern void print_version PARAMS ((const char *)); /* libiberty */ PTR xmalloc PARAMS ((size_t)); diff -urN binutils-2.7/binutils/coffgrok.c binutils-2.8/binutils/coffgrok.c --- binutils-2.7/binutils/coffgrok.c Thu Jul 4 12:23:27 1996 +++ binutils-2.8/binutils/coffgrok.c Wed Apr 30 12:59:06 1997 @@ -1,8 +1,5 @@ - - /* coffgrok.c - - Copyright (C) 1994 Free Software Foundation, Inc. + Copyright (C) 1994, 95, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -189,8 +186,8 @@ int i; { struct internal_syment *sym = &rawsyms[i].u.syment; - struct coff_where *where - = (struct coff_where *) (malloc (sizeof (struct coff_where))); + struct coff_where *where = + (struct coff_where *) (xmalloc (sizeof (struct coff_where))); where->offset = sym->n_value; if (sym->n_scnum == -1) @@ -298,7 +295,8 @@ { struct internal_syment *sym = &rawsyms[i].u.syment; union internal_auxent *aux = &rawsyms[i + 1].u.auxent; - struct coff_type *res = (struct coff_type *) malloc (sizeof (struct coff_type)); + struct coff_type *res = + (struct coff_type *) xmalloc (sizeof (struct coff_type)); int type = sym->n_type; int which_dt = 0; int dimind = 0; @@ -417,7 +415,7 @@ case DT_ARY: { struct coff_type *ptr = ((struct coff_type *) - malloc (sizeof (struct coff_type))); + xmalloc (sizeof (struct coff_type))); int els = (dimind < DIMNUM ? aux->x_sym.x_fcnary.x_ary.x_dimen[dimind] : 0); @@ -431,7 +429,8 @@ } case DT_PTR: { - struct coff_type *ptr = (struct coff_type *) malloc (sizeof (struct coff_type)); + struct coff_type *ptr = + (struct coff_type *) xmalloc (sizeof (struct coff_type)); ptr->size = PTR_SIZE; ptr->type = coff_pointer_type; ptr->u.pointer.points_to = res; @@ -440,7 +439,8 @@ } case DT_FCN: { - struct coff_type *ptr = (struct coff_type *) malloc (sizeof (struct coff_type)); + struct coff_type *ptr + = (struct coff_type *) xmalloc (sizeof (struct coff_type)); ptr->size = 0; ptr->type = coff_function_type; ptr->u.function.function_returns = res; @@ -461,7 +461,8 @@ int i; { struct internal_syment *sym = &rawsyms[i].u.syment; - struct coff_visible *visible = (struct coff_visible *) (malloc (sizeof (struct coff_visible))); + struct coff_visible *visible = + (struct coff_visible *) (xmalloc (sizeof (struct coff_visible))); enum coff_vis_type t; switch (sym->n_sclass) { @@ -606,7 +607,8 @@ case C_FILE: { /* new source file announced */ - struct coff_sfile *n = (struct coff_sfile *) malloc (sizeof (struct coff_sfile)); + struct coff_sfile *n = + (struct coff_sfile *) xmalloc (sizeof (struct coff_sfile)); n->section = (struct coff_isection *) xcalloc (sizeof (struct coff_isection), abfd->section_count + 1); cur_sfile = n; n->name = sym->_n._n_nptr[1]; diff -urN binutils-2.7/binutils/config.h-vms binutils-2.8/binutils/config.h-vms --- binutils-2.7/binutils/config.h-vms Thu Jul 4 12:23:27 1996 +++ binutils-2.8/binutils/config.h-vms Wed Dec 31 19:00:00 1969 @@ -1,46 +0,0 @@ -/* config.h. Generated automatically by configure. */ -/* config.in. Generated automatically from configure.in by autoheader. */ - -/* Is the type time_t defined in ? */ -#define HAVE_TIME_T_IN_TIME_H 1 - -/* Is the type time_t defined in ? */ -#define HAVE_TIME_T_IN_TYPES_H 1 - -/* Does define struct utimbuf? */ -#define HAVE_GOOD_UTIME_H 1 - -/* Whether fprintf must be declared even if is included. */ -#define NEED_DECLARATION_FPRINTF 1 - -/* Do we need to use the b modifier when opening binary files? */ -/* #undef USE_BINARY_FOPEN */ - -/* Define if you have the sbrk function. */ -/* #undef HAVE_SBRK */ - -/* Define if you have the utimes function. */ -#define HAVE_UTIMES 1 - -/* Define if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_FILE_H 1 - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 - -#if __GNUC__ -#define _bfd_generic_get_section_contents_in_window _bfd_generic_get_win_section_cont -#define _elf_section_from_bfd_section _bfd_elf_sec_from_bfd_sec -#endif diff -urN binutils-2.7/binutils/config.in binutils-2.8/binutils/config.in --- binutils-2.7/binutils/config.in Thu Jul 4 12:23:27 1996 +++ binutils-2.8/binutils/config.in Wed Apr 30 12:59:06 1997 @@ -1,8 +1,30 @@ /* config.in. Generated automatically from configure.in by autoheader. */ +/* Whether strstr must be declared even if is included. */ +#undef NEED_DECLARATION_STRSTR + /* Whether fprintf must be declared even if is included. */ #undef NEED_DECLARATION_FPRINTF +/* Whether sbrk must be declared even if is included. */ +#undef NEED_DECLARATION_SBRK + +/* Whether getenv must be declared even if is included. */ +#undef NEED_DECLARATION_GETENV + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END + +/* Define if you have alloca, 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 that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H @@ -11,6 +33,15 @@ /* Define to `int' if doesn't define. */ #undef pid_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 diff -urN binutils-2.7/binutils/config.texi binutils-2.8/binutils/config.texi --- binutils-2.7/binutils/config.texi Mon Jul 15 15:14:11 1996 +++ binutils-2.8/binutils/config.texi Wed Apr 30 13:12:43 1997 @@ -1 +1 @@ -@set VERSION 2.7 +@set VERSION 2.8 diff -urN binutils-2.7/binutils/configure binutils-2.8/binutils/configure --- binutils-2.7/binutils/configure Thu Jul 4 12:23:29 1996 +++ binutils-2.8/binutils/configure Wed Apr 30 12:59:07 1997 @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.10 +# Generated automatically using autoconf version 2.12 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -15,6 +15,8 @@ --enable-targets alternative target configurations" ac_help="$ac_help --enable-shared build shared BFD library" +ac_help="$ac_help + --enable-commonbfdlib build shared BFD/opcodes/libiberty library" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -53,6 +55,8 @@ # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 ac_prev= for ac_option @@ -334,7 +338,7 @@ verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.10" + echo "configure generated by autoconf version 2.12" exit 0 ;; -with-* | --with-*) @@ -436,11 +440,14 @@ done # NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# 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 @@ -502,6 +509,7 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. @@ -540,6 +548,15 @@ *) shared=false ;; esac fi +# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. +if test "${enable_commonbfdlib+set}" = set; then + enableval="$enable_commonbfdlib" + case "${enableval}" in + yes) commonbfdlib=true ;; + no) commonbfdlib=false ;; + *) { echo "configure: error: bad value ${enableval} for BFD commonbfdlib option" 1>&2; exit 1; } ;; +esac +fi @@ -590,6 +607,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:611: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -604,12 +622,13 @@ esac host=`$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/'` +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:632: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -621,12 +640,13 @@ esac target=`$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/'` +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:650: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -638,9 +658,9 @@ esac build=`$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/'` +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" && @@ -678,11 +698,13 @@ HDEFINES= HLDFLAGS= +HLDENV= RPATH_ENVVAR=LD_LIBRARY_PATH # 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:708: 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 @@ -711,6 +733,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:737: 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 @@ -757,7 +780,47 @@ 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:785: 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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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* + +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:819: 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:824: 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 @@ -766,7 +829,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:770: \"$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:833: \"$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 @@ -774,29 +837,34 @@ fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + if test $ac_cv_prog_gcc = yes; then GCC=yes - if test "${CFLAGS+set}" != set; then - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + 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:848: 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_gcc_g=yes + ac_cv_prog_cc_g=yes else - ac_cv_prog_gcc_g=no + ac_cv_prog_cc_g=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 - if test $ac_cv_prog_gcc_g = yes; then - CFLAGS="-g -O" - else - CFLAGS="-O" - 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 + CFLAGS="-g -O2" + else + CFLAGS="-O2" fi else GCC= @@ -809,11 +877,13 @@ + 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:887: 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 @@ -850,11 +920,12 @@ # 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:924: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in @@ -877,7 +948,7 @@ ;; esac done - IFS="$ac_save_ifs" + IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then @@ -904,6 +975,7 @@ # need to handle some hosts specially. BFDLIB='-L../bfd -lbfd' OPCODES='-L../opcodes -lopcodes' + case "${host}" in *-*-sunos*) # On SunOS, we must link against the name we are going to install, @@ -932,33 +1004,14 @@ ;; esac +if test "${commonbfdlib}" = "true"; then + # when a shared libbfd is built with --enable-commonbfdlib, + # all of libopcodes is available in libbfd.so + OPCODES= +fi -# If we cannot run a trivial program, we must be cross compiling. -echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_c_cross=yes -else -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } -if test -s conftest && (./conftest; exit) 2>/dev/null; then - ac_cv_c_cross=no -else - ac_cv_c_cross=yes -fi -fi -rm -fr conftest* -fi -echo "$ac_t""$ac_cv_c_cross" 1>&6 -cross_compiling=$ac_cv_c_cross # Put a plausible default for CC_FOR_BUILD in Makefile. if test -z "$CC_FOR_BUILD"; then @@ -971,6 +1024,7 @@ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1028: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -985,33 +1039,37 @@ # 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:995: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1049: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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:1010: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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 @@ -1028,24 +1086,27 @@ for ac_hdr in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h do -ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1092: 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:1043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1102: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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 @@ -1053,7 +1114,7 @@ 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 | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 +echo "configure:1129: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1078,22 +1140,22 @@ #ifndef WIFEXITED #define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif -int main() { return 0; } -int t() { +int main() { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_sys_wait_h=no fi rm -f conftest* - fi echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 @@ -1104,14 +1166,244 @@ 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:1173: 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:1185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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:1206: 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 < +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +int main() { +char *p = (char *) alloca(1); +; return 0; } +EOF +if { (eval echo configure:1234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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.o + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + + +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:1266: 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:1296: 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:1324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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:1351: 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:1378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./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:1402: 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; }; then +if { (eval echo configure:1430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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'` @@ -1157,12 +1450,14 @@ fi done -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +if test "x$cross_compiling" = "xno"; then + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1456: 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 @@ -1170,13 +1465,15 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1469: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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 @@ -1185,7 +1482,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1203,7 +1500,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1223,8 +1520,8 @@ if test "$cross_compiling" = yes; then : else -cat > conftest.$ac_ext < conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1235,15 +1532,19 @@ exit (0); } EOF -{ (eval echo configure:1239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } -if test -s conftest && (./conftest; exit) 2>/dev/null; then +if { (eval echo configure:1536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./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 -fi rm -fr conftest* fi + +fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 @@ -1255,19 +1556,21 @@ fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:1560: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include +#include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "pid_t" >/dev/null 2>&1; then + egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_pid_t=yes else @@ -1285,24 +1588,27 @@ fi -ac_safe=`echo "vfork.h" | tr './\055' '___'` +ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 +echo "configure:1594: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1300: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1604: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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 @@ -1319,16 +1625,18 @@ fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then +echo "configure:1629: checking for working vfork" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 +echo "configure:1635: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_vfork=no" fi rm -f conftest* - fi + if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then echo "$ac_t""yes" 1>&6 : @@ -1370,8 +1679,8 @@ fi else -cat > conftest.$ac_ext < conftest.$ac_ext < @@ -1399,8 +1708,10 @@ static pid_t child; if (!child) { child = vfork (); - if (child < 0) + if (child < 0) { perror ("vfork"); + _exit(2); + } if (!child) { arg = getpid(); write(-1, "", 0); @@ -1464,47 +1775,106 @@ } } EOF -{ (eval echo configure:1468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } -if test -s conftest && (./conftest; exit) 2>/dev/null; then - ac_cv_func_vfork=yes -else - ac_cv_func_vfork=no -fi +if { (eval echo configure:1779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_func_vfork_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_vfork_works=no fi rm -fr conftest* fi -echo "$ac_t""$ac_cv_func_vfork" 1>&6 -if test $ac_cv_func_vfork = no; then +fi + +echo "$ac_t""$ac_cv_func_vfork_works" 1>&6 +if test $ac_cv_func_vfork_works = no; then cat >> confdefs.h <<\EOF #define vfork fork EOF fi +else + echo $ac_n "checking for vfork""... $ac_c" 1>&6 +echo "configure:1803: checking for vfork" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* 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 vfork(); + +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_vfork) || defined (__stub___vfork) +choke me +#else +vfork(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_vfork=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vfork=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define vfork fork +EOF + +fi + +fi echo $ac_n "checking for time_t in time.h""... $ac_c" 1>&6 +echo "configure:1857: checking for time_t in time.h" >&5 if eval "test \"`echo '$''{'bu_cv_decl_time_t_time_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < -int main() { return 0; } -int t() { +int main() { time_t i; ; return 0; } EOF -if { (eval echo configure:1500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_decl_time_t_time_h=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* bu_cv_decl_time_t_time_h=no fi rm -f conftest* - fi echo "$ac_t""$bu_cv_decl_time_t_time_h" 1>&6 @@ -1516,27 +1886,28 @@ fi echo $ac_n "checking for time_t in sys/types.h""... $ac_c" 1>&6 +echo "configure:1890: checking for time_t in sys/types.h" >&5 if eval "test \"`echo '$''{'bu_cv_decl_time_t_types_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < -int main() { return 0; } -int t() { +int main() { time_t i; ; return 0; } EOF -if { (eval echo configure:1532: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1902: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_decl_time_t_types_h=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* bu_cv_decl_time_t_types_h=no fi rm -f conftest* - fi echo "$ac_t""$bu_cv_decl_time_t_types_h" 1>&6 @@ -1550,31 +1921,32 @@ # Under Next 3.2 apparently does not define struct utimbuf # by default. echo $ac_n "checking for utime.h""... $ac_c" 1>&6 +echo "configure:1925: checking for utime.h" >&5 if eval "test \"`echo '$''{'bu_cv_header_utime_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifdef HAVE_TIME_H #include #endif #include -int main() { return 0; } -int t() { +int main() { struct utimbuf s; ; return 0; } EOF -if { (eval echo configure:1570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_header_utime_h=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* bu_cv_header_utime_h=no fi rm -f conftest* - fi echo "$ac_t""$bu_cv_header_utime_h" 1>&6 @@ -1586,34 +1958,42 @@ fi echo $ac_n "checking whether fprintf must be declared""... $ac_c" 1>&6 +echo "configure:1962: checking whether fprintf must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_fprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif -int main() { return 0; } -int t() { +int main() { char *(*pfn) = (char *(*)) fprintf ; return 0; } EOF -if { (eval echo configure:1609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_fprintf=no else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* bfd_cv_decl_needed_fprintf=yes fi rm -f conftest* - fi echo "$ac_t""$bfd_cv_decl_needed_fprintf" 1>&6 @@ -1625,10 +2005,154 @@ fi +echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 +echo "configure:2010: 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 < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { +char *(*pfn) = (char *(*)) strstr +; return 0; } +EOF +if { (eval echo configure:2036: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_strstr=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_decl_needed_strstr=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$bfd_cv_decl_needed_strstr" 1>&6 +if test $bfd_cv_decl_needed_strstr = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo strstr | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +echo "configure:2058: checking whether sbrk must be declared" >&5 +if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { +char *(*pfn) = (char *(*)) sbrk +; return 0; } +EOF +if { (eval echo configure:2084: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_sbrk=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_decl_needed_sbrk=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$bfd_cv_decl_needed_sbrk" 1>&6 +if test $bfd_cv_decl_needed_sbrk = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo sbrk | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +echo "configure:2106: 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 < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { +char *(*pfn) = (char *(*)) getenv +; return 0; } +EOF +if { (eval echo configure:2132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_getenv=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_decl_needed_getenv=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$bfd_cv_decl_needed_getenv" 1>&6 +if test $bfd_cv_decl_needed_getenv = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo getenv | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <> confdefs.h <<\EOF #define USE_BINARY_FOPEN 1 EOF @@ -1641,7 +2165,7 @@ if test -n "$enable_targets"; then for targ in `echo $enable_targets | sed 's/,/ /g'` do - result=`$ac_config_sub $targ 2>/dev/null` + result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null` if test -n "$result"; then canon_targets="$canon_targets $result" else @@ -1667,7 +2191,7 @@ NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC" else case $targ in - i[345]86*-*-netware*) + i[3456]86*-*-netware*) BUILD_NLMCONV='$(NLMCONV_PROG)' NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386" ;; @@ -1736,11 +2260,25 @@ # --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 | - sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ - >> confcache + case `(ac_space=' '; set) 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 @@ -1795,7 +2333,7 @@ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.10" + echo "$CONFIG_STATUS generated by autoconf version 2.12" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1854,6 +2392,7 @@ s%@CC@%$CC%g s%@HDEFINES@%$HDEFINES%g s%@HLDFLAGS@%$HLDFLAGS%g +s%@HLDENV@%$HLDENV%g s%@RPATH_ENVVAR@%$RPATH_ENVVAR%g s%@AR@%$AR%g s%@RANLIB@%$RANLIB%g @@ -1863,6 +2402,7 @@ s%@OPCODES@%$OPCODES%g s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g s%@CPP@%$CPP%g +s%@ALLOCA@%$ALLOCA%g s%@NLMCONV_DEFS@%$NLMCONV_DEFS%g s%@BUILD_NLMCONV@%$BUILD_NLMCONV%g s%@BUILD_SRCONV@%$BUILD_SRCONV%g @@ -1872,20 +2412,56 @@ 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]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac - # Adjust relative srcdir, etc. for subdirectories. + # 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%/[^/][^/]*$%%'` @@ -1913,6 +2489,7 @@ [/$]*) 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." @@ -1921,14 +2498,16 @@ # $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 -" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done -rm -f conftest.subs +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. @@ -1949,11 +2528,17 @@ ac_eC=' ' ac_eD='%g' -CONFIG_HEADERS=${CONFIG_HEADERS-"config.h:config.in"} +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]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac @@ -1961,7 +2546,8 @@ echo creating $ac_file rm -f conftest.frag conftest.in conftest.out - cp $ac_given_srcdir/$ac_file_in conftest.in + 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 @@ -1989,8 +2575,6 @@ # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. -# Maximum number of lines to put in a single here document. -ac_max_here_lines=12 rm -f conftest.tail while : @@ -2032,7 +2616,11 @@ fi fi; done +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac exit 0 EOF diff -urN binutils-2.7/binutils/configure.com binutils-2.8/binutils/configure.com --- binutils-2.7/binutils/configure.com Wed Dec 31 19:00:00 1969 +++ binutils-2.8/binutils/configure.com Wed Apr 30 12:59:07 1997 @@ -0,0 +1,78 @@ +$! +$! This file configures binutils for use with openVMS/Alpha +$! We do not use the configure script, since we do not have /bin/sh +$! to execute it. +$! +$! Written by Klaus K"ampf (kkaempf@progis.de) +$! +$arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2 +$arch = f$element(arch_indx,"|","|VAX|Alpha|") +$if arch .eqs. "VAX" +$then +$ write sys$output "Target VAX not supported." +$ exit 2 +$endif +$! +$! +$! Generate config.h +$! +$ create []config.h +/* config.h. Generated automatically by configure. */ +/* config.in. Generated automatically from configure.in by autoheader. */ +/* Is the type time_t defined in ? */ +#define HAVE_TIME_T_IN_TIME_H 1 +/* Is the type time_t defined in ? */ +#define HAVE_TIME_T_IN_TYPES_H 1 +/* Does define struct utimbuf? */ +#define HAVE_GOOD_UTIME_H 1 +/* Whether fprintf must be declared even if is included. */ +#define NEED_DECLARATION_FPRINTF 1 +/* Whether sbrk must be declared even if is included. */ +#undef NEED_DECLARATION_SBRK +/* Do we need to use the b modifier when opening binary files? */ +/* #undef USE_BINARY_FOPEN */ +/* Define if you have the sbrk function. */ +#define HAVE_SBRK 1 +/* Define if you have the utimes function. */ +#define HAVE_UTIMES 1 +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 +/* Define if you have the header file. */ +#define HAVE_STRINGS_H 1 +/* Define if you have the header file. */ +#define HAVE_SYS_FILE_H 1 +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 +$ write sys$output "Generated `config.h'" +$! +$! +$! Edit VERSION in makefile.vms +$! +$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input - + []makefile.vms /output=[]makefile.vms +$DECK +! +! Get VERSION from Makefile.in +! + mfile := CREATE_BUFFER("mfile", "Makefile.in"); + rang := CREATE_RANGE(BEGINNING_OF(mfile), END_OF(mfile)); + v_pos := SEARCH_QUIETLY('VERSION=', FORWARD, EXACT, rang); + POSITION(BEGINNING_OF(v_pos)); + vers := CURRENT_LINE; + IF match_pos <> 0 THEN; + file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); + rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); + match_pos := SEARCH_QUIETLY('VERSION=', FORWARD, EXACT, rang); + POSITION(BEGINNING_OF(match_pos)); + ERASE_LINE; + COPY_TEXT(vers); + SPLIT_LINE; + ENDIF; + WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); + QUIT +$ EOD +$ write sys$output "Patched `makefile.vms'" diff -urN binutils-2.7/binutils/configure.in binutils-2.8/binutils/configure.in --- binutils-2.7/binutils/configure.in Thu Jul 4 12:23:29 1996 +++ binutils-2.8/binutils/configure.in Wed Apr 30 12:59:07 1997 @@ -22,6 +22,13 @@ *opcodes*) shared=true shared_opcodes=true ;; *) shared=false ;; esac])dnl +AC_ARG_ENABLE(commonbfdlib, +[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library], +[case "${enableval}" in + yes) commonbfdlib=true ;; + no) commonbfdlib=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; +esac])dnl AC_CONFIG_HEADER(config.h:config.in) @@ -39,6 +46,7 @@ HDEFINES= HLDFLAGS= +HLDENV= RPATH_ENVVAR=LD_LIBRARY_PATH AC_PROG_CC @@ -47,6 +55,7 @@ AC_SUBST(HDEFINES) AC_SUBST(HLDFLAGS) +AC_SUBST(HLDENV) AC_SUBST(RPATH_ENVVAR) AR=${AR-ar} AC_SUBST(AR) @@ -58,6 +67,7 @@ # need to handle some hosts specially. BFDLIB='-L../bfd -lbfd' OPCODES='-L../opcodes -lopcodes' + case "${host}" in *-*-sunos*) # On SunOS, we must link against the name we are going to install, @@ -85,6 +95,13 @@ fi ;; esac + +if test "${commonbfdlib}" = "true"; then + # when a shared libbfd is built with --enable-commonbfdlib, + # all of libopcodes is available in libbfd.so + OPCODES= +fi + AC_SUBST(BFDLIB) AC_SUBST(OPCODES) @@ -92,8 +109,15 @@ AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h) AC_HEADER_SYS_WAIT +AC_FUNC_ALLOCA AC_CHECK_FUNCS(sbrk utimes) -AC_FUNC_VFORK +dnl Temporary workaround for bug in autoconf 2.12. When the bug is +dnl fixed, we can just call AC_FUNC_VFORK in all cases. +if test "x$cross_compiling" = "xno"; then + AC_FUNC_VFORK +else + AC_CHECK_FUNC(vfork, , AC_DEFINE(vfork, fork)) +fi AC_MSG_CHECKING(for time_t in time.h) AC_CACHE_VAL(bu_cv_decl_time_t_time_h, @@ -130,6 +154,9 @@ fi BFD_NEED_DECLARATION(fprintf) +BFD_NEED_DECLARATION(strstr) +BFD_NEED_DECLARATION(sbrk) +BFD_NEED_DECLARATION(getenv) BFD_BINARY_FOPEN @@ -139,7 +166,7 @@ if test -n "$enable_targets"; then for targ in `echo $enable_targets | sed 's/,/ /g'` do - result=`$ac_config_sub $targ 2>/dev/null` + result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null` if test -n "$result"; then canon_targets="$canon_targets $result" else @@ -166,7 +193,7 @@ else case $targ in changequote(,)dnl - i[345]86*-*-netware*) + i[3456]86*-*-netware*) changequote([,])dnl BUILD_NLMCONV='$(NLMCONV_PROG)' NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386" diff -urN binutils-2.7/binutils/debug.c binutils-2.8/binutils/debug.c --- binutils-2.7/binutils/debug.c Thu Jul 4 12:23:33 1996 +++ binutils-2.8/binutils/debug.c Wed Apr 30 12:59:08 1997 @@ -1955,7 +1955,7 @@ if (info->current_unit == NULL || info->current_file == NULL) { - debug_error ("debug_record_variable: no current file"); + debug_error ("debug_name_type: no current file"); return false; } @@ -3142,6 +3142,11 @@ struct debug_type_compare_list *l; struct debug_type_compare_list top; boolean ret; + + if (t1 == NULL) + return t2 == NULL; + if (t2 == NULL) + return false; while (t1->kind == DEBUG_KIND_INDIRECT) { diff -urN binutils-2.7/binutils/dlltool.c binutils-2.8/binutils/dlltool.c --- binutils-2.7/binutils/dlltool.c Thu Jul 4 12:23:36 1996 +++ binutils-2.8/binutils/dlltool.c Wed Apr 30 12:59:09 1997 @@ -1,7 +1,5 @@ -#define show_allnames 0 - /* dlltool.c -- tool to generate stuff for PE style DLLs - Copyright (C) 1995 Free Software Foundation, Inc. + Copyright (C) 1995, 96, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -202,6 +200,16 @@ .idata$7 = dll name (eg: "kernel32.dll"). (.idata$6 for ppc) */ +/* AIX requires this to be the first thing in the file. */ +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# ifdef _AIX + #pragma alloca +#endif +#endif + +#define show_allnames 0 + #define PAGE_SIZE 4096 #define PAGE_MASK (-PAGE_SIZE) #include "bfd.h" @@ -750,12 +758,15 @@ char *c; p += 8; name = p; - while (*p != ' ' && *p != '-' && p < e) + while (p < e && *p != ' ' && *p != '-') p++; c = xmalloc (p - name + 1); memcpy (c, name, p - name); c[p - name] = 0; - def_exports (c, 0, -1, 0); + /* FIXME: The 5th arg is for the `constant' field. + What should it be? Not that it matters since it's not + currently useful. */ + def_exports (c, 0, -1, 0, 0); } else p++; @@ -768,7 +779,6 @@ if (verbose) fprintf (stderr, "%s: Done readin\n", program_name); - } @@ -1073,7 +1083,7 @@ fseek (base_file, 0, SEEK_END); numbytes = ftell (base_file); fseek (base_file, 0, SEEK_SET); - copy = malloc (numbytes); + copy = xmalloc (numbytes); fread (copy, 1, numbytes, base_file); num_entries = numbytes / sizeof (long); @@ -1130,7 +1140,7 @@ { if (add_underscore) { - char *copy = malloc (strlen (name) + 2); + char *copy = xmalloc (strlen (name) + 2); copy[0] = '_'; strcpy (copy + 1, name); name = copy; @@ -1199,7 +1209,7 @@ static sinfo secdata[NSECS] = { - { TEXT, ".text", SEC_CODE | SEC_HAS_CONTENTS, 3}, + { TEXT, ".text", SEC_CODE | SEC_HAS_CONTENTS, 2}, { DATA, ".data", SEC_DATA, 2}, { BSS, ".bss", 0, 2}, { IDATA7, ".idata$7", SEC_HAS_CONTENTS, 2}, @@ -2026,7 +2036,7 @@ /* fill in the unset ordinals with ones from our range */ - ptr = (char *) malloc (size); + ptr = (char *) xmalloc (size); memset (ptr, 0, size); @@ -2323,7 +2333,6 @@ scan_obj_file (av[optind]); optind++; } - mangle_defs (); diff -urN binutils-2.7/binutils/filemode.c binutils-2.8/binutils/filemode.c --- binutils-2.7/binutils/filemode.c Thu Jul 4 12:23:36 1996 +++ binutils-2.8/binutils/filemode.c Wed Apr 30 12:59:09 1997 @@ -1,5 +1,5 @@ /* filemode.c -- make a string describing file modes - Copyright (C) 1985, 1990, 1991 Free Software Foundation, Inc. + Copyright (C) 1985, 90, 91, 94, 95, 1997 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,9 +13,11 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #include "bfd.h" +#include "bucomm.h" static char ftypelet PARAMS ((unsigned long)); static void setst PARAMS ((unsigned long, char *)); diff -urN binutils-2.7/binutils/ieee.c binutils-2.8/binutils/ieee.c --- binutils-2.7/binutils/ieee.c Thu Jul 4 12:23:39 1996 +++ binutils-2.8/binutils/ieee.c Wed Apr 30 12:59:10 1997 @@ -154,12 +154,16 @@ const bfd_byte *pend; /* The block stack. */ struct ieee_blockstack blockstack; + /* Whether we have seen a BB1 or BB2. */ + boolean saw_filename; /* The variables. */ struct ieee_vars vars; /* The global variables, after a global typedef block. */ struct ieee_vars *global_vars; /* The types. */ struct ieee_types types; + /* The global types, after a global typedef block. */ + struct ieee_types *global_types; /* The list of tagged structs. */ struct ieee_tag *tags; }; @@ -893,6 +897,7 @@ info.bytes = bytes; info.pend = bytes + len; info.blockstack.bsp = info.blockstack.stack; + info.saw_filename = false; info.vars.alloc = 0; info.vars.vars = NULL; info.types.alloc = 0; @@ -976,7 +981,7 @@ bfd_vma size; const char *name; unsigned long namlen; - char *namcopy; + char *namcopy = NULL; unsigned int fnindx; boolean skip; @@ -1001,6 +1006,29 @@ return false; if (! debug_set_filename (info->dhandle, namcopy)) return false; + info->saw_filename = true; + + /* Discard any variables or types we may have seen before. */ + if (info->vars.vars != NULL) + free (info->vars.vars); + info->vars.vars = NULL; + info->vars.alloc = 0; + if (info->types.types != NULL) + free (info->types.types); + info->types.types = NULL; + info->types.alloc = 0; + + /* Initialize the types to the global types. */ + if (info->global_types != NULL) + { + info->types.alloc = info->global_types->alloc; + info->types.types = ((struct ieee_type *) + xmalloc (info->types.alloc + * sizeof (*info->types.types))); + memcpy (info->types.types, info->global_types->types, + info->types.alloc * sizeof (*info->types.types)); + } + break; case 2: @@ -1008,6 +1036,7 @@ empty, but we don't check. */ if (! debug_set_filename (info->dhandle, "*global*")) return false; + info->saw_filename = true; break; case 3: @@ -1147,8 +1176,8 @@ break; case 10: - /* BB10: Assembler module scope. We completely ignore all this - information. FIXME. */ + /* BB10: Assembler module scope. In the normal case, we + completely ignore all this information. FIXME. */ { const char *inam, *vstr; unsigned long inamlen, vstrlen; @@ -1156,6 +1185,16 @@ boolean present; unsigned int i; + if (! info->saw_filename) + { + namcopy = savestring (name, namlen); + if (namcopy == NULL) + return false; + if (! debug_set_filename (info->dhandle, namcopy)) + return false; + info->saw_filename = true; + } + if (! ieee_read_id (info, pp, &inam, &inamlen) || ! ieee_read_number (info, pp, &tool_type) || ! ieee_read_optional_id (info, pp, &vstr, &vstrlen, &present)) @@ -1244,6 +1283,20 @@ * sizeof (*info->vars.vars))); memcpy (info->global_vars->vars, info->vars.vars, info->vars.alloc * sizeof (*info->vars.vars)); + + /* We also copy out the non builtin parts of info->types, since + the types are discarded when we start a new block. */ + info->global_types = ((struct ieee_types *) + xmalloc (sizeof *info->global_types)); + info->global_types->alloc = info->types.alloc; + info->global_types->types = ((struct ieee_type *) + xmalloc (info->types.alloc + * sizeof (*info->types.types))); + memcpy (info->global_types->types, info->types.types, + info->types.alloc * sizeof (*info->types.types)); + memset (info->global_types->builtins, 0, + sizeof (info->global_types->builtins)); + break; case 4: @@ -1818,16 +1871,31 @@ case 'g': /* Bitfield type. */ { - bfd_vma signedp, bitsize; + bfd_vma signedp, bitsize, dummy; + const bfd_byte *hold; + boolean present; if (! ieee_read_number (info, pp, &signedp) - || ! ieee_read_number (info, pp, &bitsize) - || ! ieee_read_type_index (info, pp, &type)) + || ! ieee_read_number (info, pp, &bitsize)) return false; - /* FIXME: This is just a guess. */ - if (! signedp) - type = debug_make_int_type (dhandle, 4, true); + /* I think the documentation says that there is a type index, + but some actual files do not have one. */ + hold = *pp; + if (! ieee_read_optional_number (info, pp, &dummy, &present)) + return false; + if (! present) + { + /* FIXME: This is just a guess. */ + type = debug_make_int_type (dhandle, 4, + signedp ? false : true); + } + else + { + *pp = hold; + if (! ieee_read_type_index (info, pp, &type)) + return false; + } type_bitsize = bitsize; } break; @@ -2691,7 +2759,7 @@ char *fieldcopy; boolean staticp; debug_type ftype; - const debug_field *pf; + const debug_field *pf = NULL; enum debug_visibility visibility; debug_field field; @@ -3723,6 +3791,8 @@ struct ieee_defined_enum *next; /* Type index. */ unsigned int indx; + /* Whether this enum has been defined. */ + boolean defined; /* Tag. */ const char *tag; /* Names. */ @@ -4662,7 +4732,18 @@ /* Prepend the global typedef information to the other data. */ if (! ieee_buffer_emptyp (&info.global_types)) { + /* The HP debugger seems to have a bug in which it ignores the + last entry in the global types, so we add a dummy entry. */ if (! ieee_change_buffer (&info, &info.global_types) + || ! ieee_write_byte (&info, (int) ieee_nn_record) + || ! ieee_write_number (&info, info.name_indx) + || ! ieee_write_id (&info, "") + || ! ieee_write_byte (&info, (int) ieee_ty_record_enum) + || ! ieee_write_number (&info, info.type_indx) + || ! ieee_write_byte (&info, 0xce) + || ! ieee_write_number (&info, info.name_indx) + || ! ieee_write_number (&info, 'P') + || ! ieee_write_number (&info, (int) builtin_void + 32) || ! ieee_write_byte (&info, (int) ieee_be_record_enum)) return false; @@ -5004,7 +5085,7 @@ /* Coalesce ranges if it seems reasonable. */ while (r->next != NULL - && high + 64 >= r->next->low + && high + 0x1000 >= r->next->low && (r->next->high <= (bfd_get_section_vma (info->abfd, s) + bfd_section_size (info->abfd, s)))) @@ -5073,7 +5154,8 @@ return; } - if (low < r->low) + if (low < r->low + && r->low - low > 0x100) { if (! ieee_add_bb11 (info, sec, low, r->low)) { @@ -5336,9 +5418,11 @@ struct ieee_handle *info = (struct ieee_handle *) p; struct ieee_defined_enum *e; boolean localp, simple; - int i; + unsigned int indx; + int i = 0; localp = false; + indx = (unsigned int) -1; for (e = info->enums; e != NULL; e = e->next) { if (tag == NULL) @@ -5354,6 +5438,13 @@ continue; } + if (! e->defined) + { + /* This enum tag has been seen but not defined. */ + indx = e->indx; + break; + } + if (names != NULL && e->names != NULL) { for (i = 0; names[i] != NULL && e->names[i] != NULL; i++) @@ -5366,7 +5457,10 @@ } if ((names == NULL && e->names == NULL) - || (names[i] == NULL && e->names[i] == NULL)) + || (names != NULL + && e->names != NULL + && names[i] == NULL + && e->names[i] == NULL)) { /* We've seen this enum before. */ return ieee_push_type (info, e->indx, 0, true, false); @@ -5398,8 +5492,8 @@ } } - if (! ieee_define_named_type (info, tag, (unsigned int) -1, 0, - true, localp, (struct ieee_buflist *) NULL) + if (! ieee_define_named_type (info, tag, indx, 0, true, localp, + (struct ieee_buflist *) NULL) || ! ieee_write_number (info, simple ? 'E' : 'N')) return false; if (simple) @@ -5425,16 +5519,20 @@ if (! localp) { - e = (struct ieee_defined_enum *) xmalloc (sizeof *e); - memset (e, 0, sizeof *e); + if (indx == (unsigned int) -1) + { + e = (struct ieee_defined_enum *) xmalloc (sizeof *e); + memset (e, 0, sizeof *e); + e->indx = info->type_stack->type.indx; + e->tag = tag; + + e->next = info->enums; + info->enums = e; + } - e->indx = info->type_stack->type.indx; - e->tag = tag; e->names = names; e->vals = vals; - - e->next = info->enums; - info->enums = e; + e->defined = true; } return true; @@ -5625,14 +5723,21 @@ struct ieee_handle *info = (struct ieee_handle *) p; unsigned int eleindx; boolean localp; + unsigned int size; struct ieee_modified_type *m = NULL; struct ieee_modified_array_type *a; /* IEEE does not store the range, so we just ignore it. */ ieee_pop_unused_type (info); localp = info->type_stack->type.localp; + size = info->type_stack->type.size; eleindx = ieee_pop_type (info); + /* If we don't know the range, treat the size as exactly one + element. */ + if (low < high) + size *= (high - low) + 1; + if (! localp) { m = ieee_get_modified_info (info, eleindx); @@ -5642,11 +5747,11 @@ for (a = m->arrays; a != NULL; a = a->next) { if (a->low == low && a->high == high) - return ieee_push_type (info, a->indx, 0, false, false); + return ieee_push_type (info, a->indx, size, false, false); } } - if (! ieee_define_type (info, 0, false, localp) + if (! ieee_define_type (info, size, false, localp) || ! ieee_write_number (info, low == 0 ? 'Z' : 'C') || ! ieee_write_number (info, eleindx)) return false; @@ -6587,7 +6692,19 @@ for (e = info->enums; e != NULL; e = e->next) if (e->tag != NULL && strcmp (e->tag, name) == 0) return ieee_push_type (info, e->indx, 0, true, false); - abort (); + + e = (struct ieee_defined_enum *) xmalloc (sizeof *e); + memset (e, 0, sizeof *e); + + e->indx = info->type_indx; + ++info->type_indx; + e->tag = name; + e->defined = false; + + e->next = info->enums; + info->enums = e; + + return ieee_push_type (info, e->indx, 0, true, false); } localp = false; diff -urN binutils-2.7/binutils/makefile.vms binutils-2.8/binutils/makefile.vms --- binutils-2.7/binutils/makefile.vms Thu Jul 4 12:23:40 1996 +++ binutils-2.8/binutils/makefile.vms Wed Apr 30 12:59:10 1997 @@ -1,56 +1,93 @@ # -# Makefile for binutils under openVMS/AXP +# Makefile for binutils under openVMS/Alpha # # For use with gnu-make for vms # -# Created by Klaus Kämpf, kkaempf@progis.de +# Created by Klaus K"ampf, kkaempf@progis.de # # -CC=gcc +# Distribution version, filled in by configure.com +VERSION= + +TARGET=""evax-alpha"" ifeq ($(CC),gcc) CFLAGS=/include=([],[-.include],[-.bfd])$(DEFS) -DEFS=/define=("unlink=remove") -GCCLIBS=,GNU_CC:[000000]LIBGCC2/lib,GNU_CC:[000000]LIBGCCLIB/lib,sys$$disk:[-]vprintf.obj,sys$$library:vaxcrtl.olb/lib,GNU_CC:[000000]crt0.obj +DEFS=/define=("TARGET=$(TARGET)") +LIBS=,GNU:[000000]libgcc/lib,sys$$library:vaxcrtl.olb/lib,GNU:[000000]crt0.obj else -CFLAGS=/noopt/debug/include=([],[-.include],[-.bfd])$(DEFS) -DEFS=/define=(\ +CFLAGS=/noopt/debug/include=([],[-.include],[-.bfd])$(DEFS)/warnings=disable=(missingreturn,implicitfunc) +DEFS=/define=("TARGET=$(TARGET)",\ +"const=","unlink=remove",\ "_bfd_generic_get_section_contents_in_window"="_bfd_generic_get_win_section_cont",\ "_bfd_elf_section_from_bfd_section"="_bfd_elf_sec_from_bfd_sec") -GCCLIBS= +LIBS=,sys$$library:vaxcrtl.olb/lib endif -LIBBFD = [-.bfd]libbfd.olb -LIBIBERTY = [-.libiberty]libiberty.olb -LIBOPCODES = [-.opcodes]libopcodes.olb +BFDLIB = [-.bfd]libbfd.olb/lib +BFDLIB_DEP = [-.bfd]libbfd.olb +LIBIBERTY_DEP = [-.libiberty]libiberty.olb +LIBIBERTY = [-.libiberty]libiberty.olb/lib +OPCODES_DEP = [-.opcodes]libopcodes.olb +OPCODES = [-.opcodes]libopcodes.olb/lib -LIBS = $(LIBBFD) $(LIBOPCODES) $(LIBIBERTY) +DEBUG_OBJS = rddbg.obj,debug.obj,stabs.obj,ieee.obj,rdcoff.obj -DEBUG_OBJS = rddbg.obj,debug.obj,stabs.obj,ieee.obj,prdbg.obj +WRITE_DEBUG_OBJS = $(DEBUG_OBJS),wrstabs.obj -SIZEOBJS = bucomm.obj,version.obj,filemode.obj,size.obj +BULIBS = []bucomm.obj,version.obj,filemode.obj -OBJDUMPOBJS = bucomm.obj,version.obj,filemode.obj,objdump.obj +ADDL_DEPS = $(BULIBS),$(BFDLIB_DEP),$(LIBIBERTY_DEP) +ADDL_LIBS = $(BULIBS),$(BFDLIB),$(LIBIBERTY) -NMOBJS = bucomm.obj,version.obj,filemode.obj,nm.obj +SIZEOBJS = $(ADDL_DEPS),size.obj -all: config.h size.exe objdump.exe nm.exe +STRINGSOBJS = $(ADDL_DEPS),strings.obj -size.exe: $(SIZEOBJS) $(LIBS) - link/exe=$@ $(SIZEOBJS),$(LIBBFD)/lib,$(LIBOPCODES)/lib,$(LIBIBERTY)/lib$(GCCLIBS) +NMOBJS = $(ADDL_DEPS),nm.obj -objdump.exe: $(DEBUG_OBJS) $(OBJDUMPOBJS) $(LIBS) - link/exe=$@ $(OBJDUMPOBJS),$(DEBUG_OBJS),$(LIBBFD)/lib,$(LIBOPCODES)/lib,$(LIBIBERTY)/lib$(GCCLIBS) +OBJDUMPOBJS = $(ADDL_DEPS),objdump.obj,prdbg.obj,$(DEBUG_OBJS),$(OPCODES_DEP) -nm.exe: $(NMOBJS) $(LIBS) - link/exe=$@ $(NMOBJS),$(LIBBFD)/lib,$(LIBOPCODES)/lib,$(LIBIBERTY)/lib$(GCCLIBS) +all: config.h size.exe strings.exe objdump.exe nm.exe -version.obj: version.c - $(CC) $(CFLAGS)/define=(VERSION="""960408""") $< +size.exe: $(SIZEOBJS) + link/exe=$@ size.obj,$(ADDL_LIBS)$(LIBS) + +strings.exe: $(STRINGSOBJS) + link/exe=$@ strings.obj,$(ADDL_LIBS)$(LIBS) + +nm.exe: $(NMOBJS) + link/exe=$@ nm.obj,$(ADDL_LIBS)$(LIBS) -objdump.obj: objdump.c - $(CC) $(CFLAGS) $< +objdump.exe: $(OBJDUMPOBJS) + link/exe=$@ objdump.obj,prdbg.obj,$(DEBUG_OBJS),$(BFDLIB),$(OPCODES),$(ADDL_LIBS)$(LIBS) + + +version.obj: version.c + $(CC) $(CFLAGS)/define=(VERSION="""$(VERSION)""") $< -config.h: config.h-vms - $(CP) $< $@ +config.h: + $$ @configure + $(MAKE) -f makefile.vms + +[-.bfd]libbfd.olb: + $(CD) [-.bfd] + $(MAKE) -f makefile.vms + $(CD) [-.binutils] + +[-.libiberty]libiberty.olb: + $(CD) [-.libiberty] + $(MAKE) -f makefile.vms + $(CD) [-.binutils] + +[-.opcodes]libopcodes.olb: + $(CD) [-.opcodes] + $(MAKE) -f makefile.vms + $(CD) [-.binutils] + +clean: + $$ purge + $(RM) *.obj; + $(RM) *.exe; + $(RM) config.h; diff -urN binutils-2.7/binutils/mpw-make.sed binutils-2.8/binutils/mpw-make.sed --- binutils-2.7/binutils/mpw-make.sed Thu Jul 4 12:23:40 1996 +++ binutils-2.8/binutils/mpw-make.sed Wed Apr 30 12:59:12 1997 @@ -12,6 +12,7 @@ # Whack out unused host define bits. /HDEFINES/s/@HDEFINES@// +# Don't build specialized tools. /BUILD_NLMCONV/s/@BUILD_NLMCONV@// /BUILD_SRCONV/s/@BUILD_SRCONV@// /BUILD_DLLTOOL/s/@BUILD_DLLTOOL@// @@ -37,9 +38,14 @@ /BISON/s/^BISON =.*$/BISON = byacc/ #/BISONFLAGS/s/^BISONFLAGS =.*$/BISONFLAGS = / +# Embed the version in symbolic doublequotes that will expand to +# the right thing for each compiler. +/VERSION/s/'"{VERSION}"'/{dq}{VERSION}{dq}/ + # '+' is a special char to MPW, don't use it ever. /c++filt/s/c++filt/cplusfilt/ +# All of the binutils use the same Rez file, change names to refer to it. /^{[A-Z]*_PROG}/s/$/ "{s}"mac-binutils.r/ /{[A-Z]*_PROG}\.r/s/{[A-Z]*_PROG}\.r/mac-binutils.r/ @@ -84,13 +90,7 @@ install \\Option-f all install-only\ \ install-only \\Option-f\ - If "`Exists "{prefix}"`" == ""\ - Echo "{prefix}" does not exist, cannot install anything\ - Exit 1\ - End If\ - If "`Exists "{bindir}"`" == ""\ - NewFolder "{bindir}"\ - End If\ + NewFolderRecursive "{bindir}"\ # Need to copy all the tools\ For prog in {PROGS}\ Set progname `echo {prog} | sed -e 's/.new//'`\ diff -urN binutils-2.7/binutils/nlmconv.c binutils-2.8/binutils/nlmconv.c --- binutils-2.7/binutils/nlmconv.c Thu Jul 4 12:23:42 1996 +++ binutils-2.8/binutils/nlmconv.c Wed Apr 30 12:59:12 1997 @@ -1,5 +1,5 @@ /* nlmconv.c -- NLM conversion program - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -22,9 +22,14 @@ This program can be used to convert any appropriate object file into a NetWare Loadable Module (an NLM). It will accept a linker specification file which is identical to that accepted by the - NetWare linker, NLMLINK, except that the INPUT command, normally - used to give a list of object files to link together, is not used. - This program will convert only a single object file. */ + NetWare linker, NLMLINK. */ + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# ifdef _AIX + #pragma alloca +#endif +#endif #include "bfd.h" #include "libiberty.h" @@ -60,10 +65,6 @@ extern struct tm *localtime (); #endif -#ifndef getenv -extern char *getenv (); -#endif - #ifndef SEEK_SET #define SEEK_SET 0 #endif @@ -79,9 +80,6 @@ /* The name used to invoke the program. */ char *program_name; -/* The version number. */ -extern char *program_version; - /* Local variables. */ /* Whether to print out debugging information (currently just controls @@ -208,6 +206,7 @@ xmalloc_set_program_name (program_name); bfd_init (); + set_default_bfd_target (); while ((opt = getopt_long (argc, argv, "dhI:l:O:T:V", long_options, (int *) NULL)) @@ -234,8 +233,7 @@ header_file = optarg; break; case 'V': - printf ("GNU %s version %s\n", program_name, program_version); - exit (0); + print_version ("nlmconv"); /*NOTREACHED*/ case 0: break; @@ -1125,6 +1123,8 @@ [--help] [--version]\n\ [in-file [out-file]]\n", program_name); + if (status == 0) + fprintf (file, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); exit (status); } @@ -2201,7 +2201,7 @@ FILE *argfile; int i; - scmd = (char *)malloc (strlen (program) + strlen (temp_filename) + 10); + scmd = (char *) xmalloc (strlen (program) + strlen (temp_filename) + 10); rf = scmd + strlen(program) + 2 + el; sprintf (scmd, "%s.exe @%s.gp", program, temp_filename); argfile = fopen (rf, "w"); diff -urN binutils-2.7/binutils/nm.c binutils-2.8/binutils/nm.c --- binutils-2.7/binutils/nm.c Thu Jul 4 12:23:43 1996 +++ binutils-2.8/binutils/nm.c Wed Apr 30 12:59:13 1997 @@ -1,5 +1,5 @@ /* nm.c -- Describe symbol table of a rel file. - Copyright 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -46,6 +46,18 @@ asymbol **syms; }; +static void +usage PARAMS ((FILE *, int)); + +static void +set_print_radix PARAMS ((char *)); + +static void +set_output_format PARAMS ((char *)); + +static void +display_archive PARAMS ((bfd *)); + static boolean display_file PARAMS ((char *filename)); @@ -66,6 +78,9 @@ print_size_symbols PARAMS ((bfd *, boolean, struct size_sym *, long, bfd *)); static void +print_symname PARAMS ((const char *, const char *, bfd *)); + +static void print_symbol PARAMS ((bfd *, asymbol *, bfd *)); static void @@ -234,9 +249,7 @@ /* IMPORT */ extern char *program_name; -extern char *program_version; extern char *target; -extern int print_version; static struct option long_options[] = { @@ -267,7 +280,7 @@ /* Some error-reporting functions */ -void +static void usage (stream, status) FILE *stream; int status; @@ -283,12 +296,14 @@ [file...]\n", program_name); list_supported_targets (program_name, stream); + if (status == 0) + fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); exit (status); } /* Set the radix for the symbol value and size according to RADIX. */ -void +static void set_print_radix (radix) char *radix; { @@ -320,7 +335,7 @@ } } -void +static void set_output_format (f) char *f; { @@ -361,6 +376,7 @@ START_PROGRESS (program_name, 0); bfd_init (); + set_default_bfd_target (); while ((c = getopt_long (argc, argv, "aABCDef:glnopPrst:uvV", long_options, (int *) 0)) != EOF) { @@ -435,10 +451,7 @@ } if (show_version) - { - printf ("GNU %s version %s\n", program_name, program_version); - exit (0); - } + print_version ("nm"); /* OK, all options now parsed. If no filename specified, do a.out. */ if (optind == argc) @@ -810,6 +823,8 @@ if (next == NULL) bfd_fatal (bfd_get_filename (abfd)); } + else + next = NULL; sec = bfd_get_section (sym); @@ -988,7 +1003,8 @@ static void print_symname (format, name, abfd) - char *format, *name; + const char *format; + const char *name; bfd *abfd; { if (do_demangle && *name) @@ -1108,6 +1124,7 @@ if (line_numbers) { + static bfd *cache_bfd; static asymbol **syms; static long symcount; const char *filename, *functionname; @@ -1116,6 +1133,11 @@ /* We need to get the canonical symbols in order to call bfd_find_nearest_line. This is inefficient, but, then, you don't have to use --line-numbers. */ + if (abfd != cache_bfd && syms != NULL) + { + free (syms); + syms = NULL; + } if (syms == NULL) { long symsize; @@ -1127,10 +1149,12 @@ symcount = bfd_canonicalize_symtab (abfd, syms); if (symcount < 0) bfd_fatal (bfd_get_filename (abfd)); + cache_bfd = abfd; } if (bfd_is_und_section (bfd_get_section (sym))) { + static bfd *cache_rel_bfd; static asection **secs; static arelent ***relocs; static long *relcount; @@ -1142,6 +1166,19 @@ seccount = bfd_count_sections (abfd); + if (abfd != cache_rel_bfd && relocs != NULL) + { + for (i = 0; i < seccount; i++) + if (relocs[i] != NULL) + free (relocs[i]); + free (secs); + free (relocs); + free (relcount); + secs = NULL; + relocs = NULL; + relcount = NULL; + } + if (relocs == NULL) { struct get_relocs_info info; @@ -1155,6 +1192,7 @@ info.relcount = relcount; info.syms = syms; bfd_map_over_sections (abfd, get_relocs, (PTR) &info); + cache_rel_bfd = abfd; } symname = bfd_asymbol_name (sym); diff -urN binutils-2.7/binutils/objcopy.1 binutils-2.8/binutils/objcopy.1 --- binutils-2.7/binutils/objcopy.1 Thu Jul 4 12:23:44 1996 +++ binutils-2.8/binutils/objcopy.1 Wed Apr 30 12:59:13 1997 @@ -1,4 +1,4 @@ -.\" Copyright (c) 1991 Free Software Foundation +.\" Copyright (c) 1991, 93, 94, 95, 96, 1997 Free Software Foundation .\" See section COPYING for conditions for redistribution .TH objcopy 1 "October 1994" "cygnus support" "GNU Development Tools" .de BP @@ -28,6 +28,7 @@ .RB "[\|" \-X\fR\ |\ \fB\-\-discard\-locals\fR "\|]" .RB "[\|" \-b\ \fIbyte\fR\ |\ \fB\-\-byte=\fIbyte\fR "\|]" .RB "[\|" \-i\ \fIinterleave\fR\ |\ \fB\-\-interleave=\fIinterleave\fR "\|]" +.RB "[\|" \-p\fR\ |\ \fB\-\-preserve\-dates\fR "\|]" .RB "[\|" \-\-debugging "\|]" .RB "[\|" \-\-gap\-fill=\fIval\fR "\|]" .RB "[\|" \-\-pad\-to=\fIaddress\fR "\|]" @@ -39,7 +40,9 @@ .RB "[\|" \-\-no\-adjust\-warnings\fR "\|]" .RB "[\|" \-\-set\-section\-flags=\fIsection=flags\fR "\|]" .RB "[\|" \-\-add\-section=\fIsectionname=filename\fR "\|]" +.RB "[\|" \-\-change\-leading\-char\fR "\|]" .RB "[\|" \-\-remove\-leading\-char\fR "\|]" +.RB "[\|" \-\-weaken\fR "\|]" .RB "[\|" \-v\ |\ \-\-verbose\fR "\|]" .RB "[\|" \-V\ |\ \-\-version\fR "\|]" .RB "[\|" \-\-help\fR "\|]" @@ -157,6 +160,10 @@ selected by the \fB\-b\fP or \fB\-\-byte\fP option. The default is 4. The interleave is ignored if neither \fB\-b\fP nor \fB\-\-byte\fP is given. .TP +.B \-p\fR, \fB\-\-preserve\-dates +Set the access and modification dates of the output file to be the same +as those of the input file. +.TP .B \-\-debugging Convert debugging information, if possible. This is not the default because only certain debugging formats are supported, and the @@ -219,13 +226,29 @@ only works on file formats which can support sections with arbitrary names. .TP +.B \-\-change\-leading\-char +Some object file formats use special characters at the start of +symbols. The most common such character is underscore, which compilers +often add before every symbol. This option tells +.B objcopy +to change the leading character of every symbol when it converts +between object file formats. If the object file formats use the same +leading character, this option has no effect. Otherwise, it will add +a character, or remove a character, or change a character, as +appropriate. +.TP .B \-\-remove\-leading\-char If the first character of a global symbol is a special symbol leading character used by the object file format, remove the character. The most common symbol leading character is underscore. This option will -remove a leading underscore from all global symbols. This can be useful -if you want to link together objects of different file formats with -different conventions for symbol names. +remove a leading underscore from all global symbols. This can be +useful if you want to link together objects of different file formats +with different conventions for symbol names. This is different from +@code{--change-leading-char} because it always changes the symbol name +when appropriate, regardless of the object file format of the output +.TP +.B \-\-weaken +Change all global symbols in the file to be weak. .TP .B \-v\fR, \fB\-\-verbose Verbose output: list all object files modified. In the case of @@ -251,7 +274,7 @@ \&, Roland H. Pesch (June 1993). .SH COPYING -Copyright (c) 1993, 94, 95, 1996 Free Software Foundation, Inc. +Copyright (c) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. .PP Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice diff -urN binutils-2.7/binutils/objcopy.c binutils-2.8/binutils/objcopy.c --- binutils-2.7/binutils/objcopy.c Thu Jul 4 12:23:47 1996 +++ binutils-2.8/binutils/objcopy.c Wed Apr 30 12:59:13 1997 @@ -1,5 +1,5 @@ /* objcopy.c -- copy object file from input to output, optionally massaging it. - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -25,6 +25,16 @@ #include "budbg.h" #include +#ifdef HAVE_GOOD_UTIME_H +#include +#else /* ! HAVE_GOOD_UTIME_H */ +#ifdef HAVE_UTIMES +#include +#endif /* HAVE_UTIMES */ +#endif /* ! HAVE_GOOD_UTIME_H */ + +static void copy_usage PARAMS ((FILE *, int)); +static void strip_usage PARAMS ((FILE *, int)); static flagword parse_flags PARAMS ((const char *)); static struct section_list *find_section_list PARAMS ((const char *, boolean)); static void setup_section PARAMS ((bfd *, asection *, PTR)); @@ -35,9 +45,19 @@ static boolean is_strip_symbol PARAMS ((const char *)); static boolean is_strip_section PARAMS ((bfd *, asection *)); static unsigned int filter_symbols - PARAMS ((bfd *, asymbol **, asymbol **, long)); + PARAMS ((bfd *, bfd *, asymbol **, asymbol **, long)); static void mark_symbols_used_in_relocations PARAMS ((bfd *, asection *, PTR)); +static void filter_bytes PARAMS ((char *, bfd_size_type *)); static boolean write_debugging_info PARAMS ((bfd *, PTR, long *, asymbol ***)); +static void copy_object PARAMS ((bfd *, bfd *)); +static void copy_archive PARAMS ((bfd *, bfd *, const char *)); +static void copy_file + PARAMS ((const char *, const char *, const char *, const char *)); +static int simple_copy PARAMS ((const char *, const char *)); +static int smart_rename PARAMS ((const char *, const char *)); +static void make_same_dates PARAMS ((const char *, const char *)); +static int strip_main PARAMS ((int, char **)); +static int copy_main PARAMS ((int, char **)); #define nonfatal(s) {bfd_nonfatal(s); status = 1; return;} @@ -138,6 +158,10 @@ static boolean convert_debugging = false; +/* Whether to change the leading character in symbol names. */ + +static boolean change_leading_char = false; + /* Whether to remove the leading character from global symbol names. */ static boolean remove_leading_char = false; @@ -149,7 +173,8 @@ #define OPTION_ADJUST_VMA (OPTION_ADJUST_START + 1) #define OPTION_ADJUST_SECTION_VMA (OPTION_ADJUST_VMA + 1) #define OPTION_ADJUST_WARNINGS (OPTION_ADJUST_SECTION_VMA + 1) -#define OPTION_DEBUGGING (OPTION_ADJUST_WARNINGS + 1) +#define OPTION_CHANGE_LEADING_CHAR (OPTION_ADJUST_WARNINGS + 1) +#define OPTION_DEBUGGING (OPTION_CHANGE_LEADING_CHAR + 1) #define OPTION_GAP_FILL (OPTION_DEBUGGING + 1) #define OPTION_NO_ADJUST_WARNINGS (OPTION_GAP_FILL + 1) #define OPTION_PAD_TO (OPTION_NO_ADJUST_WARNINGS + 1) @@ -157,6 +182,7 @@ #define OPTION_SET_SECTION_FLAGS (OPTION_REMOVE_LEADING_CHAR + 1) #define OPTION_SET_START (OPTION_SET_SECTION_FLAGS + 1) #define OPTION_STRIP_UNNEEDED (OPTION_SET_START + 1) +#define OPTION_WEAKEN (OPTION_STRIP_UNNEEDED + 1) /* Options to handle if running as "strip". */ @@ -171,6 +197,7 @@ {"keep-symbol", required_argument, 0, 'K'}, {"output-format", required_argument, 0, 'O'}, /* Obsolete */ {"output-target", required_argument, 0, 'O'}, + {"preserve-dates", no_argument, 0, 'p'}, {"remove-section", required_argument, 0, 'R'}, {"strip-all", no_argument, 0, 's'}, {"strip-debug", no_argument, 0, 'S'}, @@ -192,6 +219,7 @@ {"adjust-section-vma", required_argument, 0, OPTION_ADJUST_SECTION_VMA}, {"adjust-warnings", no_argument, 0, OPTION_ADJUST_WARNINGS}, {"byte", required_argument, 0, 'b'}, + {"change-leading-char", no_argument, 0, OPTION_CHANGE_LEADING_CHAR}, {"debugging", no_argument, 0, OPTION_DEBUGGING}, {"discard-all", no_argument, 0, 'x'}, {"discard-locals", no_argument, 0, 'X'}, @@ -206,6 +234,7 @@ {"output-format", required_argument, 0, 'O'}, /* Obsolete */ {"output-target", required_argument, 0, 'O'}, {"pad-to", required_argument, 0, OPTION_PAD_TO}, + {"preserve-dates", no_argument, 0, 'p'}, {"remove-leading-char", no_argument, 0, OPTION_REMOVE_LEADING_CHAR}, {"remove-section", required_argument, 0, 'R'}, {"set-section-flags", required_argument, 0, OPTION_SET_SECTION_FLAGS}, @@ -217,12 +246,12 @@ {"target", required_argument, 0, 'F'}, {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, + {"weaken", no_argument, 0, OPTION_WEAKEN}, {0, no_argument, 0, 0} }; /* IMPORTS */ extern char *program_name; -extern char *program_version; /* This flag distinguishes between strip and objcopy: 1 means this is 'strip'; 0 means this is 'objcopy'. @@ -236,22 +265,24 @@ int exit_status; { fprintf (stream, "\ -Usage: %s [-vVSgxX] [-I bfdname] [-O bfdname] [-F bfdname] [-b byte]\n\ +Usage: %s [-vVSpgxX] [-I bfdname] [-O bfdname] [-F bfdname] [-b byte]\n\ [-R section] [-i interleave] [--interleave=interleave] [--byte=byte]\n\ [--input-target=bfdname] [--output-target=bfdname] [--target=bfdname]\n\ [--strip-all] [--strip-debug] [--strip-unneeded] [--discard-all]\n\ [--discard-locals] [--debugging] [--remove-section=section]\n", program_name); fprintf (stream, "\ - [--gap-fill=val] [--pad-to=address]\n\ + [--gap-fill=val] [--pad-to=address] [--preserve-dates]\n\ [--set-start=val] [--adjust-start=incr]\n\ [--adjust-vma=incr] [--adjust-section-vma=section{=,+,-}val]\n\ [--adjust-warnings] [--no-adjust-warnings]\n\ [--set-section-flags=section=flags] [--add-section=sectionname=filename]\n\ [--keep-symbol symbol] [-K symbol] [--strip-symbol symbol] [-N symbol]\n\ - [--remove-leading-char] [--verbose] [--version] [--help]\n\ - in-file [out-file]\n"); + [--change-leading-char] [--remove-leading-char] [--weaken] [--verbose]\n\ + [--version] [--help] in-file [out-file]\n"); list_supported_targets (program_name, stream); + if (exit_status == 0) + fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); exit (exit_status); } @@ -261,14 +292,16 @@ int exit_status; { fprintf (stream, "\ -Usage: %s [-vVsSgxX] [-I bfdname] [-O bfdname] [-F bfdname] [-R section]\n\ +Usage: %s [-vVsSpgxX] [-I bfdname] [-O bfdname] [-F bfdname] [-R section]\n\ [--input-target=bfdname] [--output-target=bfdname] [--target=bfdname]\n\ [--strip-all] [--strip-debug] [--strip-unneeded] [--discard-all]\n\ [--discard-locals] [--keep-symbol symbol] [-K symbol]\n\ [--strip-symbol symbol] [-N symbol] [--remove-section=section]\n\ - [-o file] [--verbose] [--version] [--help] file...\n", + [-o file] [--preserve-dates] [--verbose] [--version] [--help] file...\n", program_name); list_supported_targets (program_name, stream); + if (exit_status == 0) + fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); exit (exit_status); } @@ -363,6 +396,10 @@ static boolean keep_symbols = false; +/* If this is true, we weaken global symbols (set BSF_WEAK). */ + +static boolean weaken = false; + /* Add a symbol to strip_specific_list. */ static void @@ -422,8 +459,9 @@ Return the number of symbols to print. */ static unsigned int -filter_symbols (abfd, osyms, isyms, symcount) +filter_symbols (abfd, obfd, osyms, isyms, symcount) bfd *abfd; + bfd *obfd; asymbol **osyms, **isyms; long symcount; { @@ -436,6 +474,29 @@ flagword flags = sym->flags; int keep; + if (change_leading_char + && (bfd_get_symbol_leading_char (abfd) + != bfd_get_symbol_leading_char (obfd)) + && (bfd_get_symbol_leading_char (abfd) == '\0' + || (bfd_asymbol_name (sym)[0] + == bfd_get_symbol_leading_char (abfd)))) + { + if (bfd_get_symbol_leading_char (obfd) == '\0') + bfd_asymbol_name (sym) = bfd_asymbol_name (sym) + 1; + else + { + char *n; + + n = xmalloc (strlen (bfd_asymbol_name (sym)) + 2); + n[0] = bfd_get_symbol_leading_char (obfd); + if (bfd_get_symbol_leading_char (abfd) == '\0') + strcpy (n + 1, bfd_asymbol_name (sym)); + else + strcpy (n + 1, bfd_asymbol_name (sym) + 1); + bfd_asymbol_name (sym) = n; + } + } + if (remove_leading_char && ((flags & BSF_GLOBAL) != 0 || (flags & BSF_WEAK) != 0 @@ -466,6 +527,12 @@ if (keep && is_strip_section (abfd, bfd_get_section (sym))) keep = 0; + if (keep && weaken && (flags & BSF_GLOBAL) != 0) + { + sym->flags &=~ BSF_GLOBAL; + sym->flags |= BSF_WEAK; + } + if (keep) to[dst_count++] = sym; } @@ -478,7 +545,7 @@ /* Keep only every `copy_byte'th byte in MEMHUNK, which is *SIZE bytes long. Adjust *SIZE. */ -void +static void filter_bytes (memhunk, size) char *memhunk; bfd_size_type *size; @@ -713,7 +780,9 @@ || strip_specific_list != NULL || sections_removed || convert_debugging - || remove_leading_char) + || change_leading_char + || remove_leading_char + || weaken) { /* Mark symbols used in output relocations so that they are kept, even if they are local labels or static symbols. @@ -727,7 +796,7 @@ mark_symbols_used_in_relocations, (PTR)isympp); osympp = (asymbol **) xmalloc ((symcount + 1) * sizeof (asymbol *)); - symcount = filter_symbols (ibfd, osympp, isympp, symcount); + symcount = filter_symbols (ibfd, obfd, osympp, isympp, symcount); } if (convert_debugging && dhandle != NULL) @@ -815,21 +884,6 @@ } } -static char * -cat (a, b, c) - char *a; - char *b; - char *c; -{ - size_t size = strlen (a) + strlen (b) + strlen (c); - char *r = xmalloc (size + 1); - - strcpy (r, a); - strcat (r, b); - strcat (r, c); - return r; -} - /* Read each archive element in turn from IBFD, copy the contents to temp file, and keep the temp file handle. */ @@ -837,7 +891,7 @@ copy_archive (ibfd, obfd, output_target) bfd *ibfd; bfd *obfd; - char *output_target; + const char *output_target; { struct name_list { @@ -863,7 +917,8 @@ while (this_element != (bfd *) NULL) { /* Create an output file for this member. */ - char *output_name = cat (dir, "/", bfd_get_filename(this_element)); + char *output_name = concat (dir, "/", bfd_get_filename(this_element), + (char *) NULL); bfd *output_bfd = bfd_openw (output_name, output_target); bfd *last_element; @@ -927,10 +982,10 @@ static void copy_file (input_filename, output_filename, input_target, output_target) - char *input_filename; - char *output_filename; - char *input_target; - char *output_target; + const char *input_filename; + const char *output_filename; + const char *input_target; + const char *output_target; { bfd *ibfd; char **matching; @@ -1387,7 +1442,8 @@ static int simple_copy (from, to) - char *from, *to; + const char *from; + const char *to; { int fromfd, tofd, nread; int saved; @@ -1441,7 +1497,8 @@ static int smart_rename (from, to) - char *from, *to; + const char *from; + const char *to; { struct stat s; int ret = 0; @@ -1496,6 +1553,57 @@ return ret; } +/* Set the date of the file DESTINATION to be the same as the date of + the file SOURCE. */ + +static void +make_same_dates (source, destination) + const char *source; + const char *destination; +{ + struct stat statbuf; + int result; + + if (stat (source, &statbuf) < 0) + { + fprintf (stderr, "%s: ", source); + perror ("cannot stat"); + return; + } + + { +#ifdef HAVE_GOOD_UTIME_H + struct utimbuf tb; + + tb.actime = statbuf.st_atime; + tb.modtime = statbuf.st_mtime; + result = utime (destination, &tb); +#else /* ! HAVE_GOOD_UTIME_H */ +#ifndef HAVE_UTIMES + long tb[2]; + + tb[0] = statbuf.st_atime; + tb[1] = statbuf.st_mtime; + result = utime (destination, tb); +#else /* HAVE_UTIMES */ + struct timeval tv[2]; + + tv[0].tv_sec = statbuf.st_atime; + tv[0].tv_usec = 0; + tv[1].tv_sec = statbuf.st_mtime; + tv[1].tv_usec = 0; + result = utimes (destination, tv); +#endif /* HAVE_UTIMES */ +#endif /* ! HAVE_GOOD_UTIME_H */ + } + + if (result != 0) + { + fprintf (stderr, "%s: ", destination); + perror ("can not set time"); + } +} + static int strip_main (argc, argv) int argc; @@ -1503,11 +1611,12 @@ { char *input_target = NULL, *output_target = NULL; boolean show_version = false; + boolean preserve_dates = false; int c, i; struct section_list *p; char *output_file = NULL; - while ((c = getopt_long (argc, argv, "I:O:F:K:N:R:o:sSgxXVv", + while ((c = getopt_long (argc, argv, "I:O:F:K:N:R:o:sSpgxXVv", strip_options, (int *) 0)) != EOF) { switch (c) @@ -1558,6 +1667,9 @@ case 'o': output_file = optarg; break; + case 'p': + preserve_dates = true; + break; case 'x': discard_locals = locals_all; break; @@ -1580,10 +1692,7 @@ } if (show_version) - { - printf ("GNU %s version %s\n", program_name, program_version); - exit (0); - } + print_version ("strip"); /* Default is to strip all symbols. */ if (strip_symbols == strip_undef @@ -1612,6 +1721,8 @@ copy_file (argv[i], tmpname, input_target, output_target); if (status == 0) { + if (preserve_dates) + make_same_dates (argv[i], tmpname); if (output_file == NULL) smart_rename (tmpname, argv[i]); status = hold_status; @@ -1634,10 +1745,11 @@ char *input_target = NULL, *output_target = NULL; boolean show_version = false; boolean adjust_warn = true; + boolean preserve_dates = false; int c; struct section_list *p; - while ((c = getopt_long (argc, argv, "b:i:I:K:N:s:O:d:F:R:SgxXVv", + while ((c = getopt_long (argc, argv, "b:i:I:K:N:s:O:d:F:R:SpgxXVv", copy_options, (int *) 0)) != EOF) { switch (c) @@ -1704,6 +1816,9 @@ } add_strip_symbol (optarg); break; + case 'p': + preserve_dates = true; + break; case 'x': discard_locals = locals_all; break; @@ -1716,6 +1831,9 @@ case 'V': show_version = true; break; + case OPTION_WEAKEN: + weaken = true; + break; case OPTION_ADD_SECTION: { const char *s; @@ -1826,6 +1944,9 @@ case OPTION_ADJUST_WARNINGS: adjust_warn = true; break; + case OPTION_CHANGE_LEADING_CHAR: + change_leading_char = true; + break; case OPTION_DEBUGGING: convert_debugging = true; break; @@ -1894,10 +2015,7 @@ } if (show_version) - { - printf ("GNU %s version %s\n", program_name, program_version); - exit (0); - } + print_version ("objcopy"); if (copy_byte >= interleave) { @@ -1926,15 +2044,22 @@ if (output_filename == (char *) NULL) { char *tmpname = make_tempname (input_filename); + copy_file (input_filename, tmpname, input_target, output_target); if (status == 0) - smart_rename (tmpname, input_filename); + { + if (preserve_dates) + make_same_dates (input_filename, tmpname); + smart_rename (tmpname, input_filename); + } else unlink (tmpname); } else { copy_file (input_filename, output_filename, input_target, output_target); + if (status == 0 && preserve_dates) + make_same_dates (input_filename, output_filename); } if (adjust_warn) @@ -1969,6 +2094,7 @@ discard_locals = locals_undef; bfd_init (); + set_default_bfd_target (); if (is_strip < 0) { diff -urN binutils-2.7/binutils/objdump.1 binutils-2.8/binutils/objdump.1 --- binutils-2.7/binutils/objdump.1 Thu Jul 4 12:23:48 1996 +++ binutils-2.8/binutils/objdump.1 Wed Apr 30 12:59:14 1997 @@ -1,4 +1,4 @@ -.\" Copyright (c) 1991, 1996 Free Software Foundation +.\" Copyright (c) 1991, 1996, 1997 Free Software Foundation .\" See section COPYING for conditions for redistribution .TH objdump 1 "5 November 1991" "cygnus support" "GNU Development Tools" .de BP @@ -21,9 +21,11 @@ .RB " | " "\-\-target="\c .I bfdname\c \&\|] +.RB "[\|" \-C | \-\-demangle "\|]" .RB "[\|" \-\-debugging "\|]" .RB "[\|" \-d | \-\-disassemble "\|]" .RB "[\|" \-D | \-\-disassemble-all "\|]" +.RB "[\|" \-\-disassemble\-zeroes "\|]" .RB "[\|" \-EB | \-EL | \-\-endian=\c .I {big|little}\c \&\|] @@ -42,11 +44,12 @@ .RB " | " "\-\-architecture="\c .I machine\c \&\|] +.RB "[\|" \-\-prefix\-addresses "\|]" .RB "[\|" \-r | \-\-reloc "\|]" .RB "[\|" \-R | \-\-dynamic\-reloc "\|]" .RB "[\|" \-s | \-\-full\-contents "\|]" .RB "[\|" \-S | \-\-source "\|]" -.RB "[\|" \-\-show\-raw\-insn "\|]" +.RB "[\|" \-\-[no\-]show\-raw\-insn "\|]" .RB "[\|" \-\-stabs "\|]" .RB "[\|" \-t | \-\-syms "\|]" .RB "[\|" \-T | \-\-dynamic\-syms "\|]" @@ -57,6 +60,9 @@ .RB "[\|" "\-\-stop\-address="\c .I address\c \&\|] +.RB "[\|" "\-\-adjust\-vma="\c +.I offset\c +\&\|] .RB "[\|" \-\-version "\|]" .RB "[\|" \-\-help "\|]" .I objfile\c @@ -102,6 +108,15 @@ the object file format of each archive member. .TP +.BI "\-\-adjust\-vma=" "offset" +When dumping information, first add +.I offset +to all the section addresses. This is useful if the section addresses +do not correspond to the symbol table, which can happen when putting +sections at particular addresses when using a format which can not +represent section addresses, such as a.out. + +.TP .BI "\-b " "bfdname"\c .TP .BI "\-\-target=" "bfdname" @@ -131,6 +146,14 @@ \|' option. .TP +.B \-C +.TP +.B \-\-demangle +Decode (\fIdemangle\fP) low-level symbol names into user-level names. +Besides removing any initial underscore prepended by the system, this +makes C++ function names readable. + +.TP .B \-\-debugging Display debugging information. This attempts to parse debugging information stored in the file and print it out using a C like syntax. @@ -155,6 +178,17 @@ those expected to contain instructions. .TP +.B \-\-prefix\-addresses +When disassembling, print the complete address on each line. This is +the older disassembly format. + +.TP +.B \-\-disassemble\-zeroes +Normally the disassembly output will skip blocks of zeroes. This +option directs the disassembler to disassemble those blocks, just like +any other data. + +.TP .B \-EB .TP .B \-EL @@ -254,9 +288,18 @@ \fB-d\fP. .TP -.B \-\-show-raw-insn +.B \-\-show\-raw\-insn When disassembling instructions, print the instruction in hex as well as -in symbolic form. Not all targets handle this correctly yet. +in symbolic form. This is the default except when +.B \-\-prefix\-addresses +is used. + +.TP +.B \-\-no\-show\-raw\-insn +When disassembling instructions, do not print the instruction bytes. +This is the default when +.B \-\-prefix\-addresses +is used. .TP .B \-\-stabs diff -urN binutils-2.7/binutils/objdump.c binutils-2.8/binutils/objdump.c --- binutils-2.7/binutils/objdump.c Thu Jul 4 12:23:49 1996 +++ binutils-2.8/binutils/objdump.c Wed Apr 30 12:59:14 1997 @@ -1,5 +1,5 @@ /* objdump.c -- dump information about an object file. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -24,6 +24,7 @@ #include #include "dis-asm.h" #include "libiberty.h" +#include "demangle.h" #include "debug.h" #include "budbg.h" @@ -44,8 +45,6 @@ static char *default_target = NULL; /* default at runtime */ -extern char *program_version; - static int show_version = 0; /* show the version number */ static int dump_section_contents; /* -s */ static int dump_section_headers; /* -h */ @@ -56,18 +55,22 @@ static int dump_dynamic_reloc_info; /* -R */ static int dump_ar_hdrs; /* -a */ static int dump_private_headers; /* -p */ +static int prefix_addresses; /* --prefix-addresses */ static int with_line_numbers; /* -l */ static boolean with_source_code; /* -S */ static int show_raw_insn; /* --show-raw-insn */ static int dump_stab_section_info; /* --stabs */ +static int do_demangle; /* -C, --demangle */ static boolean disassemble; /* -d */ static boolean disassemble_all; /* -D */ +static int disassemble_zeroes; /* --disassemble-zeroes */ static boolean formats_info; /* -i */ static char *only; /* -j secname */ static int wide_output; /* -w */ static bfd_vma start_address = (bfd_vma) -1; /* --start-address */ static bfd_vma stop_address = (bfd_vma) -1; /* --stop-address */ static int dump_debugging; /* --debugging */ +static bfd_vma adjust_section_vma = 0; /* --adjust-vma */ /* Extra info to pass to the disassembler address printing function. */ struct objdump_disasm_info { @@ -100,12 +103,21 @@ /* Number of symbols in `dynsyms'. */ static long dynsymcount = 0; -/* Forward declarations. */ +/* Static declarations. */ + +static void +usage PARAMS ((FILE *, int)); static void display_file PARAMS ((char *filename, char *target)); static void +dump_section_header PARAMS ((bfd *, asection *, PTR)); + +static void +dump_headers PARAMS ((bfd *)); + +static void dump_data PARAMS ((bfd *abfd)); static void @@ -121,10 +133,41 @@ dump_symbols PARAMS ((bfd *abfd, boolean dynamic)); static void +dump_bfd_header PARAMS ((bfd *)); + +static void +dump_bfd_private_header PARAMS ((bfd *)); + +static void display_bfd PARAMS ((bfd *abfd)); static void -objdump_print_value PARAMS ((bfd_vma, struct disassemble_info *)); +display_target_list PARAMS ((void)); + +static void +display_info_table PARAMS ((int, int)); + +static void +display_target_tables PARAMS ((void)); + +static void +display_info PARAMS ((void)); + +static void +objdump_print_value PARAMS ((bfd_vma, struct disassemble_info *, boolean)); + +static void +objdump_print_symname PARAMS ((bfd *, struct disassemble_info *, asymbol *)); + +static asymbol * +find_symbol_for_address PARAMS ((bfd *, asection *, bfd_vma, boolean, long *)); + +static void +objdump_print_addr_with_sym PARAMS ((bfd *, asection *, asymbol *, bfd_vma, + struct disassemble_info *, boolean)); + +static void +objdump_print_addr PARAMS ((bfd_vma, struct disassemble_info *, boolean)); static void objdump_print_address PARAMS ((bfd_vma, struct disassemble_info *)); @@ -132,8 +175,40 @@ static void show_line PARAMS ((bfd *, asection *, bfd_vma)); +static void +disassemble_bytes PARAMS ((struct disassemble_info *, disassembler_ftype, + boolean, bfd_byte *, long, long, arelent ***, + arelent **)); + +static void +disassemble_data PARAMS ((bfd *)); + static const char * endian_string PARAMS ((enum bfd_endian)); + +static asymbol ** +slurp_symtab PARAMS ((bfd *)); + +static asymbol ** +slurp_dynamic_symtab PARAMS ((bfd *)); + +static long +remove_useless_symbols PARAMS ((asymbol **, long)); + +static int +compare_symbols PARAMS ((const PTR, const PTR)); + +static int +compare_relocs PARAMS ((const PTR, const PTR)); + +static void +dump_stabs PARAMS ((bfd *)); + +static boolean +read_section_stabs PARAMS ((bfd *, const char *, const char *)); + +static void +print_section_stabs PARAMS ((bfd *, const char *, const char *)); static void usage (stream, status) @@ -141,9 +216,10 @@ int status; { fprintf (stream, "\ -Usage: %s [-ahifdDprRtTxsSlw] [-b bfdname] [-m machine] [-j section-name]\n\ +Usage: %s [-ahifCdDprRtTxsSlw] [-b bfdname] [-m machine] [-j section-name]\n\ [--archive-headers] [--target=bfdname] [--debugging] [--disassemble]\n\ - [--disassemble-all] [--file-headers] [--section-headers] [--headers]\n\ + [--disassemble-all] [--disassemble-zeroes] [--file-headers]\n\ + [--section-headers] [--headers]\n\ [--info] [--section=section-name] [--line-numbers] [--source]\n", program_name); fprintf (stream, "\ @@ -151,9 +227,12 @@ [--syms] [--all-headers] [--dynamic-syms] [--dynamic-reloc]\n\ [--wide] [--version] [--help] [--private-headers]\n\ [--start-address=addr] [--stop-address=addr]\n\ - [--show-raw-insn] [-EB|-EL] [--endian={big|little}] objfile...\n\ + [--prefix-addresses] [--[no-]show-raw-insn] [--demangle]\n\ + [--adjust-vma=offset] [-EB|-EL] [--endian={big|little}] objfile...\n\ at least one option besides -l (--line-numbers) must be given\n"); list_supported_targets (program_name, stream); + if (status == 0) + fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); exit (status); } @@ -162,16 +241,20 @@ #define OPTION_ENDIAN (150) #define OPTION_START_ADDRESS (OPTION_ENDIAN + 1) #define OPTION_STOP_ADDRESS (OPTION_START_ADDRESS + 1) +#define OPTION_ADJUST_VMA (OPTION_STOP_ADDRESS + 1) static struct option long_options[]= { + {"adjust-vma", required_argument, NULL, OPTION_ADJUST_VMA}, {"all-headers", no_argument, NULL, 'x'}, {"private-headers", no_argument, NULL, 'p'}, {"architecture", required_argument, NULL, 'm'}, {"archive-headers", no_argument, NULL, 'a'}, {"debugging", no_argument, &dump_debugging, 1}, + {"demangle", no_argument, &do_demangle, 1}, {"disassemble", no_argument, NULL, 'd'}, {"disassemble-all", no_argument, NULL, 'D'}, + {"disassemble-zeroes", no_argument, &disassemble_zeroes, 1}, {"dynamic-reloc", no_argument, NULL, 'R'}, {"dynamic-syms", no_argument, NULL, 'T'}, {"endian", required_argument, NULL, OPTION_ENDIAN}, @@ -181,6 +264,8 @@ {"help", no_argument, NULL, 'H'}, {"info", no_argument, NULL, 'i'}, {"line-numbers", no_argument, NULL, 'l'}, + {"no-show-raw-insn", no_argument, &show_raw_insn, -1}, + {"prefix-addresses", no_argument, &prefix_addresses, 1}, {"reloc", no_argument, NULL, 'r'}, {"section", required_argument, NULL, 'j'}, {"section-headers", no_argument, NULL, 'h'}, @@ -437,8 +522,8 @@ if (! af && bf) return -1; - /* Try to sort global symbols before local symbols before debugging - symbols. */ + /* Try to sort global symbols before local symbols before function + symbols before debugging symbols. */ aflags = a->flags; bflags = b->flags; @@ -450,6 +535,13 @@ else return -1; } + if ((aflags & BSF_FUNCTION) != (bflags & BSF_FUNCTION)) + { + if ((aflags & BSF_FUNCTION) != 0) + return -1; + else + return 1; + } if ((aflags & BSF_LOCAL) != (bflags & BSF_LOCAL)) { if ((aflags & BSF_LOCAL) != 0) @@ -502,31 +594,81 @@ return 0; } -/* Print VMA to STREAM with no leading zeroes. */ +/* Print VMA to STREAM. If SKIP_ZEROES is true, omit leading zeroes. */ static void -objdump_print_value (vma, info) +objdump_print_value (vma, info, skip_zeroes) bfd_vma vma; struct disassemble_info *info; + boolean skip_zeroes; { char buf[30]; char *p; sprintf_vma (buf, vma); - for (p = buf; *p == '0'; ++p) - ; + if (! skip_zeroes) + p = buf; + else + { + for (p = buf; *p == '0'; ++p) + ; + if (*p == '\0') + --p; + } (*info->fprintf_func) (info->stream, "%s", p); } -/* Print VMA symbolically to INFO if possible. */ +/* Print the name of a symbol. */ static void -objdump_print_address (vma, info) - bfd_vma vma; +objdump_print_symname (abfd, info, sym) + bfd *abfd; struct disassemble_info *info; + asymbol *sym; { - char buf[30]; + char *alloc; + const char *name; + const char *print; + + alloc = NULL; + name = bfd_asymbol_name (sym); + if (! do_demangle || name[0] == '\0') + print = name; + else + { + /* Demangle the name. */ + if (bfd_get_symbol_leading_char (abfd) == name[0]) + ++name; + + alloc = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS); + if (alloc == NULL) + print = name; + else + print = alloc; + } + + if (info != NULL) + (*info->fprintf_func) (info->stream, "%s", print); + else + printf ("%s", print); + if (alloc != NULL) + free (alloc); +} + +/* Locate a symbol given a bfd, a section, and a VMA. If REQUIRE_SEC + is true, then always require the symbol to be in the section. This + returns NULL if there is no suitable symbol. If PLACE is not NULL, + then *PLACE is set to the index of the symbol in sorted_syms. */ + +static asymbol * +find_symbol_for_address (abfd, sec, vma, require_sec, place) + bfd *abfd; + asection *sec; + bfd_vma vma; + boolean require_sec; + long *place; +{ /* @@ Would it speed things up to cache the last two symbols returned, and maybe their address ranges? For many processors, only one memory operand can be present at a time, so the 2-entry cache wouldn't be @@ -537,11 +679,8 @@ long max = sorted_symcount; long thisplace; - sprintf_vma (buf, vma); - (*info->fprintf_func) (info->stream, "%s", buf); - if (sorted_symcount < 1) - return; + return NULL; /* Perform a binary search looking for the closest symbol to the required value. We are searching the range (min, max]. */ @@ -572,102 +711,160 @@ == bfd_asymbol_value (sorted_syms[thisplace - 1]))) --thisplace; - { - /* If the file is relocateable, and the symbol could be from this - section, prefer a symbol from this section over symbols from - others, even if the other symbol's value might be closer. + /* If the file is relocateable, and the symbol could be from this + section, prefer a symbol from this section over symbols from + others, even if the other symbol's value might be closer. - Note that this may be wrong for some symbol references if the - sections have overlapping memory ranges, but in that case there's - no way to tell what's desired without looking at the relocation - table. */ - struct objdump_disasm_info *aux; - long i; - - aux = (struct objdump_disasm_info *) info->application_data; - if (sorted_syms[thisplace]->section != aux->sec - && (aux->require_sec - || ((aux->abfd->flags & HAS_RELOC) != 0 - && vma >= bfd_get_section_vma (aux->abfd, aux->sec) - && vma < (bfd_get_section_vma (aux->abfd, aux->sec) - + bfd_section_size (aux->abfd, aux->sec))))) - { - for (i = thisplace + 1; i < sorted_symcount; i++) - { - if (bfd_asymbol_value (sorted_syms[i]) - != bfd_asymbol_value (sorted_syms[thisplace])) + Note that this may be wrong for some symbol references if the + sections have overlapping memory ranges, but in that case there's + no way to tell what's desired without looking at the relocation + table. */ + + if (sorted_syms[thisplace]->section != sec + && (require_sec + || ((abfd->flags & HAS_RELOC) != 0 + && vma >= bfd_get_section_vma (abfd, sec) + && vma < (bfd_get_section_vma (abfd, sec) + + bfd_section_size (abfd, sec))))) + { + long i; + + for (i = thisplace + 1; i < sorted_symcount; i++) + { + if (bfd_asymbol_value (sorted_syms[i]) + != bfd_asymbol_value (sorted_syms[thisplace])) + break; + } + --i; + for (; i >= 0; i--) + { + if (sorted_syms[i]->section == sec + && (i == 0 + || sorted_syms[i - 1]->section != sec + || (bfd_asymbol_value (sorted_syms[i]) + != bfd_asymbol_value (sorted_syms[i - 1])))) + { + thisplace = i; break; - } - --i; - for (; i >= 0; i--) - { - if (sorted_syms[i]->section == aux->sec - && (i == 0 - || sorted_syms[i - 1]->section != aux->sec - || (bfd_asymbol_value (sorted_syms[i]) - != bfd_asymbol_value (sorted_syms[i - 1])))) - { - thisplace = i; - break; - } - } + } + } - if (sorted_syms[thisplace]->section != aux->sec) - { - /* We didn't find a good symbol with a smaller value. - Look for one with a larger value. */ - for (i = thisplace + 1; i < sorted_symcount; i++) - { - if (sorted_syms[i]->section == aux->sec) - { - thisplace = i; - break; - } - } - } + if (sorted_syms[thisplace]->section != sec) + { + /* We didn't find a good symbol with a smaller value. + Look for one with a larger value. */ + for (i = thisplace + 1; i < sorted_symcount; i++) + { + if (sorted_syms[i]->section == sec) + { + thisplace = i; + break; + } + } + } - if (sorted_syms[thisplace]->section != aux->sec - && (aux->require_sec - || ((aux->abfd->flags & HAS_RELOC) != 0 - && vma >= bfd_get_section_vma (aux->abfd, aux->sec) - && vma < (bfd_get_section_vma (aux->abfd, aux->sec) - + bfd_section_size (aux->abfd, aux->sec))))) - { - bfd_vma secaddr; + if (sorted_syms[thisplace]->section != sec + && (require_sec + || ((abfd->flags & HAS_RELOC) != 0 + && vma >= bfd_get_section_vma (abfd, sec) + && vma < (bfd_get_section_vma (abfd, sec) + + bfd_section_size (abfd, sec))))) + { + /* There is no suitable symbol. */ + return NULL; + } + } - (*info->fprintf_func) (info->stream, " <%s", - bfd_get_section_name (aux->abfd, aux->sec)); - secaddr = bfd_get_section_vma (aux->abfd, aux->sec); - if (vma < secaddr) - { - (*info->fprintf_func) (info->stream, "-"); - objdump_print_value (secaddr - vma, info); - } - else if (vma > secaddr) - { - (*info->fprintf_func) (info->stream, "+"); - objdump_print_value (vma - secaddr, info); - } - (*info->fprintf_func) (info->stream, ">"); - return; - } - } - } + if (place != NULL) + *place = thisplace; + + return sorted_syms[thisplace]; +} + +/* Print an address to INFO symbolically. */ + +static void +objdump_print_addr_with_sym (abfd, sec, sym, vma, info, skip_zeroes) + bfd *abfd; + asection *sec; + asymbol *sym; + bfd_vma vma; + struct disassemble_info *info; + boolean skip_zeroes; +{ + objdump_print_value (vma, info, skip_zeroes); - (*info->fprintf_func) (info->stream, " <%s", sorted_syms[thisplace]->name); - if (bfd_asymbol_value (sorted_syms[thisplace]) > vma) + if (sym == NULL) { - (*info->fprintf_func) (info->stream, "-"); - objdump_print_value (bfd_asymbol_value (sorted_syms[thisplace]) - vma, - info); + bfd_vma secaddr; + + (*info->fprintf_func) (info->stream, " <%s", + bfd_get_section_name (abfd, sec)); + secaddr = bfd_get_section_vma (abfd, sec); + if (vma < secaddr) + { + (*info->fprintf_func) (info->stream, "-"); + objdump_print_value (secaddr - vma, info, true); + } + else if (vma > secaddr) + { + (*info->fprintf_func) (info->stream, "+"); + objdump_print_value (vma - secaddr, info, true); + } + (*info->fprintf_func) (info->stream, ">"); } - else if (vma > bfd_asymbol_value (sorted_syms[thisplace])) + else { - (*info->fprintf_func) (info->stream, "+"); - objdump_print_value (vma - bfd_asymbol_value (sorted_syms[thisplace]), - info); + (*info->fprintf_func) (info->stream, " <"); + objdump_print_symname (abfd, info, sym); + if (bfd_asymbol_value (sym) > vma) + { + (*info->fprintf_func) (info->stream, "-"); + objdump_print_value (bfd_asymbol_value (sym) - vma, info, true); + } + else if (vma > bfd_asymbol_value (sym)) + { + (*info->fprintf_func) (info->stream, "+"); + objdump_print_value (vma - bfd_asymbol_value (sym), info, true); + } + (*info->fprintf_func) (info->stream, ">"); } - (*info->fprintf_func) (info->stream, ">"); +} + +/* Print VMA to INFO, symbolically if possible. If SKIP_ZEROES is + true, don't output leading zeroes. */ + +static void +objdump_print_addr (vma, info, skip_zeroes) + bfd_vma vma; + struct disassemble_info *info; + boolean skip_zeroes; +{ + struct objdump_disasm_info *aux; + asymbol *sym; + + if (sorted_symcount < 1) + { + objdump_print_value (vma, info, skip_zeroes); + return; + } + + aux = (struct objdump_disasm_info *) info->application_data; + sym = find_symbol_for_address (aux->abfd, aux->sec, vma, aux->require_sec, + (long *) NULL); + objdump_print_addr_with_sym (aux->abfd, aux->sec, sym, vma, info, + skip_zeroes); +} + +/* Print VMA to INFO. This function is passed to the disassembler + routine. */ + +static void +objdump_print_address (vma, info) + bfd_vma vma; + struct disassemble_info *info; +{ + objdump_print_addr (vma, info, ! prefix_addresses); } /* Hold the last function name and the last line number we displayed @@ -910,18 +1107,336 @@ } #endif +/* The number of zeroes we want to see before we start skipping them. + The number is arbitrarily chosen. */ + +#define SKIP_ZEROES (8) + +/* The number of zeroes to skip at the end of a section. If the + number of zeroes at the end is between SKIP_ZEROES_AT_END and + SKIP_ZEROES, they will be disassembled. If there are fewer than + SKIP_ZEROES_AT_END, they will be skipped. This is a heuristic + attempt to avoid disassembling zeroes inserted by section + alignment. */ + +#define SKIP_ZEROES_AT_END (3) + +/* Disassemble some data in memory between given values. */ + +static void +disassemble_bytes (info, disassemble_fn, insns, data, start, stop, relppp, + relppend) + struct disassemble_info *info; + disassembler_ftype disassemble_fn; + boolean insns; + bfd_byte *data; + long start; + long stop; + arelent ***relppp; + arelent **relppend; +{ + struct objdump_disasm_info *aux; + asection *section; + int bytes_per_line; + boolean done_dot; + int skip_addr_chars; + long i; + + aux = (struct objdump_disasm_info *) info->application_data; + section = aux->sec; + + if (insns) + bytes_per_line = 4; + else + bytes_per_line = 16; + + /* Figure out how many characters to skip at the start of an + address, to make the disassembly look nicer. We discard leading + zeroes in chunks of 4, ensuring that there is always a leading + zero remaining. */ + skip_addr_chars = 0; + if (! prefix_addresses) + { + char buf[30]; + char *s; + + sprintf_vma (buf, + section->vma + bfd_section_size (section->owner, section)); + s = buf; + while (s[0] == '0' && s[1] == '0' && s[2] == '0' && s[3] == '0' + && s[4] == '0') + { + skip_addr_chars += 4; + s += 4; + } + } + + info->insn_info_valid = 0; + + done_dot = false; + i = start; + while (i < stop) + { + long z; + int bytes; + boolean need_nl = false; + + /* If we see more than SKIP_ZEROES bytes of zeroes, we just + print `...'. */ + for (z = i; z < stop; z++) + if (data[z] != 0) + break; + if (! disassemble_zeroes + && (info->insn_info_valid == 0 + || info->branch_delay_insns == 0) + && (z - i >= SKIP_ZEROES + || (z == stop && z - i < SKIP_ZEROES_AT_END))) + { + printf ("\t...\n"); + + /* If there are more nonzero bytes to follow, we only skip + zeroes in multiples of 4, to try to avoid running over + the start of an instruction which happens to start with + zero. */ + if (z != stop) + z = i + ((z - i) &~ 3); + + bytes = z - i; + } + else + { + char buf[1000]; + SFILE sfile; + int bpc, pb = 0; + + done_dot = false; + + if (with_line_numbers || with_source_code) + show_line (aux->abfd, section, i); + + if (! prefix_addresses) + { + char *s; + + sprintf_vma (buf, section->vma + i); + for (s = buf + skip_addr_chars; *s == '0'; s++) + *s = ' '; + if (*s == '\0') + *--s = '0'; + printf ("%s:\t", buf + skip_addr_chars); + } + else + { + aux->require_sec = true; + objdump_print_address (section->vma + i, info); + aux->require_sec = false; + putchar (' '); + } + + if (insns) + { + sfile.buffer = sfile.current = buf; + info->fprintf_func = (fprintf_ftype) objdump_sprintf; + info->stream = (FILE *) &sfile; + info->bytes_per_line = 0; + info->bytes_per_chunk = 0; + bytes = (*disassemble_fn) (section->vma + i, info); + info->fprintf_func = (fprintf_ftype) fprintf; + info->stream = stdout; + if (info->bytes_per_line != 0) + bytes_per_line = info->bytes_per_line; + if (bytes < 0) + break; + } + else + { + long j; + + bytes = bytes_per_line; + if (i + bytes > stop) + bytes = stop - i; + + for (j = i; j < i + bytes; ++j) + { + if (isprint (data[j])) + buf[j - i] = data[j]; + else + buf[j - i] = '.'; + } + buf[j - i] = '\0'; + } + + if (prefix_addresses + ? show_raw_insn > 0 + : show_raw_insn >= 0) + { + long j; + + /* If ! prefix_addresses and ! wide_output, we print + bytes_per_line bytes per line. */ + pb = bytes; + if (pb > bytes_per_line && ! prefix_addresses && ! wide_output) + pb = bytes_per_line; + + if (info->bytes_per_chunk) + bpc = info->bytes_per_chunk; + else + bpc = 1; + + for (j = i; j < i + pb; j += bpc) + { + int k; + if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE) + { + for (k = bpc - 1; k >= 0; k--) + printf ("%02x", (unsigned) data[j + k]); + putchar (' '); + } + else + { + for (k = 0; k < bpc; k++) + printf ("%02x", (unsigned) data[j + k]); + putchar (' '); + } + } + + for (; pb < bytes_per_line; pb += bpc) + { + int k; + + for (k = 0; k < bpc; k++) + printf (" "); + putchar (' '); + } + + /* Separate raw data from instruction by extra space. */ + if (insns) + putchar ('\t'); + else + printf (" "); + } + + printf ("%s", buf); + + if (prefix_addresses + ? show_raw_insn > 0 + : show_raw_insn >= 0) + { + while (pb < bytes) + { + long j; + char *s; + + putchar ('\n'); + j = i + pb; + + sprintf_vma (buf, section->vma + j); + for (s = buf + skip_addr_chars; *s == '0'; s++) + *s = ' '; + if (*s == '\0') + *--s = '0'; + printf ("%s:\t", buf + skip_addr_chars); + + pb += bytes_per_line; + if (pb > bytes) + pb = bytes; + for (; j < i + pb; j += bpc) + { + int k; + + if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE) + { + for (k = bpc - 1; k >= 0; k--) + printf ("%02x", (unsigned) data[j + k]); + putchar (' '); + } + else + { + for (k = 0; k < bpc; k++) + printf ("%02x", (unsigned) data[j + k]); + putchar (' '); + } + } + } + } + + if (!wide_output) + putchar ('\n'); + else + need_nl = true; + } + + if (dump_reloc_info + && (section->flags & SEC_RELOC) != 0) + { + while ((*relppp) < relppend + && ((**relppp)->address >= (bfd_vma) i + && (**relppp)->address < (bfd_vma) i + bytes)) + { + arelent *q; + + q = **relppp; + + if (wide_output) + putchar ('\t'); + else + printf ("\t\t\t"); + + objdump_print_value (section->vma + q->address, info, true); + + printf (": %s\t", q->howto->name); + + if (q->sym_ptr_ptr == NULL || *q->sym_ptr_ptr == NULL) + printf ("*unknown*"); + else + { + const char *sym_name; + + sym_name = bfd_asymbol_name (*q->sym_ptr_ptr); + if (sym_name != NULL && *sym_name != '\0') + objdump_print_symname (aux->abfd, info, *q->sym_ptr_ptr); + else + { + asection *sym_sec; + + sym_sec = bfd_get_section (*q->sym_ptr_ptr); + sym_name = bfd_get_section_name (aux->abfd, sym_sec); + if (sym_name == NULL || *sym_name == '\0') + sym_name = "*unknown*"; + printf ("%s", sym_name); + } + } + + if (q->addend) + { + printf ("+0x"); + objdump_print_value (q->addend, info, true); + } + + printf ("\n"); + need_nl = false; + ++(*relppp); + } + } + + if (need_nl) + printf ("\n"); + + i += bytes; + } +} + +/* Disassemble the contents of an object file. */ + static void disassemble_data (abfd) bfd *abfd; { long i; - disassembler_ftype disassemble_fn = 0; /* New style */ + disassembler_ftype disassemble_fn; struct disassemble_info disasm_info; struct objdump_disasm_info aux; asection *section; - boolean done_dot = false; - char buf[200]; - SFILE sfile; print_files = NULL; prev_functionname = NULL; @@ -940,6 +1455,7 @@ INIT_DISASSEMBLE_INFO(disasm_info, stdout, fprintf); disasm_info.application_data = (PTR) &aux; aux.abfd = abfd; + aux.require_sec = false; disasm_info.print_address_func = objdump_print_address; if (machine != (char *) NULL) @@ -971,9 +1487,10 @@ fprintf (stderr, "%s: Can't disassemble for architecture %s\n", program_name, bfd_printable_arch_mach (bfd_get_arch (abfd), 0)); - exit (1); + return; } + disasm_info.flavour = bfd_get_flavour (abfd); disasm_info.arch = bfd_get_arch (abfd); disasm_info.mach = bfd_get_mach (abfd); if (bfd_big_endian (abfd)) @@ -1060,118 +1577,90 @@ if (stop > disasm_info.buffer_length) stop = disasm_info.buffer_length; } - while (i < stop) + + if (prefix_addresses) + disassemble_bytes (&disasm_info, disassemble_fn, true, data, i, stop, + &relpp, relppend); + else { - int bytes; - boolean need_nl = false; + asymbol *sym; + long place; - if (data[i] == 0 - && (i + 1 >= stop - || (data[i + 1] == 0 - && (i + 2 >= stop - || (data[i + 2] == 0 - && (i + 3 >= stop - || data[i + 3] == 0)))))) - { - if (done_dot == false) - { - printf ("...\n"); - done_dot = true; - } - bytes = 4; - } - else + sym = find_symbol_for_address (abfd, section, section->vma + i, + true, &place); + ++place; + while (i < stop) { - done_dot = false; - if (with_line_numbers || with_source_code) - show_line (abfd, section, i); - aux.require_sec = true; - objdump_print_address (section->vma + i, &disasm_info); - aux.require_sec = false; - putchar (' '); + asymbol *nextsym; + long nextstop; + boolean insns; - sfile.buffer = sfile.current = buf; - disasm_info.fprintf_func = (fprintf_ftype) objdump_sprintf; - disasm_info.stream = (FILE *) &sfile; - bytes = (*disassemble_fn) (section->vma + i, &disasm_info); - disasm_info.fprintf_func = (fprintf_ftype) fprintf; - disasm_info.stream = stdout; - if (bytes < 0) - break; + if (sym != NULL && bfd_asymbol_value (sym) <= section->vma + i) + disasm_info.symbol = sym; + else + disasm_info.symbol = NULL; - if (show_raw_insn) + printf ("\n"); + objdump_print_addr_with_sym (abfd, section, sym, + section->vma + i, + &disasm_info, + false); + printf (":\n"); + + if (sym != NULL && bfd_asymbol_value (sym) > section->vma + i) + nextsym = sym; + else if (sym == NULL) + nextsym = NULL; + else { - long j; - for (j = i; j < i + bytes; ++j) - { - printf ("%02x", (unsigned) data[j]); - putchar (' '); - } - /* Separate raw data from instruction by extra space. */ - putchar (' '); + while (place < sorted_symcount + && (sorted_syms[place]->section != section + || (bfd_asymbol_value (sorted_syms[place]) + <= bfd_asymbol_value (sym)))) + ++place; + if (place >= sorted_symcount) + nextsym = NULL; + else + nextsym = sorted_syms[place]; } - printf ("%s", sfile.buffer); - - if (!wide_output) - putchar ('\n'); + if (sym != NULL && bfd_asymbol_value (sym) > section->vma + i) + { + nextstop = bfd_asymbol_value (sym) - section->vma; + if (nextstop > stop) + nextstop = stop; + } + else if (nextsym == NULL) + nextstop = stop; else - need_nl = true; - } - - if (dump_reloc_info - && (section->flags & SEC_RELOC) != 0) - { - while (relpp < relppend - && ((*relpp)->address >= (bfd_vma) i - && (*relpp)->address < (bfd_vma) i + bytes)) { - arelent *q; - const char *sym_name; - - q = *relpp; - - printf ("\t\tRELOC: "); - - printf_vma (section->vma + q->address); - - printf (" %s ", q->howto->name); - - if (q->sym_ptr_ptr != NULL - && *q->sym_ptr_ptr != NULL) - { - sym_name = bfd_asymbol_name (*q->sym_ptr_ptr); - if (sym_name == NULL || *sym_name == '\0') - { - asection *sym_sec; + nextstop = bfd_asymbol_value (nextsym) - section->vma; + if (nextstop > stop) + nextstop = stop; + } - sym_sec = bfd_get_section (*q->sym_ptr_ptr); - sym_name = bfd_get_section_name (abfd, sym_sec); - if (sym_name == NULL || *sym_name == '\0') - sym_name = "*unknown*"; - } - } - else - sym_name = "*unknown*"; + /* If a symbol is explicitly marked as being an object + rather than a function, just dump the bytes without + disassembling them. */ + if (disassemble_all + || sym == NULL + || bfd_asymbol_value (sym) > section->vma + i + || ((sym->flags & BSF_OBJECT) == 0 + && (strstr (bfd_asymbol_name (sym), "gnu_compiled") + == NULL) + && (strstr (bfd_asymbol_name (sym), "gcc2_compiled") + == NULL)) + || (sym->flags & BSF_FUNCTION) != 0) + insns = true; + else + insns = false; - printf ("%s", sym_name); + disassemble_bytes (&disasm_info, disassemble_fn, insns, data, i, + nextstop, &relpp, relppend); - if (q->addend) - { - printf ("+0x"); - printf_vma (q->addend); - } - - printf ("\n"); - need_nl = false; - ++relpp; - } + i = nextstop; + sym = nextsym; } - - if (need_nl) - printf ("\n"); - - i += bytes; } free (data); @@ -1216,8 +1705,8 @@ static boolean read_section_stabs (abfd, stabsect_name, strsect_name) bfd *abfd; - char *stabsect_name; - char *strsect_name; + const char *stabsect_name; + const char *strsect_name; { asection *stabsect, *stabstrsect; @@ -1287,8 +1776,8 @@ static void print_section_stabs (abfd, stabsect_name, strsect_name) bfd *abfd; - char *stabsect_name; - char *strsect_name; + const char *stabsect_name; + const char *strsect_name; { int i; unsigned file_string_table_offset = 0, next_file_string_table_offset = 0; @@ -1370,8 +1859,15 @@ s != NULL; s = s->next) { - if (strncmp (stabsect_name, s->name, strlen (stabsect_name)) == 0 - && strncmp (strsect_name, s->name, strlen (strsect_name)) != 0) + int len; + + len = strlen (stabsect_name); + +/* If the prefix matches, and the files section name ends with a nul or a digit, + then we match. Ie: we want either an exact match or a a section followed by + a number. */ + if (strncmp (stabsect_name, s->name, len) == 0 + && (s->name[len] == '\000' || isdigit (s->name[len]))) { if (read_section_stabs (abfd, s->name, strsect_name)) { @@ -1434,6 +1930,20 @@ return; } + /* If we are adjusting section VMA's, change them all now. Changing + the BFD information is a hack. However, we must do it, or + bfd_find_nearest_line will not do the right thing. */ + if (adjust_section_vma != 0) + { + asection *s; + + for (s = abfd->sections; s != NULL; s = s->next) + { + s->vma += adjust_section_vma; + s->lma += adjust_section_vma; + } + } + printf ("\n%s: file format %s\n", bfd_get_filename (abfd), abfd->xvec->name); if (dump_ar_hdrs) @@ -1650,12 +2160,40 @@ { if (*current) { - bfd *cur_bfd = bfd_asymbol_bfd(*current); - if (cur_bfd) + bfd *cur_bfd = bfd_asymbol_bfd (*current); + + if (cur_bfd != NULL) { - bfd_print_symbol (cur_bfd, - stdout, - *current, bfd_print_symbol_all); + const char *name; + char *alloc; + + name = bfd_asymbol_name (*current); + alloc = NULL; + if (do_demangle && name != NULL && *name != '\0') + { + const char *n; + + /* If we want to demangle the name, we demangle it + here, and temporarily clobber it while calling + bfd_print_symbol. FIXME: This is a gross hack. */ + + n = name; + if (bfd_get_symbol_leading_char (cur_bfd) == *n) + ++n; + alloc = cplus_demangle (n, DMGL_ANSI | DMGL_PARAMS); + if (alloc != NULL) + (*current)->name = alloc; + else + (*current)->name = n; + } + + bfd_print_symbol (cur_bfd, stdout, *current, + bfd_print_symbol_all); + + (*current)->name = name; + if (alloc != NULL) + free (alloc); + printf ("\n"); } } @@ -1847,9 +2385,9 @@ if (sym_name) { printf_vma (q->address); - printf (" %-16s %s", - q->howto->name, - sym_name); + printf (" %-16s ", q->howto->name); + objdump_print_symname (abfd, (struct disassemble_info *) NULL, + *q->sym_ptr_ptr); } else { @@ -1872,10 +2410,6 @@ /* The length of the longest architecture name + 1. */ #define LONGEST_ARCH sizeof("rs6000:6000") -#ifndef L_tmpnam -#define L_tmpnam 25 -#endif - static const char * endian_string (endian) enum bfd_endian endian; @@ -1894,13 +2428,11 @@ static void display_target_list () { - extern char *tmpnam (); extern bfd_target *bfd_target_vector[]; - char tmparg[L_tmpnam]; char *dummy_name; int t; - dummy_name = tmpnam (tmparg); + dummy_name = choose_temp_base (); for (t = 0; bfd_target_vector[t]; t++) { bfd_target *p = bfd_target_vector[t]; @@ -1930,6 +2462,7 @@ bfd_printable_arch_mach ((enum bfd_architecture) a, 0)); } unlink (dummy_name); + free (dummy_name); } /* Print a table showing which architectures are supported for entries @@ -1942,8 +2475,6 @@ int last; { extern bfd_target *bfd_target_vector[]; - extern char *tmpnam (); - char tmparg[L_tmpnam]; int t, a; char *dummy_name; @@ -1953,7 +2484,7 @@ printf ("%s ", bfd_target_vector[t]->name); putchar ('\n'); - dummy_name = tmpnam (tmparg); + dummy_name = choose_temp_base (); for (a = (int) bfd_arch_obscure + 1; a < (int) bfd_arch_last; a++) if (strcmp (bfd_printable_arch_mach (a, 0), "UNKNOWN!") != 0) { @@ -2000,6 +2531,7 @@ putchar ('\n'); } unlink (dummy_name); + free (dummy_name); } /* Print tables of all the target-architecture combinations that @@ -2011,7 +2543,6 @@ int t, columns; extern bfd_target *bfd_target_vector[]; char *colum; - extern char *getenv (); columns = 0; colum = getenv ("COLUMNS"); @@ -2064,8 +2595,9 @@ START_PROGRESS (program_name, 0); bfd_init (); + set_default_bfd_target (); - while ((c = getopt_long (argc, argv, "pib:m:VdDlfahrRtTxsSj:wE:", + while ((c = getopt_long (argc, argv, "pib:m:VCdDlfahrRtTxsSj:wE:", long_options, (int *) 0)) != EOF) { @@ -2110,6 +2642,9 @@ case 'T': dump_dynamic_symtab = 1; break; + case 'C': + do_demangle = 1; + break; case 'd': disassemble = true; break; @@ -2143,6 +2678,9 @@ case 'w': wide_output = 1; break; + case OPTION_ADJUST_VMA: + adjust_section_vma = parse_vma (optarg, "--adjust-vma"); + break; case OPTION_START_ADDRESS: start_address = parse_vma (optarg, "--start-address"); break; @@ -2178,10 +2716,7 @@ } if (show_version) - { - printf ("GNU %s version %s\n", program_name, program_version); - exit (0); - } + print_version ("objdump"); if (seenflag == false) usage (stderr, 1); diff -urN binutils-2.7/binutils/prdbg.c binutils-2.8/binutils/prdbg.c --- binutils-2.7/binutils/prdbg.c Thu Jul 4 12:23:50 1996 +++ binutils-2.8/binutils/prdbg.c Wed Apr 30 12:59:14 1997 @@ -1007,6 +1007,9 @@ case DEBUG_VISIBILITY_PROTECTED: s = "protected"; break; + case DEBUG_VISIBILITY_IGNORE: + s = "/* ignore */"; + break; default: abort (); return false; @@ -1092,7 +1095,7 @@ /* Change the trailing indentation to have a close brace. */ s = info->stack->type + strlen (info->stack->type) - 2; - assert (strcmp (s, " ") == 0); + assert (s[0] == ' ' && s[1] == ' ' && s[2] == '\0'); *s++ = '}'; *s = '\0'; diff -urN binutils-2.7/binutils/rdcoff.c binutils-2.8/binutils/rdcoff.c --- binutils-2.7/binutils/rdcoff.c Thu Jul 4 18:33:31 1996 +++ binutils-2.8/binutils/rdcoff.c Wed Apr 30 12:59:14 1997 @@ -199,6 +199,12 @@ NULL, dhandle), 0, n - 1, false); } + else + { + fprintf (stderr, "%s: parse_coff_type: Bad type code 0x%x\n", + program_name, ntype); + return DEBUG_TYPE_NULL; + } return type; } diff -urN binutils-2.7/binutils/rddbg.c binutils-2.8/binutils/rddbg.c --- binutils-2.7/binutils/rddbg.c Thu Jul 4 12:23:51 1996 +++ binutils-2.8/binutils/rddbg.c Wed Apr 30 12:59:15 1997 @@ -1,5 +1,5 @@ /* rddbg.c -- Read debugging information into a generic form. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 96, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -189,13 +189,22 @@ while (s[strlen (s) - 1] == '\\' && stab + 12 < stabs + stabsize) { + char *p; + stab += 12; - s[strlen (s) - 1] = '\0'; + p = s + strlen (s) - 1; + *p = '\0'; s = concat (s, ((char *) strings + stroff + bfd_get_32 (abfd, stab)), (const char *) NULL); + + /* We have to restore the backslash, because, if + the linker is hashing stabs strings, we may + see the same string more than once. */ + *p = '\\'; + if (f != NULL) free (f); f = s; @@ -270,6 +279,7 @@ *pfound = true; s = i.name; + f = NULL; while (s[strlen (s) - 1] == '\\' && ps + 1 < symend) { @@ -426,7 +436,13 @@ int i; for (i = 0; i < SAVE_STABS_COUNT; i++) - if (saved_stabs[i].string != NULL) - free (saved_stabs[i].string); + { + if (saved_stabs[i].string != NULL) + { + free (saved_stabs[i].string); + saved_stabs[i].string = NULL; + } + } + saved_stabs_index = 0; } diff -urN binutils-2.7/binutils/size.c binutils-2.8/binutils/size.c --- binutils-2.7/binutils/size.c Thu Jul 4 12:23:51 1996 +++ binutils-2.8/binutils/size.c Wed Apr 30 12:59:15 1997 @@ -1,5 +1,5 @@ /* size.c -- report size of various sections of an executable file. - Copyright 1991, 92, 93, 94 Free Software Foundation, Inc. + Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -51,18 +51,23 @@ int return_code = 0; /* IMPORTS */ -extern char *program_version; extern char *target; -/* Forward declarations */ +/* Static declarations */ +static void usage PARAMS ((FILE *, int)); static void display_file PARAMS ((char *filename)); - +static void display_bfd PARAMS ((bfd *)); +static void display_archive PARAMS ((bfd *)); +static void lprint_number PARAMS ((int, bfd_size_type)); +static void rprint_number PARAMS ((int, bfd_size_type)); +static void print_berkeley_format PARAMS ((bfd *)); +static void sysv_internal_printer PARAMS ((bfd *, asection *, PTR)); +static void print_sysv_format PARAMS ((bfd *)); static void print_sizes PARAMS ((bfd * file)); - static void berkeley_sum PARAMS ((bfd *, sec_ptr, PTR)); -void +static void usage (stream, status) FILE *stream; int status; @@ -76,6 +81,8 @@ fputs ("default is --format=sysv\n", stream); #endif list_supported_targets (program_name, stream); + if (status == 0) + fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); exit (status); } @@ -101,6 +108,7 @@ xmalloc_set_program_name (program_name); bfd_init (); + set_default_bfd_target (); while ((c = getopt_long (argc, argv, "ABVdox", long_options, (int *) 0)) != EOF) @@ -175,10 +183,7 @@ } if (show_version) - { - printf ("GNU %s version %s\n", program_name, program_version); - exit (0); - } + print_version ("size"); if (show_help) usage (stdout, 0); @@ -193,7 +198,7 @@ /* Display stats on file or archive member ABFD. */ -void +static void display_bfd (abfd) bfd *abfd; { @@ -298,7 +303,7 @@ /* This is what lexical functions are for. */ -void +static void lprint_number (width, num) int width; bfd_size_type num; @@ -308,7 +313,7 @@ width, (unsigned long) num); } -void +static void rprint_number (width, num) int width; bfd_size_type num; @@ -328,18 +333,23 @@ sec_ptr sec; PTR ignore; { + flagword flags; bfd_size_type size; + flags = bfd_get_section_flags (abfd, sec); + if ((flags & SEC_ALLOC) == 0) + return; + size = bfd_get_section_size_before_reloc (sec); - if (bfd_get_section_flags (abfd, sec) & SEC_CODE) + if ((flags & SEC_CODE) != 0 || (flags & SEC_READONLY) != 0) textsize += size; - else if (bfd_get_section_flags (abfd, sec) & SEC_DATA) + else if ((flags & SEC_HAS_CONTENTS) != 0) datasize += size; - else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + else bsssize += size; } -void +static void print_berkeley_format (abfd) bfd *abfd; { @@ -378,7 +388,7 @@ /* I REALLY miss lexical functions! */ bfd_size_type svi_total = 0; -void +static void sysv_internal_printer (file, sec, ignore) bfd *file; sec_ptr sec; @@ -399,7 +409,7 @@ } } -void +static void print_sysv_format (file) bfd *file; { diff -urN binutils-2.7/binutils/stabs.c binutils-2.8/binutils/stabs.c --- binutils-2.7/binutils/stabs.c Thu Jul 4 12:23:57 1996 +++ binutils-2.8/binutils/stabs.c Wed Apr 30 12:59:15 1997 @@ -75,10 +75,16 @@ boolean n_opt_found; /* The main file name. */ char *main_filename; - /* A stack of N_BINCL files. */ + /* A stack of unfinished N_BINCL files. */ struct bincl_file *bincl_stack; + /* A list of finished N_BINCL files. */ + struct bincl_file *bincl_list; /* Whether we are inside a function or not. */ boolean within_function; + /* The address of the end of the function, used if we have seen an + N_FUN symbol while in a function. This is -1 if we have not seen + an N_FUN (the normal case). */ + bfd_vma function_end; /* The depth of block nesting. */ int block_depth; /* List of pending variable definitions. */ @@ -182,8 +188,10 @@ debug_type *, boolean *)); static debug_type parse_stab_array_type PARAMS ((PTR, struct stab_handle *, const char **, boolean)); -static void push_bincl PARAMS ((struct stab_handle *, const char *)); +static void push_bincl PARAMS ((struct stab_handle *, const char *, bfd_vma)); static const char *pop_bincl PARAMS ((struct stab_handle *)); +static boolean find_excl + PARAMS ((struct stab_handle *, const char *, bfd_vma)); static boolean stab_record_variable PARAMS ((PTR, struct stab_handle *, const char *, debug_type, enum debug_var_kind, bfd_vma)); @@ -366,6 +374,7 @@ ret->files = 1; ret->file_types = (struct stab_types **) xmalloc (sizeof *ret->file_types); ret->file_types[0] = NULL; + ret->function_end = (bfd_vma) -1; return (PTR) ret; } @@ -383,9 +392,10 @@ if (info->within_function) { if (! stab_emit_pending_vars (dhandle, info) - || ! debug_end_function (dhandle, (bfd_vma) -1)) + || ! debug_end_function (dhandle, info->function_end)) return false; info->within_function = false; + info->function_end = (bfd_vma) -1; } for (st = info->tags; st != NULL; st = st->next) @@ -509,10 +519,18 @@ /* This always ends a function. */ if (info->within_function) { + bfd_vma endval; + + endval = value; + if (*string != '\0' + && info->function_end != (bfd_vma) -1 + && info->function_end < endval) + endval = info->function_end; if (! stab_emit_pending_vars (dhandle, info) - || ! debug_end_function (dhandle, value)) + || ! debug_end_function (dhandle, endval)) return false; info->within_function = false; + info->function_end = (bfd_vma) -1; } /* An empty string is emitted by gcc at the end of a compilation @@ -550,7 +568,7 @@ case N_BINCL: /* Start an include file which may be replaced. */ - push_bincl (info, string); + push_bincl (info, string, value); if (! debug_start_source (dhandle, string)) return false; break; @@ -564,12 +582,8 @@ case N_EXCL: /* This is a duplicate of a header file named by N_BINCL which was eliminated by the linker. */ - ++info->files; - info->file_types = ((struct stab_types **) - xrealloc ((PTR) info->file_types, - (info->files - * sizeof *info->file_types))); - info->file_types[info->files - 1] = NULL; + if (! find_excl (info, string, value)) + return false; break; case N_SLINE: @@ -588,10 +602,40 @@ return false; break; + case N_FUN: + if (*string == '\0') + { + if (info->within_function) + { + /* This always marks the end of a function; we don't + need to worry about info->function_end. */ + if (info->sections) + value += info->function_start_offset; + if (! stab_emit_pending_vars (dhandle, info) + || ! debug_end_function (dhandle, value)) + return false; + info->within_function = false; + info->function_end = (bfd_vma) -1; + } + break; + } + + /* A const static symbol in the .text section will have an N_FUN + entry. We need to use these to mark the end of the function, + in case we are looking at gcc output before it was changed to + always emit an empty N_FUN. We can't call debug_end_function + here, because it might be a local static symbol. */ + if (info->within_function + && (info->function_end == (bfd_vma) -1 + || value < info->function_end)) + info->function_end = value; + + /* Fall through. */ /* FIXME: gdb checks the string for N_STSYM, N_LCSYM or N_ROSYM symbols, and if it does not start with :S, gdb relocates the value to the start of the section. gcc always seems to use :S, so we don't worry about this. */ + /* Fall through. */ default: { const char *colon; @@ -602,9 +646,16 @@ { if (info->within_function) { + bfd_vma endval; + + endval = value; + if (info->function_end != (bfd_vma) -1 + && info->function_end < endval) + endval = info->function_end; if (! stab_emit_pending_vars (dhandle, info) - || ! debug_end_function (dhandle, value)) + || ! debug_end_function (dhandle, endval)) return false; + info->function_end = (bfd_vma) -1; } /* For stabs in sections, line numbers and block addresses are offsets from the start of the function. */ @@ -2666,6 +2717,7 @@ if (**pp == ':') { /* g++ version 1 overloaded methods. */ + context = DEBUG_TYPE_NULL; } else { @@ -3091,26 +3143,43 @@ upper, stringp); } -/* Keep a stack of N_BINCL include files. */ +/* This struct holds information about files we have seen using + N_BINCL. */ struct bincl_file { + /* The next N_BINCL file. */ struct bincl_file *next; + /* The next N_BINCL on the stack. */ + struct bincl_file *next_stack; + /* The file name. */ const char *name; + /* The hash value. */ + bfd_vma hash; + /* The file index. */ + unsigned int file; + /* The list of types defined in this file. */ + struct stab_types *file_types; }; /* Start a new N_BINCL file, pushing it onto the stack. */ static void -push_bincl (info, name) +push_bincl (info, name, hash) struct stab_handle *info; const char *name; + bfd_vma hash; { struct bincl_file *n; n = (struct bincl_file *) xmalloc (sizeof *n); - n->next = info->bincl_stack; + n->next = info->bincl_list; + n->next_stack = info->bincl_stack; n->name = name; + n->hash = hash; + n->file = info->files; + n->file_types = NULL; + info->bincl_list = n; info->bincl_stack = n; ++info->files; @@ -3118,7 +3187,7 @@ xrealloc ((PTR) info->file_types, (info->files * sizeof *info->file_types))); - info->file_types[info->files - 1] = NULL; + info->file_types[n->file] = NULL; } /* Finish an N_BINCL file, at an N_EINCL, popping the name off the @@ -3133,13 +3202,46 @@ o = info->bincl_stack; if (o == NULL) return info->main_filename; - info->bincl_stack = o->next; - free (o); + info->bincl_stack = o->next_stack; + + o->file_types = info->file_types[o->file]; + if (info->bincl_stack == NULL) return info->main_filename; return info->bincl_stack->name; } +/* Handle an N_EXCL: get the types from the corresponding N_BINCL. */ + +static boolean +find_excl (info, name, hash) + struct stab_handle *info; + const char *name; + bfd_vma hash; +{ + struct bincl_file *l; + + ++info->files; + info->file_types = ((struct stab_types **) + xrealloc ((PTR) info->file_types, + (info->files + * sizeof *info->file_types))); + + for (l = info->bincl_list; l != NULL; l = l->next) + if (l->hash == hash && strcmp (l->name, name) == 0) + break; + if (l == NULL) + { + warn_stab (name, "Undefined N_EXCL"); + info->file_types[info->files - 1] = NULL; + return true; + } + + info->file_types[info->files - 1] = l->file_types; + + return true; +} + /* Handle a variable definition. gcc emits variable definitions for a block before the N_LBRAC, so we must hold onto them until we see it. The SunPRO compiler emits variable definitions after the @@ -4222,7 +4324,7 @@ done = true; break; default: - /* Assume it's a uder defined integral type. */ + /* Assume it's a user defined integral type. */ integralp = true; done = true; break; @@ -4923,7 +5025,20 @@ case 't': if (! stab_demangle_template (minfo, pp)) return false; - abort (); + if (ptype != NULL) + { + debug_type t; + + /* FIXME: I really don't know how a template should be + represented in the current type system. Perhaps the + template should be demangled into a string, and the type + should be represented as a named type. However, I don't + know what the base type of the named type should be. */ + t = debug_make_void_type (minfo->dhandle); + t = debug_make_pointer_type (minfo->dhandle, t); + t = debug_name_type (minfo->dhandle, "TEMPLATE", t); + *ptype = t; + } break; default: diff -urN binutils-2.7/binutils/strings.c binutils-2.8/binutils/strings.c --- binutils-2.7/binutils/strings.c Thu Jul 4 12:23:58 1996 +++ binutils-2.8/binutils/strings.c Wed Apr 30 12:59:15 1997 @@ -1,5 +1,5 @@ /* strings -- print the strings of printable characters in files - Copyright (C) 1993, 94 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* Usage: strings [options] file... @@ -91,8 +92,6 @@ /* The BFD object file format. */ static char *target; -extern char *program_version; - static struct option long_options[] = { {"all", no_argument, NULL, 'a'}, @@ -105,9 +104,11 @@ {NULL, 0, NULL, 0} }; +static void strings_a_section PARAMS ((bfd *, asection *, PTR)); +static boolean strings_object_file PARAMS ((const char *)); static boolean strings_file PARAMS ((char *file)); static int integer_arg PARAMS ((char *s)); -static void print_strings PARAMS ((char *filename, FILE *stream, +static void print_strings PARAMS ((const char *filename, FILE *stream, file_ptr address, int stop_point, int magiccount, char *magic)); static void usage PARAMS ((FILE *stream, int status)); @@ -188,8 +189,8 @@ break; case 'v': - printf ("GNU %s version %s\n", program_name, program_version); - exit (0); + print_version ("strings"); + break; case '?': usage (stderr, 1); @@ -207,6 +208,7 @@ string_min = 4; bfd_init (); + set_default_bfd_target (); if (optind >= argc) { @@ -239,11 +241,13 @@ set `got_a_section' and print the strings in it. */ static void -strings_a_section (abfd, sect, file) +strings_a_section (abfd, sect, filearg) bfd *abfd; asection *sect; - PTR file; + PTR filearg; { + const char *file = (const char *) filearg; + if ((sect->flags & DATA_FLAGS) == DATA_FLAGS) { bfd_size_type sz = bfd_get_section_size_before_reloc (sect); @@ -265,7 +269,7 @@ static boolean strings_object_file (file) - char *file; + const char *file; { bfd *abfd = bfd_openr (file, target); @@ -285,7 +289,7 @@ } got_a_section = false; - bfd_map_over_sections (abfd, strings_a_section, file); + bfd_map_over_sections (abfd, strings_a_section, (PTR) file); if (!bfd_close (abfd)) { @@ -348,7 +352,7 @@ static void print_strings (filename, stream, address, stop_point, magiccount, magic) - char *filename; + const char *filename; FILE *stream; file_ptr address; int stop_point; @@ -498,5 +502,7 @@ [--target=bfdname] [--help] [--version] file...\n", program_name); list_supported_targets (program_name, stream); + if (status == 0) + fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); exit (status); } diff -urN binutils-2.7/binutils/strip.1 binutils-2.8/binutils/strip.1 --- binutils-2.7/binutils/strip.1 Thu Jul 4 12:23:58 1996 +++ binutils-2.8/binutils/strip.1 Wed Apr 30 12:59:16 1997 @@ -1,4 +1,4 @@ -.\" Copyright (c) 1991 Free Software Foundation +.\" Copyright (c) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation .\" See section COPYING for conditions for redistribution .TH strip 1 "5 November 1991" "cygnus support" "GNU Development Tools" .de BP @@ -27,6 +27,7 @@ .RB "[\|" \-K\ \fIsymbolname\fR\ |\ \fB\-\-keep\-symbol=\fIsymbolname\fR "\|]" .RB "[\|" \-N\ \fIsymbolname\fR\ |\ \fB\-\-strip\-symbol=\fIsymbolname\fR "\|]" .RB "[\|" \-o\ \fIfile\f\R "\|]" +.RB "[\|" \-p\fR\ |\ \fB\-\-preserve\-dates "\|]" .RB "[\|" \-v\fR\ |\ \fB\-\-verbose "\|]" .RB "[\|" \-V\fR\ |\ \fB\-\-version "\|]" .RB "[\|" \-V\fR\ |\ \fB\-\-help "\|]" @@ -112,6 +113,12 @@ Put the stripped output in \fIfile\fR, rather than replacing the existing file. When this argument is used, only one \fIobjfile\fR argument may be specified. + +.TP +.B \-p +.TP +.B \-\-preserve-dates +Preserve the access and modification dates of the file. .TP .B \-x diff -urN binutils-2.7/binutils/testsuite/ChangeLog binutils-2.8/binutils/testsuite/ChangeLog --- binutils-2.7/binutils/testsuite/ChangeLog Thu Jul 4 12:24:01 1996 +++ binutils-2.8/binutils/testsuite/ChangeLog Wed Apr 30 12:59:22 1997 @@ -1,3 +1,42 @@ +Mon Apr 14 12:36:41 1997 Ian Lance Taylor + + * binutils-all/ar.exp (long_filenames): Check for a file system + with a 14 character file name length limit. + +Tue Apr 1 09:52:15 1997 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objdump.exp: Handle d10v. + +Fri Feb 7 16:45:34 1997 Bob Manson + + * binutils-all/ar.exp: Use prune_warnings instead of + prune_system_crud. + * binutils-all/objcopy.exp: Ditto. + +Wed Jan 29 00:16:43 1997 Bob Manson + + * binutils-all/nm.exp: Use / between $srcdir and $subdir. + * binutils-all/objcopy.exp: Ditto. + * binutils-all/objdump.exp: Ditto. + * binutils-all/size.exp: Ditto. + * binutils-all/hppa/objdump.exp: Ditto. + + +Wed Oct 16 22:57:59 1996 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objdump.exp: Add mn10200 and mn10300 to expected + cpus list. + +Tue Oct 1 15:06:55 1996 Ian Lance Taylor + + * lib/utils-lib.exp (binutil_version): Fix for current version + printing. + +Sun Aug 4 22:25:40 1996 Ian Lance Taylor + + * binutils-all/objcopy.exp: Fix end of line matching in srec tests + to work with TCL 7.5. + Sat Jun 29 12:51:30 1996 Ian Lance Taylor * binutils-all/objcopy.exp: Simple copy test works for i960 b.out diff -urN binutils-2.7/binutils/testsuite/binutils-all/ar.exp binutils-2.8/binutils/testsuite/binutils-all/ar.exp --- binutils-2.7/binutils/testsuite/binutils-all/ar.exp Thu Jul 4 12:24:02 1996 +++ binutils-2.8/binutils/testsuite/binutils-all/ar.exp Wed Apr 30 12:59:19 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1995 Free Software Foundation, Inc. +# Copyright (C) 1995, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -38,15 +38,36 @@ set n2 "abcdefghijklmnopqrstuvwxyz2" binutils_remove tmpdir/$n1 - set f [open tmpdir/$n1 w] + set status [catch "set f [open tmpdir/$n1 w]" errs] + if { $status != 0 } { + verbose -log "open tmpdir/$n1 returned $errs" + unsupported $testname + return + } puts $f "first" close $f binutils_remove tmpdir/$n2 - set f [open tmpdir/$n2 w] + set status [catch "set f [open tmpdir/$n2 w]" errs] + if { $status != 0 } { + verbose -log "open tmpdir/$n2 returned $errs" + unsupported $testname + return + } puts $f "second" close $f + # Some file systems truncate file names at 14 characters, which + # makes it impossible to run this test. Check for that now. + set f [open tmpdir/$n1 r] + gets $f string + close $f + if ![string match "first" $string] { + verbose -log "reading tmpdir/$n1 returned $string" + unsupported $testname + return + } + binutils_remove tmpdir/artest.a set got [binutils_run $AR "rc tmpdir/artest.a tmpdir/$n1 tmpdir/$n2"] if ![string match "" $got] { @@ -65,7 +86,7 @@ verbose -log "cd tmpdir; $AR x artest.a" catch "exec /bin/sh -c \"cd tmpdir; $AR x artest.a\"" exec_output - set exec_output [prune_system_crud $host_triplet $exec_output] + set exec_output [prune_warnings $exec_output] if ![string match "" $exec_output] { verbose -log $exec_output fail $testname diff -urN binutils-2.7/binutils/testsuite/binutils-all/hppa/objdump.exp binutils-2.8/binutils/testsuite/binutils-all/hppa/objdump.exp --- binutils-2.7/binutils/testsuite/binutils-all/hppa/objdump.exp Thu Jul 4 12:24:03 1996 +++ binutils-2.8/binutils/testsuite/binutils-all/hppa/objdump.exp Wed Apr 30 12:59:21 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1993, 1994 Free Software Foundation, Inc. +# Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ send_user "Version [binutil_version $OBJDUMP]" -if {![binutils_assemble $AS $srcdir$subdir/addendbug.s tmpdir/addendbug.o]} then { +if {![binutils_assemble $AS $srcdir/$subdir/addendbug.s tmpdir/addendbug.o]} then { return } diff -urN binutils-2.7/binutils/testsuite/binutils-all/nm.exp binutils-2.8/binutils/testsuite/binutils-all/nm.exp --- binutils-2.7/binutils/testsuite/binutils-all/nm.exp Thu Jul 4 12:24:02 1996 +++ binutils-2.8/binutils/testsuite/binutils-all/nm.exp Wed Apr 30 12:59:19 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1993, 1994 Free Software Foundation, Inc. +# Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ send_user "Version [binutil_version $NM]" -if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then { +if {![binutils_assemble $AS $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { return } diff -urN binutils-2.7/binutils/testsuite/binutils-all/objcopy.exp binutils-2.8/binutils/testsuite/binutils-all/objcopy.exp --- binutils-2.7/binutils/testsuite/binutils-all/objcopy.exp Thu Jul 4 12:24:02 1996 +++ binutils-2.8/binutils/testsuite/binutils-all/objcopy.exp Wed Apr 30 12:59:19 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ send_user "Version [binutil_version $OBJCOPY]" -if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then { +if {![binutils_assemble $AS $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { unresolved "objcopy (simple copy)" return } @@ -41,7 +41,7 @@ send_log "cmp tmpdir/bintest.o tmpdir/copy.o\n" verbose "cmp tmpdir/bintest.o tmpdir/copy.o" catch "exec cmp tmpdir/bintest.o tmpdir/copy.o" exec_output - set exec_output [prune_system_crud $host_triplet $exec_output] + set exec_output [prune_warnings $exec_output] # On some systems the result of objcopy will not be identical. # Usually this is just because gas isn't using bfd to write the files @@ -93,19 +93,19 @@ gets $file line send_log "$line\n" verbose $line - if ![string match $line "S0130000746D706469722F636F70792E7372656397\r"] { + if ![string match "S0130000746D706469722F636F70792E7372656397*" $line] { send_log "bad header\n" fail "objcopy -O srec" } else { while {[gets $file line] != -1 \ - && [regexp "^S\[123\]\[0-9a-fA-F\]+\r$" $line]} { + && [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} { send_log "$line\n" verbose $line set line "**EOF**" } send_log "$line\n" verbose $line - if ![regexp "^S\[789\]\[0-9a-fA-F\]+\r$" $line] then { + if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then { send_log "bad trailer\n" fail "objcopy -O srec" } else { diff -urN binutils-2.7/binutils/testsuite/binutils-all/objdump.exp binutils-2.8/binutils/testsuite/binutils-all/objdump.exp --- binutils-2.7/binutils/testsuite/binutils-all/objdump.exp Thu Jul 4 12:31:32 1996 +++ binutils-2.8/binutils/testsuite/binutils-all/objdump.exp Wed Apr 30 12:59:21 1997 @@ -31,7 +31,7 @@ set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"] -set cpus_expected "(a29k|alliant|alpha|arm|convex|h8|hppa|i386|i860|i960|m68k|m88k|mips|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k|z8001|z8002)" +set cpus_expected "(a29k|alliant|alpha|arm|convex|d10v|h8|hppa|i386|i860|i960|m32r|m68k|m88k|mips|mn10200|mn10300|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k|z8001|z8002)" set want "BFD header file version.*srec.*header .* endian.*, data .* endian.*$cpus_expected" @@ -44,7 +44,7 @@ # The remaining tests require a test file. -if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then { +if {![binutils_assemble $AS $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { return } diff -urN binutils-2.7/binutils/testsuite/binutils-all/size.exp binutils-2.8/binutils/testsuite/binutils-all/size.exp --- binutils-2.7/binutils/testsuite/binutils-all/size.exp Thu Jul 4 12:24:02 1996 +++ binutils-2.8/binutils/testsuite/binutils-all/size.exp Wed Apr 30 12:59:21 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1993, 1994 Free Software Foundation, Inc. +# Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ send_user "Version [binutil_version $SIZE]" -if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then { +if {![binutils_assemble $AS $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { return } diff -urN binutils-2.7/binutils/testsuite/config/default.exp binutils-2.8/binutils/testsuite/config/default.exp --- binutils-2.7/binutils/testsuite/config/default.exp Thu Jul 4 12:24:04 1996 +++ binutils-2.8/binutils/testsuite/config/default.exp Wed Apr 30 12:59:25 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1993, 1994 Free Software Foundation, Inc. +# Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff -urN binutils-2.7/binutils/testsuite/lib/utils-lib.exp binutils-2.8/binutils/testsuite/lib/utils-lib.exp --- binutils-2.7/binutils/testsuite/lib/utils-lib.exp Thu Jul 4 12:24:05 1996 +++ binutils-2.8/binutils/testsuite/lib/utils-lib.exp Wed Apr 30 12:59:27 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1993, 1994 Free Software Foundation, Inc. +# Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,12 +28,11 @@ catch "exec $prog --version" tmp # Should find a way to discard constant parts, keep whatever's # left, so the version string could be almost anything at all... - regexp "version (cygnus-|)\[-0-9.a-zA-Z-\]+" $tmp version - if ![info exists version] then { + regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" $tmp version cyg number + if ![info exists number] then { return "[which $prog] (no version number)\n" } - set tmp $version - return "[which $prog] $version\n" + return "[which $prog] $number\n" } # @@ -68,7 +67,7 @@ # language. regsub -all "\\$" $progargs "\\$" progq catch "exec $prog $progq" exec_output - set exec_output [prune_system_crud $host_triplet $exec_output] + set exec_output [prune_warnings $exec_output] if {![string match "" $exec_output]} then { send_log "$exec_output\n" verbose "$exec_output" @@ -108,7 +107,7 @@ catch "exec $as $ASFLAGS -o $object $source" exec_output } - set exec_output [prune_system_crud $host_triplet $exec_output] + set exec_output [prune_warnings $exec_output] if [string match "" $exec_output] then { return 1 @@ -140,7 +139,7 @@ verbose "$cc $flags $CFLAGS -o $object $source" catch "exec $cc $flags $CFLAGS -o $object $source" exec_output - set exec_output [prune_system_crud $host_triplet $exec_output] + set exec_output [prune_warnings $exec_output] if [string match "" $exec_output] then { return 1 @@ -163,19 +162,16 @@ # This definition is taken from an unreleased version of DejaGnu. Once # that version gets released, and has been out in the world for a few # months at least, it may be safe to delete this copy. -if ![string length [info proc prune_system_crud]] { +if ![string length [info proc prune_warnings]] { # - # prune_system_crud -- delete various system verbosities from TEXT on SYSTEM + # prune_warnings -- delete various system verbosities from TEXT # # An example is: # ld.so: warning: /usr/lib/libc.so.1.8.1 has older revision than expected 9 # - # SYSTEM is typical $target_triplet or $host_triplet. - # - # This is useful when trying to do pattern matches on program output. # Sites with particular verbose os's may wish to override this in site.exp. # - proc prune_system_crud { system text } { + proc prune_warnings { text } { # This is from sun4's. Do it for all machines for now. # The "\\1" is to try to preserve a "\n" but only if necessary. regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text diff -urN binutils-2.7/binutils/version.c binutils-2.8/binutils/version.c --- binutils-2.7/binutils/version.c Thu Jul 4 12:23:59 1996 +++ binutils-2.8/binutils/version.c Wed Apr 30 12:59:16 1997 @@ -1,5 +1,43 @@ -/*** version.c -- version number for binutils. - They all change in lockstep -- it's easier that way -*/ +/* version.c -- binutils version information + Copyright 1991, 1996 Free Software Foundation, Inc. -char *program_version = VERSION; +This file is part of GNU Binutils. + +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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include +#include "bfd.h" +#include "bucomm.h" + +/* This is the version numbers for the binutils. They all change in + lockstep -- it's easier that way. */ + +const char *program_version = VERSION; + +/* Print the version number and copyright information, and exit. This + implements the --version option for the various programs. */ + +void +print_version (name) + const char *name; +{ + /* This output is intended to follow the GNU standards document. */ + printf ("GNU %s %s\n", name, program_version); + printf ("Copyright 1997 Free Software Foundation, Inc.\n"); + printf ("\ +This program is free software; you may redistribute it under the terms of\n\ +the GNU General Public License. This program has absolutely no warranty.\n"); + exit (0); +} diff -urN binutils-2.7/binutils/wrstabs.c binutils-2.8/binutils/wrstabs.c --- binutils-2.7/binutils/wrstabs.c Thu Jul 4 12:24:00 1996 +++ binutils-2.8/binutils/wrstabs.c Wed Apr 30 12:59:16 1997 @@ -47,6 +47,8 @@ struct string_hash_entry { struct bfd_hash_entry root; + /* Next string in this table. */ + struct string_hash_entry *next; /* Index in string table. */ long index; /* Size of type if this is a typedef. */ @@ -139,10 +141,12 @@ bfd_byte *symbols; size_t symbols_size; size_t symbols_alloc; - /* This buffer holds the strings. */ - bfd_byte *strings; + /* This is a list of hash table entries for the strings. */ + struct string_hash_entry *strings; + /* The last string hash table entry. */ + struct string_hash_entry *last_string; + /* The size of the strings. */ size_t strings_size; - size_t strings_alloc; /* This hash table eliminates duplicate strings. */ struct string_hash_table strhash; /* The type stack. */ @@ -323,6 +327,7 @@ if (ret) { /* Initialize the local fields. */ + ret->next = NULL; ret->index = -1; ret->size = 0; } @@ -355,7 +360,7 @@ { struct string_hash_entry *h; - h = string_hash_lookup (&info->strhash, string, true, false); + h = string_hash_lookup (&info->strhash, string, true, true); if (h == NULL) { fprintf (stderr, "string_hash_lookup failed: %s\n", @@ -366,20 +371,14 @@ strx = h->index; else { - size_t len; - strx = info->strings_size; h->index = strx; - - len = strlen (string); - while (info->strings_size + len + 1 > info->strings_alloc) - { - info->strings_alloc *= 2; - info->strings = (bfd_byte *) xrealloc (info->strings, - info->strings_alloc); - } - strcpy (info->strings + info->strings_size, string); - info->strings_size += len + 1; + if (info->last_string == NULL) + info->strings = h; + else + info->last_string->next = h; + info->last_string = h; + info->strings_size += strlen (string) + 1; } } @@ -489,6 +488,8 @@ bfd_size_type *pstringsize; { struct stab_write_handle info; + struct string_hash_entry *h; + bfd_byte *p; info.abfd = abfd; @@ -496,10 +497,10 @@ info.symbols_alloc = 500; info.symbols = (bfd_byte *) xmalloc (info.symbols_alloc); + info.strings = NULL; + info.last_string = NULL; + /* Reserve 1 byte for a null byte. */ info.strings_size = 1; - info.strings_alloc = 500; - info.strings = (bfd_byte *) xmalloc (info.strings_alloc); - info.strings[0] = '\0'; if (! bfd_hash_table_init (&info.strhash.table, string_hash_newfunc) || ! bfd_hash_table_init (&info.typedef_hash.table, string_hash_newfunc)) @@ -544,8 +545,16 @@ *psyms = info.symbols; *psymsize = info.symbols_size; - *pstrings = info.strings; *pstringsize = info.strings_size; + *pstrings = (bfd_byte *) xmalloc (info.strings_size); + + p = *pstrings; + *p++ = '\0'; + for (h = info.strings; h != NULL; h = h->next) + { + strcpy (p, h->root.string); + p += strlen (p) + 1; + } return true; } @@ -922,12 +931,14 @@ } index = (*cache)[targindex]; - if (index != 0) + if (index != 0 && ! info->type_stack->definition) { - /* If we have already defined a modification of this type, - then the entry on the type stack can not be a definition, - so we can safely discard it. */ - assert (! info->type_stack->definition); + /* We have already defined a modification of this type, and + the entry on the type stack is not a definition, so we + can safely discard it (we may have a definition on the + stack, even if we already defined a modification, if it + is a struct which we did not define at the time it was + referenced). */ free (stab_pop_type (info)); if (! stab_push_defined_type (info, index, size)) return false; @@ -1088,11 +1099,12 @@ sprintf (buf, "%ld=@S;", index); } - sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s", range, low, high, element); + sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s", + range, (long) low, (long) high, element); free (range); free (element); - if (high <= low) + if (high < low) size = 0; else size = element_size * ((high - low) + 1); diff -urN binutils-2.7/config/ChangeLog binutils-2.8/config/ChangeLog --- binutils-2.7/config/ChangeLog Thu Jul 4 12:22:03 1996 +++ binutils-2.8/config/ChangeLog Wed Apr 30 12:57:28 1997 @@ -1,7 +1,68 @@ +Thu Mar 27 15:52:40 1997 Geoffrey Noer + + * mh-cygwin32: override CXXFLAGS, setting to -O2 only + (no debug) + +Tue Mar 25 18:16:43 1997 Geoffrey Noer + + * mh-cygwin32: override LIBGCC2_DEBUG_CFLAGS so debug info + isn't included in cygwin32-hosted libgcc2.a by default + +Wed Jan 8 19:56:43 1997 Geoffrey Noer + + * mh-cygwin32: override CFLAGS so debug info isn't included + in cygwin32-hosted tools by default + +Tue Dec 31 16:04:26 1996 Ian Lance Taylor + + * mh-linux: Remove. + +Mon Nov 11 10:29:51 1996 Michael Meissner + + * mt-ppc: Delete file, options moved to newlib configure. + +Fri Oct 4 12:21:03 1996 Angela Marie Thomas (angela@cygnus.com) + + * mh-dgux386: New file. x86 dgux specific flags + +Mon Sep 30 15:10:07 1996 Stan Shebs + + * mpw-mh-mpw (EXTRALIBS_PPC_XCOFF): New, was EXTRALIBS_PPC. + (EXTRALIBS_PPC): Use shared libraries instead of xcoff. + +Sat Aug 17 04:56:25 1996 Geoffrey Noer + + * mh-cygwin32: don't -D_WIN32 here anymore + +Thu Aug 15 19:46:44 1996 Stan Shebs + + * mpw-mh-mpw (SEGFLAG_68K, SEGFLAG_PPC): Remove. + (EXTRALIBS_PPC): Add libgcc.xcoff. + +Thu Aug 8 14:51:47 1996 Michael Meissner + + * mt-ppc: New file, add -mrelocatable-lib and -mno-eabi to all + target builds for PowerPC eabi targets. + +Fri Jul 12 12:06:01 1996 Stan Shebs + + * mpw: New subdir, Mac MPW configuration support bits. + +Mon Jul 8 17:30:52 1996 Jim Wilson + + * mh-irix6: New file. + +Mon Jul 8 15:15:37 1996 Jason Merrill + + * mt-sparcpic (PICFLAG_FOR_TARGET): Use -fPIC. + +Fri Jul 5 11:49:02 1996 Ian Lance Taylor + + * mh-irix4 (RANLIB): Don't define; Irix 4 does have ranlib. + Sun Jun 23 22:59:25 1996 Geoffrey Noer * mh-cygwin32: new file. Like mh-go32 without the CFLAGS entry. - * .Sanitize: listed new file Tue Mar 26 14:10:41 1996 Ian Lance Taylor diff -urN binutils-2.7/config/mh-cygwin32 binutils-2.8/config/mh-cygwin32 --- binutils-2.7/config/mh-cygwin32 Thu Jul 4 12:22:04 1996 +++ binutils-2.8/config/mh-cygwin32 Wed Apr 30 12:57:28 1997 @@ -1,6 +1,16 @@ +# We don't want debugging info in Win32-hosted toolchains. +# Accomplish this by overriding CFLAGS. +CFLAGS=-O2 +CXXFLAGS=-O2 + +# We also need to override LIBGCC2_DEBUG_CFLAGS so libgcc2 will be +# build without debugging information + +LIBGCC2_DEBUG_CFLAGS= + # We set MAKEINFOFLAGS to not split .info files, because the resulting # file names don't work on DOS. MAKEINFOFLAGS=--no-split -# This does some sort of DOS specific installation, I guess. +# custom installation rules for cygwin32 (append .exe to binaries, etc.) INSTALL_DOSREL=install-dosrel diff -urN binutils-2.7/config/mh-dgux386 binutils-2.8/config/mh-dgux386 --- binutils-2.7/config/mh-dgux386 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/config/mh-dgux386 Wed Apr 30 12:57:29 1997 @@ -0,0 +1,22 @@ +# from mh-dgux +HDEFINES=-DHOST_SYS=DGUX_SYS +CC=gcc -Wall -ansi -D__using_DGUX +RANLIB = true + +# from mh-sysv4 +# Define SYSV as -DSYSV if you are using a System V operating system. +SYSV = -DSYSV -DSVR4 +RANLIB = true + +# C++ debugging is not yet supported under SVR4 (DWARF) +CXXFLAGS=-O + +# The l flag generates a warning from the SVR4 archiver, remove it. +AR_FLAGS = cr + +X11_EXTRA_LIBS = -lnsl + +# from angela +# no debugging due to broken compiler, use BSD style timeofday +CFLAGS=-O -D_BSD_TIMEOFDAY_FLAVOR + diff -urN binutils-2.7/config/mh-irix4 binutils-2.8/config/mh-irix4 --- binutils-2.7/config/mh-irix4 Thu Jul 4 12:22:04 1996 +++ binutils-2.8/config/mh-irix4 Wed Apr 30 12:57:30 1997 @@ -5,4 +5,3 @@ CC = cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000 -Wf,-XNl8192 SYSV = -DSYSV -RANLIB = true diff -urN binutils-2.7/config/mh-irix6 binutils-2.8/config/mh-irix6 --- binutils-2.7/config/mh-irix6 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/config/mh-irix6 Wed Apr 30 12:57:30 1997 @@ -0,0 +1,7 @@ +# Makefile changes for SGI's running IRIX-6.x. +SYSV = -DSYSV +RANLIB = true +# Specify the ABI, to ensure that all Irix 6 systems will behave the same. +# Also, using -32 avoids bugs that exist in the n32/n64 support in some +# versions of the SGI compiler. +CC = cc -32 diff -urN binutils-2.7/config/mh-linux binutils-2.8/config/mh-linux --- binutils-2.7/config/mh-linux Thu Jul 4 12:22:04 1996 +++ binutils-2.8/config/mh-linux Wed Dec 31 19:00:00 1969 @@ -1,2 +0,0 @@ -# This is the Makefile fragment used when running on a Linux host. -# It does not have to do anything at present. diff -urN binutils-2.7/config/mh-windows binutils-2.8/config/mh-windows --- binutils-2.7/config/mh-windows Wed Dec 31 19:00:00 1969 +++ binutils-2.8/config/mh-windows Wed Apr 30 12:57:33 1997 @@ -0,0 +1,16 @@ +CC=cc +CFLAGS= +RANLIB=true +AR_FLAGS= + +.PHONY: windows +windows: nmake.mak + @echo "Don't forget to setup setvars.mak!" + +nmake.mak: to-be-built + @echo Building nmake files + @$(srcdir)/gdb/mswin/genmakes + +to-be-built: + @echo Recording commands + @$(srcdir)/gdb/mswin/recordit diff -urN binutils-2.7/config/mpw/ChangeLog binutils-2.8/config/mpw/ChangeLog --- binutils-2.7/config/mpw/ChangeLog Fri Jul 12 17:23:39 1996 +++ binutils-2.8/config/mpw/ChangeLog Wed Apr 30 12:57:36 1997 @@ -1,3 +1,22 @@ +Tue Nov 26 12:34:12 1996 Stan Shebs + + * g-mpw-make.sed: Fix some comments. + +Mon Sep 16 14:42:52 1996 Stan Shebs + + * g-mpw-make.sed (HLDENV): Edit out all references. + +Thu Aug 15 19:49:23 1996 Stan Shebs + + * true: New script, identical to mpw-true. + * g-mpw-make.sed: Add @DASH_C_FLAG@ and @SEGMENT_FLAG()@ + to the editors for compile commands. + +Thu Aug 1 15:01:42 1996 Stan Shebs + + * mpw-true, mpw-touch, null-command: New scripts. + * README: Describe usage in more detail. + Tue Dec 12 14:51:51 1995 Stan Shebs * g-mpw-make.sed: Don't edit out "version=" occurrences. diff -urN binutils-2.7/config/mpw/README binutils-2.8/config/mpw/README --- binutils-2.7/config/mpw/README Fri Jul 12 17:23:40 1996 +++ binutils-2.8/config/mpw/README Wed Apr 30 12:57:36 1997 @@ -1,5 +1,10 @@ This directory contains MPW scripts and related files that are needed to -build Cygnus GNU tools for MPW. +build Cygnus GNU tools for MPW. The scripts should be somewhere on the +command path; our usual practice has been to have a separate directory +for the scripts, and put the tools (byacc, flex, and sed at least) there +also; then it's easier to drag the support bits around as a group, or to +upgrade MPW versions. The complete package of scripts and tool binaries +is usually available as pub/mac/buildtools.cpt.hqx on ftp.cygnus.com. "tr-7to8-src" is actually the source to an MPW script that transforms sequences like "\Option-d" into the actual 8-bit chars that MPW needs. diff -urN binutils-2.7/config/mpw/g-mpw-make.sed binutils-2.8/config/mpw/g-mpw-make.sed --- binutils-2.7/config/mpw/g-mpw-make.sed Fri Jul 12 17:23:41 1996 +++ binutils-2.8/config/mpw/g-mpw-make.sed Wed Apr 30 12:57:37 1997 @@ -33,6 +33,9 @@ /=/s/ = \.$/ = :/ +# Make these go away so that later edits not confused. +/HLDENV/s/{HLDENV}// + # Comment out any explicit srcdir setting. /srcdir/s/^srcdir/# srcdir/ @@ -54,13 +57,13 @@ /CC_LD/s/^CC_LD *=/#CC_LD =/ /LDFLAGS/s/^LDFLAGS *=/#LDFLAGS =/ -# Change -I usages. (not for GCC) +# Change -I usages. /-I/s/-I\./-i :/g /-I/s/-I::bfd/-i ::bfd:/g /-I/s/-I::include/-i ::include:/g /-I/s/-I/-i /g -# Change -D usage. (not for GCC) +# Change -D usage. /-D/s/\([ =]\)-D\([^ ]*\)/\1-d \2/g # Change continuation char. @@ -194,17 +197,18 @@ # Change syntax of default rule dependency. /^\.c\.o/s/^\.c\.o \\Option-f$/.c.o \\Option-f .c/ + # Change default rule's action. -/{CC} -c/s/{CC} -c \(.*\) \$<$/{CC} {DepDir}{Default}.c \1 @SEGMENT_FLAG@ -o {TargDir}{Default}.c.o/ +/{CC} -c/s/{CC} -c \(.*\) \$<$/{CC} @DASH_C_FLAG@ {DepDir}{Default}.c \1 @SEGMENT_FLAG({Default})@ -o {TargDir}{Default}.c.o/ # This is pretty disgusting, but I can't seem to detect empty rules. /Option-f$/s/Option-f$/Option-f _oldest/g # Remove -c from explicit compiler calls. (but should not if GCC) # Handle the case of a source file that is "{xxx}"file.c. -/ -c /s/{\([A-Z_]*\)CC}\(.*\) -c \(.*\)"\([^"]*\)"\([-a-z_]*\)\.c/{\1CC}\2 \3"\4"\5.c -o "{o}"\5.c.o/ +/ -c /s/{\([A-Z_]*\)CC}\(.*\) -c \(.*\)"\([^"]*\)"\([-a-z_]*\)\.c/{\1CC}\2 @DASH_C_FLAG@ \3"\4"\5.c -o "{o}"\5.c.o/ # Handle the case of a source file that is "{xxx}"dir:file.c. -/ -c /s/{\([A-Z_]*\)CC}\(.*\) -c \(.*\)"\([^"]*\)"\([-a-z_]*\):\([-a-z_]*\)\.c/{\1CC}\2 \3"\4"\5:\6.c -o "{o}"\6.c.o/ +/ -c /s/{\([A-Z_]*\)CC}\(.*\) -c \(.*\)"\([^"]*\)"\([-a-z_]*\):\([-a-z_]*\)\.c/{\1CC}\2 @DASH_C_FLAG@ \3"\4"\5:\6.c -o "{o}"\6.c.o/ # Change linking cc to linking sequence. /-o/s/^\([ ]*\){CC} \(.*\){\([A-Z_]*\)CFLAGS} \(.*\){LDFLAGS} \(.*\)-o \([^ ]*\) \(.*\)$/\1{CC_LD} \2 {\3CFLAGS} \4 {LDFLAGS} \5 -o \6{PROG_EXT} \7\ diff -urN binutils-2.7/config/mpw/mpw-touch binutils-2.8/config/mpw/mpw-touch --- binutils-2.7/config/mpw/mpw-touch Wed Dec 31 19:00:00 1969 +++ binutils-2.8/config/mpw/mpw-touch Wed Apr 30 12:57:36 1997 @@ -0,0 +1,7 @@ +# "Touch" command. + +If "`Exists "{1}"`" != "" + SetFile -m . "{1}" +Else + Echo ' ' > "{1}" +End If diff -urN binutils-2.7/config/mpw/mpw-true binutils-2.8/config/mpw/mpw-true --- binutils-2.7/config/mpw/mpw-true Wed Dec 31 19:00:00 1969 +++ binutils-2.8/config/mpw/mpw-true Wed Apr 30 12:57:37 1997 @@ -0,0 +1 @@ +Exit 0 diff -urN binutils-2.7/config/mpw/null-command binutils-2.8/config/mpw/null-command --- binutils-2.7/config/mpw/null-command Wed Dec 31 19:00:00 1969 +++ binutils-2.8/config/mpw/null-command Wed Apr 30 12:57:37 1997 @@ -0,0 +1 @@ +# This command does nothing. diff -urN binutils-2.7/config/mpw/true binutils-2.8/config/mpw/true --- binutils-2.7/config/mpw/true Wed Dec 31 19:00:00 1969 +++ binutils-2.8/config/mpw/true Wed Apr 30 12:57:37 1997 @@ -0,0 +1 @@ +Exit 0 diff -urN binutils-2.7/config/mpw-mh-mpw binutils-2.8/config/mpw-mh-mpw --- binutils-2.7/config/mpw-mh-mpw Thu Jul 4 12:22:06 1996 +++ binutils-2.8/config/mpw-mh-mpw Wed Apr 30 12:57:33 1997 @@ -32,6 +32,9 @@ CC_MWCPPC = MWCPPC -d MPW -enum int -mpw_chars -sym on -w off +# Note that GCC does *not* wire in a definition of "pascal", so that +# it can be handled in another way if desired. + CC_68K_GCC = gC -Dpascal= -DANSI_PROTOTYPES -DMPW CC_PPC_GCC = gC -Dpowerc=1 -Dpascal= -DANSI_PROTOTYPES -DMPW @@ -40,12 +43,6 @@ CFLAGS = -# These two definitions must *not* have any trailing blanks. - -SEGFLAG_68K = -s - -SEGFLAG_PPC = -d dumdum_ - # Tool to use for making libraries/archives. AR_LIB = Lib @@ -114,13 +111,23 @@ "{Libraries}"ToolLibs.o \Option-d "{MW68KLibraries}MPW ANSI (4i) C.68K.Lib" -EXTRALIBS_PPC = \Option-d +EXTRALIBS_PPC_XCOFF = \Option-d "{PPCLibraries}"StdCRuntime.o \Option-d "{PPCLibraries}"InterfaceLib.xcoff \Option-d "{PPCLibraries}"MathLib.xcoff \Option-d "{PPCLibraries}"StdCLib.xcoff \Option-d "{PPCLibraries}"PPCToolLibs.o \Option-d - "{PPCLibraries}"PPCCRuntime.o + "{PPCLibraries}"PPCCRuntime.o \Option-d + "{GCCPPCLibraries}"libgcc.xcoff + +EXTRALIBS_PPC = \Option-d + "{PPCLibraries}"StdCRuntime.o \Option-d + "{SharedLibraries}"InterfaceLib \Option-d + "{SharedLibraries}"MathLib \Option-d + "{SharedLibraries}"StdCLib \Option-d + "{PPCLibraries}"PPCToolLibs.o \Option-d + "{PPCLibraries}"PPCCRuntime.o \Option-d + "{GCCPPCLibraries}"libgcc.xcoff EXTRALIBS_MWCPPC = \Option-d "{MWPPCLibraries}"MWStdCRuntime.Lib \Option-d diff -urN binutils-2.7/config/mt-sparcpic binutils-2.8/config/mt-sparcpic --- binutils-2.7/config/mt-sparcpic Thu Jul 4 12:22:06 1996 +++ binutils-2.8/config/mt-sparcpic Wed Apr 30 12:57:32 1997 @@ -1 +1 @@ -PICFLAG_FOR_TARGET=-fpic +PICFLAG_FOR_TARGET=-fPIC diff -urN binutils-2.7/config.guess binutils-2.8/config.guess --- binutils-2.7/config.guess Thu Jul 4 12:21:56 1996 +++ binutils-2.8/config.guess Wed Apr 30 12:57:44 1997 @@ -1,6 +1,6 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. +# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -67,21 +67,49 @@ amiga:NetBSD:*:*) echo m68k-cbm-netbsd${UNAME_RELEASE} exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - Pyramid*:OSx*:*:*) + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; - sun4*:SunOS:5.*:*) + NILE:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) - echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize @@ -101,15 +129,39 @@ sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; atari*:NetBSD:*:*) echo m68k-atari-netbsd${UNAME_RELEASE} exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; sun3*:NetBSD:*:*) echo m68k-sun-netbsd${UNAME_RELEASE} exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; mac68k:NetBSD:*:*) echo m68k-apple-netbsd${UNAME_RELEASE} exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; @@ -133,10 +185,11 @@ exit (-1); } EOF - ${CC-cc} dummy.c -o dummy && ./dummy "${UNAME_RELEASE}" \ + ${CC-cc} dummy.c -o dummy \ + && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm dummy.c dummy && exit 0 rm -f dummy.c dummy - echo mips-mips-riscos{UNAME_RELEASE} + echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix @@ -179,10 +232,10 @@ *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i[34]86:AIX:*:*) + i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; *:AIX:2:3) @@ -245,7 +298,7 @@ case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/7?? | 9000/8?[679] ) HP_ARCH=hppa1.1 ;; + 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;; 9000/8?? ) HP_ARCH=hppa1.0 ;; esac HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` @@ -293,6 +346,13 @@ hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; @@ -320,17 +380,33 @@ CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} exit 0 ;; - CRAY*C90:*:*:*) - echo c90-cray-unicos${UNAME_RELEASE} + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; hp3[0-9][05]:NetBSD:*:*) echo m68k-hp-netbsd${UNAME_RELEASE} exit 0 ;; - i[34]86:BSD/386:*:* | *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` @@ -338,8 +414,11 @@ *:NetBSD:*:*) echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; i*:CYGWIN*:*) - echo i386-unknown-cygwin32 + echo i386-pc-cygwin32 exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin32 @@ -348,33 +427,50 @@ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,-.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. ld_help_string=`ld --help 2>&1` - if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then - echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 - elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then - echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0 - elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then - echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0 + if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then + echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then + echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then + echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then - echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 + echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0 elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then - echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0 + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then - echo "powerpc-unknown-linux" ; exit 0 + echo "powerpc-unknown-linux-gnu" ; exit 0 elif test "${UNAME_MACHINE}" = "alpha" ; then - echo alpha-unknown-linux ; exit 0 + echo alpha-unknown-linux-gnu ; exit 0 elif test "${UNAME_MACHINE}" = "sparc" ; then - echo sparc-unknown-linux ; exit 0 + echo sparc-unknown-linux-gnu ; exit 0 + elif test "${UNAME_MACHINE}" = "mips" ; then + cat >dummy.c </dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy else - # Either a pre-BFD a.out linker (linuxoldld) or one that does not give us - # useful --help. Gcc wants to distinguish between linuxoldld and linuxaout. + # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us + # useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout. test ! -d /usr/lib/ldscripts/. \ - && echo "${UNAME_MACHINE}-unknown-linuxoldld" && exit 0 + && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 # Determine whether the default compiler is a.out or elf cat >dummy.c </dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} else - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi exit 0 ;; - i[34]86:*:3.2:*) + i?86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 - echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else - echo ${UNAME_MACHINE}-unknown-sysv32 + echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; Intel:Mach:3*:*) - echo i386-unknown-mach3 + echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 @@ -435,34 +531,36 @@ # "miniframe" echo m68010-convergent-sysv exit 0 ;; - M680[234]0:*:R3V[567]*:*) + M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) - UNAME_REL=4.3 - if test -f /etc/.relid; then - UNAME_REL=4.3.`awk '{ print $3 }' /etc/.relid` - fi - uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv$UNAME_REL && exit 0 - uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv$UNAME_REL && exit 0 ;; + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - uname -p 2>/dev/null | grep 86 >/dev/null \ + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; - m680[234]0:LynxOS:2.[23]*:*) - echo m68k-lynx-lynxos${UNAME_RELEASE} + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i[34]86:LynxOS:2.[23]*:*) - echo i386-lynx-lynxos${UNAME_RELEASE} + i?86:LynxOS:2.*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - TSUNAMI:LynxOS:2.[23]*:*) - echo sparc-lynx-lynxos${UNAME_RELEASE} + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - rs6000:LynxOS:2.[23]*:*) - echo rs6000-lynx-lynxos${UNAME_RELEASE} + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 @@ -475,10 +573,23 @@ echo ns32k-sni-sysv fi exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; - R3000:*System_V*:*:*) + R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else @@ -528,7 +639,7 @@ #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3"); + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); exit (0); #endif @@ -545,7 +656,7 @@ #endif #if defined (__386BSD__) - printf ("i386-unknown-bsd\n"); exit (0); + printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) diff -urN binutils-2.7/config.sub binutils-2.8/config.sub --- binutils-2.7/config.sub Thu Jul 4 12:37:54 1996 +++ binutils-2.8/config.sub Wed Apr 30 12:57:44 1997 @@ -3,7 +3,7 @@ # Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. +# can handle that machine. It does not imply ALL GNU software can. # # 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 @@ -41,6 +41,8 @@ # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. if [ x$1 = x ] @@ -62,11 +64,21 @@ ;; esac -# Separate what the user gave into CPU-COMPANY and OS (if any). -basic_machine=`echo $1 | sed 's/-[^-]*$//'` -if [ $basic_machine != $1 ] -then os=`echo $1 | sed 's/.*-/-/'` -else os=; fi +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also @@ -81,7 +93,8 @@ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp ) + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) os= basic_machine=$1 ;; @@ -89,48 +102,47 @@ os= basic_machine=$1 ;; - -apple*) # CYGNUS LOCAL - os= - basic_machine=$1 - ;; -scout) # CYGNUS LOCAL ;; -wrs) # CYGNUS LOCAL os=vxworks basic_machine=$1 ;; + -hiuxmpp) + os=-hiuxmpp + ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos @@ -150,9 +162,9 @@ case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i[3456]86 | i860 | m68k | m68000 | m88k | ns32k | arm \ - | arme[lb] | pyramid \ - | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \ + tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arm \ + | arme[lb] | pyramid | mn10300 \ + | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \ | alpha | we32k | ns16k | clipper | i370 | sh \ | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \ | pdp11 | mips64el | mips64orion | mips64orionel \ @@ -168,27 +180,52 @@ mips64vr4100 | mips64vr4100el) # CYGNUS LOCAL jsmith/vr4100 basic_machine=$basic_machine-unknown ;; + mips64vr5000 | mips64vr5000el) # CYGNUS LOCAL ian/vr5000 + basic_machine=$basic_machine-unknown + ;; + mips16) # CYGNUS LOCAL krk/mips16 + basic_machine=$basic_machine-unknown + ;; +# CYGNUS LOCAL law + mn10200) + basic_machine=$basic_machine-unknown + ;; +# END CYGNUS LOCAL + d10v) # CYGNUS LOCAL meissner/d10v + basic_machine=$basic_machine-unknown + ;; + mn10200) # CYGNUS LOCAL + basic_machine=$basic_machine-unknown + ;; + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[3456]86) + basic_machine=$basic_machine-pc + ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \ - | sparc-* | ns32k-* | fx80-* | arm-* | arme[lb]-* | c[123]* \ + vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \ | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \ - | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \ | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \ | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-*) + | mips64el-* | mips64orion-* | mips64orionel-* | f301-*) ;; - m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | h8500-*) # CYGNUS LOCAL + m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | h8500-* | d10v-*) # CYGNUS LOCAL ;; mips64vr4300-* | mips64vr4300el-*) # CYGNUS LOCAL jsmith/vr4300 ;; mips64vr4100-* | mips64vr4100el-*) # CYGNUS LOCAL jsmith/vr4100 ;; + mips16-*) # CYGNUS LOCAL krk/mips16 + ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) # CYGNUS LOCAL @@ -242,10 +279,6 @@ basic_machine=m68k-apollo os=-bsd ;; - arm | armel | armeb) - basic_machine=arm-arm - os=-aout - ;; aux) basic_machine=m68k-apple os=-aux @@ -282,6 +315,10 @@ basic_machine=cray2-cray os=-unicos ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; crds | unos) basic_machine=m68k-crds ;; @@ -332,6 +369,10 @@ basic_machine=tron-gmicro os=-sysv ;; + hiuxmpp) + basic_machine=hppa1.1-hitachi + os=-hiuxmpp + ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -391,6 +432,9 @@ hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; + hppa-next) + os=-nextstep3 + ;; hppaosf) # CYGNUS LOCAL basic_machine=hppa1.1-hp os=-osf @@ -401,19 +445,19 @@ ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[3456]86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i[3456]86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i[3456]86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i[3456]86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) # CYGNUS LOCAL @@ -456,6 +500,14 @@ miniframe) basic_machine=m68000-convergent ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux + ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; @@ -519,7 +571,7 @@ basic_machine=i960-intel os=-nindy ;; - mon960) + mon960) # CYGNUS LOCAL basic_machine=i960-intel os=-mon960 ;; @@ -695,6 +747,9 @@ basic_machine=vax-dec os=-vms ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; vxworks960) basic_machine=i960-wrs os=-vxworks @@ -739,7 +794,11 @@ basic_machine=hppa1.1-oki ;; mips) - basic_machine=mips-mips + if [ x$os = x-linux ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi ;; romp) basic_machine=romp-ibm @@ -797,6 +856,8 @@ if [ x"$os" != x"" ] then case $os in + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` @@ -808,34 +869,38 @@ os=-sysv4 ;; -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux|'` + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[3456]* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigados* | -msdos* | -moss* | -newsos* | -unicos* | -aos* | -aof* \ - | -nindy* | -mon960* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \ - | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \ + | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin32* | -pe* | -psos*) + | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -linux-gnu* | -uxpv*) # Remember, each alternative MUST END IN *, to match a version number. ;; # CYGNUS LOCAL -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -proelf | -os9* \ - | -macos* | -mpw* | -magic* | -rtems*) + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mon960* | -lnews* ) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; # END CYGNUS LOCAL + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; @@ -952,12 +1017,18 @@ mips*-cisco) # CYGNUS LOCAL os=-elf ;; + mips*-*) # CYGNUS LOCAL + os=-elf + ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; + *-be) # CYGNUS LOCAL + os=-beos + ;; *-ibm) os=-aix ;; @@ -1030,6 +1101,9 @@ *-masscomp) os=-rtu ;; + f301-fujitsu) + os=-uxpv + ;; *-rom68k) # CYGNUS LOCAL os=-coff ;; @@ -1057,15 +1131,12 @@ -sunos*) vendor=sun ;; - -bosx*) # CYGNUS LOCAL - vendor=bull - ;; - -lynxos*) - vendor=lynx - ;; -aix*) vendor=ibm ;; + -beos*) # CYGNUS LOCAL + vendor=be + ;; -hpux*) vendor=hp ;; @@ -1090,7 +1161,7 @@ -ptx*) vendor=sequent ;; - -vxworks*) + -vxsim* | -vxworks*) vendor=wrs ;; -aux*) diff -urN binutils-2.7/configure binutils-2.8/configure --- binutils-2.7/configure Thu Jul 4 12:21:59 1996 +++ binutils-2.8/configure Wed Apr 30 12:57:44 1997 @@ -3,7 +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 Free Software Foundation, Inc. +# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997 +# Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -47,7 +48,7 @@ Makefile_in=Makefile.in arguments= build_alias= -cache_file= +cache_file=config.cache cache_file_option= configdirs= exec_prefix= @@ -80,7 +81,7 @@ target_alias=NOTARGET target_makefile_frag= undefs=NOUNDEFS -version="$Revision: 1.224 $" +version="$Revision: 1.230.2.1 $" x11=default ### we might need to use some other shell than /bin/sh for running subshells @@ -340,7 +341,7 @@ # Neither --host option nor undefs were present. # Call config.guess. guesssys=`echo ${progname} | sed 's/configure$/config.guess/'` - if host_alias=`${guesssys}` + if host_alias=`${config_shell} ${guesssys}` then # If the string we are going to use for # the target is a prefix of the string @@ -426,7 +427,7 @@ moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'` # this is a hack. sun4 must always be a valid host alias or this will fail. -if ${configsub} sun4 >/dev/null 2>&1 ; then +if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then true else echo '***' cannot find config.sub. 1>&2 @@ -434,7 +435,7 @@ fi touch config.junk -if ${moveifchange} config.junk config.trash ; then +if ${config_shell} ${moveifchange} config.junk config.trash ; then true else echo '***' cannot find move-if-change. 1>&2 @@ -573,9 +574,9 @@ case "${build_alias}" in "") if result=`${config_shell} ${configsub} ${host_alias}` ; then - build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` - build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` - build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` + build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` + build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` + build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` build=${build_cpu}-${build_vendor}-${build_os} build_alias=${host_alias} fi @@ -583,9 +584,9 @@ *) if result=`${config_shell} ${configsub} ${build_alias}` ; then buildopt="--build=${build_alias}" - build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` - build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` - build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` + build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` + build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` + build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` build=${build_cpu}-${build_vendor}-${build_os} else echo "Unrecognized build system name ${build_alias}." 1>&2 @@ -600,9 +601,9 @@ echo "Unrecognized host system name ${host_alias}." 1>&2 exit 1 fi -host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` -host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` -host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` host=${host_cpu}-${host_vendor}-${host_os} . ${tmpfile}.hst @@ -613,9 +614,9 @@ echo "Unrecognized target system name ${target_alias}." 1>&2 exit 1 fi -target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` -target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` -target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` target=${target_cpu}-${target_vendor}-${target_os} . ${tmpfile}.tgt @@ -673,8 +674,8 @@ if [ -z "${CC}" -a -r Makefile ]; then sed -n -e ':loop /\\$/ N -/\\$/ b loop s/\\\n//g +t loop /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc CC=`tail -1 Makefile.cc` rm -f Makefile.cc @@ -683,8 +684,8 @@ if [ -z "${CXX}" -a -r Makefile ]; then sed -n -e ':loop /\\$/ N -/\\$/ b loop s/\\\n//g +t loop /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc CXX=`tail -1 Makefile.cc` rm -f Makefile.cc @@ -734,7 +735,7 @@ tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD" tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET" - tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET HOST_PREFIX" + 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} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET" @@ -742,8 +743,8 @@ if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile ]; then sed -n -e ':loop /\\$/ N -/\\$/ b loop s/\\\n//g +t loop /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \ < Makefile > Makefile.v t=`tail -1 Makefile.v` @@ -765,6 +766,7 @@ CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-gcc} 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}- LD=${LD-${host_alias}-ld} @@ -1108,15 +1110,15 @@ -e "/^CC[ ]*=/{ :loop1 /\\\\$/ N - /\\\\$/ b loop1 s/\\\\\\n//g + t loop1 s%^CC[ ]*=.*$%CC = ${CC}% }" \ -e "/^CXX[ ]*=/{ :loop2 /\\\\$/ N - /\\\\$/ b loop2 s/\\\\\\n//g + t loop2 s%^CXX[ ]*=.*$%CXX = ${CXX}% }" \ -e "s:^SHELL[ ]*=.*$:SHELL = ${config_shell}:" \ @@ -1204,7 +1206,7 @@ if [ -r ${subdir}/config.back ] ; then mv -f ${subdir}/config.back ${subdir}/config.status fi - ${moveifchange} ${subdir}/config.new ${subdir}/config.status + ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status ;; *) rm -f ${Makefile} ${subdir}/config.status ${links} ;; diff -urN binutils-2.7/configure.in binutils-2.8/configure.in --- binutils-2.7/configure.in Mon Jul 15 15:15:15 1996 +++ binutils-2.8/configure.in Wed Apr 30 13:16:20 1997 @@ -14,7 +14,7 @@ ## For more information on these two systems, check out the documentation ## for 'Autoconf' (autoconf.texi) and 'Configure' (configure.texi). -# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. +# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -41,19 +41,16 @@ # these libraries are used by various programs built for the host environment # -host_libs="mmalloc libiberty opcodes bfd readline gash tcl tk tclX" +host_libs="mmalloc libiberty opcodes bfd readline gash db tcl tk tclX itcl" if [ "${enable_gdbgui}" = "yes" ] ; then host_libs="${host_libs} libgui" fi # these tools are built for the host environment -# -host_tools="byacc flex bison binutils ld gas gcc gdb make patch - prms send-pr gprof gdbtest tgas etc expect dejagnu sim bash - m4 autoconf ispell grep diff rcs cvs fileutils shellutils time - textutils wdiff find emacs emacs19 uudecode hello tar gzip indent - recode release sed utils guile perl apache inet gawk" +# Note, the powerpc-eabi build depends on sim occurring before gdb in order to +# know that we are building the simulator. +host_tools="byacc flex bison binutils ld gas gcc sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu bash m4 autoconf ispell grep diff rcs cvs fileutils shellutils time textutils wdiff find emacs emacs19 uudecode hello tar gzip indent recode release sed utils guile perl apache inet gawk findutils sn" # these libraries are built for the target environment, and are built after @@ -81,10 +78,9 @@ # directories to be built in the native environment only # -native_only="autoconf cvs emacs emacs19 fileutils find gawk grep gzip hello - indent ispell m4 rcs recode sed shellutils tar textutils gash - uudecode wdiff gprof target-groff guile perl apache inet time - bash" +# This must be a single line because of the way it is searched by grep in +# the code below. +native_only="autoconf cvs emacs emacs19 fileutils find gawk grep gzip hello indent ispell m4 rcs recode sed shellutils tar textutils gash uudecode wdiff gprof target-groff guile perl apache inet time bash prms sn" # directories to be built in a cross environment only # @@ -115,27 +111,28 @@ m68k-hp-hpux*) host_makefile_frag=config/mh-hp300 ;; m68k-apollo-sysv*) host_makefile_frag=config/mh-apollo68 ;; m68k-apollo-bsd*) host_makefile_frag=config/mh-a68bsd ;; - m68k-*-linux*) host_makefile_frag=config/mh-linux ;; m88k-dg-dgux*) host_makefile_frag=config/mh-dgux ;; m88k-harris-cxux*) host_makefile_frag=config/mh-cxux ;; m88k-motorola-sysv*) host_makefile_frag=config/mh-delta88;; mips*-dec-ultrix*) host_makefile_frag=config/mh-decstation ;; mips*-nec-sysv4*) host_makefile_frag=config/mh-necv4 ;; - mips*-sgi-irix[56]*) host_makefile_frag=config/mh-irix5 ;; + mips*-sgi-irix6*) host_makefile_frag=config/mh-irix6 ;; + mips*-sgi-irix5*) host_makefile_frag=config/mh-irix5 ;; mips*-sgi-irix4*) host_makefile_frag=config/mh-irix4 ;; mips*-sgi-irix3*) host_makefile_frag=config/mh-sysv ;; mips*-*-sysv4*) host_makefile_frag=config/mh-sysv4 ;; mips*-*-sysv*) host_makefile_frag=config/mh-riscos ;; - i[345]86-ncr-sysv4.3) host_makefile_frag=config/mh-ncrsvr43 ;; - i[345]86-ncr-sysv4*) host_makefile_frag=config/mh-ncr3000 ;; - i[345]86-*-sco3.2v5*) host_makefile_frag=config/mh-sysv ;; - i[345]86-*-sco*) host_makefile_frag=config/mh-sco ;; - i[345]86-*-isc*) host_makefile_frag=config/mh-sysv ;; - i[345]86-*-linux*) host_makefile_frag=config/mh-linux ;; - i[345]86-*-solaris2*) host_makefile_frag=config/mh-sysv4 ;; - i[345]86-*-aix*) host_makefile_frag=config/mh-aix386 ;; - i[345]86-*-go32*) host_makefile_frag=config/mh-go32 ;; + i[3456]86-*-dgux*) host_makefile_frag=config/mh-dgux386 ;; + i[3456]86-ncr-sysv4.3) host_makefile_frag=config/mh-ncrsvr43 ;; + i[3456]86-ncr-sysv4*) host_makefile_frag=config/mh-ncr3000 ;; + i[3456]86-*-sco3.2v5*) host_makefile_frag=config/mh-sysv ;; + i[3456]86-*-sco*) host_makefile_frag=config/mh-sco ;; + i[3456]86-*-isc*) host_makefile_frag=config/mh-sysv ;; + i[3456]86-*-solaris2*) host_makefile_frag=config/mh-sysv4 ;; + i[3456]86-*-aix*) host_makefile_frag=config/mh-aix386 ;; + i[3456]86-*-go32*) host_makefile_frag=config/mh-go32 ;; *-cygwin32*) host_makefile_frag=config/mh-cygwin32 ;; + *-windows*) host_makefile_frag=config/mh-windows ;; vax-*-ultrix2*) host_makefile_frag=config/mh-vaxult2 ;; *-*-solaris2*) host_makefile_frag=config/mh-solaris ;; m68k-sun-sunos*) host_makefile_frag=config/mh-sun3 ;; @@ -192,7 +189,7 @@ waugh= case "${host}" in hppa*) waugh=config/mh-papic ;; - i[345]86-*) waugh=config/mh-x86pic ;; + i[3456]86-*) waugh=config/mh-x86pic ;; sparc64-*) waugh=config/mh-sparcpic ;; *) waugh=config/mh-${host_cpu}pic ;; esac @@ -211,7 +208,7 @@ case "${target}" in v810*) target_makefile_frag=config/mt-v810 ;; - i[345]86-*-netware*) target_makefile_frag=config/mt-netware ;; + i[3456]86-*-netware*) target_makefile_frag=config/mt-netware ;; powerpc-*-netware*) target_makefile_frag=config/mt-netware ;; esac @@ -314,7 +311,9 @@ # Default to using --with-stabs for certain targets. if [ x${with_stabs} = x ]; then case "${target}" in - mips*-*-* | alpha*-*-osf* | i[345]86*-*-sysv4* | i[345]86*-*-unixware*) + mips*-*-irix6*) + ;; + mips*-*-* | alpha*-*-osf* | i[3456]86*-*-sysv4* | i[3456]86*-*-unixware*) with_stabs=yes; withoptions="${withoptions} --with-stabs" ;; @@ -355,7 +354,7 @@ # Configure extra directories which are host specific case "${host}" in - i[345]86-*-go32*) + i[3456]86-*-go32*) configdirs="$configdirs dosrel" ;; *-cygwin32*) configdirs="$configdirs dosrel" ;; @@ -368,17 +367,22 @@ noconfigdirs="" case "${host}" in - i[345]86-*-vsta) - noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl apache inet" + i[3456]86-*-vsta) + noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl apache inet itcl db sn" ;; - i[345]86-*-go32) - noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl apache inet" + i[3456]86-*-go32) + noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl apache inet itcl db sn" ;; *-*-cygwin32) - noconfigdirs="tk tcl expect dejagnu cvs autoconf bison send-pr gprof rcs guile perl texinfo apache inet" + noconfigdirs="expect dejagnu cvs autoconf bison send-pr gprof rcs guile perl texinfo apache inet itcl db sn" + ;; + *-*-windows*) +# This is only used to build WinGDB... + configdirs="bfd gdb libiberty opcodes readline sim" + target_configdirs= ;; ppc*-*-pe) - noconfigdirs="patch diff make tk tcl expect dejagnu cvs autoconf texinfo bison send-pr gprof rcs guile perl apache inet" + noconfigdirs="patch diff make tk tcl expect dejagnu cvs autoconf texinfo bison send-pr gprof rcs guile perl apache inet itcl db sn" ;; esac @@ -390,9 +394,6 @@ *-*-vxworks*) noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; - *-*-ose) - noconfigdirs="$noconfigdirs target-libgloss" - ;; 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 or grep. @@ -409,15 +410,22 @@ arm-*-pe*) noconfigdirs="$noconfigdirs target-libgloss" ;; + arm-*-coff*) + noconfigdirs="$noconfigdirs target-libgloss" + ;; arm-*-riscix*) noconfigdirs="$noconfigdirs ld target-libgloss" ;; + d10v-*-*) + noconfigdirs="$noconfigdirs target-librx target-libg++ target-libstdc++ target-libio target-libgloss" + ;; h8300*-*-* | \ h8500-*-*) noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss" ;; hppa*-*-*elf* | \ - hppa*-*-lites*) + hppa*-*-lites* | \ + hppa*-*-rtems* ) # Do configure ld/binutils/gas for this case. ;; hppa*-*-*) @@ -430,13 +438,13 @@ esac noconfigdirs="$noconfigdirs ld shellutils" ;; - i[345]86-*-go32) + i[3456]86-*-go32) # but don't build gdb noconfigdirs="$noconfigdirs gdb target-libg++ target-libstdc++ target-libio target-librx" ;; *-*-cygwin32) target_configdirs="$target_configdirs target-winsup" - noconfigdirs="$noconfigdirs tcl tk expect target-libgloss" + noconfigdirs="$noconfigdirs expect target-libgloss itcl db sn" # always build newlib. skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` @@ -446,24 +454,24 @@ *) noconfigdirs="$noconfigdirs gdb" esac ;; - i[345]86-*-pe) + i[3456]86-*-pe) noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss" ;; - i[345]86-*-sco3.2v5*) + i[3456]86-*-sco3.2v5*) # The linker does not yet know about weak symbols in COFF, # and is not configured to handle mixed ELF and COFF. noconfigdirs="$noconfigdirs gprof ld target-libgloss" ;; - i[345]86-*-sco*) + i[3456]86-*-sco*) noconfigdirs="$noconfigdirs gprof target-libgloss" ;; - i[345]86-*-solaris2*) + i[3456]86-*-solaris2*) # The linker does static linking correctly, but the Solaris C library # has bugs such that some important functions won't work when statically # linked. (See man pages for getpwuid, for example.) noconfigdirs="$noconfigdirs ld target-libgloss" ;; - i[345]86-*-sysv4*) + i[3456]86-*-sysv4*) # The SYSV4 C compiler doesn't handle Emacs correctly case "${CC}" in "" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;; @@ -472,6 +480,12 @@ # but that's okay since emacs doesn't work anyway noconfigdirs="$noconfigdirs emacs emacs19 target-libgloss" ;; + mn10200-*-*) + noconfigdirs="$noconfigdirs target-libgloss" + ;; + mn10300-*-*) + noconfigdirs="$noconfigdirs target-libgloss" + ;; powerpc-*-aix*) # copied from rs6000-*-* entry noconfigdirs="$noconfigdirs gprof cvs target-libgloss" @@ -480,13 +494,13 @@ ;; powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe) target_configdirs="$target_configdirs target-winsup" - noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss" + noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl db sn" # always build newlib. skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;; # This is temporary until we can link against shared libraries powerpcle-*-solaris*) - noconfigdirs="$noconfigdirs gdb sim make tcl tk expect" + noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl db sn" ;; rs6000-*-lynxos*) # The CVS server code doesn't work on the RS/6000 @@ -512,8 +526,7 @@ mips*-*-irix6*) # The GNU linker does not support shared libraries. # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work) - # BFD does not have Irix 6 support yet. - noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb readline mmalloc sim gprof emacs target-libgloss" + noconfigdirs="$noconfigdirs ld gas gprof emacs target-libgloss" ;; mips*-dec-bsd*) noconfigdirs="$noconfigdirs gprof target-libgloss" @@ -529,8 +542,8 @@ ;; sh-*-*) case "${host}" in - i[345]86-*-vsta) ;; # don't add gprof back in - i[345]86-*-go32) ;; # don't add gprof back in + i[3456]86-*-vsta) ;; # don't add gprof back in + i[3456]86-*-go32) ;; # don't add gprof back in *) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;; esac noconfigdirs="$noconfigdirs target-libgloss" @@ -579,7 +592,7 @@ # If we are building a Canadian Cross, discard tools that can not be built # using a cross compiler. FIXME: These tools should be fixed. if [ "${build}" != "${host}" ]; then - noconfigdirs="$noconfigdirs tcl tk expect dejagnu" + noconfigdirs="$noconfigdirs expect dejagnu itcl db sn" fi # Make sure we don't let GNU ld be added if we didn't want it. @@ -718,10 +731,18 @@ fi fi +# If using newlib, add --with-newlib to the withoptions so that gcc/configure +# can detect this case. + +if [ x${with_newlib} != xno ] && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 && [ -d ${srcdir}/newlib ] ; then + with_newlib=yes + withoptions="$withoptions --with-newlib" +fi + if [ x${shared} = xyes ]; then case "${target}" in hppa*) target_makefile_frag=config/mt-papic ;; - i[345]86-*) target_makefile_frag=config/mt-x86pic ;; + i[3456]86-*) target_makefile_frag=config/mt-x86pic ;; *) target_makefile_frag=config/mt-${target_cpu}pic ;; esac fi diff -urN binutils-2.7/etc/Makefile.in binutils-2.8/etc/Makefile.in --- binutils-2.7/etc/Makefile.in Thu Jul 4 12:31:58 1996 +++ binutils-2.8/etc/Makefile.in Wed Apr 30 12:57:39 1997 @@ -2,16 +2,18 @@ # Makefile.in for etc # -prefix = /usr/local -exec_prefix = $(prefix) +prefix = @prefix@ +exec_prefix = @exec_prefix@ -srcdir = . -bindir = $(exec_prefix)/bin -libdir = $(exec_prefix)/lib +srcdir = @srcdir@ +VPATH = @srcdir@ + +bindir = @bindir@ +libdir = @libdir@ tooldir = $(libdir) -datadir = $(prefix)/share +datadir = @datadir@ -mandir = $(prefix)/man +mandir = @mandir@ man1dir = $(mandir)/man1 man2dir = $(mandir)/man2 man3dir = $(mandir)/man3 @@ -21,13 +23,13 @@ man7dir = $(mandir)/man7 man8dir = $(mandir)/man8 man9dir = $(mandir)/man9 -infodir = $(prefix)/info +infodir = @infodir@ SHELL = /bin/sh -INSTALL = install -c -INSTALL_PROGRAM = $(INSTALL) -INSTALL_DATA = $(INSTALL) +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ MAKEINFO = makeinfo TEXI2DVI = texi2dvi @@ -85,7 +87,7 @@ mostlyclean: clean distclean: clean - rm -f Makefile config.status + rm -f Makefile config.status config.cache maintainer-clean realclean: distclean rm -f *.info* diff -urN binutils-2.7/etc/cfg-paper.info binutils-2.8/etc/cfg-paper.info --- binutils-2.7/etc/cfg-paper.info Mon Jul 15 12:23:21 1996 +++ binutils-2.8/etc/cfg-paper.info Wed Apr 30 12:57:40 1997 @@ -1,4 +1,4 @@ -This is Info file cfg-paper.info, produced by Makeinfo-1.55 from the +This is Info file cfg-paper.info, produced by Makeinfo-1.64 from the input file ./cfg-paper.texi. This document attempts to describe the general concepts behind diff -urN binutils-2.7/etc/configure binutils-2.8/etc/configure --- binutils-2.7/etc/configure Wed Dec 31 19:00:00 1969 +++ binutils-2.8/etc/configure Wed Apr 30 12:57:40 1997 @@ -0,0 +1,794 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.10 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +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= + +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 + --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" ;; + + -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.10" + 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 LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +# 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=configure.texi + +# 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 "$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 +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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + +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 + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; 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 $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# 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 +# 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 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + 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_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +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 +# 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 | + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </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.10" + 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" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%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%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g + +CEOF +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[: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 relative srcdir, etc. 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 + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +fi; done +rm -f conftest.subs + + + +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 -urN binutils-2.7/etc/configure.in binutils-2.8/etc/configure.in --- binutils-2.7/etc/configure.in Thu Jul 4 12:22:33 1996 +++ binutils-2.8/etc/configure.in Wed Apr 30 12:57:40 1997 @@ -1,17 +1,7 @@ -# This file is a shell script fragment that supplies the information -# necessary to tailor a template configure script into the configure -# script appropriate for this directory. For more information, check -# any existing configure script. +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5) +AC_INIT(configure.texi) -srctrigger=configure.texi -srcname="general documentation" +AC_PROG_INSTALL -# per-host: - -# per-target: - -# -# Local Variables: -# fill-column: 131 -# End: -# +AC_OUTPUT(Makefile) diff -urN binutils-2.7/etc/configure.info binutils-2.8/etc/configure.info --- binutils-2.7/etc/configure.info Mon Jul 15 12:23:20 1996 +++ binutils-2.8/etc/configure.info Wed Apr 30 12:57:41 1997 @@ -1,4 +1,4 @@ -This is Info file configure.info, produced by Makeinfo-1.55 from the +This is Info file configure.info, produced by Makeinfo-1.64 from the input file ./configure.texi. START-INFO-DIR-ENTRY @@ -24,41 +24,41 @@  Indirect: configure.info-1: 968 -configure.info-2: 50440 +configure.info-2: 50426  Tag Table: (Indirect) Node: Top968 -Node: What configure does1463 -Node: Invoking configure4783 -Node: Using configure11838 -Node: What configure really does13103 -Node: Build variables18380 -Node: Build directories20582 -Node: Makefile generation23984 -Node: config.guess25515 -Node: config.status26405 -Node: configure.in26962 -Node: configure variables28632 -Node: Minimal36798 -Node: Declarations37608 -Node: per-host38082 -Node: per-target38819 -Node: post-target39642 -Node: Example40225 -Node: Install locations40932 -Node: prefix41733 -Node: exec_prefix42626 -Node: Install details44431 -Node: Host49368 -Node: Target50004 -Node: Makefile fragments50440 -Node: Makefile extensions52056 -Node: Porting55783 -Node: Programs56235 -Node: Hosts and targets61089 -Node: Sites62752 -Node: Variables Index63452 -Node: Concept Index66624 +Node: What configure does1449 +Node: Invoking configure4769 +Node: Using configure11824 +Node: What configure really does13089 +Node: Build variables18366 +Node: Build directories20568 +Node: Makefile generation23970 +Node: config.guess25501 +Node: config.status26391 +Node: configure.in26948 +Node: configure variables28618 +Node: Minimal36784 +Node: Declarations37594 +Node: per-host38068 +Node: per-target38805 +Node: post-target39628 +Node: Example40211 +Node: Install locations40918 +Node: prefix41719 +Node: exec_prefix42612 +Node: Install details44417 +Node: Host49354 +Node: Target49990 +Node: Makefile fragments50426 +Node: Makefile extensions52042 +Node: Porting55769 +Node: Programs56221 +Node: Hosts and targets61075 +Node: Sites62738 +Node: Variables Index63438 +Node: Concept Index66610  End Tag Table diff -urN binutils-2.7/etc/configure.info-1 binutils-2.8/etc/configure.info-1 --- binutils-2.7/etc/configure.info-1 Mon Jul 15 12:23:19 1996 +++ binutils-2.8/etc/configure.info-1 Wed Apr 30 12:57:39 1997 @@ -1,4 +1,4 @@ -This is Info file configure.info, produced by Makeinfo-1.55 from the +This is Info file configure.info, produced by Makeinfo-1.64 from the input file ./configure.texi. START-INFO-DIR-ENTRY @@ -22,7 +22,7 @@ translation approved by Cygnus Support.  -File: configure.info, Node: Top, Next: What configure does, Prev: (DIR), Up: (DIR) +File: configure.info, Node: Top, Next: What configure does, Up: (dir) Cygnus configure **************** diff -urN binutils-2.7/etc/configure.info-2 binutils-2.8/etc/configure.info-2 --- binutils-2.7/etc/configure.info-2 Mon Jul 15 12:23:19 1996 +++ binutils-2.8/etc/configure.info-2 Wed Apr 30 12:57:41 1997 @@ -1,4 +1,4 @@ -This is Info file configure.info, produced by Makeinfo-1.55 from the +This is Info file configure.info, produced by Makeinfo-1.64 from the input file ./configure.texi. START-INFO-DIR-ENTRY @@ -339,7 +339,7 @@ * docdir: Install details. * enable-FEATURE: Invoking configure. * exec-prefix: Invoking configure. -* exec_prefix: exec_prefix. +* exec_prefix <1>: exec_prefix. * exec_prefix: Install details. * files: configure variables. * floating_point: configure variables. @@ -360,21 +360,21 @@ * nfp: Invoking configure. * norecursion: Invoking configure. * package_makefile_frag: configure variables. -* prefix: prefix. -* prefix: Install details. +* prefix <1>: prefix. +* prefix <2>: Install details. * prefix: Invoking configure. * program-prefix: Invoking configure. * removing: configure variables. * rm: Invoking configure. * site: Invoking configure. * site_makefile_frag: configure variables. -* srcdir: configure variables. -* srcdir: What configure does. +* srcdir <1>: configure variables. +* srcdir <2>: What configure does. * srcdir: Invoking configure. * srcname: configure variables. * srctrigger: configure variables. * subdirs: configure variables. -* target: Invoking configure. +* target <1>: Invoking configure. * target: configure variables. * target_cpu: configure variables. * target_makefile_frag: configure variables. @@ -417,7 +417,7 @@ * bindir: Install details. * config.guess: config.guess. * config.guess definition: What configure really does. -* config.status: config.status. +* config.status <1>: config.status. * config.status: What configure does. * config.status definition: What configure really does. * config.sub definition: What configure really does. @@ -441,22 +441,22 @@ * Makefile.in definition: What configure really does. * Makefile extensions: Makefile extensions. * Makefile fragments: Makefile fragments. -* Makefile generation: Makefile generation. +* Makefile generation <1>: Makefile generation. * Makefile generation: What configure does. * manNdir: Install details. * manNext: Install details. * mandir: Install details. -* nfp option: Invoking configure. +* nfp option <1>: Invoking configure. * nfp option: configure variables. * norecursion option: Invoking configure. * prefix: Install details. -* prefix option: Invoking configure. +* prefix option <1>: Invoking configure. * prefix option: prefix. * program-prefix option: Invoking configure. -* rm option: Invoking configure. +* rm option <1>: Invoking configure. * rm option: configure variables. * site option: Invoking configure. -* srcdir: configure variables. +* srcdir <1>: configure variables. * srcdir: What configure does. * srcdir option: Invoking configure. * srcname: configure variables. @@ -473,29 +473,28 @@ * without-PACKAGE option: Invoking configure. * configure.in interface: configure variables. * host shell-script fragment: per-host. -* per-host section: per-host. +* per-host section <1>: per-host. * per-host section: configure.in. -* per-invocation section: configure.in. +* per-invocation section <1>: configure.in. * per-invocation section: Declarations. -* per-target section: configure.in. +* per-target section <1>: configure.in. * per-target section: per-target. -* post-target section: configure.in. +* post-target section <1>: configure.in. * post-target section: post-target. * Abbreviating option names: Invoking configure. * Adding configure to new programs: Programs. * Adding hosts and targets: Hosts and targets. * Adding local info: Makefile fragments. -* Adding site info: Sites. +* Adding site info <1>: Sites. * Adding site info: Makefile fragments. * Behind the scenes: What configure really does. * BISON: Makefile extensions. -* Build directories: What configure does. +* Build directories <1>: What configure does. * Build directories: Build directories. * Build variables: Build variables. * Building for multiple hosts: Build directories. * Building for multiple targets: Build directories. * Canonical "triple": configure variables. -* Canonical "triple": configure variables. * Changing the install directory: prefix. * clean: Makefile extensions. * clean-info: Makefile extensions. @@ -503,7 +502,7 @@ * configure variables: configure variables. * Configuring for multiple hosts: exec_prefix. * Cygnus extensions: Makefile extensions. -* Cygnus Support Developer's Kit: What configure does. +* Cygnus Support Developer's Kit <1>: What configure does. * Cygnus Support Developer's Kit: Build variables. * datadir: Makefile extensions. * Declarations section: Declarations. @@ -511,14 +510,12 @@ * Detailed usage: Using configure. * docdir: Makefile extensions. * Example configure.in: Example. -* Example session: Build directories. -* Example session: Build directories. -* Example session: exec_prefix. -* Example session: Build variables. -* Example session: Makefile extensions. -* Example session: What configure really does. -* Example session: Sites. -* Example session: Invoking configure. +* Example session <1>: Build directories. +* Example session <2>: exec_prefix. +* Example session <3>: Build variables. +* Example session <4>: Makefile extensions. +* Example session <5>: What configure really does. +* Example session <6>: Sites. * Example session: Invoking configure. * For each invocation: Declarations. * Host: Host. @@ -549,8 +546,7 @@ * Sharing host-independent files: exec_prefix. * Sites: Sites. * Subdirectories: Install details. -* Symbolic links: What configure does. -* Symbolic links: configure variables. +* Symbolic links <1>: What configure does. * Symbolic links: configure variables. * Target: Target. * target shell-script fragment: per-target. @@ -558,12 +554,10 @@ * The exec_prefix directory: exec_prefix. * Truncating option names: Invoking configure. * Usage: Invoking configure. -* Usage: Invoking configure. * Usage: detailed: Using configure. * Using configure: Using configure. * Variables: Build variables. * Verbose Output: Invoking configure. -* version: Invoking configure. * version: Invoking configure. * What configure does: What configure does. * What configure really does: What configure really does. diff -urN binutils-2.7/etc/make-stds.texi binutils-2.8/etc/make-stds.texi --- binutils-2.7/etc/make-stds.texi Thu Jul 4 12:22:42 1996 +++ binutils-2.8/etc/make-stds.texi Wed Apr 30 12:57:41 1997 @@ -8,14 +8,28 @@ @cindex conventions for makefiles @cindex standards for makefiles -This chapter describes conventions for writing the Makefiles for GNU programs. +This +@ifinfo +node +@end ifinfo +@iftex +@ifset CODESTD +section +@end ifset +@ifclear CODESTD +chapter +@end ifclear +@end iftex +describes conventions for writing the Makefiles for GNU programs. @menu -* Makefile Basics:: -* Utilities in Makefiles:: -* Standard Targets:: -* Command Variables:: -* Directory Variables:: +* Makefile Basics:: General Conventions for Makefiles +* Utilities in Makefiles:: Utilities in Makefiles +* Command Variables:: Variables for Specifying Commands +* Directory Variables:: Variables for Installation Directories +* Standard Targets:: Standard Targets for Users +* Install Command Categories:: Three categories of commands in the `install' + rule: normal, pre-install and post-install. @end menu @node Makefile Basics @@ -32,16 +46,31 @@ inherited from the environment. (This is never a problem with GNU @code{make}.) +Different @code{make} programs have incompatible suffix lists and +implicit rules, and this sometimes creates confusion or misbehavior. So +it is a good idea to set the suffix list explicitly using only the +suffixes you need in the particular Makefile, like this: + +@example +.SUFFIXES: +.SUFFIXES: .c .o +@end example + +@noindent +The first line clears out the suffix list, the second introduces all +suffixes which may be subject to implicit rules in this Makefile. + Don't assume that @file{.} is in the path for command execution. When you need to run programs that are a part of your package during the make, please make sure that it uses @file{./} if the program is built as part of the make or @file{$(srcdir)/} if the file is an unchanging part of the source code. Without one of these prefixes, the current search -path is used. +path is used. -The distinction between @file{./} and @file{$(srcdir)/} is important -when using the @samp{--srcdir} option to @file{configure}. A rule of -the form: +The distinction between @file{./} (the @dfn{build directory}) and +@file{$(srcdir)/} (the @dfn{source directory}) is important because +users can build in a separate directory using the @samp{--srcdir} option +to @file{configure}. A rule of the form: @smallexample foo.1 : foo.man sedscript @@ -49,15 +78,14 @@ @end smallexample @noindent -will fail when the current directory is not the source directory, -because @file{foo.man} and @file{sedscript} are not in the current -directory. +will fail when the build directory is not the source directory, because +@file{foo.man} and @file{sedscript} are in the the source directory. When using GNU @code{make}, relying on @samp{VPATH} to find the source file will work in the case where there is a single dependency file, -since the @file{make} automatic variable @samp{$<} will represent the +since the @code{make} automatic variable @samp{$<} will represent the source file wherever it is. (Many versions of @code{make} set @samp{$<} -only in implicit rules.) A makefile target like +only in implicit rules.) A Makefile target like @smallexample foo.o : bar.c @@ -69,7 +97,7 @@ @smallexample foo.o : bar.c - $(CC) $(CFLAGS) $< -o $@@ + $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@@ @end smallexample @noindent @@ -80,9 +108,24 @@ @smallexample foo.1 : foo.man sedscript - sed -s $(srcdir)/sedscript $(srcdir)/foo.man > foo.1 + sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@@ @end smallexample +GNU distributions usually contain some files which are not source +files---for example, Info files, and the output from Autoconf, Automake, +Bison or Flex. Since these files normally appear in the source +directory, they should always appear in the source directory, not in the +build directory. So Makefile rules to update them should put the +updated files in the source directory. + +However, if a file does not appear in the distribution, then the +Makefile should not put it in the source directory, because building a +program in ordinary circumstances should not modify the source directory +in any way. + +Try to make the build and installation targets, at least (and all their +subtargets) work correctly with a parallel @code{make}. + @node Utilities in Makefiles @section Utilities in Makefiles @@ -93,219 +136,60 @@ The @code{configure} script and the Makefile rules for building and installation should not use any utilities directly except these: +@c dd find +@c gunzip gzip md5sum +@c mkfifo mknod tee uname + @example -cat cmp cp echo egrep expr grep -ln mkdir mv pwd rm rmdir sed test touch +cat cmp cp diff echo egrep expr false grep install-info +ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch true @end example +The compression program @code{gzip} can be used in the @code{dist} rule. + Stick to the generally supported options for these programs. For example, don't use @samp{mkdir -p}, convenient as it may be, because most systems don't support it. +It is a good idea to avoid creating symbolic links in makefiles, since a +few systems don't support them. + The Makefile rules for building and installation can also use compilers and related programs, but should do so via @code{make} variables so that the user can substitute alternatives. Here are some of the programs we mean: @example -ar bison cc flex install ld lex +ar bison cc flex install ld ldconfig lex make makeinfo ranlib texi2dvi yacc @end example -When you use @code{ranlib}, you should test whether it exists, and run -it only if it exists, so that the distribution will work on systems that -don't have @code{ranlib}. - -If you use symbolic links, you should implement a fallback for systems -that don't have symbolic links. - -It is ok to use other utilities in Makefile portions (or scripts) -intended only for particular systems where you know those utilities to -exist. - -@node Standard Targets -@section Standard Targets for Users - -All GNU programs should have the following targets in their Makefiles: - -@table @samp -@item all -Compile the entire program. This should be the default target. This -target need not rebuild any documentation files; Info files should -normally be included in the distribution, and DVI files should be made -only when explicitly asked for. - -@item install -Compile the program and copy the executables, libraries, and so on to -the file names where they should reside for actual use. If there is a -simple test to verify that a program is properly installed, this target -should run that test. - -The commands should create all the directories in which files are to be -installed, if they don't already exist. This includes the directories -specified as the values of the variables @code{prefix} and -@code{exec_prefix}, as well as all subdirectories that are needed. -One way to do this is by means of an @code{installdirs} target -as described below. - -Use @samp{-} before any command for installing a man page, so that -@code{make} will ignore any errors. This is in case there are systems -that don't have the Unix man page documentation system installed. - -The way to install Info files is to copy them into @file{$(infodir)} -with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run -the @code{install-info} program if it is present. @code{install-info} -is a script that edits the Info @file{dir} file to add or update the -menu entry for the given Info file; it will be part of the Texinfo package. -Here is a sample rule to install an Info file: - -@comment This example has been carefully formatted for the Make manual. -@comment Please do not reformat it without talking to roland@gnu.ai.mit.edu. -@smallexample -$(infodir)/foo.info: foo.info -# There may be a newer info file in . than in srcdir. - -if test -f foo.info; then d=.; \ - else d=$(srcdir); fi; \ - $(INSTALL_DATA) $$d/foo.info $@@; \ -# Run install-info only if it exists. -# Use `if' instead of just prepending `-' to the -# line so we notice real errors from install-info. -# We use `$(SHELL) -c' because some shells do not -# fail gracefully when there is an unknown command. - if $(SHELL) -c 'install-info --version' \ - >/dev/null 2>&1; then \ - install-info --infodir=$(infodir) $$d/foo.info; \ - else true; fi -@end smallexample - -@item uninstall -Delete all the installed files that the @samp{install} target would -create (but not the noninstalled files such as @samp{make all} would -create). - -@comment The gratuitous blank line here is to make the table look better -@comment in the printed Make manual. Please leave it in. -@item clean - -Delete all files from the current directory that are normally created by -building the program. Don't delete the files that record the -configuration. Also preserve files that could be made by building, but -normally aren't because the distribution comes with them. - -Delete @file{.dvi} files here if they are not part of the distribution. - -@item distclean -Delete all files from the current directory that are created by -configuring or building the program. If you have unpacked the source -and built the program without creating any other files, @samp{make -distclean} should leave only the files that were in the distribution. - -@item mostlyclean -Like @samp{clean}, but may refrain from deleting a few files that people -normally don't want to recompile. For example, the @samp{mostlyclean} -target for GCC does not delete @file{libgcc.a}, because recompiling it -is rarely necessary and takes a lot of time. - -@item realclean -Delete everything from the current directory that can be reconstructed -with this Makefile. This typically includes everything deleted by -@code{distclean}, plus more: C source files produced by Bison, tags tables, -Info files, and so on. - -One exception, however: @samp{make realclean} should not delete -@file{configure} even if @file{configure} can be remade using a rule in -the Makefile. More generally, @samp{make realclean} should not delete -anything that needs to exist in order to run @file{configure} -and then begin to build the program. - -@item TAGS -Update a tags table for this program. - -@item info -Generate any Info files needed. The best way to write the rules is as -follows: - -@smallexample -info: foo.info +Use the following @code{make} variables to run those programs: -foo.info: foo.texi chap1.texi chap2.texi - $(MAKEINFO) $(srcdir)/foo.texi -@end smallexample - -@noindent -You must define the variable @code{MAKEINFO} in the Makefile. It should -run the @code{makeinfo} program, which is part of the Texinfo -distribution. - -@item dvi -Generate DVI files for all TeXinfo documentation. -For example: - -@smallexample -dvi: foo.dvi - -foo.dvi: foo.texi chap1.texi chap2.texi - $(TEXI2DVI) $(srcdir)/foo.texi -@end smallexample - -@noindent -You must define the variable @code{TEXI2DVI} in the Makefile. It should -run the program @code{texi2dvi}, which is part of the Texinfo -distribution. Alternatively, write just the dependencies, and allow GNU -Make to provide the command. - -@item dist -Create a distribution tar file for this program. The tar file should be -set up so that the file names in the tar file start with a subdirectory -name which is the name of the package it is a distribution for. This -name can include the version number. - -For example, the distribution tar file of GCC version 1.40 unpacks into -a subdirectory named @file{gcc-1.40}. - -The easiest way to do this is to create a subdirectory appropriately -named, use @code{ln} or @code{cp} to install the proper files in it, and -then @code{tar} that subdirectory. - -The @code{dist} target should explicitly depend on all non-source files -that are in the distribution, to make sure they are up to date in the -distribution. -@xref{Releases, , Making Releases, standards, GNU Coding Standards}. +@example +$(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX) +$(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC) +@end example -@item check -Perform self-tests (if any). The user must build the program before -running the tests, but need not install the program; you should write -the self-tests so that they work when the program is built but not -installed. -@end table +When you use @code{ranlib} or @code{ldconfig}, you should make sure +nothing bad happens if the system does not have the program in question. +Arrange to ignore an error from that command, and print a message before +the command to tell the user that failure of this command does not mean +a problem. (The Autoconf @samp{AC_PROG_RANLIB} macro can help with +this.) -The following targets are suggested as conventional names, for programs -in which they are useful. +If you use symbolic links, you should implement a fallback for systems +that don't have symbolic links. -@table @code -@item installcheck -Perform installation tests (if any). The user must build and install -the program before running the tests. You should not assume that -@file{$(bindir)} is in the search path. +Additional utilities that can be used via Make variables are: -@item installdirs -It's useful to add a target named @samp{installdirs} to create the -directories where files are installed, and their parent directories. -There is a script called @file{mkinstalldirs} which is convenient for -this; find it in the Texinfo package.@c It's in /gd/gnu/lib/mkinstalldirs. -You can use a rule like this: +@example +chgrp chmod chown mknod +@end example -@comment This has been carefully formatted to look decent in the Make manual. -@comment Please be sure not to make it extend any further to the right.--roland -@smallexample -# Make sure all installation directories (e.g. $(bindir)) -# actually exist by making them if necessary. -installdirs: mkinstalldirs - $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ - $(libdir) $(infodir) \ - $(mandir) -@end smallexample -@end table +It is ok to use other utilities in Makefile portions (or scripts) +intended only for particular systems where you know those utilities +exist. @node Command Variables @section Variables for Specifying Commands @@ -379,48 +263,149 @@ Installation directories should always be named by variables, so it is easy to install in a nonstandard place. The standard names for these -variables are: +variables are described below. They are based on a standard filesystem +layout; variants of it are used in SVR4, 4.4BSD, Linux, Ultrix v4, and +other modern operating systems. + +These two variables set the root for the installation. All the other +installation directories should be subdirectories of one of these two, +and nothing should be directly installed into these two directories. @table @samp @item prefix A prefix used in constructing the default values of the variables listed -below. The default value of @code{prefix} should be @file{/usr/local} -(at least for now). +below. The default value of @code{prefix} should be @file{/usr/local}. +When building the complete GNU system, the prefix will be empty and +@file{/usr} will be a symbolic link to @file{/}. +(If you are using Autoconf, write it as @samp{@@prefix@@}.) @item exec_prefix A prefix used in constructing the default values of some of the variables listed below. The default value of @code{exec_prefix} should be @code{$(prefix)}. +(If you are using Autoconf, write it as @samp{@@exec_prefix@@}.) Generally, @code{$(exec_prefix)} is used for directories that contain machine-specific files (such as executables and subroutine libraries), while @code{$(prefix)} is used directly for other directories. +@end table + +Executable programs are installed in one of the following directories. +@table @samp @item bindir The directory for installing executable programs that users can run. This should normally be @file{/usr/local/bin}, but write it as @file{$(exec_prefix)/bin}. +(If you are using Autoconf, write it as @samp{@@bindir@@}.) -@item libdir -The directory for installing executable files to be run by the program -rather than by users. Object files and libraries of object code should -also go in this directory. The idea is that this directory is used for -files that pertain to a specific machine architecture, but need not be -in the path for commands. The value of @code{libdir} should normally be -@file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}. +@item sbindir +The directory for installing executable programs that can be run from +the shell, but are only generally useful to system administrators. This +should normally be @file{/usr/local/sbin}, but write it as +@file{$(exec_prefix)/sbin}. +(If you are using Autoconf, write it as @samp{@@sbindir@@}.) + +@item libexecdir +@comment This paragraph adjusted to avoid overfull hbox --roland 5jul94 +The directory for installing executable programs to be run by other +programs rather than by users. This directory should normally be +@file{/usr/local/libexec}, but write it as @file{$(exec_prefix)/libexec}. +(If you are using Autoconf, write it as @samp{@@libexecdir@@}.) +@end table + +Data files used by the program during its execution are divided into +categories in two ways. +@itemize @bullet +@item +Some files are normally modified by programs; others are never normally +modified (though users may edit some of these). + +@item +Some files are architecture-independent and can be shared by all +machines at a site; some are architecture-dependent and can be shared +only by machines of the same kind and operating system; others may never +be shared between two machines. +@end itemize + +This makes for six different possibilities. However, we want to +discourage the use of architecture-dependent files, aside from object +files and libraries. It is much cleaner to make other data files +architecture-independent, and it is generally not hard. + +Therefore, here are the variables Makefiles should use to specify +directories: + +@table @samp @item datadir -The directory for installing read-only data files which the programs -refer to while they run. This directory is used for files which are -independent of the type of machine being used. This should normally be -@file{/usr/local/lib}, but write it as @file{$(prefix)/lib}. +The directory for installing read-only architecture independent data +files. This should normally be @file{/usr/local/share}, but write it as +@file{$(prefix)/share}. +(If you are using Autoconf, write it as @samp{@@datadir@@}.) +As a special exception, see @file{$(infodir)} +and @file{$(includedir)} below. + +@item sysconfdir +The directory for installing read-only data files that pertain to a +single machine--that is to say, files for configuring a host. Mailer +and network configuration files, @file{/etc/passwd}, and so forth belong +here. All the files in this directory should be ordinary ASCII text +files. This directory should normally be @file{/usr/local/etc}, but +write it as @file{$(prefix)/etc}. +(If you are using Autoconf, write it as @samp{@@sysconfdir@@}.) + +@c rewritten to avoid overfull hbox --tower +Do not install executables +@c here +in this directory (they probably +belong in @file{$(libexecdir)} or @file{$(sbindir)}). Also do not +install files that are modified in the normal course of their use +(programs whose purpose is to change the configuration of the system +excluded). Those probably belong in @file{$(localstatedir)}. + +@item sharedstatedir +The directory for installing architecture-independent data files which +the programs modify while they run. This should normally be +@file{/usr/local/com}, but write it as @file{$(prefix)/com}. +(If you are using Autoconf, write it as @samp{@@sharedstatedir@@}.) -@item statedir +@item localstatedir The directory for installing data files which the programs modify while -they run. These files should be independent of the type of machine -being used, and it should be possible to share them among machines at a -network installation. This should normally be @file{/usr/local/lib}, -but write it as @file{$(prefix)/lib}. +they run, and that pertain to one specific machine. Users should never +need to modify files in this directory to configure the package's +operation; put such configuration information in separate files that go +in @file{$(datadir)} or @file{$(sysconfdir)}. @file{$(localstatedir)} +should normally be @file{/usr/local/var}, but write it as +@file{$(prefix)/var}. +(If you are using Autoconf, write it as @samp{@@localstatedir@@}.) + +@item libdir +The directory for object files and libraries of object code. Do not +install executables here, they probably ought to go in @file{$(libexecdir)} +instead. The value of @code{libdir} should normally be +@file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}. +(If you are using Autoconf, write it as @samp{@@libdir@@}.) + +@item infodir +The directory for installing the Info files for this package. By +default, it should be @file{/usr/local/info}, but it should be written +as @file{$(prefix)/info}. +(If you are using Autoconf, write it as @samp{@@infodir@@}.) + +@item lispdir +The directory for installing any Emacs Lisp files in this package. By +default, it should be @file{/usr/local/share/emacs/site-lisp}, but it +should be written as @file{$(prefix)/share/emacs/site-lisp}. + +If you are using Autoconf, write the default as @samp{@@lispdir@@}. +In order to make @samp{@@lispdir@@} work, you need the following lines +in your @file{configure.in} file: + +@example +lispdir='$@{datadir@}/emacs/site-lisp' +AC_SUBST(lispdir) +@end example @item includedir @c rewritten to avoid overfull hbox --roland @@ -428,6 +413,7 @@ programs with the C @samp{#include} preprocessor directive. This should normally be @file{/usr/local/include}, but write it as @file{$(prefix)/include}. +(If you are using Autoconf, write it as @samp{@@includedir@@}.) Most compilers other than GCC do not look for header files in @file{/usr/local/include}. So installing the header files this way is @@ -440,6 +426,7 @@ @item oldincludedir The directory for installing @samp{#include} header files for use with compilers other than GCC. This should normally be @file{/usr/include}. +(If you are using Autoconf, you can write it as @samp{@@oldincludedir@@}.) The Makefile commands should check whether the value of @code{oldincludedir} is empty. If it is, they should not try to use @@ -453,22 +440,25 @@ package. To tell whether @file{foo.h} came from the Foo package, put a magic -string in the file---part of a comment---and grep for that string. +string in the file---part of a comment---and @code{grep} for that string. +@end table +Unix-style man pages are installed in one of the following: + +@table @samp @item mandir -The directory for installing the man pages (if any) for this package. -It should include the suffix for the proper section of the -manual---usually @samp{1} for a utility. It will normally be -@file{/usr/local/man/man1}, but you should write it as -@file{$(prefix)/man/man1}. +The top-level directory for installing the man pages (if any) for this +package. It will normally be @file{/usr/local/man}, but you should +write it as @file{$(prefix)/man}. +(If you are using Autoconf, write it as @samp{@@mandir@@}.) @item man1dir -The directory for installing section 1 man pages. +The directory for installing section 1 man pages. Write it as +@file{$(mandir)/man1}. @item man2dir -The directory for installing section 2 man pages. +The directory for installing section 2 man pages. Write it as +@file{$(mandir)/man2} @item @dots{} -Use these names instead of @samp{mandir} if the package needs to install man -pages in more than one section of the manual. @strong{Don't make the primary documentation for any GNU software be a man page. Write a manual in Texinfo instead. Man pages are just for @@ -486,15 +476,15 @@ @item @dots{} Use these names instead of @samp{manext} if the package needs to install man pages in more than one section of the manual. +@end table -@item infodir -The directory for installing the Info files for this package. By -default, it should be @file{/usr/local/info}, but it should be written -as @file{$(prefix)/info}. +And finally, you should set the following variable: +@table @samp @item srcdir The directory for the sources being compiled. The value of this variable is normally inserted by the @code{configure} shell script. +(If you are using Autconf, use @samp{srcdir = @@srcdir@@}.) @end table For example: @@ -509,7 +499,7 @@ # Where to put the executable for the command `gcc'. bindir = $(exec_prefix)/bin # Where to put the directories used by the compiler. -libdir = $(exec_prefix)/lib +libexecdir = $(exec_prefix)/libexec # Where to put the Info files. infodir = $(prefix)/info @end smallexample @@ -526,3 +516,378 @@ order for this to be useful, all the packages must be designed so that they will work sensibly when the user does so. +@node Standard Targets +@section Standard Targets for Users + +All GNU programs should have the following targets in their Makefiles: + +@table @samp +@item all +Compile the entire program. This should be the default target. This +target need not rebuild any documentation files; Info files should +normally be included in the distribution, and DVI files should be made +only when explicitly asked for. + +By default, the Make rules should compile and link with @samp{-g}, so +that executable programs have debugging symbols. Users who don't mind +being helpless can strip the executables later if they wish. + +@item install +Compile the program and copy the executables, libraries, and so on to +the file names where they should reside for actual use. If there is a +simple test to verify that a program is properly installed, this target +should run that test. + +Do not strip executables when installing them. Devil-may-care users can +use the @code{install-strip} target to do that. + +If possible, write the @code{install} target rule so that it does not +modify anything in the directory where the program was built, provided +@samp{make all} has just been done. This is convenient for building the +program under one user name and installing it under another. + +The commands should create all the directories in which files are to be +installed, if they don't already exist. This includes the directories +specified as the values of the variables @code{prefix} and +@code{exec_prefix}, as well as all subdirectories that are needed. +One way to do this is by means of an @code{installdirs} target +as described below. + +Use @samp{-} before any command for installing a man page, so that +@code{make} will ignore any errors. This is in case there are systems +that don't have the Unix man page documentation system installed. + +The way to install Info files is to copy them into @file{$(infodir)} +with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run +the @code{install-info} program if it is present. @code{install-info} +is a program that edits the Info @file{dir} file to add or update the +menu entry for the given Info file; it is part of the Texinfo package. +Here is a sample rule to install an Info file: + +@comment This example has been carefully formatted for the Make manual. +@comment Please do not reformat it without talking to roland@gnu.ai.mit.edu. +@smallexample +$(infodir)/foo.info: foo.info + $(POST_INSTALL) +# There may be a newer info file in . than in srcdir. + -if test -f foo.info; then d=.; \ + else d=$(srcdir); fi; \ + $(INSTALL_DATA) $$d/foo.info $@@; \ +# Run install-info only if it exists. +# Use `if' instead of just prepending `-' to the +# line so we notice real errors from install-info. +# We use `$(SHELL) -c' because some shells do not +# fail gracefully when there is an unknown command. + if $(SHELL) -c 'install-info --version' \ + >/dev/null 2>&1; then \ + install-info --dir-file=$(infodir)/dir \ + $(infodir)/foo.info; \ + else true; fi +@end smallexample + +When writing the @code{install} target, you must classify all the +commands into three categories: normal ones, @dfn{pre-installation} +commands and @dfn{post-installation} commands. @xref{Install Command +Categories}. + +@item uninstall +Delete all the installed files---the copies that the @samp{install} +target creates. + +This rule should not modify the directories where compilation is done, +only the directories where files are installed. + +The uninstallation commands are divided into three categories, just like +the installation commands. @xref{Install Command Categories}. + +@item install-strip +Like @code{install}, but strip the executable files while installing +them. In many cases, the definition of this target can be very simple: + +@smallexample +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ + install +@end smallexample + +Normally we do not recommend stripping an executable unless you are sure +the program has no bugs. However, it can be reasonable to install a +stripped executable for actual execution while saving the unstripped +executable elsewhere in case there is a bug. + +@comment The gratuitous blank line here is to make the table look better +@comment in the printed Make manual. Please leave it in. +@item clean + +Delete all files from the current directory that are normally created by +building the program. Don't delete the files that record the +configuration. Also preserve files that could be made by building, but +normally aren't because the distribution comes with them. + +Delete @file{.dvi} files here if they are not part of the distribution. + +@item distclean +Delete all files from the current directory that are created by +configuring or building the program. If you have unpacked the source +and built the program without creating any other files, @samp{make +distclean} should leave only the files that were in the distribution. + +@item mostlyclean +Like @samp{clean}, but may refrain from deleting a few files that people +normally don't want to recompile. For example, the @samp{mostlyclean} +target for GCC does not delete @file{libgcc.a}, because recompiling it +is rarely necessary and takes a lot of time. + +@item maintainer-clean +Delete almost everything from the current directory that can be +reconstructed with this Makefile. This typically includes everything +deleted by @code{distclean}, plus more: C source files produced by +Bison, tags tables, Info files, and so on. + +The reason we say ``almost everything'' is that running the command +@samp{make maintainer-clean} should not delete @file{configure} even if +@file{configure} can be remade using a rule in the Makefile. More generally, +@samp{make maintainer-clean} should not delete anything that needs to +exist in order to run @file{configure} and then begin to build the +program. This is the only exception; @code{maintainer-clean} should +delete everything else that can be rebuilt. + +The @samp{maintainer-clean} target is intended to be used by a maintainer of +the package, not by ordinary users. You may need special tools to +reconstruct some of the files that @samp{make maintainer-clean} deletes. +Since these files are normally included in the distribution, we don't +take care to make them easy to reconstruct. If you find you need to +unpack the full distribution again, don't blame us. + +To help make users aware of this, the commands for the special +@code{maintainer-clean} target should start with these two: + +@smallexample +@@echo 'This command is intended for maintainers to use; it' +@@echo 'deletes files that may need special tools to rebuild.' +@end smallexample + +@item TAGS +Update a tags table for this program. +@c ADR: how? + +@item info +Generate any Info files needed. The best way to write the rules is as +follows: + +@smallexample +info: foo.info + +foo.info: foo.texi chap1.texi chap2.texi + $(MAKEINFO) $(srcdir)/foo.texi +@end smallexample + +@noindent +You must define the variable @code{MAKEINFO} in the Makefile. It should +run the @code{makeinfo} program, which is part of the Texinfo +distribution. + +Normally a GNU distribution comes with Info files, and that means the +Info files are present in the source directory. Therefore, the Make +rule for an info file should update it in the source directory. When +users build the package, ordinarily Make will not update the Info files +because they will already be up to date. + +@item dvi +Generate DVI files for all Texinfo documentation. +For example: + +@smallexample +dvi: foo.dvi + +foo.dvi: foo.texi chap1.texi chap2.texi + $(TEXI2DVI) $(srcdir)/foo.texi +@end smallexample + +@noindent +You must define the variable @code{TEXI2DVI} in the Makefile. It should +run the program @code{texi2dvi}, which is part of the Texinfo +distribution.@footnote{@code{texi2dvi} uses @TeX{} to do the real work +of formatting. @TeX{} is not distributed with Texinfo.} Alternatively, +write just the dependencies, and allow GNU @code{make} to provide the command. + +@item dist +Create a distribution tar file for this program. The tar file should be +set up so that the file names in the tar file start with a subdirectory +name which is the name of the package it is a distribution for. This +name can include the version number. + +For example, the distribution tar file of GCC version 1.40 unpacks into +a subdirectory named @file{gcc-1.40}. + +The easiest way to do this is to create a subdirectory appropriately +named, use @code{ln} or @code{cp} to install the proper files in it, and +then @code{tar} that subdirectory. + +Compress the tar file file with @code{gzip}. For example, the actual +distribution file for GCC version 1.40 is called @file{gcc-1.40.tar.gz}. + +The @code{dist} target should explicitly depend on all non-source files +that are in the distribution, to make sure they are up to date in the +distribution. +@ifset CODESTD +@xref{Releases, , Making Releases}. +@end ifset +@ifclear CODESTD +@xref{Releases, , Making Releases, standards, GNU Coding Standards}. +@end ifclear + +@item check +Perform self-tests (if any). The user must build the program before +running the tests, but need not install the program; you should write +the self-tests so that they work when the program is built but not +installed. +@end table + +The following targets are suggested as conventional names, for programs +in which they are useful. + +@table @code +@item installcheck +Perform installation tests (if any). The user must build and install +the program before running the tests. You should not assume that +@file{$(bindir)} is in the search path. + +@item installdirs +It's useful to add a target named @samp{installdirs} to create the +directories where files are installed, and their parent directories. +There is a script called @file{mkinstalldirs} which is convenient for +this; you can find it in the Texinfo package. +@c It's in /gd/gnu/lib/mkinstalldirs. +You can use a rule like this: + +@comment This has been carefully formatted to look decent in the Make manual. +@comment Please be sure not to make it extend any further to the right.--roland +@smallexample +# Make sure all installation directories (e.g. $(bindir)) +# actually exist by making them if necessary. +installdirs: mkinstalldirs + $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ + $(libdir) $(infodir) \ + $(mandir) +@end smallexample + +This rule should not modify the directories where compilation is done. +It should do nothing but create installation directories. +@end table + +@node Install Command Categories +@section Install Command Categories + +@cindex pre-installation commands +@cindex post-installation commands +When writing the @code{install} target, you must classify all the +commands into three categories: normal ones, @dfn{pre-installation} +commands and @dfn{post-installation} commands. + +Normal commands move files into their proper places, and set their +modes. They may not alter any files except the ones that come entirely +from the package they belong to. + +Pre-installation and post-installation commands may alter other files; +in particular, they can edit global configuration files or data bases. + +Pre-installation commands are typically executed before the normal +commands, and post-installation commands are typically run after the +normal commands. + +The most common use for a post-installation command is to run +@code{install-info}. This cannot be done with a normal command, since +it alters a file (the Info directory) which does not come entirely and +solely from the package being installed. It is a post-installation +command because it needs to be done after the normal command which +installs the package's Info files. + +Most programs don't need any pre-installation commands, but we have the +feature just in case it is needed. + +To classify the commands in the @code{install} rule into these three +categories, insert @dfn{category lines} among them. A category line +specifies the category for the commands that follow. + +A category line consists of a tab and a reference to a special Make +variable, plus an optional comment at the end. There are three +variables you can use, one for each category; the variable name +specifies the category. Category lines are no-ops in ordinary execution +because these three Make variables are normally undefined (and you +@emph{should not} define them in the makefile). + +Here are the three possible category lines, each with a comment that +explains what it means: + +@smallexample + $(PRE_INSTALL) # @r{Pre-install commands follow.} + $(POST_INSTALL) # @r{Post-install commands follow.} + $(NORMAL_INSTALL) # @r{Normal commands follow.} +@end smallexample + +If you don't use a category line at the beginning of the @code{install} +rule, all the commands are classified as normal until the first category +line. If you don't use any category lines, all the commands are +classified as normal. + +These are the category lines for @code{uninstall}: + +@smallexample + $(PRE_UNINSTALL) # @r{Pre-uninstall commands follow.} + $(POST_UNINSTALL) # @r{Post-uninstall commands follow.} + $(NORMAL_UNINSTALL) # @r{Normal commands follow.} +@end smallexample + +Typically, a pre-uninstall command would be used for deleting entries +from the Info directory. + +If the @code{install} or @code{uninstall} target has any dependencies +which act as subroutines of installation, then you should start +@emph{each} dependency's commands with a category line, and start the +main target's commands with a category line also. This way, you can +ensure that each command is placed in the right category regardless of +which of the dependencies actually run. + +Pre-installation and post-installation commands should not run any +programs except for these: + +@example +[ basename bash cat chgrp chmod chown cmp cp dd diff echo +egrep expand expr false fgrep find getopt grep gunzip gzip +hostname install install-info kill ldconfig ln ls md5sum +mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee +test touch true uname xargs yes +@end example + +@cindex binary packages +The reason for distinguishing the commands in this way is for the sake +of making binary packages. Typically a binary package contains all the +executables and other files that need to be installed, and has its own +method of installing them---so it does not need to run the normal +installation commands. But installing the binary package does need to +execute the pre-installation and post-installation commands. + +Programs to build binary packages work by extracting the +pre-installation and post-installation commands. Here is one way of +extracting the pre-installation commands: + +@smallexample +make -n install -o all \ + PRE_INSTALL=pre-install \ + POST_INSTALL=post-install \ + NORMAL_INSTALL=normal-install \ + | gawk -f pre-install.awk +@end smallexample + +@noindent +where the file @file{pre-install.awk} could contain this: + +@smallexample +$0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ @{on = 0@} +on @{print $0@} +$0 ~ /^\t[ \t]*pre_install[ \t]*$/ @{on = 1@} +@end smallexample + +The resulting file of pre-installation commands is executed as a shell +script as part of installing the binary package. diff -urN binutils-2.7/etc/standards.info binutils-2.8/etc/standards.info --- binutils-2.7/etc/standards.info Mon Jul 15 12:23:21 1996 +++ binutils-2.8/etc/standards.info Wed Apr 30 13:15:34 1997 @@ -1,12 +1,12 @@ -This is Info file standards.info, produced by Makeinfo-1.55 from the +This is Info file standards.info, produced by Makeinfo-1.64 from the input file ./standards.texi. START-INFO-DIR-ENTRY * Standards: (standards). GNU coding standards. END-INFO-DIR-ENTRY - GNU Coding Standards Copyright (C) 1992, 1993, 1994 Free Software -Foundation + GNU Coding Standards Copyright (C) 1992, 1993, 1994, 1995, 1996 Free +Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -24,36 +24,59 @@  Indirect: -standards.info-1: 950 -standards.info-2: 49237 +standards.info-1: 968 +standards.info-2: 48339 +standards.info-3: 97867  Tag Table: (Indirect) -Node: Top950 -Node: Reading Non-Free Code2051 -Node: Contributions3777 -Node: Change Logs5375 -Node: Compatibility9091 -Node: Makefile Conventions10730 -Node: Makefile Basics11087 -Node: Utilities in Makefiles12978 -Node: Standard Targets14414 -Node: Command Variables21523 -Node: Directory Variables24353 -Node: Configuration30825 -Node: Source Language37849 -Node: Formatting38979 -Node: Comments42269 -Node: Syntactic Conventions45055 -Node: Names47947 -Node: Using Extensions49237 -Node: System Functions50978 -Node: Semantics55781 -Node: Errors58747 -Node: Libraries59950 -Node: Portability61174 -Node: User Interfaces64461 -Node: Documentation79291 -Node: Releases83225 +Node: Top968 +Node: Preface1512 +Node: Intellectual Property2554 +Node: Reading Non-Free Code2929 +Node: Contributions4661 +Node: Design Advice6259 +Node: Compatibility6776 +Node: Using Extensions8420 +Node: ANSI C9922 +Node: Source Language11158 +Node: Program Behavior12292 +Node: Semantics13001 +Node: Libraries16755 +Node: Errors17990 +Node: User Interfaces19213 +Node: Option Table25935 +Node: Memory Usage40039 +Node: Writing C41033 +Node: Formatting41872 +Node: Comments45144 +Node: Syntactic Conventions48339 +Node: Names51277 +Node: System Portability53013 +Node: CPU Portability54789 +Node: System Functions56950 +Node: Internationalization62054 +Node: Mmap65199 +Node: Documentation65904 +Node: GNU Manuals66462 +Node: Manual Structure Details70349 +Node: NEWS File71679 +Node: Change Logs72360 +Node: Change Log Concepts73077 +Node: Style of Change Logs74845 +Node: Simple Changes76399 +Node: Conditional Changes77590 +Node: Man Pages78967 +Node: Reading other Manuals80586 +Node: Managing Releases81370 +Node: Configuration82106 +Node: Makefile Conventions89046 +Node: Makefile Basics89726 +Node: Utilities in Makefiles92895 +Node: Command Variables95031 +Node: Directory Variables97867 +Node: Standard Targets108436 +Node: Install Command Categories118937 +Node: Releases123510  End Tag Table diff -urN binutils-2.7/etc/standards.info-1 binutils-2.8/etc/standards.info-1 --- binutils-2.7/etc/standards.info-1 Mon Jul 15 12:23:21 1996 +++ binutils-2.8/etc/standards.info-1 Wed Apr 30 13:15:34 1997 @@ -1,12 +1,12 @@ -This is Info file standards.info, produced by Makeinfo-1.55 from the +This is Info file standards.info, produced by Makeinfo-1.64 from the input file ./standards.texi. START-INFO-DIR-ENTRY * Standards: (standards). GNU coding standards. END-INFO-DIR-ENTRY - GNU Coding Standards Copyright (C) 1992, 1993, 1994 Free Software -Foundation + GNU Coding Standards Copyright (C) 1992, 1993, 1994, 1995, 1996 Free +Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -23,41 +23,65 @@ translation approved by the Free Software Foundation.  -File: standards.info, Node: Top, Next: Reading Non-Free Code, Prev: (dir), Up: (dir) +File: standards.info, Node: Top, Next: Preface, Prev: (dir), Up: (dir) Version ******* - Last updated 28 March 1994. + Last updated 16 January 1997. * Menu: -* Reading Non-Free Code:: Referring to Proprietary Programs -* Contributions:: Accepting Contributions -* Change Logs:: Recording Changes -* Compatibility:: Compatibility with Other Implementations -* Makefile Conventions:: Makefile Conventions -* Configuration:: How Configuration Should Work -* Source Language:: Using Languages Other Than C -* Formatting:: Formatting Your Source Code -* Comments:: Commenting Your Work -* Syntactic Conventions:: Clean Use of C Constructs -* Names:: Naming Variables and Functions -* Using Extensions:: Using Non-standard Features -* System Functions:: Portability and "standard" library functions -* Semantics:: Program Behavior for All Programs -* Errors:: Formatting Error Messages -* Libraries:: Library Behavior -* Portability:: Portability As It Applies to GNU -* User Interfaces:: Standards for Command Line Interfaces -* Documentation:: Documenting Programs -* Releases:: Making Releases +* Preface:: About the GNU Coding Standards +* Intellectual Property:: Keeping Free Software Free +* Design Advice:: General Program Design +* Program Behavior:: Program Behavior for All Programs +* Writing C:: Making The Best Use of C +* Documentation:: Documenting Programs +* Managing Releases:: The Release Process + + +File: standards.info, Node: Preface, Next: Intellectual Property, Prev: Top, Up: Top + +About the GNU Coding Standards +****************************** + + The GNU Coding Standards were written by Richard Stallman and other +GNU Project volunteers. Their purpose is to make the GNU system clean, +consistent, and easy to install. This document can also be read as a +guide to writing portable, robust and reliable programs. It focuses on +programs written in C, but many of the rules and principles are useful +even if you write in another programming language. The rules often +state reasons for writing in a certain way. + + Corrections or suggestions regarding this document should be sent to +`gnu@prep.ai.mit.edu'. If you make a suggestion, please include a +suggested new wording for it; our time is limited. We prefer a context +diff to the `standards.texi' or `make-stds.texi' files, but if you +don't have those files, please mail your suggestion anyway. + + This release of the GNU Coding Standards was last updated 16 January +1997.  -File: standards.info, Node: Reading Non-Free Code, Next: Contributions, Prev: Top, Up: Top +File: standards.info, Node: Intellectual Property, Next: Design Advice, Prev: Preface, Up: Top + +Keeping Free Software Free +************************** + + This node discusses how you can make sure that GNU software remains +unencumbered. + +* Menu: + +* Reading Non-Free Code:: Referring to Proprietary Programs +* Contributions:: Accepting Contributions + + +File: standards.info, Node: Reading Non-Free Code, Next: Contributions, Up: Intellectual Property Referring to Proprietary Programs -********************************* +================================= Don't in any circumstances refer to Unix source code for or during your work on GNU! (Or to any other proprietary programs.) @@ -91,10 +115,10 @@ obstacks.  -File: standards.info, Node: Contributions, Next: Change Logs, Prev: Reading Non-Free Code, Up: Top +File: standards.info, Node: Contributions, Prev: Reading Non-Free Code, Up: Intellectual Property Accepting Contributions -*********************** +======================= If someone else sends you a piece of code to add to the program you are working on, we need legal papers to use it--the same sort of legal @@ -108,7 +132,7 @@ contribution. This applies both before you release the program and afterward. If -you receive diffs to fix a bug, and they make significant change, we +you receive diffs to fix a bug, and they make significant changes, we need legal papers for it. You don't need papers for changes of a few lines here or there, since @@ -117,7 +141,7 @@ which you use. For example, if you write a different solution to the problem, you don't need to get papers. - I know this is frustrating; it's frustrating for us as well. But if + We know this is frustrating; it's frustrating for us as well. But if you don't wait, you are going out on a limb--for example, what if the contributor's employer won't sign a disclaimer? You might have to take that code out again! @@ -127,89 +151,28 @@ result.  -File: standards.info, Node: Change Logs, Next: Compatibility, Prev: Contributions, Up: Top +File: standards.info, Node: Design Advice, Next: Program Behavior, Prev: Intellectual Property, Up: Top + +General Program Design +********************** -Change Logs -*********** + This node discusses some of the issues you should take into account +when designing your program. + +* Menu: - Keep a change log for each directory, describing the changes made to -source files in that directory. The purpose of this is so that people -investigating bugs in the future will know about the changes that might -have introduced the bug. Often a new bug can be found by looking at -what was recently changed. More importantly, change logs can help -eliminate conceptual inconsistencies between different parts of a -program; they can give you a history of how the conflicting concepts -arose. - - Use the Emacs command `M-x add-change' to start a new entry in the -change log. An entry should have an asterisk, the name of the changed -file, and then in parentheses the name of the changed functions, -variables or whatever, followed by a colon. Then describe the changes -you made to that function or variable. - - Separate unrelated entries with blank lines. When two entries -represent parts of the same change, so that they work together, then -don't put blank lines between them. Then you can omit the file name -and the asterisk when successive entries are in the same file. - - Here are some examples: - - * register.el (insert-register): Return nil. - (jump-to-register): Likewise. - - * sort.el (sort-subr): Return nil. - - * tex-mode.el (tex-bibtex-file, tex-file, tex-region): - Restart the tex shell if process is gone or stopped. - (tex-shell-running): New function. - - * expr.c (store_one_arg): Round size up for move_block_to_reg. - (expand_call): Round up when emitting USE insns. - * stmt.c (assign_parms): Round size up for move_block_from_reg. - - It's important to name the changed function or variable in full. -Don't abbreviate them; don't combine them. Subsequent maintainers will -often search for a function name to find all the change log entries that -pertain to it; if you abbreviate the name, they won't find it when they -search. For example, some people are tempted to abbreviate groups of -function names by writing `* register.el ({insert,jump-to}-register)'; -this is not a good idea, since searching for `jump-to-register' or -`insert-register' would not find the entry. - - There's no need to describe the full purpose of the changes or how -they work together. It is better to put such explanations in comments -in the code. That's why just "New function" is enough; there is a -comment with the function in the source to explain what it does. - - However, sometimes it is useful to write one line to describe the -overall purpose of a large batch of changes. - - You can think of the change log as a conceptual "undo list" which -explains how earlier versions were different from the current version. -People can see the current version; they don't need the change log to -tell them what is in it. What they want from a change log is a clear -explanation of how the earlier version differed. - - When you change the calling sequence of a function in a simple -fashion, and you change all the callers of the function, there is no -need to make individual entries for all the callers. Just write in the -entry for the function being called, "All callers changed." - - When you change just comments or doc strings, it is enough to write -an entry for the file, without mentioning the functions. Write just, -"Doc fix." There's no need to keep a change log for documentation -files. This is because documentation is not susceptible to bugs that -are hard to fix. Documentation does not consist of parts that must -interact in a precisely engineered fashion; to correct an error, you -need not know the history of the erroneous passage. +* Compatibility:: Compatibility with other implementations +* Using Extensions:: Using non-standard features +* ANSI C:: Using ANSI C features +* Source Language:: Using languages other than C  -File: standards.info, Node: Compatibility, Next: Makefile Conventions, Prev: Change Logs, Up: Top +File: standards.info, Node: Compatibility, Next: Using Extensions, Up: Design Advice Compatibility with Other Implementations -**************************************** +======================================== - With certain exceptions, utility programs and libraries for GNU + With occasional exceptions, utility programs and libraries for GNU should be upward compatible with those in Berkeley Unix, and upward compatible with ANSI C if ANSI C specifies their behavior, and upward compatible with POSIX if POSIX specifies their behavior. @@ -218,10 +181,10 @@ modes for each of them. ANSI C and POSIX prohibit many kinds of extensions. Feel free to -make the extensions anyway, and include a `--ansi' or `--compatible' -option to turn them off. However, if the extension has a significant -chance of breaking any real programs or scripts, then it is not really -upward compatible. Try to redesign its interface. +make the extensions anyway, and include a `--ansi', `--posix', or +`--compatible' option to turn them off. However, if the extension has +a significant chance of breaking any real programs or scripts, then it +is not really upward compatible. Try to redesign its interface. Many GNU programs suppress extensions that conflict with POSIX if the environment variable `POSIXLY_CORRECT' is defined (even if it is @@ -231,698 +194,1530 @@ When a feature is used only by users (not by programs or command files), and it is done poorly in Unix, feel free to replace it completely with something totally different and better. (For example, -vi is replaced with Emacs.) But it is nice to offer a compatible -feature as well. (There is a free vi clone, so we offer it.) +`vi' is replaced with Emacs.) But it is nice to offer a compatible +feature as well. (There is a free `vi' clone, so we offer it.) Additional useful features not in Berkeley Unix are welcome. Additional programs with no counterpart in Unix may be useful, but our first priority is usually to duplicate what Unix already has.  -File: standards.info, Node: Makefile Conventions, Next: Configuration, Prev: Compatibility, Up: Top +File: standards.info, Node: Using Extensions, Next: ANSI C, Prev: Compatibility, Up: Design Advice -Makefile Conventions -******************** +Using Non-standard Features +=========================== - This chapter describes conventions for writing the Makefiles for GNU -programs. + Many GNU facilities that already exist support a number of convenient +extensions over the comparable Unix facilities. Whether to use these +extensions in implementing your program is a difficult question. + + On the one hand, using the extensions can make a cleaner program. +On the other hand, people will not be able to build the program unless +the other GNU tools are available. This might cause the program to +work on fewer kinds of machines. + + With some extensions, it might be easy to provide both alternatives. +For example, you can define functions with a "keyword" `INLINE' and +define that as a macro to expand into either `inline' or nothing, +depending on the compiler. + + In general, perhaps it is best not to use the extensions if you can +straightforwardly do without them, but to use the extensions if they +are a big improvement. + + An exception to this rule are the large, established programs (such +as Emacs) which run on a great variety of systems. Such programs would +be broken by use of GNU extensions. + + Another exception is for programs that are used as part of +compilation: anything that must be compiled with other compilers in +order to bootstrap the GNU compilation facilities. If these require +the GNU compiler, then no one can compile them without having them +installed already. That would be no good. -* Menu: + +File: standards.info, Node: ANSI C, Next: Source Language, Prev: Using Extensions, Up: Design Advice + +ANSI C and pre-ANSI C +===================== + + Do not ever use the "trigraph" feature of ANSI C. + + ANSI C is widespread enough now that it is ok to write new programs +that use ANSI C features (and therefore will not work in non-ANSI +compilers). And if a program is already written in ANSI C, there's no +need to convert it to support non-ANSI compilers. + + However, it is easy to support non-ANSI compilers in most programs, +so you might still consider doing so when you write a program. Instead +of writing function definitions in ANSI prototype form, + + int + foo (int x, int y) + ... + +write the definition in pre-ANSI style like this, -* Makefile Basics:: -* Utilities in Makefiles:: -* Standard Targets:: -* Command Variables:: -* Directory Variables:: + int + foo (x, y) + int x, y; + ... + +and use a separate declaration to specify the argument prototype: + + int foo (int, int); + + You need such a declaration anyway, in a header file, to get the +benefit of ANSI C prototypes in all the files where the function is +called. And once you have it, you lose nothing by writing the function +definition in the pre-ANSI style. + + If you don't know non-ANSI C, there's no need to learn it; just +write in ANSI C.  -File: standards.info, Node: Makefile Basics, Next: Utilities in Makefiles, Up: Makefile Conventions +File: standards.info, Node: Source Language, Prev: ANSI C, Up: Design Advice -General Conventions for Makefiles -================================= +Using Languages Other Than C +============================ - Every Makefile should contain this line: + Using a language other than C is like using a non-standard feature: +it will cause trouble for users. Even if GCC supports the other +language, users may find it inconvenient to have to install the +compiler for that other language in order to build your program. So +please write in C. + + There are three exceptions for this rule: + + * It is okay to use a special language if the same program contains + an interpreter for that language. + + For example, if your program links with GUILE, it is ok to write + part of the program in Scheme or another language supported by + GUILE. + + * It is okay to use another language in a tool specifically intended + for use with that language. + + This is okay because the only people who want to build the tool + will be those who have installed the other language anyway. + + * If an application is not of extremely widespread interest, then + perhaps it's not important if the application is inconvenient to + install. - SHELL = /bin/sh + +File: standards.info, Node: Program Behavior, Next: Writing C, Prev: Design Advice, Up: Top -to avoid trouble on systems where the `SHELL' variable might be -inherited from the environment. (This is never a problem with GNU -`make'.) +Program Behavior for All Programs +********************************* - Don't assume that `.' is in the path for command execution. When -you need to run programs that are a part of your package during the -make, please make sure that it uses `./' if the program is built as -part of the make or `$(srcdir)/' if the file is an unchanging part of -the source code. Without one of these prefixes, the current search -path is used. + This node describes how to write robust software. It also describes +general standards for error messages, the command line interface, and +how libraries should behave. - The distinction between `./' and `$(srcdir)/' is important when -using the `--srcdir' option to `configure'. A rule of the form: +* Menu: - foo.1 : foo.man sedscript - sed -e sedscript foo.man > foo.1 +* Semantics:: Writing robust programs +* Libraries:: Library behavior +* Errors:: Formatting error messages +* User Interfaces:: Standards for command line interfaces +* Option Table:: Table of long options. +* Memory Usage:: When and how to care about memory needs -will fail when the current directory is not the source directory, -because `foo.man' and `sedscript' are not in the current directory. + +File: standards.info, Node: Semantics, Next: Libraries, Up: Program Behavior - When using GNU `make', relying on `VPATH' to find the source file -will work in the case where there is a single dependency file, since -the `make' automatic variable `$<' will represent the source file -wherever it is. (Many versions of `make' set `$<' only in implicit -rules.) A makefile target like +Writing Robust Programs +======================= - foo.o : bar.c - $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o + Avoid arbitrary limits on the length or number of *any* data +structure, including file names, lines, files, and symbols, by +allocating all data structures dynamically. In most Unix utilities, +"long lines are silently truncated". This is not acceptable in a GNU +utility. + + Utilities reading files should not drop NUL characters, or any other +nonprinting characters *including those with codes above 0177*. The +only sensible exceptions would be utilities specifically intended for +interface to certain types of printers that can't handle those +characters. + + Check every system call for an error return, unless you know you +wish to ignore errors. Include the system error text (from `perror' or +equivalent) in *every* error message resulting from a failing system +call, as well as the name of the file if any and the name of the +utility. Just "cannot open foo.c" or "stat failed" is not sufficient. + + Check every call to `malloc' or `realloc' to see if it returned +zero. Check `realloc' even if you are making the block smaller; in a +system that rounds block sizes to a power of 2, `realloc' may get a +different block if you ask for less space. + + In Unix, `realloc' can destroy the storage block if it returns zero. +GNU `realloc' does not have this bug: if it fails, the original block +is unchanged. Feel free to assume the bug is fixed. If you wish to +run your program on Unix, and wish to avoid lossage in this case, you +can use the GNU `malloc'. + + You must expect `free' to alter the contents of the block that was +freed. Anything you want to fetch from the block, you must fetch before +calling `free'. + + If `malloc' fails in a noninteractive program, make that a fatal +error. In an interactive program (one that reads commands from the +user), it is better to abort the command and return to the command +reader loop. This allows the user to kill other processes to free up +virtual memory, and then try the command again. + + Use `getopt_long' to decode arguments, unless the argument syntax +makes this unreasonable. + + When static storage is to be written in during program execution, use +explicit C code to initialize it. Reserve C initialized declarations +for data that will not be changed. + + Try to avoid low-level interfaces to obscure Unix data structures +(such as file directories, utmp, or the layout of kernel memory), since +these are less likely to work compatibly. If you need to find all the +files in a directory, use `readdir' or some other high-level interface. +These will be supported compatibly by GNU. + + By default, the GNU system will provide the signal handling +functions of BSD and of POSIX. So GNU software should be written to use +these. + + In error checks that detect "impossible" conditions, just abort. +There is usually no point in printing any message. These checks +indicate the existence of bugs. Whoever wants to fix the bugs will have +to read the source code and run a debugger. So explain the problem with +comments in the source. The relevant data will be in variables, which +are easy to examine with the debugger, so there is no point moving them +elsewhere. + + Do not use a count of errors as the exit status for a program. +*That does not work*, because exit status values are limited to 8 bits +(0 through 255). A single run of the program might have 256 errors; if +you try to return 256 as the exit status, the parent process will see 0 +as the status, and it will appear that the program succeeded. + + If you make temporary files, check the `TMPDIR' environment +variable; if that variable is defined, use the specified directory +instead of `/tmp'. -should instead be written as + +File: standards.info, Node: Libraries, Next: Errors, Prev: Semantics, Up: Program Behavior - foo.o : bar.c - $(CC) $(CFLAGS) $< -o $@ +Library Behavior +================ -in order to allow `VPATH' to work correctly. When the target has -multiple dependencies, using an explicit `$(srcdir)' is the easiest way -to make the rule work well. For example, the target above for `foo.1' -is best written as: + Try to make library functions reentrant. If they need to do dynamic +storage allocation, at least try to avoid any nonreentrancy aside from +that of `malloc' itself. + + Here are certain name conventions for libraries, to avoid name +conflicts. + + Choose a name prefix for the library, more than two characters long. +All external function and variable names should start with this prefix. +In addition, there should only be one of these in any given library +member. This usually means putting each one in a separate source file. + + An exception can be made when two external symbols are always used +together, so that no reasonable program could use one without the +other; then they can both go in the same file. + + External symbols that are not documented entry points for the user +should have names beginning with `_'. They should also contain the +chosen name prefix for the library, to prevent collisions with other +libraries. These can go in the same files with user entry points if +you like. - foo.1 : foo.man sedscript - sed -s $(srcdir)/sedscript $(srcdir)/foo.man > foo.1 + Static functions and variables can be used as you like and need not +fit any naming convention.  -File: standards.info, Node: Utilities in Makefiles, Next: Standard Targets, Prev: Makefile Basics, Up: Makefile Conventions +File: standards.info, Node: Errors, Next: User Interfaces, Prev: Libraries, Up: Program Behavior + +Formatting Error Messages +========================= -Utilities in Makefiles -====================== + Error messages from compilers should look like this: - Write the Makefile commands (and any shell scripts, such as -`configure') to run in `sh', not in `csh'. Don't use any special -features of `ksh' or `bash'. + SOURCE-FILE-NAME:LINENO: MESSAGE - The `configure' script and the Makefile rules for building and -installation should not use any utilities directly except these: + Error messages from other noninteractive programs should look like +this: - cat cmp cp echo egrep expr grep - ln mkdir mv pwd rm rmdir sed test touch + PROGRAM:SOURCE-FILE-NAME:LINENO: MESSAGE - Stick to the generally supported options for these programs. For -example, don't use `mkdir -p', convenient as it may be, because most -systems don't support it. +when there is an appropriate source file, or like this: - The Makefile rules for building and installation can also use -compilers and related programs, but should do so via `make' variables -so that the user can substitute alternatives. Here are some of the -programs we mean: + PROGRAM: MESSAGE - ar bison cc flex install ld lex - make makeinfo ranlib texi2dvi yacc +when there is no relevant source file. - When you use `ranlib', you should test whether it exists, and run it -only if it exists, so that the distribution will work on systems that -don't have `ranlib'. + In an interactive program (one that is reading commands from a +terminal), it is better not to include the program name in an error +message. The place to indicate which program is running is in the +prompt or with the screen layout. (When the same program runs with +input from a source other than a terminal, it is not interactive and +would do best to print error messages using the noninteractive style.) - If you use symbolic links, you should implement a fallback for -systems that don't have symbolic links. + The string MESSAGE should not begin with a capital letter when it +follows a program name and/or file name. Also, it should not end with +a period. - It is ok to use other utilities in Makefile portions (or scripts) -intended only for particular systems where you know those utilities to -exist. + Error messages from interactive programs, and other messages such as +usage messages, should start with a capital letter. But they should not +end with a period.  -File: standards.info, Node: Standard Targets, Next: Command Variables, Prev: Utilities in Makefiles, Up: Makefile Conventions +File: standards.info, Node: User Interfaces, Next: Option Table, Prev: Errors, Up: Program Behavior + +Standards for Command Line Interfaces +===================================== -Standard Targets for Users -========================== + Please don't make the behavior of a utility depend on the name used +to invoke it. It is useful sometimes to make a link to a utility with +a different name, and that should not change what it does. + + Instead, use a run time option or a compilation switch or both to +select among the alternate behaviors. + + Likewise, please don't make the behavior of the program depend on the +type of output device it is used with. Device independence is an +important principle of the system's design; do not compromise it merely +to save someone from typing an option now and then. + + If you think one behavior is most useful when the output is to a +terminal, and another is most useful when the output is a file or a +pipe, then it is usually best to make the default behavior the one that +is useful with output to a terminal, and have an option for the other +behavior. + + Compatibility requires certain programs to depend on the type of +output device. It would be disastrous if `ls' or `sh' did not do so in +the way all users expect. In some of these cases, we supplement the +program with a preferred alternate version that does not depend on the +output device type. For example, we provide a `dir' program much like +`ls' except that its default output format is always multi-column +format. + + It is a good idea to follow the POSIX guidelines for the +command-line options of a program. The easiest way to do this is to use +`getopt' to parse them. Note that the GNU version of `getopt' will +normally permit options anywhere among the arguments unless the special +argument `--' is used. This is not what POSIX specifies; it is a GNU +extension. + + Please define long-named options that are equivalent to the +single-letter Unix-style options. We hope to make GNU more user +friendly this way. This is easy to do with the GNU function +`getopt_long'. + + One of the advantages of long-named options is that they can be +consistent from program to program. For example, users should be able +to expect the "verbose" option of any GNU program which has one, to be +spelled precisely `--verbose'. To achieve this uniformity, look at the +table of common long-option names when you choose the option names for +your program (*note Option Table::.). + + It is usually a good idea for file names given as ordinary arguments +to be input files only; any output files would be specified using +options (preferably `-o' or `--output'). Even if you allow an output +file name as an ordinary argument for compatibility, try to provide an +option as another way to specify it. This will lead to more consistency +among GNU utilities, and fewer idiosyncracies for users to remember. + + All programs should support two standard options: `--version' and +`--help'. + +`--version' + This option should direct the program to information about its + name, version, origin and legal status, all on standard output, + and then exit successfully. Other options and arguments should be + ignored once this is seen, and the program should not perform its + normal function. + + The first line is meant to be easy for a program to parse; the + version number proper starts after the last space. In addition, + it contains the canonical name for this program, in this format: + + GNU Emacs 19.30 + + The program's name should be a constant string; *don't* compute it + from `argv[0]'. The idea is to state the standard or canonical + name for the program, not its file name. There are other ways to + find out the precise file name where a command is found in `PATH'. + + If the program is a subsidiary part of a larger package, mention + the package name in parentheses, like this: + + emacsserver (GNU Emacs) 19.30 + + If the package has a version number which is different from this + program's version number, you can mention the package version + number just before the close-parenthesis. + + If you *need* to mention the version numbers of libraries which + are distributed separately from the package which contains this + program, you can do so by printing an additional line of version + info for each library you want to mention. Use the same format + for these lines as for the first line. + + Please don't mention all the libraries that the program uses "just + for completeness"--that would produce a lot of unhelpful clutter. + Please mention library version numbers only if you find in + practice that they are very important to you in debugging. + + The following line, after the version number line or lines, should + be a copyright notice. If more than one copyright notice is + called for, put each on a separate line. + + Next should follow a brief statement that the program is free + software, and that users are free to copy and change it on certain + conditions. If the program is covered by the GNU GPL, say so + here. Also mention that there is no warranty, to the extent + permitted by law. + + It is ok to finish the output with a list of the major authors of + the program, as a way of giving credit. + + Here's an example of output that follows these rules: + + GNU Emacs 19.34.5 + Copyright (C) 1996 Free Software Foundation, Inc. + GNU Emacs comes with NO WARRANTY, to the extent permitted by law. + You may redistribute copies of GNU Emacs + under the terms of the GNU General Public License. + For more information about these matters, see the files named COPYING. + + You should adapt this to your program, of course, filling in the + proper year, copyright holder, name of program, and the references + to distribution terms, and changing the rest of the wording as + necessary. + + This copyright notice only needs to mention the most recent year in + which changes were made--there's no need to list the years for + previous versions' changes. You don't have to mention the name of + the program in these notices, if that is inconvenient, since it + appeared in the first line. + +`--help' + This option should output brief documentation for how to invoke the + program, on standard output, then exit successfully. Other + options and arguments should be ignored once this is seen, and the + program should not perform its normal function. - All GNU programs should have the following targets in their -Makefiles: + Near the end of the `--help' option's output there should be a line + that says where to mail bug reports. It should have this format: + + Report bugs to MAILING-ADDRESS. + + +File: standards.info, Node: Option Table, Next: Memory Usage, Prev: User Interfaces, Up: Program Behavior + +Table of Long Options +===================== + + Here is a table of long options used by GNU programs. It is surely +incomplete, but we aim to list all the options that a new program might +want to be compatible with. If you use names not already in the table, +please send `gnu@prep.ai.mit.edu' a list of them, with their meanings, +so we can update the table. + +`after-date' + `-N' in `tar'. `all' - Compile the entire program. This should be the default target. - This target need not rebuild any documentation files; Info files - should normally be included in the distribution, and DVI files - should be made only when explicitly asked for. - -`install' - Compile the program and copy the executables, libraries, and so on - to the file names where they should reside for actual use. If - there is a simple test to verify that a program is properly - installed, this target should run that test. - - The commands should create all the directories in which files are - to be installed, if they don't already exist. This includes the - directories specified as the values of the variables `prefix' and - `exec_prefix', as well as all subdirectories that are needed. One - way to do this is by means of an `installdirs' target as described - below. - - Use `-' before any command for installing a man page, so that - `make' will ignore any errors. This is in case there are systems - that don't have the Unix man page documentation system installed. - - The way to install Info files is to copy them into `$(infodir)' - with `$(INSTALL_DATA)' (*note Command Variables::.), and then run - the `install-info' program if it is present. `install-info' is a - script that edits the Info `dir' file to add or update the menu - entry for the given Info file; it will be part of the Texinfo - package. Here is a sample rule to install an Info file: - - $(infodir)/foo.info: foo.info - # There may be a newer info file in . than in srcdir. - -if test -f foo.info; then d=.; \ - else d=$(srcdir); fi; \ - $(INSTALL_DATA) $$d/foo.info $@; \ - # Run install-info only if it exists. - # Use `if' instead of just prepending `-' to the - # line so we notice real errors from install-info. - # We use `$(SHELL) -c' because some shells do not - # fail gracefully when there is an unknown command. - if $(SHELL) -c 'install-info --version' \ - >/dev/null 2>&1; then \ - install-info --infodir=$(infodir) $$d/foo.info; \ - else true; fi - -`uninstall' - Delete all the installed files that the `install' target would - create (but not the noninstalled files such as `make all' would - create). - -`clean' - Delete all files from the current directory that are normally - created by building the program. Don't delete the files that - record the configuration. Also preserve files that could be made - by building, but normally aren't because the distribution comes - with them. - - Delete `.dvi' files here if they are not part of the distribution. - -`distclean' - Delete all files from the current directory that are created by - configuring or building the program. If you have unpacked the - source and built the program without creating any other files, - `make distclean' should leave only the files that were in the - distribution. - -`mostlyclean' - Like `clean', but may refrain from deleting a few files that people - normally don't want to recompile. For example, the `mostlyclean' - target for GCC does not delete `libgcc.a', because recompiling it - is rarely necessary and takes a lot of time. - -`realclean' - Delete everything from the current directory that can be - reconstructed with this Makefile. This typically includes - everything deleted by `distclean', plus more: C source files - produced by Bison, tags tables, Info files, and so on. - - One exception, however: `make realclean' should not delete - `configure' even if `configure' can be remade using a rule in the - Makefile. More generally, `make realclean' should not delete - anything that needs to exist in order to run `configure' and then - begin to build the program. + `-a' in `du', `ls', `nm', `stty', `uname', and `unexpand'. + +`all-text' + `-a' in `diff'. + +`almost-all' + `-A' in `ls'. + +`append' + `-a' in `etags', `tee', `time'; `-r' in `tar'. + +`archive' + `-a' in `cp'. + +`archive-name' + `-n' in `shar'. + +`arglength' + `-l' in `m4'. + +`ascii' + `-a' in `diff'. + +`assign' + `-v' in `gawk'. + +`assume-new' + `-W' in Make. + +`assume-old' + `-o' in Make. + +`auto-check' + `-a' in `recode'. + +`auto-pager' + `-a' in `wdiff'. + +`auto-reference' + `-A' in `ptx'. + +`avoid-wraps' + `-n' in `wdiff'. + +`backward-search' + `-B' in `ctags'. + +`basename' + `-f' in `shar'. + +`batch' + Used in GDB. + +`baud' + Used in GDB. + +`before' + `-b' in `tac'. + +`binary' + `-b' in `cpio' and `diff'. + +`bits-per-code' + `-b' in `shar'. + +`block-size' + Used in `cpio' and `tar'. + +`blocks' + `-b' in `head' and `tail'. + +`break-file' + `-b' in `ptx'. + +`brief' + Used in various programs to make output shorter. + +`bytes' + `-c' in `head', `split', and `tail'. + +`c++' + `-C' in `etags'. + +`catenate' + `-A' in `tar'. + +`cd' + Used in various programs to specify the directory to use. + +`changes' + `-c' in `chgrp' and `chown'. + +`classify' + `-F' in `ls'. + +`colons' + `-c' in `recode'. + +`command' + `-c' in `su'; `-x' in GDB. + +`compare' + `-d' in `tar'. + +`compat' + Used in `gawk'. + +`compress' + `-Z' in `tar' and `shar'. + +`concatenate' + `-A' in `tar'. + +`confirmation' + `-w' in `tar'. + +`context' + Used in `diff'. + +`copyleft' + `-W copyleft' in `gawk'. + +`copyright' + `-C' in `ptx', `recode', and `wdiff'; `-W copyright' in `gawk'. + +`core' + Used in GDB. + +`count' + `-q' in `who'. + +`count-links' + `-l' in `du'. -`TAGS' - Update a tags table for this program. +`create' + Used in `tar' and `cpio'. + +`cut-mark' + `-c' in `shar'. + +`cxref' + `-x' in `ctags'. + +`date' + `-d' in `touch'. + +`debug' + `-d' in Make and `m4'; `-t' in Bison. + +`define' + `-D' in `m4'. + +`defines' + `-d' in Bison and `ctags'. + +`delete' + `-D' in `tar'. + +`dereference' + `-L' in `chgrp', `chown', `cpio', `du', `ls', and `tar'. + +`dereference-args' + `-D' in `du'. + +`diacritics' + `-d' in `recode'. + +`dictionary-order' + `-d' in `look'. + +`diff' + `-d' in `tar'. + +`digits' + `-n' in `csplit'. + +`directory' + Specify the directory to use, in various programs. In `ls', it + means to show directories themselves rather than their contents. + In `rm' and `ln', it means to not treat links to directories + specially. + +`discard-all' + `-x' in `strip'. + +`discard-locals' + `-X' in `strip'. + +`dry-run' + `-n' in Make. + +`ed' + `-e' in `diff'. + +`elide-empty-files' + `-z' in `csplit'. + +`end-delete' + `-x' in `wdiff'. + +`end-insert' + `-z' in `wdiff'. + +`entire-new-file' + `-N' in `diff'. + +`environment-overrides' + `-e' in Make. + +`eof' + `-e' in `xargs'. + +`epoch' + Used in GDB. + +`error-limit' + Used in `makeinfo'. + +`error-output' + `-o' in `m4'. + +`escape' + `-b' in `ls'. + +`exclude-from' + `-X' in `tar'. + +`exec' + Used in GDB. + +`exit' + `-x' in `xargs'. + +`exit-0' + `-e' in `unshar'. + +`expand-tabs' + `-t' in `diff'. + +`expression' + `-e' in `sed'. + +`extern-only' + `-g' in `nm'. + +`extract' + `-i' in `cpio'; `-x' in `tar'. + +`faces' + `-f' in `finger'. + +`fast' + `-f' in `su'. + +`fatal-warnings' + `-E' in `m4'. + +`file' + `-f' in `info', `gawk', Make, `mt', and `tar'; `-n' in `sed'; `-r' + in `touch'. + +`field-separator' + `-F' in `gawk'. + +`file-prefix' + `-b' in Bison. + +`file-type' + `-F' in `ls'. + +`files-from' + `-T' in `tar'. + +`fill-column' + Used in `makeinfo'. + +`flag-truncation' + `-F' in `ptx'. + +`fixed-output-files' + `-y' in Bison. + +`follow' + `-f' in `tail'. + +`footnote-style' + Used in `makeinfo'. + +`force' + `-f' in `cp', `ln', `mv', and `rm'. + +`force-prefix' + `-F' in `shar'. + +`format' + Used in `ls', `time', and `ptx'. + +`freeze-state' + `-F' in `m4'. + +`fullname' + Used in GDB. + +`gap-size' + `-g' in `ptx'. + +`get' + `-x' in `tar'. + +`graphic' + `-i' in `ul'. + +`graphics' + `-g' in `recode'. + +`group' + `-g' in `install'. + +`gzip' + `-z' in `tar' and `shar'. + +`hashsize' + `-H' in `m4'. + +`header' + `-h' in `objdump' and `recode' + +`heading' + `-H' in `who'. + +`help' + Used to ask for brief usage information. + +`here-delimiter' + `-d' in `shar'. + +`hide-control-chars' + `-q' in `ls'. + +`idle' + `-u' in `who'. + +`ifdef' + `-D' in `diff'. + +`ignore' + `-I' in `ls'; `-x' in `recode'. + +`ignore-all-space' + `-w' in `diff'. + +`ignore-backups' + `-B' in `ls'. + +`ignore-blank-lines' + `-B' in `diff'. + +`ignore-case' + `-f' in `look' and `ptx'; `-i' in `diff' and `wdiff'. + +`ignore-errors' + `-i' in Make. + +`ignore-file' + `-i' in `ptx'. + +`ignore-indentation' + `-I' in `etags'. + +`ignore-init-file' + `-f' in Oleo. + +`ignore-interrupts' + `-i' in `tee'. + +`ignore-matching-lines' + `-I' in `diff'. + +`ignore-space-change' + `-b' in `diff'. + +`ignore-zeros' + `-i' in `tar'. + +`include' + `-i' in `etags'; `-I' in `m4'. + +`include-dir' + `-I' in Make. + +`incremental' + `-G' in `tar'. `info' - Generate any Info files needed. The best way to write the rules - is as follows: + `-i', `-l', and `-m' in Finger. - info: foo.info - - foo.info: foo.texi chap1.texi chap2.texi - $(MAKEINFO) $(srcdir)/foo.texi - - You must define the variable `MAKEINFO' in the Makefile. It should - run the `makeinfo' program, which is part of the Texinfo - distribution. - -`dvi' - Generate DVI files for all TeXinfo documentation. For example: - - dvi: foo.dvi - - foo.dvi: foo.texi chap1.texi chap2.texi - $(TEXI2DVI) $(srcdir)/foo.texi - - You must define the variable `TEXI2DVI' in the Makefile. It should - run the program `texi2dvi', which is part of the Texinfo - distribution. Alternatively, write just the dependencies, and - allow GNU Make to provide the command. - -`dist' - Create a distribution tar file for this program. The tar file - should be set up so that the file names in the tar file start with - a subdirectory name which is the name of the package it is a - distribution for. This name can include the version number. - - For example, the distribution tar file of GCC version 1.40 unpacks - into a subdirectory named `gcc-1.40'. - - The easiest way to do this is to create a subdirectory - appropriately named, use `ln' or `cp' to install the proper files - in it, and then `tar' that subdirectory. - - The `dist' target should explicitly depend on all non-source files - that are in the distribution, to make sure they are up to date in - the distribution. *Note Making Releases: (standards)Releases. - -`check' - Perform self-tests (if any). The user must build the program - before running the tests, but need not install the program; you - should write the self-tests so that they work when the program is - built but not installed. - - The following targets are suggested as conventional names, for -programs in which they are useful. - -`installcheck' - Perform installation tests (if any). The user must build and - install the program before running the tests. You should not - assume that `$(bindir)' is in the search path. - -`installdirs' - It's useful to add a target named `installdirs' to create the - directories where files are installed, and their parent - directories. There is a script called `mkinstalldirs' which is - convenient for this; find it in the Texinfo package.You can use a - rule like this: - - # Make sure all installation directories (e.g. $(bindir)) - # actually exist by making them if necessary. - installdirs: mkinstalldirs - $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ - $(libdir) $(infodir) \ - $(mandir) +`initial' + `-i' in `expand'. - -File: standards.info, Node: Command Variables, Next: Directory Variables, Prev: Standard Targets, Up: Makefile Conventions +`initial-tab' + `-T' in `diff'. -Variables for Specifying Commands -================================= +`inode' + `-i' in `ls'. - Makefiles should provide variables for overriding certain commands, -options, and so on. +`interactive' + `-i' in `cp', `ln', `mv', `rm'; `-e' in `m4'; `-p' in `xargs'; + `-w' in `tar'. - In particular, you should run most utility programs via variables. -Thus, if you use Bison, have a variable named `BISON' whose default -value is set with `BISON = bison', and refer to it with `$(BISON)' -whenever you need to use Bison. - - File management utilities such as `ln', `rm', `mv', and so on, need -not be referred to through variables in this way, since users don't -need to replace them with other programs. - - Each program-name variable should come with an options variable that -is used to supply options to the program. Append `FLAGS' to the -program-name variable name to get the options variable name--for -example, `BISONFLAGS'. (The name `CFLAGS' is an exception to this -rule, but we keep it because it is standard.) Use `CPPFLAGS' in any -compilation command that runs the preprocessor, and use `LDFLAGS' in -any compilation command that does linking as well as in any direct use -of `ld'. - - If there are C compiler options that *must* be used for proper -compilation of certain files, do not include them in `CFLAGS'. Users -expect to be able to specify `CFLAGS' freely themselves. Instead, -arrange to pass the necessary options to the C compiler independently -of `CFLAGS', by writing them explicitly in the compilation commands or -by defining an implicit rule, like this: - - CFLAGS = -g - ALL_CFLAGS = -I. $(CFLAGS) - .c.o: - $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< - - Do include the `-g' option in `CFLAGS', because that is not -*required* for proper compilation. You can consider it a default that -is only recommended. If the package is set up so that it is compiled -with GCC by default, then you might as well include `-O' in the default -value of `CFLAGS' as well. - - Put `CFLAGS' last in the compilation command, after other variables -containing compiler options, so the user can use `CFLAGS' to override -the others. - - Every Makefile should define the variable `INSTALL', which is the -basic command for installing a file into the system. - - Every Makefile should also define the variables `INSTALL_PROGRAM' -and `INSTALL_DATA'. (The default for each of these should be -`$(INSTALL)'.) Then it should use those variables as the commands for -actual installation, for executables and nonexecutables respectively. -Use these variables as follows: - - $(INSTALL_PROGRAM) foo $(bindir)/foo - $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a - -Always use a file name, not a directory name, as the second argument of -the installation commands. Use a separate command for each file to be -installed. +`intermix-type' + `-p' in `shar'. - -File: standards.info, Node: Directory Variables, Prev: Command Variables, Up: Makefile Conventions +`jobs' + `-j' in Make. + +`just-print' + `-n' in Make. + +`keep-going' + `-k' in Make. + +`keep-files' + `-k' in `csplit'. + +`kilobytes' + `-k' in `du' and `ls'. + +`language' + `-l' in `etags'. + +`less-mode' + `-l' in `wdiff'. + +`level-for-gzip' + `-g' in `shar'. + +`line-bytes' + `-C' in `split'. + +`lines' + Used in `split', `head', and `tail'. + +`link' + `-l' in `cpio'. + +`lint' +`lint-old' + Used in `gawk'. + +`list' + `-t' in `cpio'; `-l' in `recode'. + +`list' + `-t' in `tar'. + +`literal' + `-N' in `ls'. + +`load-average' + `-l' in Make. + +`login' + Used in `su'. + +`machine' + No listing of which programs already use this; someone should + check to see if any actually do and tell `gnu@prep.ai.mit.edu'. + +`macro-name' + `-M' in `ptx'. + +`mail' + `-m' in `hello' and `uname'. + +`make-directories' + `-d' in `cpio'. + +`makefile' + `-f' in Make. + +`mapped' + Used in GDB. + +`max-args' + `-n' in `xargs'. + +`max-chars' + `-n' in `xargs'. + +`max-lines' + `-l' in `xargs'. + +`max-load' + `-l' in Make. + +`max-procs' + `-P' in `xargs'. + +`mesg' + `-T' in `who'. + +`message' + `-T' in `who'. -Variables for Installation Directories -====================================== +`minimal' + `-d' in `diff'. - Installation directories should always be named by variables, so it -is easy to install in a nonstandard place. The standard names for these -variables are: +`mixed-uuencode' + `-M' in `shar'. + +`mode' + `-m' in `install', `mkdir', and `mkfifo'. + +`modification-time' + `-m' in `tar'. + +`multi-volume' + `-M' in `tar'. + +`name-prefix' + `-a' in Bison. + +`nesting-limit' + `-L' in `m4'. + +`net-headers' + `-a' in `shar'. + +`new-file' + `-W' in Make. + +`no-builtin-rules' + `-r' in Make. + +`no-character-count' + `-w' in `shar'. + +`no-check-existing' + `-x' in `shar'. + +`no-common' + `-3' in `wdiff'. + +`no-create' + `-c' in `touch'. + +`no-defines' + `-D' in `etags'. + +`no-deleted' + `-1' in `wdiff'. + +`no-dereference' + `-d' in `cp'. + +`no-inserted' + `-2' in `wdiff'. + +`no-keep-going' + `-S' in Make. + +`no-lines' + `-l' in Bison. + +`no-piping' + `-P' in `shar'. + +`no-prof' + `-e' in `gprof'. + +`no-regex' + `-R' in `etags'. + +`no-sort' + `-p' in `nm'. + +`no-split' + Used in `makeinfo'. + +`no-static' + `-a' in `gprof'. + +`no-time' + `-E' in `gprof'. + +`no-timestamp' + `-m' in `shar'. + +`no-validate' + Used in `makeinfo'. + +`no-wait' + Used in `emacsclient'. + +`no-warn' + Used in various programs to inhibit warnings. + +`node' + `-n' in `info'. + +`nodename' + `-n' in `uname'. + +`nonmatching' + `-f' in `cpio'. + +`nstuff' + `-n' in `objdump'. + +`null' + `-0' in `xargs'. + +`number' + `-n' in `cat'. + +`number-nonblank' + `-b' in `cat'. + +`numeric-sort' + `-n' in `nm'. + +`numeric-uid-gid' + `-n' in `cpio' and `ls'. + +`nx' + Used in GDB. + +`old-archive' + `-o' in `tar'. + +`old-file' + `-o' in Make. + +`one-file-system' + `-l' in `tar', `cp', and `du'. + +`only-file' + `-o' in `ptx'. + +`only-prof' + `-f' in `gprof'. + +`only-time' + `-F' in `gprof'. + +`output' + In various programs, specify the output file name. + +`output-prefix' + `-o' in `shar'. + +`override' + `-o' in `rm'. + +`overwrite' + `-c' in `unshar'. + +`owner' + `-o' in `install'. + +`paginate' + `-l' in `diff'. + +`paragraph-indent' + Used in `makeinfo'. + +`parents' + `-p' in `mkdir' and `rmdir'. + +`pass-all' + `-p' in `ul'. + +`pass-through' + `-p' in `cpio'. + +`port' + `-P' in `finger'. + +`portability' + `-c' in `cpio' and `tar'. + +`posix' + Used in `gawk'. + +`prefix-builtins' + `-P' in `m4'. `prefix' - A prefix used in constructing the default values of the variables - listed below. The default value of `prefix' should be `/usr/local' - (at least for now). - -`exec_prefix' - A prefix used in constructing the default values of some of the - variables listed below. The default value of `exec_prefix' should - be `$(prefix)'. - - Generally, `$(exec_prefix)' is used for directories that contain - machine-specific files (such as executables and subroutine - libraries), while `$(prefix)' is used directly for other - directories. - -`bindir' - The directory for installing executable programs that users can - run. This should normally be `/usr/local/bin', but write it as - `$(exec_prefix)/bin'. - -`libdir' - The directory for installing executable files to be run by the - program rather than by users. Object files and libraries of - object code should also go in this directory. The idea is that - this directory is used for files that pertain to a specific - machine architecture, but need not be in the path for commands. - The value of `libdir' should normally be `/usr/local/lib', but - write it as `$(exec_prefix)/lib'. - -`datadir' - The directory for installing read-only data files which the - programs refer to while they run. This directory is used for - files which are independent of the type of machine being used. - This should normally be `/usr/local/lib', but write it as - `$(prefix)/lib'. - -`statedir' - The directory for installing data files which the programs modify - while they run. These files should be independent of the type of - machine being used, and it should be possible to share them among - machines at a network installation. This should normally be - `/usr/local/lib', but write it as `$(prefix)/lib'. - -`includedir' - The directory for installing header files to be included by user - programs with the C `#include' preprocessor directive. This - should normally be `/usr/local/include', but write it as - `$(prefix)/include'. - - Most compilers other than GCC do not look for header files in - `/usr/local/include'. So installing the header files this way is - only useful with GCC. Sometimes this is not a problem because some - libraries are only really intended to work with GCC. But some - libraries are intended to work with other compilers. They should - install their header files in two places, one specified by - `includedir' and one specified by `oldincludedir'. - -`oldincludedir' - The directory for installing `#include' header files for use with - compilers other than GCC. This should normally be `/usr/include'. - - The Makefile commands should check whether the value of - `oldincludedir' is empty. If it is, they should not try to use - it; they should cancel the second installation of the header files. - - A package should not replace an existing header in this directory - unless the header came from the same package. Thus, if your Foo - package provides a header file `foo.h', then it should install the - header file in the `oldincludedir' directory if either (1) there - is no `foo.h' there or (2) the `foo.h' that exists came from the - Foo package. - - To tell whether `foo.h' came from the Foo package, put a magic - string in the file--part of a comment--and grep for that string. - -`mandir' - The directory for installing the man pages (if any) for this - package. It should include the suffix for the proper section of - the manual--usually `1' for a utility. It will normally be - `/usr/local/man/man1', but you should write it as - `$(prefix)/man/man1'. - -`man1dir' - The directory for installing section 1 man pages. - -`man2dir' - The directory for installing section 2 man pages. - -`...' - Use these names instead of `mandir' if the package needs to - install man pages in more than one section of the manual. - - *Don't make the primary documentation for any GNU software be a - man page. Write a manual in Texinfo instead. Man pages are just - for the sake of people running GNU software on Unix, which is a - secondary application only.* - -`manext' - The file name extension for the installed man page. This should - contain a period followed by the appropriate digit; it should - normally be `.1'. - -`man1ext' - The file name extension for installed section 1 man pages. - -`man2ext' - The file name extension for installed section 2 man pages. - -`...' - Use these names instead of `manext' if the package needs to - install man pages in more than one section of the manual. - -`infodir' - The directory for installing the Info files for this package. By - default, it should be `/usr/local/info', but it should be written - as `$(prefix)/info'. - -`srcdir' - The directory for the sources being compiled. The value of this - variable is normally inserted by the `configure' shell script. - - For example: - - # Common prefix for installation directories. - # NOTE: This directory must exist when you start the install. - prefix = /usr/local - exec_prefix = $(prefix) - # Where to put the executable for the command `gcc'. - bindir = $(exec_prefix)/bin - # Where to put the directories used by the compiler. - libdir = $(exec_prefix)/lib - # Where to put the Info files. - infodir = $(prefix)/info - - If your program installs a large number of files into one of the -standard user-specified directories, it might be useful to group them -into a subdirectory particular to that program. If you do this, you -should write the `install' rule to create these subdirectories. - - Do not expect the user to include the subdirectory name in the value -of any of the variables listed above. The idea of having a uniform set -of variable names for installation directories is to enable the user to -specify the exact same values for several different GNU packages. In -order for this to be useful, all the packages must be designed so that -they will work sensibly when the user does so. + `-f' in `csplit'. - -File: standards.info, Node: Configuration, Next: Source Language, Prev: Makefile Conventions, Up: Top +`preserve' + Used in `tar' and `cp'. -How Configuration Should Work -***************************** +`preserve-environment' + `-p' in `su'. - Each GNU distribution should come with a shell script named -`configure'. This script is given arguments which describe the kind of -machine and system you want to compile the program for. - - The `configure' script must record the configuration options so that -they affect compilation. - - One way to do this is to make a link from a standard name such as -`config.h' to the proper configuration file for the chosen system. If -you use this technique, the distribution should *not* contain a file -named `config.h'. This is so that people won't be able to build the -program without configuring it first. - - Another thing that `configure' can do is to edit the Makefile. If -you do this, the distribution should *not* contain a file named -`Makefile'. Instead, include a file `Makefile.in' which contains the -input used for editing. Once again, this is so that people won't be -able to build the program without configuring it first. - - If `configure' does write the `Makefile', then `Makefile' should -have a target named `Makefile' which causes `configure' to be rerun, -setting up the same configuration that was set up last time. The files -that `configure' reads should be listed as dependencies of `Makefile'. - - All the files which are output from the `configure' script should -have comments at the beginning explaining that they were generated -automatically using `configure'. This is so that users won't think of -trying to edit them by hand. - - The `configure' script should write a file named `config.status' -which describes which configuration options were specified when the -program was last configured. This file should be a shell script which, -if run, will recreate the same configuration. - - The `configure' script should accept an option of the form -`--srcdir=DIRNAME' to specify the directory where sources are found (if -it is not the current directory). This makes it possible to build the -program in a separate directory, so that the actual source directory is -not modified. - - If the user does not specify `--srcdir', then `configure' should -check both `.' and `..' to see if it can find the sources. If it finds -the sources in one of these places, it should use them from there. -Otherwise, it should report that it cannot find the sources, and should -exit with nonzero status. - - Usually the easy way to support `--srcdir' is by editing a -definition of `VPATH' into the Makefile. Some rules may need to refer -explicitly to the specified source directory. To make this possible, -`configure' can add to the Makefile a variable named `srcdir' whose -value is precisely the specified directory. +`preserve-modification-time' + `-m' in `cpio'. - The `configure' script should also take an argument which specifies -the type of system to build the program for. This argument should look -like this: +`preserve-order' + `-s' in `tar'. + +`preserve-permissions' + `-p' in `tar'. + +`print' + `-l' in `diff'. + +`print-chars' + `-L' in `cmp'. + +`print-data-base' + `-p' in Make. + +`print-directory' + `-w' in Make. + +`print-file-name' + `-o' in `nm'. + +`print-symdefs' + `-s' in `nm'. + +`printer' + `-p' in `wdiff'. + +`prompt' + `-p' in `ed'. + +`query-user' + `-X' in `shar'. + +`question' + `-q' in Make. + +`quiet' + Used in many programs to inhibit the usual output. *Note:* every + program accepting `--quiet' should accept `--silent' as a synonym. + +`quiet-unshar' + `-Q' in `shar' + +`quote-name' + `-Q' in `ls'. + +`rcs' + `-n' in `diff'. + +`re-interval' + Used in `gawk'. + +`read-full-blocks' + `-B' in `tar'. + +`readnow' + Used in GDB. + +`recon' + `-n' in Make. + +`record-number' + `-R' in `tar'. + +`recursive' + Used in `chgrp', `chown', `cp', `ls', `diff', and `rm'. + +`reference-limit' + Used in `makeinfo'. + +`references' + `-r' in `ptx'. + +`regex' + `-r' in `tac' and `etags'. + +`release' + `-r' in `uname'. + +`reload-state' + `-R' in `m4'. + +`relocation' + `-r' in `objdump'. + +`rename' + `-r' in `cpio'. + +`replace' + `-i' in `xargs'. + +`report-identical-files' + `-s' in `diff'. + +`reset-access-time' + `-a' in `cpio'. + +`reverse' + `-r' in `ls' and `nm'. + +`reversed-ed' + `-f' in `diff'. + +`right-side-defs' + `-R' in `ptx'. + +`same-order' + `-s' in `tar'. + +`same-permissions' + `-p' in `tar'. + +`save' + `-g' in `stty'. + +`se' + Used in GDB. + +`sentence-regexp' + `-S' in `ptx'. + +`separate-dirs' + `-S' in `du'. + +`separator' + `-s' in `tac'. + +`sequence' + Used by `recode' to chose files or pipes for sequencing passes. + +`shell' + `-s' in `su'. + +`show-all' + `-A' in `cat'. + +`show-c-function' + `-p' in `diff'. + +`show-ends' + `-E' in `cat'. + +`show-function-line' + `-F' in `diff'. + +`show-tabs' + `-T' in `cat'. + +`silent' + Used in many programs to inhibit the usual output. *Note:* every + program accepting `--silent' should accept `--quiet' as a synonym. + +`size' + `-s' in `ls'. + +`sort' + Used in `ls'. + +`source' + `-W source' in `gawk'. + +`sparse' + `-S' in `tar'. + +`speed-large-files' + `-H' in `diff'. + +`split-at' + `-E' in `unshar'. - CPU-COMPANY-SYSTEM +`split-size-limit' + `-L' in `shar'. - For example, a Sun 3 might be `m68k-sun-sunos4.1'. +`squeeze-blank' + `-s' in `cat'. - The `configure' script needs to be able to decode all plausible -alternatives for how to describe a machine. Thus, `sun3-sunos4.1' -would be a valid alias. So would `sun3-bsd4.2', since SunOS is -basically BSD and no other BSD system is used on a Sun. For many -programs, `vax-dec-ultrix' would be an alias for `vax-dec-bsd', simply -because the differences between Ultrix and BSD are rarely noticeable, -but a few programs might need to distinguish them. - - There is a shell script called `config.sub' that you can use as a -subroutine to validate system types and canonicalize aliases. - - Other options are permitted to specify in more detail the software -or hardware present on the machine, and include or exclude optional -parts of the package: - -`--enable-FEATURE[=PARAMETER]' - Configure the package to build and install an optional user-level - facility called FEATURE. This allows users to choose which - optional features to include. Giving an optional PARAMETER of - `no' should omit FEATURE, if it is built by default. - - No `--enable' option should *ever* cause one feature to replace - another. No `--enable' option should ever substitute one useful - behavior for another useful behavior. The only proper use for - `--enable' is for questions of whether to build part of the program - or exclude it. - -`--with-PACKAGE' - The package PACKAGE will be installed, so configure this package - to work with PACKAGE. - - Possible values of PACKAGE include `x', `x-toolkit', `gnu-as' (or - `gas'), `gnu-ld', `gnu-libc', and `gdb'. - - Do not use a `--with' option to specify the file name to use to - find certain files. That is outside the scope of what `--with' - options are for. - -`--nfp' - The target machine has no floating point processor. - -`--gas' - The target machine assembler is GAS, the GNU assembler. This is - obsolete; users should use `--with-gnu-as' instead. - -`--x' - The target machine has the X Window System installed. This is - obsolete; users should use `--with-x' instead. - - All `configure' scripts should accept all of these "detail" options, -whether or not they make any difference to the particular package at -hand. In particular, they should accept any option that starts with -`--with-' or `--enable-'. This is so users will be able to configure -an entire GNU source tree at once with a single set of options. - - You will note that the categories `--with-' and `--enable-' are -narrow: they *do not* provide a place for any sort of option you might -think of. That is deliberate. We want to limit the possible -configuration options in GNU software. We do not want GNU programs to -have idiosyncratic configuration options. - - Packages that perform part of compilation may support -cross-compilation. In such a case, the host and target machines for -the program may be different. The `configure' script should normally -treat the specified type of system as both the host and the target, -thus producing a program which works for the same type of machine that -it runs on. - - The way to build a cross-compiler, cross-assembler, or what have -you, is to specify the option `--host=HOSTTYPE' when running -`configure'. This specifies the host system without changing the type -of target system. The syntax for HOSTTYPE is the same as described -above. - - Bootstrapping a cross-compiler requires compiling it on a machine -other than the host it will run on. Compilation packages accept a -configuration option `--build=HOSTTYPE' for specifying the -configuration on which you will compile them, in case that is different -from the host. - - Programs for which cross-operation is not meaningful need not accept -the `--host' option, because configuring an entire operating system for -cross-operation is not a meaningful thing. - - Some programs have ways of configuring themselves automatically. If -your program is set up to do this, your `configure' script can simply -ignore most of its arguments. +`start-delete' + `-w' in `wdiff'. + +`start-insert' + `-y' in `wdiff'. + +`starting-file' + Used in `tar' and `diff' to specify which file within a directory + to start processing with. + +`statistics' + `-s' in `wdiff'. + +`stdin-file-list' + `-S' in `shar'. + +`stop' + `-S' in Make. + +`strict' + `-s' in `recode'. + +`strip' + `-s' in `install'. + +`strip-all' + `-s' in `strip'. + +`strip-debug' + `-S' in `strip'. + +`submitter' + `-s' in `shar'. + +`suffix' + `-S' in `cp', `ln', `mv'. + +`suffix-format' + `-b' in `csplit'. + +`sum' + `-s' in `gprof'. + +`summarize' + `-s' in `du'. + +`symbolic' + `-s' in `ln'. + +`symbols' + Used in GDB and `objdump'. + +`synclines' + `-s' in `m4'. + +`sysname' + `-s' in `uname'. + +`tabs' + `-t' in `expand' and `unexpand'. + +`tabsize' + `-T' in `ls'. + +`terminal' + `-T' in `tput' and `ul'. `-t' in `wdiff'. + +`text' + `-a' in `diff'. + +`text-files' + `-T' in `shar'. + +`time' + Used in `ls' and `touch'. + +`to-stdout' + `-O' in `tar'. + +`total' + `-c' in `du'. + +`touch' + `-t' in Make, `ranlib', and `recode'. + +`trace' + `-t' in `m4'. + +`traditional' + `-t' in `hello'; `-W traditional' in `gawk'; `-G' in `ed', `m4', + and `ptx'. + +`tty' + Used in GDB. + +`typedefs' + `-t' in `ctags'. + +`typedefs-and-c++' + `-T' in `ctags'. + +`typeset-mode' + `-t' in `ptx'. + +`uncompress' + `-z' in `tar'. + +`unconditional' + `-u' in `cpio'. + +`undefine' + `-U' in `m4'. + +`undefined-only' + `-u' in `nm'. + +`update' + `-u' in `cp', `ctags', `mv', `tar'. + +`usage' + Used in `gawk'; same as `--help'. + +`uuencode' + `-B' in `shar'. + +`vanilla-operation' + `-V' in `shar'. + +`verbose' + Print more information about progress. Many programs support this. + +`verify' + `-W' in `tar'. + +`version' + Print the version number. + +`version-control' + `-V' in `cp', `ln', `mv'. + +`vgrind' + `-v' in `ctags'. + +`volume' + `-V' in `tar'. + +`what-if' + `-W' in Make. + +`whole-size-limit' + `-l' in `shar'. + +`width' + `-w' in `ls' and `ptx'. + +`word-regexp' + `-W' in `ptx'. + +`writable' + `-T' in `who'. + +`zeros' + `-z' in `gprof'.  -File: standards.info, Node: Source Language, Next: Formatting, Prev: Configuration, Up: Top +File: standards.info, Node: Memory Usage, Prev: Option Table, Up: Program Behavior -Using Languages Other Than C -**************************** +Memory Usage +============ - Using a language other than C is like using a non-standard feature: -it will cause trouble for users. Even if GCC supports the other -language, users may find it inconvenient to have to install the -compiler for that other language in order to build your program. So -please write in C. + If it typically uses just a few meg of memory, don't bother making +any effort to reduce memory usage. For example, if it is impractical +for other reasons to operate on files more than a few meg long, it is +reasonable to read entire input files into core to operate on them. + + However, for programs such as `cat' or `tail', that can usefully +operate on very large files, it is important to avoid using a technique +that would artificially limit the size of files it can handle. If a +program works by lines and could be applied to arbitrary user-supplied +input files, it should keep only a line in memory, because this is not +very hard and users will want to be able to operate on input files that +are bigger than will fit in core all at once. - There are three exceptions for this rule: + If your program creates complicated data structures, just make them +in core and give a fatal error if `malloc' returns zero. - * It is okay to use a special language if the same program contains - an interpreter for that language. + +File: standards.info, Node: Writing C, Next: Documentation, Prev: Program Behavior, Up: Top - Thus, it is not a problem that GNU Emacs contains code written in - Emacs Lisp, because it comes with a Lisp interpreter. +Making The Best Use of C +************************ - * It is okay to use another language in a tool specifically intended - for use with that language. + This node provides advice on how best to use the C language when +writing GNU software. - This is okay because the only people who want to build the tool - will be those who have installed the other language anyway. +* Menu: - * If an application is not of extremely widespread interest, then - perhaps it's not important if the application is inconvenient to - install. +* Formatting:: Formatting Your Source Code +* Comments:: Commenting Your Work +* Syntactic Conventions:: Clean Use of C Constructs +* Names:: Naming Variables and Functions +* System Portability:: Portability between different operating systems +* CPU Portability:: Supporting the range of CPU types +* System Functions:: Portability and "standard" library functions +* Internationalization:: Techniques for internationalization +* Mmap:: How you can safely use `mmap'.  -File: standards.info, Node: Formatting, Next: Comments, Prev: Source Language, Up: Top +File: standards.info, Node: Formatting, Next: Comments, Up: Writing C Formatting Your Source Code -*************************** +=========================== It is important to put the open-brace that starts the body of a C function in column zero, and avoid putting any other open-brace or @@ -1021,14 +1816,21 @@ page. The formfeeds should appear alone on lines by themselves.  -File: standards.info, Node: Comments, Next: Syntactic Conventions, Prev: Formatting, Up: Top +File: standards.info, Node: Comments, Next: Syntactic Conventions, Prev: Formatting, Up: Writing C Commenting Your Work -******************** +==================== Every program should start with a comment saying briefly what it is for. Example: `fmt - filter for simple filling of text'. + Please write the comments in a GNU program in English, because +English is the one language that nearly all programmers in all +countries can read. If you do not write English well, please write +comments in English as well as you can, then ask other people to help +rewrite them. If you can't write comments in English, please find +someone to work with you and translate your comments into English. + Please put a comment on each function saying what the function does, what sorts of arguments it gets, and what the possible values of arguments mean and are used for. It is not necessary to duplicate in @@ -1045,7 +1847,7 @@ Please put two spaces after the end of a sentence in your comments, so that the Emacs sentence commands will work. Also, please write complete sentences and capitalize the first word. If a lower-case -identifer comes at the beginning of a sentence, don't capitalize it! +identifier comes at the beginning of a sentence, don't capitalize it! Changing the spelling makes it a different identifier. If you don't like starting a sentence with a lower case letter, write the sentence differently (e.g., "The identifier lower-case is ..."). @@ -1086,140 +1888,4 @@ #else /* foo */ ... #endif /* foo */ - - -File: standards.info, Node: Syntactic Conventions, Next: Names, Prev: Comments, Up: Top - -Clean Use of C Constructs -************************* - - Please explicitly declare all arguments to functions. Don't omit -them just because they are `int's. - - Declarations of external functions and functions to appear later in -the source file should all go in one place near the beginning of the -file (somewhere before the first function definition in the file), or -else should go in a header file. Don't put `extern' declarations inside -functions. - - It used to be common practice to use the same local variables (with -names like `tem') over and over for different values within one -function. Instead of doing this, it is better declare a separate local -variable for each distinct purpose, and give it a name which is -meaningful. This not only makes programs easier to understand, it also -facilitates optimization by good compilers. You can also move the -declaration of each local variable into the smallest scope that includes -all its uses. This makes the program even cleaner. - - Don't use local variables or parameters that shadow global -identifiers. - - Don't declare multiple variables in one declaration that spans lines. -Start a new declaration on each line, instead. For example, instead of -this: - - int foo, - bar; - -write either this: - - int foo, bar; - -or this: - - int foo; - int bar; - -(If they are global variables, each should have a comment preceding it -anyway.) - - When you have an `if'-`else' statement nested in another `if' -statement, always put braces around the `if'-`else'. Thus, never write -like this: - - if (foo) - if (bar) - win (); - else - lose (); - -always like this: - - if (foo) - { - if (bar) - win (); - else - lose (); - } - - If you have an `if' statement nested inside of an `else' statement, -either write `else if' on one line, like this, - - if (foo) - ... - else if (bar) - ... - -with its `then'-part indented like the preceding `then'-part, or write -the nested `if' within braces like this: - - if (foo) - ... - else - { - if (bar) - ... - } - - Don't declare both a structure tag and variables or typedefs in the -same declaration. Instead, declare the structure tag separately and -then use it to declare the variables or typedefs. - - Try to avoid assignments inside `if'-conditions. For example, don't -write this: - - if ((foo = (char *) malloc (sizeof *foo)) == 0) - fatal ("virtual memory exhausted"); - -instead, write this: - - foo = (char *) malloc (sizeof *foo); - if (foo == 0) - fatal ("virtual memory exhausted"); - - Don't make the program ugly to placate `lint'. Please don't insert -any casts to `void'. Zero without a cast is perfectly fine as a null -pointer constant. - - -File: standards.info, Node: Names, Next: Using Extensions, Prev: Syntactic Conventions, Up: Top - -Naming Variables and Functions -****************************** - - Please use underscores to separate words in a name, so that the Emacs -word commands can be useful within them. Stick to lower case; reserve -upper case for macros and `enum' constants, and for name-prefixes that -follow a uniform convention. - - For example, you should use names like `ignore_space_change_flag'; -don't use names like `iCantReadThis'. - - Variables that indicate whether command-line options have been -specified should be named after the meaning of the option, not after -the option-letter. A comment should state both the exact meaning of -the option and its letter. For example, - - /* Ignore changes in horizontal whitespace (-b). */ - int ignore_space_change_flag; - - When you want to define names with constant integer values, use -`enum' rather than `#define'. GDB knows about enumeration constants. - - Use file names of 14 characters or less, to avoid creating gratuitous -problems on System V. You can use the program `doschk' to test for -this. `doschk' also tests for potential name conflicts if the files -were loaded onto an MS-DOS file system--something you may or may not -care about. diff -urN binutils-2.7/etc/standards.info-2 binutils-2.8/etc/standards.info-2 --- binutils-2.7/etc/standards.info-2 Mon Jul 15 12:23:21 1996 +++ binutils-2.8/etc/standards.info-2 Wed Apr 30 13:15:34 1997 @@ -1,12 +1,12 @@ -This is Info file standards.info, produced by Makeinfo-1.55 from the +This is Info file standards.info, produced by Makeinfo-1.64 from the input file ./standards.texi. START-INFO-DIR-ENTRY * Standards: (standards). GNU coding standards. END-INFO-DIR-ENTRY - GNU Coding Standards Copyright (C) 1992, 1993, 1994 Free Software -Foundation + GNU Coding Standards Copyright (C) 1992, 1993, 1994, 1995, 1996 Free +Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -23,49 +23,248 @@ translation approved by the Free Software Foundation.  -File: standards.info, Node: Using Extensions, Next: System Functions, Prev: Names, Up: Top +File: standards.info, Node: Syntactic Conventions, Next: Names, Prev: Comments, Up: Writing C -Using Non-standard Features -*************************** +Clean Use of C Constructs +========================= - Many GNU facilities that already exist support a number of convenient -extensions over the comparable Unix facilities. Whether to use these -extensions in implementing your program is a difficult question. - - On the one hand, using the extensions can make a cleaner program. -On the other hand, people will not be able to build the program unless -the other GNU tools are available. This might cause the program to -work on fewer kinds of machines. - - With some extensions, it might be easy to provide both alternatives. -For example, you can define functions with a "keyword" `INLINE' and -define that as a macro to expand into either `inline' or nothing, -depending on the compiler. - - In general, perhaps it is best not to use the extensions if you can -straightforwardly do without them, but to use the extensions if they -are a big improvement. - - An exception to this rule are the large, established programs (such -as Emacs) which run on a great variety of systems. Such programs would -be broken by use of GNU extensions. - - Another exception is for programs that are used as part of -compilation: anything that must be compiled with other compilers in -order to bootstrap the GNU compilation facilities. If these require -the GNU compiler, then no one can compile them without having them -installed already. That would be no good. - - Since most computer systems do not yet implement ANSI C, using the -ANSI C features is effectively using a GNU extension, so the same -considerations apply. (Except for ANSI features that we discourage, -such as trigraphs--don't ever use them.) + Please explicitly declare all arguments to functions. Don't omit +them just because they are `int's. + + Declarations of external functions and functions to appear later in +the source file should all go in one place near the beginning of the +file (somewhere before the first function definition in the file), or +else should go in a header file. Don't put `extern' declarations inside +functions. + + It used to be common practice to use the same local variables (with +names like `tem') over and over for different values within one +function. Instead of doing this, it is better declare a separate local +variable for each distinct purpose, and give it a name which is +meaningful. This not only makes programs easier to understand, it also +facilitates optimization by good compilers. You can also move the +declaration of each local variable into the smallest scope that includes +all its uses. This makes the program even cleaner. + + Don't use local variables or parameters that shadow global +identifiers. + + Don't declare multiple variables in one declaration that spans lines. +Start a new declaration on each line, instead. For example, instead of +this: + + int foo, + bar; + +write either this: + + int foo, bar; + +or this: + + int foo; + int bar; + +(If they are global variables, each should have a comment preceding it +anyway.) + + When you have an `if'-`else' statement nested in another `if' +statement, always put braces around the `if'-`else'. Thus, never write +like this: + + if (foo) + if (bar) + win (); + else + lose (); + +always like this: + + if (foo) + { + if (bar) + win (); + else + lose (); + } + + If you have an `if' statement nested inside of an `else' statement, +either write `else if' on one line, like this, + + if (foo) + ... + else if (bar) + ... + +with its `then'-part indented like the preceding `then'-part, or write +the nested `if' within braces like this: + + if (foo) + ... + else + { + if (bar) + ... + } + + Don't declare both a structure tag and variables or typedefs in the +same declaration. Instead, declare the structure tag separately and +then use it to declare the variables or typedefs. + + Try to avoid assignments inside `if'-conditions. For example, don't +write this: + + if ((foo = (char *) malloc (sizeof *foo)) == 0) + fatal ("virtual memory exhausted"); + +instead, write this: + + foo = (char *) malloc (sizeof *foo); + if (foo == 0) + fatal ("virtual memory exhausted"); + + Don't make the program ugly to placate `lint'. Please don't insert +any casts to `void'. Zero without a cast is perfectly fine as a null +pointer constant, except when calling a varargs function. + + +File: standards.info, Node: Names, Next: System Portability, Prev: Syntactic Conventions, Up: Writing C + +Naming Variables and Functions +============================== + + The names of global variables and functions in a program serve as +comments of a sort. So don't choose terse names--instead, look for +names that give useful information about the meaning of the variable or +function. In a GNU program, names should be English, like other +comments. + + Local variable names can be shorter, because they are used only +within one context, where (presumably) comments explain their purpose. + + Please use underscores to separate words in a name, so that the Emacs +word commands can be useful within them. Stick to lower case; reserve +upper case for macros and `enum' constants, and for name-prefixes that +follow a uniform convention. + + For example, you should use names like `ignore_space_change_flag'; +don't use names like `iCantReadThis'. + + Variables that indicate whether command-line options have been +specified should be named after the meaning of the option, not after +the option-letter. A comment should state both the exact meaning of +the option and its letter. For example, + + /* Ignore changes in horizontal whitespace (-b). */ + int ignore_space_change_flag; + + When you want to define names with constant integer values, use +`enum' rather than `#define'. GDB knows about enumeration constants. + + Use file names of 14 characters or less, to avoid creating gratuitous +problems on older System V systems. You can use the program `doschk' +to test for this. `doschk' also tests for potential name conflicts if +the files were loaded onto an MS-DOS file system--something you may or +may not care about. + + +File: standards.info, Node: System Portability, Next: CPU Portability, Prev: Names, Up: Writing C + +Portability between System Types +================================ + + In the Unix world, "portability" refers to porting to different Unix +versions. For a GNU program, this kind of portability is desirable, but +not paramount. + + The primary purpose of GNU software is to run on top of the GNU +kernel, compiled with the GNU C compiler, on various types of CPU. The +amount and kinds of variation among GNU systems on different CPUs will +be comparable to the variation among Linux-based GNU systems or among +BSD systems today. So the kinds of portability that are absolutely +necessary are quite limited. + + But many users do run GNU software on non-GNU Unix or Unix-like +systems. So supporting a variety of Unix-like systems is desirable, +although not paramount. + + The easiest way to achieve portability to most Unix-like systems is +to use Autoconf. It's unlikely that your program needs to know more +information about the host platform than Autoconf can provide, simply +because most of the programs that need such knowledge have already been +written. + + Avoid using the format of semi-internal data bases (e.g., +directories) when there is a higher-level alternative (`readdir'). + + As for systems that are not like Unix, such as MSDOS, Windows, the +Macintosh, VMS, and MVS, supporting them is usually so much work that it +is better if you don't. + + The planned GNU kernel is not finished yet, but you can tell which +facilities it will provide by looking at the GNU C Library Manual. The +GNU kernel is based on Mach, so the features of Mach will also be +available. However, if you use Mach features, you'll probably have +trouble debugging your program today. + + +File: standards.info, Node: CPU Portability, Next: System Functions, Prev: System Portability, Up: Writing C + +Portability between CPUs +======================== + + Even GNU systems will differ because of differences among CPU +types--for example, difference in byte ordering and alignment +requirements. It is absolutely essential to handle these differences. +However, don't make any effort to cater to the possibility that an +`int' will be less than 32 bits. We don't support 16-bit machines in +GNU. + + Don't assume that the address of an `int' object is also the address +of its least-significant byte. This is false on big-endian machines. +Thus, don't make the following mistake: + + int c; + ... + while ((c = getchar()) != EOF) + write(file_descriptor, &c, 1); + + When calling functions, you need not worry about the difference +between pointers of various types, or between pointers and integers. +On most machines, there's no difference anyway. As for the few +machines where there is a difference, all of them support ANSI C, so +you can use prototypes (conditionalized to be active only in ANSI C) to +make the code work on those systems. + + In certain cases, it is ok to pass integer and pointer arguments +indiscriminately to the same function, and use no prototype on any +system. For example, many GNU programs have error-reporting functions +that pass their arguments along to `printf' and friends: + + error (s, a1, a2, a3) + char *s; + int a1, a2, a3; + { + fprintf (stderr, "error: "); + fprintf (stderr, s, a1, a2, a3); + } + +In practice, this works on all machines, and it is much simpler than any +"correct" alternative. Be sure *not* to use a prototype for such +functions. + + However, avoid casting pointers to integers unless you really need +to. These assumptions really reduce portability, and in most programs +they are easy to avoid. In the cases where casting pointers to +integers is essential--such as, a Lisp interpreter which stores type +information as well as an address in one word--it is ok to do so, but +you'll have to make explicit provisions to handle different word sizes.  -File: standards.info, Node: System Functions, Next: Semantics, Prev: Using Extensions, Up: Top +File: standards.info, Node: System Functions, Next: Internationalization, Prev: CPU Portability, Up: Writing C Calling System Functions -************************ +======================== C implementations differ substantially. ANSI C reduces but does not eliminate the incompatibilities; meanwhile, many users wish to compile @@ -76,6 +275,10 @@ * Don't use the value of `sprintf'. It returns the number of characters written on some systems, but not on all systems. + * `main' should be declared to return type `int'. It should + terminate either by calling `exit' or by returning the integer + status code; make sure it cannot ever return an undefined value. + * Don't declare system functions explicitly. Almost any declaration for a system function is wrong on some @@ -85,9 +288,9 @@ While it may seem unclean to use a function without declaring it, in practice this works fine for most system library functions on - the systems where this really happens. The problem is only - theoretical. By contrast, actual declarations have frequently - caused actual conflicts. + the systems where this really happens; thus, the disadvantage is + only theoretical. By contrast, actual declarations have + frequently caused actual conflicts. * If you must declare a system function, don't specify the argument types. Use an old-style declaration, not an ANSI prototype. The @@ -110,7 +313,7 @@ systems. * The string functions require special treatment. Some Unix systems - have a header file `string.h'; other have `strings.h'. Neither + have a header file `string.h'; others have `strings.h'. Neither file name is portable. There are two things you can do: use Autoconf to figure out which file to include, or don't include either file. @@ -120,11 +323,12 @@ usual way. That causes less of a problem than you might think. The newer ANSI - string functions are off-limits anyway because many systems still - don't support them. The string functions you can use are these: + string functions should be avoided anyway because many systems + still don't support them. The string functions you can use are + these: strcpy strncpy strcat strncat - strlen strcmp strncmp + strlen strcmp strncmp strchr strrchr The copy and concatenate functions work fine without a declaration @@ -146,12 +350,13 @@ neither pair works on all systems. You should pick a single pair of names and use it throughout your - program. (Nowadays, it is better to choose `strchr' and - `strrchr'.) Declare both of those names as functions returning - `char *'. On systems which don't support those names, define them - as macros in terms of the other pair. For example, here is what - to put at the beginning of your file (or in a header) if you want - to use the names `strchr' and `strrchr' throughout: + program. (Nowadays, it is better to choose `strchr' and `strrchr' + for new programs, since those are the standard ANSI names.) + Declare both of those names as functions returning `char *'. On + systems which don't support those names, define them as macros in + terms of the other pair. For example, here is what to put at the + beginning of your file (or in a header) if you want to use the + names `strchr' and `strrchr' throughout: #ifndef HAVE_STRCHR #define strchr index @@ -168,1295 +373,844 @@ get them properly defined is to use Autoconf.  -File: standards.info, Node: Semantics, Next: Errors, Prev: System Functions, Up: Top +File: standards.info, Node: Internationalization, Next: Mmap, Prev: System Functions, Up: Writing C -Program Behavior for All Programs -********************************* +Internationalization +==================== - Avoid arbitrary limits on the length or number of *any* data -structure, including filenames, lines, files, and symbols, by allocating -all data structures dynamically. In most Unix utilities, "long lines -are silently truncated". This is not acceptable in a GNU utility. - - Utilities reading files should not drop NUL characters, or any other -nonprinting characters *including those with codes above 0177*. The -only sensible exceptions would be utilities specifically intended for -interface to certain types of printers that can't handle those -characters. - - Check every system call for an error return, unless you know you -wish to ignore errors. Include the system error text (from `perror' or -equivalent) in *every* error message resulting from a failing system -call, as well as the name of the file if any and the name of the -utility. Just "cannot open foo.c" or "stat failed" is not sufficient. - - Check every call to `malloc' or `realloc' to see if it returned -zero. Check `realloc' even if you are making the block smaller; in a -system that rounds block sizes to a power of 2, `realloc' may get a -different block if you ask for less space. - - In Unix, `realloc' can destroy the storage block if it returns zero. -GNU `realloc' does not have this bug: if it fails, the original block -is unchanged. Feel free to assume the bug is fixed. If you wish to -run your program on Unix, and wish to avoid lossage in this case, you -can use the GNU `malloc'. - - You must expect `free' to alter the contents of the block that was -freed. Anything you want to fetch from the block, you must fetch before -calling `free'. - - Use `getopt_long' to decode arguments, unless the argument syntax -makes this unreasonable. - - When static storage is to be written in during program execution, use -explicit C code to initialize it. Reserve C initialized declarations -for data that will not be changed. - - Try to avoid low-level interfaces to obscure Unix data structures -(such as file directories, utmp, or the layout of kernel memory), since -these are less likely to work compatibly. If you need to find all the -files in a directory, use `readdir' or some other high-level interface. -These will be supported compatibly by GNU. - - By default, the GNU system will provide the signal handling -functions of BSD and of POSIX. So GNU software should be written to use -these. - - In error checks that detect "impossible" conditions, just abort. -There is usually no point in printing any message. These checks -indicate the existence of bugs. Whoever wants to fix the bugs will have -to read the source code and run a debugger. So explain the problem with -comments in the source. The relevant data will be in variables, which -are easy to examine with the debugger, so there is no point moving them -elsewhere. - - -File: standards.info, Node: Errors, Next: Libraries, Prev: Semantics, Up: Top + GNU has a library called GNU gettext that makes it easy to translate +the messages in a program into various languages. You should use this +library in every program. Use English for the messages as they appear +in the program, and let gettext provide the way to translate them into +other languages. -Formatting Error Messages -************************* + Using GNU gettext involves putting a call to the `gettext' macro +around each string that might need translation--like this: - Error messages from compilers should look like this: + printf (gettext ("Processing file `%s'...")); - SOURCE-FILE-NAME:LINENO: MESSAGE +This permits GNU gettext to replace the string `"Processing file +`%s'..."' with a translated version. - Error messages from other noninteractive programs should look like -this: + Once a program uses gettext, please make a point of writing calls to +`gettext' when you add new strings that call for translation. - PROGRAM:SOURCE-FILE-NAME:LINENO: MESSAGE + Using GNU gettext in a package involves specifying a "text domain +name" for the package. The text domain name is used to separate the +translations for this package from the translations for other packages. +Normally, the text domain name should be the same as the name of the +package--for example, `fileutils' for the GNU file utilities. -when there is an appropriate source file, or like this: + To enable gettext to work well, avoid writing code that makes +assumptions about the structure of words or sentences. When you want +the precise text of a sentence to vary depending on the data, use two or +more alternative string constants each containing a complete sentences, +rather than inserting conditionalized words or phrases into a single +sentence framework. - PROGRAM: MESSAGE + Here is an example of what not to do: -when there is no relevant source file. + printf ("%d file%s processed", nfiles, + nfiles != 1 ? "s" : ""); - In an interactive program (one that is reading commands from a -terminal), it is better not to include the program name in an error -message. The place to indicate which program is running is in the -prompt or with the screen layout. (When the same program runs with -input from a source other than a terminal, it is not interactive and -would do best to print error messages using the noninteractive style.) +The problem with that example is that it assumes that plurals are made +by adding `s'. If you apply gettext to the format string, like this, - The string MESSAGE should not begin with a capital letter when it -follows a program name and/or filename. Also, it should not end with a -period. + printf (gettext ("%d file%s processed"), nfiles, + nfiles != 1 ? "s" : ""); - Error messages from interactive programs, and other messages such as -usage messages, should start with a capital letter. But they should not -end with a period. +the message can use different words, but it will still be forced to use +`s' for the plural. Here is a better way: - -File: standards.info, Node: Libraries, Next: Portability, Prev: Errors, Up: Top + printf ((nfiles != 1 ? "%d files processed" + : "%d file processed"), + nfiles); -Library Behavior -**************** +This way, you can apply gettext to each of the two strings +independently: - Try to make library functions reentrant. If they need to do dynamic -storage allocation, at least try to avoid any nonreentrancy aside from -that of `malloc' itself. + printf ((nfiles != 1 ? gettext ("%d files processed") + : gettext ("%d file processed")), + nfiles); - Here are certain name conventions for libraries, to avoid name -conflicts. +This can any method of forming the plural of the word for "file", and +also handles languages that require agreement in the word for +"processed". - Choose a name prefix for the library, more than two characters long. -All external function and variable names should start with this prefix. -In addition, there should only be one of these in any given library -member. This usually means putting each one in a separate source file. + A similar problem appears at the level of sentence structure with +this code: - An exception can be made when two external symbols are always used -together, so that no reasonable program could use one without the -other; then they can both go in the same file. + printf ("# Implicit rule search has%s been done.\n", + f->tried_implicit ? "" : " not"); - External symbols that are not documented entry points for the user -should have names beginning with `_'. They should also contain the -chosen name prefix for the library, to prevent collisions with other -libraries. These can go in the same files with user entry points if -you like. +Adding `gettext' calls to this code cannot give correct results for all +languages, because negation in some languages requires adding words at +more than one place in the sentence. By contrast, adding `gettext' +calls does the job straightfowardly if the code starts out like this: - Static functions and variables can be used as you like and need not -fit any naming convention. + printf (f->tried_implicit + ? "# Implicit rule search has been done.\n", + : "# Implicit rule search has not been done.\n");  -File: standards.info, Node: Portability, Next: User Interfaces, Prev: Libraries, Up: Top +File: standards.info, Node: Mmap, Prev: Internationalization, Up: Writing C -Portability As It Applies to GNU -******************************** +Mmap +==== - Much of what is called "portability" in the Unix world refers to -porting to different Unix versions. This is a secondary consideration -for GNU software, because its primary purpose is to run on top of one -and only one kernel, the GNU kernel, compiled with one and only one C -compiler, the GNU C compiler. The amount and kinds of variation among -GNU systems on different cpu's will be like the variation among Berkeley -4.3 systems on different cpu's. + Don't assume that `mmap' either works on all files or fails for all +files. It may work on some files and fail on others. - All users today run GNU software on non-GNU systems. So supporting a -variety of non-GNU systems is desirable; simply not paramount. The -easiest way to achieve portability to a reasonable range of systems is -to use Autoconf. It's unlikely that your program needs to know more -information about the host machine than Autoconf can provide, simply -because most of the programs that need such knowledge have already been -written. - - It is difficult to be sure exactly what facilities the GNU kernel -will provide, since it isn't finished yet. Therefore, assume you can -use anything in 4.3; just avoid using the format of semi-internal data -bases (e.g., directories) when there is a higher-level alternative -(`readdir'). - - You can freely assume any reasonably standard facilities in the C -language, libraries or kernel, because we will find it necessary to -support these facilities in the full GNU system, whether or not we have -already done so. The fact that there may exist kernels or C compilers -that lack these facilities is irrelevant as long as the GNU kernel and -C compiler support them. - - It remains necessary to worry about differences among cpu types, such -as the difference in byte ordering and alignment restrictions. It's -unlikely that 16-bit machines will ever be supported by GNU, so there -is no point in spending any time to consider the possibility that an -int will be less than 32 bits. - - You can assume that all pointers have the same format, regardless of -the type they point to, and that this is really an integer. There are -some weird machines where this isn't true, but they aren't important; -don't waste time catering to them. Besides, eventually we will put -function prototypes into all GNU programs, and that will probably make -your program work even on weird machines. - - Since some important machines (including the 68000) are big-endian, -it is important not to assume that the address of an `int' object is -also the address of its least-significant byte. Thus, don't make the -following mistake: - - int c; - ... - while ((c = getchar()) != EOF) - write(file_descriptor, &c, 1); - - You can assume that it is reasonable to use a meg of memory. Don't -strain to reduce memory usage unless it can get to that level. If your -program creates complicated data structures, just make them in core and -give a fatal error if malloc returns zero. - - If a program works by lines and could be applied to arbitrary -user-supplied input files, it should keep only a line in memory, because -this is not very hard and users will want to be able to operate on input -files that are bigger than will fit in core all at once. + The proper way to use `mmap' is to try it on the specific file for +which you want to use it--and if `mmap' doesn't work, fall back on +doing the job in another way using `read' and `write'. + + The reason this precaution is needed is that the GNU kernel (the +HURD) provides a user-extensible file system, in which there can be many +different kinds of "ordinary files." Many of them support `mmap', but +some do not. It is important to make programs handle all these kinds +of files.  -File: standards.info, Node: User Interfaces, Next: Documentation, Prev: Portability, Up: Top - -Standards for Command Line Interfaces -************************************* - - Please don't make the behavior of a utility depend on the name used -to invoke it. It is useful sometimes to make a link to a utility with -a different name, and that should not change what it does. - - Instead, use a run time option or a compilation switch or both to -select among the alternate behaviors. - - Likewise, please don't make the behavior of the program depend on the -type of output device it is used with. Device independence is an -important principle of the system's design; do not compromise it merely -to save someone from typing an option now and then. - - If you think one behavior is most useful when the output is to a -terminal, and another is most useful when the output is a file or a -pipe, then it is usually best to make the default behavior the one that -is useful with output to a terminal, and have an option for the other -behavior. - - Compatibility requires certain programs to depend on the type of -output device. It would be disastrous if `ls' or `sh' did not do so in -the way all users expect. In some of these cases, we supplement the -program with a preferred alternate version that does not depend on the -output device type. For example, we provide a `dir' program much like -`ls' except that its default output format is always multi-column -format. - - It is a good idea to follow the POSIX guidelines for the -command-line options of a program. The easiest way to do this is to use -`getopt' to parse them. Note that the GNU version of `getopt' will -normally permit options anywhere among the arguments unless the special -argument `--' is used. This is not what POSIX specifies; it is a GNU -extension. - - Please define long-named options that are equivalent to the -single-letter Unix-style options. We hope to make GNU more user -friendly this way. This is easy to do with the GNU function -`getopt_long'. - - One of the advantages of long-named options is that they can be -consistent from program to program. For example, users should be able -to expect the "verbose" option of any GNU program which has one, to be -spelled precisely `--verbose'. To achieve this uniformity, look at the -table of common long-option names when you choose the option names for -your program. The table appears below. - - If you use names not already in the table, please send -`gnu@prep.ai.mit.edu' a list of them, with their meanings, so we can -update the table. - - It is usually a good idea for file names given as ordinary arguments -to be input files only; any output files would be specified using -options (preferably `-o'). Even if you allow an output file name as an -ordinary argument for compatibility, try to provide a suitable option -as well. This will lead to more consistency among GNU utilities, so -that there are fewer idiosyncracies for users to remember. - - Programs should support an option `--version' which prints the -program's version number on standard output and exits successfully, and -an option `--help' which prints option usage information on standard -output and exits successfully. These options should inhibit the normal -function of the command; they should do nothing except print the -requested information. - -`auto-check' - `-a' in `recode'. - -`auto-reference' - `-A' in `ptx'. - -`after-date' - `-N' in `tar'. - -`all' - `-a' in `du', `ls', `nm', `stty', `uname', and `unexpand'. - -`all-text' - `-a' in `diff'. - -`almost-all' - `-A' in `ls'. - -`append' - `-a' in `etags', `tee', `time'; `-r' in `tar'. - -`archive' - `-a' in `cp'. - -`arglength' - `-l' in `m4'. - -`ascii' - `-a' in `diff'. - -`assume-new' - `-W' in Make. - -`assume-old' - `-o' in Make. - -`backward-search' - `-B' in etags. - -`batch' - Used in GDB. - -`baud' - Used in GDB. - -`before' - `-b' in `tac'. - -`binary' - `-b' in `cpio' and `diff'. - -`block-size' - Used in `cpio' and `tar'. - -`blocks' - `-b' in `head' and `tail'. - -`break-file' - `-b' in `ptx'. - -`brief' - Used in various programs to make output shorter. - -`bytes' - `-c' in `head', `split', and `tail'. - -`c++' - `-C' in `etags'. - -`catenate' - `-A' in `tar'. - -`cd' - Used in various programs to specify the directory to use. - -`changes' - `-c' in `chgrp' and `chown'. - -`classify' - `-F' in `ls'. - -`colons' - `-c' in `recode'. - -`command' - `-c' in `su'; `-x' in GDB. - -`compare' - `-d' in `tar'. - -`compress' - `-Z' in `tar'. - -`concatenate' - `-A' in `tar'. - -`confirmation' - `-w' in `tar'. - -`context' - Used in `diff'. - -`copyright' - `-C' in `ptx' and `recode'. - -`core' - Used in GDB. - -`count' - `-q' in `who'. - -`count-links' - `-l' in `du'. - -`create' - Used in `tar' and `cpio'. - -`cxref' - `-x' in `etags'. - -`date' - `-d' in `touch'. - -`debug' - `-d' in Make and `m4'; `-t' in Bison. - -`define' - `-D' in `m4'. - -`defines' - `-d' in Bison and `etags'. - -`delete' - `-D' in `tar'. - -`dereference' - `-L' in `chgrp', `chown', `cpio', `du', `ls', and `tar'. - -`dereference-args' - `-D' in `du'. - -`diacritics' - `-d' in `recode'. - -`dictionary-order' - `-d' in `look'. - -`diff' - `-d' in `tar'. - -`digits' - `-n' in `csplit'. - -`directory' - Specify the directory to use, in various programs. In `ls', it - means to show directories themselves rather than their contents. - In `rm' and `ln', it means to not treat links to directories - specially. - -`discard-all' - `-x' in `strip'. - -`discard-locals' - `-X' in `strip'. - -`diversions' - `-N' in `m4'. - -`dry-run' - `-n' in Make. - -`ed' - `-e' in `diff'. - -`elide-empty-files' - `-z' in `csplit'. - -`entire-new-file' - `-N' in `diff'. - -`environment-overrides' - `-e' in Make. - -`eof' - `-e' in `xargs'. - -`epoch' - Used in GDB. - -`error-limit' - Used in Makeinfo. - -`error-output' - `-o' in `m4'. - -`escape' - `-b' in `ls'. - -`exclude-from' - `-X' in `tar'. - -`exec' - Used in GDB. - -`exit' - `-x' in `xargs'. - -`expand-tabs' - `-t' in `diff'. - -`expression' - `-e' in `sed'. - -`extern-only' - `-g' in `nm'. - -`extract' - `-i' in `cpio'; `-x' in `tar'. - -`faces' - `-f' in `finger'. - -`fast' - `-f' in `su'. - -`file' - `-f' in `info', Make, `mt', and `tar'; `-n' in `sed'; `-r' in - `touch'. - -`file-prefix' - `-b' in Bison. - -`file-type' - `-F' in `ls'. - -`files-from' - `-T' in `tar'. - -`fill-column' - Used in Makeinfo. - -`flag-truncation' - `-F' in `ptx'. - -`fixed-output-files' - `-y' in Bison. - -`follow' - `-f' in `tail'. - -`footnote-style' - Used in Makeinfo. - -`force' - `-f' in `cp', `ln', `mv', and `rm'. - -`format' - Used in `ls', `time', and `ptx'. - -`forward-search' - `-F' in `etags'. - -`fullname' - Used in GDB. - -`gap-size' - `-g' in `ptx'. - -`get' - `-x' in `tar'. - -`graphic' - `-i' in `ul'. - -`graphics' - `-g' in `recode'. - -`group' - `-g' in `install'. +File: standards.info, Node: Documentation, Next: Managing Releases, Prev: Writing C, Up: Top -`gzip' - `-z' in `tar'. - -`hashsize' - `-H' in `m4'. - -`header' - `-h' in `objdump' and `recode' - -`heading' - `-H' in `who'. - -`help' - Used to ask for brief usage information. - -`hide-control-chars' - `-q' in `ls'. - -`idle' - `-u' in `who'. - -`ifdef' - `-D' in `diff'. - -`ignore' - `-I' in `ls'; `-x' in `recode'. - -`ignore-all-space' - `-w' in `diff'. - -`ignore-backups' - `-B' in `ls'. - -`ignore-blank-lines' - `-B' in `diff'. - -`ignore-case' - `-f' in `look' and `ptx'; `-i' in `diff'. - -`ignore-errors' - `-i' in Make. - -`ignore-file' - `-i' in `ptx'. - -`ignore-indentation' - `-S' in `etags'. - -`ignore-init-file' - `-f' in Oleo. - -`ignore-interrupts' - `-i' in `tee'. - -`ignore-matching-lines' - `-I' in `diff'. - -`ignore-space-change' - `-b' in `diff'. - -`ignore-zeros' - `-i' in `tar'. - -`include' - `-i' in `etags'; `-I' in `m4'. - -`include-dir' - `-I' in Make. - -`incremental' - `-G' in `tar'. - -`info' - `-i', `-l', and `-m' in Finger. - -`initial' - `-i' in `expand'. - -`initial-tab' - `-T' in `diff'. - -`inode' - `-i' in `ls'. - -`interactive' - `-i' in `cp', `ln', `mv', `rm'; `-e' in `m4'; `-p' in `xargs'; - `-w' in `tar'. - -`jobs' - `-j' in Make. - -`just-print' - `-n' in Make. - -`keep-going' - `-k' in Make. - -`keep-files' - `-k' in `csplit'. - -`kilobytes' - `-k' in `du' and `ls'. - -`line-bytes' - `-C' in `split'. - -`lines' - Used in `split', `head', and `tail'. - -`link' - `-l' in `cpio'. - -`list' - `-t' in `cpio'; `-l' in `recode'. - -`list' - `-t' in `tar'. - -`literal' - `-N' in `ls'. - -`load-average' - `-l' in Make. - -`login' - Used in `su'. - -`machine' - No listing of which programs already use this; someone should - check to see if any actually do and tell `gnu@prep.ai.mit.edu'. - -`macro-name' - `-M' in `ptx'. - -`mail' - `-m' in `hello' and `uname'. - -`make-directories' - `-d' in `cpio'. - -`makefile' - `-f' in Make. - -`mapped' - Used in GDB. - -`max-args' - `-n' in `xargs'. - -`max-chars' - `-n' in `xargs'. - -`max-lines' - `-l' in `xargs'. - -`max-load' - `-l' in Make. - -`max-procs' - `-P' in `xargs'. - -`mesg' - `-T' in `who'. - -`message' - `-T' in `who'. - -`minimal' - `-d' in `diff'. - -`mode' - `-m' in `install', `mkdir', and `mkfifo'. - -`modification-time' - `-m' in `tar'. - -`multi-volume' - `-M' in `tar'. - -`name-prefix' - `-a' in Bison. - -`new-file' - `-W' in Make. - -`no-builtin-rules' - `-r' in Make. - -`no-create' - `-c' in `touch'. - -`no-defines' - `-D' in `etags'. - -`no-dereference' - `-d' in `cp'. - -`no-keep-going' - `-S' in Make. - -`no-lines' - `-l' in Bison. - -`no-prof' - `-e' in `gprof'. - -`no-sort' - `-p' in `nm'. - -`no-split' - Used in Makeinfo. - -`no-static' - `-a' in `gprof'. - -`no-time' - `-E' in `gprof'. - -`no-validate' - Used in Makeinfo. - -`no-warn' - Used in various programs to inhibit warnings. - -`node' - `-n' in `info'. - -`nodename' - `-n' in `uname'. - -`nonmatching' - `-f' in `cpio'. - -`nstuff' - `-n' in `objdump'. - -`null' - `-0' in `xargs'. - -`number' - `-n' in `cat'. - -`number-nonblank' - `-b' in `cat'. - -`numeric-sort' - `-n' in `nm'. - -`numeric-uid-gid' - `-n' in `cpio' and `ls'. - -`nx' - Used in GDB. - -`old-archive' - `-o' in `tar'. - -`old-file' - `-o' in Make. - -`one-file-system' - `-l' in `tar', `cp', and `du'. - -`only-file' - `-o' in `ptx'. - -`only-prof' - `-f' in `gprof'. - -`only-time' - `-F' in `gprof'. - -`output' - In various programs, specify the output file name. - -`override' - `-o' in `rm'. - -`owner' - `-o' in `install'. - -`paginate' - `-l' in `diff'. - -`paragraph-indent' - Used in Makeinfo. - -`parents' - `-p' in `mkdir' and `rmdir'. - -`pass-all' - `-p' in `ul'. - -`pass-through' - `-p' in `cpio'. - -`port' - `-P' in `finger'. - -`portability' - `-c' in `cpio' and `tar'. +Documenting Programs +******************** -`prefix-builtins' - `-P' in `m4'. +* Menu: -`prefix' - `-f' in `csplit'. +* GNU Manuals:: Writing proper manuals. +* Manual Structure Details:: Specific structure conventions. +* NEWS File:: NEWS files supplement manuals. +* Change Logs:: Recording Changes +* Man Pages:: Man pages are secondary. +* Reading other Manuals:: How far you can go in learning + from other manuals. -`preserve' - Used in `tar' and `cp'. + +File: standards.info, Node: GNU Manuals, Next: Manual Structure Details, Up: Documentation -`preserve-environment' - `-p' in `su'. +GNU Manuals +=========== -`preserve-modification-time' - `-m' in `cpio'. + The preferred way to document part of the GNU system is to write a +manual in the Texinfo formatting language. See the Texinfo manual, +either the hardcopy, or the on-line version available through `info' or +the Emacs Info subsystem (`C-h i'). + + Programmers often find it most natural to structure the documentation +following the structure of the implementation, which they know. But +this structure is not necessarily good for explaining how to use the +program; it may be irrelevant and confusing for a user. + + At every level, from the sentences in a paragraph to the grouping of +topics into separate manuals, the right way to structure documentation +is according to the concepts and questions that a user will have in mind +when reading it. Sometimes this structure of ideas matches the +structure of the implementation of the software being documented--but +often they are different. Often the most important part of learning to +write good documentation is learning to notice when you are structuring +the documentation like the implementation, and think about better +alternatives. + + For example, each program in the GNU system probably ought to be +documented in one manual; but this does not mean each program should +have its own manual. That would be following the structure of the +implementation, rather than the structure that helps the user +understand. + + Instead, each manual should cover a coherent *topic*. For example, +instead of a manual for `diff' and a manual for `diff3', we have one +manual for "comparison of files" which covers both of those programs, +as well as `cmp'. By documenting these programs together, we can make +the whole subject clearer. + + The manual which discusses a program should document all of the +program's command-line options and all of its commands. It should give +examples of their use. But don't organize the manual as a list of +features. Instead, organize it logically, by subtopics. Address the +questions that a user will ask when thinking about the job that the +program does. + + In general, a GNU manual should serve both as tutorial and reference. +It should be set up for convenient access to each topic through Info, +and for reading straight through (appendixes aside). A GNU manual +should give a good introduction to a beginner reading through from the +start, and should also provide all the details that hackers want. + + That is not as hard as it first sounds. Arrange each chapter as a +logical breakdown of its topic, but order the sections, and write their +text, so that reading the chapter straight through makes sense. Do +likewise when structuring the book into chapters, and when structuring a +section into paragraphs. The watchword is, *at each point, address the +most fundamental and important issue raised by the preceding text.* + + If necessary, add extra chapters at the beginning of the manual which +are purely tutorial and cover the basics of the subject. These provide +the framework for a beginner to understand the rest of the manual. The +Bison manual provides a good example of how to do this. + + Don't use Unix man pages as a model for how to write GNU +documentation; most of them are terse, badly structured, and give +inadequate explanation of the underlying concepts. (There are, of +course exceptions.) Also Unix man pages use a particular format which +is different from what we use in GNU manuals. -`preserve-order' - `-s' in `tar'. + Please do not use the term "pathname" that is used in Unix +documentation; use "file name" (two words) instead. We use the term +"path" only for search paths, which are lists of file names. -`preserve-permissions' - `-p' in `tar'. + Please do not use the term "illegal" to refer to erroneous input to a +computer program. Please use "invalid" for this, and reserve the term +"illegal" for violations of law. -`print' - `-l' in `diff'. + +File: standards.info, Node: Manual Structure Details, Next: NEWS File, Prev: GNU Manuals, Up: Documentation -`print-chars' - `-L' in `cmp'. +Manual Structure Details +======================== -`print-data-base' - `-p' in Make. + The title page of the manual should state the version of the +programs or packages documented in the manual. The Top node of the +manual should also contain this information. If the manual is changing +more frequently than or independent of the program, also state a version +number for the manual in both of these places. + + Each program documented in the manual should should have a node named +`PROGRAM Invocation' or `Invoking PROGRAM'. This node (together with +its subnodes, if any) should describe the program's command line +arguments and how to run it (the sort of information people would look +in a man page for). Start with an `@example' containing a template for +all the options and arguments that the program uses. -`print-directory' - `-w' in Make. + Alternatively, put a menu item in some menu whose item name fits one +of the above patterns. This identifies the node which that item points +to as the node for this purpose, regardless of the node's actual name. -`print-file-name' - `-o' in `nm'. + There will be automatic features for specifying a program name and +quickly reading just this part of its manual. -`print-symdefs' - `-s' in `nm'. + If one manual describes several programs, it should have such a node +for each program described. -`question' - `-q' in Make. + +File: standards.info, Node: NEWS File, Next: Change Logs, Prev: Manual Structure Details, Up: Documentation -`quiet' - Used in many programs to inhibit the usual output. *Note:* every - program accepting `--quiet' should accept `--silent' as a synonym. +The NEWS File +============= -`quote-name' - `-Q' in `ls'. + In addition to its manual, the package should have a file named +`NEWS' which contains a list of user-visible changes worth mentioning. +In each new release, add items to the front of the file and identify +the version they pertain to. Don't discard old items; leave them in +the file after the newer items. This way, a user upgrading from any +previous version can see what is new. -`rcs' - `-n' in `diff'. + If the `NEWS' file gets very long, move some of the older items into +a file named `ONEWS' and put a note at the end referring the user to +that file. -`read-full-blocks' - `-B' in `tar'. + +File: standards.info, Node: Change Logs, Next: Man Pages, Prev: NEWS File, Up: Documentation -`readnow' - Used in GDB. +Change Logs +=========== -`recon' - `-n' in Make. + Keep a change log to describe all the changes made to program source +files. The purpose of this is so that people investigating bugs in the +future will know about the changes that might have introduced the bug. +Often a new bug can be found by looking at what was recently changed. +More importantly, change logs can help you eliminate conceptual +inconsistencies between different parts of a program, by giving you a +history of how the conflicting concepts arose and who they came from. + +* Menu: + +* Change Log Concepts:: +* Style of Change Logs:: +* Simple Changes:: +* Conditional Changes:: -`record-number' - `-R' in `tar'. + +File: standards.info, Node: Change Log Concepts, Next: Style of Change Logs, Up: Change Logs -`recursive' - Used in `chgrp', `chown', `cp', `ls', `diff', and `rm'. +Change Log Concepts +------------------- -`reference-limit' - Used in Makeinfo. + You can think of the change log as a conceptual "undo list" which +explains how earlier versions were different from the current version. +People can see the current version; they don't need the change log to +tell them what is in it. What they want from a change log is a clear +explanation of how the earlier version differed. + + The change log file is normally called `ChangeLog' and covers an +entire directory. Each directory can have its own change log, or a +directory can use the change log of its parent directory-it's up to you. + + Another alternative is to record change log information with a +version control system such as RCS or CVS. This can be converted +automatically to a `ChangeLog' file. + + There's no need to describe the full purpose of the changes or how +they work together. If you think that a change calls for explanation, +you're probably right. Please do explain it--but please put the +explanation in comments in the code, where people will see it whenever +they see the code. For example, "New function" is enough for the +change log when you add a function, because there should be a comment +before the function definition to explain what it does. + + However, sometimes it is useful to write one line to describe the +overall purpose of a batch of changes. + + The easiest way to add an entry to `ChangeLog' is with the Emacs +command `M-x add-change-log-entry'. An entry should have an asterisk, +the name of the changed file, and then in parentheses the name of the +changed functions, variables or whatever, followed by a colon. Then +describe the changes you made to that function or variable. -`references' - `-r' in `ptx'. + +File: standards.info, Node: Style of Change Logs, Next: Simple Changes, Prev: Change Log Concepts, Up: Change Logs -`regex' - `-r' in `tac'. +Style of Change Logs +-------------------- -`release' - `-r' in `uname'. + Here are some examples of change log entries: -`relocation' - `-r' in `objdump'. + * register.el (insert-register): Return nil. + (jump-to-register): Likewise. + + * sort.el (sort-subr): Return nil. + + * tex-mode.el (tex-bibtex-file, tex-file, tex-region): + Restart the tex shell if process is gone or stopped. + (tex-shell-running): New function. + + * expr.c (store_one_arg): Round size up for move_block_to_reg. + (expand_call): Round up when emitting USE insns. + * stmt.c (assign_parms): Round size up for move_block_from_reg. + + It's important to name the changed function or variable in full. +Don't abbreviate function or variable names, and don't combine them. +Subsequent maintainers will often search for a function name to find all +the change log entries that pertain to it; if you abbreviate the name, +they won't find it when they search. + + For example, some people are tempted to abbreviate groups of function +names by writing `* register.el ({insert,jump-to}-register)'; this is +not a good idea, since searching for `jump-to-register' or +`insert-register' would not find that entry. + + Separate unrelated change log entries with blank lines. When two +entries represent parts of the same change, so that they work together, +then don't put blank lines between them. Then you can omit the file +name and the asterisk when successive entries are in the same file. -`rename' - `-r' in `cpio'. + +File: standards.info, Node: Simple Changes, Next: Conditional Changes, Prev: Style of Change Logs, Up: Change Logs -`replace' - `-i' in `xargs'. +Simple Changes +-------------- -`report-identical-files' - `-s' in `diff'. + Certain simple kinds of changes don't need much detail in the change +log. -`reset-access-time' - `-a' in `cpio'. + When you change the calling sequence of a function in a simple +fashion, and you change all the callers of the function, there is no +need to make individual entries for all the callers that you changed. +Just write in the entry for the function being called, "All callers +changed." + + * keyboard.c (Fcommand_execute): New arg SPECIAL. + All callers changed. + + When you change just comments or doc strings, it is enough to write +an entry for the file, without mentioning the functions. Just "Doc +fixes" is enough for the change log. + + There's no need to make change log entries for documentation files. +This is because documentation is not susceptible to bugs that are hard +to fix. Documentation does not consist of parts that must interact in a +precisely engineered fashion. To correct an error, you need not know +the history of the erroneous passage; it is enough to compare what the +documentation says with the way the program actually works. -`reverse' - `-r' in `ls' and `nm'. + +File: standards.info, Node: Conditional Changes, Prev: Simple Changes, Up: Change Logs -`reversed-ed' - `-f' in `diff'. +Conditional Changes +------------------- -`right-side-defs' - `-R' in `ptx'. + C programs often contain compile-time `#if' conditionals. Many +changes are conditional; sometimes you add a new definition which is +entirely contained in a conditional. It is very useful to indicate in +the change log the conditions for which the change applies. -`same-order' - `-s' in `tar'. + Our convention for indicating conditional changes is to use square +brackets around the name of the condition. -`same-permissions' - `-p' in `tar'. + Here is a simple example, describing a change which is conditional +but does not have a function or entity name associated with it: -`save' - `-g' in `stty'. + * xterm.c [SOLARIS2]: Include string.h. -`se' - Used in GDB. + Here is an entry describing a new definition which is entirely +conditional. This new definition for the macro `FRAME_WINDOW_P' is +used only when `HAVE_X_WINDOWS' is defined: -`sentence-regexp' - `-S' in `ptx'. + * frame.h [HAVE_X_WINDOWS] (FRAME_WINDOW_P): Macro defined. -`separate-dirs' - `-S' in `du'. + Here is an entry for a change within the function `init_display', +whose definition as a whole is unconditional, but the changes themselves +are contained in a `#ifdef HAVE_LIBNCURSES' conditional: -`separator' - `-s' in `tac'. + * dispnew.c (init_display) [HAVE_LIBNCURSES]: If X, call tgetent. -`sequence' - Used by `recode' to chose files or pipes for sequencing passes. + Here is an entry for a change that takes affect only when a certain +macro is *not* defined: -`shell' - `-s' in `su'. + (gethostname) [!HAVE_SOCKETS]: Replace with winsock version. -`show-all' - `-A' in `cat'. + +File: standards.info, Node: Man Pages, Next: Reading other Manuals, Prev: Change Logs, Up: Documentation -`show-c-function' - `-p' in `diff'. +Man Pages +========= -`show-ends' - `-E' in `cat'. + In the GNU project, man pages are secondary. It is not necessary or +expected for every GNU program to have a man page, but some of them do. +It's your choice whether to include a man page in your program. + + When you make this decision, consider that supporting a man page +requires continual effort each time the program is changed. The time +you spend on the man page is time taken away from more useful work. + + For a simple program which changes little, updating the man page may +be a small job. Then there is little reason not to include a man page, +if you have one. + + For a large program that changes a great deal, updating a man page +may be a substantial burden. If a user offers to donate a man page, +you may find this gift costly to accept. It may be better to refuse +the man page unless the same person agrees to take full responsibility +for maintaining it--so that you can wash your hands of it entirely. If +this volunteer later ceases to do the job, then don't feel obliged to +pick it up yourself; it may be better to withdraw the man page from the +distribution until someone else agrees to update it. + + When a program changes only a little, you may feel that the +discrepancies are small enough that the man page remains useful without +updating. If so, put a prominent note near the beginning of the man +page explaining that you don't maintain it and that the Texinfo manual +is more authoritative. The note should say how to access the Texinfo +documentation. -`show-function-line' - `-F' in `diff'. + +File: standards.info, Node: Reading other Manuals, Prev: Man Pages, Up: Documentation -`show-tabs' - `-T' in `cat'. +Reading other Manuals +===================== -`silent' - Used in many programs to inhibit the usual output. *Note:* every - program accepting `--silent' should accept `--quiet' as a synonym. + There may be non-free books or documentation files that describe the +program you are documenting. -`size' - `-s' in `ls'. + It is ok to use these documents for reference, just as the author of +a new algebra textbook can read other books on algebra. A large portion +of any non-fiction book consists of facts, in this case facts about how +a certain program works, and these facts are necessarily the same for +everyone who writes about the subject. But be careful not to copy your +outline structure, wording, tables or examples from preexisting non-free +documentation. Copying from free documentation may be ok; please check +with the FSF about the individual case. -`sort' - Used in `ls'. + +File: standards.info, Node: Managing Releases, Prev: Documentation, Up: Top -`sparse' - `-S' in `tar'. +The Release Process +******************* -`speed-large-files' - `-H' in `diff'. + Making a release is more than just bundling up your source files in a +tar file and putting it up for FTP. You should set up your software so +that it can be configured to run on a variety of systems. Your Makefile +should conform to the GNU standards described below, and your directory +layout should also conform to the standards discussed below. Doing so +makes it easy to include your package into the larger framework of all +GNU software. + +* Menu: + +* Configuration:: How Configuration Should Work +* Makefile Conventions:: Makefile Conventions +* Releases:: Making Releases -`squeeze-blank' - `-s' in `cat'. + +File: standards.info, Node: Configuration, Next: Makefile Conventions, Up: Managing Releases -`starting-file' - Used in `tar' and `diff' to specify which file within a directory - to start processing with. +How Configuration Should Work +============================= -`stop' - `-S' in Make. + Each GNU distribution should come with a shell script named +`configure'. This script is given arguments which describe the kind of +machine and system you want to compile the program for. + + The `configure' script must record the configuration options so that +they affect compilation. + + One way to do this is to make a link from a standard name such as +`config.h' to the proper configuration file for the chosen system. If +you use this technique, the distribution should *not* contain a file +named `config.h'. This is so that people won't be able to build the +program without configuring it first. + + Another thing that `configure' can do is to edit the Makefile. If +you do this, the distribution should *not* contain a file named +`Makefile'. Instead, it should include a file `Makefile.in' which +contains the input used for editing. Once again, this is so that people +won't be able to build the program without configuring it first. + + If `configure' does write the `Makefile', then `Makefile' should +have a target named `Makefile' which causes `configure' to be rerun, +setting up the same configuration that was set up last time. The files +that `configure' reads should be listed as dependencies of `Makefile'. + + All the files which are output from the `configure' script should +have comments at the beginning explaining that they were generated +automatically using `configure'. This is so that users won't think of +trying to edit them by hand. + + The `configure' script should write a file named `config.status' +which describes which configuration options were specified when the +program was last configured. This file should be a shell script which, +if run, will recreate the same configuration. + + The `configure' script should accept an option of the form +`--srcdir=DIRNAME' to specify the directory where sources are found (if +it is not the current directory). This makes it possible to build the +program in a separate directory, so that the actual source directory is +not modified. + + If the user does not specify `--srcdir', then `configure' should +check both `.' and `..' to see if it can find the sources. If it finds +the sources in one of these places, it should use them from there. +Otherwise, it should report that it cannot find the sources, and should +exit with nonzero status. + + Usually the easy way to support `--srcdir' is by editing a +definition of `VPATH' into the Makefile. Some rules may need to refer +explicitly to the specified source directory. To make this possible, +`configure' can add to the Makefile a variable named `srcdir' whose +value is precisely the specified directory. + + The `configure' script should also take an argument which specifies +the type of system to build the program for. This argument should look +like this: + + CPU-COMPANY-SYSTEM + + For example, a Sun 3 might be `m68k-sun-sunos4.1'. + + The `configure' script needs to be able to decode all plausible +alternatives for how to describe a machine. Thus, `sun3-sunos4.1' +would be a valid alias. For many programs, `vax-dec-ultrix' would be +an alias for `vax-dec-bsd', simply because the differences between +Ultrix and BSD are rarely noticeable, but a few programs might need to +distinguish them. + + There is a shell script called `config.sub' that you can use as a +subroutine to validate system types and canonicalize aliases. + + Other options are permitted to specify in more detail the software +or hardware present on the machine, and include or exclude optional +parts of the package: + +`--enable-FEATURE[=PARAMETER]' + Configure the package to build and install an optional user-level + facility called FEATURE. This allows users to choose which + optional features to include. Giving an optional PARAMETER of + `no' should omit FEATURE, if it is built by default. + + No `--enable' option should *ever* cause one feature to replace + another. No `--enable' option should ever substitute one useful + behavior for another useful behavior. The only proper use for + `--enable' is for questions of whether to build part of the program + or exclude it. + +`--with-PACKAGE' + The package PACKAGE will be installed, so configure this package + to work with PACKAGE. + + Possible values of PACKAGE include `x', `x-toolkit', `gnu-as' (or + `gas'), `gnu-ld', `gnu-libc', and `gdb'. + + Do not use a `--with' option to specify the file name to use to + find certain files. That is outside the scope of what `--with' + options are for. + +`--nfp' + The target machine has no floating point processor. + +`--gas' + The target machine assembler is GAS, the GNU assembler. This is + obsolete; users should use `--with-gnu-as' instead. + +`--x' + The target machine has the X Window System installed. This is + obsolete; users should use `--with-x' instead. + + All `configure' scripts should accept all of these "detail" options, +whether or not they make any difference to the particular package at +hand. In particular, they should accept any option that starts with +`--with-' or `--enable-'. This is so users will be able to configure +an entire GNU source tree at once with a single set of options. + + You will note that the categories `--with-' and `--enable-' are +narrow: they *do not* provide a place for any sort of option you might +think of. That is deliberate. We want to limit the possible +configuration options in GNU software. We do not want GNU programs to +have idiosyncratic configuration options. + + Packages that perform part of the compilation process may support +cross-compilation. In such a case, the host and target machines for +the program may be different. The `configure' script should normally +treat the specified type of system as both the host and the target, +thus producing a program which works for the same type of machine that +it runs on. + + The way to build a cross-compiler, cross-assembler, or what have +you, is to specify the option `--host=HOSTTYPE' when running +`configure'. This specifies the host system without changing the type +of target system. The syntax for HOSTTYPE is the same as described +above. + + Bootstrapping a cross-compiler requires compiling it on a machine +other than the host it will run on. Compilation packages accept a +configuration option `--build=HOSTTYPE' for specifying the +configuration on which you will compile them, in case that is different +from the host. + + Programs for which cross-operation is not meaningful need not accept +the `--host' option, because configuring an entire operating system for +cross-operation is not a meaningful thing. + + Some programs have ways of configuring themselves automatically. If +your program is set up to do this, your `configure' script can simply +ignore most of its arguments. -`strict' - `-s' in `recode'. + +File: standards.info, Node: Makefile Conventions, Next: Releases, Prev: Configuration, Up: Managing Releases -`strip' - `-s' in `install'. +Makefile Conventions +==================== -`strip-all' - `-s' in `strip'. + This node describes conventions for writing the Makefiles for GNU +programs. -`strip-debug' - `-S' in `strip'. +* Menu: + +* Makefile Basics:: General Conventions for Makefiles +* Utilities in Makefiles:: Utilities in Makefiles +* Command Variables:: Variables for Specifying Commands +* Directory Variables:: Variables for Installation Directories +* Standard Targets:: Standard Targets for Users +* Install Command Categories:: Three categories of commands in the `install' + rule: normal, pre-install and post-install. -`suffix' - `-S' in `cp', `ln', `mv'. + +File: standards.info, Node: Makefile Basics, Next: Utilities in Makefiles, Up: Makefile Conventions -`suffix-format' - `-b' in `csplit'. +General Conventions for Makefiles +--------------------------------- -`sum' - `-s' in `gprof'. + Every Makefile should contain this line: -`summarize' - `-s' in `du'. + SHELL = /bin/sh -`symbolic' - `-s' in `ln'. +to avoid trouble on systems where the `SHELL' variable might be +inherited from the environment. (This is never a problem with GNU +`make'.) -`symbols' - Used in GDB and `objdump'. + Different `make' programs have incompatible suffix lists and +implicit rules, and this sometimes creates confusion or misbehavior. So +it is a good idea to set the suffix list explicitly using only the +suffixes you need in the particular Makefile, like this: -`synclines' - `-s' in `m4'. + .SUFFIXES: + .SUFFIXES: .c .o -`sysname' - `-s' in `uname'. +The first line clears out the suffix list, the second introduces all +suffixes which may be subject to implicit rules in this Makefile. -`tabs' - `-t' in `expand' and `unexpand'. + Don't assume that `.' is in the path for command execution. When +you need to run programs that are a part of your package during the +make, please make sure that it uses `./' if the program is built as +part of the make or `$(srcdir)/' if the file is an unchanging part of +the source code. Without one of these prefixes, the current search +path is used. -`tabsize' - `-T' in `ls'. + The distinction between `./' (the "build directory") and +`$(srcdir)/' (the "source directory") is important because users can +build in a separate directory using the `--srcdir' option to +`configure'. A rule of the form: -`terminal' - `-T' in `tput' and `ul'. + foo.1 : foo.man sedscript + sed -e sedscript foo.man > foo.1 -`text' - `-a' in `diff'. +will fail when the build directory is not the source directory, because +`foo.man' and `sedscript' are in the the source directory. -`time' - Used in `ls' and `touch'. + When using GNU `make', relying on `VPATH' to find the source file +will work in the case where there is a single dependency file, since +the `make' automatic variable `$<' will represent the source file +wherever it is. (Many versions of `make' set `$<' only in implicit +rules.) A Makefile target like -`to-stdout' - `-O' in `tar'. + foo.o : bar.c + $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o -`total' - `-c' in `du'. +should instead be written as -`touch' - `-t' in Make, `ranlib', and `recode'. + foo.o : bar.c + $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@ -`trace' - `-t' in `m4'. +in order to allow `VPATH' to work correctly. When the target has +multiple dependencies, using an explicit `$(srcdir)' is the easiest way +to make the rule work well. For example, the target above for `foo.1' +is best written as: -`traditional' - `-t' in `hello'; `-G' in `m4' and `ptx'. + foo.1 : foo.man sedscript + sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@ -`tty' - Used in GDB. + GNU distributions usually contain some files which are not source +files--for example, Info files, and the output from Autoconf, Automake, +Bison or Flex. Since these files normally appear in the source +directory, they should always appear in the source directory, not in the +build directory. So Makefile rules to update them should put the +updated files in the source directory. -`typedefs' - `-t' in `etags'. + However, if a file does not appear in the distribution, then the +Makefile should not put it in the source directory, because building a +program in ordinary circumstances should not modify the source directory +in any way. -`typedefs-and-c++' - `-T' in `etags'. + Try to make the build and installation targets, at least (and all +their subtargets) work correctly with a parallel `make'. -`typeset-mode' - `-t' in `ptx'. + +File: standards.info, Node: Utilities in Makefiles, Next: Command Variables, Prev: Makefile Basics, Up: Makefile Conventions -`uncompress' - `-z' in `tar'. +Utilities in Makefiles +---------------------- -`unconditional' - `-u' in `cpio'. + Write the Makefile commands (and any shell scripts, such as +`configure') to run in `sh', not in `csh'. Don't use any special +features of `ksh' or `bash'. -`undefine' - `-U' in `m4'. + The `configure' script and the Makefile rules for building and +installation should not use any utilities directly except these: -`undefined-only' - `-u' in `nm'. + cat cmp cp diff echo egrep expr false grep install-info + ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch true -`update' - `-u' in `cp', `etags', `mv', `tar'. + The compression program `gzip' can be used in the `dist' rule. -`verbose' - Print more information about progress. Many programs support this. + Stick to the generally supported options for these programs. For +example, don't use `mkdir -p', convenient as it may be, because most +systems don't support it. -`verify' - `-W' in `tar'. + It is a good idea to avoid creating symbolic links in makefiles, +since a few systems don't support them. -`version' - Print the version number. + The Makefile rules for building and installation can also use +compilers and related programs, but should do so via `make' variables +so that the user can substitute alternatives. Here are some of the +programs we mean: -`version-control' - `-V' in `cp', `ln', `mv'. + ar bison cc flex install ld ldconfig lex + make makeinfo ranlib texi2dvi yacc -`vgrind' - `-v' in `etags'. + Use the following `make' variables to run those programs: -`volume' - `-V' in `tar'. + $(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX) + $(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC) -`what-if' - `-W' in Make. + When you use `ranlib' or `ldconfig', you should make sure nothing +bad happens if the system does not have the program in question. +Arrange to ignore an error from that command, and print a message before +the command to tell the user that failure of this command does not mean +a problem. (The Autoconf `AC_PROG_RANLIB' macro can help with this.) -`width' - `-w' in `ls' and `ptx'. + If you use symbolic links, you should implement a fallback for +systems that don't have symbolic links. -`word-regexp' - `-W' in `ptx'. + Additional utilities that can be used via Make variables are: -`writable' - `-T' in `who'. + chgrp chmod chown mknod -`zeros' - `-z' in `gprof'. + It is ok to use other utilities in Makefile portions (or scripts) +intended only for particular systems where you know those utilities +exist.  -File: standards.info, Node: Documentation, Next: Releases, Prev: User Interfaces, Up: Top - -Documenting Programs -******************** - - Please use Texinfo for documenting GNU programs. See the Texinfo -manual, either the hardcopy or the version in the GNU Emacs Info -subsystem (`C-h i'). See existing GNU Texinfo files (e.g., those under -the `man/' directory in the GNU Emacs distribution) for examples. - - The title page of the manual should state the version of the program -which the manual applies to. The Top node of the manual should also -contain this information. If the manual is changing more frequently -than or independent of the program, also state a version number for the -manual in both of these places. - - The manual should document all command-line arguments and all -commands. It should give examples of their use. But don't organize -the manual as a list of features. Instead, organize it by the concepts -a user will have before reaching that point in the manual. Address the -goals that a user will have in mind, and explain how to accomplish -them. Don't use Unix man pages as a model for how to write GNU -documentation; they are a bad example to follow. - - The manual should have a node named `PROGRAM Invocation' or -`Invoking PROGRAM', where PROGRAM stands for the name of the program -being described, as you would type it in the shell to run the program. -This node (together with its subnodes, if any) should describe the -program's command line arguments and how to run it (the sort of -information people would look in a man page for). Start with an -`@example' containing a template for all the options and arguments that -the program uses. - - Alternatively, put a menu item in some menu whose item name fits one -of the above patterns. This identifies the node which that item points -to as the node for this purpose, regardless of the node's actual name. +File: standards.info, Node: Command Variables, Next: Directory Variables, Prev: Utilities in Makefiles, Up: Makefile Conventions - There will be automatic features for specifying a program name and -quickly reading just this part of its manual. - - If one manual describes several programs, it should have such a node -for each program described. - - In addition to its manual, the package should have a file named -`NEWS' which contains a list of user-visible changes worth mentioning. -In each new release, add items to the front of the file and identify -the version they pertain to. Don't discard old items; leave them in -the file after the newer items. This way, a user upgrading from any -previous version can see what is new. - - If the `NEWS' file gets very long, move some of the older items into -a file named `ONEWS' and put a note at the end referring the user to -that file. - - Please do not use the term "pathname" that is used in Unix -documentation; use "file name" (two words) instead. We use the term -"path" only for search paths, which are lists of file names. +Variables for Specifying Commands +--------------------------------- - It is ok to supply a man page for the program as well as a Texinfo -manual if you wish to. But keep in mind that supporting a man page -requires continual effort, each time the program is changed. Any time -you spend on the man page is time taken away from more useful things you -could contribute. - - Thus, even if a user volunteers to donate a man page, you may find -this gift costly to accept. Unless you have time on your hands, it may -be better to refuse the man page unless the same volunteer agrees to -take full responsibility for maintaining it--so that you can wash your -hands of it entirely. If the volunteer ceases to do the job, then -don't feel obliged to pick it up yourself; it may be better to withdraw -the man page until another volunteer offers to carry on with it. - - Alternatively, if you expect the discrepancies to be small enough -that the man page remains useful, put a prominent note near the -beginning of the man page explaining that you don't maintain it and -that the Texinfo manual is more authoritative, and describing how to -access the Texinfo documentation. - - -File: standards.info, Node: Releases, Prev: Documentation, Up: Top - -Making Releases -*************** - - Package the distribution of Foo version 69.96 in a gzipped tar file -named `foo-69.96.tar.gz'. It should unpack into a subdirectory named -`foo-69.96'. - - Building and installing the program should never modify any of the -files contained in the distribution. This means that all the files -that form part of the program in any way must be classified into "source -files" and "non-source files". Source files are written by humans and -never changed automatically; non-source files are produced from source -files by programs under the control of the Makefile. - - Naturally, all the source files must be in the distribution. It is -okay to include non-source files in the distribution, provided they are -up-to-date and machine-independent, so that building the distribution -normally will never modify them. We commonly include non-source files -produced by Bison, Lex, TeX, and Makeinfo; this helps avoid unnecessary -dependencies between our distributions, so that users can install -whichever packages they want to install. - - Non-source files that might actually be modified by building and -installing the program should *never* be included in the distribution. -So if you do distribute non-source files, always make sure they are up -to date when you make a new distribution. - - Make sure that the directory into which the distribution unpacks (as -well as any subdirectories) are all world-writable (octal mode 777). -This is so that old versions of `tar' which preserve the ownership and -permissions of the files from the tar archive will be able to extract -all the files even if the user is unprivileged. - - Make sure that all the files in the distribution are world-readable. - - Make sure that no file name in the distribution is more than 14 -characters long. Likewise, no file created by building the program -should have a name longer than 14 characters. The reason for this is -that some systems adhere to a foolish interpretation of the POSIX -standard, and refuse to open a longer name, rather than truncating as -they did in the past. - - Don't include any symbolic links in the distribution itself. If the -tar file contains symbolic links, then people cannot even unpack it on -systems that don't support symbolic links. Also, don't use multiple -names for one file in different directories, because certain file -systems cannot handle this and that prevents unpacking the distribution. - - Try to make sure that all the file names will be unique on MS-DOG. A -name on MS-DOG consists of up to 8 characters, optionally followed by a -period and up to three characters. MS-DOG will truncate extra -characters both before and after the period. Thus, `foobarhacker.c' -and `foobarhacker.o' are not ambiguous; they are truncated to -`foobarha.c' and `foobarha.o', which are distinct. - - Include in your distribution a copy of the `texinfo.tex' you used to -test print any `*.texinfo' files. - - Likewise, if your program uses small GNU software packages like -regex, getopt, obstack, or termcap, include them in the distribution -file. Leaving them out would make the distribution file a little -smaller at the expense of possible inconvenience to a user who doesn't -know what other files to get. + Makefiles should provide variables for overriding certain commands, +options, and so on. + In particular, you should run most utility programs via variables. +Thus, if you use Bison, have a variable named `BISON' whose default +value is set with `BISON = bison', and refer to it with `$(BISON)' +whenever you need to use Bison. + + File management utilities such as `ln', `rm', `mv', and so on, need +not be referred to through variables in this way, since users don't +need to replace them with other programs. + + Each program-name variable should come with an options variable that +is used to supply options to the program. Append `FLAGS' to the +program-name variable name to get the options variable name--for +example, `BISONFLAGS'. (The name `CFLAGS' is an exception to this +rule, but we keep it because it is standard.) Use `CPPFLAGS' in any +compilation command that runs the preprocessor, and use `LDFLAGS' in +any compilation command that does linking as well as in any direct use +of `ld'. + + If there are C compiler options that *must* be used for proper +compilation of certain files, do not include them in `CFLAGS'. Users +expect to be able to specify `CFLAGS' freely themselves. Instead, +arrange to pass the necessary options to the C compiler independently +of `CFLAGS', by writing them explicitly in the compilation commands or +by defining an implicit rule, like this: + + CFLAGS = -g + ALL_CFLAGS = -I. $(CFLAGS) + .c.o: + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< + + Do include the `-g' option in `CFLAGS', because that is not +*required* for proper compilation. You can consider it a default that +is only recommended. If the package is set up so that it is compiled +with GCC by default, then you might as well include `-O' in the default +value of `CFLAGS' as well. + + Put `CFLAGS' last in the compilation command, after other variables +containing compiler options, so the user can use `CFLAGS' to override +the others. + + Every Makefile should define the variable `INSTALL', which is the +basic command for installing a file into the system. + + Every Makefile should also define the variables `INSTALL_PROGRAM' +and `INSTALL_DATA'. (The default for each of these should be +`$(INSTALL)'.) Then it should use those variables as the commands for +actual installation, for executables and nonexecutables respectively. +Use these variables as follows: + + $(INSTALL_PROGRAM) foo $(bindir)/foo + $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a + +Always use a file name, not a directory name, as the second argument of +the installation commands. Use a separate command for each file to be +installed. diff -urN binutils-2.7/etc/standards.info-3 binutils-2.8/etc/standards.info-3 --- binutils-2.7/etc/standards.info-3 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/etc/standards.info-3 Wed Apr 30 13:15:34 1997 @@ -0,0 +1,679 @@ +This is Info file standards.info, produced by Makeinfo-1.64 from the +input file ./standards.texi. + +START-INFO-DIR-ENTRY +* Standards: (standards). GNU coding standards. +END-INFO-DIR-ENTRY + + GNU Coding Standards Copyright (C) 1992, 1993, 1994, 1995, 1996 Free +Software Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, provided that +the entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions, except that this permission notice may be stated in a +translation approved by the Free Software Foundation. + + +File: standards.info, Node: Directory Variables, Next: Standard Targets, Prev: Command Variables, Up: Makefile Conventions + +Variables for Installation Directories +-------------------------------------- + + Installation directories should always be named by variables, so it +is easy to install in a nonstandard place. The standard names for these +variables are described below. They are based on a standard filesystem +layout; variants of it are used in SVR4, 4.4BSD, Linux, Ultrix v4, and +other modern operating systems. + + These two variables set the root for the installation. All the other +installation directories should be subdirectories of one of these two, +and nothing should be directly installed into these two directories. + +`prefix' + A prefix used in constructing the default values of the variables + listed below. The default value of `prefix' should be + `/usr/local'. When building the complete GNU system, the prefix + will be empty and `/usr' will be a symbolic link to `/'. (If you + are using Autoconf, write it as `@prefix@'.) + +`exec_prefix' + A prefix used in constructing the default values of some of the + variables listed below. The default value of `exec_prefix' should + be `$(prefix)'. (If you are using Autoconf, write it as + `@exec_prefix@'.) + + Generally, `$(exec_prefix)' is used for directories that contain + machine-specific files (such as executables and subroutine + libraries), while `$(prefix)' is used directly for other + directories. + + Executable programs are installed in one of the following +directories. + +`bindir' + The directory for installing executable programs that users can + run. This should normally be `/usr/local/bin', but write it as + `$(exec_prefix)/bin'. (If you are using Autoconf, write it as + `@bindir@'.) + +`sbindir' + The directory for installing executable programs that can be run + from the shell, but are only generally useful to system + administrators. This should normally be `/usr/local/sbin', but + write it as `$(exec_prefix)/sbin'. (If you are using Autoconf, + write it as `@sbindir@'.) + +`libexecdir' + The directory for installing executable programs to be run by other + programs rather than by users. This directory should normally be + `/usr/local/libexec', but write it as `$(exec_prefix)/libexec'. + (If you are using Autoconf, write it as `@libexecdir@'.) + + Data files used by the program during its execution are divided into +categories in two ways. + + * Some files are normally modified by programs; others are never + normally modified (though users may edit some of these). + + * Some files are architecture-independent and can be shared by all + machines at a site; some are architecture-dependent and can be + shared only by machines of the same kind and operating system; + others may never be shared between two machines. + + This makes for six different possibilities. However, we want to +discourage the use of architecture-dependent files, aside from object +files and libraries. It is much cleaner to make other data files +architecture-independent, and it is generally not hard. + + Therefore, here are the variables Makefiles should use to specify +directories: + +`datadir' + The directory for installing read-only architecture independent + data files. This should normally be `/usr/local/share', but write + it as `$(prefix)/share'. (If you are using Autoconf, write it as + `@datadir@'.) As a special exception, see `$(infodir)' and + `$(includedir)' below. + +`sysconfdir' + The directory for installing read-only data files that pertain to a + single machine-that is to say, files for configuring a host. + Mailer and network configuration files, `/etc/passwd', and so + forth belong here. All the files in this directory should be + ordinary ASCII text files. This directory should normally be + `/usr/local/etc', but write it as `$(prefix)/etc'. (If you are + using Autoconf, write it as `@sysconfdir@'.) + + Do not install executables in this directory (they probably belong + in `$(libexecdir)' or `$(sbindir)'). Also do not install files + that are modified in the normal course of their use (programs + whose purpose is to change the configuration of the system + excluded). Those probably belong in `$(localstatedir)'. + +`sharedstatedir' + The directory for installing architecture-independent data files + which the programs modify while they run. This should normally be + `/usr/local/com', but write it as `$(prefix)/com'. (If you are + using Autoconf, write it as `@sharedstatedir@'.) + +`localstatedir' + The directory for installing data files which the programs modify + while they run, and that pertain to one specific machine. Users + should never need to modify files in this directory to configure + the package's operation; put such configuration information in + separate files that go in `$(datadir)' or `$(sysconfdir)'. + `$(localstatedir)' should normally be `/usr/local/var', but write + it as `$(prefix)/var'. (If you are using Autoconf, write it as + `@localstatedir@'.) + +`libdir' + The directory for object files and libraries of object code. Do + not install executables here, they probably ought to go in + `$(libexecdir)' instead. The value of `libdir' should normally be + `/usr/local/lib', but write it as `$(exec_prefix)/lib'. (If you + are using Autoconf, write it as `@libdir@'.) + +`infodir' + The directory for installing the Info files for this package. By + default, it should be `/usr/local/info', but it should be written + as `$(prefix)/info'. (If you are using Autoconf, write it as + `@infodir@'.) + +`lispdir' + The directory for installing any Emacs Lisp files in this package. + By default, it should be `/usr/local/share/emacs/site-lisp', but + it should be written as `$(prefix)/share/emacs/site-lisp'. + + If you are using Autoconf, write the default as `@lispdir@'. In + order to make `@lispdir@' work, you need the following lines in + your `configure.in' file: + + lispdir='${datadir}/emacs/site-lisp' + AC_SUBST(lispdir) + +`includedir' + The directory for installing header files to be included by user + programs with the C `#include' preprocessor directive. This + should normally be `/usr/local/include', but write it as + `$(prefix)/include'. (If you are using Autoconf, write it as + `@includedir@'.) + + Most compilers other than GCC do not look for header files in + `/usr/local/include'. So installing the header files this way is + only useful with GCC. Sometimes this is not a problem because some + libraries are only really intended to work with GCC. But some + libraries are intended to work with other compilers. They should + install their header files in two places, one specified by + `includedir' and one specified by `oldincludedir'. + +`oldincludedir' + The directory for installing `#include' header files for use with + compilers other than GCC. This should normally be `/usr/include'. + (If you are using Autoconf, you can write it as `@oldincludedir@'.) + + The Makefile commands should check whether the value of + `oldincludedir' is empty. If it is, they should not try to use + it; they should cancel the second installation of the header files. + + A package should not replace an existing header in this directory + unless the header came from the same package. Thus, if your Foo + package provides a header file `foo.h', then it should install the + header file in the `oldincludedir' directory if either (1) there + is no `foo.h' there or (2) the `foo.h' that exists came from the + Foo package. + + To tell whether `foo.h' came from the Foo package, put a magic + string in the file--part of a comment--and `grep' for that string. + + Unix-style man pages are installed in one of the following: + +`mandir' + The top-level directory for installing the man pages (if any) for + this package. It will normally be `/usr/local/man', but you should + write it as `$(prefix)/man'. (If you are using Autoconf, write it + as `@mandir@'.) + +`man1dir' + The directory for installing section 1 man pages. Write it as + `$(mandir)/man1'. + +`man2dir' + The directory for installing section 2 man pages. Write it as + `$(mandir)/man2' + +`...' + *Don't make the primary documentation for any GNU software be a + man page. Write a manual in Texinfo instead. Man pages are just + for the sake of people running GNU software on Unix, which is a + secondary application only.* + +`manext' + The file name extension for the installed man page. This should + contain a period followed by the appropriate digit; it should + normally be `.1'. + +`man1ext' + The file name extension for installed section 1 man pages. + +`man2ext' + The file name extension for installed section 2 man pages. + +`...' + Use these names instead of `manext' if the package needs to + install man pages in more than one section of the manual. + + And finally, you should set the following variable: + +`srcdir' + The directory for the sources being compiled. The value of this + variable is normally inserted by the `configure' shell script. + (If you are using Autconf, use `srcdir = @srcdir@'.) + + For example: + + # Common prefix for installation directories. + # NOTE: This directory must exist when you start the install. + prefix = /usr/local + exec_prefix = $(prefix) + # Where to put the executable for the command `gcc'. + bindir = $(exec_prefix)/bin + # Where to put the directories used by the compiler. + libexecdir = $(exec_prefix)/libexec + # Where to put the Info files. + infodir = $(prefix)/info + + If your program installs a large number of files into one of the +standard user-specified directories, it might be useful to group them +into a subdirectory particular to that program. If you do this, you +should write the `install' rule to create these subdirectories. + + Do not expect the user to include the subdirectory name in the value +of any of the variables listed above. The idea of having a uniform set +of variable names for installation directories is to enable the user to +specify the exact same values for several different GNU packages. In +order for this to be useful, all the packages must be designed so that +they will work sensibly when the user does so. + + +File: standards.info, Node: Standard Targets, Next: Install Command Categories, Prev: Directory Variables, Up: Makefile Conventions + +Standard Targets for Users +-------------------------- + + All GNU programs should have the following targets in their +Makefiles: + +`all' + Compile the entire program. This should be the default target. + This target need not rebuild any documentation files; Info files + should normally be included in the distribution, and DVI files + should be made only when explicitly asked for. + + By default, the Make rules should compile and link with `-g', so + that executable programs have debugging symbols. Users who don't + mind being helpless can strip the executables later if they wish. + +`install' + Compile the program and copy the executables, libraries, and so on + to the file names where they should reside for actual use. If + there is a simple test to verify that a program is properly + installed, this target should run that test. + + Do not strip executables when installing them. Devil-may-care + users can use the `install-strip' target to do that. + + If possible, write the `install' target rule so that it does not + modify anything in the directory where the program was built, + provided `make all' has just been done. This is convenient for + building the program under one user name and installing it under + another. + + The commands should create all the directories in which files are + to be installed, if they don't already exist. This includes the + directories specified as the values of the variables `prefix' and + `exec_prefix', as well as all subdirectories that are needed. One + way to do this is by means of an `installdirs' target as described + below. + + Use `-' before any command for installing a man page, so that + `make' will ignore any errors. This is in case there are systems + that don't have the Unix man page documentation system installed. + + The way to install Info files is to copy them into `$(infodir)' + with `$(INSTALL_DATA)' (*note Command Variables::.), and then run + the `install-info' program if it is present. `install-info' is a + program that edits the Info `dir' file to add or update the menu + entry for the given Info file; it is part of the Texinfo package. + Here is a sample rule to install an Info file: + + $(infodir)/foo.info: foo.info + $(POST_INSTALL) + # There may be a newer info file in . than in srcdir. + -if test -f foo.info; then d=.; \ + else d=$(srcdir); fi; \ + $(INSTALL_DATA) $$d/foo.info $@; \ + # Run install-info only if it exists. + # Use `if' instead of just prepending `-' to the + # line so we notice real errors from install-info. + # We use `$(SHELL) -c' because some shells do not + # fail gracefully when there is an unknown command. + if $(SHELL) -c 'install-info --version' \ + >/dev/null 2>&1; then \ + install-info --dir-file=$(infodir)/dir \ + $(infodir)/foo.info; \ + else true; fi + + When writing the `install' target, you must classify all the + commands into three categories: normal ones, "pre-installation" + commands and "post-installation" commands. *Note Install Command + Categories::. + +`uninstall' + Delete all the installed files--the copies that the `install' + target creates. + + This rule should not modify the directories where compilation is + done, only the directories where files are installed. + + The uninstallation commands are divided into three categories, + just like the installation commands. *Note Install Command + Categories::. + +`install-strip' + Like `install', but strip the executable files while installing + them. In many cases, the definition of this target can be very + simple: + + install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ + install + + Normally we do not recommend stripping an executable unless you + are sure the program has no bugs. However, it can be reasonable + to install a stripped executable for actual execution while saving + the unstripped executable elsewhere in case there is a bug. + +`clean' + Delete all files from the current directory that are normally + created by building the program. Don't delete the files that + record the configuration. Also preserve files that could be made + by building, but normally aren't because the distribution comes + with them. + + Delete `.dvi' files here if they are not part of the distribution. + +`distclean' + Delete all files from the current directory that are created by + configuring or building the program. If you have unpacked the + source and built the program without creating any other files, + `make distclean' should leave only the files that were in the + distribution. + +`mostlyclean' + Like `clean', but may refrain from deleting a few files that people + normally don't want to recompile. For example, the `mostlyclean' + target for GCC does not delete `libgcc.a', because recompiling it + is rarely necessary and takes a lot of time. + +`maintainer-clean' + Delete almost everything from the current directory that can be + reconstructed with this Makefile. This typically includes + everything deleted by `distclean', plus more: C source files + produced by Bison, tags tables, Info files, and so on. + + The reason we say "almost everything" is that running the command + `make maintainer-clean' should not delete `configure' even if + `configure' can be remade using a rule in the Makefile. More + generally, `make maintainer-clean' should not delete anything that + needs to exist in order to run `configure' and then begin to build + the program. This is the only exception; `maintainer-clean' should + delete everything else that can be rebuilt. + + The `maintainer-clean' target is intended to be used by a + maintainer of the package, not by ordinary users. You may need + special tools to reconstruct some of the files that `make + maintainer-clean' deletes. Since these files are normally + included in the distribution, we don't take care to make them easy + to reconstruct. If you find you need to unpack the full + distribution again, don't blame us. + + To help make users aware of this, the commands for the special + `maintainer-clean' target should start with these two: + + @echo 'This command is intended for maintainers to use; it' + @echo 'deletes files that may need special tools to rebuild.' + +`TAGS' + Update a tags table for this program. + +`info' + Generate any Info files needed. The best way to write the rules + is as follows: + + info: foo.info + + foo.info: foo.texi chap1.texi chap2.texi + $(MAKEINFO) $(srcdir)/foo.texi + + You must define the variable `MAKEINFO' in the Makefile. It should + run the `makeinfo' program, which is part of the Texinfo + distribution. + + Normally a GNU distribution comes with Info files, and that means + the Info files are present in the source directory. Therefore, + the Make rule for an info file should update it in the source + directory. When users build the package, ordinarily Make will not + update the Info files because they will already be up to date. + +`dvi' + Generate DVI files for all Texinfo documentation. For example: + + dvi: foo.dvi + + foo.dvi: foo.texi chap1.texi chap2.texi + $(TEXI2DVI) $(srcdir)/foo.texi + + You must define the variable `TEXI2DVI' in the Makefile. It should + run the program `texi2dvi', which is part of the Texinfo + distribution.(1) Alternatively, write just the dependencies, and + allow GNU `make' to provide the command. + +`dist' + Create a distribution tar file for this program. The tar file + should be set up so that the file names in the tar file start with + a subdirectory name which is the name of the package it is a + distribution for. This name can include the version number. + + For example, the distribution tar file of GCC version 1.40 unpacks + into a subdirectory named `gcc-1.40'. + + The easiest way to do this is to create a subdirectory + appropriately named, use `ln' or `cp' to install the proper files + in it, and then `tar' that subdirectory. + + Compress the tar file file with `gzip'. For example, the actual + distribution file for GCC version 1.40 is called `gcc-1.40.tar.gz'. + + The `dist' target should explicitly depend on all non-source files + that are in the distribution, to make sure they are up to date in + the distribution. *Note Making Releases: Releases. + +`check' + Perform self-tests (if any). The user must build the program + before running the tests, but need not install the program; you + should write the self-tests so that they work when the program is + built but not installed. + + The following targets are suggested as conventional names, for +programs in which they are useful. + +`installcheck' + Perform installation tests (if any). The user must build and + install the program before running the tests. You should not + assume that `$(bindir)' is in the search path. + +`installdirs' + It's useful to add a target named `installdirs' to create the + directories where files are installed, and their parent + directories. There is a script called `mkinstalldirs' which is + convenient for this; you can find it in the Texinfo package. You + can use a rule like this: + + # Make sure all installation directories (e.g. $(bindir)) + # actually exist by making them if necessary. + installdirs: mkinstalldirs + $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ + $(libdir) $(infodir) \ + $(mandir) + + This rule should not modify the directories where compilation is + done. It should do nothing but create installation directories. + + ---------- Footnotes ---------- + + (1) `texi2dvi' uses TeX to do the real work of formatting. TeX is +not distributed with Texinfo. + + +File: standards.info, Node: Install Command Categories, Prev: Standard Targets, Up: Makefile Conventions + +Install Command Categories +-------------------------- + + When writing the `install' target, you must classify all the +commands into three categories: normal ones, "pre-installation" +commands and "post-installation" commands. + + Normal commands move files into their proper places, and set their +modes. They may not alter any files except the ones that come entirely +from the package they belong to. + + Pre-installation and post-installation commands may alter other +files; in particular, they can edit global configuration files or data +bases. + + Pre-installation commands are typically executed before the normal +commands, and post-installation commands are typically run after the +normal commands. + + The most common use for a post-installation command is to run +`install-info'. This cannot be done with a normal command, since it +alters a file (the Info directory) which does not come entirely and +solely from the package being installed. It is a post-installation +command because it needs to be done after the normal command which +installs the package's Info files. + + Most programs don't need any pre-installation commands, but we have +the feature just in case it is needed. + + To classify the commands in the `install' rule into these three +categories, insert "category lines" among them. A category line +specifies the category for the commands that follow. + + A category line consists of a tab and a reference to a special Make +variable, plus an optional comment at the end. There are three +variables you can use, one for each category; the variable name +specifies the category. Category lines are no-ops in ordinary execution +because these three Make variables are normally undefined (and you +*should not* define them in the makefile). + + Here are the three possible category lines, each with a comment that +explains what it means: + + $(PRE_INSTALL) # Pre-install commands follow. + $(POST_INSTALL) # Post-install commands follow. + $(NORMAL_INSTALL) # Normal commands follow. + + If you don't use a category line at the beginning of the `install' +rule, all the commands are classified as normal until the first category +line. If you don't use any category lines, all the commands are +classified as normal. + + These are the category lines for `uninstall': + + $(PRE_UNINSTALL) # Pre-uninstall commands follow. + $(POST_UNINSTALL) # Post-uninstall commands follow. + $(NORMAL_UNINSTALL) # Normal commands follow. + + Typically, a pre-uninstall command would be used for deleting entries +from the Info directory. + + If the `install' or `uninstall' target has any dependencies which +act as subroutines of installation, then you should start *each* +dependency's commands with a category line, and start the main target's +commands with a category line also. This way, you can ensure that each +command is placed in the right category regardless of which of the +dependencies actually run. + + Pre-installation and post-installation commands should not run any +programs except for these: + + [ basename bash cat chgrp chmod chown cmp cp dd diff echo + egrep expand expr false fgrep find getopt grep gunzip gzip + hostname install install-info kill ldconfig ln ls md5sum + mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee + test touch true uname xargs yes + + The reason for distinguishing the commands in this way is for the +sake of making binary packages. Typically a binary package contains +all the executables and other files that need to be installed, and has +its own method of installing them--so it does not need to run the normal +installation commands. But installing the binary package does need to +execute the pre-installation and post-installation commands. + + Programs to build binary packages work by extracting the +pre-installation and post-installation commands. Here is one way of +extracting the pre-installation commands: + + make -n install -o all \ + PRE_INSTALL=pre-install \ + POST_INSTALL=post-install \ + NORMAL_INSTALL=normal-install \ + | gawk -f pre-install.awk + +where the file `pre-install.awk' could contain this: + + $0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ {on = 0} + on {print $0} + $0 ~ /^\t[ \t]*pre_install[ \t]*$/ {on = 1} + + The resulting file of pre-installation commands is executed as a +shell script as part of installing the binary package. + + +File: standards.info, Node: Releases, Prev: Makefile Conventions, Up: Managing Releases + +Making Releases +=============== + + Package the distribution of Foo version 69.96 in a gzipped tar file +named `foo-69.96.tar.gz'. It should unpack into a subdirectory named +`foo-69.96'. + + Building and installing the program should never modify any of the +files contained in the distribution. This means that all the files +that form part of the program in any way must be classified into "source +files" and "non-source files". Source files are written by humans and +never changed automatically; non-source files are produced from source +files by programs under the control of the Makefile. + + Naturally, all the source files must be in the distribution. It is +okay to include non-source files in the distribution, provided they are +up-to-date and machine-independent, so that building the distribution +normally will never modify them. We commonly include non-source files +produced by Bison, `lex', TeX, and `makeinfo'; this helps avoid +unnecessary dependencies between our distributions, so that users can +install whichever packages they want to install. + + Non-source files that might actually be modified by building and +installing the program should *never* be included in the distribution. +So if you do distribute non-source files, always make sure they are up +to date when you make a new distribution. + + Make sure that the directory into which the distribution unpacks (as +well as any subdirectories) are all world-writable (octal mode 777). +This is so that old versions of `tar' which preserve the ownership and +permissions of the files from the tar archive will be able to extract +all the files even if the user is unprivileged. + + Make sure that all the files in the distribution are world-readable. + + Make sure that no file name in the distribution is more than 14 +characters long. Likewise, no file created by building the program +should have a name longer than 14 characters. The reason for this is +that some systems adhere to a foolish interpretation of the POSIX +standard, and refuse to open a longer name, rather than truncating as +they did in the past. + + Don't include any symbolic links in the distribution itself. If the +tar file contains symbolic links, then people cannot even unpack it on +systems that don't support symbolic links. Also, don't use multiple +names for one file in different directories, because certain file +systems cannot handle this and that prevents unpacking the distribution. + + Try to make sure that all the file names will be unique on MS-DOS. A +name on MS-DOS consists of up to 8 characters, optionally followed by a +period and up to three characters. MS-DOS will truncate extra +characters both before and after the period. Thus, `foobarhacker.c' +and `foobarhacker.o' are not ambiguous; they are truncated to +`foobarha.c' and `foobarha.o', which are distinct. + + Include in your distribution a copy of the `texinfo.tex' you used to +test print any `*.texinfo' or `*.texi' files. + + Likewise, if your program uses small GNU software packages like +regex, getopt, obstack, or termcap, include them in the distribution +file. Leaving them out would make the distribution file a little +smaller at the expense of possible inconvenience to a user who doesn't +know what other files to get. + + diff -urN binutils-2.7/etc/standards.texi binutils-2.8/etc/standards.texi --- binutils-2.7/etc/standards.texi Thu Jul 4 12:22:47 1996 +++ binutils-2.8/etc/standards.texi Wed Apr 30 12:57:42 1997 @@ -3,7 +3,7 @@ @setfilename standards.info @settitle GNU Coding Standards @c UPDATE THIS DATE WHENEVER YOU MAKE CHANGES! -@set lastupdate 28 March 1994 +@set lastupdate 16 January 1997 @c %**end of header @ifinfo @@ -14,11 +14,21 @@ @end format @end ifinfo +@c @setchapternewpage odd @setchapternewpage off +@c This is used by a cross ref in make-stds.texi +@set CODESTD 1 +@iftex +@set CHAPTER chapter +@end iftex +@ifinfo +@set CHAPTER node +@end ifinfo + @ifinfo GNU Coding Standards -Copyright (C) 1992, 1993, 1994 Free Software Foundation +Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -49,7 +59,7 @@ @page @vskip 0pt plus 1filll -Copyright @copyright{} 1992, 1993 Free Software Foundation +Copyright @copyright{} 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -63,41 +73,59 @@ Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved -by Free Software Foundation. +by the Free Software Foundation. @end titlepage @ifinfo -@node Top, Reading Non-Free Code, (dir), (dir) +@node Top, Preface, (dir), (dir) @top Version Last updated @value{lastupdate}. @end ifinfo @menu -* Reading Non-Free Code:: Referring to Proprietary Programs -* Contributions:: Accepting Contributions -* Change Logs:: Recording Changes -* Compatibility:: Compatibility with Other Implementations -* Makefile Conventions:: Makefile Conventions -* Configuration:: How Configuration Should Work -* Source Language:: Using Languages Other Than C -* Formatting:: Formatting Your Source Code -* Comments:: Commenting Your Work -* Syntactic Conventions:: Clean Use of C Constructs -* Names:: Naming Variables and Functions -* Using Extensions:: Using Non-standard Features -* System Functions:: Portability and ``standard'' library functions -* Semantics:: Program Behavior for All Programs -* Errors:: Formatting Error Messages -* Libraries:: Library Behavior -* Portability:: Portability As It Applies to GNU -* User Interfaces:: Standards for Command Line Interfaces -* Documentation:: Documenting Programs -* Releases:: Making Releases +* Preface:: About the GNU Coding Standards +* Intellectual Property:: Keeping Free Software Free +* Design Advice:: General Program Design +* Program Behavior:: Program Behavior for All Programs +* Writing C:: Making The Best Use of C +* Documentation:: Documenting Programs +* Managing Releases:: The Release Process +@end menu + +@node Preface +@chapter About the GNU Coding Standards + +The GNU Coding Standards were written by Richard Stallman and other GNU +Project volunteers. Their purpose is to make the GNU system clean, +consistent, and easy to install. This document can also be read as a +guide to writing portable, robust and reliable programs. It focuses on +programs written in C, but many of the rules and principles are useful +even if you write in another programming language. The rules often +state reasons for writing in a certain way. + +Corrections or suggestions regarding this document should be sent to +@code{gnu@@prep.ai.mit.edu}. If you make a suggestion, please include a +suggested new wording for it; our time is limited. We prefer a context +diff to the @file{standards.texi} or @file{make-stds.texi} files, but if +you don't have those files, please mail your suggestion anyway. + +This release of the GNU Coding Standards was last updated +@value{lastupdate}. + +@node Intellectual Property +@chapter Keeping Free Software Free + +This @value{CHAPTER} discusses how you can make sure that GNU software +remains unencumbered. + +@menu +* Reading Non-Free Code:: Referring to Proprietary Programs +* Contributions:: Accepting Contributions @end menu @node Reading Non-Free Code -@chapter Referring to Proprietary Programs +@section Referring to Proprietary Programs Don't in any circumstances refer to Unix source code for or during your work on GNU! (Or to any other proprietary programs.) @@ -131,7 +159,7 @@ @node Contributions -@chapter Accepting Contributions +@section Accepting Contributions If someone else sends you a piece of code to add to the program you are working on, we need legal papers to use it---the same sort of legal @@ -146,7 +174,7 @@ contribution. This applies both before you release the program and afterward. If -you receive diffs to fix a bug, and they make significant change, we +you receive diffs to fix a bug, and they make significant changes, we need legal papers for it. You don't need papers for changes of a few lines here or there, since @@ -155,7 +183,7 @@ which you use. For example, if you write a different solution to the problem, you don't need to get papers. -I know this is frustrating; it's frustrating for us as well. But if +We know this is frustrating; it's frustrating for us as well. But if you don't wait, you are going out on a limb---for example, what if the contributor's employer won't sign a disclaimer? You might have to take that code out again! @@ -164,101 +192,37 @@ contributor. We could be very embarrassed in court some day as a result. -@node Change Logs -@chapter Change Logs - -Keep a change log for each directory, describing the changes made to -source files in that directory. The purpose of this is so that people -investigating bugs in the future will know about the changes that -might have introduced the bug. Often a new bug can be found by -looking at what was recently changed. More importantly, change logs -can help eliminate conceptual inconsistencies between different parts -of a program; they can give you a history of how the conflicting -concepts arose. - -Use the Emacs command @kbd{M-x add-change} to start a new entry in the -change log. An entry should have an asterisk, the name of the changed -file, and then in parentheses the name of the changed functions, -variables or whatever, followed by a colon. Then describe the changes -you made to that function or variable. - -Separate unrelated entries with blank lines. When two entries -represent parts of the same change, so that they work together, then -don't put blank lines between them. Then you can omit the file name -and the asterisk when successive entries are in the same file. - -Here are some examples: - -@example -* register.el (insert-register): Return nil. -(jump-to-register): Likewise. - -* sort.el (sort-subr): Return nil. - -* tex-mode.el (tex-bibtex-file, tex-file, tex-region): -Restart the tex shell if process is gone or stopped. -(tex-shell-running): New function. - -* expr.c (store_one_arg): Round size up for move_block_to_reg. -(expand_call): Round up when emitting USE insns. -* stmt.c (assign_parms): Round size up for move_block_from_reg. -@end example - -It's important to name the changed function or variable in full. Don't -abbreviate them; don't combine them. Subsequent maintainers will often -search for a function name to find all the change log entries that -pertain to it; if you abbreviate the name, they won't find it when they -search. For example, some people are tempted to abbreviate groups of -function names by writing @samp{* register.el -(@{insert,jump-to@}-register)}; this is not a good idea, since searching -for @code{jump-to-register} or @code{insert-register} would not find the -entry. - -There's no need to describe the full purpose of the changes or how they -work together. It is better to put such explanations in comments in the -code. That's why just ``New function'' is enough; there is a comment -with the function in the source to explain what it does. - -However, sometimes it is useful to write one line to describe the -overall purpose of a large batch of changes. - -You can think of the change log as a conceptual ``undo list'' which -explains how earlier versions were different from the current version. -People can see the current version; they don't need the change log -to tell them what is in it. What they want from a change log is a -clear explanation of how the earlier version differed. - -When you change the calling sequence of a function in a simple -fashion, and you change all the callers of the function, there is no -need to make individual entries for all the callers. Just write in -the entry for the function being called, ``All callers changed.'' +@node Design Advice +@chapter General Program Design -When you change just comments or doc strings, it is enough to write an -entry for the file, without mentioning the functions. Write just, -``Doc fix.'' There's no need to keep a change log for documentation -files. This is because documentation is not susceptible to bugs that -are hard to fix. Documentation does not consist of parts that must -interact in a precisely engineered fashion; to correct an error, you -need not know the history of the erroneous passage. +This @value{CHAPTER} discusses some of the issues you should take into +account when designing your program. +@menu +* Compatibility:: Compatibility with other implementations +* Using Extensions:: Using non-standard features +* ANSI C:: Using ANSI C features +* Source Language:: Using languages other than C +@end menu @node Compatibility -@chapter Compatibility with Other Implementations +@section Compatibility with Other Implementations -With certain exceptions, utility programs and libraries for GNU should -be upward compatible with those in Berkeley Unix, and upward compatible -with @sc{ANSI} C if @sc{ANSI} C specifies their behavior, and upward -compatible with @sc{POSIX} if @sc{POSIX} specifies their behavior. +With occasional exceptions, utility programs and libraries for GNU +should be upward compatible with those in Berkeley Unix, and upward +compatible with @sc{ansi} C if @sc{ansi} C specifies their behavior, and +upward compatible with @sc{POSIX} if @sc{POSIX} specifies their +behavior. When these standards conflict, it is useful to offer compatibility modes for each of them. -@sc{ANSI} C and @sc{POSIX} prohibit many kinds of extensions. Feel -free to make the extensions anyway, and include a @samp{--ansi} or -@samp{--compatible} option to turn them off. However, if the extension -has a significant chance of breaking any real programs or scripts, -then it is not really upward compatible. Try to redesign its -interface. +@sc{ansi} C and @sc{POSIX} prohibit many kinds of extensions. Feel free +to make the extensions anyway, and include a @samp{--ansi}, +@samp{--posix}, or @samp{--compatible} option to turn them off. +However, if the extension has a significant chance of breaking any real +programs or scripts, then it is not really upward compatible. Try to +redesign its interface. Many GNU programs suppress extensions that conflict with POSIX if the environment variable @code{POSIXLY_CORRECT} is defined (even if it is @@ -268,183 +232,93 @@ When a feature is used only by users (not by programs or command files), and it is done poorly in Unix, feel free to replace it completely with something totally different and better. (For example, -vi is replaced with Emacs.) But it is nice to offer a compatible -feature as well. (There is a free vi clone, so we offer it.) +@code{vi} is replaced with Emacs.) But it is nice to offer a compatible +feature as well. (There is a free @code{vi} clone, so we offer it.) Additional useful features not in Berkeley Unix are welcome. Additional programs with no counterpart in Unix may be useful, but our first priority is usually to duplicate what Unix already has. -@comment The makefile standards are in a separate file that is also -@comment included by make.texinfo. Done by roland@gnu.ai.mit.edu on 1/6/93. -@include make-stds.texi - -@node Configuration -@chapter How Configuration Should Work - -Each GNU distribution should come with a shell script named -@code{configure}. This script is given arguments which describe the -kind of machine and system you want to compile the program for. - -The @code{configure} script must record the configuration options so -that they affect compilation. +@node Using Extensions +@section Using Non-standard Features -One way to do this is to make a link from a standard name such as -@file{config.h} to the proper configuration file for the chosen system. -If you use this technique, the distribution should @emph{not} contain a -file named @file{config.h}. This is so that people won't be able to -build the program without configuring it first. +Many GNU facilities that already exist support a number of convenient +extensions over the comparable Unix facilities. Whether to use these +extensions in implementing your program is a difficult question. -Another thing that @code{configure} can do is to edit the Makefile. If -you do this, the distribution should @emph{not} contain a file named -@file{Makefile}. Instead, include a file @file{Makefile.in} which -contains the input used for editing. Once again, this is so that people -won't be able to build the program without configuring it first. +On the one hand, using the extensions can make a cleaner program. +On the other hand, people will not be able to build the program +unless the other GNU tools are available. This might cause the +program to work on fewer kinds of machines. -If @code{configure} does write the @file{Makefile}, then @file{Makefile} -should have a target named @file{Makefile} which causes @code{configure} -to be rerun, setting up the same configuration that was set up last -time. The files that @code{configure} reads should be listed as -dependencies of @file{Makefile}. +With some extensions, it might be easy to provide both alternatives. +For example, you can define functions with a ``keyword'' @code{INLINE} +and define that as a macro to expand into either @code{inline} or +nothing, depending on the compiler. -All the files which are output from the @code{configure} script should -have comments at the beginning explaining that they were generated -automatically using @code{configure}. This is so that users won't think -of trying to edit them by hand. +In general, perhaps it is best not to use the extensions if you can +straightforwardly do without them, but to use the extensions if they +are a big improvement. -The @code{configure} script should write a file named @file{config.status} -which describes which configuration options were specified when the -program was last configured. This file should be a shell script which, -if run, will recreate the same configuration. +An exception to this rule are the large, established programs (such as +Emacs) which run on a great variety of systems. Such programs would +be broken by use of GNU extensions. -The @code{configure} script should accept an option of the form -@samp{--srcdir=@var{dirname}} to specify the directory where sources are found -(if it is not the current directory). This makes it possible to build -the program in a separate directory, so that the actual source directory -is not modified. +Another exception is for programs that are used as part of +compilation: anything that must be compiled with other compilers in +order to bootstrap the GNU compilation facilities. If these require +the GNU compiler, then no one can compile them without having them +installed already. That would be no good. -If the user does not specify @samp{--srcdir}, then @code{configure} should -check both @file{.} and @file{..} to see if it can find the sources. If -it finds the sources in one of these places, it should use them from -there. Otherwise, it should report that it cannot find the sources, and -should exit with nonzero status. +@node ANSI C +@section @sc{ansi} C and pre-@sc{ansi} C -Usually the easy way to support @samp{--srcdir} is by editing a -definition of @code{VPATH} into the Makefile. Some rules may need to -refer explicitly to the specified source directory. To make this -possible, @code{configure} can add to the Makefile a variable named -@code{srcdir} whose value is precisely the specified directory. +Do not ever use the ``trigraph'' feature of @sc{ansi} C. -The @code{configure} script should also take an argument which specifies the -type of system to build the program for. This argument should look like -this: +@sc{ansi} C is widespread enough now that it is ok to write new programs +that use @sc{ansi} C features (and therefore will not work in +non-@sc{ansi} compilers). And if a program is already written in +@sc{ansi} C, there's no need to convert it to support non-@sc{ansi} +compilers. + +However, it is easy to support non-@sc{ansi} compilers in most programs, +so you might still consider doing so when you write a program. Instead +of writing function definitions in @sc{ansi} prototype form, @example -@var{cpu}-@var{company}-@var{system} +int +foo (int x, int y) +@dots{} @end example -For example, a Sun 3 might be @samp{m68k-sun-sunos4.1}. - -The @code{configure} script needs to be able to decode all plausible -alternatives for how to describe a machine. Thus, @samp{sun3-sunos4.1} -would be a valid alias. So would @samp{sun3-bsd4.2}, since SunOS is -basically @sc{BSD} and no other @sc{BSD} system is used on a Sun. For many -programs, @samp{vax-dec-ultrix} would be an alias for -@samp{vax-dec-bsd}, simply because the differences between Ultrix and -@sc{BSD} are rarely noticeable, but a few programs might need to distinguish -them. - -There is a shell script called @file{config.sub} that you can use -as a subroutine to validate system types and canonicalize aliases. - -Other options are permitted to specify in more detail the software -or hardware present on the machine, and include or exclude optional -parts of the package: - -@table @samp -@item --enable-@var{feature}@r{[}=@var{parameter}@r{]} -Configure the package to build and install an optional user-level -facility called @var{feature}. This allows users to choose which -optional features to include. Giving an optional @var{parameter} of -@samp{no} should omit @var{feature}, if it is built by default. - -No @samp{--enable} option should @strong{ever} cause one feature to -replace another. No @samp{--enable} option should ever substitute one -useful behavior for another useful behavior. The only proper use for -@samp{--enable} is for questions of whether to build part of the program -or exclude it. - -@item --with-@var{package} -@c @r{[}=@var{parameter}@r{]} -The package @var{package} will be installed, so configure this package -to work with @var{package}. - -@c Giving an optional @var{parameter} of -@c @samp{no} should omit @var{package}, if it is used by default. - -Possible values of @var{package} include @samp{x}, @samp{x-toolkit}, -@samp{gnu-as} (or @samp{gas}), @samp{gnu-ld}, @samp{gnu-libc}, and -@samp{gdb}. - -Do not use a @samp{--with} option to specify the file name to use to -find certain files. That is outside the scope of what @samp{--with} -options are for. - -@item --nfp -The target machine has no floating point processor. - -@item --gas -The target machine assembler is GAS, the GNU assembler. -This is obsolete; users should use @samp{--with-gnu-as} instead. - -@item --x -The target machine has the X Window System installed. -This is obsolete; users should use @samp{--with-x} instead. -@end table - -All @code{configure} scripts should accept all of these ``detail'' -options, whether or not they make any difference to the particular -package at hand. In particular, they should accept any option that -starts with @samp{--with-} or @samp{--enable-}. This is so users will -be able to configure an entire GNU source tree at once with a single set -of options. - -You will note that the categories @samp{--with-} and @samp{--enable-} -are narrow: they @strong{do not} provide a place for any sort of option -you might think of. That is deliberate. We want to limit the possible -configuration options in GNU software. We do not want GNU programs to -have idiosyncratic configuration options. - -Packages that perform part of compilation may support cross-compilation. -In such a case, the host and target machines for the program may be -different. The @code{configure} script should normally treat the -specified type of system as both the host and the target, thus producing -a program which works for the same type of machine that it runs on. +@noindent +write the definition in pre-@sc{ansi} style like this, -The way to build a cross-compiler, cross-assembler, or what have you, is -to specify the option @samp{--host=@var{hosttype}} when running -@code{configure}. This specifies the host system without changing the -type of target system. The syntax for @var{hosttype} is the same as -described above. +@example +int +foo (x, y) + int x, y; +@dots{} +@end example -Bootstrapping a cross-compiler requires compiling it on a machine other -than the host it will run on. Compilation packages accept a -configuration option @samp{--build=@var{hosttype}} for specifying the -configuration on which you will compile them, in case that is different -from the host. +@noindent +and use a separate declaration to specify the argument prototype: -Programs for which cross-operation is not meaningful need not accept the -@samp{--host} option, because configuring an entire operating system for -cross-operation is not a meaningful thing. +@example +int foo (int, int); +@end example -Some programs have ways of configuring themselves automatically. If -your program is set up to do this, your @code{configure} script can simply -ignore most of its arguments. +You need such a declaration anyway, in a header file, to get the benefit +of @sc{ansi} C prototypes in all the files where the function is called. +And once you have it, you lose nothing by writing the function +definition in the pre-@sc{ansi} style. +If you don't know non-@sc{ansi} C, there's no need to learn it; just +write in @sc{ansi} C. @node Source Language -@chapter Using Languages Other Than C +@section Using Languages Other Than C Using a language other than C is like using a non-standard feature: it will cause trouble for users. Even if GCC supports the other language, @@ -458,8 +332,8 @@ It is okay to use a special language if the same program contains an interpreter for that language. -Thus, it is not a problem that GNU Emacs contains code written in Emacs -Lisp, because it comes with a Lisp interpreter. +For example, if your program links with GUILE, it is ok to write part of +the program in Scheme or another language supported by GUILE. @item It is okay to use another language in a tool specifically intended for @@ -473,1759 +347,2651 @@ it's not important if the application is inconvenient to install. @end itemize -@node Formatting -@chapter Formatting Your Source Code - -It is important to put the open-brace that starts the body of a C -function in column zero, and avoid putting any other open-brace or -open-parenthesis or open-bracket in column zero. Several tools look -for open-braces in column zero to find the beginnings of C functions. -These tools will not work on code not formatted that way. +@node Program Behavior +@chapter Program Behavior for All Programs -It is also important for function definitions to start the name of the -function in column zero. This helps people to search for function -definitions, and may also help certain tools recognize them. Thus, -the proper format is this: +This @value{CHAPTER} describes how to write robust software. It also +describes general standards for error messages, the command line interface, +and how libraries should behave. -@example -static char * -concat (s1, s2) /* Name starts in column zero here */ - char *s1, *s2; -@{ /* Open brace in column zero here */ - @dots{} -@} -@end example +@menu +* Semantics:: Writing robust programs +* Libraries:: Library behavior +* Errors:: Formatting error messages +* User Interfaces:: Standards for command line interfaces +* Option Table:: Table of long options. +* Memory Usage:: When and how to care about memory needs +@end menu -@noindent -or, if you want to use @sc{ANSI} C, format the definition like this: +@node Semantics +@section Writing Robust Programs -@example -static char * -concat (char *s1, char *s2) -@{ - @dots{} -@} -@end example +Avoid arbitrary limits on the length or number of @emph{any} data +structure, including file names, lines, files, and symbols, by allocating +all data structures dynamically. In most Unix utilities, ``long lines +are silently truncated''. This is not acceptable in a GNU utility. -In @sc{ANSI} C, if the arguments don't fit nicely on one line, -split it like this: +Utilities reading files should not drop NUL characters, or any other +nonprinting characters @emph{including those with codes above 0177}. The +only sensible exceptions would be utilities specifically intended for +interface to certain types of printers that can't handle those characters. -@example -int -lots_of_args (int an_integer, long a_long, short a_short, - double a_double, float a_float) -@dots{} -@end example +Check every system call for an error return, unless you know you wish to +ignore errors. Include the system error text (from @code{perror} or +equivalent) in @emph{every} error message resulting from a failing +system call, as well as the name of the file if any and the name of the +utility. Just ``cannot open foo.c'' or ``stat failed'' is not +sufficient. -For the body of the function, we prefer code formatted like this: +Check every call to @code{malloc} or @code{realloc} to see if it +returned zero. Check @code{realloc} even if you are making the block +smaller; in a system that rounds block sizes to a power of 2, +@code{realloc} may get a different block if you ask for less space. -@example -if (x < foo (y, z)) - haha = bar[4] + 5; -else - @{ - while (z) - @{ - haha += foo (z, z); - z--; - @} - return ++x + bar (); - @} -@end example +In Unix, @code{realloc} can destroy the storage block if it returns +zero. GNU @code{realloc} does not have this bug: if it fails, the +original block is unchanged. Feel free to assume the bug is fixed. If +you wish to run your program on Unix, and wish to avoid lossage in this +case, you can use the GNU @code{malloc}. -We find it easier to read a program when it has spaces before the -open-parentheses and after the commas. Especially after the commas. +You must expect @code{free} to alter the contents of the block that was +freed. Anything you want to fetch from the block, you must fetch before +calling @code{free}. -When you split an expression into multiple lines, split it -before an operator, not after one. Here is the right way: +If @code{malloc} fails in a noninteractive program, make that a fatal +error. In an interactive program (one that reads commands from the +user), it is better to abort the command and return to the command +reader loop. This allows the user to kill other processes to free up +virtual memory, and then try the command again. -@example -if (foo_this_is_long && bar > win (x, y, z) - && remaining_condition) -@end example +Use @code{getopt_long} to decode arguments, unless the argument syntax +makes this unreasonable. -Try to avoid having two operators of different precedence at the same -level of indentation. For example, don't write this: +When static storage is to be written in during program execution, use +explicit C code to initialize it. Reserve C initialized declarations +for data that will not be changed. +@c ADR: why? -@example -mode = (inmode[j] == VOIDmode - || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]) - ? outmode[j] : inmode[j]); -@end example +Try to avoid low-level interfaces to obscure Unix data structures (such +as file directories, utmp, or the layout of kernel memory), since these +are less likely to work compatibly. If you need to find all the files +in a directory, use @code{readdir} or some other high-level interface. +These will be supported compatibly by GNU. -Instead, use extra parentheses so that the indentation shows the nesting: +By default, the GNU system will provide the signal handling functions of +@sc{BSD} and of @sc{POSIX}. So GNU software should be written to use +these. -@example -mode = ((inmode[j] == VOIDmode - || (GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]))) - ? outmode[j] : inmode[j]); -@end example +In error checks that detect ``impossible'' conditions, just abort. +There is usually no point in printing any message. These checks +indicate the existence of bugs. Whoever wants to fix the bugs will have +to read the source code and run a debugger. So explain the problem with +comments in the source. The relevant data will be in variables, which +are easy to examine with the debugger, so there is no point moving them +elsewhere. -Insert extra parentheses so that Emacs will indent the code properly. -For example, the following indentation looks nice if you do it by hand, -but Emacs would mess it up: +Do not use a count of errors as the exit status for a program. +@emph{That does not work}, because exit status values are limited to 8 +bits (0 through 255). A single run of the program might have 256 +errors; if you try to return 256 as the exit status, the parent process +will see 0 as the status, and it will appear that the program succeeded. + +If you make temporary files, check the @code{TMPDIR} environment +variable; if that variable is defined, use the specified directory +instead of @file{/tmp}. + +@node Libraries +@section Library Behavior + +Try to make library functions reentrant. If they need to do dynamic +storage allocation, at least try to avoid any nonreentrancy aside from +that of @code{malloc} itself. + +Here are certain name conventions for libraries, to avoid name +conflicts. + +Choose a name prefix for the library, more than two characters long. +All external function and variable names should start with this +prefix. In addition, there should only be one of these in any given +library member. This usually means putting each one in a separate +source file. + +An exception can be made when two external symbols are always used +together, so that no reasonable program could use one without the +other; then they can both go in the same file. + +External symbols that are not documented entry points for the user +should have names beginning with @samp{_}. They should also contain +the chosen name prefix for the library, to prevent collisions with +other libraries. These can go in the same files with user entry +points if you like. + +Static functions and variables can be used as you like and need not +fit any naming convention. + +@node Errors +@section Formatting Error Messages + +Error messages from compilers should look like this: @example -v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 - + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000; +@var{source-file-name}:@var{lineno}: @var{message} @end example -But adding a set of parentheses solves the problem: +Error messages from other noninteractive programs should look like this: @example -v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 - + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000); +@var{program}:@var{source-file-name}:@var{lineno}: @var{message} @end example -Format do-while statements like this: +@noindent +when there is an appropriate source file, or like this: @example -do - @{ - a = foo (a); - @} -while (a > 0); +@var{program}: @var{message} @end example -Please use formfeed characters (control-L) to divide the program into -pages at logical places (but not within a function). It does not matter -just how long the pages are, since they do not have to fit on a printed -page. The formfeeds should appear alone on lines by themselves. +@noindent +when there is no relevant source file. +In an interactive program (one that is reading commands from a +terminal), it is better not to include the program name in an error +message. The place to indicate which program is running is in the +prompt or with the screen layout. (When the same program runs with +input from a source other than a terminal, it is not interactive and +would do best to print error messages using the noninteractive style.) -@node Comments -@chapter Commenting Your Work +The string @var{message} should not begin with a capital letter when +it follows a program name and/or file name. Also, it should not end +with a period. -Every program should start with a comment saying briefly what it is for. -Example: @samp{fmt - filter for simple filling of text}. +Error messages from interactive programs, and other messages such as +usage messages, should start with a capital letter. But they should not +end with a period. -Please put a comment on each function saying what the function does, -what sorts of arguments it gets, and what the possible values of -arguments mean and are used for. It is not necessary to duplicate in -words the meaning of the C argument declarations, if a C type is being -used in its customary fashion. If there is anything nonstandard about -its use (such as an argument of type @code{char *} which is really the -address of the second character of a string, not the first), or any -possible values that would not work the way one would expect (such as, -that strings containing newlines are not guaranteed to work), be sure -to say so. +@node User Interfaces +@section Standards for Command Line Interfaces -Also explain the significance of the return value, if there is one. +Please don't make the behavior of a utility depend on the name used +to invoke it. It is useful sometimes to make a link to a utility +with a different name, and that should not change what it does. -Please put two spaces after the end of a sentence in your comments, so -that the Emacs sentence commands will work. Also, please write -complete sentences and capitalize the first word. If a lower-case -identifer comes at the beginning of a sentence, don't capitalize it! -Changing the spelling makes it a different identifier. If you don't -like starting a sentence with a lower case letter, write the sentence -differently (e.g., ``The identifier lower-case is @dots{}''). +Instead, use a run time option or a compilation switch or both +to select among the alternate behaviors. -The comment on a function is much clearer if you use the argument -names to speak about the argument values. The variable name itself -should be lower case, but write it in upper case when you are speaking -about the value rather than the variable itself. Thus, ``the inode -number NODE_NUM'' rather than ``an inode''. +Likewise, please don't make the behavior of the program depend on the +type of output device it is used with. Device independence is an +important principle of the system's design; do not compromise it +merely to save someone from typing an option now and then. -There is usually no purpose in restating the name of the function in -the comment before it, because the reader can see that for himself. -There might be an exception when the comment is so long that the function -itself would be off the bottom of the screen. +If you think one behavior is most useful when the output is to a +terminal, and another is most useful when the output is a file or a +pipe, then it is usually best to make the default behavior the one that +is useful with output to a terminal, and have an option for the other +behavior. -There should be a comment on each static variable as well, like this: +Compatibility requires certain programs to depend on the type of output +device. It would be disastrous if @code{ls} or @code{sh} did not do so +in the way all users expect. In some of these cases, we supplement the +program with a preferred alternate version that does not depend on the +output device type. For example, we provide a @code{dir} program much +like @code{ls} except that its default output format is always +multi-column format. + +It is a good idea to follow the @sc{POSIX} guidelines for the +command-line options of a program. The easiest way to do this is to use +@code{getopt} to parse them. Note that the GNU version of @code{getopt} +will normally permit options anywhere among the arguments unless the +special argument @samp{--} is used. This is not what @sc{POSIX} +specifies; it is a GNU extension. + +Please define long-named options that are equivalent to the +single-letter Unix-style options. We hope to make GNU more user +friendly this way. This is easy to do with the GNU function +@code{getopt_long}. + +One of the advantages of long-named options is that they can be +consistent from program to program. For example, users should be able +to expect the ``verbose'' option of any GNU program which has one, to be +spelled precisely @samp{--verbose}. To achieve this uniformity, look at +the table of common long-option names when you choose the option names +for your program (@pxref{Option Table}). + +It is usually a good idea for file names given as ordinary arguments to +be input files only; any output files would be specified using options +(preferably @samp{-o} or @samp{--output}). Even if you allow an output +file name as an ordinary argument for compatibility, try to provide an +option as another way to specify it. This will lead to more consistency +among GNU utilities, and fewer idiosyncracies for users to remember. + +All programs should support two standard options: @samp{--version} +and @samp{--help}. + +@table @code +@item --version +This option should direct the program to information about its name, +version, origin and legal status, all on standard output, and then exit +successfully. Other options and arguments should be ignored once this +is seen, and the program should not perform its normal function. + +The first line is meant to be easy for a program to parse; the version +number proper starts after the last space. In addition, it contains +the canonical name for this program, in this format: @example -/* Nonzero means truncate lines in the display; - zero means continue them. */ -int truncate_lines; +GNU Emacs 19.30 @end example -Every @samp{#endif} should have a comment, except in the case of short -conditionals (just a few lines) that are not nested. The comment should -state the condition of the conditional that is ending, @emph{including -its sense}. @samp{#else} should have a comment describing the condition -@emph{and sense} of the code that follows. For example: +@noindent +The program's name should be a constant string; @emph{don't} compute it +from @code{argv[0]}. The idea is to state the standard or canonical +name for the program, not its file name. There are other ways to find +out the precise file name where a command is found in @code{PATH}. + +If the program is a subsidiary part of a larger package, mention the +package name in parentheses, like this: @example -#ifdef foo - @dots{} -#else /* not foo */ - @dots{} -#endif /* not foo */ +emacsserver (GNU Emacs) 19.30 @end example @noindent -but, by contrast, write the comments this way for a @samp{#ifndef}: +If the package has a version number which is different from this +program's version number, you can mention the package version number +just before the close-parenthesis. + +If you @strong{need} to mention the version numbers of libraries which +are distributed separately from the package which contains this program, +you can do so by printing an additional line of version info for each +library you want to mention. Use the same format for these lines as for +the first line. + +Please don't mention all the libraries that the program uses ``just for +completeness''---that would produce a lot of unhelpful clutter. Please +mention library version numbers only if you find in practice that they +are very important to you in debugging. + +The following line, after the version number line or lines, should be a +copyright notice. If more than one copyright notice is called for, put +each on a separate line. + +Next should follow a brief statement that the program is free software, +and that users are free to copy and change it on certain conditions. If +the program is covered by the GNU GPL, say so here. Also mention that +there is no warranty, to the extent permitted by law. + +It is ok to finish the output with a list of the major authors of the +program, as a way of giving credit. + +Here's an example of output that follows these rules: + +@smallexample +GNU Emacs 19.34.5 +Copyright (C) 1996 Free Software Foundation, Inc. +GNU Emacs comes with NO WARRANTY, to the extent permitted by law. +You may redistribute copies of GNU Emacs +under the terms of the GNU General Public License. +For more information about these matters, see the files named COPYING. +@end smallexample + +You should adapt this to your program, of course, filling in the proper +year, copyright holder, name of program, and the references to +distribution terms, and changing the rest of the wording as necessary. + +This copyright notice only needs to mention the most recent year in +which changes were made---there's no need to list the years for previous +versions' changes. You don't have to mention the name of the program in +these notices, if that is inconvenient, since it appeared in the first +line. + +@item --help +This option should output brief documentation for how to invoke the +program, on standard output, then exit successfully. Other options and +arguments should be ignored once this is seen, and the program should +not perform its normal function. + +Near the end of the @samp{--help} option's output there should be a line +that says where to mail bug reports. It should have this format: @example -#ifndef foo - @dots{} -#else /* foo */ - @dots{} -#endif /* foo */ +Report bugs to @var{mailing-address}. @end example +@end table +@node Option Table +@section Table of Long Options -@node Syntactic Conventions -@chapter Clean Use of C Constructs +Here is a table of long options used by GNU programs. It is surely +incomplete, but we aim to list all the options that a new program might +want to be compatible with. If you use names not already in the table, +please send @samp{gnu@@prep.ai.mit.edu} a list of them, with their +meanings, so we can update the table. -Please explicitly declare all arguments to functions. -Don't omit them just because they are @code{int}s. +@c Please leave newlines between items in this table; it's much easier +@c to update when it isn't completely squashed together and unreadable. +@c When there is more than one short option for a long option name, put +@c a semicolon between the lists of the programs that use them, not a +@c period. --friedman -Declarations of external functions and functions to appear later in the -source file should all go in one place near the beginning of the file -(somewhere before the first function definition in the file), or else -should go in a header file. Don't put @code{extern} declarations inside -functions. +@table @samp +@item after-date +@samp{-N} in @code{tar}. -It used to be common practice to use the same local variables (with -names like @code{tem}) over and over for different values within one -function. Instead of doing this, it is better declare a separate local -variable for each distinct purpose, and give it a name which is -meaningful. This not only makes programs easier to understand, it also -facilitates optimization by good compilers. You can also move the -declaration of each local variable into the smallest scope that includes -all its uses. This makes the program even cleaner. +@item all +@samp{-a} in @code{du}, @code{ls}, @code{nm}, @code{stty}, @code{uname}, +and @code{unexpand}. -Don't use local variables or parameters that shadow global identifiers. +@item all-text +@samp{-a} in @code{diff}. -Don't declare multiple variables in one declaration that spans lines. -Start a new declaration on each line, instead. For example, instead -of this: +@item almost-all +@samp{-A} in @code{ls}. -@example -int foo, - bar; -@end example +@item append +@samp{-a} in @code{etags}, @code{tee}, @code{time}; +@samp{-r} in @code{tar}. -@noindent -write either this: +@item archive +@samp{-a} in @code{cp}. -@example -int foo, bar; -@end example +@item archive-name +@samp{-n} in @code{shar}. -@noindent -or this: +@item arglength +@samp{-l} in @code{m4}. -@example -int foo; -int bar; -@end example +@item ascii +@samp{-a} in @code{diff}. -@noindent -(If they are global variables, each should have a comment preceding it -anyway.) +@item assign +@samp{-v} in @code{gawk}. + +@item assume-new +@samp{-W} in Make. + +@item assume-old +@samp{-o} in Make. + +@item auto-check +@samp{-a} in @code{recode}. + +@item auto-pager +@samp{-a} in @code{wdiff}. + +@item auto-reference +@samp{-A} in @code{ptx}. + +@item avoid-wraps +@samp{-n} in @code{wdiff}. + +@item backward-search +@samp{-B} in @code{ctags}. + +@item basename +@samp{-f} in @code{shar}. + +@item batch +Used in GDB. + +@item baud +Used in GDB. + +@item before +@samp{-b} in @code{tac}. + +@item binary +@samp{-b} in @code{cpio} and @code{diff}. + +@item bits-per-code +@samp{-b} in @code{shar}. + +@item block-size +Used in @code{cpio} and @code{tar}. + +@item blocks +@samp{-b} in @code{head} and @code{tail}. + +@item break-file +@samp{-b} in @code{ptx}. + +@item brief +Used in various programs to make output shorter. + +@item bytes +@samp{-c} in @code{head}, @code{split}, and @code{tail}. + +@item c@t{++} +@samp{-C} in @code{etags}. + +@item catenate +@samp{-A} in @code{tar}. + +@item cd +Used in various programs to specify the directory to use. + +@item changes +@samp{-c} in @code{chgrp} and @code{chown}. + +@item classify +@samp{-F} in @code{ls}. + +@item colons +@samp{-c} in @code{recode}. + +@item command +@samp{-c} in @code{su}; +@samp{-x} in GDB. + +@item compare +@samp{-d} in @code{tar}. + +@item compat +Used in @code{gawk}. + +@item compress +@samp{-Z} in @code{tar} and @code{shar}. + +@item concatenate +@samp{-A} in @code{tar}. + +@item confirmation +@samp{-w} in @code{tar}. + +@item context +Used in @code{diff}. + +@item copyleft +@samp{-W copyleft} in @code{gawk}. + +@item copyright +@samp{-C} in @code{ptx}, @code{recode}, and @code{wdiff}; +@samp{-W copyright} in @code{gawk}. + +@item core +Used in GDB. + +@item count +@samp{-q} in @code{who}. + +@item count-links +@samp{-l} in @code{du}. + +@item create +Used in @code{tar} and @code{cpio}. + +@item cut-mark +@samp{-c} in @code{shar}. + +@item cxref +@samp{-x} in @code{ctags}. + +@item date +@samp{-d} in @code{touch}. + +@item debug +@samp{-d} in Make and @code{m4}; +@samp{-t} in Bison. + +@item define +@samp{-D} in @code{m4}. + +@item defines +@samp{-d} in Bison and @code{ctags}. + +@item delete +@samp{-D} in @code{tar}. + +@item dereference +@samp{-L} in @code{chgrp}, @code{chown}, @code{cpio}, @code{du}, +@code{ls}, and @code{tar}. + +@item dereference-args +@samp{-D} in @code{du}. + +@item diacritics +@samp{-d} in @code{recode}. + +@item dictionary-order +@samp{-d} in @code{look}. + +@item diff +@samp{-d} in @code{tar}. + +@item digits +@samp{-n} in @code{csplit}. + +@item directory +Specify the directory to use, in various programs. In @code{ls}, it +means to show directories themselves rather than their contents. In +@code{rm} and @code{ln}, it means to not treat links to directories +specially. + +@item discard-all +@samp{-x} in @code{strip}. + +@item discard-locals +@samp{-X} in @code{strip}. + +@item dry-run +@samp{-n} in Make. + +@item ed +@samp{-e} in @code{diff}. + +@item elide-empty-files +@samp{-z} in @code{csplit}. + +@item end-delete +@samp{-x} in @code{wdiff}. + +@item end-insert +@samp{-z} in @code{wdiff}. + +@item entire-new-file +@samp{-N} in @code{diff}. + +@item environment-overrides +@samp{-e} in Make. + +@item eof +@samp{-e} in @code{xargs}. + +@item epoch +Used in GDB. + +@item error-limit +Used in @code{makeinfo}. + +@item error-output +@samp{-o} in @code{m4}. + +@item escape +@samp{-b} in @code{ls}. + +@item exclude-from +@samp{-X} in @code{tar}. + +@item exec +Used in GDB. + +@item exit +@samp{-x} in @code{xargs}. + +@item exit-0 +@samp{-e} in @code{unshar}. + +@item expand-tabs +@samp{-t} in @code{diff}. + +@item expression +@samp{-e} in @code{sed}. + +@item extern-only +@samp{-g} in @code{nm}. + +@item extract +@samp{-i} in @code{cpio}; +@samp{-x} in @code{tar}. + +@item faces +@samp{-f} in @code{finger}. + +@item fast +@samp{-f} in @code{su}. + +@item fatal-warnings +@samp{-E} in @code{m4}. + +@item file +@samp{-f} in @code{info}, @code{gawk}, Make, @code{mt}, and @code{tar}; +@samp{-n} in @code{sed}; +@samp{-r} in @code{touch}. + +@item field-separator +@samp{-F} in @code{gawk}. + +@item file-prefix +@samp{-b} in Bison. + +@item file-type +@samp{-F} in @code{ls}. + +@item files-from +@samp{-T} in @code{tar}. + +@item fill-column +Used in @code{makeinfo}. + +@item flag-truncation +@samp{-F} in @code{ptx}. + +@item fixed-output-files +@samp{-y} in Bison. + +@item follow +@samp{-f} in @code{tail}. + +@item footnote-style +Used in @code{makeinfo}. + +@item force +@samp{-f} in @code{cp}, @code{ln}, @code{mv}, and @code{rm}. + +@item force-prefix +@samp{-F} in @code{shar}. + +@item format +Used in @code{ls}, @code{time}, and @code{ptx}. + +@item freeze-state +@samp{-F} in @code{m4}. + +@item fullname +Used in GDB. + +@item gap-size +@samp{-g} in @code{ptx}. + +@item get +@samp{-x} in @code{tar}. + +@item graphic +@samp{-i} in @code{ul}. + +@item graphics +@samp{-g} in @code{recode}. + +@item group +@samp{-g} in @code{install}. + +@item gzip +@samp{-z} in @code{tar} and @code{shar}. + +@item hashsize +@samp{-H} in @code{m4}. + +@item header +@samp{-h} in @code{objdump} and @code{recode} + +@item heading +@samp{-H} in @code{who}. + +@item help +Used to ask for brief usage information. + +@item here-delimiter +@samp{-d} in @code{shar}. + +@item hide-control-chars +@samp{-q} in @code{ls}. + +@item idle +@samp{-u} in @code{who}. + +@item ifdef +@samp{-D} in @code{diff}. + +@item ignore +@samp{-I} in @code{ls}; +@samp{-x} in @code{recode}. + +@item ignore-all-space +@samp{-w} in @code{diff}. + +@item ignore-backups +@samp{-B} in @code{ls}. + +@item ignore-blank-lines +@samp{-B} in @code{diff}. + +@item ignore-case +@samp{-f} in @code{look} and @code{ptx}; +@samp{-i} in @code{diff} and @code{wdiff}. + +@item ignore-errors +@samp{-i} in Make. + +@item ignore-file +@samp{-i} in @code{ptx}. + +@item ignore-indentation +@samp{-I} in @code{etags}. + +@item ignore-init-file +@samp{-f} in Oleo. + +@item ignore-interrupts +@samp{-i} in @code{tee}. + +@item ignore-matching-lines +@samp{-I} in @code{diff}. + +@item ignore-space-change +@samp{-b} in @code{diff}. + +@item ignore-zeros +@samp{-i} in @code{tar}. + +@item include +@samp{-i} in @code{etags}; +@samp{-I} in @code{m4}. + +@item include-dir +@samp{-I} in Make. + +@item incremental +@samp{-G} in @code{tar}. + +@item info +@samp{-i}, @samp{-l}, and @samp{-m} in Finger. + +@item initial +@samp{-i} in @code{expand}. + +@item initial-tab +@samp{-T} in @code{diff}. + +@item inode +@samp{-i} in @code{ls}. + +@item interactive +@samp{-i} in @code{cp}, @code{ln}, @code{mv}, @code{rm}; +@samp{-e} in @code{m4}; +@samp{-p} in @code{xargs}; +@samp{-w} in @code{tar}. + +@item intermix-type +@samp{-p} in @code{shar}. + +@item jobs +@samp{-j} in Make. + +@item just-print +@samp{-n} in Make. + +@item keep-going +@samp{-k} in Make. + +@item keep-files +@samp{-k} in @code{csplit}. + +@item kilobytes +@samp{-k} in @code{du} and @code{ls}. + +@item language +@samp{-l} in @code{etags}. + +@item less-mode +@samp{-l} in @code{wdiff}. + +@item level-for-gzip +@samp{-g} in @code{shar}. + +@item line-bytes +@samp{-C} in @code{split}. + +@item lines +Used in @code{split}, @code{head}, and @code{tail}. + +@item link +@samp{-l} in @code{cpio}. + +@item lint +@itemx lint-old +Used in @code{gawk}. + +@item list +@samp{-t} in @code{cpio}; +@samp{-l} in @code{recode}. + +@item list +@samp{-t} in @code{tar}. + +@item literal +@samp{-N} in @code{ls}. + +@item load-average +@samp{-l} in Make. + +@item login +Used in @code{su}. + +@item machine +No listing of which programs already use this; +someone should check to +see if any actually do and tell @code{gnu@@prep.ai.mit.edu}. + +@item macro-name +@samp{-M} in @code{ptx}. + +@item mail +@samp{-m} in @code{hello} and @code{uname}. + +@item make-directories +@samp{-d} in @code{cpio}. + +@item makefile +@samp{-f} in Make. + +@item mapped +Used in GDB. -When you have an @code{if}-@code{else} statement nested in another -@code{if} statement, always put braces around the @code{if}-@code{else}. -Thus, never write like this: +@item max-args +@samp{-n} in @code{xargs}. -@example -if (foo) - if (bar) - win (); - else - lose (); -@end example +@item max-chars +@samp{-n} in @code{xargs}. -@noindent -always like this: +@item max-lines +@samp{-l} in @code{xargs}. -@example -if (foo) - @{ - if (bar) - win (); - else - lose (); - @} -@end example +@item max-load +@samp{-l} in Make. -If you have an @code{if} statement nested inside of an @code{else} -statement, either write @code{else if} on one line, like this, +@item max-procs +@samp{-P} in @code{xargs}. -@example -if (foo) - @dots{} -else if (bar) - @dots{} -@end example +@item mesg +@samp{-T} in @code{who}. -@noindent -with its @code{then}-part indented like the preceding @code{then}-part, -or write the nested @code{if} within braces like this: +@item message +@samp{-T} in @code{who}. -@example -if (foo) - @dots{} -else - @{ - if (bar) - @dots{} - @} -@end example +@item minimal +@samp{-d} in @code{diff}. -Don't declare both a structure tag and variables or typedefs in the -same declaration. Instead, declare the structure tag separately -and then use it to declare the variables or typedefs. +@item mixed-uuencode +@samp{-M} in @code{shar}. -Try to avoid assignments inside @code{if}-conditions. For example, -don't write this: +@item mode +@samp{-m} in @code{install}, @code{mkdir}, and @code{mkfifo}. -@example -if ((foo = (char *) malloc (sizeof *foo)) == 0) - fatal ("virtual memory exhausted"); -@end example +@item modification-time +@samp{-m} in @code{tar}. -@noindent -instead, write this: +@item multi-volume +@samp{-M} in @code{tar}. -@example -foo = (char *) malloc (sizeof *foo); -if (foo == 0) - fatal ("virtual memory exhausted"); -@end example +@item name-prefix +@samp{-a} in Bison. -Don't make the program ugly to placate @code{lint}. Please don't insert any -casts to @code{void}. Zero without a cast is perfectly fine as a null -pointer constant. +@item nesting-limit +@samp{-L} in @code{m4}. -@node Names -@chapter Naming Variables and Functions +@item net-headers +@samp{-a} in @code{shar}. -Please use underscores to separate words in a name, so that the Emacs -word commands can be useful within them. Stick to lower case; reserve -upper case for macros and @code{enum} constants, and for name-prefixes -that follow a uniform convention. +@item new-file +@samp{-W} in Make. -For example, you should use names like @code{ignore_space_change_flag}; -don't use names like @code{iCantReadThis}. +@item no-builtin-rules +@samp{-r} in Make. -Variables that indicate whether command-line options have been -specified should be named after the meaning of the option, not after -the option-letter. A comment should state both the exact meaning of -the option and its letter. For example, +@item no-character-count +@samp{-w} in @code{shar}. -@example -/* Ignore changes in horizontal whitespace (-b). */ -int ignore_space_change_flag; -@end example +@item no-check-existing +@samp{-x} in @code{shar}. -When you want to define names with constant integer values, use -@code{enum} rather than @samp{#define}. GDB knows about enumeration -constants. +@item no-common +@samp{-3} in @code{wdiff}. -Use file names of 14 characters or less, to avoid creating gratuitous -problems on System V. You can use the program @code{doschk} to test for -this. @code{doschk} also tests for potential name conflicts if the -files were loaded onto an MS-DOS file system---something you may or may -not care about. +@item no-create +@samp{-c} in @code{touch}. +@item no-defines +@samp{-D} in @code{etags}. -@node Using Extensions -@chapter Using Non-standard Features +@item no-deleted +@samp{-1} in @code{wdiff}. -Many GNU facilities that already exist support a number of convenient -extensions over the comparable Unix facilities. Whether to use these -extensions in implementing your program is a difficult question. +@item no-dereference +@samp{-d} in @code{cp}. -On the one hand, using the extensions can make a cleaner program. -On the other hand, people will not be able to build the program -unless the other GNU tools are available. This might cause the -program to work on fewer kinds of machines. +@item no-inserted +@samp{-2} in @code{wdiff}. -With some extensions, it might be easy to provide both alternatives. -For example, you can define functions with a ``keyword'' @code{INLINE} -and define that as a macro to expand into either @code{inline} or -nothing, depending on the compiler. +@item no-keep-going +@samp{-S} in Make. -In general, perhaps it is best not to use the extensions if you can -straightforwardly do without them, but to use the extensions if they -are a big improvement. +@item no-lines +@samp{-l} in Bison. -An exception to this rule are the large, established programs (such as -Emacs) which run on a great variety of systems. Such programs would -be broken by use of GNU extensions. +@item no-piping +@samp{-P} in @code{shar}. -Another exception is for programs that are used as part of -compilation: anything that must be compiled with other compilers in -order to bootstrap the GNU compilation facilities. If these require -the GNU compiler, then no one can compile them without having them -installed already. That would be no good. +@item no-prof +@samp{-e} in @code{gprof}. -Since most computer systems do not yet implement @sc{ANSI} C, using the -@sc{ANSI} C features is effectively using a GNU extension, so the -same considerations apply. (Except for @sc{ANSI} features that we -discourage, such as trigraphs---don't ever use them.) +@item no-regex +@samp{-R} in @code{etags}. +@item no-sort +@samp{-p} in @code{nm}. -@node System Functions -@chapter Calling System Functions +@item no-split +Used in @code{makeinfo}. -C implementations differ substantially. ANSI C reduces but does not -eliminate the incompatibilities; meanwhile, many users wish to compile -GNU software with pre-ANSI compilers. This chapter gives -recommendations for how to use the more or less standard C library -functions to avoid unnecessary loss of portability. +@item no-static +@samp{-a} in @code{gprof}. -@itemize @bullet -@item -Don't use the value of @code{sprintf}. It returns the number of -characters written on some systems, but not on all systems. +@item no-time +@samp{-E} in @code{gprof}. -@item -Don't declare system functions explicitly. +@item no-timestamp +@samp{-m} in @code{shar}. -Almost any declaration for a system function is wrong on some system. -To minimize conflicts, leave it to the system header files to declare -system functions. If the headers don't declare a function, let it -remain undeclared. +@item no-validate +Used in @code{makeinfo}. -While it may seem unclean to use a function without declaring it, in -practice this works fine for most system library functions on the -systems where this really happens. The problem is only theoretical. By -contrast, actual declarations have frequently caused actual conflicts. +@item no-wait +Used in @code{emacsclient}. -@item -If you must declare a system function, don't specify the argument types. -Use an old-style declaration, not an ANSI prototype. The more you -specify about the function, the more likely a conflict. +@item no-warn +Used in various programs to inhibit warnings. -@item -In particular, don't unconditionally declare @code{malloc} or -@code{realloc}. +@item node +@samp{-n} in @code{info}. -Most GNU programs use those functions just once, in functions -conventionally named @code{xmalloc} and @code{xrealloc}. These -functions call @code{malloc} and @code{realloc}, respectively, and -check the results. +@item nodename +@samp{-n} in @code{uname}. -Because @code{xmalloc} and @code{xrealloc} are defined in your program, -you can declare them in other files without any risk of type conflict. +@item nonmatching +@samp{-f} in @code{cpio}. -On most systems, @code{int} is the same length as a pointer; thus, the -calls to @code{malloc} and @code{realloc} work fine. For the few -exceptional systems (mostly 64-bit machines), you can use -@strong{conditionalized} declarations of @code{malloc} and -@code{realloc}---or put these declarations in configuration files -specific to those systems. +@item nstuff +@samp{-n} in @code{objdump}. -@item -The string functions require special treatment. Some Unix systems have -a header file @file{string.h}; other have @file{strings.h}. Neither -file name is portable. There are two things you can do: use Autoconf to -figure out which file to include, or don't include either file. +@item null +@samp{-0} in @code{xargs}. -@item -If you don't include either strings file, you can't get declarations for -the string functions from the header file in the usual way. +@item number +@samp{-n} in @code{cat}. -That causes less of a problem than you might think. The newer ANSI -string functions are off-limits anyway because many systems still don't -support them. The string functions you can use are these: +@item number-nonblank +@samp{-b} in @code{cat}. -@example -strcpy strncpy strcat strncat -strlen strcmp strncmp -strchr strrchr -@end example +@item numeric-sort +@samp{-n} in @code{nm}. -The copy and concatenate functions work fine without a declaration as -long as you don't use their values. Using their values without a -declaration fails on systems where the width of a pointer differs from -the width of @code{int}, and perhaps in other cases. It is trivial to -avoid using their values, so do that. +@item numeric-uid-gid +@samp{-n} in @code{cpio} and @code{ls}. -The compare functions and @code{strlen} work fine without a declaration -on most systems, possibly all the ones that GNU software runs on. -You may find it necessary to declare them @strong{conditionally} on a -few systems. +@item nx +Used in GDB. -The search functions must be declared to return @code{char *}. Luckily, -there is no variation in the data type they return. But there is -variation in their names. Some systems give these functions the names -@code{index} and @code{rindex}; other systems use the names -@code{strchr} and @code{strrchr}. Some systems support both pairs of -names, but neither pair works on all systems. +@item old-archive +@samp{-o} in @code{tar}. -You should pick a single pair of names and use it throughout your -program. (Nowadays, it is better to choose @code{strchr} and -@code{strrchr}.) Declare both of those names as functions returning -@code{char *}. On systems which don't support those names, define them -as macros in terms of the other pair. For example, here is what to put -at the beginning of your file (or in a header) if you want to use the -names @code{strchr} and @code{strrchr} throughout: +@item old-file +@samp{-o} in Make. -@example -#ifndef HAVE_STRCHR -#define strchr index -#endif -#ifndef HAVE_STRRCHR -#define strrchr rindex -#endif +@item one-file-system +@samp{-l} in @code{tar}, @code{cp}, and @code{du}. -char *strchr (); -char *strrchr (); -@end example -@end itemize +@item only-file +@samp{-o} in @code{ptx}. -Here we assume that @code{HAVE_STRCHR} and @code{HAVE_STRRCHR} are -macros defined in systems where the corresponding functions exist. -One way to get them properly defined is to use Autoconf. +@item only-prof +@samp{-f} in @code{gprof}. -@node Semantics -@chapter Program Behavior for All Programs +@item only-time +@samp{-F} in @code{gprof}. -Avoid arbitrary limits on the length or number of @emph{any} data -structure, including filenames, lines, files, and symbols, by allocating -all data structures dynamically. In most Unix utilities, ``long lines -are silently truncated''. This is not acceptable in a GNU utility. +@item output +In various programs, specify the output file name. -Utilities reading files should not drop NUL characters, or any other -nonprinting characters @emph{including those with codes above 0177}. The -only sensible exceptions would be utilities specifically intended for -interface to certain types of printers that can't handle those characters. +@item output-prefix +@samp{-o} in @code{shar}. -Check every system call for an error return, unless you know you wish to -ignore errors. Include the system error text (from @code{perror} or -equivalent) in @emph{every} error message resulting from a failing -system call, as well as the name of the file if any and the name of the -utility. Just ``cannot open foo.c'' or ``stat failed'' is not -sufficient. +@item override +@samp{-o} in @code{rm}. -Check every call to @code{malloc} or @code{realloc} to see if it -returned zero. Check @code{realloc} even if you are making the block -smaller; in a system that rounds block sizes to a power of 2, -@code{realloc} may get a different block if you ask for less space. +@item overwrite +@samp{-c} in @code{unshar}. -In Unix, @code{realloc} can destroy the storage block if it returns -zero. GNU @code{realloc} does not have this bug: if it fails, the -original block is unchanged. Feel free to assume the bug is fixed. If -you wish to run your program on Unix, and wish to avoid lossage in this -case, you can use the GNU @code{malloc}. +@item owner +@samp{-o} in @code{install}. -You must expect @code{free} to alter the contents of the block that was -freed. Anything you want to fetch from the block, you must fetch before -calling @code{free}. +@item paginate +@samp{-l} in @code{diff}. -Use @code{getopt_long} to decode arguments, unless the argument syntax -makes this unreasonable. +@item paragraph-indent +Used in @code{makeinfo}. -When static storage is to be written in during program execution, use -explicit C code to initialize it. Reserve C initialized declarations -for data that will not be changed. +@item parents +@samp{-p} in @code{mkdir} and @code{rmdir}. -Try to avoid low-level interfaces to obscure Unix data structures (such -as file directories, utmp, or the layout of kernel memory), since these -are less likely to work compatibly. If you need to find all the files -in a directory, use @code{readdir} or some other high-level interface. -These will be supported compatibly by GNU. +@item pass-all +@samp{-p} in @code{ul}. -By default, the GNU system will provide the signal handling functions of -@sc{BSD} and of @sc{POSIX}. So GNU software should be written to use -these. +@item pass-through +@samp{-p} in @code{cpio}. -In error checks that detect ``impossible'' conditions, just abort. -There is usually no point in printing any message. These checks -indicate the existence of bugs. Whoever wants to fix the bugs will have -to read the source code and run a debugger. So explain the problem with -comments in the source. The relevant data will be in variables, which -are easy to examine with the debugger, so there is no point moving them -elsewhere. +@item port +@samp{-P} in @code{finger}. +@item portability +@samp{-c} in @code{cpio} and @code{tar}. -@node Errors -@chapter Formatting Error Messages +@item posix +Used in @code{gawk}. -Error messages from compilers should look like this: +@item prefix-builtins +@samp{-P} in @code{m4}. -@example -@var{source-file-name}:@var{lineno}: @var{message} -@end example +@item prefix +@samp{-f} in @code{csplit}. -Error messages from other noninteractive programs should look like this: +@item preserve +Used in @code{tar} and @code{cp}. -@example -@var{program}:@var{source-file-name}:@var{lineno}: @var{message} -@end example +@item preserve-environment +@samp{-p} in @code{su}. -@noindent -when there is an appropriate source file, or like this: +@item preserve-modification-time +@samp{-m} in @code{cpio}. -@example -@var{program}: @var{message} -@end example +@item preserve-order +@samp{-s} in @code{tar}. -@noindent -when there is no relevant source file. +@item preserve-permissions +@samp{-p} in @code{tar}. -In an interactive program (one that is reading commands from a -terminal), it is better not to include the program name in an error -message. The place to indicate which program is running is in the -prompt or with the screen layout. (When the same program runs with -input from a source other than a terminal, it is not interactive and -would do best to print error messages using the noninteractive style.) +@item print +@samp{-l} in @code{diff}. -The string @var{message} should not begin with a capital letter when -it follows a program name and/or filename. Also, it should not end -with a period. +@item print-chars +@samp{-L} in @code{cmp}. -Error messages from interactive programs, and other messages such as -usage messages, should start with a capital letter. But they should not -end with a period. +@item print-data-base +@samp{-p} in Make. +@item print-directory +@samp{-w} in Make. -@node Libraries -@chapter Library Behavior +@item print-file-name +@samp{-o} in @code{nm}. -Try to make library functions reentrant. If they need to do dynamic -storage allocation, at least try to avoid any nonreentrancy aside from -that of @code{malloc} itself. +@item print-symdefs +@samp{-s} in @code{nm}. -Here are certain name conventions for libraries, to avoid name -conflicts. +@item printer +@samp{-p} in @code{wdiff}. -Choose a name prefix for the library, more than two characters long. -All external function and variable names should start with this -prefix. In addition, there should only be one of these in any given -library member. This usually means putting each one in a separate -source file. +@item prompt +@samp{-p} in @code{ed}. -An exception can be made when two external symbols are always used -together, so that no reasonable program could use one without the -other; then they can both go in the same file. +@item query-user +@samp{-X} in @code{shar}. -External symbols that are not documented entry points for the user -should have names beginning with @samp{_}. They should also contain -the chosen name prefix for the library, to prevent collisions with -other libraries. These can go in the same files with user entry -points if you like. +@item question +@samp{-q} in Make. -Static functions and variables can be used as you like and need not -fit any naming convention. +@item quiet +Used in many programs to inhibit the usual output. @strong{Note:} every +program accepting @samp{--quiet} should accept @samp{--silent} as a +synonym. +@item quiet-unshar +@samp{-Q} in @code{shar} -@node Portability -@chapter Portability As It Applies to GNU +@item quote-name +@samp{-Q} in @code{ls}. -Much of what is called ``portability'' in the Unix world refers to -porting to different Unix versions. This is a secondary consideration -for GNU software, because its primary purpose is to run on top of one -and only one kernel, the GNU kernel, compiled with one and only one C -compiler, the GNU C compiler. The amount and kinds of variation among -GNU systems on different cpu's will be like the variation among Berkeley -4.3 systems on different cpu's. - -All users today run GNU software on non-GNU systems. So supporting a -variety of non-GNU systems is desirable; simply not paramount. -The easiest way to achieve portability to a reasonable range of systems -is to use Autoconf. It's unlikely that your program needs to know more -information about the host machine than Autoconf can provide, simply -because most of the programs that need such knowledge have already been -written. +@item rcs +@samp{-n} in @code{diff}. -It is difficult to be sure exactly what facilities the GNU kernel -will provide, since it isn't finished yet. Therefore, assume you can -use anything in 4.3; just avoid using the format of semi-internal data -bases (e.g., directories) when there is a higher-level alternative -(@code{readdir}). - -You can freely assume any reasonably standard facilities in the C -language, libraries or kernel, because we will find it necessary to -support these facilities in the full GNU system, whether or not we -have already done so. The fact that there may exist kernels or C -compilers that lack these facilities is irrelevant as long as the GNU -kernel and C compiler support them. - -It remains necessary to worry about differences among cpu types, such -as the difference in byte ordering and alignment restrictions. It's -unlikely that 16-bit machines will ever be supported by GNU, so there -is no point in spending any time to consider the possibility that an -int will be less than 32 bits. - -You can assume that all pointers have the same format, regardless -of the type they point to, and that this is really an integer. -There are some weird machines where this isn't true, but they aren't -important; don't waste time catering to them. Besides, eventually -we will put function prototypes into all GNU programs, and that will -probably make your program work even on weird machines. - -Since some important machines (including the 68000) are big-endian, -it is important not to assume that the address of an @code{int} object -is also the address of its least-significant byte. Thus, don't -make the following mistake: +@item re-interval +Used in @code{gawk}. -@example -int c; -@dots{} -while ((c = getchar()) != EOF) - write(file_descriptor, &c, 1); -@end example +@item read-full-blocks +@samp{-B} in @code{tar}. -You can assume that it is reasonable to use a meg of memory. Don't -strain to reduce memory usage unless it can get to that level. If -your program creates complicated data structures, just make them in -core and give a fatal error if malloc returns zero. +@item readnow +Used in GDB. -If a program works by lines and could be applied to arbitrary -user-supplied input files, it should keep only a line in memory, because -this is not very hard and users will want to be able to operate on input -files that are bigger than will fit in core all at once. +@item recon +@samp{-n} in Make. +@item record-number +@samp{-R} in @code{tar}. -@node User Interfaces -@chapter Standards for Command Line Interfaces +@item recursive +Used in @code{chgrp}, @code{chown}, @code{cp}, @code{ls}, @code{diff}, +and @code{rm}. -Please don't make the behavior of a utility depend on the name used -to invoke it. It is useful sometimes to make a link to a utility -with a different name, and that should not change what it does. +@item reference-limit +Used in @code{makeinfo}. -Instead, use a run time option or a compilation switch or both -to select among the alternate behaviors. +@item references +@samp{-r} in @code{ptx}. -Likewise, please don't make the behavior of the program depend on the -type of output device it is used with. Device independence is an -important principle of the system's design; do not compromise it -merely to save someone from typing an option now and then. +@item regex +@samp{-r} in @code{tac} and @code{etags}. -If you think one behavior is most useful when the output is to a -terminal, and another is most useful when the output is a file or a -pipe, then it is usually best to make the default behavior the one that -is useful with output to a terminal, and have an option for the other -behavior. +@item release +@samp{-r} in @code{uname}. -Compatibility requires certain programs to depend on the type of output -device. It would be disastrous if @code{ls} or @code{sh} did not do so -in the way all users expect. In some of these cases, we supplement the -program with a preferred alternate version that does not depend on the -output device type. For example, we provide a @code{dir} program much -like @code{ls} except that its default output format is always -multi-column format. +@item reload-state +@samp{-R} in @code{m4}. -It is a good idea to follow the @sc{POSIX} guidelines for the -command-line options of a program. The easiest way to do this is to use -@code{getopt} to parse them. Note that the GNU version of @code{getopt} -will normally permit options anywhere among the arguments unless the -special argument @samp{--} is used. This is not what @sc{POSIX} -specifies; it is a GNU extension. +@item relocation +@samp{-r} in @code{objdump}. -Please define long-named options that are equivalent to the -single-letter Unix-style options. We hope to make GNU more user -friendly this way. This is easy to do with the GNU function -@code{getopt_long}. +@item rename +@samp{-r} in @code{cpio}. -One of the advantages of long-named options is that they can be -consistent from program to program. For example, users should be able -to expect the ``verbose'' option of any GNU program which has one, to be -spelled precisely @samp{--verbose}. To achieve this uniformity, look at -the table of common long-option names when you choose the option names -for your program. The table appears below. +@item replace +@samp{-i} in @code{xargs}. -If you use names not already in the table, please send -@samp{gnu@@prep.ai.mit.edu} a list of them, with their meanings, so we -can update the table. - -It is usually a good idea for file names given as ordinary arguments -to be input files only; any output files would be specified using -options (preferably @samp{-o}). Even if you allow an output file name -as an ordinary argument for compatibility, try to provide a suitable -option as well. This will lead to more consistency among GNU -utilities, so that there are fewer idiosyncracies for users to -remember. - -Programs should support an option @samp{--version} which prints the -program's version number on standard output and exits successfully, and -an option @samp{--help} which prints option usage information on -standard output and exits successfully. These options should inhibit -the normal function of the command; they should do nothing except print -the requested information. +@item report-identical-files +@samp{-s} in @code{diff}. -@c Please leave newlines between items in this table; it's much easier -@c to update when it isn't completely squashed together and unreadable. -@c When there is more than one short option for a long option name, put -@c a semicolon between the lists of the programs that use them, not a -@c period. --friedman +@item reset-access-time +@samp{-a} in @code{cpio}. -@table @samp +@item reverse +@samp{-r} in @code{ls} and @code{nm}. -@item auto-check -@samp{-a} in @code{recode}. +@item reversed-ed +@samp{-f} in @code{diff}. -@item auto-reference -@samp{-A} in @code{ptx}. +@item right-side-defs +@samp{-R} in @code{ptx}. -@item after-date -@samp{-N} in @code{tar}. +@item same-order +@samp{-s} in @code{tar}. -@item all -@samp{-a} in @code{du}, @code{ls}, @code{nm}, @code{stty}, @code{uname}, -and @code{unexpand}. +@item same-permissions +@samp{-p} in @code{tar}. + +@item save +@samp{-g} in @code{stty}. -@item all-text -@samp{-a} in @code{diff}. +@item se +Used in GDB. -@item almost-all -@samp{-A} in @code{ls}. +@item sentence-regexp +@samp{-S} in @code{ptx}. -@item append -@samp{-a} in @code{etags}, @code{tee}, @code{time}; -@samp{-r} in @code{tar}. +@item separate-dirs +@samp{-S} in @code{du}. -@item archive -@samp{-a} in @code{cp}. +@item separator +@samp{-s} in @code{tac}. -@item arglength -@samp{-l} in @code{m4}. +@item sequence +Used by @code{recode} to chose files or pipes for sequencing passes. -@item ascii -@samp{-a} in @code{diff}. +@item shell +@samp{-s} in @code{su}. -@item assume-new -@samp{-W} in Make. +@item show-all +@samp{-A} in @code{cat}. -@item assume-old -@samp{-o} in Make. +@item show-c-function +@samp{-p} in @code{diff}. -@item backward-search -@samp{-B} in etags. +@item show-ends +@samp{-E} in @code{cat}. -@item batch -Used in GDB. +@item show-function-line +@samp{-F} in @code{diff}. -@item baud -Used in GDB. +@item show-tabs +@samp{-T} in @code{cat}. -@item before -@samp{-b} in @code{tac}. +@item silent +Used in many programs to inhibit the usual output. +@strong{Note:} every program accepting +@samp{--silent} should accept @samp{--quiet} as a synonym. -@item binary -@samp{-b} in @code{cpio} and @code{diff}. +@item size +@samp{-s} in @code{ls}. -@item block-size -Used in @code{cpio} and @code{tar}. +@item sort +Used in @code{ls}. -@item blocks -@samp{-b} in @code{head} and @code{tail}. +@item source +@samp{-W source} in @code{gawk}. -@item break-file -@samp{-b} in @code{ptx}. +@item sparse +@samp{-S} in @code{tar}. -@item brief -Used in various programs to make output shorter. +@item speed-large-files +@samp{-H} in @code{diff}. -@item bytes -@samp{-c} in @code{head}, @code{split}, and @code{tail}. +@item split-at +@samp{-E} in @code{unshar}. -@item c++ -@samp{-C} in @code{etags}. +@item split-size-limit +@samp{-L} in @code{shar}. -@item catenate -@samp{-A} in @code{tar}. +@item squeeze-blank +@samp{-s} in @code{cat}. -@item cd -Used in various programs to specify the directory to use. +@item start-delete +@samp{-w} in @code{wdiff}. -@item changes -@samp{-c} in @code{chgrp} and @code{chown}. +@item start-insert +@samp{-y} in @code{wdiff}. -@item classify -@samp{-F} in @code{ls}. +@item starting-file +Used in @code{tar} and @code{diff} to specify which file within +a directory to start processing with. -@item colons -@samp{-c} in @code{recode}. +@item statistics +@samp{-s} in @code{wdiff}. -@item command -@samp{-c} in @code{su}; -@samp{-x} in GDB. +@item stdin-file-list +@samp{-S} in @code{shar}. -@item compare -@samp{-d} in @code{tar}. +@item stop +@samp{-S} in Make. -@item compress -@samp{-Z} in @code{tar}. +@item strict +@samp{-s} in @code{recode}. -@item concatenate -@samp{-A} in @code{tar}. +@item strip +@samp{-s} in @code{install}. -@item confirmation -@samp{-w} in @code{tar}. +@item strip-all +@samp{-s} in @code{strip}. -@item context -Used in @code{diff}. +@item strip-debug +@samp{-S} in @code{strip}. -@item copyright -@samp{-C} in @code{ptx} and @code{recode}. +@item submitter +@samp{-s} in @code{shar}. -@item core -Used in GDB. +@item suffix +@samp{-S} in @code{cp}, @code{ln}, @code{mv}. -@item count -@samp{-q} in @code{who}. +@item suffix-format +@samp{-b} in @code{csplit}. -@item count-links -@samp{-l} in @code{du}. +@item sum +@samp{-s} in @code{gprof}. -@item create -Used in @code{tar} and @code{cpio}. +@item summarize +@samp{-s} in @code{du}. -@item cxref -@samp{-x} in @code{etags}. +@item symbolic +@samp{-s} in @code{ln}. -@item date -@samp{-d} in @code{touch}. +@item symbols +Used in GDB and @code{objdump}. -@item debug -@samp{-d} in Make and @code{m4}; -@samp{-t} in Bison. +@item synclines +@samp{-s} in @code{m4}. -@item define -@samp{-D} in @code{m4}. +@item sysname +@samp{-s} in @code{uname}. -@item defines -@samp{-d} in Bison and @code{etags}. +@item tabs +@samp{-t} in @code{expand} and @code{unexpand}. -@item delete -@samp{-D} in @code{tar}. +@item tabsize +@samp{-T} in @code{ls}. -@item dereference -@samp{-L} in @code{chgrp}, @code{chown}, @code{cpio}, @code{du}, -@code{ls}, and @code{tar}. +@item terminal +@samp{-T} in @code{tput} and @code{ul}. +@samp{-t} in @code{wdiff}. -@item dereference-args -@samp{-D} in @code{du}. +@item text +@samp{-a} in @code{diff}. -@item diacritics -@samp{-d} in @code{recode}. +@item text-files +@samp{-T} in @code{shar}. -@item dictionary-order -@samp{-d} in @code{look}. +@item time +Used in @code{ls} and @code{touch}. -@item diff -@samp{-d} in @code{tar}. +@item to-stdout +@samp{-O} in @code{tar}. -@item digits -@samp{-n} in @code{csplit}. +@item total +@samp{-c} in @code{du}. -@item directory -Specify the directory to use, in various programs. In @code{ls}, it -means to show directories themselves rather than their contents. In -@code{rm} and @code{ln}, it means to not treat links to directories -specially. +@item touch +@samp{-t} in Make, @code{ranlib}, and @code{recode}. -@item discard-all -@samp{-x} in @code{strip}. +@item trace +@samp{-t} in @code{m4}. -@item discard-locals -@samp{-X} in @code{strip}. +@item traditional +@samp{-t} in @code{hello}; +@samp{-W traditional} in @code{gawk}; +@samp{-G} in @code{ed}, @code{m4}, and @code{ptx}. -@item diversions -@samp{-N} in @code{m4}. +@item tty +Used in GDB. -@item dry-run -@samp{-n} in Make. +@item typedefs +@samp{-t} in @code{ctags}. -@item ed -@samp{-e} in @code{diff}. +@item typedefs-and-c++ +@samp{-T} in @code{ctags}. -@item elide-empty-files -@samp{-z} in @code{csplit}. +@item typeset-mode +@samp{-t} in @code{ptx}. -@item entire-new-file -@samp{-N} in @code{diff}. +@item uncompress +@samp{-z} in @code{tar}. -@item environment-overrides -@samp{-e} in Make. +@item unconditional +@samp{-u} in @code{cpio}. -@item eof -@samp{-e} in @code{xargs}. +@item undefine +@samp{-U} in @code{m4}. -@item epoch -Used in GDB. +@item undefined-only +@samp{-u} in @code{nm}. -@item error-limit -Used in Makeinfo. +@item update +@samp{-u} in @code{cp}, @code{ctags}, @code{mv}, @code{tar}. -@item error-output -@samp{-o} in @code{m4}. +@item usage +Used in @code{gawk}; same as @samp{--help}. -@item escape -@samp{-b} in @code{ls}. +@item uuencode +@samp{-B} in @code{shar}. -@item exclude-from -@samp{-X} in @code{tar}. +@item vanilla-operation +@samp{-V} in @code{shar}. -@item exec -Used in GDB. +@item verbose +Print more information about progress. Many programs support this. -@item exit -@samp{-x} in @code{xargs}. +@item verify +@samp{-W} in @code{tar}. -@item expand-tabs -@samp{-t} in @code{diff}. +@item version +Print the version number. -@item expression -@samp{-e} in @code{sed}. +@item version-control +@samp{-V} in @code{cp}, @code{ln}, @code{mv}. -@item extern-only -@samp{-g} in @code{nm}. +@item vgrind +@samp{-v} in @code{ctags}. -@item extract -@samp{-i} in @code{cpio}; -@samp{-x} in @code{tar}. +@item volume +@samp{-V} in @code{tar}. -@item faces -@samp{-f} in @code{finger}. +@item what-if +@samp{-W} in Make. -@item fast -@samp{-f} in @code{su}. +@item whole-size-limit +@samp{-l} in @code{shar}. -@item file -@samp{-f} in @code{info}, Make, @code{mt}, and @code{tar}; -@samp{-n} in @code{sed}; -@samp{-r} in @code{touch}. +@item width +@samp{-w} in @code{ls} and @code{ptx}. -@item file-prefix -@samp{-b} in Bison. +@item word-regexp +@samp{-W} in @code{ptx}. -@item file-type -@samp{-F} in @code{ls}. +@item writable +@samp{-T} in @code{who}. -@item files-from -@samp{-T} in @code{tar}. +@item zeros +@samp{-z} in @code{gprof}. +@end table -@item fill-column -Used in Makeinfo. +@node Memory Usage +@section Memory Usage -@item flag-truncation -@samp{-F} in @code{ptx}. +If it typically uses just a few meg of memory, don't bother making any +effort to reduce memory usage. For example, if it is impractical for +other reasons to operate on files more than a few meg long, it is +reasonable to read entire input files into core to operate on them. + +However, for programs such as @code{cat} or @code{tail}, that can +usefully operate on very large files, it is important to avoid using a +technique that would artificially limit the size of files it can handle. +If a program works by lines and could be applied to arbitrary +user-supplied input files, it should keep only a line in memory, because +this is not very hard and users will want to be able to operate on input +files that are bigger than will fit in core all at once. -@item fixed-output-files -@samp{-y} in Bison. +If your program creates complicated data structures, just make them in +core and give a fatal error if @code{malloc} returns zero. -@item follow -@samp{-f} in @code{tail}. +@node Writing C +@chapter Making The Best Use of C -@item footnote-style -Used in Makeinfo. +This @value{CHAPTER} provides advice on how best to use the C language +when writing GNU software. -@item force -@samp{-f} in @code{cp}, @code{ln}, @code{mv}, and @code{rm}. +@menu +* Formatting:: Formatting Your Source Code +* Comments:: Commenting Your Work +* Syntactic Conventions:: Clean Use of C Constructs +* Names:: Naming Variables and Functions +* System Portability:: Portability between different operating systems +* CPU Portability:: Supporting the range of CPU types +* System Functions:: Portability and ``standard'' library functions +* Internationalization:: Techniques for internationalization +* Mmap:: How you can safely use @code{mmap}. +@end menu -@item format -Used in @code{ls}, @code{time}, and @code{ptx}. +@node Formatting +@section Formatting Your Source Code -@item forward-search -@samp{-F} in @code{etags}. +It is important to put the open-brace that starts the body of a C +function in column zero, and avoid putting any other open-brace or +open-parenthesis or open-bracket in column zero. Several tools look +for open-braces in column zero to find the beginnings of C functions. +These tools will not work on code not formatted that way. -@item fullname -Used in GDB. +It is also important for function definitions to start the name of the +function in column zero. This helps people to search for function +definitions, and may also help certain tools recognize them. Thus, +the proper format is this: -@item gap-size -@samp{-g} in @code{ptx}. +@example +static char * +concat (s1, s2) /* Name starts in column zero here */ + char *s1, *s2; +@{ /* Open brace in column zero here */ + @dots{} +@} +@end example -@item get -@samp{-x} in @code{tar}. +@noindent +or, if you want to use @sc{ansi} C, format the definition like this: -@item graphic -@samp{-i} in @code{ul}. +@example +static char * +concat (char *s1, char *s2) +@{ + @dots{} +@} +@end example -@item graphics -@samp{-g} in @code{recode}. +In @sc{ansi} C, if the arguments don't fit nicely on one line, +split it like this: -@item group -@samp{-g} in @code{install}. +@example +int +lots_of_args (int an_integer, long a_long, short a_short, + double a_double, float a_float) +@dots{} +@end example -@item gzip -@samp{-z} in @code{tar}. +For the body of the function, we prefer code formatted like this: -@item hashsize -@samp{-H} in @code{m4}. +@example +if (x < foo (y, z)) + haha = bar[4] + 5; +else + @{ + while (z) + @{ + haha += foo (z, z); + z--; + @} + return ++x + bar (); + @} +@end example -@item header -@samp{-h} in @code{objdump} and @code{recode} +We find it easier to read a program when it has spaces before the +open-parentheses and after the commas. Especially after the commas. -@item heading -@samp{-H} in @code{who}. +When you split an expression into multiple lines, split it +before an operator, not after one. Here is the right way: -@item help -Used to ask for brief usage information. +@example +if (foo_this_is_long && bar > win (x, y, z) + && remaining_condition) +@end example -@item hide-control-chars -@samp{-q} in @code{ls}. +Try to avoid having two operators of different precedence at the same +level of indentation. For example, don't write this: -@item idle -@samp{-u} in @code{who}. +@example +mode = (inmode[j] == VOIDmode + || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]) + ? outmode[j] : inmode[j]); +@end example -@item ifdef -@samp{-D} in @code{diff}. +Instead, use extra parentheses so that the indentation shows the nesting: -@item ignore -@samp{-I} in @code{ls}; -@samp{-x} in @code{recode}. +@example +mode = ((inmode[j] == VOIDmode + || (GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]))) + ? outmode[j] : inmode[j]); +@end example -@item ignore-all-space -@samp{-w} in @code{diff}. +Insert extra parentheses so that Emacs will indent the code properly. +For example, the following indentation looks nice if you do it by hand, +but Emacs would mess it up: -@item ignore-backups -@samp{-B} in @code{ls}. +@example +v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 + + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000; +@end example -@item ignore-blank-lines -@samp{-B} in @code{diff}. +But adding a set of parentheses solves the problem: -@item ignore-case -@samp{-f} in @code{look} and @code{ptx}; -@samp{-i} in @code{diff}. +@example +v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 + + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000); +@end example -@item ignore-errors -@samp{-i} in Make. +Format do-while statements like this: -@item ignore-file -@samp{-i} in @code{ptx}. +@example +do + @{ + a = foo (a); + @} +while (a > 0); +@end example -@item ignore-indentation -@samp{-S} in @code{etags}. +Please use formfeed characters (control-L) to divide the program into +pages at logical places (but not within a function). It does not matter +just how long the pages are, since they do not have to fit on a printed +page. The formfeeds should appear alone on lines by themselves. -@item ignore-init-file -@samp{-f} in Oleo. -@item ignore-interrupts -@samp{-i} in @code{tee}. +@node Comments +@section Commenting Your Work -@item ignore-matching-lines -@samp{-I} in @code{diff}. +Every program should start with a comment saying briefly what it is for. +Example: @samp{fmt - filter for simple filling of text}. -@item ignore-space-change -@samp{-b} in @code{diff}. +Please write the comments in a GNU program in English, because English +is the one language that nearly all programmers in all countries can +read. If you do not write English well, please write comments in +English as well as you can, then ask other people to help rewrite them. +If you can't write comments in English, please find someone to work with +you and translate your comments into English. -@item ignore-zeros -@samp{-i} in @code{tar}. +Please put a comment on each function saying what the function does, +what sorts of arguments it gets, and what the possible values of +arguments mean and are used for. It is not necessary to duplicate in +words the meaning of the C argument declarations, if a C type is being +used in its customary fashion. If there is anything nonstandard about +its use (such as an argument of type @code{char *} which is really the +address of the second character of a string, not the first), or any +possible values that would not work the way one would expect (such as, +that strings containing newlines are not guaranteed to work), be sure +to say so. -@item include -@samp{-i} in @code{etags}; -@samp{-I} in @code{m4}. +Also explain the significance of the return value, if there is one. -@item include-dir -@samp{-I} in Make. +Please put two spaces after the end of a sentence in your comments, so +that the Emacs sentence commands will work. Also, please write +complete sentences and capitalize the first word. If a lower-case +identifier comes at the beginning of a sentence, don't capitalize it! +Changing the spelling makes it a different identifier. If you don't +like starting a sentence with a lower case letter, write the sentence +differently (e.g., ``The identifier lower-case is @dots{}''). -@item incremental -@samp{-G} in @code{tar}. +The comment on a function is much clearer if you use the argument +names to speak about the argument values. The variable name itself +should be lower case, but write it in upper case when you are speaking +about the value rather than the variable itself. Thus, ``the inode +number NODE_NUM'' rather than ``an inode''. -@item info -@samp{-i}, @samp{-l}, and @samp{-m} in Finger. +There is usually no purpose in restating the name of the function in +the comment before it, because the reader can see that for himself. +There might be an exception when the comment is so long that the function +itself would be off the bottom of the screen. -@item initial -@samp{-i} in @code{expand}. +There should be a comment on each static variable as well, like this: -@item initial-tab -@samp{-T} in @code{diff}. +@example +/* Nonzero means truncate lines in the display; + zero means continue them. */ +int truncate_lines; +@end example -@item inode -@samp{-i} in @code{ls}. +Every @samp{#endif} should have a comment, except in the case of short +conditionals (just a few lines) that are not nested. The comment should +state the condition of the conditional that is ending, @emph{including +its sense}. @samp{#else} should have a comment describing the condition +@emph{and sense} of the code that follows. For example: -@item interactive -@samp{-i} in @code{cp}, @code{ln}, @code{mv}, @code{rm}; -@samp{-e} in @code{m4}; -@samp{-p} in @code{xargs}; -@samp{-w} in @code{tar}. +@example +@group +#ifdef foo + @dots{} +#else /* not foo */ + @dots{} +#endif /* not foo */ +@end group +@end example -@item jobs -@samp{-j} in Make. +@noindent +but, by contrast, write the comments this way for a @samp{#ifndef}: -@item just-print -@samp{-n} in Make. +@example +@group +#ifndef foo + @dots{} +#else /* foo */ + @dots{} +#endif /* foo */ +@end group +@end example -@item keep-going -@samp{-k} in Make. -@item keep-files -@samp{-k} in @code{csplit}. +@node Syntactic Conventions +@section Clean Use of C Constructs -@item kilobytes -@samp{-k} in @code{du} and @code{ls}. +Please explicitly declare all arguments to functions. +Don't omit them just because they are @code{int}s. -@item line-bytes -@samp{-C} in @code{split}. +Declarations of external functions and functions to appear later in the +source file should all go in one place near the beginning of the file +(somewhere before the first function definition in the file), or else +should go in a header file. Don't put @code{extern} declarations inside +functions. -@item lines -Used in @code{split}, @code{head}, and @code{tail}. +It used to be common practice to use the same local variables (with +names like @code{tem}) over and over for different values within one +function. Instead of doing this, it is better declare a separate local +variable for each distinct purpose, and give it a name which is +meaningful. This not only makes programs easier to understand, it also +facilitates optimization by good compilers. You can also move the +declaration of each local variable into the smallest scope that includes +all its uses. This makes the program even cleaner. -@item link -@samp{-l} in @code{cpio}. +Don't use local variables or parameters that shadow global identifiers. -@item list -@samp{-t} in @code{cpio}; -@samp{-l} in @code{recode}. +Don't declare multiple variables in one declaration that spans lines. +Start a new declaration on each line, instead. For example, instead +of this: -@item list -@samp{-t} in @code{tar}. +@example +@group +int foo, + bar; +@end group +@end example -@item literal -@samp{-N} in @code{ls}. +@noindent +write either this: -@item load-average -@samp{-l} in Make. +@example +int foo, bar; +@end example -@item login -Used in @code{su}. +@noindent +or this: -@item machine -No listing of which programs already use this; -someone should check to -see if any actually do and tell @code{gnu@@prep.ai.mit.edu}. +@example +int foo; +int bar; +@end example -@item macro-name -@samp{-M} in @code{ptx}. +@noindent +(If they are global variables, each should have a comment preceding it +anyway.) -@item mail -@samp{-m} in @code{hello} and @code{uname}. +When you have an @code{if}-@code{else} statement nested in another +@code{if} statement, always put braces around the @code{if}-@code{else}. +Thus, never write like this: -@item make-directories -@samp{-d} in @code{cpio}. +@example +if (foo) + if (bar) + win (); + else + lose (); +@end example -@item makefile -@samp{-f} in Make. +@noindent +always like this: -@item mapped -Used in GDB. +@example +if (foo) + @{ + if (bar) + win (); + else + lose (); + @} +@end example -@item max-args -@samp{-n} in @code{xargs}. +If you have an @code{if} statement nested inside of an @code{else} +statement, either write @code{else if} on one line, like this, -@item max-chars -@samp{-n} in @code{xargs}. +@example +if (foo) + @dots{} +else if (bar) + @dots{} +@end example -@item max-lines -@samp{-l} in @code{xargs}. +@noindent +with its @code{then}-part indented like the preceding @code{then}-part, +or write the nested @code{if} within braces like this: -@item max-load -@samp{-l} in Make. +@example +if (foo) + @dots{} +else + @{ + if (bar) + @dots{} + @} +@end example -@item max-procs -@samp{-P} in @code{xargs}. +Don't declare both a structure tag and variables or typedefs in the +same declaration. Instead, declare the structure tag separately +and then use it to declare the variables or typedefs. -@item mesg -@samp{-T} in @code{who}. +Try to avoid assignments inside @code{if}-conditions. For example, +don't write this: -@item message -@samp{-T} in @code{who}. +@example +if ((foo = (char *) malloc (sizeof *foo)) == 0) + fatal ("virtual memory exhausted"); +@end example -@item minimal -@samp{-d} in @code{diff}. +@noindent +instead, write this: -@item mode -@samp{-m} in @code{install}, @code{mkdir}, and @code{mkfifo}. +@example +foo = (char *) malloc (sizeof *foo); +if (foo == 0) + fatal ("virtual memory exhausted"); +@end example -@item modification-time -@samp{-m} in @code{tar}. +Don't make the program ugly to placate @code{lint}. Please don't insert any +casts to @code{void}. Zero without a cast is perfectly fine as a null +pointer constant, except when calling a varargs function. -@item multi-volume -@samp{-M} in @code{tar}. +@node Names +@section Naming Variables and Functions -@item name-prefix -@samp{-a} in Bison. +The names of global variables and functions in a program serve as +comments of a sort. So don't choose terse names---instead, look for +names that give useful information about the meaning of the variable or +function. In a GNU program, names should be English, like other +comments. -@item new-file -@samp{-W} in Make. +Local variable names can be shorter, because they are used only within +one context, where (presumably) comments explain their purpose. -@item no-builtin-rules -@samp{-r} in Make. +Please use underscores to separate words in a name, so that the Emacs +word commands can be useful within them. Stick to lower case; reserve +upper case for macros and @code{enum} constants, and for name-prefixes +that follow a uniform convention. -@item no-create -@samp{-c} in @code{touch}. +For example, you should use names like @code{ignore_space_change_flag}; +don't use names like @code{iCantReadThis}. -@item no-defines -@samp{-D} in @code{etags}. +Variables that indicate whether command-line options have been +specified should be named after the meaning of the option, not after +the option-letter. A comment should state both the exact meaning of +the option and its letter. For example, -@item no-dereference -@samp{-d} in @code{cp}. +@example +@group +/* Ignore changes in horizontal whitespace (-b). */ +int ignore_space_change_flag; +@end group +@end example -@item no-keep-going -@samp{-S} in Make. +When you want to define names with constant integer values, use +@code{enum} rather than @samp{#define}. GDB knows about enumeration +constants. -@item no-lines -@samp{-l} in Bison. +Use file names of 14 characters or less, to avoid creating gratuitous +problems on older System V systems. You can use the program +@code{doschk} to test for this. @code{doschk} also tests for potential +name conflicts if the files were loaded onto an MS-DOS file +system---something you may or may not care about. + +@node System Portability +@section Portability between System Types + +In the Unix world, ``portability'' refers to porting to different Unix +versions. For a GNU program, this kind of portability is desirable, but +not paramount. + +The primary purpose of GNU software is to run on top of the GNU kernel, +compiled with the GNU C compiler, on various types of @sc{cpu}. The +amount and kinds of variation among GNU systems on different @sc{cpu}s +will be comparable to the variation among Linux-based GNU systems or +among BSD systems today. So the kinds of portability that are absolutely +necessary are quite limited. + +But many users do run GNU software on non-GNU Unix or Unix-like systems. +So supporting a variety of Unix-like systems is desirable, although not +paramount. + +The easiest way to achieve portability to most Unix-like systems is to +use Autoconf. It's unlikely that your program needs to know more +information about the host platform than Autoconf can provide, simply +because most of the programs that need such knowledge have already been +written. -@item no-prof -@samp{-e} in @code{gprof}. +Avoid using the format of semi-internal data bases (e.g., directories) +when there is a higher-level alternative (@code{readdir}). -@item no-sort -@samp{-p} in @code{nm}. +As for systems that are not like Unix, such as MSDOS, Windows, the +Macintosh, VMS, and MVS, supporting them is usually so much work that it +is better if you don't. + +The planned GNU kernel is not finished yet, but you can tell which +facilities it will provide by looking at the GNU C Library Manual. The +GNU kernel is based on Mach, so the features of Mach will also be +available. However, if you use Mach features, you'll probably have +trouble debugging your program today. + +@node CPU Portability +@section Portability between @sc{cpu}s + +Even GNU systems will differ because of differences among @sc{cpu} +types---for example, difference in byte ordering and alignment +requirements. It is absolutely essential to handle these differences. +However, don't make any effort to cater to the possibility that an +@code{int} will be less than 32 bits. We don't support 16-bit machines +in GNU. + +Don't assume that the address of an @code{int} object is also the +address of its least-significant byte. This is false on big-endian +machines. Thus, don't make the following mistake: -@item no-split -Used in Makeinfo. +@example +int c; +@dots{} +while ((c = getchar()) != EOF) + write(file_descriptor, &c, 1); +@end example -@item no-static -@samp{-a} in @code{gprof}. +When calling functions, you need not worry about the difference between +pointers of various types, or between pointers and integers. On most +machines, there's no difference anyway. As for the few machines where +there is a difference, all of them support @sc{ansi} C, so you can use +prototypes (conditionalized to be active only in @sc{ansi} C) to make +the code work on those systems. -@item no-time -@samp{-E} in @code{gprof}. +In certain cases, it is ok to pass integer and pointer arguments +indiscriminately to the same function, and use no prototype on any +system. For example, many GNU programs have error-reporting functions +that pass their arguments along to @code{printf} and friends: -@item no-validate -Used in Makeinfo. +@example +error (s, a1, a2, a3) + char *s; + int a1, a2, a3; +@{ + fprintf (stderr, "error: "); + fprintf (stderr, s, a1, a2, a3); +@} +@end example -@item no-warn -Used in various programs to inhibit warnings. +@noindent +In practice, this works on all machines, and it is much simpler than any +``correct'' alternative. Be sure @emph{not} to use a prototype +for such functions. + +However, avoid casting pointers to integers unless you really need to. +These assumptions really reduce portability, and in most programs they +are easy to avoid. In the cases where casting pointers to integers is +essential---such as, a Lisp interpreter which stores type information as +well as an address in one word---it is ok to do so, but you'll have to +make explicit provisions to handle different word sizes. -@item node -@samp{-n} in @code{info}. +@node System Functions +@section Calling System Functions -@item nodename -@samp{-n} in @code{uname}. +C implementations differ substantially. @sc{ansi} C reduces but does not +eliminate the incompatibilities; meanwhile, many users wish to compile +GNU software with pre-@sc{ansi} compilers. This chapter gives +recommendations for how to use the more or less standard C library +functions to avoid unnecessary loss of portability. -@item nonmatching -@samp{-f} in @code{cpio}. +@itemize @bullet +@item +Don't use the value of @code{sprintf}. It returns the number of +characters written on some systems, but not on all systems. -@item nstuff -@samp{-n} in @code{objdump}. +@item +@code{main} should be declared to return type @code{int}. It should +terminate either by calling @code{exit} or by returning the integer +status code; make sure it cannot ever return an undefined value. -@item null -@samp{-0} in @code{xargs}. +@item +Don't declare system functions explicitly. -@item number -@samp{-n} in @code{cat}. +Almost any declaration for a system function is wrong on some system. +To minimize conflicts, leave it to the system header files to declare +system functions. If the headers don't declare a function, let it +remain undeclared. -@item number-nonblank -@samp{-b} in @code{cat}. +While it may seem unclean to use a function without declaring it, in +practice this works fine for most system library functions on the +systems where this really happens; thus, the disadvantage is only +theoretical. By contrast, actual declarations have frequently caused +actual conflicts. -@item numeric-sort -@samp{-n} in @code{nm}. +@item +If you must declare a system function, don't specify the argument types. +Use an old-style declaration, not an @sc{ansi} prototype. The more you +specify about the function, the more likely a conflict. -@item numeric-uid-gid -@samp{-n} in @code{cpio} and @code{ls}. +@item +In particular, don't unconditionally declare @code{malloc} or +@code{realloc}. -@item nx -Used in GDB. +Most GNU programs use those functions just once, in functions +conventionally named @code{xmalloc} and @code{xrealloc}. These +functions call @code{malloc} and @code{realloc}, respectively, and +check the results. -@item old-archive -@samp{-o} in @code{tar}. +Because @code{xmalloc} and @code{xrealloc} are defined in your program, +you can declare them in other files without any risk of type conflict. -@item old-file -@samp{-o} in Make. +On most systems, @code{int} is the same length as a pointer; thus, the +calls to @code{malloc} and @code{realloc} work fine. For the few +exceptional systems (mostly 64-bit machines), you can use +@strong{conditionalized} declarations of @code{malloc} and +@code{realloc}---or put these declarations in configuration files +specific to those systems. -@item one-file-system -@samp{-l} in @code{tar}, @code{cp}, and @code{du}. +@item +The string functions require special treatment. Some Unix systems have +a header file @file{string.h}; others have @file{strings.h}. Neither +file name is portable. There are two things you can do: use Autoconf to +figure out which file to include, or don't include either file. -@item only-file -@samp{-o} in @code{ptx}. +@item +If you don't include either strings file, you can't get declarations for +the string functions from the header file in the usual way. -@item only-prof -@samp{-f} in @code{gprof}. +That causes less of a problem than you might think. The newer @sc{ansi} +string functions should be avoided anyway because many systems still +don't support them. The string functions you can use are these: -@item only-time -@samp{-F} in @code{gprof}. +@example +strcpy strncpy strcat strncat +strlen strcmp strncmp +strchr strrchr +@end example -@item output -In various programs, specify the output file name. +The copy and concatenate functions work fine without a declaration as +long as you don't use their values. Using their values without a +declaration fails on systems where the width of a pointer differs from +the width of @code{int}, and perhaps in other cases. It is trivial to +avoid using their values, so do that. -@item override -@samp{-o} in @code{rm}. +The compare functions and @code{strlen} work fine without a declaration +on most systems, possibly all the ones that GNU software runs on. +You may find it necessary to declare them @strong{conditionally} on a +few systems. -@item owner -@samp{-o} in @code{install}. +The search functions must be declared to return @code{char *}. Luckily, +there is no variation in the data type they return. But there is +variation in their names. Some systems give these functions the names +@code{index} and @code{rindex}; other systems use the names +@code{strchr} and @code{strrchr}. Some systems support both pairs of +names, but neither pair works on all systems. -@item paginate -@samp{-l} in @code{diff}. +You should pick a single pair of names and use it throughout your +program. (Nowadays, it is better to choose @code{strchr} and +@code{strrchr} for new programs, since those are the standard @sc{ansi} +names.) Declare both of those names as functions returning @code{char +*}. On systems which don't support those names, define them as macros +in terms of the other pair. For example, here is what to put at the +beginning of your file (or in a header) if you want to use the names +@code{strchr} and @code{strrchr} throughout: -@item paragraph-indent -Used in Makeinfo. +@example +#ifndef HAVE_STRCHR +#define strchr index +#endif +#ifndef HAVE_STRRCHR +#define strrchr rindex +#endif -@item parents -@samp{-p} in @code{mkdir} and @code{rmdir}. +char *strchr (); +char *strrchr (); +@end example +@end itemize -@item pass-all -@samp{-p} in @code{ul}. +Here we assume that @code{HAVE_STRCHR} and @code{HAVE_STRRCHR} are +macros defined in systems where the corresponding functions exist. +One way to get them properly defined is to use Autoconf. -@item pass-through -@samp{-p} in @code{cpio}. +@node Internationalization +@section Internationalization -@item port -@samp{-P} in @code{finger}. +GNU has a library called GNU gettext that makes it easy to translate the +messages in a program into various languages. You should use this +library in every program. Use English for the messages as they appear +in the program, and let gettext provide the way to translate them into +other languages. -@item portability -@samp{-c} in @code{cpio} and @code{tar}. +Using GNU gettext involves putting a call to the @code{gettext} macro +around each string that might need translation---like this: -@item prefix-builtins -@samp{-P} in @code{m4}. +@example +printf (gettext ("Processing file `%s'...")); +@end example -@item prefix -@samp{-f} in @code{csplit}. +@noindent +This permits GNU gettext to replace the string @code{"Processing file +`%s'..."} with a translated version. -@item preserve -Used in @code{tar} and @code{cp}. +Once a program uses gettext, please make a point of writing calls to +@code{gettext} when you add new strings that call for translation. -@item preserve-environment -@samp{-p} in @code{su}. +Using GNU gettext in a package involves specifying a @dfn{text domain +name} for the package. The text domain name is used to separate the +translations for this package from the translations for other packages. +Normally, the text domain name should be the same as the name of the +package---for example, @samp{fileutils} for the GNU file utilities. + +To enable gettext to work well, avoid writing code that makes +assumptions about the structure of words or sentences. When you want +the precise text of a sentence to vary depending on the data, use two or +more alternative string constants each containing a complete sentences, +rather than inserting conditionalized words or phrases into a single +sentence framework. -@item preserve-modification-time -@samp{-m} in @code{cpio}. +Here is an example of what not to do: -@item preserve-order -@samp{-s} in @code{tar}. +@example +printf ("%d file%s processed", nfiles, + nfiles != 1 ? "s" : ""); +@end example -@item preserve-permissions -@samp{-p} in @code{tar}. +@noindent +The problem with that example is that it assumes that plurals are made +by adding `s'. If you apply gettext to the format string, like this, -@item print -@samp{-l} in @code{diff}. +@example +printf (gettext ("%d file%s processed"), nfiles, + nfiles != 1 ? "s" : ""); +@end example -@item print-chars -@samp{-L} in @code{cmp}. +@noindent +the message can use different words, but it will still be forced to use +`s' for the plural. Here is a better way: -@item print-data-base -@samp{-p} in Make. +@example +printf ((nfiles != 1 ? "%d files processed" + : "%d file processed"), + nfiles); +@end example -@item print-directory -@samp{-w} in Make. +@noindent +This way, you can apply gettext to each of the two strings +independently: -@item print-file-name -@samp{-o} in @code{nm}. +@example +printf ((nfiles != 1 ? gettext ("%d files processed") + : gettext ("%d file processed")), + nfiles); +@end example -@item print-symdefs -@samp{-s} in @code{nm}. +@noindent +This can any method of forming the plural of the word for ``file'', and +also handles languages that require agreement in the word for +``processed''. -@item question -@samp{-q} in Make. +A similar problem appears at the level of sentence structure with this +code: -@item quiet -Used in many programs to inhibit the usual output. @strong{Note:} every -program accepting @samp{--quiet} should accept @samp{--silent} as a -synonym. +@example +printf ("# Implicit rule search has%s been done.\n", + f->tried_implicit ? "" : " not"); +@end example -@item quote-name -@samp{-Q} in @code{ls}. +@noindent +Adding @code{gettext} calls to this code cannot give correct results for +all languages, because negation in some languages requires adding words +at more than one place in the sentence. By contrast, adding +@code{gettext} calls does the job straightfowardly if the code starts +out like this: -@item rcs -@samp{-n} in @code{diff}. +@example +printf (f->tried_implicit + ? "# Implicit rule search has been done.\n", + : "# Implicit rule search has not been done.\n"); +@end example -@item read-full-blocks -@samp{-B} in @code{tar}. +@node Mmap +@section Mmap -@item readnow -Used in GDB. +Don't assume that @code{mmap} either works on all files or fails +for all files. It may work on some files and fail on others. -@item recon -@samp{-n} in Make. +The proper way to use @code{mmap} is to try it on the specific file for +which you want to use it---and if @code{mmap} doesn't work, fall back on +doing the job in another way using @code{read} and @code{write}. -@item record-number -@samp{-R} in @code{tar}. +The reason this precaution is needed is that the GNU kernel (the HURD) +provides a user-extensible file system, in which there can be many +different kinds of ``ordinary files.'' Many of them support +@code{mmap}, but some do not. It is important to make programs handle +all these kinds of files. -@item recursive -Used in @code{chgrp}, @code{chown}, @code{cp}, @code{ls}, @code{diff}, -and @code{rm}. +@node Documentation +@chapter Documenting Programs -@item reference-limit -Used in Makeinfo. +@menu +* GNU Manuals:: Writing proper manuals. +* Manual Structure Details:: Specific structure conventions. +* NEWS File:: NEWS files supplement manuals. +* Change Logs:: Recording Changes +* Man Pages:: Man pages are secondary. +* Reading other Manuals:: How far you can go in learning + from other manuals. +@end menu -@item references -@samp{-r} in @code{ptx}. +@node GNU Manuals +@section GNU Manuals -@item regex -@samp{-r} in @code{tac}. +The preferred way to document part of the GNU system is to write a +manual in the Texinfo formatting language. See the Texinfo manual, +either the hardcopy, or the on-line version available through +@code{info} or the Emacs Info subsystem (@kbd{C-h i}). + +Programmers often find it most natural to structure the documentation +following the structure of the implementation, which they know. But +this structure is not necessarily good for explaining how to use the +program; it may be irrelevant and confusing for a user. + +At every level, from the sentences in a paragraph to the grouping of +topics into separate manuals, the right way to structure documentation +is according to the concepts and questions that a user will have in mind +when reading it. Sometimes this structure of ideas matches the +structure of the implementation of the software being documented---but +often they are different. Often the most important part of learning to +write good documentation is learning to notice when you are structuring +the documentation like the implementation, and think about better +alternatives. + +For example, each program in the GNU system probably ought to be +documented in one manual; but this does not mean each program should +have its own manual. That would be following the structure of the +implementation, rather than the structure that helps the user +understand. + +Instead, each manual should cover a coherent @emph{topic}. For example, +instead of a manual for @code{diff} and a manual for @code{diff3}, we +have one manual for ``comparison of files'' which covers both of those +programs, as well as @code{cmp}. By documenting these programs +together, we can make the whole subject clearer. + +The manual which discusses a program should document all of the +program's command-line options and all of its commands. It should give +examples of their use. But don't organize the manual as a list of +features. Instead, organize it logically, by subtopics. Address the +questions that a user will ask when thinking about the job that the +program does. + +In general, a GNU manual should serve both as tutorial and reference. +It should be set up for convenient access to each topic through Info, +and for reading straight through (appendixes aside). A GNU manual +should give a good introduction to a beginner reading through from the +start, and should also provide all the details that hackers want. + +That is not as hard as it first sounds. Arrange each chapter as a +logical breakdown of its topic, but order the sections, and write their +text, so that reading the chapter straight through makes sense. Do +likewise when structuring the book into chapters, and when structuring a +section into paragraphs. The watchword is, @emph{at each point, address +the most fundamental and important issue raised by the preceding text.} + +If necessary, add extra chapters at the beginning of the manual which +are purely tutorial and cover the basics of the subject. These provide +the framework for a beginner to understand the rest of the manual. The +Bison manual provides a good example of how to do this. + +Don't use Unix man pages as a model for how to write GNU documentation; +most of them are terse, badly structured, and give inadequate +explanation of the underlying concepts. (There are, of course +exceptions.) Also Unix man pages use a particular format which is +different from what we use in GNU manuals. -@item release -@samp{-r} in @code{uname}. +Please do not use the term ``pathname'' that is used in Unix +documentation; use ``file name'' (two words) instead. We use the term +``path'' only for search paths, which are lists of file names. -@item relocation -@samp{-r} in @code{objdump}. +Please do not use the term ``illegal'' to refer to erroneous input to a +computer program. Please use ``invalid'' for this, and reserve the term +``illegal'' for violations of law. + +@node Manual Structure Details +@section Manual Structure Details + +The title page of the manual should state the version of the programs or +packages documented in the manual. The Top node of the manual should +also contain this information. If the manual is changing more +frequently than or independent of the program, also state a version +number for the manual in both of these places. + +Each program documented in the manual should should have a node named +@samp{@var{program} Invocation} or @samp{Invoking @var{program}}. This +node (together with its subnodes, if any) should describe the program's +command line arguments and how to run it (the sort of information people +would look in a man page for). Start with an @samp{@@example} +containing a template for all the options and arguments that the program +uses. -@item rename -@samp{-r} in @code{cpio}. +Alternatively, put a menu item in some menu whose item name fits one of +the above patterns. This identifies the node which that item points to +as the node for this purpose, regardless of the node's actual name. -@item replace -@samp{-i} in @code{xargs}. +There will be automatic features for specifying a program name and +quickly reading just this part of its manual. -@item report-identical-files -@samp{-s} in @code{diff}. +If one manual describes several programs, it should have such a node for +each program described. -@item reset-access-time -@samp{-a} in @code{cpio}. +@node NEWS File +@section The NEWS File -@item reverse -@samp{-r} in @code{ls} and @code{nm}. +In addition to its manual, the package should have a file named +@file{NEWS} which contains a list of user-visible changes worth +mentioning. In each new release, add items to the front of the file and +identify the version they pertain to. Don't discard old items; leave +them in the file after the newer items. This way, a user upgrading from +any previous version can see what is new. -@item reversed-ed -@samp{-f} in @code{diff}. +If the @file{NEWS} file gets very long, move some of the older items +into a file named @file{ONEWS} and put a note at the end referring the +user to that file. -@item right-side-defs -@samp{-R} in @code{ptx}. +@node Change Logs +@section Change Logs -@item same-order -@samp{-s} in @code{tar}. +Keep a change log to describe all the changes made to program source +files. The purpose of this is so that people investigating bugs in the +future will know about the changes that might have introduced the bug. +Often a new bug can be found by looking at what was recently changed. +More importantly, change logs can help you eliminate conceptual +inconsistencies between different parts of a program, by giving you a +history of how the conflicting concepts arose and who they came from. -@item same-permissions -@samp{-p} in @code{tar}. +@menu +* Change Log Concepts:: +* Style of Change Logs:: +* Simple Changes:: +* Conditional Changes:: +@end menu -@item save -@samp{-g} in @code{stty}. +@node Change Log Concepts +@subsection Change Log Concepts -@item se -Used in GDB. +You can think of the change log as a conceptual ``undo list'' which +explains how earlier versions were different from the current version. +People can see the current version; they don't need the change log +to tell them what is in it. What they want from a change log is a +clear explanation of how the earlier version differed. -@item sentence-regexp -@samp{-S} in @code{ptx}. +The change log file is normally called @file{ChangeLog} and covers an +entire directory. Each directory can have its own change log, or a +directory can use the change log of its parent directory--it's up to +you. + +Another alternative is to record change log information with a version +control system such as RCS or CVS. This can be converted automatically +to a @file{ChangeLog} file. -@item separate-dirs -@samp{-S} in @code{du}. +There's no need to describe the full purpose of the changes or how they +work together. If you think that a change calls for explanation, you're +probably right. Please do explain it---but please put the explanation +in comments in the code, where people will see it whenever they see the +code. For example, ``New function'' is enough for the change log when +you add a function, because there should be a comment before the +function definition to explain what it does. -@item separator -@samp{-s} in @code{tac}. +However, sometimes it is useful to write one line to describe the +overall purpose of a batch of changes. -@item sequence -Used by @code{recode} to chose files or pipes for sequencing passes. +The easiest way to add an entry to @file{ChangeLog} is with the Emacs +command @kbd{M-x add-change-log-entry}. An entry should have an +asterisk, the name of the changed file, and then in parentheses the name +of the changed functions, variables or whatever, followed by a colon. +Then describe the changes you made to that function or variable. -@item shell -@samp{-s} in @code{su}. +@node Style of Change Logs +@subsection Style of Change Logs -@item show-all -@samp{-A} in @code{cat}. +Here are some examples of change log entries: -@item show-c-function -@samp{-p} in @code{diff}. +@example +* register.el (insert-register): Return nil. +(jump-to-register): Likewise. -@item show-ends -@samp{-E} in @code{cat}. +* sort.el (sort-subr): Return nil. -@item show-function-line -@samp{-F} in @code{diff}. +* tex-mode.el (tex-bibtex-file, tex-file, tex-region): +Restart the tex shell if process is gone or stopped. +(tex-shell-running): New function. -@item show-tabs -@samp{-T} in @code{cat}. +* expr.c (store_one_arg): Round size up for move_block_to_reg. +(expand_call): Round up when emitting USE insns. +* stmt.c (assign_parms): Round size up for move_block_from_reg. +@end example -@item silent -Used in many programs to inhibit the usual output. -@strong{Note:} every program accepting -@samp{--silent} should accept @samp{--quiet} as a synonym. +It's important to name the changed function or variable in full. Don't +abbreviate function or variable names, and don't combine them. +Subsequent maintainers will often search for a function name to find all +the change log entries that pertain to it; if you abbreviate the name, +they won't find it when they search. + +For example, some people are tempted to abbreviate groups of function +names by writing @samp{* register.el (@{insert,jump-to@}-register)}; +this is not a good idea, since searching for @code{jump-to-register} or +@code{insert-register} would not find that entry. + +Separate unrelated change log entries with blank lines. When two +entries represent parts of the same change, so that they work together, +then don't put blank lines between them. Then you can omit the file +name and the asterisk when successive entries are in the same file. + +@node Simple Changes +@subsection Simple Changes + +Certain simple kinds of changes don't need much detail in the change +log. + +When you change the calling sequence of a function in a simple fashion, +and you change all the callers of the function, there is no need to make +individual entries for all the callers that you changed. Just write in +the entry for the function being called, ``All callers changed.'' -@item size -@samp{-s} in @code{ls}. +@example +* keyboard.c (Fcommand_execute): New arg SPECIAL. +All callers changed. +@end example -@item sort -Used in @code{ls}. +When you change just comments or doc strings, it is enough to write an +entry for the file, without mentioning the functions. Just ``Doc +fixes'' is enough for the change log. -@item sparse -@samp{-S} in @code{tar}. +There's no need to make change log entries for documentation files. +This is because documentation is not susceptible to bugs that are hard +to fix. Documentation does not consist of parts that must interact in a +precisely engineered fashion. To correct an error, you need not know +the history of the erroneous passage; it is enough to compare what the +documentation says with the way the program actually works. -@item speed-large-files -@samp{-H} in @code{diff}. +@node Conditional Changes +@subsection Conditional Changes -@item squeeze-blank -@samp{-s} in @code{cat}. +C programs often contain compile-time @code{#if} conditionals. Many +changes are conditional; sometimes you add a new definition which is +entirely contained in a conditional. It is very useful to indicate in +the change log the conditions for which the change applies. -@item starting-file -Used in @code{tar} and @code{diff} to specify which file within -a directory to start processing with. +Our convention for indicating conditional changes is to use square +brackets around the name of the condition. -@item stop -@samp{-S} in Make. +Here is a simple example, describing a change which is conditional but +does not have a function or entity name associated with it: -@item strict -@samp{-s} in @code{recode}. +@example +* xterm.c [SOLARIS2]: Include string.h. +@end example -@item strip -@samp{-s} in @code{install}. +Here is an entry describing a new definition which is entirely +conditional. This new definition for the macro @code{FRAME_WINDOW_P} is +used only when @code{HAVE_X_WINDOWS} is defined: -@item strip-all -@samp{-s} in @code{strip}. +@example +* frame.h [HAVE_X_WINDOWS] (FRAME_WINDOW_P): Macro defined. +@end example -@item strip-debug -@samp{-S} in @code{strip}. +Here is an entry for a change within the function @code{init_display}, +whose definition as a whole is unconditional, but the changes themselves +are contained in a @samp{#ifdef HAVE_LIBNCURSES} conditional: -@item suffix -@samp{-S} in @code{cp}, @code{ln}, @code{mv}. +@example +* dispnew.c (init_display) [HAVE_LIBNCURSES]: If X, call tgetent. +@end example -@item suffix-format -@samp{-b} in @code{csplit}. +Here is an entry for a change that takes affect only when +a certain macro is @emph{not} defined: -@item sum -@samp{-s} in @code{gprof}. +@example +(gethostname) [!HAVE_SOCKETS]: Replace with winsock version. +@end example -@item summarize -@samp{-s} in @code{du}. +@node Man Pages +@section Man Pages -@item symbolic -@samp{-s} in @code{ln}. +In the GNU project, man pages are secondary. It is not necessary or +expected for every GNU program to have a man page, but some of them do. +It's your choice whether to include a man page in your program. -@item symbols -Used in GDB and @code{objdump}. +When you make this decision, consider that supporting a man page +requires continual effort each time the program is changed. The time +you spend on the man page is time taken away from more useful work. -@item synclines -@samp{-s} in @code{m4}. +For a simple program which changes little, updating the man page may be +a small job. Then there is little reason not to include a man page, if +you have one. -@item sysname -@samp{-s} in @code{uname}. +For a large program that changes a great deal, updating a man page may +be a substantial burden. If a user offers to donate a man page, you may +find this gift costly to accept. It may be better to refuse the man +page unless the same person agrees to take full responsibility for +maintaining it---so that you can wash your hands of it entirely. If +this volunteer later ceases to do the job, then don't feel obliged to +pick it up yourself; it may be better to withdraw the man page from the +distribution until someone else agrees to update it. -@item tabs -@samp{-t} in @code{expand} and @code{unexpand}. +When a program changes only a little, you may feel that the +discrepancies are small enough that the man page remains useful without +updating. If so, put a prominent note near the beginning of the man +page explaining that you don't maintain it and that the Texinfo manual +is more authoritative. The note should say how to access the Texinfo +documentation. -@item tabsize -@samp{-T} in @code{ls}. +@node Reading other Manuals +@section Reading other Manuals -@item terminal -@samp{-T} in @code{tput} and @code{ul}. +There may be non-free books or documentation files that describe the +program you are documenting. -@item text -@samp{-a} in @code{diff}. +It is ok to use these documents for reference, just as the author of a +new algebra textbook can read other books on algebra. A large portion +of any non-fiction book consists of facts, in this case facts about how +a certain program works, and these facts are necessarily the same for +everyone who writes about the subject. But be careful not to copy your +outline structure, wording, tables or examples from preexisting non-free +documentation. Copying from free documentation may be ok; please check +with the FSF about the individual case. + +@node Managing Releases +@chapter The Release Process + +Making a release is more than just bundling up your source files in a +tar file and putting it up for FTP. You should set up your software so +that it can be configured to run on a variety of systems. Your Makefile +should conform to the GNU standards described below, and your directory +layout should also conform to the standards discussed below. Doing so +makes it easy to include your package into the larger framework of +all GNU software. -@item time -Used in @code{ls} and @code{touch}. +@menu +* Configuration:: How Configuration Should Work +* Makefile Conventions:: Makefile Conventions +* Releases:: Making Releases +@end menu -@item to-stdout -@samp{-O} in @code{tar}. +@node Configuration +@section How Configuration Should Work -@item total -@samp{-c} in @code{du}. +Each GNU distribution should come with a shell script named +@code{configure}. This script is given arguments which describe the +kind of machine and system you want to compile the program for. -@item touch -@samp{-t} in Make, @code{ranlib}, and @code{recode}. +The @code{configure} script must record the configuration options so +that they affect compilation. -@item trace -@samp{-t} in @code{m4}. +One way to do this is to make a link from a standard name such as +@file{config.h} to the proper configuration file for the chosen system. +If you use this technique, the distribution should @emph{not} contain a +file named @file{config.h}. This is so that people won't be able to +build the program without configuring it first. -@item traditional -@samp{-t} in @code{hello}; -@samp{-G} in @code{m4} and @code{ptx}. +Another thing that @code{configure} can do is to edit the Makefile. If +you do this, the distribution should @emph{not} contain a file named +@file{Makefile}. Instead, it should include a file @file{Makefile.in} which +contains the input used for editing. Once again, this is so that people +won't be able to build the program without configuring it first. -@item tty -Used in GDB. +If @code{configure} does write the @file{Makefile}, then @file{Makefile} +should have a target named @file{Makefile} which causes @code{configure} +to be rerun, setting up the same configuration that was set up last +time. The files that @code{configure} reads should be listed as +dependencies of @file{Makefile}. -@item typedefs -@samp{-t} in @code{etags}. +All the files which are output from the @code{configure} script should +have comments at the beginning explaining that they were generated +automatically using @code{configure}. This is so that users won't think +of trying to edit them by hand. -@item typedefs-and-c++ -@samp{-T} in @code{etags}. +The @code{configure} script should write a file named @file{config.status} +which describes which configuration options were specified when the +program was last configured. This file should be a shell script which, +if run, will recreate the same configuration. -@item typeset-mode -@samp{-t} in @code{ptx}. +The @code{configure} script should accept an option of the form +@samp{--srcdir=@var{dirname}} to specify the directory where sources are found +(if it is not the current directory). This makes it possible to build +the program in a separate directory, so that the actual source directory +is not modified. -@item uncompress -@samp{-z} in @code{tar}. +If the user does not specify @samp{--srcdir}, then @code{configure} should +check both @file{.} and @file{..} to see if it can find the sources. If +it finds the sources in one of these places, it should use them from +there. Otherwise, it should report that it cannot find the sources, and +should exit with nonzero status. -@item unconditional -@samp{-u} in @code{cpio}. +Usually the easy way to support @samp{--srcdir} is by editing a +definition of @code{VPATH} into the Makefile. Some rules may need to +refer explicitly to the specified source directory. To make this +possible, @code{configure} can add to the Makefile a variable named +@code{srcdir} whose value is precisely the specified directory. -@item undefine -@samp{-U} in @code{m4}. +The @code{configure} script should also take an argument which specifies the +type of system to build the program for. This argument should look like +this: -@item undefined-only -@samp{-u} in @code{nm}. +@example +@var{cpu}-@var{company}-@var{system} +@end example -@item update -@samp{-u} in @code{cp}, @samp{etags}, @samp{mv}, @samp{tar}. +For example, a Sun 3 might be @samp{m68k-sun-sunos4.1}. -@item verbose -Print more information about progress. Many programs support this. +The @code{configure} script needs to be able to decode all plausible +alternatives for how to describe a machine. Thus, @samp{sun3-sunos4.1} +would be a valid alias. For many programs, @samp{vax-dec-ultrix} would +be an alias for @samp{vax-dec-bsd}, simply because the differences +between Ultrix and @sc{BSD} are rarely noticeable, but a few programs +might need to distinguish them. +@c Real 4.4BSD now runs on some Suns. -@item verify -@samp{-W} in @code{tar}. +There is a shell script called @file{config.sub} that you can use +as a subroutine to validate system types and canonicalize aliases. -@item version -Print the version number. +Other options are permitted to specify in more detail the software +or hardware present on the machine, and include or exclude optional +parts of the package: -@item version-control -@samp{-V} in @code{cp}, @code{ln}, @code{mv}. +@table @samp +@item --enable-@var{feature}@r{[}=@var{parameter}@r{]} +Configure the package to build and install an optional user-level +facility called @var{feature}. This allows users to choose which +optional features to include. Giving an optional @var{parameter} of +@samp{no} should omit @var{feature}, if it is built by default. -@item vgrind -@samp{-v} in @code{etags}. +No @samp{--enable} option should @strong{ever} cause one feature to +replace another. No @samp{--enable} option should ever substitute one +useful behavior for another useful behavior. The only proper use for +@samp{--enable} is for questions of whether to build part of the program +or exclude it. -@item volume -@samp{-V} in @code{tar}. +@item --with-@var{package} +@c @r{[}=@var{parameter}@r{]} +The package @var{package} will be installed, so configure this package +to work with @var{package}. -@item what-if -@samp{-W} in Make. +@c Giving an optional @var{parameter} of +@c @samp{no} should omit @var{package}, if it is used by default. -@item width -@samp{-w} in @code{ls} and @code{ptx}. +Possible values of @var{package} include @samp{x}, @samp{x-toolkit}, +@samp{gnu-as} (or @samp{gas}), @samp{gnu-ld}, @samp{gnu-libc}, and +@samp{gdb}. -@item word-regexp -@samp{-W} in @code{ptx}. +Do not use a @samp{--with} option to specify the file name to use to +find certain files. That is outside the scope of what @samp{--with} +options are for. -@item writable -@samp{-T} in @code{who}. +@item --nfp +The target machine has no floating point processor. -@item zeros -@samp{-z} in @code{gprof}. +@item --gas +The target machine assembler is GAS, the GNU assembler. +This is obsolete; users should use @samp{--with-gnu-as} instead. +@item --x +The target machine has the X Window System installed. +This is obsolete; users should use @samp{--with-x} instead. @end table -@node Documentation -@chapter Documenting Programs - -Please use Texinfo for documenting GNU programs. See the Texinfo -manual, either the hardcopy or the version in the GNU Emacs Info -subsystem (@kbd{C-h i}). See existing GNU Texinfo files (e.g., those -under the @file{man/} directory in the GNU Emacs distribution) for -examples. - -The title page of the manual should state the version of the program -which the manual applies to. The Top node of the manual should also -contain this information. If the manual is changing more frequently -than or independent of the program, also state a version number for -the manual in both of these places. - -The manual should document all command-line arguments and all -commands. It should give examples of their use. But don't organize -the manual as a list of features. Instead, organize it by the -concepts a user will have before reaching that point in the manual. -Address the goals that a user will have in mind, and explain how to -accomplish them. Don't use Unix man pages as a model for how to -write GNU documentation; they are a bad example to follow. - -The manual should have a node named @samp{@var{program} Invocation} or -@samp{Invoking @var{program}}, where @var{program} stands for the name -of the program being described, as you would type it in the shell to run -the program. This node (together with its subnodes, if any) should -describe the program's command line arguments and how to run it (the -sort of information people would look in a man page for). Start with an -@samp{@@example} containing a template for all the options and arguments -that the program uses. +All @code{configure} scripts should accept all of these ``detail'' +options, whether or not they make any difference to the particular +package at hand. In particular, they should accept any option that +starts with @samp{--with-} or @samp{--enable-}. This is so users will +be able to configure an entire GNU source tree at once with a single set +of options. -Alternatively, put a menu item in some menu whose item name fits one of -the above patterns. This identifies the node which that item points to -as the node for this purpose, regardless of the node's actual name. +You will note that the categories @samp{--with-} and @samp{--enable-} +are narrow: they @strong{do not} provide a place for any sort of option +you might think of. That is deliberate. We want to limit the possible +configuration options in GNU software. We do not want GNU programs to +have idiosyncratic configuration options. -There will be automatic features for specifying a program name and -quickly reading just this part of its manual. +Packages that perform part of the compilation process may support cross-compilation. +In such a case, the host and target machines for the program may be +different. The @code{configure} script should normally treat the +specified type of system as both the host and the target, thus producing +a program which works for the same type of machine that it runs on. -If one manual describes several programs, it should have such a node for -each program described. +The way to build a cross-compiler, cross-assembler, or what have you, is +to specify the option @samp{--host=@var{hosttype}} when running +@code{configure}. This specifies the host system without changing the +type of target system. The syntax for @var{hosttype} is the same as +described above. -In addition to its manual, the package should have a file named -@file{NEWS} which contains a list of user-visible changes worth -mentioning. In each new release, add items to the front of the file and -identify the version they pertain to. Don't discard old items; leave -them in the file after the newer items. This way, a user upgrading from -any previous version can see what is new. +Bootstrapping a cross-compiler requires compiling it on a machine other +than the host it will run on. Compilation packages accept a +configuration option @samp{--build=@var{hosttype}} for specifying the +configuration on which you will compile them, in case that is different +from the host. -If the @file{NEWS} file gets very long, move some of the older items -into a file named @file{ONEWS} and put a note at the end referring the -user to that file. +Programs for which cross-operation is not meaningful need not accept the +@samp{--host} option, because configuring an entire operating system for +cross-operation is not a meaningful thing. -Please do not use the term ``pathname'' that is used in Unix -documentation; use ``file name'' (two words) instead. We use the term -``path'' only for search paths, which are lists of file names. +Some programs have ways of configuring themselves automatically. If +your program is set up to do this, your @code{configure} script can simply +ignore most of its arguments. -It is ok to supply a man page for the program as well as a Texinfo -manual if you wish to. But keep in mind that supporting a man page -requires continual effort, each time the program is changed. Any time -you spend on the man page is time taken away from more useful things you -could contribute. - -Thus, even if a user volunteers to donate a man page, you may find this -gift costly to accept. Unless you have time on your hands, it may be -better to refuse the man page unless the same volunteer agrees to take -full responsibility for maintaining it---so that you can wash your hands -of it entirely. If the volunteer ceases to do the job, then don't feel -obliged to pick it up yourself; it may be better to withdraw the man -page until another volunteer offers to carry on with it. - -Alternatively, if you expect the discrepancies to be small enough that -the man page remains useful, put a prominent note near the beginning of -the man page explaining that you don't maintain it and that the Texinfo -manual is more authoritative, and describing how to access the Texinfo -documentation. +@comment The makefile standards are in a separate file that is also +@comment included by make.texinfo. Done by roland@gnu.ai.mit.edu on 1/6/93. +@comment For this document, turn chapters into sections, etc. +@lowersections +@include make-stds.texi +@raisesections @node Releases -@chapter Making Releases +@section Making Releases Package the distribution of Foo version 69.96 in a gzipped tar file named @file{foo-69.96.tar.gz}. It should unpack into a subdirectory @@ -2242,7 +3008,7 @@ to include non-source files in the distribution, provided they are up-to-date and machine-independent, so that building the distribution normally will never modify them. We commonly include non-source files -produced by Bison, Lex, @TeX{}, and Makeinfo; this helps avoid +produced by Bison, @code{lex}, @TeX{}, and @code{makeinfo}; this helps avoid unnecessary dependencies between our distributions, so that users can install whichever packages they want to install. @@ -2273,16 +3039,16 @@ systems cannot handle this and that prevents unpacking the distribution. -Try to make sure that all the file names will be unique on MS-DOG. A -name on MS-DOG consists of up to 8 characters, optionally followed by a -period and up to three characters. MS-DOG will truncate extra +Try to make sure that all the file names will be unique on MS-DOS. A +name on MS-DOS consists of up to 8 characters, optionally followed by a +period and up to three characters. MS-DOS will truncate extra characters both before and after the period. Thus, @file{foobarhacker.c} and @file{foobarhacker.o} are not ambiguous; they are truncated to @file{foobarha.c} and @file{foobarha.o}, which are distinct. Include in your distribution a copy of the @file{texinfo.tex} you used -to test print any @file{*.texinfo} files. +to test print any @file{*.texinfo} or @file{*.texi} files. Likewise, if your program uses small GNU software packages like regex, getopt, obstack, or termcap, include them in the distribution file. diff -urN binutils-2.7/gas/CONTRIBUTORS binutils-2.8/gas/CONTRIBUTORS --- binutils-2.7/gas/CONTRIBUTORS Thu Jul 4 12:12:10 1996 +++ binutils-2.8/gas/CONTRIBUTORS Wed Apr 30 12:53:28 1997 @@ -92,6 +92,7 @@ Ian Dall updated the support code for the National Semiconductor 32000 series, and added support for Mach 3 and NetBSD running on the PC532. +Klaus Kaempf ported the assembler and the binutils to openVMS/Alpha. Many others have contributed large or small bugfixes and enhancements. If you've contributed significant work and are not mentioned on this list, and diff -urN binutils-2.7/gas/COPYING binutils-2.8/gas/COPYING --- binutils-2.7/gas/COPYING Thu Jul 4 12:12:11 1996 +++ binutils-2.8/gas/COPYING Wed Apr 30 12:53:28 1997 @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -279,7 +279,7 @@ END OF TERMS AND CONDITIONS - Appendix: How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -305,7 +305,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Also add information on how to contact you by electronic and paper mail. diff -urN binutils-2.7/gas/ChangeLog binutils-2.8/gas/ChangeLog --- binutils-2.7/gas/ChangeLog Mon Jul 15 14:02:44 1996 +++ binutils-2.8/gas/ChangeLog Wed Apr 30 12:53:29 1997 @@ -1,18 +1,2544 @@ -Fri Jul 12 20:54:19 1996 Ian Lance Taylor +Wed Apr 30 12:47:00 1997 Manfred Hollstein - * Released binutils 2.7. + * config/obj-coff.c (c_section_symbol): Clear the LOCAL bit #ifdef + TE_DELTA. -Fri Jul 12 20:54:19 1996 Michael Meissner +Tue Apr 29 20:23:10 1997 Jim Wilson - * config/tc-ppc.c (md_parse_option): Recognize -K PIC. + * config/tc-mips.c (nopic_need_relax): Add new parameter + before_relaxing. Use it when testing ecoff_extern_size. + (load_address, macro, md_estimate_size_before_relax): Fix all + callers. -Wed Jul 10 00:23:30 1996 Ian Lance Taylor +Fri Apr 25 14:17:46 1997 H.J. Lu - * config/tc-ppc.c (md_apply_fix3): Give a useful error message - when an unsupported PC relative reloc is seen, rather than calling - abort. + * Makefile.in (DISTSTUFF): Add itbl-parse.h. + +Fri Apr 25 12:03:15 1997 Ian Lance Taylor + + * doc/internals.texi (Porting GAS): Correct documentation for + current configure handling of targ-cpu.h, et. al. + (CPU backend): Document listing macros. + +Sat Apr 19 23:09:25 1997 Niklas Hallqvist + + * configure.in (i386-*-openbsd*, m68k-*-openbsd*, + mips-dec-openbsd*, ppc-*-*bsd*, ns32k-pc532-openbsd*, + sparc-*-openbsd*): New targets. + * configure: Rebuild. + +Sat Apr 19 22:52:03 1997 Jim Wilson + + * config/obj-elf.c (elf_frob_symbol): If TC_MIPS, set BSF_OBJECT + for all undefined symbols. + +Fri Apr 18 11:51:35 1997 Niklas Hallqvist + + * configure.in (alpha*-*-openbsd*): New target. + * configure: Rebuild. + +Thu Apr 17 13:59:47 1997 Per Fogelstrom + + * configure.in (mips-*-openbsd*): New target. + * configure: Rebuild. + +Tue Apr 15 18:11:44 1997 Gavin Koch + + * config/tc-mips.c (insn_uses_reg): Correct test for fpr pairs. + +Mon Apr 14 11:59:08 1997 Ian Lance Taylor + + From Thomas Graichen : + * Makefile.in: Always use $(SHELL) when running move-if-change. + * configure.in: Use ${CONFIG_SHELL} when running $ac_config_sub. + * configure: Rebuild. + +Thu Apr 10 14:40:00 1997 Doug Evans + + * cgen.c (cgen_parse_operand): Renamed from cgen_asm_parse_operand. + New argument `want'. Update enum cgen_parse_operand_result values. + Initialize if CGEN_PARSE_OPERAND_INIT. + * config/tc-m32r.c (md_begin): Set cgen_parse_operand_fn. + (md_assemble): Call cgen_asm_init_parse. + Update call to m32r_cgen_assemble_insn, call as_bad if assembly failed. + +Wed Apr 9 11:49:41 1997 Ian Lance Taylor + + * config/tc-m68k.c (m68k_ip): Handle #j. + +Mon Apr 7 14:58:22 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-hppa.c (pa_subspace_start): If OBJ_ELF, then always return + zero. + * config/tc-hppa.h (tc_frob_symbol): Don't reset the value of the + symbol for OBJ_ELF anymore. + +Mon Apr 7 10:54:59 1997 Doug Evans + + * Makefile.in: Regenerate dependencies. + (TARG_CPU): New variable. + (cgen.o): Depend on cgen.h, $(TARG_CPU)-opc.h. + (.dep1): Delete creating of cgen-opc.h. + (.tcdep): Put proper contents in cgen-opc.h. + * configure.in (m32r): Delete setting of extra_files, extra_links. + (AC_OUTPUT): Create cgen-opc.h. + * configure: Regenerated. + +Sat Apr 5 13:19:12 1997 Klaus Kaempf + + * makefile.vms: Update to build gasp.exe. + +Fri Apr 4 16:10:02 1997 Doug Evans + + * write.c (relax_frag): Make non-static. + * write.h (relax_frag): Add prototype for. + * config/tc-m32r.h (md_do_align): New arg `max'. + * config/tc-m32r.c (m32r_do_align): Likewise. + Update calls to frag_align, frag_align_pattern. + (fill_insn): Update call to m32r_do_align. + (m32r_scomm): Update call to frag_align. + + * config/tc-m32r.[ch]: New files. + * cgen.c: New file. + * Makefile.in (CPU_TYPES): Add m32r. + (TARGET_CPU_CFILES): Add tc-m32r.c. + (TARGET_CPU_HFILES): Add tc-m32r.h. + (DISTCLEAN_HERE): Add cgen-opc.h. + (.dep1,.tcdep): Create empty cgen-opc.h. + (cgen.o): Add dependencies. + (dependencies): Regenerate. + * as.h (struct frag): New member fr_targ. + (fr_pcrel_adjust,fr_bsr): Move into union fr_targ.ns32k. + * conf.in (USING_CGEN): New macro. + * configure.in (m32r-*-*): Add entry for. + Add cgen.o to extra_objects. + * configure: Regenerate. + * frags.c (frag_var): fr_pcrel_adjust renamed to + fr_targ.ns32k.pcrel_adjust. fr_bsr renamed to fr_targ.ns32k.bsr. + (frag_variant): Likewise. + * write.c (relax_frag): Likewise. + * config/tc-ns32k.c (*): Likewise. + +Fri Apr 4 13:26:10 1997 Ian Lance Taylor + + * config/tc-hppa.h (TC_EOL_IN_INSN): Check explicitly for '!', + rather than for any end of line character. + + * config/tc-mips.c: Protect uses of STO_MIPS16 with an ifdef of + OBJ_ELF, rather than of S_GET_OTHER. + + * Makefile.in (DISTCLEAN_HERE): Add site.exp and site.bak. + +Thu Apr 3 18:52:39 1997 Ian Lance Taylor + + * Makefile.in (VERSION): Set to 2.8. + +Wed Apr 2 12:24:10 1997 Ian Lance Taylor + + * COPYING: Update FSF address. + + * config/tc-mips.c (mips16_macro): Handle M_DMUL and M_MUL. + +Tue Apr 1 18:29:47 1997 Jim Wilson + + * config/tc-mips.c (md_begin): Don't set interlocks for 4100. + +Tue Apr 1 16:24:28 1997 Klaus Kaempf + + * config-gas.com: Update to handle both vax and alpha. + * makefile.vms: Update to use config-gas. + * conf-a-gas.com: Remove file. + +Tue Apr 1 16:08:21 1997 Ian Lance Taylor + + * Makefile.in: Remove unnecessary itbl-parse.h, ibtl-parse.c, and + itbl-lex.c dependencies. Remove rules for itbl-lex.o, + itbl-parse.o, and itbl-ops.o; just use the normal .c.o rule. + +Tue Apr 1 00:07:30 1997 Ian Lance Taylor + + * config/tc-m68k.c: Only compile tc_coff_symbol_emit_hook and + tc_coff_sizemachdep if OBJ_COFF. + +Mon Mar 31 23:53:44 1997 H.J. Lu + + * config/tc-ppc.c (register_name): Declare. + +Mon Mar 31 16:31:04 1997 Joel Sherrill + + * configure.in (hppa*-*-rtems*): New target, like hppa-*-*elf*. + * configure: Rebuild. + +Mon Mar 31 14:15:19 1997 Ian Lance Taylor + + * config/tc-mips.c (mips_pseudo_table): Add "stabn". + (mips16_mark_labels): New static function. + (append_insn): Call mips16_mark_labels. + (mips_emit_delays): Likewise. + (s_insn): Likewise. Don't call mips_clear_insn_labels. + (s_mips_stab): New static function. + + * configure.in: Use ELF for mips-*-gnu*. + * configure: Rebuild. + +Mon Mar 31 14:01:40 1997 Philippe De Muyter + + * config/tc-m68k.h (TARGET_FORMAT): Set to "coff-m68k-sysv" if + TE_DELTA. + +Fri Mar 28 18:03:19 1997 Alan Modra + + * configure.in: Add AC_ARG_ENABLE for commonbfdlib. If it is set, + set OPCODES_LIB to empty. + * configure: Rebuild. + +Fri Mar 28 15:25:24 1997 H.J. Lu + + * configure.in (sparc-*-linux*aout*, sparc-*-linux*): New + targets. + * configure: Rebuild. + +Fri Mar 28 13:08:33 1997 Ian Lance Taylor + + * itbl-parse.y (yyerror): Make static. Declare. + + From Ralf Baechle : + * configure.in: Set emulations for mips-*-linux*-*. + * configure: Rebuild. + + * config/tc-mips.c (struct mips_set_options): Define. + (mips_opts): New static variable. + (mips_isa): Remove. Now a field in mips_opts. Change all + references. + (mips16, mips16_autoextend, mips_warn_about_macros): Likewise. + (mips_noreorder, mips_nomove, mips_noat, mips_nobopt): Likewise. + (struct mips_option_stack): Define. + (mips_opts_stack): New static variable. + (s_mipsset): Add support for .set push and .set pop. + * doc/c-mips.texi: Document .set push and .set pop. + + * config/obj-elf.c (obj_elf_section_change_hook): New function. + * config/obj-elf.h (obj_elf_section_change_hook): Declare it. + * config/tc-mips.c (s_change_sec): Call it if OBJ_ELF. + +Thu Mar 27 12:23:56 1997 Ian Lance Taylor + + * as.c (parse_args): Update copyright date in version message. + + * Makefile.in (clean-here): Remove dependency files. + + * read.c (s_comm): Check S_IS_COMMON as well as S_IS_DEFINED. + (s_mri_common): Check S_IS_COMMON unconditionally. + * symbols.c (colon): Check S_IS_COMMON as well as S_IS_DEFINED. + * config/tc-alpha.c (s_alpha_comm): Likewise. + * config/tc-mips.c (nopic_need_relax): Likewise. + * config/tc-ppc.c (ppc_elf_lcomm): Likewise. + (ppc_pe_comm): Likewise. + * config/obj-elf.c (obj_elf_common): Likewise. Set segment of + common symbol to bfd_com_section_ptr. + * config/tc-sparc.c (s_common): Likewise. + (tc_gen_reloc): Likewise. + +Wed Mar 26 13:35:15 1997 H.J. Lu + + * config/tc-i386.c (tc_i386_fix_adjustable): Only define if + BFD_ASSEMBLER. + +Wed Mar 26 11:32:51 1997 Ian Lance Taylor + + * input-scrub.c (input_scrub_next_buffer): Handle very long input + lines correctly. + + * listing.c (print_lines): Add lineno parameter. Change all + callers. + (listing_listing): Only call calc_hex for the right line. + (listing_list): Set the new edict based on the current edict, in + order to handle listing commands in macros correctly. + + * config/tc-mips.c (insn_uses_reg): Map register numbers in mips16 + instructions. + + * cond.c (cond_finish_check): New function. + * as.h (cond_finish_check): Declare. + * as.c (main): Call cond_finish_check. + +Mon Mar 24 12:11:18 1997 Ian Lance Taylor + + * config/tc-i386.h (iclrKludge): Define. + * config/tc-i386.c (md_assemble): Handle iclrKludge. + + * config/tc-alpha.h (tc_frob_file_before_adjust): Define if + OBJ_ECOFF. + (alpha_frob_file_before_adjust): Declare if OBJ_ECOFF. + * config/tc-alpha.c (alpha_debug): New static variable. + (md_parse_option): Set alpha_debug if -g is seen. + (alpha_frob_file_before_adjust): New function if OBJ_ECOFF. + +Sat Mar 22 13:44:28 1997 Ian Lance Taylor + + * Makefile.in: Added automatic dependency building. + * dep-in.sed: New file. + +Fri Mar 21 15:42:37 1997 Ian Lance Taylor + + * config/obj-ieee.c (segment_name): Don't define function if this + is a macro. + + * config/obj-coff.h (DO_STRIP): Don't define. + * config/tc-h8300.h (DO_STRIP): Don't define. + * config/tc-h8500.h (DO_STRIP): Don't define. + * config/tc-w65.h (DO_STRIP): Don't define. + * config/tc-z8k.h (DO_STRIP): Don't define. + + * symbols.c (colon): Call obj_frob_label if it is defined. + * config/obj-vms.h (obj_frob_label): Rename from tc_frob_label. + + * configure.in: Don't set files and links. Don't call + AC_LINK_FILES. Substitute te_file. Create targ-cpu.h, + obj-format.h, targ-env.h, and itbl-cpu.h in AC_OUTPUT. + * configure: Rebuild. + * Makefile.in (TARG_CPU_C): New variable. + (TARG_CPU_O, TARG_CPU_H): New variables. + (OBJ_FORMAT_C, OBJ_FORMAT_O, OBJ_FORMAT_H): New variables. + (TARG_ENV_H, ATOF_TARG_C, ATOF_TARG_O): New variables. + (SOURCES): Rename from REAL_SOURCES. Delete old definition. + (LINKED_SOURCES): Remove. + (HEADERS): Rename from REAL_HEADERS. Delete old definition. + (LINKED_HEADERS): Remove. + (OBJS): Use $(TARG_CPU_O), etc., rather than targ-cpu.o, etc. + ($(OBJS)): Depend upon $(TARG_ENV_H), etc., rather than + targ-cpu.h, etc. + ($(TARG_CPU_O), $(OBJ_FORMAT_O) $(ATOF_TARG_O)): New targets. + (targ-cpu.o, obj-format.o, atof-targ.o): Remove targets. + (itbl-cpu.h): Remove target. + (DISTCLEAN_HERE): Remove targ-cpu.c, obj-format.c, atof-targ.c, + atof-targ.h. + +Thu Mar 20 19:18:58 1997 Ian Lance Taylor + + * doc/as.texinfo (Symbol Names): Don't use obsolete @ctrl macro. + +Thu Mar 20 16:49:14 1997 Andreas Schwab + + * config/tc-m68k.c (mri_chip): Replace calls to get_symbol_end by + open coded loop that does not require the name to start with a + name beginner. + +Thu Mar 20 13:42:01 1997 H.J. Lu + + * frags.c (frag_var): Change offset parameter to offsetT. + (frag_variant): Likewise. + * frags.h (frag_variant, frag_var): Update declarations. + * config/tc-m68k.c (struct m68k_it): Change foff field to + offsetT. + (add_frag): Change off parameter to offsetT. + * Several files: Add casts to calls to frag_var. + + * Makefile.in (m68k-parse.c): Depend upon itbl-parse.c, to + serialize a parallel make. + (itbl-parse.h): Split target out from itbl-parse.c. + +Thu Mar 20 12:48:45 1997 Philippe De Muyter + + * config/m68k-parse.y (motorola_operand): Allow (zdireg,EXPR). + + * config/te-delta.h (COFF_COMMON_ADDEND): Define. + * config/obj-coff.c (fixup_segment): Check COFF_COMMON_ADDEND when + storing the value of a common symbol. + +Wed Mar 19 11:37:57 1997 Philippe De Muyter + + * config/obj-coff.c (glue_symbols): Unused variable symbolP + removed. + (crawl_symbols): Do not modify symbol_rootP and symbol_lastP here; + that is done by symbol_remove and symbol_insert. + + * config/obj-coff.h (S_IS_LOCAL): Return 0 for a debugging + symbol. + +Wed Mar 19 11:06:29 1997 Ian Lance Taylor + + * config/tc-mips.c (load_register): In 32 bit mode, when not + dealing with a 64 bit number, permit the upper 32 bits to be set + even if bit 31 is not set. + +Tue Mar 18 23:30:14 1997 Ian Lance Taylor + + * read.c (potable): Add "equiv". + (s_set): Handle .equiv based on argument. + * doc/as.texinfo (Equiv): New node to document .equiv. + (Err): New node to document .err. + +Tue Mar 18 15:50:13 1997 H.J. Lu + + * Many files: Add function prototypes. + * as.c (show_usage, parse_args): Make static. + * frags.h (frag_alloc): Declare. + * subsegs.c (subseg_set_rest): Don't declare frag_alloc. + * symbols.c (dollar_label_instance): Change return type to long. + * symbols.h (print_symbol_value): Declare. + (print_expr, print_expr_1, print_symbol_value_1): Declare. + * write.c (fix_new_exp): Don't declare make_expr_symbol. + (remove_subsegs, relax_frag): Make static. + * config/atof-vax.c (atof_vax_sizeof): Change letter to int. + (what_kind_of_float): Likewise. + (atof_vax): Make static. Change what_kind to int. + (md_atof): Change what_statement_type to int. + * config/obj-ecoff.h (obj_ecoff_set_ext): Declare. + * config/tc-alpha.c (vax_md_atof): Declare. + (md_atof): Don't declare atof_ieee and vax_md_atof. + * config/tc-i386.c (set_16bit_code_flag): Make static. + * config/tc-i386.h (tc_i386_fix_adjustable): Declare. + * config/tc-m68k.c (add_fix): Change width to int. + (insert_reg): Change regname to const. + (md_atof): Don't declare atof_ieee. + (demand_empty_rest_of_line): Don't declare. + * config/tc-m88k.c (md_atof): Don't declare atof_ieee. + * config/tc-sparc.c (cmp_reg_entry): Change args to const PTR. + (parse_keyword_arg): Change lookup_fn to take const arg. + (md_atof): Don't declare atof_ieee. + * config/tc-sparc.h: Add ifdef for multiple inclusion. + (tc_aout_pre_write_hook): Don't declare. + +Mon Mar 17 11:21:09 1997 Ian Lance Taylor + + * as.h (bfd_alloc_by_size_t): Don't declare. + * Many files: Use xmalloc rather than bfd_alloc_by_size_t. + +Sun Mar 16 13:49:21 1997 Philippe De Muyter + + * symbols.c (symbol_new): Don't call debug_verify_symchain. + (symbol_append): Set sy_next and sy_previous when adding a single + symbol to an empty list. Call debug_verify_symchain. + (verify_symbol_chain): Use assert, not know. + +Sat Mar 15 20:27:12 1997 Fred Fish + + * NEWS: Note BeOS support. + * configure.in: (ppc-*-beos): New target, use coff as object format. + * configure: Regenerate with autoconf. + +Sat Mar 15 19:14:02 1997 Ian Lance Taylor + + * config/tc-mips.c (md_apply_fix): Improve error message for out + of range branch. + + * Makefile.in: Add dependencies on obstack.h where needed. + +Fri Mar 14 15:33:38 1997 Ian Lance Taylor + + * config/tc-mips.c (md_estimate_size_before_relax): Handle the + case of a symbol equated to another symbol when using SVR4_PIC. + + * Makefile.in (TARG_CPU_DEP_sparc): Add opcode/sparc.h. + +Thu Mar 13 11:20:51 1997 Ian Lance Taylor + + * read.c (read_a_source_file): Call LISTING_NEWLINE before + HANDLE_CONDITIONAL_ASSEMBLY when handling an MRI line label. + + * config/obj-elf.c (obj_elf_data): Call md_flush_pending_output + and md_elf_section_change_hook if they are defined. + (obj_elf_text, obj_elf_previous): Likewise. + +Wed Mar 12 11:40:20 1997 Ian Lance Taylor + + * config/obj-multi.h (struct elf_obj_sy): Define if + OBJ_MAYBE_ELF. + (OBJ_SYMFIELD_TYPE): Define as struct elf_obj_sy if + OBJ_MAYBE_ELF. + * config/obj-elf.h (struct elf_obj_sy): Don't define if + OBJ_SYMFIELD_TYPE is defined. + + * doc/as.texinfo (bss): Improve description of .bss section. In + ELF or COFF, you are permitted to switch into the section. + (Comm): Rewrite description of common symbols. + (Lcomm): Mention that some targets permit a third argument. + +Tue Mar 11 01:13:31 1997 Ian Lance Taylor + + * config/tc-ppc.c (ppc_elf_lcomm): Don't call S_CLEAR_EXTERNAL. + + * symbols.c (colon): Change type of local to int. From Alan Modra + . + + * config/tc-m88k.c (m88k_do_align): Don't use a special nop + alignment if a zero fill pattern was explicitly specified. + * config/tc-sh.c (sh_do_align): Likewise. + + * read.c (equals): Always permit register names to be redefined. + + * config/tc-mips.c (mips_fix_adjustable): Permit a reloc against a + mips16 symbol to be adjusted if a symbol is being subtracted from + it. + + From Eric Youngdale : + * config/obj-elf.c (obj_elf_symver): Check for duplicate or + illegal symbol version names. + (elf_frob_symbol): Check for external default versions. + +Sun Mar 9 23:49:12 1997 Ian Lance Taylor + + From Eric Youngdale : + * config/obj-elf.h (struct elf_obj_sy): Define. + (OBJ_SYMFIELD_TYPE): Define to elf_obj_sy struct. Change all + users. + * config/obj-elf.c (obj_elf_symver): Just record the name. + (obj_symbol_new_hook): Initialized versioned_name field. + (elf_frob_symbol): If there is a versioned_name, either rename the + symbol, or add an alias with that name. + +Thu Mar 6 13:55:32 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (md_relax_table): Define. + (md_convert_frag): Implement. + (md_assemble): Handle relaxable operands/instructions correctly. + (md_estimate_size_before_relax): Implement. + * config/tc-mn10300.h (TC_GENERIC_RELAX_TABLE): Define. + + * config/tc-mn10200.c (md_relax_table): Fix typos. + + * config/tc-mn10300.c (md_assemble): Don't use any MN10300 specific + relocs anymore. Tweak fx_offset for pc-relative relocs. + +Wed Mar 5 15:46:16 1997 Ian Lance Taylor + + * cond.c (s_ifc): Call mri_comment_field and mri_comment_end when + in MRI mode. + +Tue Mar 4 10:01:04 1997 Ian Lance Taylor + + * read.c (equals): Add reassign parameter. Change all callers. + * read.h (equals): Update declaration. + +Sat Mar 1 01:04:04 1997 Ian Lance Taylor + + * config/tc-mips.c (mips16_extended_frag): Don't assume that we + can rely on the frag address to determine whether a frag is + earlier or later. + +Fri Feb 28 14:40:00 1997 Ian Lance Taylor + + * write.h (LOCAL_LABEL): Only define if not BFD_ASSEMBLER. + (S_LOCAL_NAME): Likewise. + (FAKE_LABEL_NAME): Define unconditionally. + * symbols.c (colon): Call bfd_is_local_label, not LOCAL_LABEL, if + BFD_ASSEMBLER. + (S_IS_LOCAL): Call bfd_is_local_label_name, not LOCAL_LABEL. + * config/tc-*.h: Only define LOCAL_LABEL if not BFD_ASSEMBLER. + Don't define FAKE_LABEL_NAME. + * config/te-ic960.h: Likewise. + * config/tc-mips.h (tc_frob_file_before_adjust): Define. + (mips_frob_file_before_adjust): Declare. + * config/tc-mips.c (mips_frob_file_before_adjust): New function. + (mips_local_label): Remove. + + * config/te-sco386.h: Remove; not used. + +Thu Feb 27 13:29:04 1997 Ian Lance Taylor + + * config/tc-m68k.c (md_assemble): Handle a reloc width of 'W'. + + * gasp.c (hash_add_to_string_table): Correct misspelling in error + message, and add newline. + (process_file): Don't process assignments in the label if this is + a equ or assign pseudo-op. + (process_pseudo_op): Swap first argument to do_assign for K_ASSIGN + and K_EQU, to match documentation. + +Thu Feb 27 12:00:03 1997 Michael Meissner -Wed Jul 10 12:45:23 1996 Richard Henderson + * config/obj-coff.c (obj_coff_section): Add 'r' section attribute + to denote read-only data sections. + +Thu Feb 27 00:26:33 1997 Ian Lance Taylor + + * config/obj-elf.c (obj_elf_common): Set BSF_OBJECT in flags. + * config/tc-sparc.c (s_common): Likewise, if BFD_ASSEMBLER. + + * expr.c (operand): Simplify 0b handling. Don't treat 0b as a + binary number if the next character is '+' or '-'. + +Wed Feb 26 18:19:00 1997 Stan Shebs + + * configure.in (mips*-*-lnews*): New target, also make empty + emulation list for this target. + * configure: Update. + * tc-mips.c (ECOFF_LITTLE_FORMAT): Define. + (mips_target_format): Use. + * te-lnews.h: New file. + +Wed Feb 26 11:56:11 1997 Ian Lance Taylor + + * Makefile.in (itbl-parse.c itbl-parse.h): Use $(BISON) and + $(BISONFLAGS), not $(YACC) and $(YACCFLAGS). + +Tue Feb 25 22:02:23 1997 Philippe De Muyter + + * config/tc-m68k.c (instring): Useless local declaration of + crack_operand removed. + * expr.h (expressionS): Changed type of X_op field to operatorT if + __GNUC__. + +Tue Feb 25 13:17:27 1997 Ian Lance Taylor + + Based on patches from Robert Lipe : + * configure.in: Add i386coff and i386elf to emulation list. + * configure: Rebuild. + * as.c (i386coff, i386elf): Declare. + * obj.h (coff_format_ops): Declare. + * config/obj-coff.c (OBJ_HEADER): Define. + (coff_obj_symbol_new_hook): Rename from obj_symbol_new_hook. + (coff_obj_read_begin_hook): Rename from obj_read_begin_hook. + (obj_pseudo_table): Add "version". + (coff_pop_insert): New static function. + (coff_sec_sym_ok_for_reloc): New static function. + (no_func): New static function. + (coff_format_ops): New variable. + * config/obj-coff.h (coff_obj_symbol_new_hook): Declare. + (obj_symbol_new_hook): Define. + (coff_obj_read_begin_hook): Declare. + (obj_read_begin_hook): Define. + * config/tc-i386.h (i386_target_format): Declare. + * config/tc-i386.c: Check OBJ_MAYBE_ELF as well as OBJ_ELF; check + OUTPUT_FLAVOR when appropriate. + (i386_target_format): New function. + * Makefile.in (obj-coff.o): New target. + (e-i386coff.o, e-i386elf.o): New targets. + + From Stephen Williams : + * config/tc-i960.h (TC_SYMFIELD_TYPE): Define if OBJ_COFF. + (_tc_get_bal_of_call): Don't declare. + (tc_get_bal_of_call): Declare as function, don't define as macro. + * config/tc-i960.c (tc_set_bal_of_call): If OBJ_COFF, store balP + in sy_tc field, not x_balntry field. + (tc_get_bal_of_call): Rename from _tc_get_bal_of_call. Change + return type to symbolS *. If OBJ_COFF, retrieve value from sy_tc + field, not x_balntry field. + + * config/obj-elf.c (obj_elf_section): Permit a .note section to + have the SHF_ALLOC attribute. + + * Makefile.in ($(OBJS)): Don't depend upon $(IT_HDRS). + (TARG_CPU_DEP_mips): Depend upon $(srcdir)/itbl-ops.h. + (itbl-lex.o): Depend upon itbl-parse.h. + + * itbl-parse.y (yyerror): Change return type to int. Change to + use old style function declaration. + + * Makefile.in (itbl-lex.o): Remove -Wall. + (itbl-parse.o): Likewise. + + * cond.c (s_ifdef): If we should omit conditionals from listings, + call listing_list. + (s_if, s_ifc, s_endif, s_else, s_ifeqs): Likewise. + * listing.c (list_info_struct): Add EDICT_NOLIST_NEXT. + (listing_listing): Handle EDICT_NOLIST_NEXT. + (listing_list): An argument of 2 means EDICT_NOLIST_NEXT. + * listing.h (LISTING_NOCOND): Define. + (LISTING_SKIP_COND): Define. + * as.c (show_usage): Mention c as a suboption of -a. + (parse_args): Handle c as a suboption of -a. + * doc/as.texinfo: Document -alc. + +Mon Feb 24 18:27:43 1997 Eric Youngdale + + * doc/as.texinfo: Document .symver. + +Mon Feb 24 15:19:57 1997 Martin M. Hunt + + * config/tc-d10v.c: Change pre_defined_registers to + d10v_predefined_registers and reg_name_cnt to d10v_reg_name_cnt. + +Mon Feb 24 10:40:45 1997 Fred Fish + + * config/obj-coff.c: Fix typo in comment section. + +Mon Feb 24 02:23:00 1997 Dawn Perchik + + * Makefile.in: Remove dependancies on itbl-cpu.h. + * as.c: Define stubs for itbl_parse and itbl_init if HAVE_ITBL_CPU + is not defined. + +Mon Feb 24 02:03:00 1997 Dawn Perchik + + * itbl-ops.h: Include as.h. + +Mon Feb 24 01:04:00 1997 Dawn Perchik + + * as.c: Remove -t option. + * configure, configure.in: Move itbl-cpu.h to mips specific configure. + * itbl-ops.h: Include itbl-cpu.h only if HAVE_ITBL_CPU is defined. + * config/tc-mips.h: Define HAVE_ITBL_CPU. + +Sun Feb 23 18:01:00 1997 Dawn Perchik + + * itbl-ops.c: Don't define DEBUG. + +Sun Feb 23 17:49:00 1997 Dawn Perchik + + * Makefile.in: Update itbl-test.c to reflect its new location. + +Sun Feb 23 15:50:00 1997 Dawn Perchik + + * itbl-ops.c: Add test for itbl_have_entries. + * config/tc-mips.c: Remove test for itbl_have_entries. + * config/tc-mips.h: Define tc_init_after_args to mips_init_after_args. + +Sun Feb 23 18:13:19 1997 Ian Lance Taylor + + * Makefile.in (DISTSTUFF): Remove itbl-parse.y, itbl-lex.l, and + itbl-ops.c. Add itbl-parse.c and itbl-lex.c. + (LEX, LEXFLAGS): Define. + * itbl-ops.c (append_insns_as_macros): Remove bogus ASSERT. + +Sat Feb 22 21:25:00 1997 Dawn Perchik + + * itbl-parse.y: Fix indentation mistakes from indent program. + * itbl-lex.l: Fix indentation mistakes from indent program. + * itbl-ops.h: Add include for ansidecl.h. + Add PARAMS around function arguments. + Add declaration for itbl_have_entries. + * itbl-ops.c: Add PARAMS around function arguments. + * Makefile.in: Add itbl build rules. + Add dependancies for itbl files to mips target. + * as.c: Add itbl support. + Add new option "--insttbl" for dynamically extending instruction set. + * as.h: Declare insttbl_file_name; + the name of file defining extensions to the basic instruction set + * configure.in, configure: Add itbl-parse.o, itbl-lex.o, and + itbl-ops.o to extra_objects for mips configuration. + Add include file link from itbl-cpu.h to + config/itbl-${target_cpu_type}.h. + * config/tc-mips.c: Allow copz instructions. + Add notes for future additions to the itbl support. + Add debug macros. + (macro): Call itbl_assemble to assemble itbl instructions. + See if an unknown register is specified in an itbl entry. + +Sat Feb 22 20:53:01 1997 Fred Fish + * doc/internals.texi (CPU backend): Fix typo in md_section_align + description. + +Fri Feb 21 14:34:31 1997 Martin M. Hunt + * config/tc-d10v.c (md_pcrel_from_section): Return 0 if + relocation is in different section. Fixes PR11574. + +Fri Feb 21 10:08:25 1997 Jim Wilson + + * tc-mips.c (mips_ip): If configured for an embedded ELF system, + don't set the section alignment to 2**4. + +Fri Feb 21 11:55:03 1997 Ian Lance Taylor + + * config/tc-m68k.c (line_comment_chars): Add '*'. + + * app.c (LEX_IS_TWOCHAR_COMMENT_2ND): Don't define. + (do_scrub_begin): Don't set lex['*']. + (do_scrub_chars): When handling LEX_IS_TWOCHAR_COMMENT_1ST, don't + check for LEX_IS_TWOCHAR_COMMENT_2ND. Instead, just check for + a literal '*'. + + * configure.in: Set em=svr4 for m68k-*-sysv4*. + * configure: Rebuild. + * config/te-svr4.h: New file. + * config/tc-m68k.c (m68k_comment_chars): Only include `#' if + TE_SVR4 or TE_DELTA. + +Thu Feb 20 22:24:39 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10200.c (md_convert_frag): Create a fixup for the + short conditional branch around a long unconditional branch. + +Thu Feb 20 13:56:00 1997 Ian Lance Taylor + + * config/obj-coff.c (obj_coff_ln [both versions]): Call + new_logical_line. + + * config/tc-arm.c (fix_new_arm): Use make_expr_symbol to handle a + complex expression. + + * symbols.c (resolve_symbol_value): If both left and right + operands are undefined, warn about both of them. + +Wed Feb 19 00:53:28 1997 Ian Lance Taylor + + Based on patches from Eric Youngdale : + * config/obj-elf.c (elf_pseudo_table): Add "symver". + (obj_elf_symver): New static function. + * config/obj-elf.h (OBJ_COPY_SYMBOL_ATTRIBUTES): Copy the st_other + field. + + * write.c (relax_segment): Make type and printf format agree. + + * read.c (get_line_sb): Don't end the line on a semicolon inside a + string. + +Sun Feb 16 17:47:29 1997 Fred Fish + + * config/tc-alpha.h (md_operand): Define with a null expansion, + like all the other targets. + * doc/internals.texi (CPU backend): Add missing word in + md_flush_pending_output description. Fix typo in md_convert_frag + description. + +Fri Feb 14 18:09:59 1997 Philippe De Muyter + + * config/tc-m68k.c (LOCAL_LABEL): Macro redefined if TE_DELTA. + (tc_canonicalize_symbol_name): Macro defined if TE_DELTA. + * config/obj-coff.c (obj_coff_def): Use + tc_canonicalize_symbol_name if defined. + (obj_coff_tag, obj_coff_val): Likewise. + * expr.c (operand): Reject '~' as operator if is_name_beginner. + +Fri Feb 14 17:24:48 1997 Ian Lance Taylor + + Based on notes from Peter Eriksson . The target + does not actually work, though: + * configure.in (i386-sequent-bsd*): New target. + * configure: Rebuild. + * config/tc-dynix.h: New file. + * config/tc-i386.h: Define TARGET_FORMAT if TE_DYNIX. + + * read.c (do_align): Add max parameter. Change all callers. + Remove useless static variables. + (s_align): New static function. Do common portion of + s_align_bytes and s_align_ptwo. + (s_align_bytes, s_align_ptwo): Just call s_align. + * frags.c (frag_align): Add max parameter. Change all callers. + (frag_align_pattern): Likewise. + * frags.h (frag_align, frag_align_pattern): Update declarations. + * write.c (relax_segment): Limit alignment change to fr_subtype. + Fix some types to be addressT. + * config/obj-coff.c (size_section): Likewise. + * config/obj-ieee.c (size_section): Likewise. + * config/tc-d10v.h (md_do_align): Add max parameter. + * config/tc-i386.h (md_do_align): Likewise. + * config/tc-m88k.h (md_do_align): Likewise. + * config/tc-m88k.c (m88k_do_align): Likewise. + * config/tc-sh.h (md_do_align): Likewise. + * config/tc-sh.c (sh_do_align): Likewise. + * as.h: Improve comments on rs_align and rs_align_code. + * doc/as.texinfo: Document new alignment arguments. + * doc/internals.texi (Frags): Document use of fr_subtype field for + rs_align and rs_align_code. + +Fri Feb 14 15:56:06 1997 Gavin Koch + + * config/tc-mips.c: Changed opcode parsing. + +Thu Feb 13 20:02:16 1997 Fred Fish + + * config/{tc-alpha.h, tc-arc.h, tc-d10v.h, tc-generic.h, tc-i960.h, + tc-mn10200.h, tc-mn10300.h, tc-sh.h, tc-vax.h, tc-w65.h}: + Add default definition of zero for TARGET_BYTES_BIG_ENDIAN. + * config/{tc-arm.h, tc-hppa.h, tc-i386.h, tc-mips.h, tc-ns32k.h, + tc-ppc.h, tc-sparc.h}: Move definition of TARGET_BYTES_BIG_ENDIAN + to a location consistent with the rest of the target include files. + * config/tc-i386.c: Remove misleading comment. + * doc/internals.texi (CPU backend): Add description of function + md_undefined_symbol. + +Thu Feb 13 21:44:18 1997 Klaus Kaempf + + * as.h: GNU c provides unlink() function. + + Unify section handling on openVMS/Alpha: + * config/tc-alpha.c(s_alpha_link): Remove. + (s_alpha_section): New function. + Remove case-hacking of symbols + Add .code_address pseudo-op. + (BFD_RELOC_ALPHA_CODEADDR): New relocation. + (s_alpha_code_address): New function. + (alpha_ctors_section, alpha_dtors_section): New sections for C++ + static constructors/destructors. + Add debug code for crash debugs, to be removed when traceback code + is added to object code. + (s_alpha_name): New function for .name pseudo-op. + (alpha_print_token): New function to print token expressions with + alpha specific extensions. + + * makefile.vms: Allow compilation with current gcc snapshot. + +Thu Feb 13 16:29:04 1997 Fred Fish + + * doc/Makefile.in (TEXI2DVI): Set to just name of program. + (DVIPS): Set to dvips. + (ps, as.ps, gasp.ps): New targets. + (internals.info, gasp.dvi, internals.dvi): Set both TEXINPUTS + and MAKEINFO env variables. + (internals.ps): Use DVIPS macro. + (clean): Remove core and backup files. + (distclean): Remove temporary files from building internals. + (clean-dvi): Ditto. + * doc/internals.texi (Frags): Fix typo. + (GAS processing): Ditto. + (CPU backend): Ditto. + * ecoff.c (init_file): Use TARGET_BYTES_BIG_ENDIAN value directly. + * mpw-config.in: Define TARGET_BYTES_BIG_ENDIAN as 1. + * read.c: Remove ugly hack that dealt with config files not + correctly defining TARGET_BYTES_BIG_ENDIAN. + (target_big_endian): Use TARGET_BYTES_BIG_ENDIAN directly. + * config/arm-big.mt: Define TARGET_BYTES_BIG_ENDIAN to 1. + * config/arm-lit.mt: Define TARGET_BYTES_BIG_ENDIAN to 0. + * config/mips-big.mt: Define TARGET_BYTES_BIG_ENDIAN to 1. + * config/mips-lit.mt: Define TARGET_BYTES_BIG_ENDIAN to 0. + * config/ppc-lit.mt: Define TARGET_BYTES_BIG_ENDIAN to 1. + * config/ppc-sol.mt: Replace TARGET_BYTES_LITTLE_ENDIAN + with TARGET_BYTES_BIG_ENDIAN defined to 0. + * config/tc-arm.h: Remove use of TARGET_BYTES_LITTLE_ENDIAN + and simplify. Test value of TARGET_BYTES_BIG_ENDIAN, not just + whether it is defined or not. + * config/tc-mips.h: Remove use of TARGET_BYTES_LITTLE_ENDIAN. + * config/tc-ppc.h: Remove use of TARGET_BYTES_LITTLE_ENDIAN + and simplify. Test value of TARGET_BYTES_BIG_ENDIAN, not just + whether it is defined or not. + +Thu Feb 13 14:40:16 1997 Doug Evans + + * write.c (write_relocs): Correct text in as_fatal error message, + bfd_perform_relocation -> bfd_install_relocation. + +Thu Feb 13 14:48:03 1997 Philippe De Muyter + + * config/tc-m68k.c (LEX_TILDE): Define if TE_DELTA. + * read.c (LEX_TILDE): Define if not defined. + (lex_type): Use LEX_TILDE. + * expr.c (get_symbol_end): Check first char with is_name_beginner, + not is_part_of_name. + +Thu Feb 13 11:40:58 1997 Ian Lance Taylor + + * config/tc-sparc.c (md_show_usage): Add missing backslash at end + of continued line. + + * config/tc-mips.c (mips16_extended_frag): Correct base address + for an extended PC relative instruction. + (md_convert_frag): Likewise. + + * config/tc-mips.c (prev_nop_frag): New static variable. + (prev_nop_frag_holds): New static variable. + (prev_nop_frag_required): New static variable. + (prev_nop_frag_since): New static variable. + (append_insn): If we aren't reordering, and prev_nop_frag is not + NULL, and we don't need any nops, then decrease the size of + prev_nop_frag. Don't insert nops because of instructions in + noreorder sections. Remember whether the previous instructions + where in noreorder sections even when not reordering. + (mips_no_prev_insn): Add preserver parameter. Change all + callers. Refer prev_nop_frag variables when appropriate. + (mips_emit_delays): Set up prev_nop_frag. + (s_mipsset): Clear prev_nop_frag if reordering. + +Wed Feb 12 14:36:29 1997 Ian Lance Taylor + + * config/tc-mips.c (append_insn): Remove useless code which + handled swapping a mips16 jump with a mips16 instruction with a + reloc. + + * config/tc-mips.c (md_parse_option): When debugging, set + mips_optimize to 1, not 0. + + * config/tc-mips.c (mips16_ip): Handle an extend operand. + + * config/tc-mips.c (my_getExpression): In mips16 mode, if it looks + like the expression was based on `.', adjust the value of the + symbol. + + * config/tc-mips.c (append_insn): Warn about an attempt to put an + extended instruction in a delay slot when not reordering. + (md_convert_frag): Warn if an extended instruction appears in a + delay slot. + + * config/tc-mips.c (mips_pseudo_table): Add "insn". + (s_insn): New static function. + * doc/c-mips.texi: Document .insn. + + * config/tc-mips.c (md_begin): Add the general registers to the + symbol table. + (mips16_ip): First parse the expression, and then see whether it + came up with a register, rather than trying to first see whether + we are looking at a register. + +Tue Feb 11 15:52:22 1997 Ian Lance Taylor + + * config/tc-mips.c (mips16_ip): Handle %gprel modifier. + (md_apply_fix): Handle BFD_RELOC_MIPS16_GPREL. + + * config/tc-mips.c (append_insn): Output jump instruction as a + pair of 2 byte instructions, rather than as a single 4 byte + instruction. + +Mon Feb 10 22:06:00 1997 Dawn Perchik (dawn@cygnus.com) + + * itbl-ops.c, itbl-lex.l, itbl-parse.y, itbl-ops.h, + config/itbl-mips.h: Add copyright message and fix indentation. + +Mon Feb 10 18:09:00 1997 Dawn Perchik (dawn@cygnus.com) + + * itbl-ops.c: New file. Add support for dynamically read + instruction registers, opcodes and formats. Build internal table + for new instructions and provide callbacks for assembler and + disassembler. + * itbl-lex.l, itbl-parse.y: Lex and yacc parsers for instruction + spec table. + * itbl-ops.h: New file. Header file for itbl support. + * config/itbl-mips.h: New file. Mips specific definitions for + itbl support. + +Fri Feb 7 09:52:34 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10200.c (md_assemble): If a constant operand won't + fit into the constant field of a relaxable operand, then it does + not match. + +Thu Feb 6 20:08:12 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10200.c (md_estimate_size_before_relax): Treat + a jsr target in a different section just like a jsr to + an undefined target. + +Thu Feb 6 16:52:57 1997 Ian Lance Taylor + + * config/tc-mips.c (mips_fix_adjustable): Don't adjust relocations + against any mips16 symbols, not just externally visible ones. + (md_apply_fix): Corresponding change. + +Wed Feb 5 11:11:06 1997 Ian Lance Taylor + + * config/tc-mips.c (mips16_ip): Accept floating point registers in + the operand of the exit instruction. + +Tue Feb 4 14:12:39 1997 Ian Lance Taylor + + * symbols.c (resolve_symbol_value): If we leave an equated symbol + as O_symbol, copy over the segment. + +Mon Feb 3 12:35:54 1997 Ian Lance Taylor + + * config/tc-mips.c (md_apply_fix): If we aren't adjusting this + fixup to be against the section symbol, adjust the value + accordingly. + + * symbols.c (resolve_symbol_value): Don't change X_add_number for + an equated symbol. + * write.c (write_relocs): Avoid looping on equated symbols. + Adjust fx_offset by X_add_number for each symbol. + * config/obj-coff.c (do_relocs_for): Avoid looping on equated + symbols. + (fixup_segment): Add a loop to track down equated symbols and + adjust fx_offset appropriately. + +Fri Jan 31 15:21:02 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10200.c (md_relax_table): Add entries to allow + jmp -> bra relaxing. + (md_convert_frag): Handle jmp->bra relaxing. + (md_assemble): Handle jmp->bra relaxing. + (md_estimate_size_before_relax): Likewise. + +Fri Jan 31 13:15:05 1997 Alan Modra + + * config/tc-i386.c (i386_align_code): Add comments explaining the + nop instructions. + +Fri Jan 31 10:46:14 1997 Ian Lance Taylor + + * config/tc-sparc.c (enforce_aligned_data): New static variable. + (sparc_cons_align): Don't do anything unless enforce_aligned_data + is set. + (md_longopts): Add "enforce-aligned-data". + (md_show_usage): Mention --enforce-aligned-data. + * doc/c-sparc.texi (Sparc-Aligned-Data): New node; document + enforce-aligned-data. + + * config/tc-ppc.c (md_pseudo_table): If OBJ_XCOFF, add "long", + "word", and "short". + (ppc_xcoff_cons): New static function. + + * write.c (relax_segment): Give an error if a .space symbol is + common or undefined. + + * read.c (read_a_source_file): Don't handle mri_pending_align if + the handler is s_globl or s_ignore. + +Thu Jan 30 11:46:59 1997 Fred Fish + + * config/tc-d10v.c (find_opcode): Remove unused variable "numops". + +Thu Jan 30 12:28:18 1997 Alan Modra + + * config/tc-i386.c (i386_align_code): Improve the nop patterns. + +Thu Jan 30 12:08:40 1997 Ian Lance Taylor + + * config/tc-mips.c (mips_fix_adjustable): New function. + * config/tc-mips.h (tc_fix_adjustable): Call mips_fix_adjustable. + (mips_fix_adjustable): Declare. + + Ideas from Srinivas Addagarla : + * read.c (read_a_source_file): After doing an mri_pending_align, + adjust the line_label if there is one. + (s_space): Set mri_pending_align if an odd number of bytes were + output. + +Wed Jan 29 15:31:12 1997 Martin M. Hunt + + * config/tc-d10v.h (md_do_align): Add this hook to call + d10v_cleanup() when a ".align" is detected. Fixes PR11487. + + * config/tc-d10v.c (find_opcode): Correctly calculate + branch displacement when .aligns are present. + +Wed Jan 29 09:42:11 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10200.c (md_relax_table): Define. + (md_convert_frag): Implement. + (md_assemble): Handle relaxable operands/instructions correctly. + (md_estimate_size_before_relax): Implement. + * config/tc-mn10200.h (TC_GENERIC_RELAX_TABLE): Define. + +Tue Jan 28 15:27:28 1997 Ian Lance Taylor + + * config/tc-mips.c (append_insn): Give an error for jumps to a + misaligned address. + (md_apply_fix): Make a branch to an odd address an error rather + than a warning. + + * config/tc-mips.c (md_convert_frag): If the user explicitly + requested an extended opcode, pass warn as true to mips16_immed. + + * config/tc-mips.c (mips16_ip): Handle a missing expression like + an explicit 0, so that explicitly extended instructions work + correctly. + +Mon Jan 27 17:41:20 1997 Ian Lance Taylor + + * ecoff.c (ecoff_build_symbols): Don't generate a local ECOFF + symbol for a common symbol. + +Wed Jan 22 10:39:39 1997 Doug Evans + + Patch presumed to have been checked in awhile ago but wasn't. + Mon Nov 25 10:45:14 1996 Doug Evans + * write.c: Delete "ifndef md_relax_frag" around is_dnrange. + (relax_segment, case rs_org): Move code inside braces. Move locals + target,after inside too. + (relax_segment, case rs_machine_dependent): Guts moved to ... + (relax_frag): New function. + Call md_prepare_relax_scan if defined. + +Mon Jan 20 10:56:47 1997 Andreas Schwab + + * config/tc-m68k.c (m68k_ip): Reject pc-relative addresses for the + 'p' operand specifier. + +Mon Jan 20 10:39:36 1997 J.T. Conklin + + * config/tc-m68k.c (HAVE_LONG_BRANCH): New macro, returns true for + m68k family cpus which support long branch addressing modes. + (m68k_ip, md_convert_frag_1, md_estimate_size_before_relax, + md_create_long_jump): Use it. + +Mon Jan 20 12:42:06 1997 Ian Lance Taylor + + * config/tc-mips.c (md_begin): Don't set SEC_ALLOC or SEC_LOAD for + the .reginfo or .MIPS.options section if configured for an + embedded target. + + * config/tc-mips.c (md_begin): Don't set interlocks for + mips_4650. + +Wed Jan 15 13:51:50 1997 Ian Lance Taylor + + * read.c (read_a_source_file): Make sure the symbol ends with + whitespace before checking whether the next character is '='. + +Tue Jan 14 15:07:27 1997 Robert Lipe + + * config/tc-i386.c (sco_id): Moved from here... + * config/obj-elf.c (sco_id): ...to here. Adding the identifier + really is an SCO ELF specific thing, not just a SCO x86 specific + thing. + +Thu Jan 9 09:08:43 1997 Ian Lance Taylor + + * read.c (emit_expr): Check for overflow of a negative value + correctly. + * write.c (fixup_segment): Likewise. + * config/obj-coff.c (fixup_segment): Likewise. + + * config/tc-m68k.c (struct label_line): Define. + (labels, current_label): New static variables. + (md_assemble): Mark current_label as text, and clear it. + (m68k_frob_label): New function. + (m68k_flush_pending_output): New function. + (m68k_frob_symbol): New function. + * config/tc-m68k.h (tc_frob_label): Define. + (md_flush_pending_output): Define. + (tc_frob_symbol): Don't warn, just call m68k_frob_symbol. + (tc_frob_coff_symbol): Likewise. + + * read.c (read_a_source_file): When defining a macro in MRI mode, + don't add the symbol to the symbol table. + +Tue Jan 7 11:21:42 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (tc_gen_reloc): Handle sym1-sym2 fixups + here since fixup_segment doesn't (linkrelax is set). + * config/tc-mn10200.c (tc_gen_reloc): Likewise. + +Mon Jan 6 15:19:32 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10200.c (md_assemble): Tweak fx_offset for pc-relative + relocs. + +Fri Jan 3 16:47:08 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-hppa.c (struct hppa_fix_struct): Tweak fx_r_field's type + to avoid warnings with the native HP compiler. + (fix_new_hppa): Similarly for the r_type argument. + (pa_build_unwind_subspace, hppa_elf_mark_end_of_function): Enclose + in an #if OBJ_ELF to keep gcc -Wall quiet. + (md_apply_fix): Always initialize "result". + + * config/tc-mn10200.c (md_assemble): Generate relocations. + +Fri Jan 3 18:17:23 1997 Andreas Schwab + + * config/tc-m68k.c (s_even): Adjust the alignment of the current + section. + +Fri Jan 3 17:10:33 1997 Richard Henderson + + * config/obj-elf.c (elf_file_symbol): When using ECOFF debugging, + pass on the new file hook. + + * config/tc-alpha.c (alpha_fix_adjustable): Not quite the same as + !alpha_force_relocation, as local LITERALs can be adjusted to be + relative to the section. + +Fri Jan 3 12:09:24 1997 Ian Lance Taylor + + * config/obj-coff.c (yank_symbols): If tc_frob_coff_symbol is + defined, call it. + * config/tc-m68k.h (tc_frob_symbol): Check whether text label is + aligned to odd boundary. + (tc_frob_coff_symbol): Define. + + * doc/as.texinfo (Set): Change parenthesized @xref to @pxref. + + * macro.c (macro_expand_body): In MRI mode, just copy a single &. + + * config/tc-m68k.c (m68k_ip): Call frag_grow before adding a + PCINDEX frag. From Ronald F. Guilmette . + + * config/tc-m68k.c (m68k_ip): Accept 'B' as a size for an + immediate value. + (md_assemble): If the size is 'B', set fx_signed. + (md_apply_fix_2): Use fx_signed when checking for overflow. + + * write.h (struct fix): Add fx_signed field. + * write.c (fix_new_internal): Initialize fx_no_overflow and + fx_signed fields. + (fixup_segment): Use fx_signed when checking for overflow. + * config/obj-coff.c (fixup_segment): Check fx_no_overflow and + fx_signed when checking for overflow. + +Thu Jan 2 13:37:29 1997 Ian Lance Taylor + + * NOTES, NOTES.config: Removed. These are rarely, if ever, + updated, and all the useful information is in doc/internals.texi. + + Based on patch from Ronald F. Guilmette : + * read.c (read_a_source_file): Check for conditional operators + before doing an MRI pending alignment. + * config/tc-m68k.h (m68k_conditional_pseudoop): Declare. + (tc_conditional_pseudop): Define. + * config/tc-m68k.c (m68k_conditional_pseudop): New function. + * doc/internals.texi (CPU backend): Describe + tc_conditional_pseudoop. + + Based on patch from Ronald F. Guilmette : + * config/tc-m68k.c (m68k_rel32_from_cmdline): New static + variable. + (md_begin): Check m68k_rel32_from_cmdline before setting + m68k_rel32. + (m68k_mri_mode_change): Likewise. + (md_longopts): Add --disp-size-default-16 and + --disp-size-default-32. + (md_parse_option): Handle new options. + (md_show_usage): Mention new options. + * doc/c-m68k.texi (M68K-Opts): Document new options. + + Based on patch from Ronald F. Guilmette : + * config/tc-m68k.c (m68k_index_width_default): New static + variable. + (m68k_ip): Use m68k_index_width_default to set the size of a base + register whose size was not given. + (md_longopts): Add --base-size-default-16 and + --base-size-default-32. + (md_parse_option): Handle new options. + (md_show_usage): Mention new options. + * doc/c-m68k.texi (M68K-Opts): Document new options. + + * doc/c-mips.texi: Mention ISA level 4, and the -mips16 option. + + * configure.in: Recognize mips-*-linux* target. + * configure: Rebuild. + + * config/tc-mips.c (load_register): Rewrite 64 bit handling to + work if valueT is only 32 bits. + + * config/tc-mips.c: Throughout, check target_big_endian rather + than byte_order. + (byte_order): Remove. + (mips_init_after_args): Remove. + * config/tc-mips.h (LITTLE_ENDIAN, BIG_ENDIAN): Don't define. + (mips_init_after_args): Don't declare. + (tc_init_after_args): Don't define. + + * config/tc-mips.h (tc_frob_after_relocs): Define if + OBJ_MAYBE_ELF. + (mips_elf_final_processing): Likewise. + (ELF_TC_SPECIAL_SECTIONS): Likewise. + +Tue Dec 31 12:56:41 1996 Ian Lance Taylor + + * read.c (read_a_source_file): Check mri_pending_align after + checking for a macro. From Ronald F. Guilmette + . + + * Makefile.in (ALL_CFLAGS): Add -D_GNU_SOURCE. + + * config/tc-sparc.c (md_apply_fix3): Rename from md_apply_fix, and + add segment argument. If OBJ_ELF, treat a relocation against a + symbol in a linkonce section like a relocation against an external + symbol. + * config/tc-sparc.h (MD_APPLY_FIX3): Define. + +Mon Dec 30 11:35:40 1996 Ian Lance Taylor + + * config/tc-mips.c (mips16_macro): Add case for M_ABS. + +Fri Dec 27 22:51:51 1996 Fred Fish + + * NOTES.config (Implementation): as.h #define's "GAS" not "gas", + includes config.h instead of host.h, tc.h instead of tp.h, and + targ-env.h instead of target-environment.h. + Also, obj-format.h includes targ-cpu.h instead of + target-processor.h. + +Fri Dec 27 11:42:29 1996 Ian Lance Taylor + + * doc/as.texinfo (M): Mention explicitly that -M changes macro + handling. + +Thu Dec 19 12:06:08 1996 Ian Lance Taylor + + * write.c (adjust_reloc_syms): If the fixup symbol has been + equated to an undefined symbol, convert the fixup to being against + the target symbol. Remove obsolete code handling a special case + for i386 PIC. + +Wed Dec 18 22:54:39 1996 Stan Shebs + + * mpw-make.sed: Use NewFolderRecursive for installation. + +Wed Dec 18 16:00:42 1996 Martin M. Hunt + + * config/tc-d10v.c (do_assemble): Correct previous bug fix. + +Wed Dec 18 15:27:40 1996 Martin M. Hunt + + * config/tc-d10v.c (md_assemble): Fix bug which caused + second instruction in a line to be case sensitize. PR11312 + +Wed Dec 18 10:08:46 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10200.c (mn10200_insert_operand): Don't + range check operands with MN10200_OPERAND_NOCHECK set. + (check_operand): Likewise. + +Tue Dec 17 10:59:32 1996 Ian Lance Taylor + + * config/tc-mips.c: Undo part of last Friday's alignment changes. + (md_begin): Always align the text section to a four byte + boundary. + (append_insn): Remove call to record_align. + + * config/tc-mips.c (insn_label): Remove. + (struct insn_label_list): Define. + (insn_labels, free_insn_labels): New static variables. + (mips_clear_insn_labels): New static function. + (append_insn): Mark all mips16 text labels, and make them odd. + Handle all labels after emitting a nop, not just one. Call + mips_clear_insn_labels rather than just clearing insn_label. + (mips_emit_delays): Add insns parameter, and use it to decide + whether to mark mips16 labels. Handle all labels, not just one. + Force mips16 labels to be odd. Change all callers. + (mips16_immed): Don't check for an odd branch target. + (md_apply_fix): Don't check mips16 mode for a branch reloc. + (mips16_extended_frag): Ignore the low bit in a branch target. + (md_convert_frag): Likewise. + (mips_no_prev_insn): Call mips_clear_insn_labels rather than just + clearing insn_label. + (mips_align, mips_flush_pending_output, s_cons): Likewise. + (s_float_cons, s_gpword): Likewise. + (s_align): Use insn_labels rather than insn_label. + (s_cons, s_float_cons, s_gpword): Likewise. + (mips_frob_file_after_relocs): New function. + (mips_define_label): Rewrite to add to insn_labels list. + * config/tc-mips.h (tc_frob_file_after_relocs): Define. + * ecoff.c (ecoff_build_symbols): If the size of a function comes + out odd, increment it. + + * config/tc-mips.c (append_insn): Only update prev_insn when not + reordering if place is NULL. + + * config/tc-mips.c (mips16_ip): Check for a missing expression + when using the register indirect addressing mode. + +Mon Dec 16 10:08:46 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10200.c (mn10200_insert_operand): Don't + check 24bit operands for overflow. + (check_operand): Likewise. + +Mon Dec 16 11:50:40 1996 Ian Lance Taylor + + * doc/as.texinfo (Section): Document how to use the .section + pseudo-op for COFF and ELF. + +Sun Dec 15 15:26:37 1996 Ian Lance Taylor + + * write.c (adjust_reloc_syms): Fix linkonce check for ELF. + +Sat Dec 14 22:37:27 1996 Ian Lance Taylor + + * config/tc-mips.c (prev_insn_reloc_type): New static variable. + (RELAX_MIPS16_ENCODE): Add dslot and jal_dslot arguments, and + store them. Adjust other RELAX_MIPS16 macros. + (RELAX_MIPS16_DSLOT): Define. + (RELAX_MIPS16_JAL_DSLOT): Define. + (append_insn): Pass new arguments to RELAX_MIPS16_ENCODE. Correct + handling of whether previous instruction has a fixup. Set + prev_insn_reloc_type. + (mips_no_prev_insn): Clear prev_insn_reloc_type. + (mips16_extended_frag): Use the right base address for a PC + relative add or load. + (md_convert_frag): Likewise. If a PC relative add or load is + used, record the alignment for the section. + +Fri Dec 13 13:00:33 1996 Ian Lance Taylor + + * write.c (adjust_reloc_syms): Don't reduce a reloc against a + linkonce section into a reloc against the section symbol. + + * config/tc-mips.c (mips16_macro): Remove nop instructions after + branch instructions. + + * config/tc-mips.c (md_begin): If configured for an embedded ELF + system, don't set the section alignment to 2**4. + (s_change_sec): Likewise. + (append_insn): Call record_alignment for the section. + (md_section_align): Don't align the section size for an embedded + ELF system. + +Thu Dec 12 16:40:47 1996 Ian Lance Taylor + + * write.c (adjust_reloc_syms): Make sure that symbols are + resolved; expression symbols may have been skipped. + * config/obj-coff.c (fixup_segment): Likewise. + +Thu Dec 12 15:18:21 1996 Michael Meissner + + * config/tc-ppc.c (ppc_elf_suffix): Move @plt to + BFD_RELOC_24_PLT_PCREL relocation. + (md_apply_fix3): Support BFD_RELOC_24_PLT_PCREL. + +Tue Dec 10 13:51:55 1996 Martin M. Hunt + + * config/tc-d10v.c (write_2_short): Remove code that called + parallel_ok() when the programmer specified parallel instructions. + +Tue Dec 10 12:23:19 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (md_assemble): Update to handle endianness + issues correctly. + + * config/tc-mn10200.c (md_assemble): Opcode 0x0 is valid! + * config/tc-mn10300.c (md_assemble): Likewise. + +Tue Dec 10 11:37:14 1996 Ian Lance Taylor + + * config/tc-mips.c (append_insn): Make sure there is enough room + in a frag after a mips16 instruction to switch it with a jump + instruction. + + * config/tc-mips.c (mips16_extended_frag): Give an error for an + attempt to use a non absolute symbol in an extending frag. + +Mon Dec 9 16:48:20 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10200.c: Flesh out assembler support for MN10200. + * config/tc-mn10200.h: Likewise. + +Mon Dec 9 17:09:42 1996 Ian Lance Taylor + + * app.c (do_scrub_chars): At the end of a C comment, pass space to + UNGET rather than PUT. Set old_state before setting state to -2. + + * config/tc-mips.c (mips16_extended_frag): Avoid an infinite loop + when extending because the value is exactly maxtiny + 1. + + * config/tc-mips.c (RELAX_MIPS16_ENCODE): Add small and ext + arguments, and store them. Adjust other RELAX_MIPS16 macros. + (RELAX_MIPS16_USER_SMALL): Define. + (RELAX_MIPS16_USER_EXT): Define. + (mips16_small, mips16_ext): New static variables. + (append_insn): Pass mips16_small and mips16_ext to + RELAX_MIPS16_ENCODE. + (mips16_ip): Set mips16_small and mips16_ext. + (mips16_immed): Don't check mips16_autoextend. + (mips16_extended_frag): Check USER_SMALL and USER_EXT. + + * write.c (write_relocs): Print an error for an out of range + fixup, rather than calling abort. + + * as.c (main): Unlink the output file if there are errors while + generating the fixups. + +Fri Dec 6 18:48:13 1996 Ian Lance Taylor + + * config/tc-mips.c (mips16_extended_frag): Don't call + S_GET_VALUE. + (md_convert_frag): Call resolve_symbol_value before calling + S_GET_VALUE, and don't add in the frag address. + + * config/tc-mips.c (mips16_immed): Add file and line parameters, + and use them when reporting errors. Change all callers. + +Fri Dec 6 15:36:32 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c: Fix various gcc -Wall warnings. + Remove '$' prefixing for registers. + +Fri Dec 6 00:55:48 1996 Martin + + * config/tc-d10v.c (md_assemble): Check to see if prev_seg + is initialized before using it. + (d10v_cleanup): No longer uses its argument, so make it void. + + * config/tc-d10v.h (d10v_cleanup): Change prototype. + +Thu Dec 5 11:03:31 1996 Ian Lance Taylor + + * write.c (fixup_segment): Don't discard the symbol for a PC + relative fixup to an absolute symbol. + +Wed Dec 4 15:42:41 1996 Martin M. Hunt + + * config/tc-d10v.c (md_assemble, d10v_cleanup): Fix bug + with multiple sections. + +Wed Dec 4 13:00:07 1996 Ian Lance Taylor + + * config/tc-mips.c (md_longopts): Rename mips-16 to mips16, and + no-mips-16 to no-mips16. + (s_mipsset): Accept .set mips16 and .set nomips16. + +Wed Dec 4 10:35:33 1996 Michael Meissner + + * config/tc-ppc.c (ppc_elf_suffix): Take expressionS pointer + argument, and check for +/- constant following the suffix, folding + it into the expression. + (ppc_elf_cons): Change ppc_elf_suffix calls. + (md_assemble): Ditto. + (shlib): Replace boolean mrelocatable with enumeration shlib. + (md_parse_option): Discriminate between PIC style shared libraries + and -mrelocatable. + (ppc_elf_validate_fix): Don't report warnings for PIC style shared + libraries. + +Tue Dec 3 23:18:29 1996 Michael Meissner + + * config/tc-ppc.h ({tc,ppc}_comment_chars): Define, so that we can + change the comment characters. + + * config/tc-ppc.c (comment_chars): Delete in favor of + tc_comment_chars. + (ppc_{eabi,solaris}_comment_chars): Eabi and Solaris versions of + comment chars. + (ppc_comment_chars): Select appropriate comment chars by default. + (msolaris): New flag for -m{,no-}solaris. + (md_parse_option): Recognize -K pic. Add support for + -m{,no-}solaris. + (md_show_usage): Update. + (md_begin): Do not set ELF flags if Solaris. + (ppc_elf_suffix): @local sets R_PPC_LOCAL24PC relocation. + (md_apply_fix3): Add support for R_PPC_LOCAL24PC. + +Mon Dec 2 13:48:57 1996 Ian Lance Taylor + + * as.c (main): Correct handling of flag_always_generate_output. + +Sun Dec 1 21:46:05 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (tc_gen_reloc): Get the addend from + fx_offset, not fx_addnumber. + + * config/tc-mn10300.h (tc_fix_adjustable): Don't do any + reloc adjustments. + +Sat Nov 30 17:34:48 1996 Eliot Dresselhaus + + * config/tc-i386.c: Correct misspelling: balenced to balanced. + +Wed Nov 27 13:25:39 1996 Ian Lance Taylor + + * config/tc-mips.c (md_section_align): Check for an alignment of + 4, not an alignment of 16. Corrects August 7 patch. + +Tue Nov 26 10:33:16 1996 Ian Lance Taylor + + * configure, conf.in: Rebuild with autoconf 2.12. + + * config/tc-ppc.c (ppc_elf_lcomm): Don't give an error if no + alignment is specified. + + Add support for mips16 (16 bit MIPS implementation): + * config/tc-mips.c: Extensive additions for mips16 support, not + listed here. + (RELAX_OLD, RELAX_NEW): Use only 7 bits each. + (insn_uses_reg): Change last parameter to an enum. + * config/tc-mips.h (LOCAL_LABELS_DOLLAR): Define as 0. + (md_relax_frag): Define as mips_relax_frag. + (mips_relax_frag): Declare. + (struct mips_cl_insn): Add use_extend and extend fields. + (tc_fix_adjustable): Define. + * config/obj-elf.h (S_GET_OTHER): Define. + (S_SET_OTHER): Define. + +Mon Nov 25 18:02:29 1996 J.T. Conklin + + * config/tc-m68k.c (m68k_ip): Implement cases for new <, >, m, n, + o and p operand specifiers. + +Mon Nov 25 10:45:14 1996 Doug Evans + + * write.c: Delete "ifndef md_relax_frag" around is_dnrange. + (relax_segment, case rs_org): Move code inside braces. Move locals + target,after inside too. + (relax_segment, case rs_machine_dependent): Guts moved to ... + (relax_frag): New function. + Call md_prepare_relax_scan if defined. + * config/tc-m68k.h (md_prepare_relax_scan): Renamed from + M68K_AIM_KLUDGE. + +Mon Nov 25 08:49:36 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (address_registers): Use '$' as register + prefix instead of '%'. + (data_registers, other_registers, md_assemble): Likewise. + + * config/tc-mn10300.c (address_registers): Use '%' prefix for regs. + (data_registers, other_registers, md_assemble): Likewise. + + * config/tc-mn10300.c (md_assemble): Correctly determine the + correct location and type for each relocation. + (md_pcrel_from): Simplify. + +Fri Nov 22 15:42:26 1996 Ian Lance Taylor + + * config/tc-sh.c (md_convert_frag): Improve warning when branch is + converted into branch around branch. + +Thu Nov 21 11:56:11 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.h (DIFF_EXPR_OK): Don't define this. + (tc_fix_adjustable): Don't adjust relocs against weak symbols or + pc-relative relocs. + * config/tc-mn10300.c (md_begin): Set linkrelax. + (md_assemble): Create fixups as needed. + (md_apply_fix3): Gut. It shouldn't ever get called anymore. + +Tue Nov 19 17:48:06 1996 Michael Meissner + + * config/tc-d10v.c (parallel_ok): When automatically converting + serial ops to parallel, do not consider a branch as the first + instruction. + +Tue Nov 19 13:35:22 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (md_assemble): Handle MN10300_OPERAND_REG_LIST. + +Mon Nov 18 15:26:55 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (mn10300_insert_operand): Provide prototype + via PARAMS. + (check_operand): Likewise. + +Mon Nov 18 15:22:28 1996 Michael Meissner + + * config/tc-d10v.c (parallel_ok): Branch and link instructions + modify r13. + (write_2_short): Call parallel_ok to check whether two short + instructions the user requested execute in parallel, can be + executed that way. + +Thu Nov 14 11:17:49 1996 Martin M. Hunt + + * config/tc-d10v.c (write_2_short): Fix bug that wouldn't + allow a branch and link in parallel with an exe instruction. + +Fri Nov 8 13:55:03 1996 Martin M. Hunt + + * doc/c-d10v.texi: Add info on @word modifier. + +Wed Nov 6 13:46:07 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (mn10300_insert_operand): MN10300_OPERAND_SPLIT + operands are assumed to be 32bits. Use "bits" field to hold the + number of bits in the main instruction word for MN10300_OPERAND_SPLIT. + (mn10300_check_operand): MN10300_OPERAND_SPLIT operands are assumed + to be 32bits. + + * config/tc-mn10300.c (mn10300_insert_operand): Shift low part + of a MN10300_OPERAND_SPLIT operand by operand->shift. + + * config/tc-mn10300.c (mn10300_insert_operand): Handle + MN10300_OPERAND_SPLIT. + +Tue Nov 5 13:30:40 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (md_assemble): Insert operands into + the extension part of the instruction if necessary. + (mn10300_insert_operand): Accept pointer to extension word + argument. Make insn a pointer argument too. Return type + is now void. All callers changed. + +Mon Nov 4 12:53:40 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (mn10300_insert_operand): Handle + repeated register operands. + +Fri Nov 1 10:42:49 1996 Ian Lance Taylor + + * doc/as.texinfo: Added section on reporting bugs. + + * config/tc-alpha.c: Change uses of void * to PTR. Change the + alpha_macro emit field to expect a const argument, and change the + arg field to be const. Fix some spacing to follow the GNU + standard. + +Fri Nov 1 10:32:03 1996 Richard Henderson + + * config/tc-alpha.c (md_parse_option): Add knowledge of 21164pc + (pca56) and 21264 (ev6) cpus. + (md_apply_fix): Private relocation types are now negative. + (alpha_force_relocation): Likewise. + (tc_gen_reloc): Likewise. + (emit_insn): Likewise. + (emit_ldXu): Do the right thing when the hardware can do byte insns. + (emit_stX): Likewise. + (emit_sextX): Likewise. + +Thu Oct 31 16:33:21 1996 Ian Lance Taylor + + * config/obj-coff.c (do_relocs_for): Call resolve_symbol_value on + a symbol found in a reloc. + + * symbols.c (resolve_symbol_value): Improve the error message if + an undefined symbol is used in an expression. + +Wed Oct 30 20:15:35 1996 Ian Lance Taylor + + * doc/internals.texi: Rewrite, and add a lot of documentation. + * doc/Makefile.in (internals.info): New target. + +Mon Oct 28 10:48:40 1996 Martin M. Hunt + + * config/tc-d10v.h (md_cleanup): New function. This is needed to + write out any buffered instructions when a ".end" is found. + +Mon Oct 28 10:43:45 1996 Martin M. Hunt + + * read.c (read_a_source_file): New hook md_cleanup(). + +Fri Oct 25 00:01:00 1996 Ian Lance Taylor + + * write.c (fix_new_exp): Use make_expr_symbol to build an + expression symbol for a complex fixup. + +Wed Oct 23 18:20:29 1996 Ian Lance Taylor + + * config/tc-ppc.c (md_apply_fix3): Give a better warning message + for an unknown relocation type. + +Tue Oct 22 17:09:32 1996 Michael Meissner + + * config/tc-d10v.c (parallel_ok): Don't allow illegal combinations + of instructions. + +Tue Oct 22 11:28:39 1996 Ian Lance Taylor + + * obj.h (struct format_ops): Add frob_file_after_relocs field. + * config/obj-multi.h (obj_frob_file_after_relocs): Define. + * config/obj-ecoff.c (ecoff_format_ops): Initialize new + frob_file_after_relocs field. + * config/obj-elf.c (elf_format_ops): Likewise. + * config/tc-mips.c: Undefine obj_frob_file_after_relocs before + including obj-elf.h. + +Mon Oct 21 11:38:30 1996 Ian Lance Taylor + + * config/tc-mips.c (cons_fix_new_mips): Only treat 8 byte reloc + specially if not ELF. + (md_apply_fix): Handle BFD_RELOC_64. + (tc_gen_reloc): Handle BFD_RELOC_64. + + * config/tc-i386.c (md_apply_fix3): Don't increment value for a PC + relative reloc when BFD_ASSEMBLER and OBJ_AOUT (more ugly gas + reloc hacking). + + * config/obj-aout.h (S_IS_DEFINE): non BFD_ASSEMBLER version: + Don't check S_GET_OTHER. + +Fri Oct 18 14:06:26 1996 Ian Lance Taylor + + * config/tc-mips.c (mips_ip): Accept an odd floating point + register with l.s or s.s. + + * config/obj-aout.c (obj_pseudo_table): Use obj_aout_type for + .type pseudo-op. + (obj_aout_type): New static function. + +Thu Oct 17 17:55:17 1996 Ian Lance Taylor + + * Makefile.in ($(OBJS)): Depend upon libiberty.h. + +Mon Oct 14 13:59:12 1996 Ian Lance Taylor + + * config/tc-mips.c (load_register): Add cast to offsetT when using + a constant with &~. + +Mon Oct 14 11:24:28 1996 Richard Henderson + + * config/obj-elf.c (elf_frob_file): Move ECOFF debug processing to ... + (elf_frob_file_after_relocs): ... here. New function. + * config/obj-elf.h (obj_from_file_after_relocs): New macro. + * write.c (write_object_file): Call *frob_after_relocs after the + call to write_relocs. + + * config/tc-alpha.c: Use new BFD_RELOC_ALPHA_ELF_LITERAL reloc. + + * config/tc-alpha.c (load_expression): Don't SET_VALUE on the section + symbol, as this messes up linking. Instead, expand the recursive call + inline and change up the appropriate bits to get the 0x8000 offset + in the reloc addend. + +Thu Oct 10 17:30:31 1996 Ian Lance Taylor + + * config/tc-sparc.h (tc_fix_adjustable): Permit the difference of + two symbols in the same segment to be adjusted. + + * configure.in: Don't get confused by CPU-VENDOR-linux-gnu. + * configure: Rebuild. + +Thu Oct 10 17:22:18 1996 Michael Meissner + + * config/tc-ppc.c (ppc_insert_operand): Change most warnings into + errors. + (ppc_elf_validate_fix): Ditto. + (md_assemble): Ditto. + (ppc_tc): Ditto. + (ppc_pe_section): Ditto. + (ppc_frob_symbol): Ditto. + +Thu Oct 10 12:05:45 1996 Jeffrey A Law (law@cygnus.com) + + * config/mn10300.c (md_assemble): Pass an extra shift count + to mn10300_insert_operand based on the opcode format. + (mn10300_insert_operand): Accept and use extra shift count + parameter. + + * config/tc-mn10300.c (md_assemble): Use FMT_* macros for + formats rather than hard-coded constants. + + * config/tc-mn10300.c (md_assemble): Format D5 instructions + are 7 bytes long. Write out instructions in big-endian format. + +Tue Oct 8 14:56:15 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (md_assemble): Tweak further so + that all instructions are parsed correctly. + +Tue Oct 8 13:02:21 1996 Ian Lance Taylor + + * as.h: Include libiberty.h. + (xmalloc, xrealloc): Don't declare. + * as.c: Don't include libiberty.h. + * expr.c, read.c, stabs.c, config/obj-coff.c: Likewise. + * config/tc-mips.c: Likewise. + * messages.c: Likewise. + (xstrerror): Don't declare. + * xmalloc.c: Remove. + +Mon Oct 7 16:53:23 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.h (pre_defined_registers) Remove. + (system_registers, cc_names): Likewise. + (address_registers, data_registers, other_registers): New register + arrays. + (register_name, system_register_name, cc_name): Remove. + (mn10300_reloc_prefix): Likewise. + (data_register_name): New function. + (address_register_name, other_register_name): Likewise. + (md_assemble): Rough cut at parsing operands. Remove lots of + unwanted code. + (md_apply_fix3): Disable for now. + +Mon Oct 7 11:38:34 1996 Andreas Schwab + + * config/tc-m68k.c (select_control_regs): New function, extracted + out of m68k_init_after_args. + (m68k_init_after_args): Use it. + (mri_chip): Use it here as well to update set of allowed control + regs for movec. + +Mon Oct 7 11:24:29 1996 Ian Lance Taylor + + * config/obj-elf.c (elf_begin): New function. + (obj_elf_section): Add the section symbol to the symbol table. + * config/obj-elf.h (obj_begin): Define. + (elf_begin): Declare. + * as.c (perform_an_assembly_pass): Call obj_begin if it is + defined. + +Fri Oct 4 18:37:32 1996 Ian Lance Taylor + + * config/obj-coff.c (fixup_segment): Subtract the section address + from a PC relative reloc if TC_M68K. + +Thu Oct 3 15:15:30 1996 Ian Lance Taylor + + * config/tc-sparc.c (md_pseudo_table): Make .uahalf, .uaword, and + .uaxword available even if not OBJ_ELF. + (md_atof): Remove unused local variable wordP. + +Thu Oct 3 00:16:50 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10x00.c, config/tc-mn10x00.h: New files + for Matsushita MN10x00 support. + * configure.in: Recognize mn10x00-*-* + * configure: Rebuilt. + +Wed Oct 2 15:54:03 1996 Klaus Kaempf + + * obj-evax.h: move openvms definitions from here to tc-alpha.c. + * tc-alpha.c: add support for vms_case_hack like in vax/vms. + (load_expression): track clobbering of base reg before jmp/jsr. + (s_alpha_file): pass case_hack flags and source filename via + symbol table to bfd. + * tc-alpha.h (TC_CONS_FIX_NEW): define + +Tue Oct 1 16:16:01 1996 Joel Sherrill + + * configure.in (mips-*-rtems*): New target, like mips-*-elf*. + * configure: Rebuild. + +Tue Oct 1 12:37:48 1996 Ian Lance Taylor + + * read.c (s_macro): Warn if a macro has the same name as a + pseudo-op. + (s_space): In m68k MRI mode, align to a word boundary. + * macro.c (define_macro): Add namep parameter. Change all + callers. + * macro.h (define_macro): Update declaration. + + * as.c (show_usage): Print bug report address. + (parse_args): Change version printing to match current GNU + standards. + * gasp.c (show_usage): Print bug report address. + (main): Change version printing to match current GNU standards. + + * config/tc-m68k.c (init_table): Correct access control unit + register numbers. From Ken Rose . + + * config/tc-alpha.c: Add some static function prototypes. + (alpha_macros): Move to top of file. Make static. + (alpha_num_macros): Move to top of file. + +Sat Sep 28 03:38:08 1996 Ian Lance Taylor + + * listing.c (list_symbol_table): Remove bogus code in BFD64 case, + and just call sprintf_vma. + +Thu Sep 26 16:04:11 1996 Ian Lance Taylor + + * expr.c (expr): Change >>= to >> (fix typo). (From meissner). + +Tue Sep 24 19:05:08 1996 Ian Lance Taylor + + * read.c (float_cons): Call md_flush_pending_output if it is + defined. + +Tue Sep 24 12:22:18 1996 Martin M. Hunt + + * config/tc-d10v.c (md_operand): Created. Allows operands to + start with '#'. + * config/tc-d10v.h (md_operand): Undefined. + +Mon Sep 23 12:13:18 1996 Ian Lance Taylor + + * config/tc-m68k.c (add_fix): Treat a width of '3' like 'B'. + (md_assemble): A fixup width of '3' means a 1 byte reloc. + +Thu Sep 19 12:21:24 1996 Ian Lance Taylor + + * config/obj-coff.c (fixup_segment): Don't adjust PC relative + reloc for the i960 for a reloc in the same section. This undoes + one of the two changes made Aug 19. + +Wed Sep 18 12:11:58 1996 Ian Lance Taylor + + * config/obj-coff.c (obj_coff_endef): Both versions: Move C_STAT + symbols to the position of the debugging information. + +Mon Sep 16 11:41:40 1996 Ian Lance Taylor + + * expr.c (expr): Always use unsigned right shifts for >>. + +Thu Sep 12 10:25:45 1996 James G. Smith + + * config/tc-arm.c (md_apply_fix3): Update two thumb instruction + slots when processing BL fixups. + + * config/tc-arm.c (output_inst): Ensure Thumb BL fixup is marked + on the first half of the instruction. + +Wed Sep 11 00:09:35 1996 Ian Lance Taylor + + * ecoff.c (ecoff_stab): Create an expression symbol for a complex + stabs expression, rather than giving an error. + + * ecoff.c (ecoff_new_file): Don't do anything if we are still in + the same file. + +Tue Sep 10 11:45:37 1996 Ian Lance Taylor + + * config/tc-mips.c (append_insn): Fill in the value for a constant + jump, rather than creating a reloc. + +Mon Sep 9 10:57:42 1996 Ian Lance Taylor + + * config/tc-mips.c (append_insn): Don't swap an instruction which + sets a condition code with an instruction which uses a condition + code. + (mips_ip): In cases 'N' and 'M', look for $fccN rather than an + immediate value. + + * config/tc-mips.c (md_begin): Recognize r5000 for cpu. + (mips_ip): Give a better error message if the ISA level is wrong. + (md_parse_option): Recognize -mcpu=[v][r]5000. + +Sat Sep 7 13:25:55 1996 James G. Smith + + * config/tc-mips.c (COUNT_TOP_ZEROES): Added macro to count + leading zeroes. + (load_register): Ensure hi32 bits are not lost during lo32bit + processing. Fix shift offset that was overflowing into the next + instruction field. Add code to generate shorter sequences for + constants with a single contiguous seqeuence of ones. + +Fri Sep 6 17:07:12 1996 Martin M. Hunt + + * config/tc-d10v.c (d10v_dot_word): New function to support + "@word" with the word pseudo-op. + (md_apply_fix3): Cleanup and changes to support correct sizes + for 16 and 18-bit relocs. + +Fri Sep 6 16:00:29 1996 Doug Evans + + * configure.in (sparc-*-aout): Set `em'. + * configure: Regenerated. + * config/te-sparcaout.h: New file. + * config/tc-sparc.h (TARGET_BYTES_BIG_ENDIAN): Define. + Ifdef TE_SPARCOUT define TARGET_FORMAT and SPARC_BIENDIAN. + * config/tc-sparc.c (INSN_BIG_ENDIAN): New macro. + (SPECIAL_CASE_{SETSW,SETX}): Define. + ({NOP,OR,FMOVS,SETHI,SLLX,SRA}_INSN): Define. + (md_begin): Delete setting of `target_big_endian'. + (output_insn): New function. + (md_assemble): Rewrite. Add `setx' support. + (sparc_ip): Handle `0' operand char. Recognize setuw, setsw, setx + special cases. + (md_atof): Add little endian support. + (md_number_to_chars): Likewise. + (md_apply_fix): Likewise. + (md_longopts): Recognize -EL,-EB ifdef SPARC_BIENDIAN. + (md_parse_option): Likewise. + (md_show_usage): Print -EL, -EB ifdef SPARC_BIENDIAN. + +Thu Sep 5 13:40:29 1996 Ian Lance Taylor + + * ecoff.c (ecoff_new_file): New function. + * ecoff.h (ecoff_new_file): Declare. + * config/obj-ecoff.h (obj_app_file): Define. + +Thu Sep 5 13:39:25 1996 Richard Henderson + + * config/tc-alpha.c (load_expression): Bias the .lit8 section + symbol by 32k so that our 16-bit signed offset can address the + entire chunk. Reported by . + +Wed Sep 4 10:23:20 1996 Ian Lance Taylor + + * config/tc-mips.c (load_register): Remove unused variable tmp. + +Wed Sep 4 11:24:29 1996 James G. Smith + + * config/tc-mips.c (load_register): Remove unnecessary code that + was causing the high 32bits of 64bit constants to be lost. + +Tue Sep 3 13:52:56 1996 Martin M. Hunt + + * config/tc-d10v.c: Added changes to support function + pointers and "@word" syntax. + +Fri Aug 30 18:12:00 1996 Ian Lance Taylor + + Add SH ELF support. + * configure.in (sh-*-elf*): New target. + * config/tc-sh.h (TARGET_ARCH): Define. + (WORKING_DOT_WORD): Define. + (TC_COFF_FIX2RTYPE): Only define if OBJ_COFF. + (BFD_ARCH, COFF_MAGIC, TC_COUNT_RELOC): Likewise. + (TC_RELOC_MANGLE, tc_coff_symbol_emit_hook): Likewise. + (DO_NOT_STRIP, NEED_FX_R_TYPE, TC_KEEP_FX_OFFSET): Likewise. + (TC_COFF_SIZEMACHDEP, tc_frob_file): Likewise. + (SUB_SEGMENT_ALIGN): Likewise. + (RELOC_32): Don't define. + (tc_frob_file_before_adjust): Define if BFD_ASSEMBLER. + (target_big_endian): Declare if OBJ_ELF. + (TARGET_FORMAT): Define if OBJ_ELF. + * config/tc-sh.c: Use BFD reloc codes instead of SH COFF reloc + numbers throughout. + (tc_crawl_symbol_chain): Only define if OBJ_COFF. + (tc_headers_hook, tc_coff_sizemachdep): Likewise. + (struct sh_count_relocs): Define. + (sh_count_relocs): New static function, broken out of + sh_frob_file. Add BFD_ASSEMBLER code. + (sh_frob_section): Likewise. + (sh_frob_file): Call sh_frob_section. + (md_convert_frag): If BFD_ASSEMBLER, change type of headers, and + call section_symbol rather than seg_info (seg)->dot. + (md_section_align): Add OBJ_ELF version. + (SWITCH_TABLE_CONS): Define. + (SWITCH_TABLE): Use SWITCH_TABLE_CONS. + (md_apply_fix): Change parameter types if BFD_ASSEMBLER. Only + handle fx_r_type == 0 if not BFD_ASSEMBLER. Return 0 if + BFD_ASSEMBLER. + (struct reloc_map): Define if not BFD_ASSEMBLER. + (coff_reloc_map): Likewise. + (sh_coff_reloc_mangle): Use coff_reloc_map to convert fx_r_type. + (tc_gen_reloc): New function if BFD_ASSEMBLER. + * write.c (write_relocs): Ifdef out fx_where test which triggers + inappropriately for SH ELF. + (write_object_file): Call tc_frob_file_before_adjust and + obj_frob_file_before_adjust if they are defined. + + * write.c (write_object_file): Use BFD_RELOC_16, not + BFD_RELOC_NONE, when calling fix_new_exp for a broken word. + + * read.c (emit_expr): Fix conversion of byte count to BFD reloc + code. + +Fri Aug 30 14:47:38 1996 Martin M. Hunt + + * config/tc-d10v.c (find_opcode): Fix problem with calculating + branch sizes in across sections. + +Wed Aug 28 19:20:04 1996 Martin M. Hunt + + * config/tc-d10v.c (find_opcode): Fix a bug which could generate + the wrong opcode for cases like st2w where there are many forms + of the same instruction. + +Tue Aug 27 13:53:22 1996 Ian Lance Taylor + + * expr.c (operand): If md_parse_name is defined, call it before + calling symbol_find_or_make. + * config/tc-ppc.h (md_parse_name): Define. + (ppc_parse_name): Declare. + * config/tc-ppc.c (reg_name_search): Add regs and regcount + parameters. + (register_name): Update call to reg_name_search. + (cr_operand): New static variable. + (cr_names): New static const array. + (ppc_parse_name): New function. + (md_assemble): If PPC_OPERAND_CR is set in the operand flags, set + cr_operand before calling expression. + +Tue Aug 27 09:05:50 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-hppa.c (tc_gen_reloc): Add new argument to + hppa_gen_reloc_type call. + +Mon Aug 26 18:24:51 1996 Martin M. Hunt + + * config/tc-d10v.c: Fixed ".word". Fixed problem with range checking + on addresses. Improved error messages. + * doc/c-d10v.texi: Added docs for register pairs. + +Mon Aug 26 13:39:27 1996 Martin M. Hunt + + * config/tc-d10v.c (parallel_ok): Fix bug in parallel + checking code. + +Mon Aug 26 14:38:22 1996 Ian Lance Taylor + + * ecoff.c (init_file): Initialize fMerge to 1. + (add_file): Restore old file merging code, but only merge files if + fMerge is set. + (ecoff_directive_loc): Clear fMerge field of current file. + (ecoff_generate_asm_lineno): Likewise. + +Fri Aug 23 11:40:47 1996 Martin M. Hunt + + * doc/c-d10v.texi: Fix typo. + +Thu Aug 22 10:20:30 1996 Ian Lance Taylor + + * configure.in: Set and substitute HLDENV. + * configure: Rebuild. + * Makefile.in (HLDENV): New variable. + (as.new): Use $(HLDENV). + + * ecoff.c (ecoff_directive_endef): Avoid a division by zero error + if an array dimension is not known. + +Thu Aug 22 10:50:00 1996 Martin M. Hunt + + * config/tc-d10v.c: Fix a reloc bug caused by my last change. + * doc/c-d10v.texi: Cleanup. + +Wed Aug 21 15:50:54 1996 Martin M. Hunt + + * doc/c-d10v.texi: New file. + * doc/all.texi: Added D10V stuff. + * doc/as.texinfo: Added D10V stuff. + +Tue Aug 20 14:10:02 1996 Martin M. Hunt + + * config/tc-d10v.c: All references to defined symbols should + now use the optimal instruction. .float and .double now work. + +Mon Aug 19 14:41:36 1996 Ian Lance Taylor + + * config/obj-coff.c (fixup_segment): Adjust PC relative reloc by + section address for the i960 as is done for the i386. + +Thu Aug 15 16:37:59 1996 Stan Shebs + + * mpw-config.in: Add wildcards for config matching, add mips-*-* + case, forward-include bfd/elf-bfd.h. + +Thu Aug 15 13:24:30 1996 Martin M. Hunt + + * config/tc-d10v.c: Add additional information to the opcode + table to help determinine which instructions can be done + in parallel. + +Thu Aug 15 17:01:31 1996 James G. Smith + + * config/tc-arm.c: Major changes to add Thumb support, with lots + of change input from . + Reverted to INSN_SIZE macro, rather than insn_size variable. + (insns): Added ARM "bx" instruction support. + (tinsns): Added Thumb instruction definition structure. + (arm_tops_hsh): Added hash structure for Thumb opcodes. + (md_pseudo_table): Added ".arm", ".thumb" and ".code" pseudo-ops. + (opcode_select,s_arm,s_thumb,s_code): Added. + (decode_shift): Allow upper-case RRX. + (do_ldst): Simpler halfword support. + (do_ldmstm): Improved. + (reg_list, do_bx, thumb_reg, thumb_add_sub, thumb_shift, + thumb_mov_compare, thumb_load_store, do_t_arit, do_t_add, + do_t_asr, do_t_branch, do_t_bx, do_t_compare, do_t_ldmstm, + do_t_ldrb, do_t_ldrh, do_t_lds, do_t_lsl, do_t_lsr, do_t_mov, + do_t_push_pop, do_t_str, do_t_strb, do_t_strh, do_t_sub, do_t_swi, + do_t_adr): Added. + (md_apply_fix3): Add support for BFD_RELOC_ARM_THUMB_* relocations. + (md_parse_option): Add support for -mthumb. + (md_show_usage): Updated to reflect new command line option. + (arm_data_in_code, arm_canonicalize_symbol_name): Added. + * config/tc-arm.h: Provide TC_FIX_TYPE to allow private ARM + fragment information to be held. + +Thu Aug 15 16:12:00 1996 Richard Earnshaw (rearnsha@armltd.co.uk) + + * tc-arm.c (md_apply_fix3): Also set fixP->fx_done if fx_addsy is + non-null, but is a constant. + (fix_new_arm): Call make_expr_symbol to make the expression symbol + so that error reporting will work correctly. + +Wed Aug 14 10:37:21 1996 Ian Lance Taylor + + * config/tc-i386.c (tc_i386_fix_adjustable): Don't adjust relocs + against weak symbols. + +Tue Aug 13 17:39:24 1996 Ian Lance Taylor + + * config/tc-ppc.h (TC_FORCE_RELOCTION): Define if OBJ_XCOFF. + (ppc_force_relocation): Declare if OBJ_XCOFF. + * config/tc-ppc.c (ppc_force_relocation): New function if + OBJ_XCOFF. + +Mon Aug 12 16:49:43 1996 Ian Lance Taylor + + * config/tc-mips.h (BYTE_ORDER): Don't define. No longer used. + +Fri Aug 9 17:48:28 1996 Martin M. Hunt + + * config/tc-d10v.c: Fix problem with relocs. + +Fri Aug 9 14:16:14 1996 Ian Lance Taylor + + * config/tc-sh.c (sh_do_align): If not BFD_ASSEMBLER, always align + with nops if not in data_section or bss_section. + +Thu Aug 8 12:32:56 1996 Klaus Kaempf + + Add support for openVMS/Alpha. + * as.h (PRINTF_LIKE): Don't define if VMS, for now. + * config/obj-evax.c: New file. + * config/obj-evax.h: New file. + * config/tc-alpha.c: Add support for EVAX format if OBJ_EVAX is + defined. + * config/tc-alpha.h: Add support for EVAX format if OBJ_EVAX is + defined. Add case for bfd_target_evax_flavour. + * config/vms-a-conf.h: New file. + * conf-a-gas.com: New file. + * configure.in: Add target alpha-*-*vms*. + * configure: Rebuild. + * makefile.vms: New file. + * read.c (s_lcomm): Align bss_seg on 8 byte boundary if OBJ_EVAX. + Don't call ffs on openVMS/Alpha. + +Wed Aug 7 14:19:03 1996 Philippe De Muyter + + * configure.in: Make GAS_CHECK_DECL_NEEDED include or + if they exist. Call GAS_CHECK_DECL_NEEDED on strstr + and sbrk. + * acconfig.h (NEED_DECLARATION_STRSTR): New macro. + (NEED_DECLARATION_SBRK): New macro. + * configure, conf.in: Rebuild. + * as.h: Only include if HAVE_STRINGS_H. + (strstr): Declare if NEED_DECLARATION_STRSTR. + * as.c: If HAVE_SBRK and NEED_DECLARATION_SBRK, declare sbrk. + +Wed Aug 7 11:50:26 1996 Ian Lance Taylor + + * symbols.c (resolve_symbol_value): Handle addition or subtraction + by a constant before entering the main switch. Reject attempts to + apply an arithmetic function to non-absolute symbols, except for + the special case of subtraction of two symbols in the same + section. + + * config/tc-mips.c (md_section_align): Do align if OBJ_ELF, but + not to more than a 16 byte boundary. + + * config/tc-i386.c (tc_gen_reloc): Accept all relocs; remove + #ifndef OBJ_ELF lines. From Eric Valette . + (tc_gen_reloc): If out of memory call as_fatal rather than + assert. If no howto found, call as_bad_where rather than + as_fatal. Change the error message slightly. Set howto to a + non-NULL value in order to keep going. + +Tue Aug 6 12:58:03 1996 Martin M. Hunt + + * config/tc-d10v.c: Added code to support 32-bit fixups for stabs. + +Tue Aug 6 11:15:26 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-h8300.c (get_specific): New operand "size" derived + from ".b", ".w" and ".l" extensions. All callers changed. If + the base instruction has no operands, then use the size to + determine which specific instruction to use. + +Mon Aug 5 14:21:10 1996 Ian Lance Taylor + + * config/tc-i960.c (mem_fmt): Call parse_expr before emit. + +Fri Aug 2 11:23:31 1996 Ian Lance Taylor + + * config/tc-mips.c (md_section_align): Don't change addr if + OBJ_ELF. + +Thu Aug 1 23:51:52 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-hppa.c: Revert yesterday's changes. + +Wed Jul 31 14:46:11 1996 Martin M. Hunt + + * config/tc-d10v.c: Disable range checking on 16-bit values. + +Wed Jul 31 16:27:19 1996 Ian Lance Taylor + + * config/tc-m68k.c (m68k_ip): Set ok_arch for every instruction, + not just the ones that don't match. + +Wed Jul 31 11:45:15 1996 Martin M. Hunt + + * config/tc-d10v.c: Fixed bugs in short relocs and range checking. + +Wed Jul 31 15:41:42 1996 James G. Smith + + * config/tc-arm.c: Changed INSN_SIZE to variable insn_size, as + pre-cursor to adding Thumb support. Also added cpu_variant flag + information to each of the asm_flg structures. + (md_parse_option): Updated ARM7 parsing to allow 't' for + thumb/halfword support, aswell as 'm' for long multiply. + (md_show_usage): Updated help message. + (md_assemble): Check that instruction flags are applicated to the + current cpu variant. + (md_apply_fix3, tc_gen_reloc): Add BFD_RELOC_ARM_OFFSET_IMM8 and + BFD_RELOC_ARM_HWLITERAL relocation support for new halfword and + signextension instructions. + (do_ldst): Generate halfword and signextension variants if + mnemonic flags match. + (ldst_extend): Do not allow shifts in the offset field of halfword + or signextension instructions. + (validate_offset_imm): Provide check on halfword and signextension + immediate range. + (add_to_lit_pool): Merge identical literal pool values. + +Tue Jul 30 14:28:23 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-hppa.c (selector_table): Add 'E' selector. + (cons_fix_new_hppa): Don't coke on e_esel. + (tc_gen_reloc, SOM version): Handle R_COMP2 when used + to help generate exception handling tables. + (md_apply_fix): Don't try to apply fixups with an e_esel + selector. + (hppa_fix_adjustable): Fixups with e_esel selectors + are not adjustable. + +Tue Jul 30 15:51:41 1996 Ian Lance Taylor + + * config/tc-sparc.c (md_pseudo_table): Add 2byte, 4byte, and 8byte + pseudo-ops. + +Fri Jul 26 11:43:03 1996 Martin M. Hunt + + * config/tc-d10v.c: Added lots of error checking. Added hacks + to support accumulator shifts. + +Fri Jul 26 11:56:08 1996 Ian Lance Taylor + + * symbols.c (S_SET_EXTERNAL): Let .weak override. + (S_CLEAR_EXTERNAL): Likewise. + (S_SET_WEAK): Remove error; just let .weak override. + +Thu Jul 25 15:22:51 1996 Martin M. Hunt + + * config/tc-d10v.c (md_assemble): Now handles multiline + instructions. + +Thu Jul 25 12:03:33 1996 Martin M. Hunt + + * config/tc-d10v.c: Fix packaging bug. Added range checking. + Added kludge for divs instruction. Fixed minor problem with + multiple text sections. + * config/tc-d10v.h (d10v_cleanup): Change prototype. + +Tue Jul 23 10:49:36 1996 Martin M. Hunt + + * config/tc-d10v.c (md_apply_fix3): Fix all instruction + addresses to be right-shifted by 2. + +Mon Jul 22 11:32:36 1996 Martin M. Hunt + + * config/tc-d10v.c: Many changes to get relocs working. + (register_name): No longer creates a symbol for register names. + (pre_defined_registers): moved to opcodes/d10v-opc.c. + (d10v_insert_operand): Now works correctly for either container. + * config/tc-d10v.h (d10v_cleanup): Declare. + +Mon Jul 22 14:01:33 1996 Ian Lance Taylor + + * config/tc-mips.c (tc_gen_reloc): BFD_RELOC_PCREL_HI16_S and + BFD_RELOC_PCREL_LO16 are expected to be PC relative. + +Mon Jul 22 12:46:55 1996 Richard Henderson + + * tc-alpha.c: Patches to track current minimum alignment to reduce + the number of fragments created with frag_align. + (alpha_current_align): New static variable. + (s_alpha_text): Reset alignment to 0. + (s_alpha_data, s_alpha_rdata, s_alpha_sdata): Likewise. + (s_alpha_stringer, s_alpha_space): New functions. + (s_alpha_cons, alpha_flush_pending_output): Remove functions. + (alpha_cons_align): New function to replace both of them. + (emit_insn): Only align if alpha_current_align is less than 2; + reset alpha_current_align to 2. + (s_alpha_gprel32): Likewise. + (s_alpha_section): New function. Basically duplicate the other + alpha section change hooks. Only define for ELF. + (s_alpha_float_cons): Simplify alignment handling. + (md_pseudo_table): Only define "rdata" and "sdata" if OBJ_ECOFF. + If OBJ_ELF, define "section", "section.s", "sect", and "sect.s". + Don't define the s_alpha_cons pseudo-ops. Do define + s_alpha_stringer and s_alpha_space pseudo-ops. + (alpha_align): Skip if less than current default alignment. Set + default alignment. + * tc-alpha.h (md_flush_pending_output): Remove. + (md_cons_align): Add. + + * tc-alpha.c: Add oodles of function description comments. + (md_bignum_to_chars): Remove; there are no callers. + (md_show_usage): Mention some more variants. + +Thu Jul 18 15:54:54 1996 Ian Lance Taylor + + From Andrew Gierth : + * configure.in (sparc-*-sysv4*): New target. + * configure: Rebuild. + + * config/tc-sparc.c (md_pseudo_table): Change uahalf, uaword, and + uaxword to use s_uacons. + (sparc_no_align_cons): New static variable. + (s_uacons): New static function. + (sparc_cons_align): If sparc_no_align_cons is set, just clear it + and return. + + * config/tc-sparc.c (s_common): Remove unused label allocate_bss. + + * configure.in: Add mips-*-irix6* target. Handle Irix 6 like Irix + 5 with regard to shared libraries. + * configure: Rebuild. + + * config/tc-m68k.c (m68k_ip): Use the correct length when + allocating space for the unsupported architecture error message. + +Thu Jul 18 12:57:10 1996 Michael Meissner + + * configure.in (d10v-*-*): Allow d10v-*-*, don't require d10v-*-elf*. + +Wed Jul 17 14:25:13 1996 Martin M. Hunt + + * config/tc-d10v.c: New file. + * config/tc-d10v.h: New file. + * configure (d10v-*-elf): New target. + * configure.in (d10v-*-elf): New target. + +Fri Jul 12 20:54:19 1996 Michael Meissner + + * config/tc-ppc.c (md_parse_option): Recognize -K PIC. + +Wed Jul 10 12:39:08 1996 Richard Henderson * config/tc-alpha.c (alpha_align): Change fill parameter to a pointer. Take NULL as 0 or nop depending on section. Change @@ -22,12 +2548,21 @@ * doc/as.texinfo (.align): Document action of omitted fill parameter. -Wed Jul 10 00:26:44 1996 Ian Lance Taylor +Wed Jul 10 00:23:30 1996 Ian Lance Taylor + + * config/tc-ppc.c (md_apply_fix3): Give a useful error message + when an unsupported PC relative reloc is seen, rather than calling + abort. * app.c (do_scrub_chars): Remove not_cpp_line local variable. Instead, check state when '#' comment is seen. -Mon Jul 8 14:14:26 1996 Ian Lance Taylor +Mon Jul 8 14:11:49 1996 Ian Lance Taylor + + * config/tc-mips.c (mips_regmask_frag): Only define if OBJ_ELF or + OBJ_MAYBE_ELF. + (tc_gen_reloc): If fixup was changed to be PC relative, change + reloc type accordingly. Use name of reloc in error message. * as.h: Don't define const or volatile. * flonum.h: Don't define const. @@ -36,15 +2571,26 @@ if fx_pcrel is set. Correct setting the addend case in the OBJ_ELF case (from Andreas Schwab ). + (md_show_usage): Correct -mfc5200 to -m5200. + +Fri Jul 5 10:32:58 1996 J.T. Conklin + + * doc/c-m68k.texi: Document -m5200 flag. + * doc/as.texinfo: Likewise. + + * config/tc-m68k.c (m68k_ip): The coldfire does not support 8x + scale factor. -Fri Jul 5 11:24:41 1996 Ian Lance Taylor +Fri Jul 5 11:07:24 1996 Ian Lance Taylor * symbols.c (S_SET_EXTERNAL): Change as_warn to as_bad. (S_CLEAR_EXTERNAL, S_SET_WEAK): Likewise. Thu Jul 4 11:59:46 1996 Ian Lance Taylor - * Makefile.in (VERSION): Set to 2.7. + * Makefile.in (VERSION): Set to cygnus-2.7.1. + + * Released binutils 2.7. Thu Jul 4 10:11:33 1996 James G. Smith @@ -332,6 +2878,18 @@ (get_specific): Promote L_24 to L_32 if it makes a match. Don't always promote L_8 to L_16. (do_a_fix_imm): Clean up L_32 and L_24 handling. + + * config/tc-h8300.c (Smode): New variable. + (h8300hmode): Turn off Hmode. + (h8300smode): New function. Turn on Smode and Hmode. + (md_pseudo_table): New ".h8300s" pseudo-op. + (parse_reg): Handle "exr" register. + (get_operand): Handle bizarre syntax for "stm.l" and "ldm.l". + Handle "mach" and "machl" operands for ldmac. + (get_specific): Handle "stm.l" and "ldm.l". + (build_bytes): Handle "stm.l" and "ldm.l"; handle MACREG operands. + * config/tc-h8300.h (COFF_MAGIC): Handle H8/S magic number. + (Smode): Declare. Mon Jun 17 15:50:53 1996 J.T. Conklin diff -urN binutils-2.7/gas/ChangeLog.1 binutils-2.8/gas/ChangeLog.1 --- binutils-2.7/gas/ChangeLog.1 Thu Jul 4 12:34:35 1996 +++ binutils-2.8/gas/ChangeLog.1 Wed Apr 30 12:53:29 1997 @@ -7053,7 +7053,7 @@ Tue Jan 4 22:11:34 1994 Rob Savoye (rob@darkstar.cygnus.com) - * config/ho-vsta.h, configure.in, .Sanitize: Add support for VSTa + * config/ho-vsta.h, configure.in: Add support for VSTa micro-kernel. Thu Dec 30 15:27:16 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) diff -urN binutils-2.7/gas/Makefile.in binutils-2.8/gas/Makefile.in --- binutils-2.7/gas/Makefile.in Mon Jul 15 15:08:34 1996 +++ binutils-2.8/gas/Makefile.in Wed Apr 30 13:06:18 1997 @@ -1,5 +1,5 @@ # Makefile for GNU Assembler -# Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996 +# Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 1997 # Free Software Foundation, Inc. # This file is part of GNU GAS. @@ -15,8 +15,9 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with GNU GAS; see the file COPYING. If not, write to -# the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with GNU GAS; see the file COPYING. If not, write to the Free +# Software Foundation, 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # The targets for external use include: # all, doc, proto, install, uninstall, includes, TAGS, @@ -52,7 +53,7 @@ infodir = @infodir@ includedir = @includedir@ -VERSION=2.7 +VERSION=2.8 SHELL = /bin/sh @@ -62,20 +63,24 @@ INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)' INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1 -DISTSTUFF= make-gas.com m68k-parse.c +DISTSTUFF= make-gas.com m68k-parse.c itbl-parse.c itbl-parse.h itbl-lex.c AR = ar AR_FLAGS = qv BISON = bison -y BISONFLAGS = +LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` +LEXFLAGS = MAKEINFO = makeinfo TEXI2DVI = texi2dvi RANLIB = ranlib CC = @CC@ -CFLAGS = -g -LDFLAGS = HLDFLAGS = @HLDFLAGS@ +HLDENV = @HLDENV@ RPATH_ENVVAR = @RPATH_ENVVAR@ +CFLAGS = -g +LDFLAGS = +DEP = mkdep MAKEOVERRIDES= @@ -106,75 +111,293 @@ fi` RUNTESTFLAGS= -# Lists of files for various purposes. - -REAL_SOURCES = \ - $(srcdir)/app.c \ - $(srcdir)/as.c \ - $(srcdir)/atof-generic.c \ - $(srcdir)/bignum-copy.c \ - $(srcdir)/cond.c \ - $(srcdir)/expr.c \ - $(srcdir)/flonum-konst.c \ - $(srcdir)/flonum-copy.c \ - $(srcdir)/flonum-mult.c \ - $(srcdir)/frags.c \ - $(srcdir)/hash.c \ - $(srcdir)/input-file.c \ - $(srcdir)/input-scrub.c \ - $(srcdir)/literal.c \ - $(srcdir)/messages.c \ - $(srcdir)/output-file.c \ - $(srcdir)/read.c \ - $(srcdir)/subsegs.c \ - $(srcdir)/symbols.c \ - $(srcdir)/write.c \ - $(srcdir)/listing.c \ - $(srcdir)/ecoff.c \ - $(srcdir)/stabs.c - -# in an expedient order -LINKED_SOURCES = \ - targ-cpu.c \ - obj-format.c \ - atof-targ.c - -SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES) - -REAL_HEADERS = \ - $(srcdir)/as.h \ - $(srcdir)/bignum.h \ - $(srcdir)/expr.h \ - $(srcdir)/flonum.h \ - $(srcdir)/frags.h \ - $(srcdir)/hash.h \ - $(srcdir)/input-file.h \ - $(srcdir)/listing.h \ - $(srcdir)/tc.h \ - $(srcdir)/obj.h \ - $(srcdir)/read.h \ - $(srcdir)/struc-symbol.h \ - $(srcdir)/subsegs.h \ - $(srcdir)/symbols.h \ - $(srcdir)/write.h \ - $(srcdir)/ecoff.h - -LINKED_HEADERS = \ - targ-env.h \ - targ-cpu.h \ - obj-format.h \ - atof-targ.h - -HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS) - -TE_OBJS= +TARG_CPU = @target_cpu_type@ +TARG_CPU_C = $(srcdir)/config/tc-@target_cpu_type@.c +TARG_CPU_O = tc-@target_cpu_type@.o +TARG_CPU_H = $(srcdir)/config/tc-@target_cpu_type@.h +OBJ_FORMAT_C = $(srcdir)/config/obj-@obj_format@.c +OBJ_FORMAT_O = obj-@obj_format@.o +OBJ_FORMAT_H = $(srcdir)/config/obj-@obj_format@.h +TARG_ENV_H = $(srcdir)/config/te-@te_file@.h +ATOF_TARG_C = $(srcdir)/config/atof-@atof@.c +ATOF_TARG_O = atof-@atof@.o + +# use @target_cpu_type@ for refering to configured target name +IT_HDRS=itbl-parse.h $(srcdir)/itbl-ops.h +IT_SRCS=itbl-parse.c itbl-lex.c $(srcdir)/itbl-ops.c +IT_DEPS=$(srcdir)/itbl-parse.y $(srcdir)/itbl-lex.l $(srcdir)/config/itbl-@target_cpu_type@.h +IT_OBJS=itbl-parse.o itbl-lex.o itbl-ops.o + +# CPU types. This is only used for dependency information. + +CPU_TYPES = \ + a29k \ + alpha \ + arm \ + d10v \ + h8300 \ + h8500 \ + hppa \ + i386 \ + i860 \ + i960 \ + m32r \ + m68k \ + m88k \ + mips \ + mn10200 \ + mn10300 \ + ns32k \ + ppc \ + sh \ + sparc \ + tahoe \ + vax \ + w65 \ + z8k + +# Object format types. This is only used for dependency information. +# We deliberately omit som, since it does not work as a cross assembler. + +OBJ_FORMATS = \ + aout \ + bout \ + coff \ + ecoff \ + elf \ + evax \ + hp300 \ + ieee \ + vms + +# This is an sh case which sets valid according to whether the CPU +# type in the shell variable c and the OS type in the shell variable o +# are supported. This helps cuts down on the amount of dependency +# information. + +CPU_OBJ_VALID = \ + valid= ; \ + case $$o in \ + aout) \ + case $$c in \ + a29k | arm | i386 | i860 | m68k | mips | ns32k | sparc | tahoe | vax) \ + valid=yes ;; \ + esac ;; \ + bout) \ + case $$c in \ + i960) valid=yes ;; \ + esac ;; \ + coff) valid=yes ;; \ + ecoff) \ + case $$c in \ + mips | alpha) valid=yes ;; \ + esac ;; \ + elf) valid=yes ;; \ + evax) \ + case $$c in \ + alpha) valid=yes ;; \ + esac ;; \ + hp300) \ + case $$c in \ + m68k) valid=yes ;; \ + esac ;; \ + vms) \ + case $$c in \ + vax) valid=yes ;; \ + esac ;; \ + esac; + +# This is like CPU_OBJ_VALID, for the obj=multi case. + +CPU_MULTI_VALID = \ + valid= ; \ + case $$c in \ + i386 | mips) valid=yes ;; \ + esac; + +# Regular source files. + +CFILES = \ + app.c \ + as.c \ + atof-generic.c \ + bignum-copy.c \ + cond.c \ + ecoff.c \ + expr.c \ + flonum-copy.c \ + flonum-konst.c \ + flonum-mult.c \ + frags.c \ + gasp.c \ + hash.c \ + input-file.c \ + input-scrub.c \ + itbl-ops.c \ + listing.c \ + literal.c \ + macro.c \ + messages.c \ + output-file.c \ + read.c \ + sb.c \ + stabs.c \ + subsegs.c \ + symbols.c \ + write.c + +HFILES = \ + as.h \ + bignum.h \ + bit_fix.h \ + ecoff.h \ + emul-target.h \ + emul.h \ + expr.h \ + flonum.h \ + frags.h \ + hash.h \ + input-file.h \ + itbl-ops.h \ + listing.h \ + macro.h \ + obj.h \ + output-file.h \ + read.h \ + sb.h \ + struc-symbol.h \ + subsegs.h \ + symbols.h \ + tc.h \ + write.h + +# CPU files in config. + +TARGET_CPU_CFILES = \ + config/tc-a29k.c \ + config/tc-alpha.c \ + config/tc-arm.c \ + config/tc-d10v.c \ + config/tc-h8300.c \ + config/tc-h8500.c \ + config/tc-hppa.c \ + config/tc-i386.c \ + config/tc-i860.c \ + config/tc-i960.c \ + config/tc-m32r.c \ + config/tc-m68k.c \ + config/tc-m88k.c \ + config/tc-mips.c \ + config/tc-mn10200.c \ + config/tc-mn10300.c \ + config/tc-ns32k.c \ + config/tc-ppc.c \ + config/tc-sh.c \ + config/tc-sparc.c \ + config/tc-tahoe.c \ + config/tc-vax.c \ + config/tc-w65.c \ + config/tc-z8k.c + +TARGET_CPU_HFILES = \ + config/tc-a29k.h \ + config/tc-alpha.h \ + config/tc-arm.h \ + config/tc-d10v.h \ + config/tc-h8300.h \ + config/tc-h8500.h \ + config/tc-hppa.h \ + config/tc-i386.h \ + config/tc-i860.h \ + config/tc-i960.h \ + config/tc-m32r.h \ + config/tc-m68k.h \ + config/tc-m88k.h \ + config/tc-mips.h \ + config/tc-mn10200.h \ + config/tc-mn10300.h \ + config/tc-ns32k.h \ + config/tc-ppc.h \ + config/tc-sh.h \ + config/tc-sparc.h \ + config/tc-tahoe.h \ + config/tc-vax.h \ + config/tc-w65.h \ + config/tc-z8k.h + +# OBJ files in config + +OBJ_FORMAT_CFILES = \ + config/obj-aout.c \ + config/obj-bout.c \ + config/obj-coff.c \ + config/obj-ecoff.c \ + config/obj-elf.c \ + config/obj-evax.c \ + config/obj-hp300.c \ + config/obj-ieee.c \ + config/obj-som.c \ + config/obj-vms.c + +OBJ_FORMAT_HFILES = \ + config/obj-aout.h \ + config/obj-bout.h \ + config/obj-coff.h \ + config/obj-ecoff.h \ + config/obj-elf.h \ + config/obj-evax.h \ + config/obj-hp300.h \ + config/obj-ieee.h \ + config/obj-som.h \ + config/obj-vms.h + +# Emulation header files in config + +TARG_ENV_HFILES = \ + config/te-386bsd.h \ + config/te-aux.h \ + config/te-delta.h \ + config/te-delt88.h \ + config/te-dpx2.h \ + config/te-dynix.h \ + config/te-generic.h \ + config/te-go32.h \ + config/te-hp300.h \ + config/te-hppa.h \ + config/te-i386aix.h \ + config/te-ic960.h \ + config/te-linux.h \ + config/te-lnews.h \ + config/te-lynx.h \ + config/te-mach.h \ + config/te-macos.h \ + config/te-multi.h \ + config/te-nbsd.h \ + config/te-nbsd532.h \ + config/te-pc532mach.h \ + config/te-pe.h \ + config/te-ppcnw.h \ + config/te-psos.h \ + config/te-riscix.h \ + config/te-sparcaout.h \ + config/te-sun3.h \ + config/te-svr4.h \ + config/te-sysv32.h + +# Multi files in config + +MULTI_CFILES = \ + config/e-i386coff.c \ + config/e-i386elf.c \ + config/e-mipsecoff.c \ + config/e-mipself.c # @target_frag@ OBJS = \ - targ-cpu.o \ - obj-format.o \ - atof-targ.o \ + $(TARG_CPU_O) \ + $(OBJ_FORMAT_O) \ + $(ATOF_TARG_O) \ app.o \ as.o \ atof-generic.o \ @@ -200,8 +423,7 @@ stabs.o \ sb.o \ macro.o \ - @extra_objects@ \ - $(TE_OBJS) + @extra_objects@ GASPOBJS = \ gasp.o \ @@ -220,13 +442,13 @@ make-gas.com: stamp-mk.com stamp-mk.com: vmsconf.sh Makefile sh $(srcdir)/vmsconf.sh $(OBJS) > new-make.com - $(srcdir)/../move-if-change new-make.com $(srcdir)/make-gas.com + $(SHELL) $(srcdir)/../move-if-change new-make.com $(srcdir)/make-gas.com touch stamp-mk.com # Now figure out from those variables how to compile and link. # This is the variable actually used when we compile. -ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CROSS) $(CFLAGS) $(HDEFINES) $(TDEFINES) +ALL_CFLAGS = -D_GNU_SOURCE $(INTERNAL_CFLAGS) $(CROSS) $(CFLAGS) $(HDEFINES) $(TDEFINES) # How to link with both our special library facilities # and the system's installed libraries. @@ -234,11 +456,15 @@ LIBDEPS = @OPCODES_DEP@ @BFDDEP@ $(LOCAL_LOADLIBES) ../libiberty/libiberty.a LIBS = @OPCODES_LIB@ @BFDLIB@ $(LOCAL_LOADLIBES) ../libiberty/libiberty.a +BASEDIR = $(srcdir)/.. +BFDDIR = $(BASEDIR)/bfd +INCDIR = $(BASEDIR)/include + # Specify the directories to be searched for header files. # Both . and srcdir are used, in that order, # so that tm.h and config.h will be found in the compilation # subdirectory rather than in the source directory. -INCLUDES = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(srcdir)/../include -I$(srcdir)/.. -I$(srcdir)/../bfd +INCLUDES = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(INCDIR) -I$(srcdir)/.. -I$(BFDDIR) # Always use -I$(srcdir)/config when compiling. .c.o: @@ -254,11 +480,13 @@ $(OBJS): @ALL_OBJ_DEPS@ as.new: $(OBJS) $(LIBDEPS) - $(CC) $(HLDFLAGS) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES) + $(HLDENV) $(CC) $(HLDFLAGS) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES) -$(OBJS): config.h as.h targ-env.h obj-format.h targ-cpu.h flonum.h expr.h \ - struc-symbol.h write.h frags.h hash.h read.h symbols.h tc.h obj.h \ - listing.h bignum.h +# Stuff that every object file depends upon. If anything is removed +# from this list, remove it from dep-in.sed as well. +$(OBJS): config.h as.h $(TARG_ENV_H) $(OBJ_FORMAT_H) $(TARG_CPU_H) flonum.h \ + expr.h struc-symbol.h write.h frags.h hash.h read.h symbols.h tc.h \ + obj.h listing.h bignum.h bit_fix.h $(INCDIR)/libiberty.h gasp.new: $(GASPOBJS) ../libiberty/libiberty.a $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gasp.new $(GASPOBJS) ../libiberty/libiberty.a $(LOADLIBES) @@ -323,86 +551,103 @@ echo '' >> config.new cat conf >> config.new echo '#endif /* GAS_VERSION */' >> config.new - $(srcdir)/../move-if-change config.new config.h + $(SHELL) $(srcdir)/../move-if-change config.new config.h touch config-stamp -# Compiling object files from source files. - -TARG_CPU_DEP_a29k = -TARG_CPU_DEP_alpha = $(srcdir)/../include/opcode/alpha.h subsegs.h -TARG_CPU_DEP_arm = subsegs.h -TARG_CPU_DEP_generic = -TARG_CPU_DEP_h8300 = $(srcdir)/../include/opcode/h8300.h -TARG_CPU_DEP_h8500 = $(srcdir)/../opcodes/h8500-opc.h subsegs.h -TARG_CPU_DEP_hppa = subsegs.h -TARG_CPU_DEP_i386 = $(srcdir)/../include/opcode/i386.h subsegs.h -TARG_CPU_DEP_i860 = -TARG_CPU_DEP_i960 = -TARG_CPU_DEP_m68k = $(srcdir)/../include/opcode/m68k.h \ - $(srcdir)/config/m68k-parse.h subsegs.h -TARG_CPU_DEP_m88k = $(srcdir)/config/m88k-opcode.h subsegs.h -TARG_CPU_DEP_mips = $(srcdir)/../include/opcode/mips.h subsegs.h -TARG_CPU_DEP_ns32k = -TARG_CPU_DEP_ppc = subsegs.h -TARG_CPU_DEP_sh = $(srcdir)/../opcodes/sh-opc.h subsegs.h -TARG_CPU_DEP_sparc = subsegs.h -TARG_CPU_DEP_tahoe = -TARG_CPU_DEP_vax = -TARG_CPU_DEP_w65 = $(srcdir)/../opcodes/w65-opc.h subsegs.h -TARG_CPU_DEP_z8k = $(srcdir)/../opcodes/z8k-opc.h - -gasp.o : gasp.c sb.h macro.h config.h -sb.o : sb.c sb.h config.h -macro.o : macro.c macro.h sb.h hash.h config.h -app.o : app.c write.h -as.o : as.c output-file.h write.h subsegs.h sb.h macro.h -atof-generic.o : atof-generic.c -bignum-copy.o : bignum-copy.c -cond.o : cond.c -debug.o : debug.c subsegs.h -expr.o : expr.c -flonum-konst.o : flonum-konst.c -flonum-copy.o : flonum-copy.c -flonum-mult.o : flonum-mult.c -frags.o : frags.c subsegs.h -hash.o : hash.c -input-file.o : input-file.c input-file.h -input-scrub.o : input-scrub.c input-file.h sb.h -listing.o : listing.c input-file.h subsegs.h -literal.o : literal.c subsegs.h -messages.o : messages.c -output-file.o : output-file.c output-file.h -read.o : read.c sb.h macro.h -subsegs.o : subsegs.c subsegs.h -symbols.o : symbols.c subsegs.h -write.o : write.c subsegs.h output-file.h -ecoff.o : ecoff.c ecoff.h \ - $(srcdir)/../include/coff/internal.h $(srcdir)/../include/coff/sym.h \ - $(srcdir)/../include/coff/ecoff.h \ - $(srcdir)/../include/coff/symconst.h \ - $(srcdir)/../include/aout/stab_gnu.h -stabs.o : stabs.c subsegs.h $(srcdir)/../include/aout/stab_gnu.h -atof-targ.o : atof-targ.c -obj-format.o : obj-format.c -targ-cpu.o : targ-cpu.c $(TARG_CPU_DEP_@target_cpu_type@) - -obj-elf.o : $(srcdir)/config/obj-elf.c - $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-elf.c +# The implicit .c.o rule doesn't work for these, perhaps because of +# the variables, or perhaps because the sources are not on vpath. +$(TARG_CPU_O): $(TARG_CPU_C) $(TARG_CPU_DEP_@target_cpu_type@) + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(TARG_CPU_C) +$(ATOF_TARG_O): $(ATOF_TARG_C) + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(ATOF_TARG_C) + +# ecoff.c only has full dependencies when ECOFF_DEBUGGING is defined, +# so the automatic dependency stuff doesn't work. +ecoff.o : ecoff.c ecoff.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/symconst.h \ + $(INCDIR)/aout/stab_gnu.h + +# We need all these explicit rules for the multi stuff. Because of +# these rules, we don't need one for OBJ_FORMAT_O. + +obj-aout.o : $(srcdir)/config/obj-aout.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-aout.c +obj-bout.o : $(srcdir)/config/obj-bout.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-bout.c +obj-coff.o: $(srcdir)/config/obj-coff.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-coff.c obj-ecoff.o : $(srcdir)/config/obj-ecoff.c $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-ecoff.c +obj-elf.o : $(srcdir)/config/obj-elf.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-elf.c +obj-evax.o : $(srcdir)/config/obj-evax.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-evax.c +obj-hp300.o : $(srcdir)/config/obj-hp300.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-hp300.c +obj-ieee.o : $(srcdir)/config/obj-ieee.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-ieee.c +obj-multi.o : $(srcdir)/config/obj-multi.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-multi.c +obj-som.o : $(srcdir)/config/obj-som.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-som.c +obj-vms.o : $(srcdir)/config/obj-vms.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-vms.c e-mipself.o : $(srcdir)/config/e-mipself.c $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-mipself.c e-mipsecoff.o : $(srcdir)/config/e-mipsecoff.c $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-mipsecoff.c +e-i386coff.o: $(srcdir)/config/e-i386coff.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-i386coff.c +e-i386elf.o: $(srcdir)/config/e-i386elf.c + $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-i386elf.c # The m68k operand parser. -m68k-parse.c: $(srcdir)/config/m68k-parse.y +# Depend upon itbl-parse.c to serialize a parallel make. +m68k-parse.c: $(srcdir)/config/m68k-parse.y itbl-parse.c $(BISON) $(BISONFLAGS) $(srcdir)/config/m68k-parse.y mv -f y.tab.c m68k-parse.c m68k-parse.o: m68k-parse.c $(srcdir)/config/m68k-parse.h +# The instruction table specification lexical analyzer and parser. + +itbl-lex.c: $(srcdir)/itbl-lex.l + $(LEX) $(LEXFLAGS) $(srcdir)/itbl-lex.l + mv -f lex.yy.c itbl-lex.c + +itbl-lex.o: itbl-lex.c itbl-parse.h + +itbl-parse.c: $(srcdir)/itbl-parse.y + $(BISON) -d $(BISONFLAGS) $(srcdir)/itbl-parse.y + mv -f y.tab.c itbl-parse.c + mv -f y.tab.h itbl-parse.h + +itbl-parse.h: itbl-parse.c + +itbl-parse.o: itbl-parse.c itbl-parse.h $(srcdir)/itbl-ops.h + +itbl-ops.o: $(srcdir)/itbl-ops.c $(srcdir)/itbl-ops.h itbl-parse.h + +# stand-alone itbl assembler & disassembler +itbl-test-ops.o: $(srcdir)/itbl-ops.c \ + $(srcdir)/itbl-ops.h itbl-parse.h + $(CC) -o itbl-test-ops.o -DSTAND_ALONE -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/itbl-ops.c + +itbl-test.o: $(srcdir)/testsuite/gas/all/itbl-test.c $(srcdir)/itbl-ops.h + $(CC) -c -DSTAND_ALONE $(ALL_CFLAGS) $(INCLUDES)\ + $(srcdir)/testsuite/gas/all/itbl-test.c + +IT_TEST_OBJS= itbl-parse.o itbl-lex.o itbl-test-ops.o +itbl-test: $(IT_TEST_OBJS) itbl-test.o $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o itbl-test itbl-test.o $(IT_TEST_OBJS) $(LIBS) + +# CGEN interface. + +cgen.o: cgen.c cgen-opc.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/$(TARG_CPU)-opc.h + # Remake the info files. doc: $(srcdir)/as.info @@ -416,14 +661,15 @@ -rm -f $(STAGESTUFF) core stamp-mk.com -rm -f testsuite/*.o testsuite/*.out \ testsuite/gas.log testsuite/gas.sum testsuite/site.exp + -rm -rf dep.sed .tcdep .objdep .dep2 .dep1 .depa .dep .depdir clean mostlyclean: clean-here @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@ # Like clean but also delete the links made to configure gas. -DISTCLEAN_HERE = config.status Makefile targ-env.h targ-cpu.h \ - targ-cpu.c obj-format.h obj-format.c atof-targ.c TAGS \ +DISTCLEAN_HERE = config.status Makefile targ-env.h targ-cpu.h obj-format.h \ + TAGS itbl-cpu.h cgen-opc.h site.exp site.bak \ config-stamp config.h conf config.log config.cache .gdbinit \ testsuite/Makefile testsuite/config.status @@ -464,7 +710,7 @@ # These exist for maintenance purposes. tags TAGS: force - etags $(REAL_HEADERS) $(REAL_SOURCES) $(srcdir)/config/*.[hc] $(srcdir)/README $(srcdir)/Makefile.in + etags $(HFILES) $(CFILES) $(srcdir)/config/*.[hc] $(srcdir)/README $(srcdir)/Makefile.in bootstrap: as.new force $(MAKE) stage1 @@ -548,3 +794,851 @@ $(SHELL) ./config.status .gdbinit: $(srcdir)/gdbinit.in config.status $(SHELL) ./config.status + +# Automatic dependency computation. This is a real pain, because the +# dependencies change based on target_cpu_type and obj_format. We +# currently ignore any dependencies caused by emulation files. + +DEP_FILE_DEPS = $(CFILES) $(HFILES) $(TARGET_CPU_CFILES) \ + $(TARGET_CPU_HFILES) $(OBJ_FORMAT_CFILES) $(OBJ_FORMAT_HFILES) + +.dep: dep.sed $(DEP_FILE_DEPS) .tcdep .objdep .dep2 + rm -f .dep1 + $(MAKE) DEP=$(DEP) .dep1 + rm -rf .depdir + sed -f dep.sed < .dep1 > .depa + sed -f dep.sed < .tcdep >> .depa + sed -f dep.sed < .objdep >> .depa + sed -f dep.sed < .dep2 >> .depa + echo '$$(OBJS): $$(DEP_@target''_cpu_type@_@obj''_format@)' >> .depa + echo '$$(TARG_CPU_O): $$(TCDEP_@target''_cpu_type@_@obj''_format@)' >> .depa + echo '$$(OBJ_FORMAT_O): $$(OBJDEP_@target''_cpu_type@_@obj''_format@)' >> .depa + echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> .depa + $(SHELL) $(srcdir)/../move-if-change .depa .dep + +# This rule needs a mkdep that runs "gcc -MM". +# FIXME: This only works correctly if $(srcdir) is an absolute path. +.dep1: $(CFILES) $(MULTI_CFILES) + if [ -d .depdir ]; then true; else mkdir .depdir; fi + cd .depdir; \ + echo '' > targ-cpu.h; \ + echo '' > obj-format.h; \ + echo '' > targ-env.h; \ + echo '' > itbl-cpu.h; \ + echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \ + $(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$(srcdir) -I../../bfd $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $? + mv -f .depdir/.dep .dep1 + +# Work out the special dependencies for the tc-*.c files. +.tcdep: $(TARGET_CPU_CFILES) + rm -f .tcdepa + if [ -d .depdir ]; then true; else mkdir .depdir; fi + cd .depdir; \ + for c in $(CPU_TYPES); do \ + for o in $(OBJ_FORMATS); do \ + $(CPU_OBJ_VALID) \ + if [ x$${valid} = xyes ]; then \ + echo '#include "tc-'"$${c}"'.h"' > targ-cpu.h; \ + echo '#include "obj-'"$${o}"'.h"' > obj-format.h; \ + echo '#include "te-generic.h"' > targ-env.h; \ + echo '' > itbl-cpu.h; \ + echo '#include "opcodes/'"$${c}"'-opc.h"' > cgen-opc.h; \ + rm -f dummy.c; \ + cp $(srcdir)/config/tc-$${c}.c dummy.c; \ + echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \ + $(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$(srcdir) -I../../bfd $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) dummy.c; \ + sed -e "s/dummy.o: dummy.c/TCDEP_$${c}_$${o} =/" \ + -e '1,/DO NOT PUT ANYTHING AFTER/d' \ + -e '/IF YOU PUT ANYTHING/,$$d' \ + -e '/^$$/d' < .dep >> ../.tcdepa; \ + rm -f dummy.c; \ + else true; fi; \ + done; \ + done + echo 'TCDEP_hppa_som = $(srcdir)/config/tc-hppa.h subsegs.h \' >> .tcdepa + echo ' $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h \' >> .tcdepa + echo ' $(INCDIR)/opcode/hppa.h $(BFDDIR)/som.h' >> .tcdepa + # We don't try to handle all multi cases. + for c in $(CPU_TYPES); do \ + $(CPU_MULTI_VALID) \ + if [ x$${valid} = xyes ]; then \ + o=ecoff; \ + $(CPU_OBJ_VALID) \ + echo 'TCDEP_'"$${c}"'_multi = \' >> .tcdepa; \ + echo '$$(TCDEP_'"$${c}"'_coff) \' >> .tcdepa; \ + if [ x$${valid} = xyes ]; then \ + echo '$$(TCDEP_'"$${c}"'_ecoff) \' >> .tcdepa; \ + else true; fi; \ + echo '$$(TCDEP_'"$${c}"'_elf)' >> .tcdepa; \ + else true; fi; \ + done + mv -f .tcdepa .tcdep + +# Work out the special dependencies for the obj-*.c files. +.objdep: $(OBJ_FORMAT_CFILES) + rm -f .objdepa + if [ -d .depdir ]; then true; else mkdir .depdir; fi + cd .depdir; \ + for c in $(CPU_TYPES); do \ + for o in $(OBJ_FORMATS); do \ + $(CPU_OBJ_VALID) \ + if [ x$${valid} = xyes ]; then \ + echo '#include "tc-'"$${c}"'.h"' > targ-cpu.h; \ + echo '#include "obj-'"$${o}"'.h"' > obj-format.h; \ + echo '#include "te-generic.h"' > targ-env.h; \ + echo '' > itbl-cpu.h; \ + rm -f dummy.c; \ + cp $(srcdir)/config/obj-$${o}.c dummy.c; \ + echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \ + $(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$(srcdir) -I../../bfd $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) dummy.c; \ + sed -e "s/dummy.o: dummy.c/OBJDEP_$${c}_$${o} =/" \ + -e '1,/DO NOT PUT ANYTHING AFTER/d' \ + -e '/IF YOU PUT ANYTHING/,$$d' \ + -e '/^$$/d' < .dep >> ../.objdepa; \ + rm -f dummy.c; \ + else true; fi; \ + done; \ + done + echo 'OBJDEP_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \' >> .objdepa + echo ' $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h \' >> .objdepa + echo ' $(BFDDIR)/som.h $(INCDIR)/aout/stab_gnu.h \' >> .objdepa + echo ' $(INCDIR)/aout/stab.def' >> .objdepa + # We don't try to handle all multi cases. + for c in $(CPU_TYPES); do \ + $(CPU_MULTI_VALID) \ + if [ x$${valid} = xyes ]; then \ + o=ecoff; \ + $(CPU_OBJ_VALID) \ + echo 'OBJDEP_'"$${c}"'_multi = \' >> .objdepa; \ + echo '$$(OBJDEP_'"$${c}"'_coff) \' >> .objdepa; \ + if [ x$${valid} = xyes ]; then \ + echo '$$(OBJDEP_'"$${c}"'_ecoff) \' >> .objdepa; \ + else true; fi; \ + echo '$$(OBJDEP_'"$${c}"'_elf)' >> .objdepa; \ + else true; fi; \ + done + mv -f .objdepa .objdep + +# Work out the dependencies for each CPU/OBJ combination. +# Note that SOM is a special case, because it only works native. +# FIXME: This only works correctly if $(srcdir) is an absolute path. +.dep2: $(TARGET_CPU_HFILES) $(OBJ_FORMAT_HFILES) + rm -f .dep2a + if [ -d .depdir ]; then true; else mkdir .depdir; fi + cd .depdir; \ + for c in $(CPU_TYPES); do \ + for o in $(OBJ_FORMATS); do \ + $(CPU_OBJ_VALID) \ + if [ x$${valid} = xyes ]; then \ + echo '#include "tc-'"$${c}"'.h"' > targ-cpu.h; \ + echo '#include "obj-'"$${o}"'.h"' > dummy.c; \ + echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \ + $(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$(srcdir) -I../../bfd $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) dummy.c; \ + sed -e "s/dummy.o: dummy.c/DEP_$${c}_$${o} =/" \ + -e '1,/DO NOT PUT ANYTHING AFTER/d' \ + -e '/IF YOU PUT ANYTHING/,$$d' \ + -e '/^$$/d' < .dep >> ../.dep2a; \ + else true; fi; \ + done; \ + done + echo 'DEP_hppa_som = $(srcdir)/../bfd/som.h' >> .dep2a + # We don't try to handle all multi cases. + for c in $(CPU_TYPES); do \ + $(CPU_MULTI_VALID) \ + if [ x$${valid} = xyes ]; then \ + o=ecoff; \ + $(CPU_OBJ_VALID) \ + echo 'DEP_'"$${c}"'_multi = \' >> .dep2a; \ + echo '$$(DEP_'"$${c}"'_coff) \' >> .dep2a; \ + if [ x$${valid} = xyes ]; then \ + echo '$$(DEP_'"$${c}"'_ecoff) \' >> .dep2a; \ + else true; fi; \ + echo '$$(DEP_'"$${c}"'_elf)' >> .dep2a; \ + else true; fi; \ + done + mv -f .dep2a .dep2 + +dep.sed: dep-in.sed config.status + sed <$(srcdir)/dep-in.sed >dep.sed \ + -e 's!@INCDIR@!$(INCDIR)!' \ + -e 's!@BFDDIR@!$(BFDDIR)!' \ + -e 's!@SRCDIR@!$(srcdir)!' + +dep: .dep + sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile + cat .dep >> tmp-Makefile + $(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile + +dep-in: .dep + sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in + cat .dep >> tmp-Makefile.in + $(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in + +.PHONY: dep dep-in + + +# DO NOT DELETE THIS LINE -- mkdep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +app.o: app.c +as.o: as.c subsegs.h $(INCDIR)/obstack.h output-file.h \ + sb.h macro.h +atof-generic.o: atof-generic.c +bignum-copy.o: bignum-copy.c +cond.o: cond.c $(INCDIR)/obstack.h +ecoff.o: ecoff.c +expr.o: expr.c $(INCDIR)/obstack.h +flonum-copy.o: flonum-copy.c +flonum-konst.o: flonum-konst.c +flonum-mult.o: flonum-mult.c +frags.o: frags.c subsegs.h $(INCDIR)/obstack.h +gasp.o: gasp.c sb.h macro.h +hash.o: hash.c +input-file.o: input-file.c input-file.h +input-scrub.o: input-scrub.c input-file.h sb.h +listing.o: listing.c input-file.h subsegs.h +literal.o: literal.c subsegs.h $(INCDIR)/obstack.h +macro.o: macro.c sb.h macro.h +messages.o: messages.c +output-file.o: output-file.c output-file.h +read.o: read.c subsegs.h $(INCDIR)/obstack.h sb.h macro.h \ + ecoff.h +sb.o: sb.c sb.h +stabs.o: stabs.c $(INCDIR)/obstack.h subsegs.h ecoff.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def +subsegs.o: subsegs.c subsegs.h $(INCDIR)/obstack.h +symbols.o: symbols.c $(INCDIR)/obstack.h subsegs.h +write.o: write.c subsegs.h $(INCDIR)/obstack.h output-file.h +e-i386coff.o: $(srcdir)/config/e-i386coff.c emul.h \ + emul-target.h +e-i386elf.o: $(srcdir)/config/e-i386elf.c emul.h emul-target.h +e-mipsecoff.o: $(srcdir)/config/e-mipsecoff.c emul.h \ + emul-target.h +e-mipself.o: $(srcdir)/config/e-mipself.c emul.h emul-target.h + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY +TCDEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/a29k.h +TCDEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/opcode/a29k.h +TCDEP_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h $(INCDIR)/opcode/a29k.h +TCDEP_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/alpha.h \ + $(srcdir)/config/atof-vax.c +TCDEP_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \ + ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/alpha.h \ + $(srcdir)/config/atof-vax.c +TCDEP_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/alpha.h $(INCDIR)/elf/alpha.h \ + $(srcdir)/config/atof-vax.c +TCDEP_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/alpha.h \ + $(srcdir)/config/atof-vax.c +TCDEP_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h +TCDEP_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h +TCDEP_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h subsegs.h \ + $(INCDIR)/obstack.h +TCDEP_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/d10v.h \ + $(INCDIR)/elf/ppc.h +TCDEP_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/d10v.h $(INCDIR)/elf/ppc.h +TCDEP_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/opcode/h8300.h +TCDEP_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h $(INCDIR)/opcode/h8300.h +TCDEP_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h +TCDEP_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h subsegs.h \ + $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h +TCDEP_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + subsegs.h $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/libbfd.h \ + $(INCDIR)/opcode/hppa.h +TCDEP_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \ + $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h subsegs.h \ + $(INCDIR)/obstack.h $(BFDDIR)/libbfd.h $(INCDIR)/opcode/hppa.h +TCDEP_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/i386.h +TCDEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i386.h +TCDEP_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/i386.h +TCDEP_i860_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i860.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/i860.h +TCDEP_i860_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i860.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/opcode/i860.h +TCDEP_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h $(INCDIR)/opcode/i860.h +TCDEP_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h +TCDEP_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h +TCDEP_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/i960.h +TCDEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + subsegs.h $(INCDIR)/obstack.h cgen-opc.h $(srcdir)/../opcodes/m32r-opc.h \ + $(INCDIR)/opcode/cgen.h +TCDEP_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h subsegs.h \ + $(INCDIR)/obstack.h cgen-opc.h $(srcdir)/../opcodes/m32r-opc.h \ + $(INCDIR)/opcode/cgen.h +TCDEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h +TCDEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/m68k.h \ + $(srcdir)/config/m68k-parse.h +TCDEP_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h $(INCDIR)/obstack.h \ + subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h +TCDEP_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/m68k.h \ + $(srcdir)/config/m68k-parse.h +TCDEP_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/config/m88k-opcode.h +TCDEP_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h subsegs.h \ + $(INCDIR)/obstack.h $(srcdir)/config/m88k-opcode.h +TCDEP_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/mips.h itbl-ops.h ecoff.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h +TCDEP_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h \ + itbl-ops.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h +TCDEP_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \ + ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h \ + itbl-ops.h +TCDEP_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h itbl-ops.h \ + $(INCDIR)/elf/mips.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h +TCDEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10200.h +TCDEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10200.h +TCDEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10300.h +TCDEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10300.h +TCDEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ns32k.h \ + $(INCDIR)/obstack.h +TCDEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h +TCDEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h $(INCDIR)/opcode/ns32k.h \ + $(INCDIR)/obstack.h +TCDEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h +TCDEP_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h $(INCDIR)/elf/ppc.h +TCDEP_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h +TCDEP_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h subsegs.h \ + $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h +TCDEP_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/sparc.h +TCDEP_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/sparc.h +TCDEP_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/sparc.h +TCDEP_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/tahoe.h +TCDEP_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h +TCDEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/tahoe.h +TCDEP_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(srcdir)/config/vax-inst.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h +TCDEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h +TCDEP_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h $(srcdir)/config/vax-inst.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h +TCDEP_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(srcdir)/config/vax-inst.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h +TCDEP_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h +TCDEP_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h subsegs.h \ + $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h +TCDEP_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +TCDEP_z8k_elf = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h +TCDEP_hppa_som = $(srcdir)/config/tc-hppa.h subsegs.h \ + $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(INCDIR)/opcode/hppa.h \ + $(BFDDIR)/som.h +TCDEP_i386_multi = $(TCDEP_i386_coff) $(TCDEP_i386_elf) +TCDEP_mips_multi = $(TCDEP_mips_coff) $(TCDEP_mips_ecoff) \ + $(TCDEP_mips_elf) +OBJDEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/obstack.h +OBJDEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h +OBJDEP_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \ + ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(BFDDIR)/libecoff.h +OBJDEP_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h subsegs.h \ + $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ + $(INCDIR)/aout/aout64.h +OBJDEP_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h +OBJDEP_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/obstack.h +OBJDEP_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h +OBJDEP_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h +OBJDEP_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \ + $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/obstack.h +OBJDEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_i860_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i860.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/obstack.h +OBJDEP_i860_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i860.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h +OBJDEP_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \ + $(INCDIR)/obstack.h +OBJDEP_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h +OBJDEP_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/obstack.h +OBJDEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_m68k_hp300 = $(srcdir)/config/obj-aout.c $(srcdir)/config/obj-hp300.h \ + $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/obstack.h +OBJDEP_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/obstack.h +OBJDEP_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h +OBJDEP_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \ + ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(BFDDIR)/libecoff.h +OBJDEP_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h subsegs.h \ + $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/aout/aout64.h +OBJDEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h +OBJDEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h +OBJDEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/obstack.h +OBJDEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h +OBJDEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/elf/ppc.h $(INCDIR)/aout/aout64.h +OBJDEP_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/obstack.h +OBJDEP_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/obstack.h +OBJDEP_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h +OBJDEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/obstack.h +OBJDEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/obstack.h subsegs.h +OBJDEP_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def subsegs.h \ + $(INCDIR)/obstack.h +OBJDEP_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +OBJDEP_z8k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +OBJDEP_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \ + $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/som.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def +OBJDEP_i386_multi = $(OBJDEP_i386_coff) $(OBJDEP_i386_elf) +OBJDEP_mips_multi = $(OBJDEP_mips_coff) $(OBJDEP_mips_ecoff) \ + $(OBJDEP_mips_elf) +DEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h +DEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h +DEP_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \ + ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h +DEP_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h +DEP_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h +DEP_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h +DEP_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h +DEP_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h +DEP_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h +DEP_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h +DEP_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \ + $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h +DEP_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h +DEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h +DEP_i860_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i860.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h +DEP_i860_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i860.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h +DEP_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h +DEP_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h +DEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h +DEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h +DEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h +DEP_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h +DEP_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h +DEP_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h +DEP_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \ + ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h +DEP_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h +DEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h +DEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h +DEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h +DEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h +DEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h +DEP_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h +DEP_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h +DEP_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h +DEP_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h +DEP_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h +DEP_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h +DEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h +DEP_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def +DEP_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h +DEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_z8k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h +DEP_hppa_som = $(BFDDIR)/som.h +DEP_i386_multi = $(DEP_i386_coff) $(DEP_i386_elf) +DEP_mips_multi = $(DEP_mips_coff) $(DEP_mips_ecoff) \ + $(DEP_mips_elf) +$(OBJS): $(DEP_@target_cpu_type@_@obj_format@) +$(TARG_CPU_O): $(TCDEP_@target_cpu_type@_@obj_format@) +$(OBJ_FORMAT_O): $(OBJDEP_@target_cpu_type@_@obj_format@) +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff -urN binutils-2.7/gas/NEWS binutils-2.8/gas/NEWS --- binutils-2.7/gas/NEWS Mon Jul 8 17:43:18 1996 +++ binutils-2.8/gas/NEWS Wed Apr 30 12:53:30 1997 @@ -1,6 +1,31 @@ -*- text -*- -Changes since 2.6: +Changes in 2.8: + +BeOS support added. + +MIPS16 support added. + +Motorola ColdFire 5200 support added (configure for m68k and use -m5200). + +Alpha/VMS support added. + +m68k options --base-size-default-16, --base-size-default-32, +--disp-size-default-16, and --disp-size-default-32 added. + +The alignment directives now take an optional third argument, which is the +maximum number of bytes to skip. If doing the alignment would require skipping +more than the given number of bytes, the alignment is not done at all. + +The ELF assembler has a new pseudo-op, .symver, used for symbol versioning. + +The -a option takes a new suboption, c (e.g., -alc), to skip false conditionals +in listings. + +Added new pseudo-op, .equiv; it's like .equ, except that it is an error if the +symbol is already defined. + +Changes in 2.7: The PowerPC assembler now allows the use of symbolic register names (r0, etc.) if -mregnames is used. Symbolic names preceded by a '%' (%r0, etc.) can be @@ -23,7 +48,7 @@ m88k-motorola-sysv* support added. -Changes since 2.5: +Changes in 2.6: Gas now directly supports macros, without requiring GASP. @@ -37,7 +62,7 @@ Added PIC support to Solaris and SPARC SunOS 4 assembler. -Changes since 2.3: +Changes in 2.4: Converted this directory to use an autoconf-generated configure script. @@ -71,7 +96,7 @@ Updated ns32k (pc532-mach, netbsd532) support from Ian Dall. -Changes since 2.2: +Changes in 2.3: Mach i386 support, by David Mackenzie and Ken Raeburn. @@ -113,7 +138,7 @@ ---------------------------------------------------------------- -Changes since 2.1: +Changes in 2.2: RS/6000 AIX and MIPS SGI Irix 5 support has been added. @@ -147,7 +172,7 @@ ---------------------------------------------------------------- -Changes for 2.1: +Changes in 2.1: Several small fixes for i386-aix (PS/2) support from Minh Tran-Le have been incorporated, but not well tested yet. @@ -172,7 +197,7 @@ ---------------------------------------------------------------- -Changes for 2.0: +Changes in 2.0: Mostly bug fixes. @@ -180,7 +205,7 @@ ---------------------------------------------------------------- -Changes for 1.94: +Changes in 1.94: BFD merge is partly done. Adventurous souls may try giving configure the "--with-bfd-assembler" option. Currently, ELF format requires it, a.out format @@ -207,7 +232,7 @@ ---------------------------------------------------------------- -Changes for 1.93.01: +Changes in 1.93.01: For m68k, support for more processors has been added: 68040, CPU32, 68851. diff -urN binutils-2.7/gas/NOTES binutils-2.8/gas/NOTES --- binutils-2.7/gas/NOTES Thu Jul 4 12:12:39 1996 +++ binutils-2.8/gas/NOTES Wed Dec 31 19:00:00 1969 @@ -1,107 +0,0 @@ --*- text -*- - -PORTING: - -Sorry, no description of the interfaces is written up yet. Look at existing -back ends and work from there. - -New hosts: The configure script, which is generated by autoconf, -should handle all host specific configuration. - -New target formats: Look at the BFD_ASSEMBLER code. The a.out or ELF -code might be a fair example. There are no "good" examples yet, -unfortunately, nor any good documentation of the changes. - -New target processors: Check first to see if the BFD_ASSEMBLER interface is -supported by the file format code you need to use. - -DOCUMENTATION: - -The internals of gas need documenting. - -The documentation should also contain a "Trouble" section similar to gcc's -manual: real bugs, common problems, incompatibilities, etc. - -Anyone want to offer to maintain a man page? - -BFD CONVERSION: - -The "#ifdef BFD_ASSEMBLER" code is on its way in; the "#ifndef BFD_ASSEMBLER" -code is on its way out. The new code uses BFD data structures, and calls BFD -for anything that needs to be written to the output file. The old code did all -the writing itself, or in a couple of cases, used BFD as a slightly higher -level than stdio (i.e., bfd_seek, bfd_write -- these are not the preferred -interface). - -Because of this, some of this code is messy. Lots of ifdef's, and the -non-BFD_ASSEMBLER version often has multiple conditional tests inside it for -various processors or formats. As the various targets get converted over, -these will gradually go away. - -TO DO: - -Remove DONTDEF code, commented-out code. - -Eliminate, as much as possible, anything not in config that is conditionalized -on a CPU, format, or environment. - -Merge COFF support into one version, supporting all the pseudo-ops used in -either versions now, but using BFD for high-level operations. (See second -following item.) Currently there are two versions (plus the new BFD code), -which support different features, and are used on different targets. - -Convert remaining a.out/b.out targets to using the BFD_ASSEMBLER code by -default. - -Finish conversion to using BFD for all object file writing. (This is the -BFD_ASSEMBLER code, not BFD or BFD_HEADERS.) VMS might be the tough one here, -since there's no BFD support for it at all yet. Eliminate the old code. Some -of this can be done target by target, so doing a target where the CPU or -format already supports BFD_ASSEMBLER mode may be easiest. - -Fix lots of uses of empty strings to use null pointers. Will improve -efficiency, and should make code clearer too. - -Clean up comments; lots of 'em are one previous maintainer griping about -another previous maintainer, unrelated to the code. (And with no names, -they're not so fun to read. :-) - -For sparc: "call 0" becomes "jmpl %g0,%l7", and similarly for absolute -addresses in -4096...4095. (Solaris assembler does this. No -relocation required, no absolute symbol needed.) For addresses -outside the range, for COFF, keep generating an absolute symbol to use -for relocs. - -Get Steve to document H8/500 stuff (and others). - -Improve test suite. Incorporate more reported net bugs, and non-confidential -Cygnus customer bugs, and anything else. - -Add support for i386/i486 16-bit mode, so operating system initialization code -doesn't require a separate assembler nor lots of `.byte' directives. - -See if it's more maintainable (and not too much of a performance loss) to use -a yacc grammar for parsing input. The lexer will have to be flexible, and the -grammar will have to contain any construct used on any platform, but it may be -easier to maintain, instead of having code in most of the back ends. - -PIC support. - -Torbjorn Granlund writes, regarding alpha .align: - - Please make sure the .align directive works as in digital's assembler. - They fill the space with a sequence of "bis $31,$31,$31;ldq_u $31,0($30)" - since these two instructions can dual-issue. Since .align is ued a lot by - gcc, it is an important optimization. - -(From old "NOTES" file to-do list, not really reviewed:) - -fix relocation types for i860, perhaps by adding a ref pointer to fixS? - -remove the ifdef's from fx_callj tests? - -space tighten sparc alignment? - -md_ => tc_ - -share b.out with a.out. diff -urN binutils-2.7/gas/NOTES.config binutils-2.8/gas/NOTES.config --- binutils-2.7/gas/NOTES.config Thu Jul 4 12:12:39 1996 +++ binutils-2.8/gas/NOTES.config Wed Dec 31 19:00:00 1969 @@ -1,42 +0,0 @@ - - The GAS Configuration Plan - -Theory: - -The goal of the new configuration scheme is to bury all object format -and target processor dependancies in object and target specific files. -That is, to move all #ifdef's out of the gas common code. - -Here's how it works. There is a .h and a .c file for each object file -format and a .h and a .c file for each target processor. The -configure script creates symlinks in the current directory to the -appropriate files in the config directory. configure also serves as a -list of triplets {host, target, object-format} that have been tested -at one time or another. I also recommend that configure be used to -document triplet specific notes as to purpose of the triplet, etc. - -Implementation: - -obj-format.h is a {sym}link to .../config/obj-something.h. It is intended - -All gas .c files include as.h. - -as.h #define's "gas", includes host.h, defines a number of gas -specific structures and types, and then includes tp.h, obj.h, and -target-environment.h. - -target-environment.h defines a target environment specific -preprocessor flag, eg, TE_SUN, and then includes obj-format.h. - -obj-format.h defines an object format specific preprocessor flag, eg, -OBJ_AOUT, OBJ_BOUT, OBJ_COFF, includes "target-processor.h", and then -defines the object specific macros, functions, types, and structures. - -target-processor.h - -target-processor. - -Porting: - -There appear to be four major types of ports; new hosts, new target -processors, new object file formats, and new target environments. diff -urN binutils-2.7/gas/README binutils-2.8/gas/README --- binutils-2.7/gas/README Mon Jul 8 17:44:24 1996 +++ binutils-2.8/gas/README Wed Apr 30 12:53:30 1997 @@ -1,7 +1,4 @@ --*- text -*- - README for GAS - [cribbed largely from GDB's README file] A number of things have changed since version 1 and the wonderful world of gas looks very different. There's still a lot of irrelevant garbage lying around @@ -84,8 +81,8 @@ configure [--help] [--prefix=DIR] [--srcdir=PATH] - [--norecursion] [--rm] - [--target=TARGET] HOST + [--host=HOST] + [--target=TARGET] [--with-OPTION] [--enable-OPTION] @@ -93,27 +90,22 @@ prefer; but you may abbreviate option names if you use `--'. `--help' - Display a quick summary of how to invoke `configure'. + Print a summary of the options to `configure', and exit. `-prefix=DIR' Configure the source to install programs and files under directory `DIR'. `--srcdir=PATH' - *Warning: using this option requires GNU `make', or another `make' - that implements the `VPATH' feature.* - Use this option to make configurations in directories separate - from the GAS source directories. Among other things, you can use - this to build (or maintain) several configurations simultaneously, - in separate directories. `configure' writes configuration - specific files in the current directory, but arranges for them to - use the source in the directory PATH. `configure' will create - directories under the working directory in parallel to the source - directories below PATH. - -`--norecursion' - Configure only the directory level where `configure' is executed; - do not propagate configuration to subdirectories. + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--host=HOST' + Configure GAS to run on the specified HOST. Normally the + configure script can figure this out automatically. + + There is no convenient way to generate a list of all available + hosts. `--target=TARGET' Configure GAS for cross-assembling programs for the specified @@ -129,12 +121,6 @@ host/target combination. See below for a list of `--enable' options recognized in the gas distribution. -`HOST ...' - Configure GAS to run on the specified HOST. - - There is no convenient way to generate a list of all available - hosts. - `configure' accepts other options, for compatibility with configuring other GNU tools recursively; but these are the only options that affect GAS or its supporting libraries. @@ -151,7 +137,7 @@ BFD data structures internally, and use BFD for writing object files. For most targets, this isn't supported yet. For most targets where it has been done, it's already the default. So generally you won't need to use - this option. See `BFD CONVERSION' in the file `gas/NOTES'. + this option. Supported platforms =================== @@ -170,46 +156,36 @@ bsd/386 delta (m68k-sysv from Motorola) delta88 (m88k-sysv from Motorola) - linux + GNU/linux m68k hpux 8.0 (hpux 7.0 may be a problem) vax bsd, ultrix, vms hp9000s300 decstation - iris + irix 4 + irix 5 miniframe (m68k-sysv from Convergent Technologies) i386-aix (ps/2) hppa (hpux 4.3bsd, osf1) - rs6000 + AIX unixware sco 3.2v4.2 sco openserver 5.0 (a.k.a. 3.2v5.0 ) - sparc solaris 2.3 - -For cross-assemblers, I believe hosting to work on any of the machines listed -above, plus: + sparc solaris - sun386i - at least some flavors of hpux (hpux 7.0 may be a problem) - most flavors of sysV +I believe that gas as a cross-assembler can currently be targetted for +most of the above hosts, plus -I believe that gas as a cross-assembler can currently be targetted for: - - 386bsd - bsd/386 decstation-bsd (a.out format, to be used in BSD 4.4) ebmon29k go32 (DOS on i386, with DJGPP -- old a.out version) h8/300, h8/500 (Hitachi) - hp9000/300 i386-aix (ps/2) i960-coff - linux mips ecoff (decstation-ultrix, iris, mips magnum, mips-idt-ecoff) nindy960 - powerpc + powerpc EABI + SH (Hitachi) sco386 - sun3 - sun4 vax bsd or ultrix? vms vxworks68k @@ -220,7 +196,8 @@ preprocessor. If you want that, rename your file to have a ".S" suffix, and run gcc on it. Or run "gcc -xassembler-with-cpp foo.s". -Support for ELF should work now for sparc, hppa, i386, alpha, m68k. +Support for ELF should work now for sparc, hppa, i386, alpha, m68k, +MIPS, powerpc. Support for ns32k, tahoe, i860, m88k may be suffering from bitrot. @@ -230,18 +207,20 @@ Compiler Support Hacks ====================== -The assembler has been modified to support a feature that is potentially -useful when assembling compiler output, but which may confuse assembly -language programmers. If assembler encounters a .word pseudo-op of the form -symbol1-symbol2 (the difference of two symbols), and the difference of those -two symbols will not fit in 16 bits, the assembler will create a branch around -a long jump to symbol1, and insert this into the output directly before the -next label: The .word will (instead of containing garbage, or giving an error -message) contain (the address of the long jump)-symbol2. This allows the -assembler to assemble jump tables that jump to locations very far away into -code that works properly. If the next label is more than 32K away from the -.word, you lose (silently); RMS claims this will never happen. If the -K -option is given, you will get a warning message when this happens. +On a few targets, the assembler has been modified to support a feature +that is potentially useful when assembling compiler output, but which +may confuse assembly language programmers. If assembler encounters a +.word pseudo-op of the form symbol1-symbol2 (the difference of two +symbols), and the difference of those two symbols will not fit in 16 +bits, the assembler will create a branch around a long jump to +symbol1, and insert this into the output directly before the next +label: The .word will (instead of containing garbage, or giving an +error message) contain (the address of the long jump)-symbol2. This +allows the assembler to assemble jump tables that jump to locations +very far away into code that works properly. If the next label is +more than 32K away from the .word, you lose (silently); RMS claims +this will never happen. If the -K option is given, you will get a +warning message when this happens. REPORTING BUGS IN GAS @@ -274,7 +253,7 @@ 1. You might be mistaken. 2. It might take us a lot of time to install things to regenerate that file. 3. We might get a different file from the one you got, and might not see any -bug. + bug. To save us these delays and uncertainties, always send the input file for the program that failed. A smaller test case that demonstrates the problem is of diff -urN binutils-2.7/gas/acconfig.h binutils-2.8/gas/acconfig.h --- binutils-2.7/gas/acconfig.h Thu Jul 4 12:12:43 1996 +++ binutils-2.8/gas/acconfig.h Wed Apr 30 12:53:30 1997 @@ -17,11 +17,17 @@ #undef TARGET_OS #undef TARGET_VENDOR +/* Sometimes the system header files don't declare strstr. */ +#undef NEED_DECLARATION_STRSTR + /* Sometimes the system header files don't declare malloc and realloc. */ #undef NEED_DECLARATION_MALLOC /* Sometimes the system header files don't declare free. */ #undef NEED_DECLARATION_FREE + +/* Sometimes the system header files don't declare sbrk. */ +#undef NEED_DECLARATION_SBRK /* Sometimes errno.h doesn't declare errno itself. */ #undef NEED_DECLARATION_ERRNO diff -urN binutils-2.7/gas/app.c binutils-2.8/gas/app.c --- binutils-2.7/gas/app.c Wed Jul 10 00:25:57 1996 +++ binutils-2.8/gas/app.c Wed Apr 30 12:53:30 1997 @@ -1,5 +1,5 @@ /* This is the Assembler Pre-Processor - Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* Modified by Allen Wirfs-Brock, Instantiations Inc 2/90 */ /* App, the assembler pre-processor. This pre-processor strips out excess @@ -52,7 +53,6 @@ #define LEX_IS_COMMENT_START 4 #define LEX_IS_LINE_COMMENT_START 5 #define LEX_IS_TWOCHAR_COMMENT_1ST 6 -#define LEX_IS_TWOCHAR_COMMENT_2ND 7 #define LEX_IS_STRINGQUOTE 8 #define LEX_IS_COLON 9 #define LEX_IS_NEWLINE 10 @@ -126,17 +126,12 @@ lex[(unsigned char) *p] = LEX_IS_LINE_SEPARATOR; } /* declare line separators */ - /* Only allow slash-star comments if slash is not in use */ + /* Only allow slash-star comments if slash is not in use. + FIXME: This isn't right. We should always permit them. */ if (lex['/'] == 0) { lex['/'] = LEX_IS_TWOCHAR_COMMENT_1ST; } - /* FIXME-soon. This is a bad hack but otherwise, we can't do - c-style comments when '/' is a line comment char. xoxorich. */ - if (lex['*'] == 0) - { - lex['*'] = LEX_IS_TWOCHAR_COMMENT_2ND; - } if (m68k_mri) { @@ -404,7 +399,7 @@ } state = old_state; - PUT (' '); + UNGET (' '); continue; case 4: @@ -759,7 +754,7 @@ case LEX_IS_TWOCHAR_COMMENT_1ST: ch2 = GET (); - if (ch2 != EOF && lex[ch2] == LEX_IS_TWOCHAR_COMMENT_2ND) + if (ch2 == '*') { for (;;) { @@ -769,20 +764,19 @@ if (ch2 != EOF && IS_NEWLINE (ch2)) add_newlines++; } - while (ch2 != EOF && - (lex[ch2] != LEX_IS_TWOCHAR_COMMENT_2ND)); + while (ch2 != EOF && ch2 != '*'); - while (ch2 != EOF && - (lex[ch2] == LEX_IS_TWOCHAR_COMMENT_2ND)) - { - ch2 = GET (); - } + while (ch2 == '*') + ch2 = GET (); - if (ch2 == EOF - || lex[ch2] == LEX_IS_TWOCHAR_COMMENT_1ST) + if (ch2 == EOF || ch2 == '/') break; + + /* This UNGET will ensure that we count newlines + correctly. */ UNGET (ch2); } + if (ch2 == EOF) as_warn ("end of file in multiline comment"); @@ -906,6 +900,7 @@ ch2 = GET (); if (ch2 == '*') { + old_state = 3; state = -2; break; } @@ -934,7 +929,7 @@ } if (ch < '0' || ch > '9' || state != 0 || startch != '#') { - /* Not a CPP line. */ + /* Not a cpp line. */ while (ch != EOF && !IS_NEWLINE (ch)) ch = GET (); if (ch == EOF) diff -urN binutils-2.7/gas/as.c binutils-2.8/gas/as.c --- binutils-2.7/gas/as.c Thu Jul 4 12:12:45 1996 +++ binutils-2.8/gas/as.c Wed Apr 30 12:53:30 1997 @@ -1,5 +1,5 @@ /* as.c - GAS main program. - Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* * Main program for AS; a 32-bit assembler of GNU. @@ -34,7 +35,6 @@ */ #include "ansidecl.h" -#include "libiberty.h" #define COMMON @@ -43,7 +43,20 @@ #include "output-file.h" #include "sb.h" #include "macro.h" +#ifndef HAVE_ITBL_CPU +#define itbl_parse(itbl_file) 1 +#define itbl_init() +#endif + +#ifdef HAVE_SBRK +#ifdef NEED_DECLARATION_SBRK +extern PTR sbrk (); +#endif +#endif +static void show_usage PARAMS ((FILE *)); +static void parse_args PARAMS ((int *, char ***)); +static void dump_statistics PARAMS ((void)); static void perform_an_assembly_pass PARAMS ((int argc, char **argv)); static int macro_expr PARAMS ((const char *, int, sb *, int *)); @@ -78,6 +91,16 @@ }; static struct defsym_list *defsyms; + +/* Keep a record of the itbl files we read in. */ + +struct itbl_file_list +{ + struct itbl_file_list *next; + char *name; +}; + +static struct itbl_file_list *itbl_files; void print_version_id () @@ -94,7 +117,7 @@ fprintf (stderr, "\n"); } -void +static void show_usage (stream) FILE *stream; { @@ -104,6 +127,7 @@ Options:\n\ -a[sub-option...] turn on listings\n\ Sub-options [default hls]:\n\ + c omit false conditionals\n\ d omit debugging directives\n\ h include high-level source\n\ l include assembly\n\ @@ -127,11 +151,15 @@ --statistics print various measured statistics from execution\n\ --version print assembler version number and exit\n\ -W suppress warnings\n\ +--itbl INSTTBL extend instruction set to include instructions\n\ + matching the specifications defined in file INSTTBL\n\ -w ignored\n\ -X ignored\n\ -Z generate object file even after errors\n"); md_show_usage (stream); + + fprintf (stream, "\nReport bugs to bug-gnu-utils@prep.ai.mit.edu\n"); } #ifdef USE_EMULATIONS @@ -139,10 +167,13 @@ extern struct emulation mipsbelf, mipslelf, mipself; extern struct emulation mipsbecoff, mipslecoff, mipsecoff; +extern struct emulation i386coff, i386elf; static struct emulation *const emulations[] = { EMULATIONS }; static const int n_emulations = sizeof (emulations) / sizeof (emulations[0]); +static void select_emulation_mode PARAMS ((int, char **)); + static void select_emulation_mode (argc, argv) int argc; @@ -229,7 +260,7 @@ * md_parse_option definitions in config/tc-*.c */ -void +static void parse_args (pargc, pargv) int *pargc; char ***pargv; @@ -258,6 +289,8 @@ 'v', #endif 'w', 'X', + /* New option for extending instruction set (see also --itbl below) */ + 't', '\0' }; struct option *longopts; @@ -280,7 +313,15 @@ #define OPTION_EMULATION (OPTION_STD_BASE + 6) {"emulation", required_argument, NULL, OPTION_EMULATION}, #define OPTION_DEFSYM (OPTION_STD_BASE + 7) - {"defsym", required_argument, NULL, OPTION_DEFSYM} + {"defsym", required_argument, NULL, OPTION_DEFSYM}, +#define OPTION_INSTTBL (OPTION_STD_BASE + 8) + /* New option for extending instruction set (see also -t above). + The "-t file" or "--itbl file" option extends the basic set of + valid instructions by reading "file", a text file containing a + list of instruction formats. The additional opcodes and their + formats are added to the built-in set of instructions, and + mnemonics for new registers may also be defined. */ + {"itbl", required_argument, NULL, OPTION_INSTTBL} }; /* Construct the option lists from the standard list and the @@ -362,7 +403,14 @@ break; case OPTION_VERSION: - print_version_id (); + /* This output is intended to follow the GNU standards document. */ + printf ("GNU assembler %s\n", GAS_VERSION); + printf ("Copyright 1997 Free Software Foundation, Inc.\n"); + printf ("\ +This program is free software; you may redistribute it under the terms of\n\ +the GNU General Public License. This program has absolutely no warranty.\n"); + printf ("This assembler was configured for a target of `%s'.\n", + TARGET_ALIAS); exit (EXIT_SUCCESS); case OPTION_EMULATION: @@ -406,6 +454,32 @@ } break; + case OPTION_INSTTBL: + case 't': + { + /* optarg is the name of the file containing the instruction + formats, opcodes, register names, etc. */ + struct itbl_file_list *n; + + n = (struct itbl_file_list *) xmalloc (sizeof *n); + n->next = itbl_files; + n->name = optarg; + itbl_files = n; + + /* Parse the file and add the new instructions to our internal + table. If multiple instruction tables are specified, the + information from this table gets appended onto the existing + internal table. */ + itbl_files->name = xstrdup (optarg); + if (itbl_parse (itbl_files->name) != 0) + { + fprintf (stderr, "Failed to read instruction table %s\n", + itbl_files->name); + exit (EXIT_SUCCESS); + } + } + break; + case 'J': flag_signed_overflow_ok = 1; break; @@ -446,6 +520,9 @@ { switch (*optarg) { + case 'c': + listing |= LISTING_NOCOND; + break; case 'd': listing |= LISTING_NODEBUG; break; @@ -513,7 +590,6 @@ *pargv = new_argv; } -static void dump_statistics (); static long start_time; int @@ -527,6 +603,7 @@ start_time = get_run_time (); + if (debug_memory) { #ifdef BFD_ASSEMBLER @@ -565,7 +642,7 @@ symbol_begin (); frag_init (); subsegs_begin (); - parse_args (&argc, &argv); + parse_args (&argc, &argv); read_begin (); input_scrub_begin (); expr_begin (); @@ -598,6 +675,8 @@ tc_init_after_args (); #endif + itbl_init (); + /* Now that we have fully initialized, and have created the output file, define any symbols requested by --defsym command line arguments. */ @@ -618,13 +697,14 @@ perform_an_assembly_pass (argc, argv); /* Assemble it. */ + cond_finish_check (); + #ifdef md_end md_end (); #endif if (seen_at_least_1_file () - && !((had_warnings () && flag_always_generate_output) - || had_errors () > 0)) + && (flag_always_generate_output || had_errors () == 0)) keep_it = 1; else keep_it = 0; @@ -643,6 +723,9 @@ output_file_close (out_file_name); #endif + if (had_errors () > 0 && ! flag_always_generate_output) + keep_it = 0; + if (!keep_it) unlink (out_file_name); @@ -652,8 +735,7 @@ /* Use xexit instead of return, because under VMS environments they may not place the same interpretation on the value given. */ - if ((had_warnings () && flag_always_generate_output) - || had_errors () > 0) + if (had_errors () > 0) xexit (EXIT_FAILURE); xexit (EXIT_SUCCESS); } @@ -771,6 +853,10 @@ /* This may add symbol table entries, which requires having an open BFD, and sections already created, in BFD_ASSEMBLER mode. */ md_begin (); + +#ifdef obj_begin + obj_begin (); +#endif argv++; /* skip argv[0] */ argc--; /* skip argv[0] */ diff -urN binutils-2.7/gas/as.h binutils-2.8/gas/as.h --- binutils-2.7/gas/as.h Mon Jul 8 17:49:07 1996 +++ binutils-2.8/gas/as.h Wed Apr 30 12:53:31 1997 @@ -1,5 +1,5 @@ /* as.h - global header file - Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #ifndef GAS #define GAS 1 @@ -79,8 +80,10 @@ #ifdef HAVE_STRING_H #include #else +#ifdef HAVE_STRINGS_H #include #endif +#endif #ifdef HAVE_STDLIB_H #include #endif @@ -133,6 +136,7 @@ #ifdef BFD_ASSEMBLER #include #endif +#include /* Define the standard progress macros. */ #include @@ -145,6 +149,9 @@ #endif /* !__MWERKS__ */ /* Other stuff from config.h. */ +#ifdef NEED_DECLARATION_STRSTR +extern char *strstr (); +#endif #ifdef NEED_DECLARATION_MALLOC extern PTR malloc (); extern PTR realloc (); @@ -156,8 +163,8 @@ extern int errno; #endif -/* This is needed for VMS. */ -#if ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE) +/* This is needed for VMS with DEC C. */ +#if ! defined (__GNUC__) && ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE) #define unlink remove #endif @@ -166,13 +173,6 @@ #define bcopy(src,dest,size) memcpy(dest,src,size) #endif -#ifdef BFD_ASSEMBLER -/* This one doesn't get declared, but we're using it anyways. This - should be fixed -- either it's part of the external interface or - it's not. */ -extern PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t sz)); -#endif - /* Make Saber happier on obstack.h. */ #ifdef SABER #undef __PTR_TO_INT @@ -212,11 +212,6 @@ as_fatal("Case value %ld unexpected at line %d of file \"%s\"\n", \ (long) val, __LINE__, __FILE__); \ } - -/* Version 2.1 of Solaris had problems with this declaration, but I - think that bug has since been fixed. If it causes problems on your - system, just delete it. */ -extern char *strstr (); #include "flonum.h" @@ -348,11 +343,17 @@ constant length frag. */ rs_fill = 1, - /* Align: Fr_offset: power of 2. Variable chars: fill pattern. */ + /* Align. The fr_offset field holds the power of 2 to which to + align. The fr_var field holds the number of characters in the + fill pattern. The fr_subtype field holds the maximum number of + bytes to skip when aligning, or 0 if there is no maximum. */ rs_align, - /* Align code: fr_offset: power of 2. Fill pattern is machine - specific, defaulting to all zeros. */ + /* Align code. The fr_offset field holds the power of 2 to which + to align. This type is only generated by machine specific + code, which is normally responsible for handling the fill + pattern. The fr_subtype field holds the maximum number of + bytes to skip when aligning, or 0 if there is no maximum. */ rs_align_code, /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill @@ -428,14 +429,22 @@ relax_stateT fr_type; relax_substateT fr_subtype; - /* These are needed only on the NS32K machines. But since we don't - include targ-cpu.h until after this structure has been defined, - we can't really conditionalize it. This code should be - rearranged a bit to make that possible. - - In the meantime, if we get stuck like this with any other target, - create a union here. */ - char fr_pcrel_adjust, fr_bsr; + union { + /* These are needed only on the NS32K machines. But since we don't + include targ-cpu.h until after this structure has been defined, + we can't really conditionalize it. This code should be + rearranged a bit to make that possible. */ + struct { + char pcrel_adjust, bsr; + } ns32k; +#ifdef USING_CGEN + /* Don't include this unless using CGEN to keep frag size down. */ + struct { + const struct cgen_insn *insn; + unsigned char opindex, opinfo; + } cgen; +#endif + } fr_targ; /* Where the frag was created, or where it became a variant frag. */ char *fr_file; @@ -455,7 +464,7 @@ included in frchain_now. The fr_fix field is bogus; instead, use: obstack_next_free(&frags)-frag_now->fr_literal. */ COMMON fragS *frag_now; -extern int frag_now_fix (); +extern int frag_now_fix PARAMS ((void)); /* For foreign-segment symbol fixups. */ COMMON fragS zero_address_frag; @@ -498,6 +507,9 @@ /* name of emitted object file */ COMMON char *out_file_name; +/* name of file defining extensions to the basic instruction set */ +COMMON char *insttbl_file_name; + /* TRUE if we need a second pass. */ COMMON int need_pass_2; @@ -541,7 +553,7 @@ #endif #ifdef USE_STDARG -#if __GNUC__ >= 2 +#if (__GNUC__ >= 2) && !defined(VMS) /* for use with -Wformat */ #define PRINTF_LIKE(FCN) void FCN (const char *format, ...) \ __attribute__ ((format (printf, 1, 2))) @@ -580,13 +592,12 @@ char *input_scrub_include_file PARAMS ((char *filename, char *position)); char *input_scrub_new_file PARAMS ((char *filename)); char *input_scrub_next_buffer PARAMS ((char **bufp)); -PTR xmalloc PARAMS ((unsigned long size)); -PTR xrealloc PARAMS ((PTR ptr, unsigned long n)); int do_scrub_chars PARAMS ((int (*get) (char **), char *to, int tolen)); int gen_to_words PARAMS ((LITTLENUM_TYPE * words, int precision, long exponent_bits)); int had_err PARAMS ((void)); int ignore_input PARAMS ((void)); +void cond_finish_check PARAMS ((void)); int seen_at_least_1_file PARAMS ((void)); void app_pop PARAMS ((char *arg)); void as_howmuch PARAMS ((FILE * stream)); diff -urN binutils-2.7/gas/cgen.c binutils-2.8/gas/cgen.c --- binutils-2.7/gas/cgen.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/cgen.c Wed Apr 30 12:53:31 1997 @@ -0,0 +1,527 @@ +/* GAS interface for targets using CGEN: Cpu tools GENerator. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + +This file is part of GAS, the GNU Assembler. + +GAS is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GAS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GAS; see the file COPYING. If not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "ansidecl.h" +#include "bfd.h" +#include "cgen-opc.h" +#include "as.h" +#include "subsegs.h" + +/* Callback to insert a register into the symbol table. + A target may choose to let GAS parse the registers. + ??? Not currently used. */ + +void +cgen_asm_record_register (name, number) + char *name; + int number; +{ + /* Use symbol_create here instead of symbol_new so we don't try to + output registers into the object file's symbol table. */ + symbol_table_insert (symbol_create (name, reg_section, + number, &zero_address_frag)); +} + +/* We need to keep a list of fixups. We can't simply generate them as + we go, because that would require us to first create the frag, and + that would screw up references to ``.''. + + This is used by cpu's with simple operands. It keeps knowledge of what + an `expressionS' is and what a `fixup' is out of CGEN which for the time + being is preferable. + + OPINDEX is the index in the operand table. + OPINFO is something the caller chooses to help in reloc determination. */ + +struct fixup +{ + int opindex; + int opinfo; + expressionS exp; +}; + +#define MAX_FIXUPS 5 + +static struct fixup fixups[MAX_FIXUPS]; +static int num_fixups; + +/* Prepare to parse an instruction. + ??? May wish to make this static and delete calls in md_assemble. */ + +void +cgen_asm_init_parse () +{ + num_fixups = 0; +} + +/* Queue a fixup. */ + +void +cgen_queue_fixup (opindex, opinfo, expP) + int opindex; + expressionS *expP; +{ + /* We need to generate a fixup for this expression. */ + if (num_fixups >= MAX_FIXUPS) + as_fatal ("too many fixups"); + fixups[num_fixups].exp = *expP; + fixups[num_fixups].opindex = opindex; + fixups[num_fixups].opinfo = opinfo; + ++num_fixups; +} + +/* Default routine to record a fixup. + This is a cover function to fix_new. + It exists because we record INSN with the fixup. + + FRAG and WHERE are their respective arguments to fix_new_exp. + LENGTH is in bits. + OPINFO is something the caller chooses to help in reloc determination. + + At this point we do not use a bfd_reloc_code_real_type for + operands residing in the insn, but instead just use the + operand index. This lets us easily handle fixups for any + operand type. We pick a BFD reloc type in md_apply_fix. */ + +fixS * +cgen_record_fixup (frag, where, insn, length, operand, opinfo, symbol, offset) + fragS *frag; + int where; + const struct cgen_insn *insn; + int length; + const struct cgen_operand *operand; + int opinfo; + symbolS *symbol; + offsetT offset; +{ + fixS *fixP; + + /* It may seem strange to use operand->attrs and not insn->attrs here, + but it is the operand that has a pc relative relocation. */ + + fixP = fix_new (frag, where, length / 8, symbol, offset, + CGEN_OPERAND_ATTR (operand, CGEN_OPERAND_PCREL_ADDR) != 0, + (bfd_reloc_code_real_type) ((int) BFD_RELOC_UNUSED + CGEN_OPERAND_INDEX (operand))); + fixP->tc_fix_data.insn = (PTR) insn; + fixP->tc_fix_data.opinfo = opinfo; + + return fixP; +} + +/* Default routine to record a fixup given an expression. + This is a cover function to fix_new_exp. + It exists because we record INSN with the fixup. + + FRAG and WHERE are their respective arguments to fix_new_exp. + LENGTH is in bits. + OPINFO is something the caller chooses to help in reloc determination. + + At this point we do not use a bfd_reloc_code_real_type for + operands residing in the insn, but instead just use the + operand index. This lets us easily handle fixups for any + operand type. We pick a BFD reloc type in md_apply_fix. */ + +fixS * +cgen_record_fixup_exp (frag, where, insn, length, operand, opinfo, exp) + fragS *frag; + int where; + const struct cgen_insn *insn; + int length; + const struct cgen_operand *operand; + int opinfo; + expressionS *exp; +{ + fixS *fixP; + + /* It may seem strange to use operand->attrs and not insn->attrs here, + but it is the operand that has a pc relative relocation. */ + + fixP = fix_new_exp (frag, where, length / 8, exp, + CGEN_OPERAND_ATTR (operand, CGEN_OPERAND_PCREL_ADDR) != 0, + (bfd_reloc_code_real_type) ((int) BFD_RELOC_UNUSED + CGEN_OPERAND_INDEX (operand))); + fixP->tc_fix_data.insn = (PTR) insn; + fixP->tc_fix_data.opinfo = opinfo; + + return fixP; +} + +/* Callback for cgen interface. Parse the expression at *STRP. + The result is an error message or NULL for success (in which case + *STRP is advanced past the parsed text). + WANT is an indication of what the caller is looking for. + If WANT == CGEN_ASM_PARSE_INIT the caller is beginning to try to match + a table entry with the insn, reset the queued fixups counter. + An enum cgen_parse_operand_result is stored in RESULTP. + OPINDEX is the operand's table entry index. + OPINFO is something the caller chooses to help in reloc determination. + The resulting value is stored in VALUEP. */ + +const char * +cgen_parse_operand (want, strP, opindex, opinfo, resultP, valueP) + enum cgen_parse_operand_type want; + const char **strP; + int opindex; + int opinfo; + enum cgen_parse_operand_result *resultP; + bfd_vma *valueP; +{ + char *hold; + const char *errmsg = NULL; + expressionS exp; + + if (want == CGEN_PARSE_OPERAND_INIT) + { + cgen_asm_init_parse (); + return NULL; + } + + hold = input_line_pointer; + input_line_pointer = (char *) *strP; + expression (&exp); + *strP = input_line_pointer; + input_line_pointer = hold; + + /* FIXME: Need to check `want'. */ + + switch (exp.X_op) + { + case O_illegal : + errmsg = "illegal operand"; + *resultP = CGEN_PARSE_OPERAND_RESULT_ERROR; + break; + case O_absent : + errmsg = "missing operand"; + *resultP = CGEN_PARSE_OPERAND_RESULT_ERROR; + break; + case O_constant : + *valueP = exp.X_add_number; + *resultP = CGEN_PARSE_OPERAND_RESULT_NUMBER; + break; + case O_register : + *valueP = exp.X_add_number; + *resultP = CGEN_PARSE_OPERAND_RESULT_REGISTER; + break; + default : + cgen_queue_fixup (opindex, opinfo, &exp); + *valueP = 0; + *resultP = CGEN_PARSE_OPERAND_RESULT_QUEUED; + break; + } + + return errmsg; +} + +/* Finish assembling instruction INSN. + BUF contains what we've built up so far. + LENGTH is the size of the insn in bits. */ + +void +cgen_asm_finish_insn (insn, buf, length) + const struct cgen_insn *insn; + cgen_insn_t *buf; + unsigned int length; +{ + int i, relax_operand; + char *f; + unsigned int byte_len = length / 8; + + /* ??? Target foo issues various warnings here, so one might want to provide + a hook here. However, our caller is defined in tc-foo.c so there + shouldn't be a need for a hook. */ + + /* Write out the instruction. + It is important to fetch enough space in one call to `frag_more'. + We use (f - frag_now->fr_literal) to compute where we are and we + don't want frag_now to change between calls. + + Relaxable instructions: We need to ensure we allocate enough + space for the largest insn. */ + + if (CGEN_INSN_ATTR (insn, CGEN_INSN_RELAX) != 0) + abort (); /* These currently shouldn't get here. */ + + /* Is there a relaxable insn with the relaxable operand needing a fixup? */ + + relax_operand = -1; + if (CGEN_INSN_ATTR (insn, CGEN_INSN_RELAXABLE) != 0) + { + /* Scan the fixups for the operand affected by relaxing + (i.e. the branch address). */ + + for (i = 0; i < num_fixups; ++i) + { + if (CGEN_OPERAND_ATTR (& CGEN_SYM (operand_table) [fixups[i].opindex], + CGEN_OPERAND_RELAX) != 0) + { + relax_operand = i; + break; + } + } + } + + if (relax_operand != -1) + { + int max_len; + fragS *old_frag; + +#ifdef TC_CGEN_MAX_RELAX + max_len = TC_CGEN_MAX_RELAX (insn, byte_len); +#else + max_len = CGEN_MAX_INSN_SIZE; +#endif + /* Ensure variable part and fixed part are in same fragment. */ + /* FIXME: Having to do this seems like a hack. */ + frag_grow (max_len); + /* Allocate space for the fixed part. */ + f = frag_more (byte_len); + /* Create a relaxable fragment for this instruction. */ + old_frag = frag_now; + frag_var (rs_machine_dependent, + max_len - byte_len /* max chars */, + 0 /* variable part already allocated */, + /* FIXME: When we machine generate the relax table, + machine generate a macro to compute subtype. */ + 1 /* subtype */, + fixups[relax_operand].exp.X_add_symbol, + fixups[relax_operand].exp.X_add_number, + f); + /* Record the operand number with the fragment so md_convert_frag + can use cgen_md_record_fixup to record the appropriate reloc. */ + /* FIXME: fr_targ.cgen is used pending deciding whether to + allow a target to add members to fragS. For more info + see the comment above fr_targ in as.h. */ + old_frag->fr_targ.cgen.insn = insn; + old_frag->fr_targ.cgen.opindex = fixups[relax_operand].opindex; + old_frag->fr_targ.cgen.opinfo = fixups[relax_operand].opinfo; + } + else + f = frag_more (byte_len); + + /* If we're recording insns as numbers (rather than a string of bytes), + target byte order handling is deferred until now. */ +#if 0 /*def CGEN_INT_INSN*/ + switch (length) + { + case 16: + if (cgen_big_endian_p) + bfd_putb16 ((bfd_vma) *buf, f); + else + bfd_putl16 ((bfd_vma) *buf, f); + break; + case 32: + if (cgen_big_endian_p) + bfd_putb32 ((bfd_vma) *buf, f); + else + bfd_putl32 ((bfd_vma) *buf, f); + break; + default: + abort (); + } +#else + memcpy (f, buf, byte_len); +#endif + + /* Create any fixups. */ + for (i = 0; i < num_fixups; ++i) + { + /* Don't create fixups for these. That's done during relaxation. + We don't need to test for CGEN_INSN_RELAX as they can't get here + (see above). */ + if (CGEN_INSN_ATTR (insn, CGEN_INSN_RELAXABLE) != 0 + && CGEN_OPERAND_ATTR (& CGEN_SYM (operand_table) [fixups[i].opindex], + CGEN_OPERAND_RELAX) != 0) + continue; + +#ifndef md_cgen_record_fixup_exp +#define md_cgen_record_fixup_exp cgen_record_fixup_exp +#endif + + md_cgen_record_fixup_exp (frag_now, f - frag_now->fr_literal, + insn, length, + & CGEN_SYM (operand_table) [fixups[i].opindex], + fixups[i].opinfo, + &fixups[i].exp); + } +} + +/* Apply a fixup to the object code. This is called for all the + fixups we generated by the call to fix_new_exp, above. In the call + above we used a reloc code which was the largest legal reloc code + plus the operand index. Here we undo that to recover the operand + index. At this point all symbol values should be fully resolved, + and we attempt to completely resolve the reloc. If we can not do + that, we determine the correct reloc code and put it back in the fixup. */ + +/* FIXME: This function handles some of the fixups and bfd_install_relocation + handles the rest. bfd_install_relocation (or some other bfd function) + should handle them all. */ + +int +cgen_md_apply_fix3 (fixP, valueP, seg) + fixS *fixP; + valueT *valueP; + segT seg; +{ + char *where = fixP->fx_frag->fr_literal + fixP->fx_where; + valueT value; + + /* FIXME FIXME FIXME: The value we are passed in *valuep includes + the symbol values. Since we are using BFD_ASSEMBLER, if we are + doing this relocation the code in write.c is going to call + bfd_install_relocation, which is also going to use the symbol + value. That means that if the reloc is fully resolved we want to + use *valuep since bfd_install_relocation is not being used. + However, if the reloc is not fully resolved we do not want to use + *valuep, and must use fx_offset instead. However, if the reloc + is PC relative, we do want to use *valuep since it includes the + result of md_pcrel_from. This is confusing. */ + + if (fixP->fx_addsy == (symbolS *) NULL) + { + value = *valueP; + fixP->fx_done = 1; + } + else if (fixP->fx_pcrel) + value = *valueP; + else + { + value = fixP->fx_offset; + if (fixP->fx_subsy != (symbolS *) NULL) + { + if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section) + value -= S_GET_VALUE (fixP->fx_subsy); + else + { + /* We don't actually support subtracting a symbol. */ + as_bad_where (fixP->fx_file, fixP->fx_line, + "expression too complex"); + } + } + } + + if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) + { + int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; + const struct cgen_operand *operand = & CGEN_SYM (operand_table) [opindex]; + const char *errmsg; + bfd_reloc_code_real_type reloc_type; + struct cgen_fields fields; + const struct cgen_insn *insn = (struct cgen_insn *) fixP->tc_fix_data.insn; + + /* If the reloc has been fully resolved finish the operand here. */ + /* FIXME: This duplicates the capabilities of code in BFD. */ + if (fixP->fx_done + /* FIXME: If partial_inplace isn't set bfd_install_relocation won't + finish the job. Testing for pcrel is a temporary hack. */ + || fixP->fx_pcrel) + { + /* This may seem like overkill, and using bfd_install_relocation or + some such may be preferable, but this is simple. */ + CGEN_FIELDS_BITSIZE (&fields) = CGEN_INSN_BITSIZE (insn); + CGEN_SYM (set_operand) (opindex, &value, &fields); + errmsg = CGEN_SYM (validate_operand) (opindex, &fields); + if (errmsg) + as_warn_where (fixP->fx_file, fixP->fx_line, "%s\n", errmsg); + CGEN_SYM (insert_operand) (opindex, &fields, where); + } + + if (fixP->fx_done) + return 1; + + /* The operand isn't fully resolved. Determine a BFD reloc value + based on the operand information and leave it to + bfd_install_relocation. Note that this doesn't work when + partial_inplace == false. */ + + reloc_type = CGEN_SYM (lookup_reloc) (insn, operand, fixP); + if (reloc_type != BFD_RELOC_NONE) + { + fixP->fx_r_type = reloc_type; + } + else + { + as_bad_where (fixP->fx_file, fixP->fx_line, + "unresolved expression that must be resolved"); + fixP->fx_done = 1; + return 1; + } + } + else if (fixP->fx_done) + { + /* We're finished with this fixup. Install it because + bfd_install_relocation won't be called to do it. */ + switch (fixP->fx_r_type) + { + case BFD_RELOC_8: + md_number_to_chars (where, value, 1); + break; + case BFD_RELOC_16: + md_number_to_chars (where, value, 2); + break; + case BFD_RELOC_32: + md_number_to_chars (where, value, 4); + break; + /* FIXME: later add support for 64 bits. */ + default: + abort (); + } + } + else + { + /* bfd_install_relocation will be called to finish things up. */ + } + + /* Tuck `value' away for use by tc_gen_reloc. + See the comment describing fx_addnumber in write.h. + This field is misnamed (or misused :-). */ + fixP->fx_addnumber = value; + + return 1; +} + +/* Translate internal representation of relocation info to BFD target format. + + FIXME: To what extent can we get all relevant targets to use this? */ + +arelent * +cgen_tc_gen_reloc (section, fixP) + asection *section; + fixS *fixP; +{ + arelent *reloc; + + reloc = (arelent *) bfd_alloc (stdoutput, sizeof (arelent)); + + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type); + if (reloc->howto == (reloc_howto_type *) NULL) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + "internal error: can't export reloc type %d (`%s')", + fixP->fx_r_type, bfd_get_reloc_code_name (fixP->fx_r_type)); + return NULL; + } + + assert (!fixP->fx_pcrel == !reloc->howto->pc_relative); + + reloc->sym_ptr_ptr = &fixP->fx_addsy->bsym; + reloc->address = fixP->fx_frag->fr_address + fixP->fx_where; + reloc->addend = fixP->fx_addnumber; + + return reloc; +} diff -urN binutils-2.7/gas/cond.c binutils-2.8/gas/cond.c --- binutils-2.7/gas/cond.c Thu Jul 4 12:12:47 1996 +++ binutils-2.8/gas/cond.c Wed Apr 30 12:53:31 1997 @@ -1,5 +1,5 @@ /* cond.c - conditional assembly pseudo-ops, and .include - Copyright (C) 1990, 91, 92, 93, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #include "as.h" @@ -28,18 +29,26 @@ { char *file; unsigned int line; -}; /* file_line */ +}; + +/* We push one of these structures for each .if, and pop it at the + .endif. */ -/* This is what we push and pop. */ struct conditional_frame - { - struct file_line if_file_line; /* the source file & line number of the "if" */ - struct file_line else_file_line; /* the source file & line of the "else" */ - struct conditional_frame *previous_cframe; - int else_seen; /* have we seen an else yet? */ - int ignoring; /* if we are currently ignoring input. */ - int dead_tree; /* if a conditional at a higher level is ignoring input. */ - }; /* conditional_frame */ +{ + /* The source file & line number of the "if". */ + struct file_line if_file_line; + /* The source file & line of the "else". */ + struct file_line else_file_line; + /* The previous conditional. */ + struct conditional_frame *previous_cframe; + /* Have we seen an else yet? */ + int else_seen; + /* Whether we are currently ignoring input. */ + int ignoring; + /* Whether a conditional at a higher level is ignoring input. */ + int dead_tree; +}; static void initialize_cframe PARAMS ((struct conditional_frame *cframe)); static char *get_mri_string PARAMS ((int, int *)); @@ -76,6 +85,13 @@ current_cframe = ((struct conditional_frame *) obstack_copy (&cond_obstack, &cframe, sizeof (cframe))); + + if (LISTING_SKIP_COND () + && cframe.ignoring + && (cframe.previous_cframe == NULL + || ! cframe.previous_cframe->ignoring)) + listing_list (2); + demand_empty_rest_of_line (); } /* if a valid identifyer name */ } /* s_ifdef() */ @@ -127,6 +143,12 @@ current_cframe = ((struct conditional_frame *) obstack_copy (&cond_obstack, &cframe, sizeof (cframe))); + if (LISTING_SKIP_COND () + && cframe.ignoring + && (cframe.previous_cframe == NULL + || ! cframe.previous_cframe->ignoring)) + listing_list (2); + if (flag_mri) mri_comment_end (stop, stopc); @@ -181,11 +203,16 @@ s_ifc (arg) int arg; { + char *stop = NULL; + char stopc; char *s1, *s2; int len1, len2; int res; struct conditional_frame cframe; + if (flag_mri) + stop = mri_comment_field (&stopc); + s1 = get_mri_string (',', &len1); if (*input_line_pointer != ',') @@ -201,6 +228,15 @@ cframe.ignoring = cframe.dead_tree || ! (res ^ arg); current_cframe = ((struct conditional_frame *) obstack_copy (&cond_obstack, &cframe, sizeof (cframe))); + + if (LISTING_SKIP_COND () + && cframe.ignoring + && (cframe.previous_cframe == NULL + || ! cframe.previous_cframe->ignoring)) + listing_list (2); + + if (flag_mri) + mri_comment_end (stop, stopc); } void @@ -215,6 +251,12 @@ } else { + if (LISTING_SKIP_COND () + && current_cframe->ignoring + && (current_cframe->previous_cframe == NULL + || ! current_cframe->previous_cframe->ignoring)) + listing_list (1); + hold = current_cframe; current_cframe = current_cframe->previous_cframe; obstack_free (&cond_obstack, hold); @@ -256,6 +298,9 @@ if (!current_cframe->dead_tree) { current_cframe->ignoring = !current_cframe->ignoring; + if (LISTING_SKIP_COND () + && ! current_cframe->ignoring) + listing_list (1); } /* if not a dead tree */ current_cframe->else_seen = 1; @@ -300,6 +345,12 @@ current_cframe = ((struct conditional_frame *) obstack_copy (&cond_obstack, &cframe, sizeof (cframe))); + if (LISTING_SKIP_COND () + && cframe.ignoring + && (cframe.previous_cframe == NULL + || ! cframe.previous_cframe->ignoring)) + listing_list (2); + demand_empty_rest_of_line (); } /* s_ifeqs() */ @@ -350,15 +401,22 @@ &cframe->if_file_line.line); cframe->previous_cframe = current_cframe; cframe->dead_tree = current_cframe != NULL && current_cframe->ignoring; +} - return; -} /* initialize_cframe() */ - -/* - * Local Variables: - * fill-column: 131 - * comment-column: 0 - * End: - */ +void +cond_finish_check () +{ + if (current_cframe != NULL) + { + as_bad ("end of file inside conditional"); + as_bad_where (current_cframe->if_file_line.file, + current_cframe->if_file_line.line, + "here is the start of the unterminated conditional"); + if (current_cframe->else_seen) + as_bad_where (current_cframe->else_file_line.file, + current_cframe->else_file_line.line, + "here is the \"else\" of the unterminated conditional"); + } +} /* end of cond.c */ diff -urN binutils-2.7/gas/conf.in binutils-2.8/gas/conf.in --- binutils-2.7/gas/conf.in Thu Jul 4 12:12:47 1996 +++ binutils-2.8/gas/conf.in Wed Apr 30 12:53:31 1997 @@ -19,9 +19,9 @@ /* 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 + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION @@ -44,12 +44,18 @@ #undef TARGET_OS #undef TARGET_VENDOR +/* Sometimes the system header files don't declare strstr. */ +#undef NEED_DECLARATION_STRSTR + /* Sometimes the system header files don't declare malloc and realloc. */ #undef NEED_DECLARATION_MALLOC /* Sometimes the system header files don't declare free. */ #undef NEED_DECLARATION_FREE +/* Sometimes the system header files don't declare sbrk. */ +#undef NEED_DECLARATION_SBRK + /* Sometimes errno.h doesn't declare errno itself. */ #undef NEED_DECLARATION_ERRNO @@ -58,6 +64,9 @@ /* Needed only for sparc configuration. */ #undef SPARC_V9 #undef SPARC_ARCH64 + +/* Defined if using CGEN. */ +#undef USING_CGEN /* Needed only for some configurations that can produce multiple output formats. */ diff -urN binutils-2.7/gas/config/arm-big.mt binutils-2.8/gas/config/arm-big.mt --- binutils-2.7/gas/config/arm-big.mt Thu Jul 4 12:13:23 1996 +++ binutils-2.8/gas/config/arm-big.mt Wed Apr 30 12:53:11 1997 @@ -1 +1 @@ -TDEFINES=-DTARGET_BYTES_BIG_ENDIAN +TDEFINES=-DTARGET_BYTES_BIG_ENDIAN=1 diff -urN binutils-2.7/gas/config/arm-lit.mt binutils-2.8/gas/config/arm-lit.mt --- binutils-2.7/gas/config/arm-lit.mt Thu Jul 4 12:13:23 1996 +++ binutils-2.8/gas/config/arm-lit.mt Wed Apr 30 12:53:11 1997 @@ -1 +1 @@ -TDEFINES=-DTARGET_BYTES_LITTLE_ENDIAN +TDEFINES=-DTARGET_BYTES_BIG_ENDIAN=0 diff -urN binutils-2.7/gas/config/atof-ieee.c binutils-2.8/gas/config/atof-ieee.c --- binutils-2.7/gas/config/atof-ieee.c Thu Jul 4 12:13:24 1996 +++ binutils-2.8/gas/config/atof-ieee.c Wed Apr 30 12:53:11 1997 @@ -1,5 +1,5 @@ /* atof_ieee.c - turn a Flonum into an IEEE floating point number - Copyright (C) 1987, 1992 Free Software Foundation, Inc. + Copyright (C) 1987, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,16 +14,18 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #include "as.h" -extern FLONUM_TYPE generic_floating_point_number; /* Flonums returned here. */ +/* Flonums returned here. */ +extern FLONUM_TYPE generic_floating_point_number; -#ifndef NULL -#define NULL (0) -#endif +static int next_bits PARAMS ((int)); +static void unget_bits PARAMS ((int)); +static void make_invalid_floating_point_number PARAMS ((LITTLENUM_TYPE *)); extern const char EXP_CHARS[]; /* Precision in LittleNums. */ diff -urN binutils-2.7/gas/config/atof-vax.c binutils-2.8/gas/config/atof-vax.c --- binutils-2.7/gas/config/atof-vax.c Thu Jul 4 12:13:24 1996 +++ binutils-2.8/gas/config/atof-vax.c Wed Apr 30 12:53:11 1997 @@ -1,5 +1,5 @@ /* atof_vax.c - turn a Flonum into a VAX floating point number - Copyright (C) 1987, 1992 Free Software Foundation, Inc. + Copyright (C) 1987, 1992, 93, 95, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,11 +14,18 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #include "as.h" +static int atof_vax_sizeof PARAMS ((int)); +static int next_bits PARAMS ((int)); +static void make_invalid_floating_point_number PARAMS ((LITTLENUM_TYPE *)); +static int what_kind_of_float PARAMS ((int, int *, long *)); +static char *atof_vax PARAMS ((char *, int, LITTLENUM_TYPE *)); + /* Precision in LittleNums. */ #define MAX_PRECISION (8) #define H_PRECISION (8) @@ -33,9 +40,9 @@ LITTLENUM_TYPE * words)); /* Number of chars in flonum type 'letter'. */ -int +static int atof_vax_sizeof (letter) - char letter; + int letter; { int return_value; @@ -148,7 +155,7 @@ static int /* 0 means letter is OK. */ what_kind_of_float (letter, precisionP, exponent_bitsP) - char letter; /* In: lowercase please. What kind of float? */ + int letter; /* In: lowercase please. What kind of float? */ int *precisionP; /* Number of 16-bit words in the float. */ long *exponent_bitsP; /* Number of exponent bits. */ { @@ -193,10 +200,10 @@ * * \***********************************************************************/ -char * /* Return pointer past text consumed. */ +static char * /* Return pointer past text consumed. */ atof_vax (str, what_kind, words) char *str; /* Text to convert to binary. */ - char what_kind; /* 'd', 'f', 'g', 'h' */ + int what_kind; /* 'd', 'f', 'g', 'h' */ LITTLENUM_TYPE *words; /* Build the binary here. */ { FLONUM_TYPE f; @@ -442,7 +449,7 @@ char * md_atof (what_statement_type, literalP, sizeP) - char what_statement_type; + int what_statement_type; char *literalP; int *sizeP; { diff -urN binutils-2.7/gas/config/e-i386coff.c binutils-2.8/gas/config/e-i386coff.c --- binutils-2.7/gas/config/e-i386coff.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/e-i386coff.c Wed Apr 30 12:53:11 1997 @@ -0,0 +1,17 @@ +#include "as.h" +#include "emul.h" + +static const char * +i386coff_bfd_name () +{ + abort (); + return NULL; +} + +#define emul_bfd_name i386coff_bfd_name +#define emul_format &coff_format_ops + +#define emul_name "i386coff" +#define emul_struct_name i386coff +#define emul_default_endian 0 +#include "emul-target.h" diff -urN binutils-2.7/gas/config/e-i386elf.c binutils-2.8/gas/config/e-i386elf.c --- binutils-2.7/gas/config/e-i386elf.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/e-i386elf.c Wed Apr 30 12:53:11 1997 @@ -0,0 +1,17 @@ +#include "as.h" +#include "emul.h" + +static const char * +i386elf_bfd_name () +{ + abort (); + return NULL; +} + +#define emul_bfd_name i386elf_bfd_name +#define emul_format &elf_format_ops + +#define emul_name "i386elf" +#define emul_struct_name i386elf +#define emul_default_endian 0 +#include "emul-target.h" diff -urN binutils-2.7/gas/config/e-mipsecoff.c binutils-2.8/gas/config/e-mipsecoff.c --- binutils-2.7/gas/config/e-mipsecoff.c Thu Jul 4 12:13:24 1996 +++ binutils-2.8/gas/config/e-mipsecoff.c Wed Apr 30 12:53:11 1997 @@ -1,6 +1,8 @@ #include "as.h" #include "emul.h" +static const char *mipsecoff_bfd_name PARAMS ((void)); + static const char * mipsecoff_bfd_name () { diff -urN binutils-2.7/gas/config/e-mipself.c binutils-2.8/gas/config/e-mipself.c --- binutils-2.7/gas/config/e-mipself.c Thu Jul 4 12:13:24 1996 +++ binutils-2.8/gas/config/e-mipself.c Wed Apr 30 12:53:11 1997 @@ -1,6 +1,8 @@ #include "as.h" #include "emul.h" +static const char *mipself_bfd_name PARAMS ((void)); + static const char * mipself_bfd_name () { diff -urN binutils-2.7/gas/config/itbl-mips.h binutils-2.8/gas/config/itbl-mips.h --- binutils-2.7/gas/config/itbl-mips.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/itbl-mips.h Wed Apr 30 12:53:11 1997 @@ -0,0 +1,47 @@ + +/* itbl-mips.h + + Copyright (C) 1997 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* Defines for Mips itbl cop support */ + +#include "opcode/mips.h" + +/* Values for processors will be from 0 to NUMBER_OF_PROCESSORS-1 */ +#define NUMBER_OF_PROCESSORS 4 +#define MAX_BITPOS 31 + +/* Mips specifics */ +#define MIPS_OPCODE_COP0 (0x21) /* COPz+CO, bits 31-25: 0100zz1 */ +#define MIPS_ENCODE_COP_NUM(z) ((MIPS_OPCODE_COP0|z<<1)<<25) +#define MIPS_IS_COP_INSN(insn) ((MIPS_OPCODE_COP0&(insn>>25)) \ + == MIPS_OPCODE_COP0) +#define MIPS_DECODE_COP_NUM(insn) ((~MIPS_OPCODE_COP0&(insn>>25))>>1) +#define MIPS_DECODE_COP_COFUN(insn) ((~MIPS_ENCODE_COP_NUM(3))&(insn)) + +/* definitions required by generic code */ +#define ITBL_IS_INSN(insn) MIPS_IS_COP_INSN(insn) +#define ITBL_DECODE_PNUM(insn) MIPS_DECODE_COP_NUM(insn) +#define ITBL_ENCODE_PNUM(pnum) MIPS_ENCODE_COP_NUM(pnum) + +#define ITBL_OPCODE_STRUCT mips_opcode +#define ITBL_OPCODES mips_opcodes +#define ITBL_NUM_OPCODES NUMOPCODES +#define ITBL_NUM_MACROS M_NUM_MACROS diff -urN binutils-2.7/gas/config/m68k-parse.y binutils-2.8/gas/config/m68k-parse.y --- binutils-2.7/gas/config/m68k-parse.y Thu Jul 4 12:13:25 1996 +++ binutils-2.8/gas/config/m68k-parse.y Wed Apr 30 12:53:12 1997 @@ -1,5 +1,5 @@ /* m68k.y -- bison grammar for m68k operand parsing - Copyright (C) 1995 Free Software Foundation, Inc. + Copyright (C) 1995, 96, 1997 Free Software Foundation, Inc. Written by Ken Raeburn and Ian Lance Taylor, Cygnus Support This file is part of GAS, the GNU Assembler. @@ -82,7 +82,7 @@ /* Internal functions. */ static enum m68k_register m68k_reg_parse PARAMS ((char **)); -static int yylex PARAMS (()); +static int yylex PARAMS ((void)); static void yyerror PARAMS ((const char *)); /* The parser sets fields pointed to by this global variable. */ @@ -259,6 +259,12 @@ op->reg = $5; op->disp = $2; op->index = $4; + } + | '(' zdireg ',' EXPR ')' + { + op->mode = BASE; + op->disp = $4; + op->index = $2; } | EXPR '(' zapc ',' zireg ')' { diff -urN binutils-2.7/gas/config/mips-big.mt binutils-2.8/gas/config/mips-big.mt --- binutils-2.7/gas/config/mips-big.mt Thu Jul 4 12:13:26 1996 +++ binutils-2.8/gas/config/mips-big.mt Wed Apr 30 12:53:12 1997 @@ -1 +1 @@ -TDEFINES=-DTARGET_BYTES_BIG_ENDIAN +TDEFINES=-DTARGET_BYTES_BIG_ENDIAN=1 diff -urN binutils-2.7/gas/config/mips-lit.mt binutils-2.8/gas/config/mips-lit.mt --- binutils-2.7/gas/config/mips-lit.mt Thu Jul 4 12:13:26 1996 +++ binutils-2.8/gas/config/mips-lit.mt Wed Apr 30 12:53:12 1997 @@ -1 +1 @@ -TDEFINES=-DTARGET_BYTES_LITTLE_ENDIAN +TDEFINES=-DTARGET_BYTES_BIG_ENDIAN=0 diff -urN binutils-2.7/gas/config/obj-aout.c binutils-2.8/gas/config/obj-aout.c --- binutils-2.7/gas/config/obj-aout.c Thu Jul 4 12:13:27 1996 +++ binutils-2.8/gas/config/obj-aout.c Wed Apr 30 12:53:12 1997 @@ -64,6 +64,7 @@ static void obj_aout_line PARAMS ((int)); static void obj_aout_weak PARAMS ((int)); +static void obj_aout_type PARAMS ((int)); const pseudo_typeS obj_pseudo_table[] = { @@ -72,6 +73,8 @@ {"weak", obj_aout_weak, 0}, /* mark symbol as weak. */ + {"type", obj_aout_type, 0}, + /* coff debug pseudos (ignored) */ {"def", s_ignore, 0}, {"dim", s_ignore, 0}, @@ -82,7 +85,6 @@ {"scl", s_ignore, 0}, {"size", s_ignore, 0}, {"tag", s_ignore, 0}, - {"type", s_ignore, 0}, {"val", s_ignore, 0}, {"version", s_ignore, 0}, @@ -384,6 +386,45 @@ } while (c == ','); demand_empty_rest_of_line (); +} + +/* Handle .type. On {Net,Open}BSD, this is used to set the n_other field, + which is then apparently used when doing dynamic linking. Older + versions ogas ignored the .type pseudo-op, so we also ignore it if + we can't parse it. */ + +static void +obj_aout_type (ignore) + int ignore; +{ + char *name; + int c; + symbolS *sym; + + name = input_line_pointer; + c = get_symbol_end (); + sym = symbol_find (name); + *input_line_pointer = c; + if (sym != NULL) + { + SKIP_WHITESPACE (); + if (*input_line_pointer == ',') + { + ++input_line_pointer; + SKIP_WHITESPACE (); + if (*input_line_pointer == '@') + { + ++input_line_pointer; + if (strncmp (input_line_pointer, "object", 6) == 0) + S_SET_OTHER (sym, 1); + else if (strncmp (input_line_pointer, "function", 8) == 0) + S_SET_OTHER (sym, 2); + } + } + } + + /* Ignore everything else on the line. */ + s_ignore (0); } void diff -urN binutils-2.7/gas/config/obj-aout.h binutils-2.8/gas/config/obj-aout.h --- binutils-2.7/gas/config/obj-aout.h Thu Jul 4 12:13:27 1996 +++ binutils-2.8/gas/config/obj-aout.h Wed Apr 30 12:53:12 1997 @@ -90,7 +90,8 @@ #define S_IS_EXTERNAL(s) ((s)->sy_symbol.n_type & N_EXT) /* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */ -#define S_IS_DEFINED(s) ((S_GET_TYPE(s) != N_UNDF) || (S_GET_OTHER(s) != 0) || (S_GET_DESC(s) != 0)) +#define S_IS_DEFINED(s) \ + (S_GET_TYPE (s) != N_UNDF || S_GET_DESC (s) != 0) #define S_IS_COMMON(s) \ (S_GET_TYPE (s) == N_UNDF && S_GET_VALUE (s) != 0) diff -urN binutils-2.7/gas/config/obj-coff.c binutils-2.8/gas/config/obj-coff.c --- binutils-2.7/gas/config/obj-coff.c Thu Jul 4 12:13:33 1996 +++ binutils-2.8/gas/config/obj-coff.c Wed Apr 30 12:53:13 1997 @@ -1,5 +1,5 @@ /* coff object file format - Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS. @@ -19,10 +19,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define OBJ_HEADER "obj-coff.h" + #include "as.h" #include "obstack.h" #include "subsegs.h" -#include "libiberty.h" /* I think this is probably always correct. */ #ifndef KEEP_RELOC_INFO @@ -328,14 +329,14 @@ void -obj_symbol_new_hook (symbolP) +coff_obj_symbol_new_hook (symbolP) symbolS *symbolP; { char underscore = 0; /* Symbol has leading _ */ { long sz = (OBJ_COFF_MAX_AUXENTRIES + 1) * sizeof (combined_entry_type); - char *s = (char *) bfd_alloc_by_size_t (stdoutput, sz); + char *s = (char *) xmalloc (sz); memset (s, 0, sz); coffsymbol (symbolP->bsym)->native = (combined_entry_type *) s; } @@ -365,8 +366,8 @@ int offset; int num; { - struct line_no *new_line = (struct line_no *) bfd_alloc_by_size_t (stdoutput, - sizeof (struct line_no)); + struct line_no *new_line = + (struct line_no *) xmalloc (sizeof (struct line_no)); if (!current_lineno_sym) { abort (); @@ -411,6 +412,9 @@ add_lineno (frag_now, frag_now_fix (), l); } + if (appline) + new_logical_line ((char *) NULL, l - 1); + #ifndef NO_LISTING { extern int listing; @@ -474,6 +478,9 @@ symbol_name_length = strlen (symbol_name); symbol_name_copy = xmalloc (symbol_name_length + 1); strcpy (symbol_name_copy, symbol_name); +#ifdef tc_canonicalize_symbol_name + symbol_name_copy = tc_canonicalize_symbol_name (symbol_name_copy); +#endif /* Initialize the new symbol */ def_symbol_in_progress = symbol_make (symbol_name_copy); @@ -620,11 +627,12 @@ def_symbol_in_progress = symbolP; if (SF_GET_FUNCTION (def_symbol_in_progress) - || SF_GET_TAG (def_symbol_in_progress)) + || SF_GET_TAG (def_symbol_in_progress) + || S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_STAT) { - /* For functions, and tags, the symbol *must* be where the - debug symbol appears. Move the existing symbol to the - current place. */ + /* For functions, and tags, and static symbols, the symbol + *must* be where the debug symbol appears. Move the + existing symbol to the current place. */ /* If it already is at the end of the symbol list, do nothing */ if (def_symbol_in_progress != symbol_lastP) { @@ -785,6 +793,10 @@ symbol_name = input_line_pointer; name_end = get_symbol_end (); +#ifdef tc_canonicalize_symbol_name + symbol_name = tc_canonicalize_symbol_name (symbol_name); +#endif + /* Assume that the symbol referred to by .tag is always defined. This was a bad assumption. I've added find_or_make. xoxorich. */ SA_SET_SYM_TAGNDX (def_symbol_in_progress, @@ -838,6 +850,9 @@ char *symbol_name = input_line_pointer; char name_end = get_symbol_end (); +#ifdef tc_canonicalize_symbol_name + symbol_name = tc_canonicalize_symbol_name (symbol_name); +#endif if (!strcmp (symbol_name, ".")) { def_symbol_in_progress->sy_frag = frag_now; @@ -869,7 +884,7 @@ } void -obj_read_begin_hook () +coff_obj_read_begin_hook () { /* These had better be the same. Usually 18 bytes. */ #ifndef BFD_HEADERS @@ -1034,7 +1049,7 @@ /* We need i entries for line numbers, plus 1 for the first entry which BFD will override, plus 1 for the last zero entry (a marker for BFD). */ - l = (alent *) bfd_alloc_by_size_t (stdoutput, (i + 2) * sizeof (alent)); + l = (alent *) xmalloc ((i + 2) * sizeof (alent)); coffsymbol (symp->bsym)->lineno = l; l[i + 1].line_number = 0; l[i + 1].u.sym = NULL; @@ -1107,6 +1122,7 @@ * 'w' for data * 'd' (apparently m88k for data) * 'x' for text + * 'r' for read-only data * But if the argument is not a quoted string, treat it as a * subsegment number. */ @@ -1163,6 +1179,7 @@ case 'd': case 'w': flags &=~ SEC_READONLY; break; case 'x': flags |= SEC_CODE; break; + case 'r': flags |= SEC_READONLY; break; case 'i': /* STYP_INFO */ case 'l': /* STYP_LIB */ @@ -1487,8 +1504,6 @@ return SEG_INFO_FROM_SECTION_NUMBER (x->sy_symbol.ost_entry.n_scnum).seg_t; } - - /* calculate the size of the frag chain and fill in the section header to contain all of it, also fill in the addr of the sections */ static unsigned int @@ -1524,8 +1539,15 @@ break; case rs_align: case rs_align_code: - size += frag->fr_fix; - size += relax_align (size, frag->fr_offset); + { + addressT off; + + size += frag->fr_fix; + off = relax_align (size, frag->fr_offset); + if (frag->fr_subtype != 0 && off > frag->fr_subtype) + off = 0; + size += off; + } break; default: BAD_CASE (frag->fr_type); @@ -1648,11 +1670,21 @@ while (symbol_ptr->sy_value.X_op == O_symbol && (! S_IS_DEFINED (symbol_ptr) || S_IS_COMMON (symbol_ptr))) - symbol_ptr = symbol_ptr->sy_value.X_add_symbol; + { + symbolS *n; + + /* We must avoid looping, as that can occur + with a badly written program. */ + n = symbol_ptr->sy_value.X_add_symbol; + if (n == symbol_ptr) + break; + symbol_ptr = n; + } /* Turn the segment of the symbol into an offset. */ if (symbol_ptr) { + resolve_symbol_value (symbol_ptr); if (! symbol_ptr->sy_resolved) { char *file; @@ -1970,7 +2002,7 @@ } void -obj_symbol_new_hook (symbolP) +coff_obj_symbol_new_hook (symbolP) symbolS *symbolP; { char underscore = 0; /* Symbol has leading _ */ @@ -2011,6 +2043,10 @@ l = get_absolute_expression (); c_line_new (0, frag_now_fix (), l, frag_now); + + if (appline) + new_logical_line ((char *) NULL, l - 1); + #ifndef NO_LISTING { extern int listing; @@ -2072,6 +2108,9 @@ symbol_name_length = strlen (symbol_name); symbol_name_copy = xmalloc (symbol_name_length + 1); strcpy (symbol_name_copy, symbol_name); +#ifdef tc_canonicalize_symbol_name + symbol_name_copy = tc_canonicalize_symbol_name (symbol_name_copy); +#endif /* Initialize the new symbol */ #ifdef STRIP_UNDERSCORE @@ -2229,11 +2268,12 @@ def_symbol_in_progress = symbolP; if (SF_GET_FUNCTION (def_symbol_in_progress) - || SF_GET_TAG (def_symbol_in_progress)) + || SF_GET_TAG (def_symbol_in_progress) + || S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_STAT) { - /* For functions, and tags, the symbol *must* be where the - debug symbol appears. Move the existing symbol to the - current place. */ + /* For functions, and tags, and static symbols, the symbol + *must* be where the debug symbol appears. Move the + existing symbol to the current place. */ /* If it already is at the end of the symbol list, do nothing */ if (def_symbol_in_progress != symbol_lastP) { @@ -2409,6 +2449,9 @@ S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); symbol_name = input_line_pointer; name_end = get_symbol_end (); +#ifdef tc_canonicalize_symbol_name + symbol_name = tc_canonicalize_symbol_name (symbol_name); +#endif /* Assume that the symbol referred to by .tag is always defined. This was a bad assumption. I've added find_or_make. xoxorich. */ @@ -2463,6 +2506,10 @@ char *symbol_name = input_line_pointer; char name_end = get_symbol_end (); +#ifdef tc_canonicalize_symbol_name + symbol_name = tc_canonicalize_symbol_name (symbol_name); +#endif + if (!strcmp (symbol_name, ".")) { def_symbol_in_progress->sy_frag = frag_now; @@ -2526,7 +2573,7 @@ #endif /* TE_PE */ void -obj_read_begin_hook () +coff_obj_read_begin_hook () { /* These had better be the same. Usually 18 bytes. */ #ifndef BFD_HEADERS @@ -2720,6 +2767,10 @@ } /* no one points at the first .file symbol */ } /* if debug or tag or eos or file */ +#ifdef tc_frob_coff_symbol + tc_frob_coff_symbol (symbolP); +#endif + /* We must put the external symbols apart. The loader does not bomb if we do not. But the references in the endndx field for a .bb symbol are not corrected @@ -2803,9 +2854,8 @@ symbolS **tail; { unsigned int symbol_number = 0; - symbolS *symbolP; - for (symbolP = *head; *head != NULL;) + while (*head != NULL) { symbolS *tmp = *head; @@ -2835,15 +2885,12 @@ tie_tags () { unsigned int symbol_number = 0; - symbolS *symbolP; - for (symbolP = symbol_rootP; symbolP; symbolP = - symbol_next (symbolP)) + + for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) { symbolP->sy_number = symbol_number; - - if (SF_GET_TAGGED (symbolP)) { SA_SET_SYM_TAGNDX @@ -2853,8 +2900,8 @@ symbol_number += 1 + S_GET_NUMBER_AUXILIARY (symbolP); } - return symbol_number; + return symbol_number; } static void @@ -2872,19 +2919,19 @@ * order : * . .file symbol * . debug entries for functions - * . fake symbols for the sections, including.text .data and .bss + * . fake symbols for the sections, including .text .data and .bss * . defined symbols * . undefined symbols * But this is not mandatory. The only important point is to put the * undefined symbols at the end of the list. */ + /* Is there a .file symbol ? If not insert one at the beginning. */ if (symbol_rootP == NULL || S_GET_STORAGE_CLASS (symbol_rootP) != C_FILE) { c_dot_file_symbol ("fake"); } - /* Is there a .file symbol ? If not insert one at the beginning. */ /* * Build up static symbols for the sections, they are filled in later @@ -3100,10 +3147,10 @@ #ifdef md_do_align { static char nop = NOP_OPCODE; - md_do_align (SUB_SEGMENT_ALIGN (now_seg), &nop, 1, alignment_done); + md_do_align (SUB_SEGMENT_ALIGN (now_seg), &nop, 1, 0, alignment_done); } #endif - frag_align (SUB_SEGMENT_ALIGN (now_seg), NOP_OPCODE); + frag_align (SUB_SEGMENT_ALIGN (now_seg), NOP_OPCODE, 0); #ifdef md_do_align alignment_done: #endif @@ -3307,6 +3354,7 @@ * 'w' for data * 'd' (apparently m88k for data) * 'x' for text + * 'r' for read-only data * But if the argument is not a quoted string, treat it as a * subsegment number. */ @@ -3371,6 +3419,7 @@ case 'd': case 'w': flags |= STYP_DATA; break; case 'x': flags |= STYP_TEXT; break; + case 'r': flags |= STYP_LIT; break; default: as_warn("unknown section attribute '%c'", *input_line_pointer); @@ -3551,16 +3600,9 @@ /* Make sure that the symbol is first on the symbol chain */ if (symbol_rootP != symbolP) { - if (symbolP == symbol_lastP) - { - symbol_lastP = symbol_lastP->sy_previous; - } /* if it was the last thing on the list */ - symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); symbol_insert (symbolP, symbol_rootP, &symbol_rootP, &symbol_lastP); - symbol_rootP = symbolP; - } /* if not first on the list */ - + } } /* c_dot_file_symbol() */ /* @@ -3583,6 +3625,11 @@ SF_SET_STATICS (symbolP); +#ifdef TE_DELTA + /* manfred@s-direktnet.de: section symbols *must* have the LOCAL bit cleared, + which is set by the new definition of LOCAL_LABEL in tc-m68k.h. */ + SF_CLEAR_LOCAL (symbolP); +#endif #ifdef TE_PE /* If the .linkonce pseudo-op was used for this section, we must store the information in the auxiliary entry for the section @@ -3728,7 +3775,7 @@ subseg_set (SEG_E2, 1); symbolP->sy_frag = frag_now; p = frag_var(rs_org, 1, 1, (relax_substateT)0, symbolP, - temp, (char *)0); + (offsetT) temp, (char *) 0); *p = 0; subseg_set (current_seg, current_subseg); /* restore current seg */ S_SET_SEGMENT(symbolP, SEG_E2); @@ -3838,6 +3885,41 @@ } #endif + /* Make sure the symbols have been resolved; this may not have + happened if these are expression symbols. */ + if (add_symbolP != NULL && ! add_symbolP->sy_resolved) + resolve_symbol_value (add_symbolP); + + if (add_symbolP != NULL) + { + /* If this fixup is against a symbol which has been equated + to another symbol, convert it to the other symbol. */ + if (add_symbolP->sy_value.X_op == O_symbol + && (! S_IS_DEFINED (add_symbolP) + || S_IS_COMMON (add_symbolP))) + { + while (add_symbolP->sy_value.X_op == O_symbol + && (! S_IS_DEFINED (add_symbolP) + || S_IS_COMMON (add_symbolP))) + { + symbolS *n; + + /* We must avoid looping, as that can occur with a + badly written program. */ + n = add_symbolP->sy_value.X_add_symbol; + if (n == add_symbolP) + break; + add_number += add_symbolP->sy_value.X_add_number; + add_symbolP = n; + } + fixP->fx_addsy = add_symbolP; + fixP->fx_offset = add_number; + } + } + + if (sub_symbolP != NULL && ! sub_symbolP->sy_resolved) + resolve_symbol_value (sub_symbolP); + if (add_symbolP != NULL && add_symbolP->sy_mri_common) { @@ -3970,8 +4052,8 @@ add_number += S_GET_VALUE (add_symbolP); add_number -= md_pcrel_from (fixP); #if defined (TC_I386) || defined (TE_LYNX) - /* On the 386 we must adjust by the segment - vaddr as well. Ian Taylor. */ + /* On the 386 we must adjust by the segment vaddr as + well. Ian Taylor. */ add_number -= segP->scnhdr.s_vaddr; #endif pcrel = 0; /* Lie. Don't want further pcrel processing. */ @@ -4027,11 +4109,15 @@ continue; } /* COBR */ #endif /* TC_I960 */ -#if (defined (TC_I386) || defined (TE_LYNX) || defined (TE_AUX)) && !defined(TE_PE) +#if ((defined (TC_I386) || defined (TE_LYNX) || defined (TE_AUX)) && !defined(TE_PE)) || defined (COFF_COMMON_ADDEND) /* 386 COFF uses a peculiar format in which the value of a common symbol is stored in the .text segment (I've checked this on SVR3.2 and SCO 3.2.2) Ian Taylor . */ + /* This is also true for 68k COFF on sysv machines + (Checked on Motorola sysv68 R3V6 and R3V7.1, and also on + UNIX System V/M68000, Release 1.0 from ATT/Bell Labs) + Philippe De Muyter . */ if (S_IS_COMMON (add_symbolP)) add_number += S_GET_VALUE (add_symbolP); #endif @@ -4053,24 +4139,42 @@ { fixP->fx_addsy = &abs_symbol; } /* if there's an add_symbol */ -#if defined (TC_I386) || defined (TE_LYNX) - /* On the 386 we must adjust by the segment vaddr - as well. Ian Taylor. */ +#if defined (TC_I386) || defined (TE_LYNX) || defined (TC_I960) || defined (TC_M68K) + /* On the 386 we must adjust by the segment vaddr as well. + Ian Taylor. + + I changed the i960 to work this way as well. This is + compatible with the current GNU linker behaviour. I do + not know what other i960 COFF assemblers do. This is not + a common case: normally, only assembler code will contain + a PC relative reloc, and only branches which do not + originate in the .text section will have a non-zero + address. + + I changed the m68k to work this way as well. This will + break existing PC relative relocs from sections which do + not start at address 0, but it will make ld -r work. + Ian Taylor, 4 Oct 96. */ + add_number -= segP->scnhdr.s_vaddr; #endif } /* if pcrel */ - if (!fixP->fx_bit_fixP) + if (!fixP->fx_bit_fixP && ! fixP->fx_no_overflow) { #ifndef TC_M88K /* The m88k uses the offset field of the reloc to get around this problem. */ if ((size == 1 - && (add_number & ~0xFF) - && ((add_number & ~0xFF) != (-1 & ~0xFF))) + && ((add_number & ~0xFF) + || (fixP->fx_signed && (add_number & 0x80))) + && ((add_number & ~0xFF) != (-1 & ~0xFF) + || (add_number & 0x80) == 0)) || (size == 2 - && (add_number & ~0xFFFF) - && ((add_number & ~0xFFFF) != (-1 & ~0xFFFF)))) + && ((add_number & ~0xFFFF) + || (fixP->fx_signed && (add_number & 0x8000))) + && ((add_number & ~0xFFFF) != (-1 & ~0xFFFF) + || (add_number & 0x8000) == 0))) { as_bad_where (fixP->fx_file, fixP->fx_line, "Value of %ld too large for field of %d bytes at 0x%lx", @@ -4210,6 +4314,7 @@ {"optim", s_ignore, 0}, /* For sun386i cc (?) */ {"ident", s_ignore, 0}, /* we don't yet handle this. */ #endif + {"version", s_ignore, 0}, {"ABORT", s_abort, 0}, #ifdef TC_M88K /* The m88k uses sdef instead of def. */ @@ -4217,3 +4322,60 @@ #endif {NULL} /* end sentinel */ }; /* obj_pseudo_table */ + +#ifdef BFD_ASSEMBLER + +/* Support for a COFF emulation. */ + +static void +coff_pop_insert () +{ + pop_insert (obj_pseudo_table); +} + +static int +coff_sec_sym_ok_for_reloc (sec) + asection *sec; +{ + return 0; +} + +static void +no_func () +{ + abort (); +} + +const struct format_ops coff_format_ops = +{ + bfd_target_coff_flavour, + 0, + 1, + coff_frob_symbol, + coff_frob_file, + no_func, + 0, 0, + 0, 0, + 0, +#if 0 + obj_generate_asm_lineno, +#else + no_func, +#endif +#if 0 + obj_stab, +#else + no_func, +#endif + coff_sec_sym_ok_for_reloc, + coff_pop_insert, +#if 0 + obj_set_ext, +#else + no_func, +#endif + coff_obj_read_begin_hook, + coff_obj_symbol_new_hook, +}; + +#endif diff -urN binutils-2.7/gas/config/obj-coff.h binutils-2.8/gas/config/obj-coff.h --- binutils-2.7/gas/config/obj-coff.h Thu Jul 4 12:13:34 1996 +++ binutils-2.8/gas/config/obj-coff.h Wed Apr 30 12:53:13 1997 @@ -1,5 +1,6 @@ /* coff object file format - Copyright (C) 1989, 90, 91, 92, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1989, 90, 91, 92, 94, 95, 96, 1997 + Free Software Foundation, Inc. This file is part of GAS. @@ -128,6 +129,7 @@ #define TARGET_FORMAT "coff-w65" #endif + /* Targets may also set this. Also, if BFD_ASSEMBLER is defined, this will already have been defined. */ #undef SYMBOLS_NEED_BACKPOINTERS @@ -137,6 +139,12 @@ #define OBJ_COFF_MAX_AUXENTRIES 1 #endif /* OBJ_COFF_MAX_AUXENTRIES */ +extern void coff_obj_symbol_new_hook PARAMS ((struct symbol *)); +#define obj_symbol_new_hook coff_obj_symbol_new_hook + +extern void coff_obj_read_begin_hook PARAMS ((void)); +#define obj_read_begin_hook coff_obj_read_begin_hook + /* *********************************************************************** This file really contains two implementations of the COFF back end. @@ -198,7 +206,6 @@ #define SYM_AUXENT(S) (&coffsymbol ((S)->bsym)->native[1].u.auxent) #define DO_NOT_STRIP 0 -#define DO_STRIP 1 extern void obj_coff_section PARAMS ((int)); @@ -403,7 +410,6 @@ #ifndef DO_NOT_STRIP #define DO_NOT_STRIP 0 -#define DO_STRIP 1 #endif /* Symbol table macros and constants */ @@ -441,7 +447,7 @@ /* A symbol name whose name includes ^A is a gas internal pseudo symbol */ #define S_IS_LOCAL(s) \ ((s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION \ - || (S_LOCAL_NAME(s) && !flag_keep_locals) \ + || (S_LOCAL_NAME(s) && ! flag_keep_locals && ! S_IS_DEBUG (s)) \ || strchr (S_GET_NAME (s), '\001') != NULL \ || strchr (S_GET_NAME (s), '\002') != NULL) /* True if a symbol is not defined in this file */ diff -urN binutils-2.7/gas/config/obj-ecoff.c binutils-2.8/gas/config/obj-ecoff.c --- binutils-2.7/gas/config/obj-ecoff.c Thu Jul 4 12:13:34 1996 +++ binutils-2.8/gas/config/obj-ecoff.c Wed Apr 30 12:53:13 1997 @@ -1,5 +1,5 @@ /* ECOFF object file format. - Copyright (C) 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. Contributed by Cygnus Support. This file was put together by Ian Lance Taylor . @@ -16,8 +16,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #define OBJ_HEADER "obj-ecoff.h" #include "as.h" @@ -29,6 +30,10 @@ gas directory. This file mostly just arranges to call that one at the right times. */ +static int ecoff_sec_sym_ok_for_reloc PARAMS ((asection *)); +static void obj_ecoff_frob_symbol PARAMS ((symbolS *, int *)); +static void ecoff_pop_insert PARAMS ((void)); + /* These are the pseudo-ops we support in this file. Only those relating to debugging information are supported here. @@ -286,6 +291,7 @@ 1, obj_ecoff_frob_symbol, ecoff_frob_file, + 0, 0, 0, 0, 0, 0, diff -urN binutils-2.7/gas/config/obj-ecoff.h binutils-2.8/gas/config/obj-ecoff.h --- binutils-2.7/gas/config/obj-ecoff.h Thu Jul 4 12:13:34 1996 +++ binutils-2.8/gas/config/obj-ecoff.h Wed Apr 30 12:53:13 1997 @@ -1,5 +1,5 @@ /* ECOFF object file format header file. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Ian Lance Taylor . @@ -16,8 +16,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #define OBJ_ECOFF 1 @@ -52,6 +53,9 @@ #define obj_read_begin_hook ecoff_read_begin_hook #define obj_symbol_new_hook ecoff_symbol_new_hook +/* Record file switches in the ECOFF symbol table. */ +#define obj_app_file(name) ecoff_new_file (name) + /* At the moment we don't want to do any stabs processing in read.c. */ #define OBJ_PROCESS_STAB(seg, what, string, type, other, desc) \ ecoff_stab ((seg), (what), (string), (type), (other), (desc)) @@ -63,3 +67,4 @@ #define obj_sec_sym_ok_for_reloc(SEC) 1 #define obj_ecoff_set_ext ecoff_set_ext +extern void obj_ecoff_set_ext PARAMS ((struct symbol *, EXTR *)); diff -urN binutils-2.7/gas/config/obj-elf.c binutils-2.8/gas/config/obj-elf.c --- binutils-2.7/gas/config/obj-elf.c Thu Jul 4 12:13:35 1996 +++ binutils-2.8/gas/config/obj-elf.c Wed Apr 30 12:53:13 1997 @@ -1,5 +1,5 @@ /* ELF object file format - Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -41,6 +41,14 @@ #include "elf/ppc.h" #endif +static bfd_vma elf_s_get_size PARAMS ((symbolS *)); +static void elf_s_set_size PARAMS ((symbolS *, bfd_vma)); +static bfd_vma elf_s_get_align PARAMS ((symbolS *)); +static void elf_s_set_align PARAMS ((symbolS *, bfd_vma)); +static void elf_copy_symbol_attributes PARAMS ((symbolS *, symbolS *)); +static int elf_sec_sym_ok_for_reloc PARAMS ((asection *)); +static void adjust_stab_sections PARAMS ((bfd *, asection *, PTR)); + #ifdef NEED_ECOFF_DEBUG static boolean elf_get_extr PARAMS ((asymbol *, EXTR *)); static void elf_set_index PARAMS ((asymbol *, bfd_size_type)); @@ -54,6 +62,7 @@ static void obj_elf_weak PARAMS ((int)); static void obj_elf_local PARAMS ((int)); static void obj_elf_common PARAMS ((int)); +static void obj_elf_symver PARAMS ((int)); static void obj_elf_data PARAMS ((int)); static void obj_elf_text PARAMS ((int)); @@ -72,9 +81,12 @@ {"version", obj_elf_version, 0}, {"weak", obj_elf_weak, 0}, -/* These are used for stabs-in-elf configurations. */ + /* These are used for stabs-in-elf configurations. */ {"line", obj_elf_line, 0}, + /* This is a GNU extension to handle symbol versions. */ + {"symver", obj_elf_symver, 0}, + /* These are used for dwarf. */ {"2byte", cons, 2}, {"4byte", cons, 4}, @@ -136,6 +148,20 @@ #undef NO_RELOC #include "aout/aout64.h" +/* This is called when the assembler starts. */ + +void +elf_begin () +{ + /* Add symbols for the known sections to the symbol table. */ + symbol_table_insert (section_symbol (bfd_get_section_by_name (stdoutput, + ".text"))); + symbol_table_insert (section_symbol (bfd_get_section_by_name (stdoutput, + ".data"))); + symbol_table_insert (section_symbol (bfd_get_section_by_name (stdoutput, + ".bss"))); +} + void elf_pop_insert () { @@ -206,6 +232,10 @@ verify_symbol_chain (symbol_rootP, symbol_lastP); #endif } + +#ifdef NEED_ECOFF_DEBUG + ecoff_new_file (s); +#endif } static void @@ -242,7 +272,7 @@ *p = 0; symbolP = symbol_find_or_make (name); *p = c; - if (S_IS_DEFINED (symbolP)) + if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) { as_bad ("Ignoring attempt to re-define symbol"); ignore_rest_of_line (); @@ -304,12 +334,12 @@ record_alignment (bss_section, align); subseg_set (bss_section, 0); if (align) - frag_align (align, 0); + frag_align (align, 0, 0); if (S_GET_SEGMENT (symbolP) == bss_section) symbolP->sy_frag->fr_symbol = 0; symbolP->sy_frag = frag_now; - pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size, - (char *) 0); + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, + (offsetT) size, (char *) 0); *pfrag = 0; S_SET_SIZE (symbolP, size); S_SET_SEGMENT (symbolP, bss_section); @@ -322,8 +352,7 @@ S_SET_VALUE (symbolP, (valueT) size); S_SET_ALIGN (symbolP, temp); S_SET_EXTERNAL (symbolP); - /* should be common, but this is how gas does it for now */ - S_SET_SEGMENT (symbolP, bfd_und_section_ptr); + S_SET_SEGMENT (symbolP, bfd_com_section_ptr); } } else @@ -345,6 +374,9 @@ ; goto allocate_common; } + + symbolP->bsym->flags |= BSF_OBJECT; + demand_empty_rest_of_line (); return; @@ -363,7 +395,7 @@ } } -static void +static void obj_elf_local (ignore) int ignore; { @@ -392,7 +424,7 @@ demand_empty_rest_of_line (); } -static void +static void obj_elf_weak (ignore) int ignore; { @@ -425,7 +457,7 @@ static int previous_subsection; /* Handle the .section pseudo-op. This code supports two different - syntaxes. + syntaxes. The first is found on Solaris, and looks like .section ".sec1",#alloc,#execinstr,#write @@ -499,6 +531,7 @@ int type, attr; int i; flagword flags; + symbolS *secsym; #ifdef md_flush_pending_output md_flush_pending_output (); @@ -722,7 +755,16 @@ as_warn ("Setting incorrect section type for %s", string); if ((attr &~ special_sections[i].attributes) != 0) - as_warn ("Setting incorrect section attributes for %s", string); + { + /* As a GNU extension, we permit a .note section to be + allocatable. If the linker sees an allocateable + .note section, it will create a PT_NOTE segment in + the output file. */ + if (strcmp (string, ".note") != 0 + || attr != SHF_ALLOC) + as_warn ("Setting incorrect section attributes for %s", + string); + } attr |= special_sections[i].attributes; break; @@ -751,6 +793,13 @@ bfd_set_section_flags (stdoutput, sec, flags); + /* Add a symbol for this section to the symbol table. */ + secsym = symbol_find (string); + if (secsym != NULL) + secsym->bsym = sec->symbol; + else + symbol_table_insert (section_symbol (sec)); + #ifdef md_elf_section_change_hook md_elf_section_change_hook (); #endif @@ -764,9 +813,17 @@ obj_elf_data (i) int i; { +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + previous_section = now_seg; previous_subsection = now_subseg; s_data (i); + +#ifdef md_elf_section_change_hook + md_elf_section_change_hook (); +#endif } /* Change to the .text section. */ @@ -775,9 +832,27 @@ obj_elf_text (i) int i; { +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + previous_section = now_seg; previous_subsection = now_subseg; s_text (i); + +#ifdef md_elf_section_change_hook + md_elf_section_change_hook (); +#endif +} + +/* This can be called from the processor backends if they change + sections. */ + +void +obj_elf_section_change_hook () +{ + previous_section = now_seg; + previous_subsection = now_subseg; } void @@ -789,8 +864,17 @@ as_bad (".previous without corresponding .section; ignored"); return; } + +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + subseg_set (previous_section, previous_subsection); previous_section = 0; + +#ifdef md_elf_section_change_hook + md_elf_section_change_hook (); +#endif } static void @@ -803,7 +887,69 @@ demand_empty_rest_of_line (); } -void +/* This handle the .symver pseudo-op, which is used to specify a + symbol version. The syntax is ``.symver NAME,SYMVERNAME''. + SYMVERNAME may contain ELF_VER_CHR ('@') characters. This + pseudo-op causes the assembler to emit a symbol named SYMVERNAME + with the same value as the symbol NAME. */ + +static void +obj_elf_symver (ignore) + int ignore; +{ + char *name; + char c; + symbolS *sym; + + name = input_line_pointer; + c = get_symbol_end (); + + sym = symbol_find_or_make (name); + + *input_line_pointer = c; + + if (sym->sy_obj.versioned_name != NULL) + { + as_bad ("multiple .symver directives for symbol `%s'", + S_GET_NAME (sym)); + ignore_rest_of_line (); + return; + } + + SKIP_WHITESPACE (); + if (*input_line_pointer != ',') + { + as_bad ("expected comma after name in .symver"); + ignore_rest_of_line (); + return; + } + + ++input_line_pointer; + name = input_line_pointer; + while (1) + { + c = get_symbol_end (); + if (c != ELF_VER_CHR) + break; + *input_line_pointer++ = c; + } + + sym->sy_obj.versioned_name = xstrdup (name); + + *input_line_pointer = c; + + if (strchr (sym->sy_obj.versioned_name, ELF_VER_CHR) == NULL) + { + as_bad ("missing version name in `%s' for symbol `%s'", + sym->sy_obj.versioned_name, S_GET_NAME (sym)); + ignore_rest_of_line (); + return; + } + + demand_empty_rest_of_line (); +} + +void obj_read_begin_hook () { #ifdef NEED_ECOFF_DEBUG @@ -812,11 +958,12 @@ #endif } -void +void obj_symbol_new_hook (symbolP) symbolS *symbolP; { - symbolP->sy_obj = 0; + symbolP->sy_obj.size = NULL; + symbolP->sy_obj.versioned_name = NULL; #ifdef NEED_ECOFF_DEBUG if (ECOFF_DEBUGGING) @@ -824,7 +971,7 @@ #endif } -void +void obj_elf_version (ignore) int ignore; { @@ -880,7 +1027,7 @@ FRAG_APPEND_1_CHAR (ch); } } - frag_align (2, 0); + frag_align (2, 0, 0); subseg_set (seg, subseg); } @@ -927,8 +1074,8 @@ S_SET_SIZE (sym, exp.X_add_number); else { - sym->sy_obj = (expressionS *) xmalloc (sizeof (expressionS)); - *sym->sy_obj = exp; + sym->sy_obj.size = (expressionS *) xmalloc (sizeof (expressionS)); + *sym->sy_obj.size = exp; } demand_empty_rest_of_line (); } @@ -1130,27 +1277,90 @@ ecoff_frob_symbol (symp); #endif - if (symp->sy_obj) + if (symp->sy_obj.size != NULL) { - switch (symp->sy_obj->X_op) + switch (symp->sy_obj.size->X_op) { case O_subtract: S_SET_SIZE (symp, - (S_GET_VALUE (symp->sy_obj->X_add_symbol) - + symp->sy_obj->X_add_number - - S_GET_VALUE (symp->sy_obj->X_op_symbol))); + (S_GET_VALUE (symp->sy_obj.size->X_add_symbol) + + symp->sy_obj.size->X_add_number + - S_GET_VALUE (symp->sy_obj.size->X_op_symbol))); break; case O_constant: S_SET_SIZE (symp, - (S_GET_VALUE (symp->sy_obj->X_add_symbol) - + symp->sy_obj->X_add_number)); + (S_GET_VALUE (symp->sy_obj.size->X_add_symbol) + + symp->sy_obj.size->X_add_number)); break; default: as_bad (".size expression too complicated to fix up"); break; } - free (symp->sy_obj); - symp->sy_obj = 0; + free (symp->sy_obj.size); + symp->sy_obj.size = NULL; + } + + if (symp->sy_obj.versioned_name != NULL) + { + /* This symbol was given a new name with the .symver directive. + + If this is an external reference, just rename the symbol to + include the version string. This will make the relocs be + against the correct versioned symbol. + + If this is a definition, add an alias. FIXME: Using an alias + will permit the debugging information to refer to the right + symbol. However, it's not clear whether it is the best + approach. */ + + if (! S_IS_DEFINED (symp)) + { + char *p; + + /* Verify that the name isn't using the @@ syntax--this is + reserved for definitions of the default version to link + against. */ + p = strchr (symp->sy_obj.versioned_name, ELF_VER_CHR); + know (p != NULL); + if (p[1] == ELF_VER_CHR) + { + as_bad ("invalid attempt to declare external version name as default in symbol `%s'", + symp->sy_obj.versioned_name); + *puntp = true; + } + S_SET_NAME (symp, symp->sy_obj.versioned_name); + } + else + { + symbolS *symp2; + + /* FIXME: Creating a new symbol here is risky. We're in the + final loop over the symbol table. We can get away with + it only because the symbol goes to the end of the list, + where the loop will still see it. It would probably be + better to do this in obj_frob_file_before_adjust. */ + + symp2 = symbol_find_or_make (symp->sy_obj.versioned_name); + + /* Now we act as though we saw symp2 = sym. */ + + S_SET_SEGMENT (symp2, S_GET_SEGMENT (symp)); + + /* Subtracting out the frag address here is a hack because + we are in the middle of the final loop. */ + S_SET_VALUE (symp2, S_GET_VALUE (symp) - symp->sy_frag->fr_address); + + symp2->sy_frag = symp->sy_frag; + + /* This will copy over the size information. */ + copy_symbol_attributes (symp2, symp); + + if (S_IS_WEAK (symp)) + S_SET_WEAK (symp2); + + if (S_IS_EXTERNAL (symp)) + S_SET_EXTERNAL (symp2); + } } /* Double check weak symbols. */ @@ -1162,10 +1372,11 @@ } #ifdef TC_MIPS - /* The Irix 5 assembler appears to set the type of any common symbol - to STT_OBJECT. We try to be compatible, since the Irix 5 linker - apparently sometimes cares. FIXME: What about Irix 6? */ - if (S_IS_COMMON (symp)) + /* The Irix 5 and 6 assemblers set the type of any common symbol and + any undefined non-function symbol to STT_OBJECT. We try to be compatible, + since newer Irix 5 and 6 linkers care. */ + if (S_IS_COMMON (symp) + || (! S_IS_DEFINED (symp) && ((symp->bsym->flags & BSF_FUNCTION) == 0))) symp->bsym->flags |= BSF_OBJECT; #endif @@ -1178,7 +1389,7 @@ #endif } -void +void elf_frob_file () { bfd_map_over_sections (stdoutput, adjust_stab_sections, (PTR) 0); @@ -1186,7 +1397,16 @@ #ifdef elf_tc_final_processing elf_tc_final_processing (); #endif +} + +/* It is required that we let write_relocs have the opportunity to + optimize away fixups before output has begun, since it is possible + to eliminate all fixups for a section and thus we never should + have generated the relocation section. */ +void +elf_frob_file_after_relocs () +{ #ifdef NEED_ECOFF_DEBUG if (ECOFF_DEBUGGING) /* Generate the ECOFF debugging information. */ @@ -1205,7 +1425,7 @@ #define SET(ptr, offset, type) \ debug.ptr = (type) (buf + debug.symbolic_header.offset) - SET (line, cbLineOffset, unsigned char *); + SET (line, cbLineOffset, unsigned char *); SET (external_dnr, cbDnOffset, PTR); SET (external_pdr, cbPdOffset, PTR); SET (external_sym, cbSymOffset, PTR); @@ -1216,7 +1436,7 @@ SET (external_rfd, cbRfdOffset, PTR); /* ssext and external_ext are set up just below. */ -#undef SET +#undef SET /* Set up the external symbols. */ debug.ssext = debug.ssext_end = NULL; @@ -1253,6 +1473,103 @@ #endif /* NEED_ECOFF_DEBUG */ } +#ifdef SCO_ELF + +/* Heavily plagarized from obj_elf_version. The idea is to emit the + SCO specific identifier in the .notes section to satisfy the SCO + linker. + + This looks more complicated than it really is. As opposed to the + "obvious" solution, this should handle the cross dev cases + correctly. (i.e, hosting on a 64 bit big endian processor, but + generating SCO Elf code) Efficiency isn't a concern, as there + should be exactly one of these sections per object module. + + SCO OpenServer 5 identifies it's ELF modules with a standard ELF + .note section. + + int_32 namesz = 4 ; Name size + int_32 descsz = 12 ; Descriptive information + int_32 type = 1 ; + char name[4] = "SCO" ; Originator name ALWAYS SCO + NULL + int_32 version = (major ver # << 16) | version of tools ; + int_32 source = (tool_id << 16 ) | 1 ; + int_32 info = 0 ; These are set by the SCO tools, but we + don't know enough about the source + environment to set them. SCO ld currently + ignores them, and recommends we set them + to zero. */ + +#define SCO_MAJOR_VERSION 0x1 +#define SCO_MINOR_VERSION 0x1 + +void +sco_id () +{ + + char *name; + unsigned int c; + char ch; + char *p; + asection *seg = now_seg; + subsegT subseg = now_subseg; + Elf_Internal_Note i_note; + Elf_External_Note e_note; + asection *note_secp = (asection *) NULL; + int i, len; + + /* create the .note section */ + + note_secp = subseg_new (".note", 0); + bfd_set_section_flags (stdoutput, + note_secp, + SEC_HAS_CONTENTS | SEC_READONLY); + + /* process the version string */ + + i_note.namesz = 4; + i_note.descsz = 12; /* 12 descriptive bytes */ + i_note.type = NT_VERSION; /* Contains a version string */ + + p = frag_more (sizeof (i_note.namesz)); + md_number_to_chars (p, (valueT) i_note.namesz, 4); + + p = frag_more (sizeof (i_note.descsz)); + md_number_to_chars (p, (valueT) i_note.descsz, 4); + + p = frag_more (sizeof (i_note.type)); + md_number_to_chars (p, (valueT) i_note.type, 4); + + p = frag_more (4); + strcpy (p, "SCO"); + + /* Note: this is the version number of the ELF we're representing */ + p = frag_more (4); + md_number_to_chars (p, (SCO_MAJOR_VERSION << 16) | (SCO_MINOR_VERSION), 4); + + /* Here, we pick a magic number for ourselves (yes, I "registered" + it with SCO. The bottom bit shows that we are compat with the + SCO ABI. */ + p = frag_more (4); + md_number_to_chars (p, 0x4c520000 | 0x0001, 4); + + /* If we knew (or cared) what the source language options were, we'd + fill them in here. SCO has given us permission to ignore these + and just set them to zero. */ + p = frag_more (4); + md_number_to_chars (p, 0x0000, 4); + + frag_align (2, 0, 0); + + /* We probably can't restore the current segment, for there likely + isn't one yet... */ + if (seg && subseg) + subseg_set (seg, subseg); + +} + +#endif /* SCO_ELF */ + const struct format_ops elf_format_ops = { bfd_target_elf_flavour, @@ -1260,6 +1577,7 @@ 1, elf_frob_symbol, elf_frob_file, + elf_frob_file_after_relocs, elf_s_get_size, elf_s_set_size, elf_s_get_align, elf_s_set_align, elf_copy_symbol_attributes, diff -urN binutils-2.7/gas/config/obj-elf.h binutils-2.8/gas/config/obj-elf.h --- binutils-2.7/gas/config/obj-elf.h Thu Jul 4 12:13:35 1996 +++ binutils-2.8/gas/config/obj-elf.h Wed Apr 30 12:53:14 1997 @@ -1,5 +1,5 @@ /* ELF object file format. - Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -34,9 +34,23 @@ #define BYTES_IN_WORD 4 /* for now */ #include "bfd/elf-bfd.h" -/* Use this to keep track of .size expressions that involve differences - that we can't compute yet. */ -#define OBJ_SYMFIELD_TYPE expressionS * +/* Additional information we keep for each symbol. */ + +/* FIXME: For some reason, this structure is needed both here and in + obj-multi.h. */ +#ifndef OBJ_SYMFIELD_TYPE +struct elf_obj_sy +{ + /* Use this to keep track of .size expressions that involve + differences that we can't compute yet. */ + expressionS *size; + + /* The name specified by the .symver directive. */ + char *versioned_name; +}; +#endif + +#define OBJ_SYMFIELD_TYPE struct elf_obj_sy /* Symbol fields used by the ELF back end. */ #define ELF_TARGET_SYMBOL_FIELDS int local:1; @@ -51,6 +65,9 @@ #define TRUE !FALSE #endif +#define obj_begin() elf_begin () +extern void elf_begin PARAMS ((void)); + /* should be conditional on address size! */ #define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd)) @@ -62,13 +79,22 @@ #define S_SET_ALIGN(S,V) \ (elf_symbol ((S)->bsym)->internal_elf_sym.st_value = (V)) -extern asection *gdb_section; +#define S_GET_OTHER(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_other) +#define S_SET_OTHER(S,V) \ + (elf_symbol ((S)->bsym)->internal_elf_sym.st_other = (V)) -#define obj_frob_file() elf_frob_file() +extern asection *gdb_section; +#define obj_frob_file elf_frob_file extern void elf_frob_file PARAMS ((void)); -extern void elf_file_symbol PARAMS ((char *)); + +#define obj_frob_file_after_relocs elf_frob_file_after_relocs +extern void elf_frob_file_after_relocs PARAMS ((void)); + #define obj_app_file elf_file_symbol +extern void elf_file_symbol PARAMS ((char *)); + +extern void obj_elf_section_change_hook PARAMS ((void)); extern void obj_elf_section PARAMS ((int)); extern void obj_elf_previous PARAMS ((int)); @@ -81,8 +107,13 @@ /* When setting one symbol equal to another, by default we probably want them to have the same "size", whatever it means in the current context. */ -#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC) \ - S_SET_SIZE ((DEST), S_GET_SIZE (SRC)) +#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC) \ +do \ + { \ + S_SET_SIZE ((DEST), S_GET_SIZE (SRC)); \ + S_SET_OTHER ((DEST), S_GET_OTHER (SRC)); \ + } \ +while (0) /* Stabs go in a separate section. */ #define SEPARATE_STAB_SECTIONS 1 @@ -133,7 +164,10 @@ #ifndef OBJ_MAYBE_ELF #define obj_ecoff_set_ext elf_ecoff_set_ext -extern void elf_ecoff_set_ext (); +#ifdef ANSI_PROTOTYPES +struct ecoff_extr; +#endif +extern void elf_ecoff_set_ext PARAMS ((struct symbol *, struct ecoff_extr *)); #endif #endif /* _OBJ_ELF_H */ diff -urN binutils-2.7/gas/config/obj-evax.c binutils-2.8/gas/config/obj-evax.c --- binutils-2.7/gas/config/obj-evax.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/obj-evax.c Wed Apr 30 12:53:14 1997 @@ -0,0 +1,42 @@ +/* obj-evax.c - EVAX (openVMS/Alpha) object file format. + Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Klaus Kämpf (kkaempf@progis.de) of + proGIS Software, Aachen, Germany. + + This file is part of GAS, the GNU Assembler + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +#define OBJ_HEADER "obj-evax.h" + +#include "as.h" + +void obj_read_begin_hook () {} + +const pseudo_typeS obj_pseudo_table[] = +{ + {0, 0, 0}, +}; /* obj_pseudo_table */ + + +/* + * Local Variables: + * comment-column: 0 + * fill-column: 131 + * End: + */ + +/* end of obj-evax.c */ diff -urN binutils-2.7/gas/config/obj-evax.h binutils-2.8/gas/config/obj-evax.h --- binutils-2.7/gas/config/obj-evax.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/obj-evax.h Wed Apr 30 12:53:14 1997 @@ -0,0 +1,95 @@ +/* This file is obj-evax.h + Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Klaus Kämpf (kkaempf@progis.de) of + proGIS Software, Aachen, Germany. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +/* + * This file is obj-evax.h and is intended to be a template for + * object format specific header files. + */ + +/* define an obj specific macro off which target cpu back ends may key. */ +#define OBJ_EVAX 1 + +/* include whatever target cpu is appropriate. */ +#include "targ-cpu.h" + +#ifdef BFD_ASSEMBLER +#define OUTPUT_FLAVOR bfd_target_evax_flavour +#endif + +/* + * SYMBOLS + */ + +/* + * If your object format needs to reorder symbols, define this. When + * defined, symbols are kept on a doubly linked list and functions are + * made available for push, insert, append, and delete. If not defined, + * symbols are kept on a singly linked list, only the append and clear + * facilities are available, and they are macros. + */ + +/* #define SYMBOLS_NEED_PACKPOINTERS */ + +/* */ +typedef struct + { + void *nothing; + } +obj_symbol_type; /* should be the format's symbol structure */ + +typedef void *object_headers; + +#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (0) /* your magic number */ + +#define OBJ_EMIT_LINENO(a,b,c) /* must be *something*. This no-op's it out. */ + +#define obj_symbol_new_hook(s) {;} + +#define S_SET_OTHER(S,V) +#define S_SET_TYPE(S,T) +#define S_SET_DESC(S,D) +#define S_GET_OTHER(S) 0 +#define S_GET_TYPE(S) 0 +#define S_GET_DESC(S) 0 + +#define PDSC_S_K_KIND_FP_STACK 9 +#define PDSC_S_K_KIND_FP_REGISTER 10 +#define PDSC_S_K_KIND_NULL 8 + +#define PDSC_S_K_MIN_STACK_SIZE 32 +#define PDSC_S_K_MIN_REGISTER_SIZE 24 +#define PDSC_S_K_NULL_SIZE 16 + +#define PDSC_S_M_BASE_REG_IS_FP 0x80 /* low byte */ +#define PDSC_S_M_NATIVE 0x10 /* high byte */ +#define PDSC_S_M_NO_JACKET 0x20 /* high byte */ + +#define LKP_S_K_SIZE 16 + +/* + * Local Variables: + * comment-column: 0 + * fill-column: 131 + * End: + */ + +/* end of obj-evax.h */ diff -urN binutils-2.7/gas/config/obj-ieee.c binutils-2.8/gas/config/obj-ieee.c --- binutils-2.7/gas/config/obj-ieee.c Thu Jul 4 12:13:36 1996 +++ binutils-2.8/gas/config/obj-ieee.c Wed Apr 30 12:53:14 1997 @@ -1,5 +1,5 @@ /* obj-format for ieee-695 records. - Copyright (C) 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* @@ -76,7 +77,15 @@ size += frag->fr_offset * frag->fr_var; break; case rs_align: - size += relax_align (size, frag->fr_offset); + case rs_align_code: + { + addressT off; + + off = relax_align (size, frag->fr_offset); + if (frag->fr_subtype != 0 && off > frag->fr_subtype) + off = 0; + size += off; + } } frag = frag->fr_next; } @@ -406,11 +415,13 @@ abort (); } +#ifndef segment_name char * segment_name () { abort (); } +#endif void obj_read_begin_hook () @@ -529,7 +540,7 @@ #ifndef SUB_SEGMENT_ALIGN #define SUB_SEGMENT_ALIGN(SEG) 2 #endif - frag_align (SUB_SEGMENT_ALIGN (now_seg), 0); + frag_align (SUB_SEGMENT_ALIGN (now_seg), 0, 0); frag_wane (frag_now); frag_now->fr_fix = 0; know (frag_now->fr_next == NULL); diff -urN binutils-2.7/gas/config/obj-multi.h binutils-2.8/gas/config/obj-multi.h --- binutils-2.7/gas/config/obj-multi.h Thu Jul 4 12:13:36 1996 +++ binutils-2.8/gas/config/obj-multi.h Wed Apr 30 12:53:15 1997 @@ -6,6 +6,7 @@ #define OUTPUT_FLAVOR (this_format->flavor) #define obj_frob_symbol(S,P) (this_format->frob_symbol)(S,&(P)) #define obj_frob_file (this_format->frob_file) +#define obj_frob_file_after_relocs (this_format->frob_file_after_relocs) #define obj_ecoff_set_ext (this_format->ecoff_set_ext) #define obj_pop_insert (this_format->pop_insert) #define obj_read_begin_hook() (this_format->read_begin_hook?this_format->read_begin_hook():(void)0) @@ -22,8 +23,15 @@ #define ECOFF_DEBUGGING 1 #endif +/* FIXME: What's the story here? Why do we have to define + OBJ_SYMFIELD_TYPE both here and in obj-elf.h? */ #ifdef OBJ_MAYBE_ELF -#define OBJ_SYMFIELD_TYPE expressionS * +struct elf_obj_sy +{ + expressionS *size; + char *versioned_name; +}; +#define OBJ_SYMFIELD_TYPE struct elf_obj_sy #define ELF_TARGET_SYMBOL_FIELDS int local:1; #else #define ELF_TARGET_SYMBOL_FIELDS diff -urN binutils-2.7/gas/config/obj-vms.h binutils-2.8/gas/config/obj-vms.h --- binutils-2.7/gas/config/obj-vms.h Thu Jul 4 12:13:43 1996 +++ binutils-2.8/gas/config/obj-vms.h Wed Apr 30 12:53:15 1997 @@ -1,5 +1,6 @@ /* VMS object file format - Copyright (C) 1989,90,91,94,95,1996 Free Software Foundation, Inc. + Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -13,9 +14,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public -License along with GAS; see the file COPYING. If not, write -to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +You should have received a copy of the GNU General Public License +along with GAS; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ /* Tag to validate a.out object file format processing */ #define OBJ_VMS 1 @@ -224,7 +226,7 @@ /* Compiler-generated label "__vax_g_doubles" is used to augment .stabs. */ extern void vms_check_for_special_label PARAMS ((struct symbol *)); -#define tc_frob_label(X) vms_check_for_special_label(X) +#define obj_frob_label(X) vms_check_for_special_label(X) extern void vms_check_for_main PARAMS ((void)); diff -urN binutils-2.7/gas/config/ppc-lit.mt binutils-2.8/gas/config/ppc-lit.mt --- binutils-2.7/gas/config/ppc-lit.mt Thu Jul 4 12:13:44 1996 +++ binutils-2.8/gas/config/ppc-lit.mt Wed Apr 30 12:53:16 1997 @@ -1 +1 @@ -TDEFINES=-DTARGET_BYTES_LITTLE_ENDIAN=1 +TDEFINES=-DTARGET_BYTES_BIG_ENDIAN=0 diff -urN binutils-2.7/gas/config/ppc-sol.mt binutils-2.8/gas/config/ppc-sol.mt --- binutils-2.7/gas/config/ppc-sol.mt Thu Jul 4 12:13:44 1996 +++ binutils-2.8/gas/config/ppc-sol.mt Wed Apr 30 12:53:16 1997 @@ -1 +1 @@ -TDEFINES=-DTARGET_BYTES_LITTLE_ENDIAN=1 -DTARGET_SOLARIS_COMMENT +TDEFINES=-DTARGET_BYTES_BIG_ENDIAN=0 -DTARGET_SOLARIS_COMMENT diff -urN binutils-2.7/gas/config/tc-alpha.c binutils-2.8/gas/config/tc-alpha.c --- binutils-2.7/gas/config/tc-alpha.c Wed Jul 10 12:45:02 1996 +++ binutils-2.8/gas/config/tc-alpha.c Wed Apr 30 12:53:17 1997 @@ -1,9 +1,10 @@ /* tc-alpha.c - Processor-specific code for the DEC Alpha AXP CPU. - Copyright (C) 1989, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1989, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Contributed by Carnegie Mellon University, 1993. Written by Alessandro Forin, based on earlier gas-1.38 target CPU files. Modified by Ken Raeburn for gas-2.x and ECOFF support. Modified by Richard Henderson for ELF support. + Modified by Klaus K"ampf for EVAX (openVMS/Alpha) support. This file is part of GAS, the GNU Assembler. @@ -86,8 +87,8 @@ struct alpha_macro { const char *name; - void (*emit) PARAMS((const expressionS *, int, void *)); - void *arg; + void (*emit) PARAMS ((const expressionS *, int, const PTR)); + const PTR arg; enum alpha_macro_arg argsets[16]; }; @@ -153,52 +154,73 @@ /* Prototypes for all local functions */ -static int tokenize_arguments PARAMS((char *, expressionS*, int)); +static int tokenize_arguments PARAMS ((char *, expressionS *, int)); static const struct alpha_opcode *find_opcode_match - PARAMS((const struct alpha_opcode*, const expressionS*, int*, int*)); + PARAMS ((const struct alpha_opcode *, const expressionS *, int *, int *)); static const struct alpha_macro *find_macro_match - PARAMS((const struct alpha_macro*, const expressionS*, int*)); -static unsigned insert_operand PARAMS((unsigned, const struct alpha_operand*, - offsetT, char *, unsigned)); -static void assemble_insn PARAMS((const struct alpha_opcode*, - const expressionS*, int, - struct alpha_insn*)); -static void emit_insn PARAMS((struct alpha_insn *)); -static void assemble_tokens_to_insn PARAMS((const char *, const expressionS*, - int, struct alpha_insn *)); -static void assemble_tokens PARAMS((const char *, const expressionS*, - int, int)); - -static int load_expression PARAMS((int, const expressionS*, int *, - expressionS*)); - -static void emit_ldgp PARAMS((const expressionS*, int, void*)); -static void emit_division PARAMS((const expressionS*, int, void*)); -static void emit_lda PARAMS((const expressionS*, int, void*)); -static void emit_ir_load PARAMS((const expressionS*, int, void*)); -static void emit_loadstore PARAMS((const expressionS*, int, void*)); -static void emit_jsrjmp PARAMS((const expressionS*, int, void*)); + PARAMS ((const struct alpha_macro *, const expressionS *, int *)); +static unsigned insert_operand + PARAMS ((unsigned, const struct alpha_operand *, offsetT, char *, unsigned)); +static void assemble_insn + PARAMS ((const struct alpha_opcode *, const expressionS *, int, + struct alpha_insn *)); +static void emit_insn PARAMS ((struct alpha_insn *)); +static void assemble_tokens_to_insn + PARAMS ((const char *, const expressionS *, int, struct alpha_insn *)); +static void assemble_tokens + PARAMS ((const char *, const expressionS *, int, int)); + +static int load_expression + PARAMS ((int, const expressionS *, int *, expressionS *)); + +static void emit_ldgp PARAMS ((const expressionS *, int, const PTR)); +static void emit_division PARAMS ((const expressionS *, int, const PTR)); +static void emit_lda PARAMS ((const expressionS *, int, const PTR)); +static void emit_ldah PARAMS ((const expressionS *, int, const PTR)); +static void emit_ir_load PARAMS ((const expressionS *, int, const PTR)); +static void emit_loadstore PARAMS ((const expressionS *, int, const PTR)); +static void emit_jsrjmp PARAMS ((const expressionS *, int, const PTR)); +static void emit_ldX PARAMS ((const expressionS *, int, const PTR)); +static void emit_ldXu PARAMS ((const expressionS *, int, const PTR)); +static void emit_uldX PARAMS ((const expressionS *, int, const PTR)); +static void emit_uldXu PARAMS ((const expressionS *, int, const PTR)); +static void emit_ldil PARAMS ((const expressionS *, int, const PTR)); +static void emit_stX PARAMS ((const expressionS *, int, const PTR)); +static void emit_ustX PARAMS ((const expressionS *, int, const PTR)); +static void emit_sextX PARAMS ((const expressionS *, int, const PTR)); +static void emit_retjcr PARAMS ((const expressionS *, int, const PTR)); -static void s_alpha_text PARAMS((int)); -static void s_alpha_data PARAMS((int)); +static void s_alpha_text PARAMS ((int)); +static void s_alpha_data PARAMS ((int)); #ifndef OBJ_ELF -static void s_alpha_comm PARAMS((int)); +static void s_alpha_comm PARAMS ((int)); #endif -static void s_alpha_rdata PARAMS((int)); -static void s_alpha_sdata PARAMS((int)); -static void s_alpha_gprel32 PARAMS((int)); -static void s_alpha_float_cons PARAMS((int)); -static void s_alpha_proc PARAMS((int)); -static void s_alpha_set PARAMS((int)); -static void s_alpha_base PARAMS((int)); -static void s_alpha_align PARAMS((int)); -static void s_alpha_cons PARAMS((int)); +#if defined (OBJ_ECOFF) || defined (OBJ_EVAX) +static void s_alpha_rdata PARAMS ((int)); +#endif +#ifdef OBJ_ECOFF +static void s_alpha_sdata PARAMS ((int)); +#endif +#ifdef OBJ_ELF +static void s_alpha_section PARAMS ((int)); +#endif +#ifdef OBJ_EVAX +static void s_alpha_section PARAMS ((int)); +#endif +static void s_alpha_gprel32 PARAMS ((int)); +static void s_alpha_float_cons PARAMS ((int)); +static void s_alpha_proc PARAMS ((int)); +static void s_alpha_set PARAMS ((int)); +static void s_alpha_base PARAMS ((int)); +static void s_alpha_align PARAMS ((int)); +static void s_alpha_stringer PARAMS ((int)); +static void s_alpha_space PARAMS ((int)); -static void create_literal_section PARAMS((const char *, segT*, symbolS**)); +static void create_literal_section PARAMS ((const char *, segT *, symbolS **)); #ifndef OBJ_ELF -static void select_gp_value PARAMS((void)); +static void select_gp_value PARAMS ((void)); #endif -static void alpha_align PARAMS((int, char *, symbolS *)); +static void alpha_align PARAMS ((int, char *, symbolS *)); /* Generic assembler global variables which must be defined by all @@ -232,7 +254,11 @@ char FLT_CHARS[] = "rRsSfFdDxXpP"; #endif +#ifdef OBJ_EVAX +const char *md_shortopts = "Fm:g+1h:H"; +#else const char *md_shortopts = "Fm:g"; +#endif struct option md_longopts[] = { #define OPTION_32ADDR (OPTION_MD_BASE) @@ -243,14 +269,30 @@ size_t md_longopts_size = sizeof(md_longopts); +#ifdef OBJ_EVAX +#define AXP_REG_R0 0 +#define AXP_REG_R16 16 +#define AXP_REG_R17 17 +#undef AXP_REG_T9 +#define AXP_REG_T9 22 +#undef AXP_REG_T10 +#define AXP_REG_T10 23 +#undef AXP_REG_T11 +#define AXP_REG_T11 24 +#undef AXP_REG_T12 +#define AXP_REG_T12 25 +#define AXP_REG_AI 25 +#undef AXP_REG_FP +#define AXP_REG_FP 29 + +#undef AXP_REG_GP +#define AXP_REG_GP AXP_REG_PV +#endif /* OBJ_EVAX */ + /* The cpu for which we are generating code */ -static unsigned alpha_target = AXP_OPCODE_ALL; +static unsigned alpha_target = AXP_OPCODE_BASE; static const char *alpha_target_name = ""; -/* Forward declaration of the table of macros */ -static const struct alpha_macro alpha_macros[]; -static const int alpha_num_macros; - /* The hash table of instruction opcodes */ static struct hash_control *alpha_opcode_hash; @@ -276,6 +318,11 @@ static segT alpha_lita_section; static segT alpha_lit4_section; #endif +#ifdef OBJ_EVAX +static segT alpha_link_section; +static segT alpha_ctors_section; +static segT alpha_dtors_section; +#endif static segT alpha_lit8_section; /* Symbols referring to said sections. */ @@ -283,8 +330,19 @@ static symbolS *alpha_lita_symbol; static symbolS *alpha_lit4_symbol; #endif +#ifdef OBJ_EVAX +static symbolS *alpha_link_symbol; +static symbolS *alpha_ctors_symbol; +static symbolS *alpha_dtors_symbol; +#endif static symbolS *alpha_lit8_symbol; +/* Literal for .litX+0x8000 within .lita */ +#ifdef OBJ_ECOFF +static offsetT alpha_lit4_literal; +static offsetT alpha_lit8_literal; +#endif + /* Is the assembler not allowed to use $at? */ static int alpha_noat_on = 0; @@ -308,17 +366,275 @@ .align 0 will turn this off. */ static int alpha_auto_align_on = 1; +/* The known current alignment of the current section. */ +static int alpha_current_align; + /* These are exported to ECOFF code. */ unsigned long alpha_gprmask, alpha_fprmask; +/* Whether the debugging option was seen. */ +static int alpha_debug; + +#ifdef OBJ_EVAX +/* Collect information about current procedure here. */ +static struct { + symbolS *symbol; /* proc pdesc symbol */ + int pdsckind; + int framereg; /* register for frame pointer */ + int framesize; /* size of frame */ + int rsa_offset; + int ra_save; + int fp_save; + long imask; + long fmask; + int type; + int prologue; +} alpha_evax_proc; + +static int alpha_flag_hash_long_names = 0; /* -+ */ +static int alpha_flag_show_after_trunc = 0; /* -H */ + +/* If the -+ switch is given, then a hash is appended to any name that is + * longer than 64 characters, else longer symbol names are truncated. + */ + +static int alpha_basereg_clobbered; +#endif + +/* The macro table */ + +static const struct alpha_macro alpha_macros[] = { +/* Load/Store macros */ + { "lda", emit_lda, NULL, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldah", emit_ldah, NULL, + { MACRO_IR, MACRO_EXP, MACRO_EOA } }, + + { "ldl", emit_ir_load, "ldl", + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldl_l", emit_ir_load, "ldl_l", + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldq", emit_ir_load, "ldq", + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldq_l", emit_ir_load, "ldq_l", + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldq_u", emit_ir_load, "ldq_u", + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldf", emit_loadstore, "ldf", + { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + { "ldg", emit_loadstore, "ldg", + { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + { "lds", emit_loadstore, "lds", + { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + { "ldt", emit_loadstore, "ldt", + { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + + { "ldb", emit_ldX, (PTR)0, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldbu", emit_ldXu, (PTR)0, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldw", emit_ldX, (PTR)1, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldwu", emit_ldXu, (PTR)1, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + + { "uldw", emit_uldX, (PTR)1, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "uldwu", emit_uldXu, (PTR)1, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "uldl", emit_uldX, (PTR)2, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "uldlu", emit_uldXu, (PTR)2, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "uldq", emit_uldXu, (PTR)3, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + + { "ldgp", emit_ldgp, NULL, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA } }, + + { "ldi", emit_lda, NULL, + { MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldil", emit_ldil, NULL, + { MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldiq", emit_lda, NULL, + { MACRO_IR, MACRO_EXP, MACRO_EOA } }, +#if 0 + { "ldif" emit_ldiq, NULL, + { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + { "ldid" emit_ldiq, NULL, + { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + { "ldig" emit_ldiq, NULL, + { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + { "ldis" emit_ldiq, NULL, + { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + { "ldit" emit_ldiq, NULL, + { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, +#endif + + { "stl", emit_loadstore, "stl", + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "stl_c", emit_loadstore, "stl_c", + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "stq", emit_loadstore, "stq", + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "stq_c", emit_loadstore, "stq_c", + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "stq_u", emit_loadstore, "stq_u", + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "stf", emit_loadstore, "stf", + { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + { "stg", emit_loadstore, "stg", + { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + { "sts", emit_loadstore, "sts", + { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + { "stt", emit_loadstore, "stt", + { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + + { "stb", emit_stX, (PTR)0, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "stw", emit_stX, (PTR)1, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ustw", emit_ustX, (PTR)1, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ustl", emit_ustX, (PTR)2, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ustq", emit_ustX, (PTR)3, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA } }, + +/* Arithmetic macros */ +#if 0 + { "absl" emit_absl, 1, { IR } }, + { "absl" emit_absl, 2, { IR, IR } }, + { "absl" emit_absl, 2, { EXP, IR } }, + { "absq" emit_absq, 1, { IR } }, + { "absq" emit_absq, 2, { IR, IR } }, + { "absq" emit_absq, 2, { EXP, IR } }, +#endif + + { "sextb", emit_sextX, (PTR)0, + { MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EOA, + /* MACRO_EXP, MACRO_IR, MACRO_EOA */ } }, + { "sextw", emit_sextX, (PTR)1, + { MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EOA, + /* MACRO_EXP, MACRO_IR, MACRO_EOA */ } }, + + { "divl", emit_division, "__divl", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "divlu", emit_division, "__divlu", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "divq", emit_division, "__divq", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "divqu", emit_division, "__divqu", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "reml", emit_division, "__reml", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "remlu", emit_division, "__remlu", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "remq", emit_division, "__remq", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "remqu", emit_division, "__remqu", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + + { "jsr", emit_jsrjmp, "jsr", + { MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_EXP, MACRO_EOA } }, + { "jmp", emit_jsrjmp, "jmp", + { MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_EXP, MACRO_EOA } }, + { "ret", emit_retjcr, "ret", + { MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_IR, MACRO_EOA, + MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_EXP, MACRO_EOA, + MACRO_EOA } }, + { "jcr", emit_retjcr, "jcr", + { MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_IR, MACRO_EOA, + MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_EXP, MACRO_EOA, + MACRO_EOA } }, + { "jsr_coroutine", emit_retjcr, "jcr", + { MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_IR, MACRO_EOA, + MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_EXP, MACRO_EOA, + MACRO_EOA } }, +}; + +static const int alpha_num_macros + = sizeof(alpha_macros) / sizeof(*alpha_macros); /* Public interface functions */ -/* - * This function is called once, at assembler startup time. It sets up - * all the tables, etc. that the MD part of the assembler will need, - * that can be determined before arguments are parsed. - */ +/* This function is called once, at assembler startup time. It sets + up all the tables, etc. that the MD part of the assembler will + need, that can be determined before arguments are parsed. */ void md_begin () @@ -416,6 +732,10 @@ &zero_address_frag); #endif +#ifdef OBJ_EVAX + create_literal_section (".link", &alpha_link_section, &alpha_link_symbol); +#endif + #ifdef OBJ_ELF if (ECOFF_DEBUGGING) { @@ -429,7 +749,7 @@ sec = subseg_new(".reginfo", (subsegT)0); /* The ABI says this section should be loaded so that the running program can access it. */ - bfd_set_section_flags(stdoutput, sec, + bfd_set_section_flags(stdoutput, sec, SEC_ALLOC|SEC_LOAD|SEC_READONLY|SEC_DATA); bfd_set_section_alignement(stdoutput, sec, 3); #endif @@ -439,9 +759,7 @@ subseg_set(text_section, 0); } -/* - * The public interface to the instruction assembler. - */ +/* The public interface to the instruction assembler. */ void md_assemble (str) @@ -470,6 +788,8 @@ assemble_tokens (opname, tok, ntok, alpha_macros_on); } +/* Round up a section's size to the appropriate boundary. */ + valueT md_section_align (seg, size) segT seg; @@ -481,16 +801,16 @@ return (size + mask) & ~mask; } -/* - * Turn a string in input_line_pointer into a floating point constant - * of type type, and store the appropriate bytes in *litP. The number - * of LITTLENUMS emitted is stored in *sizeP. An error message is - * returned, or NULL on OK. - */ +/* Turn a string in input_line_pointer into a floating point constant + of type type, and store the appropriate bytes in *litP. The number + of LITTLENUMS emitted is stored in *sizeP. An error message is + returned, or NULL on OK. */ /* Equal to MAX_PRECISION in atof-ieee.c */ #define MAX_LITTLENUMS 6 +extern char *vax_md_atof PARAMS ((int, char *, int *)); + char * md_atof (type, litP, sizeP) char type; @@ -501,7 +821,6 @@ LITTLENUM_TYPE words[MAX_LITTLENUMS]; LITTLENUM_TYPE *wordP; char *t; - char *atof_ieee (), *vax_md_atof (); switch (type) { @@ -550,27 +869,7 @@ return 0; } -void -md_bignum_to_chars (buf, bignum, nchars) - char *buf; - LITTLENUM_TYPE *bignum; - int nchars; -{ - while (nchars) - { - LITTLENUM_TYPE work = *bignum++; - int nb = CHARS_PER_LITTLENUM; - - do - { - *buf++ = work & ((1 << BITS_PER_CHAR) - 1); - if (--nchars == 0) - return; - work >>= BITS_PER_CHAR; - } - while (--nb); - } -} +/* Take care of the target-specific command-line options. */ int md_parse_option (c, arg) @@ -588,9 +887,7 @@ break; case 'g': - /* Ignore `-g' so gcc can provide this option to the Digital - UNIX assembler, which otherwise would throw away info that - mips-tfile needs. */ + alpha_debug = 1; break; case 'm': @@ -601,18 +898,34 @@ unsigned flags; } *p, m[] = { - { "21064", AXP_OPCODE_EV4|AXP_OPCODE_ALL }, - { "21066", AXP_OPCODE_EV4|AXP_OPCODE_ALL }, - { "21164", AXP_OPCODE_EV5|AXP_OPCODE_ALL }, - { "21164a", AXP_OPCODE_EV56|AXP_OPCODE_ALL }, - { "ev4", AXP_OPCODE_EV4|AXP_OPCODE_ALL }, - { "ev45", AXP_OPCODE_EV4|AXP_OPCODE_ALL }, - { "ev5", AXP_OPCODE_EV5|AXP_OPCODE_ALL }, - { "ev56", AXP_OPCODE_EV56|AXP_OPCODE_ALL }, - { "all", AXP_OPCODE_ALL }, + { "21064", AXP_OPCODE_BASE|AXP_OPCODE_EV4 }, + { "21064a", AXP_OPCODE_BASE|AXP_OPCODE_EV4 }, + { "21066", AXP_OPCODE_BASE|AXP_OPCODE_EV4 }, + { "21068", AXP_OPCODE_BASE|AXP_OPCODE_EV4 }, + { "21164", AXP_OPCODE_BASE|AXP_OPCODE_EV5 }, + /* Do we have CIX extension here? */ + { "21164a", AXP_OPCODE_BASE|AXP_OPCODE_EV5|AXP_OPCODE_BWX }, + /* Still same PALcodes? */ + { "21164pc", (AXP_OPCODE_BASE|AXP_OPCODE_EV5|AXP_OPCODE_BWX + |AXP_OPCODE_CIX|AXP_OPCODE_MAX) }, + /* All new PALcodes? Extras? */ + { "21264", (AXP_OPCODE_BASE|AXP_OPCODE_BWX + |AXP_OPCODE_CIX|AXP_OPCODE_MAX) }, + + { "ev4", AXP_OPCODE_BASE|AXP_OPCODE_EV4 }, + { "ev45", AXP_OPCODE_BASE|AXP_OPCODE_EV4 }, + { "lca45", AXP_OPCODE_BASE|AXP_OPCODE_EV4 }, + { "ev5", AXP_OPCODE_BASE|AXP_OPCODE_EV5 }, + { "ev56", AXP_OPCODE_BASE|AXP_OPCODE_EV5|AXP_OPCODE_BWX }, + { "pca56", (AXP_OPCODE_BASE|AXP_OPCODE_EV5|AXP_OPCODE_BWX + |AXP_OPCODE_CIX|AXP_OPCODE_MAX) }, + { "ev6", (AXP_OPCODE_BASE|AXP_OPCODE_BWX + |AXP_OPCODE_CIX|AXP_OPCODE_MAX) }, + + { "all", AXP_OPCODE_BASE }, { 0 } }; - + for (p = m; p->name; ++p) if (strcmp(arg, p->name) == 0) { @@ -624,13 +937,28 @@ } break; - default: - return 0; +#ifdef OBJ_EVAX + case '+': /* For g++. Hash any name > 63 chars long. */ + alpha_flag_hash_long_names = 1; + break; + + case 'H': /* Show new symbol after hash truncation */ + alpha_flag_show_after_trunc = 1; + break; + + case 'h': /* for gnu-c/vax compatibility. */ + break; +#endif + + default: + return 0; } return 1; } +/* Print a description of the command-line options that we accept. */ + void md_show_usage (stream) FILE *stream; @@ -639,12 +967,21 @@ Alpha options:\n\ -32addr treat addresses as 32-bit values\n\ -F lack floating point instructions support\n\ --m21064 | -m21066 | -m21164 | -m21164a | -m21264\n\ +-m21064 | -m21066 | -m21164 | -m21164a\n\ +-mev4 | -mev45 | -mev5 | -mev56 | -mall\n\ specify variant of Alpha architecture\n", stream); +#ifdef OBJ_EVAX + fputs ("\ +VMS options:\n\ +-+ hash encode (don't truncate) names longer than 64 characters\n\ +-H show new symbol after hash truncation\n", + stream); +#endif } -/* FIXME (inherited): @@ Is this right?? */ +/* Decide from what point a pc-relative relocation is relative to, + relative to the pc-relative fixup. Er, relatively speaking. */ long md_pcrel_from (fixP) @@ -662,6 +999,16 @@ } } +/* Attempt to simplify or even eliminate a fixup. The return value is + ignored; perhaps it was once meaningful, but now it is historical. + To indicate that a fixup has been eliminated, set fixP->fx_done. + + For ELF, here it is that we transform the GPDISP_HI16 reloc we used + internally into the GPDISP reloc used externally. We had to do + this so that we'd have the GPDISP_LO16 reloc as a tag to compute + the distance to the "lda" instruction for setting the addend to + GPDISP. */ + int md_apply_fix (fixP, valueP) fixS *fixP; @@ -682,7 +1029,7 @@ fixS *next = fixP->fx_next; assert (next->fx_r_type == BFD_RELOC_ALPHA_GPDISP_LO16); - fixP->fx_offset = (next->fx_frag->fr_address + next->fx_where + fixP->fx_offset = (next->fx_frag->fr_address + next->fx_where - fixP->fx_frag->fr_address - fixP->fx_where); value = (value - sign_extend_16 (value)) >> 16; @@ -760,24 +1107,29 @@ return 1; #endif #ifdef OBJ_ELF - case BFD_RELOC_ALPHA_LITERAL: + case BFD_RELOC_ALPHA_ELF_LITERAL: case BFD_RELOC_ALPHA_LITUSE: return 1; #endif +#ifdef OBJ_EVAX + case BFD_RELOC_ALPHA_LINKAGE: + case BFD_RELOC_ALPHA_CODEADDR: + return 1; +#endif default: { const struct alpha_operand *operand; - if (fixP->fx_r_type <= BFD_RELOC_UNUSED) + if ((int)fixP->fx_r_type >= 0) as_fatal ("unhandled relocation type %s", bfd_get_reloc_code_name (fixP->fx_r_type)); - assert (fixP->fx_r_type < BFD_RELOC_UNUSED + alpha_num_operands); - operand = &alpha_operands[fixP->fx_r_type - BFD_RELOC_UNUSED]; + assert (-(int)fixP->fx_r_type < alpha_num_operands); + operand = &alpha_operands[-(int)fixP->fx_r_type]; /* The rest of these fixups only exist internally during symbol - resolution and have no representation in the object file. + resolution and have no representation in the object file. Therefore they must be completely resolved as constants. */ if (fixP->fx_addsy != 0 @@ -797,10 +1149,10 @@ else { as_warn_where(fixP->fx_file, fixP->fx_line, - "type %d reloc done?\n", fixP->fx_r_type); + "type %d reloc done?\n", (int)fixP->fx_r_type); goto done; } - + write_done: md_number_to_chars(fixpos, image, 4); @@ -809,7 +1161,7 @@ return 0; } -/* +/* * Look for a register name in the given symbol. */ @@ -840,7 +1192,7 @@ num = name[0] - '0'; else if (name[0] != '0' && isdigit(name[1]) && name[2] == '\0') { - num = (name[0] - '0')*10 + name[1] - '0'; + num = (name[0] - '0') * 10 + name[1] - '0'; if (num >= 32) break; } @@ -875,6 +1227,8 @@ } #ifdef OBJ_ECOFF +/* @@@ Magic ECOFF bits. */ + void alpha_frob_ecoff_data () { @@ -885,11 +1239,9 @@ } #endif -void -alpha_flush_pending_output () -{ - alpha_insn_label = NULL; -} +/* Hook to remember a recently defined label so that the auto-align + code can adjust the symbol after we know what alignment will be + required. */ void alpha_define_label (sym) @@ -898,6 +1250,9 @@ alpha_insn_label = sym; } +/* Return true if we must always emit a reloc for a type and false if + there is some hope of resolving it a assembly time. */ + int alpha_force_relocation (f) fixS *f; @@ -907,9 +1262,18 @@ case BFD_RELOC_ALPHA_GPDISP_HI16: case BFD_RELOC_ALPHA_GPDISP_LO16: case BFD_RELOC_ALPHA_GPDISP: +#ifdef OBJ_ECOFF case BFD_RELOC_ALPHA_LITERAL: +#endif +#ifdef OBJ_ELF + case BFD_RELOC_ALPHA_ELF_LITERAL: +#endif case BFD_RELOC_ALPHA_LITUSE: case BFD_RELOC_GPREL32: +#ifdef OBJ_EVAX + case BFD_RELOC_ALPHA_LINKAGE: + case BFD_RELOC_ALPHA_CODEADDR: +#endif return 1; case BFD_RELOC_23_PCREL_S2: @@ -919,12 +1283,13 @@ return 0; default: - assert(f->fx_r_type > BFD_RELOC_UNUSED && - f->fx_r_type < BFD_RELOC_UNUSED + alpha_num_operands); + assert((int)f->fx_r_type < 0 && -(int)f->fx_r_type < alpha_num_operands); return 0; } } +/* Return true if we can partially resolve a relocation now. */ + int alpha_fix_adjustable (f) fixS *f; @@ -939,14 +1304,44 @@ but we can adjust the values contained within it? */ switch (f->fx_r_type) { + case BFD_RELOC_ALPHA_GPDISP_HI16: + case BFD_RELOC_ALPHA_GPDISP_LO16: + case BFD_RELOC_ALPHA_GPDISP: + return 0; + +#ifdef OBJ_ECOFF + case BFD_RELOC_ALPHA_LITERAL: +#endif +#ifdef OBJ_ELF + case BFD_RELOC_ALPHA_ELF_LITERAL: +#endif +#ifdef OBJ_EVAX + case BFD_RELOC_ALPHA_LINKAGE: + case BFD_RELOC_ALPHA_CODEADDR: +#endif + return 1; + + case BFD_RELOC_ALPHA_LITUSE: + return 0; + case BFD_RELOC_GPREL32: + case BFD_RELOC_23_PCREL_S2: + case BFD_RELOC_32: + case BFD_RELOC_64: + case BFD_RELOC_ALPHA_HINT: return 1; + default: - return !alpha_force_relocation (f); + assert ((int)f->fx_r_type < 0 + && - (int)f->fx_r_type < alpha_num_operands); + return 1; } /*NOTREACHED*/ } +/* Generate the BFD reloc to be stuck in the object file from the + fixup used internally in the assembler. */ + arelent * tc_gen_reloc (sec, fixp) asection *sec; @@ -954,11 +1349,14 @@ { arelent *reloc; - reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent)); + reloc = (arelent *) xmalloc (sizeof (arelent)); reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym; reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; - assert (fixp->fx_r_type < BFD_RELOC_UNUSED); + /* Make sure none of our internal relocations make it this far. + They'd better have been fully resolved by this point. */ + assert ((int)fixp->fx_r_type > 0); + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); if (reloc->howto == NULL) { @@ -986,7 +1384,7 @@ { reloc->addend = fixp->fx_offset; #ifdef OBJ_ELF - /* + /* * Ohhh, this is ugly. The problem is that if this is a local global * symbol, the relocation will entirely be performed at link time, not * at assembly time. bfd_perform_reloc doesn't know about this sort @@ -1000,6 +1398,12 @@ return reloc; } +/* Parse a register name off of the input_line and return a register + number. Gets md_undefined_symbol above to do the register name + matching for us. + + Only called as a part of processing the ECOFF .frame directive. */ + int tc_get_register (frame) int frame; @@ -1010,12 +1414,12 @@ if (*input_line_pointer == '$') { char *s = input_line_pointer; - char c = get_symbol_end(); - symbolS *sym = md_undefined_symbol(s); + char c = get_symbol_end (); + symbolS *sym = md_undefined_symbol (s); *strchr(s, '\0') = c; - if (sym && (framereg = S_GET_VALUE(sym)) <= 31) - goto found; + if (sym && (framereg = S_GET_VALUE (sym)) <= 31) + goto found; } as_warn ("frame reg expected, using $%d.", framereg); @@ -1024,10 +1428,26 @@ return framereg; } +/* This is called before the symbol table is processed. In order to + work with gcc when using mips-tfile, we must keep all local labels. + However, in other cases, we want to discard them. If we were + called with -g, but we didn't see any debugging information, it may + mean that gcc is smuggling debugging information through to + mips-tfile, in which case we must generate all local labels. */ + +#ifdef OBJ_ECOFF + +void +alpha_frob_file_before_adjust () +{ + if (alpha_debug != 0 + && ! ecoff_debugging_seen) + flag_keep_locals = 1; +} + +#endif /* OBJ_ECOFF */ -/* - * Parse the arguments to an opcode - */ +/* Parse the arguments to an opcode. */ static int tokenize_arguments (str, tok, ntok) @@ -1039,12 +1459,12 @@ char *old_input_line_pointer; int saw_comma = 0, saw_arg = 0; - memset (tok, 0, sizeof(*tok)*ntok); + memset (tok, 0, sizeof (*tok) * ntok); - /* Save and restore input_line_pointer around this function */ + /* Save and restore input_line_pointer around this function */ old_input_line_pointer = input_line_pointer; input_line_pointer = str; - + while (tok < end_tok && *input_line_pointer) { SKIP_WHITESPACE (); @@ -1105,10 +1525,8 @@ return -1; } -/* - * Search forward through all variants of an opcode - * looking for a syntax match. - */ +/* Search forward through all variants of an opcode looking for a + syntax match. */ static const struct alpha_opcode * find_opcode_match(first_opcode, tok, pntok, pcpumatch) @@ -1202,7 +1620,7 @@ match_failed:; } - while (++opcode-alpha_opcodes < alpha_num_opcodes + while (++opcode-alpha_opcodes < alpha_num_opcodes && !strcmp(opcode->name, first_opcode->name)); if (*pcpumatch) @@ -1211,10 +1629,8 @@ return NULL; } -/* - * Search forward through all variants of a macro - * looking for a syntax match. - */ +/* Search forward through all variants of a macro looking for a syntax + match. */ static const struct alpha_macro * find_macro_match(first_macro, tok, pntok) @@ -1280,7 +1696,7 @@ } ++tokidx; break; - + match_failed: while (*arg != MACRO_EOA) ++arg; @@ -1290,15 +1706,13 @@ ++arg; } } - while (++macro-alpha_macros < alpha_num_macros + while (++macro-alpha_macros < alpha_num_macros && !strcmp(macro->name, first_macro->name)); return NULL; } -/* - * Insert an operand value into an instruction. - */ +/* Insert an operand value into an instruction. */ static unsigned insert_operand(insn, operand, val, file, line) @@ -1325,9 +1739,9 @@ if (val < min || val > max) { - const char *err = + const char *err = "operand out of range (%s not between %d and %d)"; - char buf[sizeof(val)*3+2]; + char buf[sizeof (val) * 3 + 2]; sprint_value(buf, val); if (file) @@ -1341,9 +1755,9 @@ { const char *errmsg = NULL; - insn = (*operand->insert)(insn, val, &errmsg); + insn = (*operand->insert) (insn, val, &errmsg); if (errmsg) - as_warn(errmsg); + as_warn (errmsg); } else insn |= ((val & ((1 << operand->bits) - 1)) << operand->shift); @@ -1351,7 +1765,7 @@ return insn; } -/* +/* * Turn an opcode description and a set of arguments into * an instruction and a fixup. */ @@ -1367,7 +1781,7 @@ unsigned image; int tokidx = 0; - memset(insn, 0, sizeof(*insn)); + memset (insn, 0, sizeof (*insn)); image = opcode->opcode; for (argidx = opcode->operands; *argidx; ++argidx) @@ -1437,20 +1851,22 @@ insn->insn = image; } -/* +/* * Actually output an instruction with its fixup. */ static void -emit_insn(insn) +emit_insn (insn) struct alpha_insn *insn; { char *f; int i; /* Take care of alignment duties */ - if (alpha_auto_align_on) + if (alpha_auto_align_on && alpha_current_align < 2) alpha_align (2, (char *) NULL, alpha_insn_label); + if (alpha_current_align > 2) + alpha_current_align = 2; alpha_insn_label = NULL; /* Write out the instruction. */ @@ -1465,7 +1881,7 @@ fixS *fixP; /* Some fixups are only used internally and so have no howto */ - if (fixup->reloc > BFD_RELOC_UNUSED) + if ((int)fixup->reloc < 0) size = 4, pcrel = 0; #ifdef OBJ_ELF /* These relocation types are only used internally. */ @@ -1477,7 +1893,7 @@ #endif else { - reloc_howto_type *reloc_howto + reloc_howto_type *reloc_howto = bfd_reloc_type_lookup (stdoutput, fixup->reloc); assert (reloc_howto); @@ -1493,7 +1909,12 @@ switch (fixup->reloc) { case BFD_RELOC_ALPHA_GPDISP_LO16: +#ifdef OBJ_ECOFF case BFD_RELOC_ALPHA_LITERAL: +#endif +#ifdef OBJ_ELF + case BFD_RELOC_ALPHA_ELF_LITERAL: +#endif case BFD_RELOC_GPREL32: fixP->fx_no_overflow = 1; break; @@ -1503,10 +1924,11 @@ } } -/* - * Given an opcode name and a pre-tokenized set of arguments, - * assemble the insn, but do not emit it. - */ +/* Given an opcode name and a pre-tokenized set of arguments, assemble + the insn, but do not emit it. + + Note that this implies no macros allowed, since we can't store more + than one insn in an insn structure. */ static void assemble_tokens_to_insn(opname, tok, ntok, insn) @@ -1538,10 +1960,8 @@ as_bad ("unknown opcode `%s'", opname); } -/* - * Given an opcode name and a pre-tokenized set of arguments, - * take the opcode all the way through emission. - */ +/* Given an opcode name and a pre-tokenized set of arguments, take the + opcode all the way through emission. */ static void assemble_tokens (opname, tok, ntok, local_macros_on) @@ -1586,7 +2006,7 @@ return; } } - + if (found_something) if (cpumatch) as_bad ("inappropriate arguments for opcode `%s'", opname); @@ -1606,12 +2026,17 @@ static const char * const extXh_op[] = { NULL, "extwh", "extlh", "extqh" }; static const char * const mskXl_op[] = { "mskbl", "mskwl", "mskll", "mskql" }; static const char * const mskXh_op[] = { NULL, "mskwh", "msklh", "mskqh" }; +static const char * const stX_op[] = { "stb", "stw", "stl", "stq" }; +static const char * const ldX_op[] = { "ldb", "ldw", "ldll", "ldq" }; +static const char * const ldXu_op[] = { "ldbu", "ldwu", NULL, NULL }; + +/* Implement the ldgp macro. */ -static void +static void emit_ldgp (tok, ntok, unused) const expressionS *tok; int ntok; - void *unused; + const PTR unused; { #ifdef OBJ_AOUT FIXME @@ -1652,7 +2077,7 @@ emit_insn (&insn); set_tok_preg (newtok[2], tok[0].X_add_number); - + assemble_tokens_to_insn ("lda", newtok, 3, &insn); #ifdef OBJ_ECOFF @@ -1667,6 +2092,80 @@ #endif /* OBJ_ECOFF || OBJ_ELF */ } +#ifdef OBJ_EVAX + +/* Add symbol+addend to link pool. + Return offset from basesym to entry in link pool. + + Add new fixup only if offset isn't 16bit. */ + +valueT +add_to_link_pool (basesym, sym, addend) + symbolS *basesym; + symbolS *sym; + offsetT addend; +{ + segT current_section = now_seg; + int current_subsec = now_subseg; + valueT offset; + bfd_reloc_code_real_type reloc_type; + char *p; + segment_info_type *seginfo = seg_info (alpha_link_section); + fixS *fixp; + + offset = -basesym->sy_obj; + + /* @@ This assumes all entries in a given section will be of the same + size... Probably correct, but unwise to rely on. */ + /* This must always be called with the same subsegment. */ + + if (seginfo->frchainP) + for (fixp = seginfo->frchainP->fix_root; + fixp != (fixS *) NULL; + fixp = fixp->fx_next, offset += 8) + { + if (fixp->fx_addsy == sym && fixp->fx_offset == addend) + { + if (range_signed_16 (offset)) + { + return offset; + } + } + } + + /* Not found in 16bit signed range. */ + + subseg_set (alpha_link_section, 0); + p = frag_more (8); + memset (p, 0, 8); + + fix_new (frag_now, p - frag_now->fr_literal, 8, sym, addend, 0, + BFD_RELOC_64); + + subseg_set (current_section, current_subsec); + seginfo->literal_pool_size += 8; + return offset; +} + +#endif /* OBJ_EVAX */ + +/* Load a (partial) expression into a target register. + + If poffset is not null, after the call it will either contain + O_constant 0, or a 16-bit offset appropriate for any MEM format + instruction. In addition, pbasereg will be modified to point to + the base register to use in that MEM format instruction. + + In any case, *pbasereg should contain a base register to add to the + expression. This will normally be either AXP_REG_ZERO or + alpha_gp_register. Symbol addresses will always be loaded via $gp, + so "foo($0)" is interpreted as adding the address of foo to $0; + i.e. "ldq $targ, LIT($gp); addq $targ, $0, $targ". Odd, perhaps, + but this is what OSF/1 does. + + Finally, the return value is true if the calling macro may emit a + LITUSE reloc if otherwise appropriate. */ + static int load_expression (targreg, exp, pbasereg, poffset) int targreg; @@ -1714,7 +2213,7 @@ as_bad ("macro requires $at register while noat in effect"); if (targreg == AXP_REG_AT) as_bad ("macro requires $at while $at in use"); - + set_tok_reg (newtok[0], AXP_REG_AT); } else @@ -1736,7 +2235,7 @@ as_bad ("macro requires $at register while noat in effect"); if (targreg == AXP_REG_AT) as_bad ("macro requires $at while $at in use"); - + set_tok_reg (newtok[0], AXP_REG_AT); } else @@ -1758,10 +2257,64 @@ assemble_tokens_to_insn ("ldq", newtok, 3, &insn); assert (insn.nfixups == 1); - insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITERAL; + insn.fixups[0].reloc = BFD_RELOC_ALPHA_ELF_LITERAL; #endif /* OBJ_ELF */ +#ifdef OBJ_EVAX + offsetT link; + + if (alpha_basereg_clobbered) + { + /* no basereg, reload basreg from 0(FP). */ + set_tok_reg (newtok[0], targreg); + set_tok_const (newtok[1], 0); + set_tok_preg (newtok[2], AXP_REG_FP); + basereg = targreg; + assemble_tokens ("ldq", newtok, 3, 0); + } + + /* Find symbol or symbol pointer in link section. */ + + if (exp->X_add_symbol == alpha_evax_proc.symbol) + { + if (range_signed_16 (addend)) + { + set_tok_reg (newtok[0], targreg); + set_tok_const (newtok[1], addend); + set_tok_preg (newtok[2], basereg); + assemble_tokens_to_insn ("lda", newtok, 3, &insn); + addend = 0; + } + else + { + set_tok_reg (newtok[0], targreg); + set_tok_const (newtok[1], 0); + set_tok_preg (newtok[2], basereg); + assemble_tokens_to_insn ("lda", newtok, 3, &insn); + } + } + else + { + if (!range_signed_32 (addend)) + { + link = add_to_link_pool (alpha_evax_proc.symbol, + exp->X_add_symbol, addend); + addend = 0; + } + else + { + link = add_to_link_pool (alpha_evax_proc.symbol, + exp->X_add_symbol, 0); + } + set_tok_reg (newtok[0], targreg); + set_tok_const (newtok[1], link); + set_tok_preg (newtok[2], basereg); + assemble_tokens_to_insn ("ldq", newtok, 3, &insn); + } +#endif /* OBJ_EVAX */ emit_insn(&insn); + +#ifndef OBJ_EVAX emit_lituse = 1; if (basereg != alpha_gp_register && basereg != AXP_REG_ZERO) @@ -1772,6 +2325,7 @@ set_tok_reg (newtok[2], targreg); assemble_tokens ("addq", newtok, 3, 0); } +#endif basereg = targreg; } @@ -1803,18 +2357,35 @@ /* for 64-bit addends, just put it in the literal pool */ +#ifdef OBJ_EVAX + /* emit "ldq targreg, lit(basereg)" */ + lit = add_to_link_pool (alpha_evax_proc.symbol, + section_symbol (absolute_section), addend); + set_tok_reg (newtok[0], targreg); + set_tok_const (newtok[1], lit); + set_tok_preg (newtok[2], alpha_gp_register); + assemble_tokens ("ldq", newtok, 3, 0); +#else + if (alpha_lit8_section == NULL) { create_literal_section (".lit8", &alpha_lit8_section, &alpha_lit8_symbol); + +#ifdef OBJ_ECOFF + alpha_lit8_literal = add_to_literal_pool (alpha_lit8_symbol, 0x8000, + alpha_lita_section, 8); + if (alpha_lit8_literal >= 0x8000) + as_fatal ("overflow in literal (.lita) table"); +#endif } lit = add_to_literal_pool (NULL, addend, alpha_lit8_section, 8) - 0x8000; if (lit >= 0x8000) as_fatal ("overflow in literal (.lit8) table"); - /* emit "ldq litreg, .lit8+lit" */ + /* emit "lda litreg, .lit8+0x8000" */ if (targreg == basereg) { @@ -1827,9 +2398,46 @@ } else set_tok_reg (newtok[0], targreg); - set_tok_sym (newtok[1], alpha_lit8_symbol, lit); +#ifdef OBJ_ECOFF + set_tok_sym (newtok[1], alpha_lita_symbol, alpha_lit8_literal); +#endif +#ifdef OBJ_ELF + set_tok_sym (newtok[1], alpha_lit8_symbol, 0x8000); +#endif + set_tok_preg (newtok[2], alpha_gp_register); + + assemble_tokens_to_insn ("ldq", newtok, 3, &insn); + + assert (insn.nfixups == 1); +#ifdef OBJ_ECOFF + insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITERAL; +#endif +#ifdef OBJ_ELF + insn.fixups[0].reloc = BFD_RELOC_ALPHA_ELF_LITERAL; +#endif + + emit_insn (&insn); - assemble_tokens ("ldq", newtok, 2, 1); /* note this does recurse */ + /* emit "ldq litreg, lit(litreg)" */ + + set_tok_const (newtok[1], lit); + set_tok_preg (newtok[2], newtok[0].X_add_number); + + assemble_tokens_to_insn ("ldq", newtok, 3, &insn); + + assert (insn.nfixups < MAX_INSN_FIXUPS); + if (insn.nfixups > 0) + { + memmove (&insn.fixups[1], &insn.fixups[0], + sizeof(struct alpha_fixup) * insn.nfixups); + } + insn.nfixups++; + insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE; + insn.fixups[0].exp.X_op = O_constant; + insn.fixups[0].exp.X_add_number = 1; + emit_lituse = 0; + + emit_insn (&insn); /* emit "addq litreg, base, target" */ @@ -1839,6 +2447,7 @@ set_tok_reg (newtok[2], targreg); assemble_tokens ("addq", newtok, 3, 0); } +#endif /* !OBJ_EVAX */ if (poffset) set_tok_const (*poffset, 0); @@ -1900,11 +2509,15 @@ return emit_lituse; } +/* The lda macro differs from the lda instruction in that it handles + most simple expressions, particualrly symbol address loads and + large constants. */ + static void emit_lda (tok, ntok, unused) const expressionS *tok; int ntok; - void *unused; + const PTR unused; { int basereg; @@ -1916,11 +2529,14 @@ (void) load_expression (tok[0].X_add_number, &tok[1], &basereg, NULL); } +/* The ldah macro differs from the ldah instruction in that it has $31 + as an implied base register. */ + static void emit_ldah (tok, ntok, unused) const expressionS *tok; int ntok; - void *unused; + const PTR unused; { expressionS newtok[3]; @@ -1931,11 +2547,15 @@ assemble_tokens ("ldah", newtok, 3, 0); } +/* Handle all "simple" integer register loads -- ldq, ldq_l, ldq_u, + etc. They differ from the real instructions in that they do simple + expressions like the lda macro. */ + static void emit_ir_load (tok, ntok, opname) const expressionS *tok; int ntok; - void *opname; + const PTR opname; { int basereg, lituse; expressionS newtok[3]; @@ -1969,18 +2589,30 @@ } emit_insn (&insn); +#ifdef OBJ_EVAX + /* special hack. If the basereg is clobbered for a call + all lda's before the call don't have a basereg. */ + if ((tok[0].X_op == O_register) + && (tok[0].X_add_number == alpha_gp_register)) + { + alpha_basereg_clobbered = 1; + } +#endif } +/* Handle fp register loads, and both integer and fp register stores. + Again, we handle simple expressions. */ + static void emit_loadstore (tok, ntok, opname) const expressionS *tok; int ntok; - void *opname; + const PTR opname; { int basereg, lituse; expressionS newtok[3]; struct alpha_insn insn; - + if (ntok == 2) basereg = (tok[1].X_op == O_constant ? AXP_REG_ZERO : alpha_gp_register); else @@ -2021,52 +2653,64 @@ emit_insn (&insn); } -static void +/* Load a half-word or byte as an unsigned value. */ + +static void emit_ldXu (tok, ntok, vlgsize) const expressionS *tok; int ntok; - void *vlgsize; + const PTR vlgsize; { - expressionS newtok[3]; + if (alpha_target & AXP_OPCODE_BWX) + emit_ir_load (tok, ntok, ldXu_op[(long)vlgsize]); + else + { + expressionS newtok[3]; - if (alpha_noat_on) - as_bad ("macro requires $at register while noat in effect"); - - /* emit "lda $at, exp" */ + if (alpha_noat_on) + as_bad ("macro requires $at register while noat in effect"); - memcpy (newtok, tok, sizeof(expressionS)*ntok); - newtok[0].X_add_number = AXP_REG_AT; - assemble_tokens ("lda", newtok, ntok, 1); + /* emit "lda $at, exp" */ - /* emit "ldq_u targ, 0($at)" */ + memcpy (newtok, tok, sizeof (expressionS) * ntok); + newtok[0].X_add_number = AXP_REG_AT; + assemble_tokens ("lda", newtok, ntok, 1); - newtok[0] = tok[0]; - set_tok_const (newtok[1], 0); - set_tok_preg (newtok[2], AXP_REG_AT); - assemble_tokens ("ldq_u", newtok, 3, 1); + /* emit "ldq_u targ, 0($at)" */ - /* emit "extXl targ, $at, targ" */ + newtok[0] = tok[0]; + set_tok_const (newtok[1], 0); + set_tok_preg (newtok[2], AXP_REG_AT); + assemble_tokens ("ldq_u", newtok, 3, 1); - set_tok_reg (newtok[1], AXP_REG_AT); - newtok[2] = newtok[0]; - assemble_tokens (extXl_op[(long)vlgsize], newtok, 3, 1); + /* emit "extXl targ, $at, targ" */ + + set_tok_reg (newtok[1], AXP_REG_AT); + newtok[2] = newtok[0]; + assemble_tokens (extXl_op[(long)vlgsize], newtok, 3, 1); + } } -static void +/* Load a half-word or byte as a signed value. */ + +static void emit_ldX (tok, ntok, vlgsize) const expressionS *tok; int ntok; - void *vlgsize; + const PTR vlgsize; { emit_ldXu (tok, ntok, vlgsize); assemble_tokens (sextX_op[(long)vlgsize], tok, 1, 1); } +/* Load an integral value from an unaligned address as an unsigned + value. */ + static void emit_uldXu (tok, ntok, vlgsize) const expressionS *tok; int ntok; - void *vlgsize; + const PTR vlgsize; { long lgsize = (long)vlgsize; expressionS newtok[3]; @@ -2076,7 +2720,7 @@ /* emit "lda $at, exp" */ - memcpy (newtok, tok, sizeof(expressionS)*ntok); + memcpy (newtok, tok, sizeof (expressionS) * ntok); newtok[0].X_add_number = AXP_REG_AT; assemble_tokens ("lda", newtok, ntok, 1); @@ -2113,22 +2757,28 @@ newtok[2] = tok[0]; assemble_tokens ("or", newtok, 3, 1); } - + +/* Load an integral value from an unaligned address as a signed value. + Note that quads should get funneled to the unsigned load since we + don't have to do the sign extension. */ + static void emit_uldX (tok, ntok, vlgsize) const expressionS *tok; int ntok; - void *vlgsize; + const PTR vlgsize; { emit_uldXu (tok, ntok, vlgsize); assemble_tokens (sextX_op[(long)vlgsize], tok, 1, 1); } +/* Implement the ldil macro. */ + static void emit_ldil (tok, ntok, unused) const expressionS *tok; int ntok; - void *unused; + const PTR unused; { expressionS newtok[2]; @@ -2138,67 +2788,78 @@ assemble_tokens ("lda", newtok, ntok, 1); } +/* Store a half-word or byte. */ + static void emit_stX (tok, ntok, vlgsize) const expressionS *tok; - void *vlgsize; + int ntok; + const PTR vlgsize; { int lgsize = (int)(long)vlgsize; - expressionS newtok[3]; - if (alpha_noat_on) - as_bad("macro requires $at register while noat in effect"); + if (alpha_target & AXP_OPCODE_BWX) + emit_loadstore (tok, ntok, stX_op[lgsize]); + else + { + expressionS newtok[3]; - /* emit "lda $at, exp" */ + if (alpha_noat_on) + as_bad("macro requires $at register while noat in effect"); - memcpy (newtok, tok, sizeof(expressionS)*ntok); - newtok[0].X_add_number = AXP_REG_AT; - assemble_tokens ("lda", newtok, ntok, 1); + /* emit "lda $at, exp" */ - /* emit "ldq_u $t9, 0($at)" */ + memcpy (newtok, tok, sizeof (expressionS) * ntok); + newtok[0].X_add_number = AXP_REG_AT; + assemble_tokens ("lda", newtok, ntok, 1); - set_tok_reg (newtok[0], AXP_REG_T9); - set_tok_const (newtok[1], 0); - set_tok_preg (newtok[2], AXP_REG_AT); - assemble_tokens ("ldq_u", newtok, 3, 1); + /* emit "ldq_u $t9, 0($at)" */ - /* emit "insXl src, $at, $t10" */ + set_tok_reg (newtok[0], AXP_REG_T9); + set_tok_const (newtok[1], 0); + set_tok_preg (newtok[2], AXP_REG_AT); + assemble_tokens ("ldq_u", newtok, 3, 1); - newtok[0] = tok[0]; - set_tok_reg (newtok[1], AXP_REG_AT); - set_tok_reg (newtok[2], AXP_REG_T10); - assemble_tokens (insXl_op[lgsize], newtok, 3, 1); + /* emit "insXl src, $at, $t10" */ - /* emit "mskXl $t9, $at, $t9" */ + newtok[0] = tok[0]; + set_tok_reg (newtok[1], AXP_REG_AT); + set_tok_reg (newtok[2], AXP_REG_T10); + assemble_tokens (insXl_op[lgsize], newtok, 3, 1); - set_tok_reg (newtok[0], AXP_REG_T9); - newtok[2] = newtok[0]; - assemble_tokens (mskXl_op[lgsize], newtok, 3, 1); + /* emit "mskXl $t9, $at, $t9" */ - /* emit "or $t9, $t10, $t9" */ + set_tok_reg (newtok[0], AXP_REG_T9); + newtok[2] = newtok[0]; + assemble_tokens (mskXl_op[lgsize], newtok, 3, 1); - set_tok_reg (newtok[1], AXP_REG_T10); - assemble_tokens ("or", newtok, 3, 1); + /* emit "or $t9, $t10, $t9" */ - /* emit "stq_u $t9, 0($at) */ + set_tok_reg (newtok[1], AXP_REG_T10); + assemble_tokens ("or", newtok, 3, 1); - set_tok_const (newtok[1], 0); - set_tok_preg (newtok[2], AXP_REG_AT); - assemble_tokens ("stq_u", newtok, 3, 1); + /* emit "stq_u $t9, 0($at) */ + + set_tok_const (newtok[1], 0); + set_tok_preg (newtok[2], AXP_REG_AT); + assemble_tokens ("stq_u", newtok, 3, 1); + } } +/* Store an integer to an unaligned address. */ + static void emit_ustX (tok, ntok, vlgsize) const expressionS *tok; int ntok; - void *vlgsize; + const PTR vlgsize; { int lgsize = (int)(long)vlgsize; expressionS newtok[3]; /* emit "lda $at, exp" */ - memcpy (newtok, tok, sizeof(expressionS)*ntok); + memcpy (newtok, tok, sizeof (expressionS) * ntok); newtok[0].X_add_number = AXP_REG_AT; assemble_tokens ("lda", newtok, ntok, 1); @@ -2267,33 +2928,150 @@ assemble_tokens ("stq_u", newtok, 3, 1); } +/* Sign extend a half-word or byte. The 32-bit sign extend is + implemented as "addl $31, $r, $t" in the opcode table. */ + static void emit_sextX (tok, ntok, vlgsize) const expressionS *tok; int ntok; - void *vlgsize; + const PTR vlgsize; { - int bitshift = 64 - 8*(1 << (long)vlgsize); - expressionS newtok[3]; + long lgsize = (long)vlgsize; - /* emit "sll src,bits,dst" */ + if (alpha_target & AXP_OPCODE_BWX) + assemble_tokens (sextX_op[lgsize], tok, ntok, 0); + else + { + int bitshift = 64 - 8 * (1 << lgsize); + expressionS newtok[3]; - newtok[0] = tok[0]; - set_tok_const (newtok[1], bitshift); - newtok[2] = tok[ntok - 1]; - assemble_tokens ("sll", newtok, 3, 1); + /* emit "sll src,bits,dst" */ + + newtok[0] = tok[0]; + set_tok_const (newtok[1], bitshift); + newtok[2] = tok[ntok - 1]; + assemble_tokens ("sll", newtok, 3, 1); - /* emit "sra dst,bits,dst" */ + /* emit "sra dst,bits,dst" */ - newtok[0] = newtok[2]; - assemble_tokens ("sra", newtok, 3, 1); + newtok[0] = newtok[2]; + assemble_tokens ("sra", newtok, 3, 1); + } } -static void -emit_division (tok, ntok, symname) - const expressionS *tok; - int ntok; - void *symname; +/* Implement the division and modulus macros. */ + +#ifdef OBJ_EVAX + +/* Make register usage like in normal procedure call. + Don't clobber PV and RA. */ + +static void +emit_division (tok, ntok, symname) + const expressionS *tok; + int ntok; + const PTR symname; +{ + /* DIVISION and MODULUS. Yech. + * + * Convert + * OP x,y,result + * to + * mov x,R16 # if x != R16 + * mov y,R17 # if y != R17 + * lda AT,__OP + * jsr AT,(AT),0 + * mov R0,result + * + * with appropriate optimizations if R0,R16,R17 are the registers + * specified by the compiler. + */ + + int xr, yr, rr; + symbolS *sym; + expressionS newtok[3]; + + xr = regno (tok[0].X_add_number); + yr = regno (tok[1].X_add_number); + + if (ntok < 3) + rr = xr; + else + rr = regno (tok[2].X_add_number); + + /* Move the operands into the right place */ + if (yr == AXP_REG_R16 && xr == AXP_REG_R17) + { + /* They are in exactly the wrong order -- swap through AT */ + + if (alpha_noat_on) + as_bad ("macro requires $at register while noat in effect"); + + set_tok_reg (newtok[0], AXP_REG_R16); + set_tok_reg (newtok[1], AXP_REG_AT); + assemble_tokens ("mov", newtok, 2, 1); + + set_tok_reg (newtok[0], AXP_REG_R17); + set_tok_reg (newtok[1], AXP_REG_R16); + assemble_tokens ("mov", newtok, 2, 1); + + set_tok_reg (newtok[0], AXP_REG_AT); + set_tok_reg (newtok[1], AXP_REG_R17); + assemble_tokens ("mov", newtok, 2, 1); + } + else + { + if (yr == AXP_REG_R16) + { + set_tok_reg (newtok[0], AXP_REG_R16); + set_tok_reg (newtok[1], AXP_REG_R17); + assemble_tokens ("mov", newtok, 2, 1); + } + + if (xr != AXP_REG_R16) + { + set_tok_reg (newtok[0], xr); + set_tok_reg (newtok[1], AXP_REG_R16); + assemble_tokens ("mov", newtok, 2, 1); + } + + if (yr != AXP_REG_R16 && yr != AXP_REG_R17) + { + set_tok_reg (newtok[0], yr); + set_tok_reg (newtok[1], AXP_REG_R17); + assemble_tokens ("mov", newtok, 2, 1); + } + } + + sym = symbol_find_or_make ((const char *)symname); + + set_tok_reg (newtok[0], AXP_REG_AT); + set_tok_sym (newtok[1], sym, 0); + assemble_tokens ("lda", newtok, 2, 1); + + /* Call the division routine */ + set_tok_reg (newtok[0], AXP_REG_AT); + set_tok_cpreg (newtok[1], AXP_REG_AT); + set_tok_const (newtok[2], 0); + assemble_tokens ("jsr", newtok, 3, 1); + + /* Move the result to the right place */ + if (rr != AXP_REG_R0) + { + set_tok_reg (newtok[0], AXP_REG_R0); + set_tok_reg (newtok[1], rr); + assemble_tokens ("mov", newtok, 2, 1); + } +} + +#else /* !OBJ_EVAX */ + +static void +emit_division (tok, ntok, symname) + const expressionS *tok; + int ntok; + const PTR symname; { /* DIVISION and MODULUS. Yech. * Convert @@ -2306,7 +3084,7 @@ * mov t12,result * * with appropriate optimizations if t10,t11,t12 are the registers - * specified by the compiler. + * specified by the compiler. */ int xr, yr, rr; @@ -2315,7 +3093,7 @@ xr = regno (tok[0].X_add_number); yr = regno (tok[1].X_add_number); - + if (ntok < 3) rr = xr; else @@ -2392,11 +3170,17 @@ } } +#endif /* !OBJ_EVAX */ + +/* The jsr and jmp macros differ from their instruction counterparts + in that they can load the target address and default most + everything. */ + static void emit_jsrjmp (tok, ntok, vopname) const expressionS *tok; int ntok; - void *vopname; + const PTR vopname; { const char *opname = (const char *) vopname; struct alpha_insn insn; @@ -2413,17 +3197,25 @@ if (tokidx < ntok && (tok[tokidx].X_op == O_pregister || tok[tokidx].X_op == O_cpregister)) r = regno (tok[tokidx++].X_add_number); +#ifdef OBJ_EVAX + /* keep register if jsr $n. */ +#else else { int basereg = alpha_gp_register; lituse = load_expression (r = AXP_REG_PV, &tok[tokidx], &basereg, NULL); } +#endif set_tok_cpreg (newtok[1], r); +#ifdef OBJ_EVAX + /* FIXME: Add hint relocs to BFD for evax. */ +#else if (tokidx < ntok) newtok[2] = tok[tokidx]; else +#endif set_tok_const (newtok[2], 0); assemble_tokens_to_insn (opname, newtok, 3, &insn); @@ -2444,13 +3236,29 @@ } emit_insn (&insn); + +#ifdef OBJ_EVAX + alpha_basereg_clobbered = 0; + + /* reload PV from 0(FP) if it is our current base register. */ + if (alpha_gp_register == AXP_REG_PV) + { + set_tok_reg (newtok[0], AXP_REG_PV); + set_tok_const (newtok[1], 0); + set_tok_preg (newtok[2], AXP_REG_FP); + assemble_tokens ("ldq", newtok, 3, 0); + } +#endif } +/* The ret and jcr instructions differ from their instruction + counterparts in that everything can be defaulted. */ + static void emit_retjcr (tok, ntok, vopname) const expressionS *tok; int ntok; - void *vopname; + const PTR vopname; { const char *opname = (const char *)vopname; expressionS newtok[3]; @@ -2481,10 +3289,8 @@ /* Assembler directives */ -/* - * Handle the .text pseudo-op. This is like the usual one, but it - * clears alpha_insn_label and restores auto alignment. - */ +/* Handle the .text pseudo-op. This is like the usual one, but it + clears alpha_insn_label and restores auto alignment. */ static void s_alpha_text (i) @@ -2494,12 +3300,11 @@ s_text (i); alpha_insn_label = NULL; alpha_auto_align_on = 1; -} + alpha_current_align = 0; +} -/* - * Handle the .data pseudo-op. This is like the usual one, but it - * clears alpha_insn_label and restores auto alignment. - */ +/* Handle the .data pseudo-op. This is like the usual one, but it + clears alpha_insn_label and restores auto alignment. */ static void s_alpha_data (i) @@ -2508,9 +3313,12 @@ s_data (i); alpha_insn_label = NULL; alpha_auto_align_on = 1; -} + alpha_current_align = 0; +} -#ifndef OBJ_ELF +#ifdef OBJ_ECOFF + +/* Handle the OSF/1 .comm pseudo quirks. */ static void s_alpha_comm (ignore) @@ -2548,12 +3356,13 @@ symbolP = symbol_find_or_make (name); *p = c; - if (S_IS_DEFINED (symbolP)) + if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) { as_bad ("Ignoring attempt to re-define symbol"); ignore_rest_of_line (); return; } + if (S_GET_VALUE (symbolP)) { if (S_GET_VALUE (symbolP) != (valueT) temp) @@ -2569,10 +3378,16 @@ } know (symbolP->sy_frag == &zero_address_frag); + demand_empty_rest_of_line (); } -#endif +#endif /* ! OBJ_ELF */ + +#ifdef OBJ_ECOFF + +/* Handle the .rdata pseudo-op. This is like the usual one, but it + clears alpha_insn_label and restores auto alignment. */ static void s_alpha_rdata (ignore) @@ -2585,8 +3400,16 @@ demand_empty_rest_of_line (); alpha_insn_label = NULL; alpha_auto_align_on = 1; + alpha_current_align = 0; } +#endif + +#ifdef OBJ_ECOFF + +/* Handle the .sdata pseudo-op. This is like the usual one, but it + clears alpha_insn_label and restores auto alignment. */ + static void s_alpha_sdata (ignore) int ignore; @@ -2598,159 +3421,649 @@ demand_empty_rest_of_line (); alpha_insn_label = NULL; alpha_auto_align_on = 1; + alpha_current_align = 0; } +#endif + +#ifdef OBJ_ELF + +/* Handle the .section pseudo-op. This is like the usual one, but it + clears alpha_insn_label and restores auto alignment. */ static void -s_alpha_gprel32 (ignore) +s_alpha_section (ignore) int ignore; { - expressionS e; - char *p; + obj_elf_section (ignore); - SKIP_WHITESPACE (); - expression (&e); + alpha_insn_label = NULL; + alpha_auto_align_on = 1; + alpha_current_align = 0; +} -#ifdef OBJ_ELF - switch (e.X_op) - { - case O_constant: - e.X_add_symbol = section_symbol(absolute_section); - e.X_op = O_symbol; - /* FALLTHRU */ - case O_symbol: - break; - default: - abort(); - } -#else - switch (e.X_op) - { - case O_constant: - e.X_add_symbol = section_symbol (absolute_section); - /* fall through */ - case O_symbol: - e.X_op = O_subtract; - e.X_op_symbol = alpha_gp_symbol; - break; - default: - abort (); - } #endif - if (alpha_auto_align_on) - alpha_align (2, (char *) NULL, alpha_insn_label); - alpha_insn_label = NULL; +#ifdef OBJ_EVAX + +/* Handle the section specific pseudo-op. */ + +static void +s_alpha_section (secid) + int secid; +{ + int temp; +#define EVAX_SECTION_COUNT 6 + static char *section_name[EVAX_SECTION_COUNT+1] = + { "NULL", ".rdata", ".comm", ".link", ".ctors", ".dtors", ".lcomm" }; - p = frag_more (4); - memset (p, 0, 4); - fix_new_exp (frag_now, p-frag_now->fr_literal, 4, - &e, 0, BFD_RELOC_GPREL32); + if ((secid <= 0) || (secid > EVAX_SECTION_COUNT)) + { + as_fatal ("Unknown section directive"); + demand_empty_rest_of_line (); + return; + } + temp = get_absolute_expression (); + subseg_new (section_name[secid], 0); + demand_empty_rest_of_line (); + alpha_insn_label = NULL; + alpha_auto_align_on = 1; + alpha_current_align = 0; } -/* - * Handle floating point allocation pseudo-ops. This is like the - * generic vresion, but it makes sure the current label, if any, is - * correctly aligned. - */ + +/* .prologue */ static void -s_alpha_float_cons (type) - int type; +s_alpha_prologue (ignore) + int ignore; { - if (alpha_auto_align_on) - { - int log_size; + alpha_basereg_clobbered = 0; + demand_empty_rest_of_line (); - switch (type) - { - default: - case 'f': - case 'F': - log_size = 2; - break; + return; +} - case 'd': - case 'D': - case 'G': - log_size = 3; - break; - case 'x': - case 'X': - case 'p': - case 'P': - log_size = 4; - break; - } +/* Parse .ent directives. */ + +static void +s_alpha_ent (ignore) + int ignore; +{ + symbolS *symbol; + expressionS symexpr; + + alpha_evax_proc.pdsckind = 0; + alpha_evax_proc.framereg = -1; + alpha_evax_proc.framesize = 0; + alpha_evax_proc.rsa_offset = 0; + alpha_evax_proc.ra_save = AXP_REG_RA; + alpha_evax_proc.fp_save = -1; + alpha_evax_proc.imask = 0; + alpha_evax_proc.fmask = 0; + alpha_evax_proc.prologue = 0; + alpha_evax_proc.type = 0; + + expression (&symexpr); - alpha_align (log_size, (char *) NULL, alpha_insn_label); + if (symexpr.X_op != O_symbol) + { + as_fatal (".ent directive has no symbol"); + demand_empty_rest_of_line (); + return; } - alpha_insn_label = NULL; - float_cons (type); + symbol = make_expr_symbol (&symexpr); + symbol->bsym->flags |= BSF_FUNCTION; + alpha_evax_proc.symbol = symbol; + + demand_empty_rest_of_line (); + return; } + +/* Parse .frame ,,RA, directives. */ + static void -s_alpha_proc (is_static) - int is_static; +s_alpha_frame (ignore) + int ignore; { - /* XXXX Align to cache linesize XXXXX */ - char *name; - char c; - char *p; - symbolS *symbolP; - int temp; + long val; + + alpha_evax_proc.framereg = tc_get_register (1); - /* Takes ".proc name,nargs" */ - name = input_line_pointer; - c = get_symbol_end (); - p = input_line_pointer; - symbolP = symbol_find_or_make (name); - *p = c; SKIP_WHITESPACE (); - if (*input_line_pointer != ',') + if (*input_line_pointer++ != ',' + || get_absolute_expression_and_terminator (&val) != ',') { - *p = 0; - as_warn ("Expected comma after name \"%s\"", name); - *p = c; - temp = 0; - ignore_rest_of_line (); + as_warn ("Bad .frame directive 1./2. param"); + --input_line_pointer; + demand_empty_rest_of_line (); + return; } - else + + alpha_evax_proc.framesize = val; + + (void) tc_get_register (1); + SKIP_WHITESPACE (); + if (*input_line_pointer++ != ',') { - input_line_pointer++; - temp = get_absolute_expression (); + as_warn ("Bad .frame directive 3./4. param"); + --input_line_pointer; + demand_empty_rest_of_line (); + return; } - /* symbolP->sy_other = (signed char) temp; */ - as_warn ("unhandled: .proc %s,%d", name, temp); - demand_empty_rest_of_line (); + alpha_evax_proc.rsa_offset = get_absolute_expression (); + + return; } static void -s_alpha_set (x) - int x; +s_alpha_pdesc (ignore) + int ignore; { - char *name = input_line_pointer, ch, *s; - int yesno = 1; + char *name; + char name_end; + long val; + register char *p; + expressionS exp; + symbolS *entry_sym; + fixS *fixp; + segment_info_type *seginfo = seg_info (alpha_link_section); - while (!is_end_of_line[(unsigned char) *input_line_pointer]) - input_line_pointer++; - ch = *input_line_pointer; - *input_line_pointer = '\0'; + if (now_seg != alpha_link_section) + { + as_bad (".pdesc directive not in link (.link) section"); + demand_empty_rest_of_line (); + return; + } - s = name; - if (s[0] == 'n' && s[1] == 'o') + if ((alpha_evax_proc.symbol == 0) + || (!S_IS_DEFINED (alpha_evax_proc.symbol))) { - yesno = 0; - s += 2; + as_fatal (".pdesc has no matching .ent"); + demand_empty_rest_of_line (); + return; } - if (!strcmp ("reorder", s)) - /* ignore */ ; - else if (!strcmp ("at", s)) - alpha_noat_on = !yesno; - else if (!strcmp ("macro", s)) - alpha_macros_on = yesno; - else if (!strcmp ("move", s)) + + alpha_evax_proc.symbol->sy_obj = (valueT)seginfo->literal_pool_size; + + expression (&exp); + if (exp.X_op != O_symbol) + { + as_warn (".pdesc directive has no entry symbol"); + demand_empty_rest_of_line (); + return; + } + + entry_sym = make_expr_symbol (&exp); + /* Save bfd symbol of proc desc in function symbol. */ + alpha_evax_proc.symbol->bsym->udata.p = (PTR)entry_sym->bsym; + + SKIP_WHITESPACE (); + if (*input_line_pointer++ != ',') + { + as_warn ("No comma after .pdesc "); + demand_empty_rest_of_line (); + return; + } + + SKIP_WHITESPACE (); + name = input_line_pointer; + name_end = get_symbol_end (); + + if (strncmp(name, "stack", 5) == 0) + { + alpha_evax_proc.pdsckind = PDSC_S_K_KIND_FP_STACK; + } + else if (strncmp(name, "reg", 3) == 0) + { + alpha_evax_proc.pdsckind = PDSC_S_K_KIND_FP_REGISTER; + } + else if (strncmp(name, "null", 4) == 0) + { + alpha_evax_proc.pdsckind = PDSC_S_K_KIND_NULL; + } + else + { + as_fatal ("unknown procedure kind"); + demand_empty_rest_of_line (); + return; + } + + *input_line_pointer = name_end; + demand_empty_rest_of_line (); + +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + + frag_align (3, 0, 0); + p = frag_more (16); + fixp = fix_new (frag_now, p - frag_now->fr_literal, 8, 0, 0, 0, 0); + fixp->fx_done = 1; + seginfo->literal_pool_size += 16; + + *p = alpha_evax_proc.pdsckind + | ((alpha_evax_proc.framereg == 29) ? PDSC_S_M_BASE_REG_IS_FP : 0); + *(p+1) = PDSC_S_M_NATIVE + | PDSC_S_M_NO_JACKET; + + switch (alpha_evax_proc.pdsckind) + { + case PDSC_S_K_KIND_NULL: + *(p+2) = 0; + *(p+3) = 0; + break; + case PDSC_S_K_KIND_FP_REGISTER: + *(p+2) = alpha_evax_proc.fp_save; + *(p+3) = alpha_evax_proc.ra_save; + break; + case PDSC_S_K_KIND_FP_STACK: + md_number_to_chars (p+2, (valueT)alpha_evax_proc.rsa_offset, 2); + break; + default: /* impossible */ + break; + } + + *(p+4) = 0; + *(p+5) = alpha_evax_proc.type & 0x0f; + + /* Signature offset. */ + md_number_to_chars (p+6, (valueT)0, 2); + + fix_new_exp (frag_now, p-frag_now->fr_literal+8, 8, &exp, 0, BFD_RELOC_64); + + if (alpha_evax_proc.pdsckind == PDSC_S_K_KIND_NULL) + return; + + /* Add dummy fix to make add_to_link_pool work. */ + p = frag_more (8); + fixp = fix_new (frag_now, p - frag_now->fr_literal, 8, 0, 0, 0, 0); + fixp->fx_done = 1; + seginfo->literal_pool_size += 8; + + /* pdesc+16: Size. */ + md_number_to_chars (p, (valueT)alpha_evax_proc.framesize, 4); + + md_number_to_chars (p+4, (valueT)0, 2); + + /* Entry length. */ + md_number_to_chars (p+6, alpha_evax_proc.prologue, 2); + + if (alpha_evax_proc.pdsckind == PDSC_S_K_KIND_FP_REGISTER) + return; + + /* Add dummy fix to make add_to_link_pool work. */ + p = frag_more (8); + fixp = fix_new (frag_now, p - frag_now->fr_literal, 8, 0, 0, 0, 0); + fixp->fx_done = 1; + seginfo->literal_pool_size += 8; + + /* pdesc+24: register masks. */ + + md_number_to_chars (p, alpha_evax_proc.imask, 4); + md_number_to_chars (p+4, alpha_evax_proc.fmask, 4); + + return; +} + + +/* Support for crash debug on vms. */ + +static void +s_alpha_name (ignore) + int ignore; +{ + register char *p; + expressionS exp; + segment_info_type *seginfo = seg_info (alpha_link_section); + + if (now_seg != alpha_link_section) + { + as_bad (".name directive not in link (.link) section"); + demand_empty_rest_of_line (); + return; + } + + expression (&exp); + if (exp.X_op != O_symbol) + { + as_warn (".name directive has no symbol"); + demand_empty_rest_of_line (); + return; + } + + demand_empty_rest_of_line (); + +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + + frag_align (3, 0, 0); + p = frag_more (8); + seginfo->literal_pool_size += 8; + + fix_new_exp (frag_now, p-frag_now->fr_literal, 8, &exp, 0, BFD_RELOC_64); + + return; +} + + +static void +s_alpha_linkage (ignore) + int ignore; +{ + expressionS exp; + char *p; + +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + + expression (&exp); + if (exp.X_op != O_symbol) + { + as_fatal ("No symbol after .linkage"); + } + else + { + p = frag_more (LKP_S_K_SIZE); + memset (p, 0, LKP_S_K_SIZE); + fix_new_exp (frag_now, p - frag_now->fr_literal, LKP_S_K_SIZE, &exp, 0,\ + BFD_RELOC_ALPHA_LINKAGE); + } + demand_empty_rest_of_line (); + + return; +} + + +static void +s_alpha_code_address (ignore) + int ignore; +{ + expressionS exp; + char *p; + +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + + expression (&exp); + if (exp.X_op != O_symbol) + { + as_fatal ("No symbol after .code_address"); + } + else + { + p = frag_more (8); + memset (p, 0, 8); + fix_new_exp (frag_now, p - frag_now->fr_literal, 8, &exp, 0,\ + BFD_RELOC_ALPHA_CODEADDR); + } + demand_empty_rest_of_line (); + + return; +} + + +static void +s_alpha_fp_save (ignore) + int ignore; +{ + + alpha_evax_proc.fp_save = tc_get_register (1); + + demand_empty_rest_of_line (); + return; +} + + +static void +s_alpha_mask (ignore) + int ignore; +{ + long val; + + if (get_absolute_expression_and_terminator (&val) != ',') + { + as_warn ("Bad .mask directive"); + --input_line_pointer; + } + else + { + alpha_evax_proc.imask = val; + (void)get_absolute_expression (); + } + demand_empty_rest_of_line (); + + return; +} + + +static void +s_alpha_fmask (ignore) + int ignore; +{ + long val; + + if (get_absolute_expression_and_terminator (&val) != ',') + { + as_warn ("Bad .fmask directive"); + --input_line_pointer; + } + else + { + alpha_evax_proc.fmask = val; + (void) get_absolute_expression (); + } + demand_empty_rest_of_line (); + + return; +} + +static void +s_alpha_end (ignore) + int ignore; +{ + char c; + + c = get_symbol_end (); + *input_line_pointer = c; + demand_empty_rest_of_line (); + alpha_evax_proc.symbol = 0; + alpha_basereg_clobbered = 0; + + return; +} + + +static void +s_alpha_file (ignore) + int ignore; +{ + symbolS *s; + int length; + static char case_hack[32]; + + extern char *demand_copy_string PARAMS ((int *lenP)); + + sprintf (case_hack, "", + alpha_flag_hash_long_names, alpha_flag_show_after_trunc); + + s = symbol_find_or_make (case_hack); + s->bsym->flags |= BSF_FILE; + + get_absolute_expression (); + s = symbol_find_or_make (demand_copy_string (&length)); + s->bsym->flags |= BSF_FILE; + demand_empty_rest_of_line (); + + return; +} +#endif /* OBJ_EVAX */ + +/* Handle the .gprel32 pseudo op. */ + +static void +s_alpha_gprel32 (ignore) + int ignore; +{ + expressionS e; + char *p; + + SKIP_WHITESPACE (); + expression (&e); + +#ifdef OBJ_ELF + switch (e.X_op) + { + case O_constant: + e.X_add_symbol = section_symbol(absolute_section); + e.X_op = O_symbol; + /* FALLTHRU */ + case O_symbol: + break; + default: + abort(); + } +#else +#ifdef OBJ_ECOFF + switch (e.X_op) + { + case O_constant: + e.X_add_symbol = section_symbol (absolute_section); + /* fall through */ + case O_symbol: + e.X_op = O_subtract; + e.X_op_symbol = alpha_gp_symbol; + break; + default: + abort (); + } +#endif +#endif + + if (alpha_auto_align_on && alpha_current_align < 2) + alpha_align (2, (char *) NULL, alpha_insn_label); + if (alpha_current_align > 2) + alpha_current_align = 2; + alpha_insn_label = NULL; + + p = frag_more (4); + memset (p, 0, 4); + fix_new_exp (frag_now, p-frag_now->fr_literal, 4, + &e, 0, BFD_RELOC_GPREL32); +} + +/* Handle floating point allocation pseudo-ops. This is like the + generic vresion, but it makes sure the current label, if any, is + correctly aligned. */ + +static void +s_alpha_float_cons (type) + int type; +{ + int log_size; + + switch (type) + { + default: + case 'f': + case 'F': + log_size = 2; + break; + + case 'd': + case 'D': + case 'G': + log_size = 3; + break; + + case 'x': + case 'X': + case 'p': + case 'P': + log_size = 4; + break; + } + + if (alpha_auto_align_on && alpha_current_align < log_size) + alpha_align (log_size, (char *) NULL, alpha_insn_label); + if (alpha_current_align > log_size) + alpha_current_align = log_size; + alpha_insn_label = NULL; + + float_cons (type); +} + +/* Handle the .proc pseudo op. We don't really do much with it except + parse it. */ + +static void +s_alpha_proc (is_static) + int is_static; +{ + char *name; + char c; + char *p; + symbolS *symbolP; + int temp; + + /* Takes ".proc name,nargs" */ + name = input_line_pointer; + c = get_symbol_end (); + p = input_line_pointer; + symbolP = symbol_find_or_make (name); + *p = c; + SKIP_WHITESPACE (); + if (*input_line_pointer != ',') + { + *p = 0; + as_warn ("Expected comma after name \"%s\"", name); + *p = c; + temp = 0; + ignore_rest_of_line (); + } + else + { + input_line_pointer++; + temp = get_absolute_expression (); + } + /* symbolP->sy_other = (signed char) temp; */ + as_warn ("unhandled: .proc %s,%d", name, temp); + demand_empty_rest_of_line (); +} + +/* Handle the .set pseudo op. This is used to turn on and off most of + the assembler features. */ + +static void +s_alpha_set (x) + int x; +{ + char *name = input_line_pointer, ch, *s; + int yesno = 1; + + while (!is_end_of_line[(unsigned char) *input_line_pointer]) + input_line_pointer++; + ch = *input_line_pointer; + *input_line_pointer = '\0'; + + s = name; + if (s[0] == 'n' && s[1] == 'o') + { + yesno = 0; + s += 2; + } + if (!strcmp ("reorder", s)) + /* ignore */ ; + else if (!strcmp ("at", s)) + alpha_noat_on = !yesno; + else if (!strcmp ("macro", s)) + alpha_macros_on = yesno; + else if (!strcmp ("move", s)) /* ignore */ ; else if (!strcmp ("volatile", s)) /* ignore */ ; @@ -2761,6 +4074,9 @@ demand_empty_rest_of_line (); } +/* Handle the .base pseudo op. This changes the assembler's notion of + the $gp register. */ + static void s_alpha_base (ignore) int ignore; @@ -2792,11 +4108,9 @@ demand_empty_rest_of_line (); } -/* - * Handle the .align pseudo-op. This aligns to a power of two. It - * also adjusts any current instruction label. We treat this the same - * way the MIPS port does: .align 0 turns off auto alignment. - */ +/* Handle the .align pseudo-op. This aligns to a power of two. It + also adjusts any current instruction label. We treat this the same + way the MIPS port does: .align 0 turns off auto alignment. */ static void s_alpha_align (ignore) @@ -2840,264 +4154,117 @@ demand_empty_rest_of_line (); } -/* - * Handle data allocation pseudo-ops. This is like the generic - * version, but it makes sure the current label, if any, is correctly - * aligned. - */ +/* Hook the normal string processor to reset known alignment. */ static void -s_alpha_cons (log_size) - int log_size; +s_alpha_stringer (terminate) + int terminate; { - if (alpha_auto_align_on && log_size > 0) - alpha_align (log_size, (char *) NULL, alpha_insn_label); + alpha_current_align = 0; alpha_insn_label = NULL; - cons (1 << log_size); + stringer (terminate); } - -/* The macro table */ - -const struct alpha_macro alpha_macros[] = { -/* Load/Store macros */ - { "lda", emit_lda, NULL, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldah", emit_ldah, NULL, - { MACRO_IR, MACRO_EXP, MACRO_EOA } }, - - { "ldl", emit_ir_load, "ldl", - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldl_l", emit_ir_load, "ldl_l", - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldq", emit_ir_load, "ldq", - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldq_l", emit_ir_load, "ldq_l", - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldq_u", emit_ir_load, "ldq_u", - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldf", emit_loadstore, "ldf", - { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "ldg", emit_loadstore, "ldg", - { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "lds", emit_loadstore, "lds", - { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "ldt", emit_loadstore, "ldt", - { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_FPR, MACRO_EXP, MACRO_EOA } }, +/* Hook the normal space processing to reset known alignment. */ - { "ldb", emit_ldX, (void *)0, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldbu", emit_ldXu, (void *)0, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldw", emit_ldX, (void *)1, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldwu", emit_ldXu, (void *)1, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, +static void +s_alpha_space (ignore) + int ignore; +{ + alpha_current_align = 0; + alpha_insn_label = NULL; + s_space (ignore); +} - { "uldw", emit_uldX, (void*)1, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "uldwu", emit_uldXu, (void*)1, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "uldl", emit_uldX, (void*)2, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "uldlu", emit_uldXu, (void*)2, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "uldq", emit_uldXu, (void*)3, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, +/* Hook into cons for auto-alignment. */ - { "ldgp", emit_ldgp, NULL, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA } }, +void +alpha_cons_align (size) + int size; +{ + int log_size; - { "ldi", emit_lda, NULL, - { MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldil", emit_ldil, NULL, - { MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldiq", emit_lda, NULL, - { MACRO_IR, MACRO_EXP, MACRO_EOA } }, -#if 0 - { "ldif" emit_ldiq, NULL, - { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "ldid" emit_ldiq, NULL, - { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "ldig" emit_ldiq, NULL, - { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "ldis" emit_ldiq, NULL, - { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "ldit" emit_ldiq, NULL, - { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, -#endif + log_size = 0; + while ((size >>= 1) != 0) + ++log_size; - { "stl", emit_loadstore, "stl", - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "stl_c", emit_loadstore, "stl_c", - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "stq", emit_loadstore, "stq", - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "stq_c", emit_loadstore, "stq_c", - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "stq_u", emit_loadstore, "stq_u", - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "stf", emit_loadstore, "stf", - { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "stg", emit_loadstore, "stg", - { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "sts", emit_loadstore, "sts", - { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "stt", emit_loadstore, "stt", - { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_FPR, MACRO_EXP, MACRO_EOA } }, + if (alpha_auto_align_on && alpha_current_align < log_size) + alpha_align (log_size, (char *) NULL, alpha_insn_label); + if (alpha_current_align > log_size) + alpha_current_align = log_size; + alpha_insn_label = NULL; +} + - { "stb", emit_stX, (void*)0, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "stw", emit_stX, (void*)1, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ustw", emit_ustX, (void*)1, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ustl", emit_ustX, (void*)2, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ustq", emit_ustX, (void*)3, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA } }, +#ifdef DEBUG1 +/* print token expression with alpha specific extension. */ -/* Arithmetic macros */ -#if 0 - { "absl" emit_absl, 1, { IR } }, - { "absl" emit_absl, 2, { IR, IR } }, - { "absl" emit_absl, 2, { EXP, IR } }, - { "absq" emit_absq, 1, { IR } }, - { "absq" emit_absq, 2, { IR, IR } }, - { "absq" emit_absq, 2, { EXP, IR } }, +static void +alpha_print_token(f, exp) + FILE *f; + const expressionS *exp; +{ + switch (exp->X_op) + { + case O_cpregister: + putc (',', f); + /* FALLTHRU */ + case O_pregister: + putc ('(', f); + { + expressionS nexp = *exp; + nexp.X_op = O_register; + print_expr (f, &nexp); + } + putc (')', f); + break; + default: + print_expr (f, exp); + break; + } + return; +} #endif - - { "sextb", emit_sextX, (void *)0, - { MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EOA, - /* MACRO_EXP, MACRO_IR, MACRO_EOA */ } }, - { "sextw", emit_sextX, (void *)1, - { MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EOA, - /* MACRO_EXP, MACRO_IR, MACRO_EOA */ } }, - - { "divl", emit_division, "__divl", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "divlu", emit_division, "__divlu", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "divq", emit_division, "__divq", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "divqu", emit_division, "__divqu", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "reml", emit_division, "__reml", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "remlu", emit_division, "__remlu", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "remq", emit_division, "__remq", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "remqu", emit_division, "__remqu", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - - { "jsr", emit_jsrjmp, "jsr", - { MACRO_PIR, MACRO_EXP, MACRO_EOA, - MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA, - MACRO_EXP, MACRO_EOA } }, - { "jmp", emit_jsrjmp, "jmp", - { MACRO_PIR, MACRO_EXP, MACRO_EOA, - MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA, - MACRO_EXP, MACRO_EOA } }, - { "ret", emit_retjcr, "ret", - { MACRO_IR, MACRO_EXP, MACRO_EOA, - MACRO_IR, MACRO_EOA, - MACRO_PIR, MACRO_EXP, MACRO_EOA, - MACRO_PIR, MACRO_EOA, - MACRO_EXP, MACRO_EOA, - MACRO_EOA } }, - { "jcr", emit_retjcr, "jcr", - { MACRO_IR, MACRO_EXP, MACRO_EOA, - MACRO_IR, MACRO_EOA, - MACRO_PIR, MACRO_EXP, MACRO_EOA, - MACRO_PIR, MACRO_EOA, - MACRO_EXP, MACRO_EOA, - MACRO_EOA } }, - { "jsr_coroutine", emit_retjcr, "jcr", - { MACRO_IR, MACRO_EXP, MACRO_EOA, - MACRO_IR, MACRO_EOA, - MACRO_PIR, MACRO_EXP, MACRO_EOA, - MACRO_PIR, MACRO_EOA, - MACRO_EXP, MACRO_EOA, - MACRO_EOA } }, -}; - -static const int alpha_num_macros - = sizeof(alpha_macros) / sizeof(*alpha_macros); - + /* The target specific pseudo-ops which we support. */ const pseudo_typeS md_pseudo_table[] = { {"common", s_comm, 0}, /* is this used? */ -#ifndef OBJ_ELF +#ifdef OBJ_ECOFF {"comm", s_alpha_comm, 0}, /* osf1 compiler does this */ + {"rdata", s_alpha_rdata, 0}, #endif {"text", s_alpha_text, 0}, {"data", s_alpha_data, 0}, - {"rdata", s_alpha_rdata, 0}, +#ifdef OBJ_ECOFF {"sdata", s_alpha_sdata, 0}, +#endif +#ifdef OBJ_ELF + {"section", s_alpha_section, 0}, + {"section.s", s_alpha_section, 0}, + {"sect", s_alpha_section, 0}, + {"sect.s", s_alpha_section, 0}, +#endif +#ifdef OBJ_EVAX + { "pdesc", s_alpha_pdesc, 0}, + { "name", s_alpha_name, 0}, + { "linkage", s_alpha_linkage, 0}, + { "code_address", s_alpha_code_address, 0}, + { "ent", s_alpha_ent, 0}, + { "frame", s_alpha_frame, 0}, + { "fp_save", s_alpha_fp_save, 0}, + { "mask", s_alpha_mask, 0}, + { "fmask", s_alpha_fmask, 0}, + { "end", s_alpha_end, 0}, + { "file", s_alpha_file, 0}, + { "rdata", s_alpha_section, 1}, + { "comm", s_alpha_section, 2}, + { "link", s_alpha_section, 3}, + { "ctors", s_alpha_section, 4}, + { "dtors", s_alpha_section, 5}, + { "lcomm", s_alpha_section, 6}, +#endif {"gprel32", s_alpha_gprel32, 0}, {"t_floating", s_alpha_float_cons, 'd'}, {"s_floating", s_alpha_float_cons, 'f'}, @@ -3118,17 +4285,15 @@ {"eflag", s_ignore, 0}, {"align", s_alpha_align, 0}, - {"byte", s_alpha_cons, 0}, - {"hword", s_alpha_cons, 1}, - {"int", s_alpha_cons, 2}, - {"long", s_alpha_cons, 2}, - {"octa", s_alpha_cons, 4}, - {"quad", s_alpha_cons, 3}, - {"short", s_alpha_cons, 1}, - {"word", s_alpha_cons, 1}, {"double", s_alpha_float_cons, 'd'}, {"float", s_alpha_float_cons, 'f'}, {"single", s_alpha_float_cons, 'f'}, + {"ascii", s_alpha_stringer, 0}, + {"asciz", s_alpha_stringer, 1}, + {"string", s_alpha_stringer, 1}, + {"space", s_alpha_space, 0}, + {"skip", s_alpha_space, 0}, + {"zero", s_alpha_space, 0}, /* We don't do any optimizing, so we can safely ignore these. */ {"noalias", s_ignore, 0}, @@ -3138,6 +4303,8 @@ }; +/* Build a BFD section with its flags set appropriately for the .lita, + .lit8, or .lit4 sections. */ static void create_literal_section (name, secp, symp) @@ -3159,7 +4326,10 @@ S_CLEAR_EXTERNAL (*symp = section_symbol (new_sec)); } -#ifndef OBJ_ELF +#ifdef OBJ_ECOFF + +/* @@@ GP selection voodoo. All of this seems overly complicated and + unnecessary; which is the primary reason it's for ECOFF only. */ static inline void maybe_set_gp (sec) @@ -3183,8 +4353,9 @@ /* Select the smallest VMA of these existing sections. */ maybe_set_gp (alpha_lita_section); -/* maybe_set_gp (sdata); Was disabled before -- should we use it? */ #if 0 + /* These were disabled before -- should we use them? */ + maybe_set_gp (sdata); maybe_set_gp (lit8_sec); maybe_set_gp (lit4_sec); #endif @@ -3200,7 +4371,12 @@ printf ("Chose GP value of %lx\n", alpha_gp_value); #endif } -#endif /* !OBJ_ELF */ +#endif /* OBJ_ECOFF */ + +/* Called internally to handle all alignment needs. This takes care + of eliding calls to frag_align if'n the cached current alignment + says we've already got it, as well as taking care of the auto-align + feature wrt labels. */ static void alpha_align (n, pfill, label) @@ -3208,6 +4384,9 @@ char *pfill; symbolS *label; { + if (alpha_current_align >= n) + return; + if (pfill == NULL) { if (n > 2 @@ -3220,14 +4399,17 @@ section. The DEC assembler silently fills with unaligned no-op instructions. This will zero-fill, then nop-fill with proper alignment. */ - frag_align (2, 0); - frag_align_pattern (n, nop, sizeof nop); + if (alpha_current_align < 2) + frag_align (2, 0, 0); + frag_align_pattern (n, nop, sizeof nop, 0); } else - frag_align (n, 0); + frag_align (n, 0, 0); } else - frag_align (n, *pfill); + frag_align (n, *pfill, 0); + + alpha_current_align = n; if (label != NULL) { diff -urN binutils-2.7/gas/config/tc-alpha.h binutils-2.8/gas/config/tc-alpha.h --- binutils-2.7/gas/config/tc-alpha.h Thu Jul 4 12:13:49 1996 +++ binutils-2.8/gas/config/tc-alpha.h Wed Apr 30 12:53:17 1997 @@ -1,5 +1,5 @@ /* This file is tc-alpha.h - Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Written by Ken Raeburn . This file is part of GAS, the GNU Assembler. @@ -21,12 +21,16 @@ #define TC_ALPHA +#define TARGET_BYTES_BIG_ENDIAN 0 + #define TARGET_ARCH bfd_arch_alpha #define TARGET_FORMAT (OUTPUT_FLAVOR == bfd_target_ecoff_flavour \ ? "ecoff-littlealpha" \ : OUTPUT_FLAVOR == bfd_target_elf_flavour \ ? "elf64-alpha" \ + : OUTPUT_FLAVOR == bfd_target_evax_flavour \ + ? "evax-alpha" \ : "unknown-format") #define NEED_LITERAL_POOL @@ -48,14 +52,19 @@ #define md_create_short_jump(p,f,t,fr,s) as_fatal("alpha_create_short_jump") #define md_estimate_size_before_relax(f,s) \ (as_fatal("estimate_size_before_relax called"),1) -#define md_operand(x) ((void) (0)) +#define md_operand(x) -#ifdef OBJ_ECOFF -#define LOCAL_LABEL(name) ((name)[0] == 'L') -#endif -#ifdef OBJ_ELF -#define LOCAL_LABEL(name) ((name)[0] == '$') -#define FAKE_LABEL_NAME "$L0\001" +#ifdef OBJ_EVAX + +/* This field keeps the symbols position in the link section. */ +#define OBJ_SYMFIELD_TYPE valueT + +#define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) \ + fix_new_exp (FRAG, OFF, (int)LEN, EXP, 0, \ + LEN == 2 ? BFD_RELOC_16 \ + : LEN == 4 ? BFD_RELOC_32 \ + : LEN == 8 ? BFD_RELOC_64 \ + : BFD_RELOC_ALPHA_LINKAGE); #endif #define md_number_to_chars number_to_chars_littleendian @@ -66,5 +75,10 @@ #define tc_frob_label(sym) alpha_define_label (sym) extern void alpha_define_label PARAMS ((struct symbol *)); -#define md_flush_pending_output alpha_flush_pending_output -extern void alpha_flush_pending_output PARAMS ((void)); +#define md_cons_align(nbytes) alpha_cons_align (nbytes) +extern void alpha_cons_align PARAMS ((int)); + +#ifdef OBJ_ECOFF +#define tc_frob_file_before_adjust() alpha_frob_file_before_adjust () +extern void alpha_frob_file_before_adjust PARAMS ((void)); +#endif diff -urN binutils-2.7/gas/config/tc-arm.c binutils-2.8/gas/config/tc-arm.c --- binutils-2.7/gas/config/tc-arm.c Thu Jul 4 12:13:53 1996 +++ binutils-2.8/gas/config/tc-arm.c Wed Apr 30 12:53:17 1997 @@ -1,10 +1,8 @@ -/* tc-arm.c All the arm specific stuff in one convenient, huge, - slow to compile, easy to find file. +/* tc-arm.c -- Assemble for the ARM + Copyright (C) 1994, 95, 96, 1997 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) Modified by David Taylor (dtaylor@armltd.co.uk) - Copyright (C) 1994, 1995 Free Software Foundation, Inc. - This file is part of GAS, the GNU Assembler. GAS is free software; you can redistribute it and/or modify @@ -18,8 +16,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #include #include @@ -44,19 +43,22 @@ /* Types of processor to assemble for. */ #define ARM_1 0x00000001 #define ARM_2 0x00000002 -#define ARM_250 0x00000002 /* Checkme, should this be = ARM_3? */ #define ARM_3 0x00000004 +#define ARM_250 ARM_3 #define ARM_6 0x00000008 -#define ARM_7 0x00000008 -#define ARM_7DM 0x00000010 +#define ARM_7 ARM_6 /* same core instruction set */ + +/* The following bitmasks control CPU extensions (ARM7 onwards): */ +#define ARM_LONGMUL 0x00000010 /* allow long multiplies */ +#define ARM_ARCH4 0x00000020 +#define ARM_THUMB ARM_ARCH4 /* Some useful combinations: */ #define ARM_ANY 0x00ffffff #define ARM_2UP 0x00fffffe #define ARM_ALL ARM_2UP /* Not arm1 only */ #define ARM_3UP 0x00fffffc -#define ARM_6UP 0x00fffff8 -#define ARM_LONGMUL 0x00000010 /* Don't know which will have this. */ +#define ARM_6UP 0x00fffff8 /* Includes ARM7 */ #define FPU_CORE 0x80000000 #define FPU_FPA10 0x40000000 @@ -101,13 +103,21 @@ CONST char FLT_CHARS[] = "rRsSfFdDxXeEpP"; -const int md_reloc_size = 8; /* Size of relocation record */ +CONST int md_reloc_size = 8; /* Size of relocation record */ + +static int thumb_mode = 0; /* non-zero if assembling thumb instructions */ + +typedef struct arm_fix +{ + int thumb_mode; +} arm_fix_data; struct arm_it { CONST char *error; unsigned long instruction; int suffix; + int size; struct { bfd_reloc_code_real_type type; @@ -169,6 +179,8 @@ #define CP_T_UD 0x00800000 #define CP_T_WB 0x00200000 +#define CONDS_BIT (0x00100000) +#define LOAD_BIT (0x00100000) #define TRANS_BIT (0x00200000) struct asm_cond @@ -200,7 +212,9 @@ {"nv", 0xf0000000} }; - +/* Warning: If the top bit of the set_bits is set, then the standard + instruction bitmask is ignored, and the new bitmask is taken from + the set_bits: */ struct asm_flg { CONST char *template; /* Basic flag string */ @@ -209,15 +223,27 @@ static CONST struct asm_flg s_flag[] = { - {"s", 0x00100000}, + {"s", CONDS_BIT}, + {NULL, 0} +}; + +static CONST struct asm_flg ldr_flags[] = +{ + {"b", 0x00400000}, + {"t", TRANS_BIT}, + {"bt", 0x00400000 | TRANS_BIT}, + {"h", 0x801000b0}, + {"sh", 0x801000f0}, + {"sb", 0x801000d0}, {NULL, 0} }; -static CONST struct asm_flg ldst_flags[] = +static CONST struct asm_flg str_flags[] = { {"b", 0x00400000}, {"t", TRANS_BIT}, {"bt", 0x00400000 | TRANS_BIT}, + {"h", 0x800000b0}, {NULL, 0} }; @@ -229,7 +255,7 @@ static CONST struct asm_flg cmp_flags[] = { - {"s", 0x00100000}, + {"s", CONDS_BIT}, {"p", 0x0010f000}, {NULL, 0} }; @@ -282,6 +308,27 @@ {NULL, 0} }; +/* The implementation of the FIX instruction is broken on some assemblers, + in that it accepts a precision specifier as well as a rounding specifier, + despite the fact that this is meaningless. To be more compatible, we + accept it as well, though of course it does not set any bits. */ +static CONST struct asm_flg fix_flags[] = +{ + {"p", 0x00000020}, + {"m", 0x00000040}, + {"z", 0x00000060}, + {"sp", 0x00000020}, + {"sm", 0x00000040}, + {"sz", 0x00000060}, + {"dp", 0x00000020}, + {"dm", 0x00000040}, + {"dz", 0x00000060}, + {"ep", 0x00000020}, + {"em", 0x00000040}, + {"ez", 0x00000060}, + {NULL, 0} +}; + static CONST struct asm_flg except_flag[] = { {"e", 0x00400000}, @@ -335,8 +382,11 @@ /* ARM 6 */ static void do_msr PARAMS ((char *operands, unsigned long flags)); static void do_mrs PARAMS ((char *operands, unsigned long flags)); -/* ARM 7DM */ +/* ARM 7M */ static void do_mull PARAMS ((char *operands, unsigned long flags)); +/* ARM THUMB */ +static void do_bx PARAMS ((char *operands, unsigned long flags)); + /* Coprocessor Instructions */ static void do_cdp PARAMS ((char *operands, unsigned long flags)); static void do_lstc PARAMS ((char *operands, unsigned long flags)); @@ -356,13 +406,13 @@ static int arm_reg_parse PARAMS ((char **ccp)); static int arm_psr_parse PARAMS ((char **ccp)); -/* All instructions take 4 bytes in the object file */ - -#define INSN_SIZE 4 +/* ARM instructions take 4bytes in the object file, Thumb instructions + take 2: */ +#define INSN_SIZE 4 /* LONGEST_INST is the longest basic instruction name without conditions or * flags. - * ARM7DM has 4 of length 5 + * ARM7M has 4 of length 5 */ #define LONGEST_INST 5 @@ -396,13 +446,13 @@ {"cmn", 0x01600000, NULL, cmp_flags, ARM_ANY, do_cmp}, {"mov", 0x01a00000, NULL, s_flag, ARM_ANY, do_mov}, {"mvn", 0x01e00000, NULL, s_flag, ARM_ANY, do_mov}, - {"str", 0x04000000, NULL, ldst_flags, ARM_ANY, do_ldst}, - {"ldr", 0x04100000, NULL, ldst_flags, ARM_ANY, do_ldst}, + {"str", 0x04000000, NULL, str_flags, ARM_ANY, do_ldst}, + {"ldr", 0x04100000, NULL, ldr_flags, ARM_ANY, do_ldst}, {"stm", 0x08000000, NULL, stm_flags, ARM_ANY, do_ldmstm}, {"ldm", 0x08100000, NULL, ldm_flags, ARM_ANY, do_ldmstm}, {"swi", 0x0f000000, NULL, NULL, ARM_ANY, do_swi}, - {"bl", 0x0b000000, NULL, NULL, ARM_ANY, do_branch}, - {"b", 0x0a000000, NULL, NULL, ARM_ANY, do_branch}, + {"bl", 0x0bfffffe, NULL, NULL, ARM_ANY, do_branch}, + {"b", 0x0afffffe, NULL, NULL, ARM_ANY, do_branch}, /* Pseudo ops */ {"adr", 0x028f0000, NULL, NULL, ARM_ANY, do_adr}, @@ -419,12 +469,15 @@ {"mrs", 0x010f0000, NULL, NULL, ARM_6UP, do_mrs}, {"msr", 0x0128f000, NULL, NULL, ARM_6UP, do_msr}, -/* ARM 7DM long multiplies - need signed/unsigned flags! */ +/* ARM 7M long multiplies - need signed/unsigned flags! */ {"smull", 0x00c00090, NULL, s_flag, ARM_LONGMUL, do_mull}, {"umull", 0x00800090, NULL, s_flag, ARM_LONGMUL, do_mull}, {"smlal", 0x00e00090, NULL, s_flag, ARM_LONGMUL, do_mull}, {"umlal", 0x00a00090, NULL, s_flag, ARM_LONGMUL, do_mull}, +/* ARM THUMB interworking */ + {"bx", 0x012fff10, NULL, NULL, ARM_THUMB, do_bx}, + /* Floating point instructions */ {"wfs", 0x0e200110, NULL, NULL, FPU_ALL, do_fp_ctrl}, {"rfs", 0x0e300110, NULL, NULL, FPU_ALL, do_fp_ctrl}, @@ -471,20 +524,21 @@ {"cmfe", 0x0ed0f110, NULL, NULL, FPU_ALL, do_fp_cmp}, {"cnfe", 0x0ef0f110, NULL, NULL, FPU_ALL, do_fp_cmp}, {"flt", 0x0e000110, "sde", round_flags, FPU_ALL, do_fp_from_reg}, - {"fix", 0x0e100110, NULL, round_flags, FPU_ALL, do_fp_to_reg}, + {"fix", 0x0e100110, NULL, fix_flags, FPU_ALL, do_fp_to_reg}, /* Generic copressor instructions */ - {"cdp", 0x0e000000, NULL, NULL, ARM_ANY, do_cdp}, - {"ldc", 0x0c100000, NULL, cplong_flag, ARM_ANY, do_lstc}, - {"stc", 0x0c000000, NULL, cplong_flag, ARM_ANY, do_lstc}, - {"mcr", 0x0e000010, NULL, NULL, ARM_ANY, do_co_reg}, - {"mrc", 0x0e100010, NULL, NULL, ARM_ANY, do_co_reg}, + {"cdp", 0x0e000000, NULL, NULL, ARM_2UP, do_cdp}, + {"ldc", 0x0c100000, NULL, cplong_flag, ARM_2UP, do_lstc}, + {"stc", 0x0c000000, NULL, cplong_flag, ARM_2UP, do_lstc}, + {"mcr", 0x0e000010, NULL, NULL, ARM_2UP, do_co_reg}, + {"mrc", 0x0e100010, NULL, NULL, ARM_2UP, do_co_reg}, }; /* defines for various bits that we will want to toggle */ #define INST_IMMEDIATE 0x02000000 #define OFFSET_REG 0x02000000 +#define HWOFFSET_IMM 0x00400000 #define SHIFT_BY_REG 0x00000010 #define PRE_INDEX 0x01000000 #define INDEX_UP 0x00800000 @@ -515,6 +569,176 @@ #define OPCODE_BIC 14 #define OPCODE_MVN 15 +static void do_t_arit PARAMS ((char *operands)); +static void do_t_add PARAMS ((char *operands)); +static void do_t_asr PARAMS ((char *operands)); +static void do_t_branch PARAMS ((char *operands)); +static void do_t_bx PARAMS ((char *operands)); +static void do_t_compare PARAMS ((char *operands)); +static void do_t_ldmstm PARAMS ((char *operands)); +static void do_t_ldr PARAMS ((char *operands)); +static void do_t_ldrb PARAMS ((char *operands)); +static void do_t_ldrh PARAMS ((char *operands)); +static void do_t_lds PARAMS ((char *operands)); +static void do_t_lsl PARAMS ((char *operands)); +static void do_t_lsr PARAMS ((char *operands)); +static void do_t_mov PARAMS ((char *operands)); +static void do_t_push_pop PARAMS ((char *operands)); +static void do_t_str PARAMS ((char *operands)); +static void do_t_strb PARAMS ((char *operands)); +static void do_t_strh PARAMS ((char *operands)); +static void do_t_sub PARAMS ((char *operands)); +static void do_t_swi PARAMS ((char *operands)); +static void do_t_adr PARAMS ((char *operands)); + +#define T_OPCODE_MUL 0x4340 +#define T_OPCODE_TST 0x4200 +#define T_OPCODE_CMN 0x42c0 +#define T_OPCODE_NEG 0x4240 +#define T_OPCODE_MVN 0x43c0 + +#define T_OPCODE_ADD_R3 0x1800 +#define T_OPCODE_SUB_R3 0x1a00 +#define T_OPCODE_ADD_HI 0x4400 +#define T_OPCODE_ADD_ST 0xb000 +#define T_OPCODE_SUB_ST 0xb080 +#define T_OPCODE_ADD_SP 0xa800 +#define T_OPCODE_ADD_PC 0xa000 +#define T_OPCODE_ADD_I8 0x3000 +#define T_OPCODE_SUB_I8 0x3800 +#define T_OPCODE_ADD_I3 0x1c00 +#define T_OPCODE_SUB_I3 0x1e00 + +#define T_OPCODE_ASR_R 0x4100 +#define T_OPCODE_LSL_R 0x4080 +#define T_OPCODE_LSR_R 0x40c0 +#define T_OPCODE_ASR_I 0x1000 +#define T_OPCODE_LSL_I 0x0000 +#define T_OPCODE_LSR_I 0x0800 + +#define T_OPCODE_MOV_I8 0x2000 +#define T_OPCODE_CMP_I8 0x2800 +#define T_OPCODE_CMP_LR 0x4280 +#define T_OPCODE_MOV_HR 0x4600 +#define T_OPCODE_CMP_HR 0x4500 + +#define T_OPCODE_LDR_PC 0x4800 +#define T_OPCODE_LDR_SP 0x9800 +#define T_OPCODE_STR_SP 0x9000 +#define T_OPCODE_LDR_IW 0x6800 +#define T_OPCODE_STR_IW 0x6000 +#define T_OPCODE_LDR_IH 0x8800 +#define T_OPCODE_STR_IH 0x8000 +#define T_OPCODE_LDR_IB 0x7800 +#define T_OPCODE_STR_IB 0x7000 +#define T_OPCODE_LDR_RW 0x5800 +#define T_OPCODE_STR_RW 0x5000 +#define T_OPCODE_LDR_RH 0x5a00 +#define T_OPCODE_STR_RH 0x5200 +#define T_OPCODE_LDR_RB 0x5c00 +#define T_OPCODE_STR_RB 0x5400 + +#define T_OPCODE_PUSH 0xb400 +#define T_OPCODE_POP 0xbc00 + +#define T_OPCODE_BRANCH 0xe7fe + +static int thumb_reg PARAMS ((char **str, int hi_lo)); + +#define THUMB_SIZE 2 /* Size of thumb instruction */ +#define THUMB_REG_LO 0x1 +#define THUMB_REG_HI 0x2 +#define THUMB_REG_ANY 0x3 + +#define THUMB_H1 0x0080 +#define THUMB_H2 0x0040 + +#define THUMB_ASR 0 +#define THUMB_LSL 1 +#define THUMB_LSR 2 + +#define THUMB_MOVE 0 +#define THUMB_COMPARE 1 + +#define THUMB_LOAD 0 +#define THUMB_STORE 1 + +#define THUMB_PP_PC_LR 0x0100 + +/* These three are used for immediate shifts, do not alter */ +#define THUMB_WORD 2 +#define THUMB_HALFWORD 1 +#define THUMB_BYTE 0 + +struct thumb_opcode +{ + CONST char *template; /* Basic string to match */ + unsigned long value; /* Basic instruction code */ + int size; + void (*parms)(); /* Function to call to parse args */ +}; + +static CONST struct thumb_opcode tinsns[] = +{ + {"adc", 0x4140, 2, do_t_arit}, + {"add", 0x0000, 2, do_t_add}, + {"and", 0x4000, 2, do_t_arit}, + {"asr", 0x0000, 2, do_t_asr}, + {"b", T_OPCODE_BRANCH, 2, do_t_branch}, + {"beq", 0xd0fe, 2, do_t_branch}, + {"bne", 0xd1fe, 2, do_t_branch}, + {"bcs", 0xd2fe, 2, do_t_branch}, + {"bhs", 0xd2fe, 2, do_t_branch}, + {"bcc", 0xd3fe, 2, do_t_branch}, + {"bul", 0xd3fe, 2, do_t_branch}, + {"blo", 0xd3fe, 2, do_t_branch}, + {"bmi", 0xd4fe, 2, do_t_branch}, + {"bpl", 0xd5fe, 2, do_t_branch}, + {"bvs", 0xd6fe, 2, do_t_branch}, + {"bvc", 0xd7fe, 2, do_t_branch}, + {"bhi", 0xd8fe, 2, do_t_branch}, + {"bls", 0xd9fe, 2, do_t_branch}, + {"bge", 0xdafe, 2, do_t_branch}, + {"blt", 0xdbfe, 2, do_t_branch}, + {"bgt", 0xdcfe, 2, do_t_branch}, + {"ble", 0xddfe, 2, do_t_branch}, + {"bic", 0x4380, 2, do_t_arit}, + {"bl", 0xf7fffffe, 4, do_t_branch}, + {"bx", 0x4700, 2, do_t_bx}, + {"cmn", T_OPCODE_CMN, 2, do_t_arit}, + {"cmp", 0x0000, 2, do_t_compare}, + {"eor", 0x4040, 2, do_t_arit}, + {"ldmia", 0xc800, 2, do_t_ldmstm}, + {"ldr", 0x0000, 2, do_t_ldr}, + {"ldrb", 0x0000, 2, do_t_ldrb}, + {"ldrh", 0x0000, 2, do_t_ldrh}, + {"ldrsb", 0x5600, 2, do_t_lds}, + {"ldrsh", 0x5e00, 2, do_t_lds}, + {"ldsb", 0x5600, 2, do_t_lds}, + {"ldsh", 0x5e00, 2, do_t_lds}, + {"lsl", 0x0000, 2, do_t_lsl}, + {"lsr", 0x0000, 2, do_t_lsr}, + {"mov", 0x0000, 2, do_t_mov}, + {"mul", T_OPCODE_MUL, 2, do_t_arit}, + {"mvn", T_OPCODE_MVN, 2, do_t_arit}, + {"neg", T_OPCODE_NEG, 2, do_t_arit}, + {"orr", 0x4300, 2, do_t_arit}, + {"pop", 0xbc00, 2, do_t_push_pop}, + {"push", 0xb400, 2, do_t_push_pop}, + {"ror", 0x41c0, 2, do_t_arit}, + {"sbc", 0x4180, 2, do_t_arit}, + {"stmia", 0xc000, 2, do_t_ldmstm}, + {"str", 0x0000, 2, do_t_str}, + {"strb", 0x0000, 2, do_t_strb}, + {"strh", 0x0000, 2, do_t_strh}, + {"swi", 0xdf00, 2, do_t_swi}, + {"sub", 0x0000, 2, do_t_sub}, + {"tst", T_OPCODE_TST, 2, do_t_arit}, + /* Pseudo ops: */ + {"adr", 0x0000, 2, do_t_adr}, + {"nop", 0x0000, 2, do_nop}, +}; + struct reg_entry { CONST char *name; @@ -526,20 +750,22 @@ #define fp_register(reg) ((reg) >= 16 && (reg) <= 23) #define REG_PC 15 +#define REG_LR 14 +#define REG_SP 13 /* These are the standard names; Users can add aliases with .req */ static CONST struct reg_entry reg_table[] = { /* Processor Register Numbers */ - {"r0", 0}, {"r1", 1}, {"r2", 2}, {"r3", 3}, - {"r4", 4}, {"r5", 5}, {"r6", 6}, {"r7", 7}, - {"r8", 8}, {"r9", 9}, {"r10", 10}, {"r11", 11}, - {"r12", 12}, {"r13", 13}, {"r14", 14}, {"r15", REG_PC}, + {"r0", 0}, {"r1", 1}, {"r2", 2}, {"r3", 3}, + {"r4", 4}, {"r5", 5}, {"r6", 6}, {"r7", 7}, + {"r8", 8}, {"r9", 9}, {"r10", 10}, {"r11", 11}, + {"r12", 12}, {"r13", REG_SP},{"r14", REG_LR},{"r15", REG_PC}, /* APCS conventions */ - {"a1", 0}, {"a2", 1}, {"a3", 2}, {"a4", 3}, - {"v1", 4}, {"v2", 5}, {"v3", 6}, {"v4", 7}, {"v5", 8}, - {"v6", 9}, {"sb", 9}, {"v7", 10}, {"sl", 10}, - {"fp", 11}, {"ip", 12}, {"sp", 13}, {"lr", 14}, {"pc", REG_PC}, + {"a1", 0}, {"a2", 1}, {"a3", 2}, {"a4", 3}, + {"v1", 4}, {"v2", 5}, {"v3", 6}, {"v4", 7}, {"v5", 8}, + {"v6", 9}, {"sb", 9}, {"v7", 10}, {"sl", 10}, + {"fp", 11}, {"ip", 12}, {"sp", REG_SP},{"lr", REG_LR},{"pc", REG_PC}, /* FP Registers */ {"f0", 16}, {"f1", 17}, {"f2", 18}, {"f3", 19}, {"f4", 20}, {"f5", 21}, {"f6", 22}, {"f7", 23}, @@ -558,6 +784,7 @@ static CONST char *bad_pc = "r15 not allowed here"; static struct hash_control *arm_ops_hsh = NULL; +static struct hash_control *arm_tops_hsh = NULL; static struct hash_control *arm_cond_hsh = NULL; static struct hash_control *arm_shift_hsh = NULL; static struct hash_control *arm_reg_hsh = NULL; @@ -575,6 +802,9 @@ static void s_bss PARAMS ((int)); static void s_even PARAMS ((int)); static void s_ltorg PARAMS ((int)); +static void s_arm PARAMS ((int)); +static void s_thumb PARAMS ((int)); +static void s_code PARAMS ((int)); static int my_get_expression PARAMS ((expressionS *, char **)); @@ -583,6 +813,9 @@ {"req", s_req, 0}, /* Never called becasue '.req' does not start line */ {"bss", s_bss, 0}, {"align", s_align, 0}, + {"arm", s_arm, 0}, + {"thumb", s_thumb, 0}, + {"code", s_code, 0}, {"even", s_even, 0}, {"ltorg", s_ltorg, 0}, {"pool", s_ltorg, 0}, @@ -624,25 +857,43 @@ static int add_to_lit_pool () { + int lit_count = 0; + if (current_poolP == NULL) current_poolP = symbol_make_empty(); - if (next_literal_pool_place > MAX_LITERAL_POOL_SIZE) + /* Check if this literal value is already in the pool: */ + while (lit_count < next_literal_pool_place) { - inst.error = "Literal Pool Overflow\n"; - return FAIL; + if (literals[lit_count].exp.X_op == inst.reloc.exp.X_op + && inst.reloc.exp.X_op == O_constant + && literals[lit_count].exp.X_add_number == inst.reloc.exp.X_add_number + && literals[lit_count].exp.X_unsigned == inst.reloc.exp.X_unsigned) + break; + lit_count++; + } + + if (lit_count == next_literal_pool_place) /* new entry */ + { + if (next_literal_pool_place > MAX_LITERAL_POOL_SIZE) + { + inst.error = "Literal Pool Overflow\n"; + return FAIL; + } + + literals[next_literal_pool_place].exp = inst.reloc.exp; + lit_count = next_literal_pool_place++; } - literals[next_literal_pool_place].exp = inst.reloc.exp; inst.reloc.exp.X_op = O_symbol; - inst.reloc.exp.X_add_number = (next_literal_pool_place++)*4-8; + inst.reloc.exp.X_add_number = (lit_count)*4-8; inst.reloc.exp.X_add_symbol = current_poolP; return SUCCESS; } /* Can't use symbol_new here, so have to create a symbol and them at - a later datete assign iot a value. Thats what these functions do */ + a later date assign it a value. Thats what these functions do */ static void symbol_locate (symbolP, name, segment, valu, frag) symbolS *symbolP; @@ -748,11 +999,13 @@ } static int -validate_offset_imm (val) +validate_offset_imm (val, hwse) int val; + int hwse; { - if (val < -4095 || val > 4095) - as_bad ("bad immediate value for offset (%d)", val); + if ((hwse && (val < -255 || val > 255)) + || (val < -4095 || val > 4095)) + return FAIL; return val; } @@ -779,7 +1032,7 @@ int ignore; { if (!need_pass_2) /* Never make frag if expect extra pass. */ - frag_align (1, 0); + frag_align (1, 0, 0); record_alignment (now_seg, 1); demand_empty_rest_of_line (); } @@ -802,7 +1055,7 @@ /* Align pool as you have word accesses */ /* Only make a frag if we have to ... */ if (!need_pass_2) - frag_align (2, 0); + frag_align (2, 0, 0); record_alignment (now_seg, 2); @@ -823,6 +1076,7 @@ current_poolP = NULL; } +#if 0 /* not used */ static void arm_align (power, fill) int power; @@ -830,10 +1084,11 @@ { /* Only make a frag if we HAVE to ... */ if (power && !need_pass_2) - frag_align (power, fill); + frag_align (power, fill, 0); record_alignment (now_seg, power); } +#endif static void s_align (unused) /* Same as s_align_ptwo but align 0 => align 2 */ @@ -865,13 +1120,83 @@ /* Only make a frag if we HAVE to. . . */ if (temp && !need_pass_2) - frag_align (temp, (int) temp_fill); + frag_align (temp, (int) temp_fill, 0); demand_empty_rest_of_line (); record_alignment (now_seg, temp); } static void +opcode_select (width) + int width; +{ + switch (width) + { + case 16: + if (! thumb_mode) + { + if (! (cpu_variant & ARM_THUMB)) + as_bad ("selected processor does not support THUMB opcodes"); + thumb_mode = 1; + /* No need to force the alignment, since we will have been + coming from ARM mode, which is word-aligned. */ + record_alignment (now_seg, 1); + } + break; + + case 32: + if (thumb_mode) + { + if ((cpu_variant & ARM_ANY) == ARM_THUMB) + as_bad ("selected processor does not support ARM opcodes"); + thumb_mode = 0; + if (!need_pass_2) + frag_align (2, 0, 0); + record_alignment (now_seg, 1); + } + break; + + default: + as_bad ("invalid instruction size selected (%d)", width); + } +} + +static void +s_arm (ignore) + int ignore; +{ + opcode_select (32); + demand_empty_rest_of_line (); +} + +static void +s_thumb (ignore) + int ignore; +{ + opcode_select (16); + demand_empty_rest_of_line (); +} + +static void +s_code (unused) + int unused; +{ + register int temp; + + temp = get_absolute_expression (); + switch (temp) + { + case 16: + case 32: + opcode_select(temp); + break; + + default: + as_bad ("invalid operand to .code directive (%d)", temp); + } +} + +static void end_of_line (str) char *str; { @@ -1694,7 +2019,8 @@ *p = c; if (shft) { - if (!strcmp (*str, "rrx")) + if (!strcmp (*str, "rrx") + || !strcmp (*str, "RRX")) { *str = p; inst.instruction |= shft->value; @@ -1718,12 +2044,12 @@ return FAIL; /* Validate some simple #expressions */ - if (! inst.reloc.exp.X_add_symbol) + if (inst.reloc.exp.X_op == O_constant) { - int num = inst.reloc.exp.X_add_number; - if (num < 0 || num > 32 - || (num == 32 - && (shft->value == 0 || shft->value == 0x60))) + unsigned num = inst.reloc.exp.X_add_number; + + /* Reject operations greater than 32, or lsl #32 */ + if (num > 32 || (num == 32 && shft->value == 0)) { inst.error = "Invalid immediate shift"; return FAIL; @@ -2030,8 +2356,8 @@ char *str; unsigned long flags; { - /* This is a pseudo-op of the form "adr rd, label" to be converted into - a relative address of the form add rd, pc, #label-.-8 */ + /* This is a pseudo-op of the form "adr rd, label" to be converted + into a relative address of the form "add rd, pc, #label-.-8" */ while (*str == ' ') str++; @@ -2079,7 +2405,7 @@ inst.instruction |= flags; if ((flags & 0x0000f000) == 0) - inst.instruction |= 0x00100000; + inst.instruction |= CONDS_BIT; end_of_line (str); return; @@ -2114,8 +2440,9 @@ } static int -ldst_extend (str) +ldst_extend (str, hwse) char **str; + int hwse; { int add = INDEX_UP; @@ -2130,7 +2457,8 @@ { int value = inst.reloc.exp.X_add_number; - if (value < -4095 || value > 4095) + if ((hwse && (value < -255 || value > 255)) + || (value < -4095 || value > 4095)) { inst.error = "address offset too large"; return FAIL; @@ -2142,11 +2470,22 @@ add = 0; } - inst.instruction |= add | value; + /* Halfword and signextension instructions have the + immediate value split across bits 11..8 and bits 3..0 */ + if (hwse) + inst.instruction |= add | HWOFFSET_IMM | (value >> 4) << 8 | value & 0xF; + else + inst.instruction |= add | value; } else { - inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM; + if (hwse) + { + inst.instruction |= HWOFFSET_IMM; + inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM8; + } + else + inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM; inst.reloc.pc_rel = 0; } return SUCCESS; @@ -2161,9 +2500,16 @@ inst.error = "Register expected"; return FAIL; } - inst.instruction |= add | OFFSET_REG; - if (skip_past_comma (str) == SUCCESS) - return decode_shift (str, SHIFT_RESTRICT); + + if (hwse) + inst.instruction |= add; + else + { + inst.instruction |= add | OFFSET_REG; + if (skip_past_comma (str) == SUCCESS) + return decode_shift (str, SHIFT_RESTRICT); + } + return SUCCESS; } } @@ -2173,10 +2519,31 @@ char *str; unsigned long flags; { + int halfword = 0; int pre_inc = 0; int conflict_reg; int value; + /* This is not ideal, but it is the simplest way of dealing with the + ARM7T halfword instructions (since they use a different + encoding, but the same mnemonic): */ + if (halfword = ((flags & 0x80000000) != 0)) + { + /* This is actually a load/store of a halfword, or a + signed-extension load */ + if ((cpu_variant & ARM_ARCH4) == 0) + { + inst.error + = "Processor does not support halfwords or signed bytes\n"; + return; + } + + inst.instruction = (inst.instruction & COND_MASK) + | (flags & ~COND_MASK); + + flags = 0; + } + while (*str == ' ') str++; @@ -2208,7 +2575,7 @@ } conflict_reg = (((conflict_reg == reg) - && (inst.instruction & 0x00100000)) + && (inst.instruction & LOAD_BIT)) ? 1 : 0); while (*str == ' ') @@ -2220,7 +2587,7 @@ if (skip_past_comma (&str) == SUCCESS) { /* [Rn],... (post inc) */ - if (ldst_extend (&str) == FAIL) + if (ldst_extend (&str, halfword) == FAIL) return; if (conflict_reg) as_warn ("destination register same as write-back base\n"); @@ -2228,6 +2595,20 @@ else { /* [Rn] */ + if (halfword) + inst.instruction |= HWOFFSET_IMM; + + while (*str == ' ') + str++; + + if (*str == '!') + { + if (conflict_reg) + as_warn ("destination register same as write-back base\n"); + str++; + inst.instruction |= WRITE_BACK; + } + flags |= INDEX_UP; if (! (flags & TRANS_BIT)) pre_inc = 1; @@ -2243,7 +2624,7 @@ } pre_inc = 1; - if (ldst_extend (&str) == FAIL) + if (ldst_extend (&str, halfword) == FAIL) return; while (*str == ' ') @@ -2261,7 +2642,7 @@ if (*str == '!') { if (conflict_reg) - as_warn ("destination register same as write-back base\n"); + as_tsktsk ("destination register same as write-back base\n"); str++; inst.instruction |= WRITE_BACK; } @@ -2306,7 +2687,13 @@ } /* Change the instruction exp to point to the pool */ - inst.reloc.type = BFD_RELOC_ARM_LITERAL; + if (halfword) + { + inst.instruction |= HWOFFSET_IMM; + inst.reloc.type = BFD_RELOC_ARM_HWLITERAL; + } + else + inst.reloc.type = BFD_RELOC_ARM_LITERAL; inst.reloc.pc_rel = 1; inst.instruction |= (REG_PC << 16); pre_inc = 1; @@ -2317,7 +2704,13 @@ if (my_get_expression (&inst.reloc.exp, &str)) return; - inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM; + if (halfword) + { + inst.instruction |= HWOFFSET_IMM; + inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM8; + } + else + inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM; inst.reloc.exp.X_add_number -= 8; /* PC rel adjust */ inst.reloc.pc_rel = 1; inst.instruction |= (REG_PC << 16); @@ -2332,155 +2725,175 @@ return; } -static void -do_ldmstm (str, flags) - char *str; - unsigned long flags; -{ - int base_reg; - - while (*str == ' ') - str++; +static long +reg_list (strp) + char **strp; +{ + char *str = *strp; + long range = 0; + int another_range; - if ((base_reg = reg_required_here (&str, 16)) == FAIL) + /* We come back here if we get ranges concatenated by '+' or '|' */ + do { - if (!inst.error) - inst.error = bad_args; - return; - } + another_range = 0; - if (base_reg == REG_PC) - { - inst.error = "r15 not allowed as base register"; - return; - } + if (*str == '{') + { + int in_range = 0; + int cur_reg = -1; + + str++; + do + { + int reg; + + while (*str == ' ') + str++; - while (*str == ' ') - str++; - if (*str == '!') - { - flags |= WRITE_BACK; - str++; - } + if ((reg = arm_reg_parse (&str)) == FAIL || !int_register (reg)) + { + inst.error = "Register expected"; + return FAIL; + } - if (skip_past_comma (&str) == FAIL) - { - inst.error = bad_args; - return; - } + if (in_range) + { + int i; + + if (reg <= cur_reg) + { + inst.error = "Bad range in register list"; + return FAIL; + } - /* We come back here if we get ranges concatenated by '+' or '|' */ - another_range: - if (*str == '{') - { - int in_range = 0; - int cur_reg = -1; - - str++; - do - { - int reg; - + for (i = cur_reg + 1; i < reg; i++) + { + if (range & (1 << i)) + as_tsktsk + ("Warning: Duplicated register (r%d) in register list", + i); + else + range |= 1 << i; + } + in_range = 0; + } + + if (range & (1 << reg)) + as_tsktsk ("Warning: Duplicated register (r%d) in register list", + reg); + else if (reg <= cur_reg) + as_tsktsk ("Warning: Register range not in ascending order"); + + range |= 1 << reg; + cur_reg = reg; + } while (skip_past_comma (&str) != FAIL + || (in_range = 1, *str++ == '-')); + str--; while (*str == ' ') str++; - if ((reg = arm_reg_parse (&str)) == FAIL || !int_register (reg)) + if (*str++ != '}') { - inst.error = "Register expected"; - return; + inst.error = "Missing `}'"; + return FAIL; } + } + else + { + expressionS expr; + + if (my_get_expression (&expr, &str)) + return FAIL; - if (in_range) + if (expr.X_op == O_constant) { - int i; - - if (reg <= cur_reg) + if (expr.X_add_number + != (expr.X_add_number & 0x0000ffff)) { - inst.error = "Bad range in register list"; - return; + inst.error = "invalid register mask"; + return FAIL; } - for (i = cur_reg + 1; i < reg; i++) + if ((range & expr.X_add_number) != 0) { - if (flags & (1 << i)) - as_tsktsk - ("Warning: Duplicated register (r%d) in register list", - i); - else - flags |= 1 << i; + int regno = range & expr.X_add_number; + + regno &= -regno; + regno = (1 << regno) - 1; + as_tsktsk + ("Warning: Duplicated register (r%d) in register list", + regno); } - in_range = 0; + + range |= expr.X_add_number; + } + else + { + if (inst.reloc.type != 0) + { + inst.error = "expression too complex"; + return FAIL; + } + + memcpy (&inst.reloc.exp, &expr, sizeof (expressionS)); + inst.reloc.type = BFD_RELOC_ARM_MULTI; + inst.reloc.pc_rel = 0; } + } - if (flags & (1 << reg)) - as_tsktsk ("Warning: Duplicated register (r%d) in register list", - reg); - else if (reg <= cur_reg) - as_tsktsk ("Warning: Register range not in ascending order"); - - flags |= 1 << reg; - cur_reg = reg; - } while (skip_past_comma (&str) != FAIL - || (in_range = 1, *str++ == '-')); - str--; while (*str == ' ') str++; - if (*str++ != '}') + if (*str == '|' || *str == '+') { - inst.error = "Missing `}'"; - return; + str++; + another_range = 1; } - } - else - { - expressionS expr; - - if (my_get_expression (&expr, &str)) - return; + } while (another_range); - if (expr.X_op == O_constant) - { - if (expr.X_add_number - != (expr.X_add_number & 0x0000ffff)) - { - inst.error = "invalid register mask"; - return; - } + *strp = str; + return range; +} - if ((flags & expr.X_add_number) != 0) - { - int regno = flags & expr.X_add_number; +static void +do_ldmstm (str, flags) + char *str; + unsigned long flags; +{ + int base_reg; + long range; - regno &= -regno; - regno = (1 << regno) - 1; - as_tsktsk ("Warning: Duplicated register (r%d) in register list", - regno); - } + while (*str == ' ') + str++; - flags |= expr.X_add_number; - } - else - { - if (inst.reloc.type != 0) - { - inst.error = "expression too complex"; - return; - } + if ((base_reg = reg_required_here (&str, 16)) == FAIL) + { + if (!inst.error) + inst.error = bad_args; + return; + } - memcpy (&inst.reloc.exp, &expr, sizeof (expressionS)); - inst.reloc.type = BFD_RELOC_ARM_MULTI; - inst.reloc.pc_rel = 0; - } + if (base_reg == REG_PC) + { + inst.error = "r15 not allowed as base register"; + return; } while (*str == ' ') str++; - - if (*str == '|' || *str == '+') + if (*str == '!') { + flags |= WRITE_BACK; str++; - goto another_range; + } + + if (skip_past_comma (&str) == FAIL + || (range = reg_list (&str)) == FAIL) + { + if (! inst.error) + inst.error = bad_args; + return; } if (*str == '^') @@ -2488,7 +2901,8 @@ str++; flags |= MULTI_SET_PSR; } - inst.instruction |= flags; + + inst.instruction |= flags | range; end_of_line (str); return; } @@ -2589,7 +3003,26 @@ return; inst.reloc.type = BFD_RELOC_ARM_PCREL_BRANCH; inst.reloc.pc_rel = 1; - inst.instruction |= flags | 0x00fffffe; /* PC-rel adjust */ + end_of_line (str); + return; +} + +static void +do_bx (str, flags) + char *str; + unsigned long flags; +{ + int reg; + + while (*str == ' ') + str++; + + if ((reg = reg_required_here (&str, 0)) == FAIL) + return; + + if (reg == REG_PC) + as_tsktsk ("Use of r15 in bx has undefined behaviour"); + end_of_line (str); return; } @@ -3160,20 +3593,929 @@ return; } -static void -insert_reg (entry) - int entry; +/* Thumb specific routines */ + +/* Parse and validate that a register is of the right form, this saves + repeated checking of this information in many similar cases. + Unlike the 32-bit case we do not insert the register into the opcode + here, since the position is often unknown until the full instruction + has been parsed. */ +static int +thumb_reg (strp, hi_lo) + char **strp; + int hi_lo; { - int len = strlen (reg_table[entry].name) + 2; - char *buf = (char *) xmalloc (len); - char *buf2 = (char *) xmalloc (len); - int i = 0; + int reg; -#ifdef REGISTER_PREFIX - buf[i++] = REGISTER_PREFIX; -#endif + if ((reg = arm_reg_parse (strp)) == FAIL || ! int_register (reg)) + { + inst.error = "Register expected"; + return FAIL; + } - strcpy (buf + i, reg_table[entry].name); + switch (hi_lo) + { + case THUMB_REG_LO: + if (reg > 7) + { + inst.error = "lo register required"; + return FAIL; + } + break; + + case THUMB_REG_HI: + if (reg < 8) + { + inst.error = "hi register required"; + return FAIL; + } + break; + + default: + break; + } + + return reg; +} + +/* Parse an add or subtract instruction, SUBTRACT is non-zero if the opcode + was SUB. */ +static void +thumb_add_sub (str, subtract) + char *str; + int subtract; +{ + int Rd, Rs, Rn = FAIL; + + while (*str == ' ') + str++; + + if ((Rd = thumb_reg (&str, THUMB_REG_ANY)) == FAIL + || skip_past_comma (&str) == FAIL) + { + if (! inst.error) + inst.error = bad_args; + return; + } + + if (*str == '#') + { + Rs = Rd; + str++; + if (my_get_expression (&inst.reloc.exp, &str)) + return; + } + else + { + if ((Rs = thumb_reg (&str, THUMB_REG_ANY)) == FAIL) + return; + + if (skip_past_comma (&str) == FAIL) + { + /* Two operand format, shuffle the registers and pretend there + are 3 */ + Rn = Rs; + Rs = Rd; + } + else if (*str == '#') + { + str++; + if (my_get_expression (&inst.reloc.exp, &str)) + return; + } + else if ((Rn = thumb_reg (&str, THUMB_REG_ANY)) == FAIL) + return; + } + + /* We now have Rd and Rs set to registers, and Rn set to a register or FAIL; + for the latter case, EXPR contains the immediate that was found. */ + if (Rn != FAIL) + { + /* All register format. */ + if (Rd > 7 || Rs > 7 || Rd > 7) + { + if (Rs != Rd) + { + inst.error = "dest and source1 must be the same register"; + return; + } + + /* Can't do this for SUB */ + if (subtract) + { + inst.error = "subtract valid only on lo regs"; + return; + } + + inst.instruction = (T_OPCODE_ADD_HI + | (Rd > 7 ? THUMB_H1 : 0) + | (Rn > 7 ? THUMB_H2 : 0)); + inst.instruction |= (Rd & 7) | ((Rn & 7) << 3); + } + else + { + inst.instruction = subtract ? T_OPCODE_SUB_R3 : T_OPCODE_ADD_R3; + inst.instruction |= Rd | (Rs << 3) | (Rn << 6); + } + } + else + { + /* Immediate expression, now things start to get nasty. */ + + /* First deal with HI regs, only very restricted cases allowed: + Adjusting SP, and using PC or SP to get an address. */ + if ((Rd > 7 && (Rd != REG_SP || Rs != REG_SP)) + || (Rs > 7 && Rs != REG_SP && Rs != REG_PC)) + { + inst.error = "invalid Hi register with immediate"; + return; + } + + if (inst.reloc.exp.X_op != O_constant) + { + /* Value isn't known yet, all we can do is store all the fragments + we know about in the instruction and let the reloc hacking + work it all out. */ + inst.instruction = (subtract ? 0x8000 : 0) | (Rd << 4) | Rs; + inst.reloc.type = BFD_RELOC_ARM_THUMB_ADD; + } + else + { + int offset = inst.reloc.exp.X_add_number; + + if (subtract) + offset = -offset; + + if (offset < 0) + { + offset = -offset; + subtract = 1; + + /* Quick check, in case offset is MIN_INT */ + if (offset < 0) + { + inst.error = "immediate value out of range"; + return; + } + } + else + subtract = 0; + + if (Rd == REG_SP) + { + if (offset & ~0x1fc) + { + inst.error = "invalid immediate value for stack adjust"; + return; + } + inst.instruction = subtract ? T_OPCODE_SUB_ST : T_OPCODE_ADD_ST; + inst.instruction |= offset >> 2; + } + else if (Rs == REG_PC || Rs == REG_SP) + { + if (subtract + || (offset & ~0x3fc)) + { + inst.error = "invalid immediate for address calculation"; + return; + } + inst.instruction = (Rs == REG_PC ? T_OPCODE_ADD_PC + : T_OPCODE_ADD_SP); + inst.instruction |= (Rd << 8) | (offset >> 2); + } + else if (Rs == Rd) + { + if (offset & ~0xff) + { + inst.error = "immediate value out of range"; + return; + } + inst.instruction = subtract ? T_OPCODE_SUB_I8 : T_OPCODE_ADD_I8; + inst.instruction |= (Rd << 8) | offset; + } + else + { + if (offset & ~0x7) + { + inst.error = "immediate value out of range"; + return; + } + inst.instruction = subtract ? T_OPCODE_SUB_I3 : T_OPCODE_ADD_I3; + inst.instruction |= Rd | (Rs << 3) | (offset << 6); + } + } + } + end_of_line (str); +} + +static void +thumb_shift (str, shift) + char *str; + int shift; +{ + int Rd, Rs, Rn = FAIL; + + while (*str == ' ') + str++; + + if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL + || skip_past_comma (&str) == FAIL) + { + if (! inst.error) + inst.error = bad_args; + return; + } + + if (*str == '#') + { + /* Two operand immediate format, set Rs to Rd. */ + Rs = Rd; + str++; + if (my_get_expression (&inst.reloc.exp, &str)) + return; + } + else + { + if ((Rs = thumb_reg (&str, THUMB_REG_LO)) == FAIL) + return; + + if (skip_past_comma (&str) == FAIL) + { + /* Two operand format, shuffle the registers and pretend there + are 3 */ + Rn = Rs; + Rs = Rd; + } + else if (*str == '#') + { + str++; + if (my_get_expression (&inst.reloc.exp, &str)) + return; + } + else if ((Rn = thumb_reg (&str, THUMB_REG_LO)) == FAIL) + return; + } + + /* We now have Rd and Rs set to registers, and Rn set to a register or FAIL; + for the latter case, EXPR contains the immediate that was found. */ + + if (Rn != FAIL) + { + if (Rs != Rd) + { + inst.error = "source1 and dest must be same register"; + return; + } + + switch (shift) + { + case THUMB_ASR: inst.instruction = T_OPCODE_ASR_R; break; + case THUMB_LSL: inst.instruction = T_OPCODE_LSL_R; break; + case THUMB_LSR: inst.instruction = T_OPCODE_LSR_R; break; + } + + inst.instruction |= Rd | (Rn << 3); + } + else + { + switch (shift) + { + case THUMB_ASR: inst.instruction = T_OPCODE_ASR_I; break; + case THUMB_LSL: inst.instruction = T_OPCODE_LSL_I; break; + case THUMB_LSR: inst.instruction = T_OPCODE_LSR_I; break; + } + + if (inst.reloc.exp.X_op != O_constant) + { + /* Value isn't known yet, create a dummy reloc and let reloc + hacking fix it up */ + + inst.reloc.type = BFD_RELOC_ARM_THUMB_SHIFT; + } + else + { + unsigned shift_value = inst.reloc.exp.X_add_number; + + if (shift_value > 32 || (shift_value == 32 && shift == THUMB_LSL)) + { + inst.error = "Invalid immediate for shift"; + return; + } + + /* Shifts of zero are handled by converting to LSL */ + if (shift_value == 0) + inst.instruction = T_OPCODE_LSL_I; + + /* Shifts of 32 are encoded as a shift of zero */ + if (shift_value == 32) + shift_value = 0; + + inst.instruction |= shift_value << 6; + } + + inst.instruction |= Rd | (Rs << 3); + } + end_of_line (str); +} + +static void +thumb_mov_compare (str, move) + char *str; + int move; +{ + int Rd, Rs = FAIL; + + while (*str == ' ') + str++; + + if ((Rd = thumb_reg (&str, THUMB_REG_ANY)) == FAIL + || skip_past_comma (&str) == FAIL) + { + if (! inst.error) + inst.error = bad_args; + return; + } + + if (*str == '#') + { + str++; + if (my_get_expression (&inst.reloc.exp, &str)) + return; + } + else if ((Rs = thumb_reg (&str, THUMB_REG_ANY)) == FAIL) + return; + + if (Rs != FAIL) + { + if (Rs < 8 && Rd < 8) + { + if (move == THUMB_MOVE) + /* A move of two lowregs is, by convention, encoded as + ADD Rd, Rs, #0 */ + inst.instruction = T_OPCODE_ADD_I3; + else + inst.instruction = T_OPCODE_CMP_LR; + inst.instruction |= Rd | (Rs << 3); + } + else + { + if (move == THUMB_MOVE) + inst.instruction = T_OPCODE_MOV_HR; + else + inst.instruction = T_OPCODE_CMP_HR; + + if (Rd > 7) + inst.instruction |= THUMB_H1; + + if (Rs > 7) + inst.instruction |= THUMB_H2; + + inst.instruction |= (Rd & 7) | ((Rs & 7) << 3); + } + } + else + { + if (Rd > 7) + { + inst.error = "only lo regs allowed with immediate"; + return; + } + + if (move == THUMB_MOVE) + inst.instruction = T_OPCODE_MOV_I8; + else + inst.instruction = T_OPCODE_CMP_I8; + + inst.instruction |= Rd << 8; + + if (inst.reloc.exp.X_op != O_constant) + inst.reloc.type = BFD_RELOC_ARM_THUMB_IMM; + else + { + unsigned value = inst.reloc.exp.X_add_number; + + if (value > 255) + { + inst.error = "invalid immediate"; + return; + } + + inst.instruction |= value; + } + } + + end_of_line (str); +} + +static void +thumb_load_store (str, load_store, size) + char *str; + int load_store; + int size; +{ + int Rd, Rb, Ro = FAIL; + + while (*str == ' ') + str++; + + if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL + || skip_past_comma (&str) == FAIL) + { + if (! inst.error) + inst.error = bad_args; + return; + } + + if (*str == '[') + { + str++; + if ((Rb = thumb_reg (&str, THUMB_REG_ANY)) == FAIL) + return; + + if (skip_past_comma (&str) != FAIL) + { + if (*str == '#') + { + str++; + if (my_get_expression (&inst.reloc.exp, &str)) + return; + } + else if ((Ro = thumb_reg (&str, THUMB_REG_LO)) == FAIL) + return; + } + else + { + inst.reloc.exp.X_op = O_constant; + inst.reloc.exp.X_add_number = 0; + } + + if (*str != ']') + { + inst.error = "expected ']'"; + return; + } + str++; + } + else if (*str == '=') + { + abort (); + } + else + { + if (my_get_expression (&inst.reloc.exp, &str)) + return; + + inst.instruction = T_OPCODE_LDR_PC | (Rd << 8); + inst.reloc.pc_rel = 1; + inst.reloc.exp.X_add_number -= 4; /* Pipeline offset */ + inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET; + end_of_line (str); + return; + } + + if (Rb == REG_PC || Rb == REG_SP) + { + if (size != THUMB_WORD) + { + inst.error = "byte or halfword not valid for base register"; + return; + } + else if (Rb == REG_PC && load_store != THUMB_LOAD) + { + inst.error = "R15 based store not allowed"; + return; + } + else if (Ro != FAIL) + { + inst.error = "Invalid base register for register offset"; + return; + } + + if (Rb == REG_PC) + inst.instruction = T_OPCODE_LDR_PC; + else if (load_store == THUMB_LOAD) + inst.instruction = T_OPCODE_LDR_SP; + else + inst.instruction = T_OPCODE_STR_SP; + + inst.instruction |= Rd << 8; + if (inst.reloc.exp.X_op == O_constant) + { + unsigned offset = inst.reloc.exp.X_add_number; + + if (offset & ~0x3fc) + { + inst.error = "invalid offset"; + return; + } + + inst.instruction |= offset >> 2; + } + else + inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET; + } + else if (Rb > 7) + { + inst.error = "invalid base register in load/store"; + return; + } + else if (Ro == FAIL) + { + /* Immediate offset */ + if (size == THUMB_WORD) + inst.instruction = (load_store == THUMB_LOAD + ? T_OPCODE_LDR_IW : T_OPCODE_STR_IW); + else if (size == THUMB_HALFWORD) + inst.instruction = (load_store == THUMB_LOAD + ? T_OPCODE_LDR_IH : T_OPCODE_STR_IH); + else + inst.instruction = (load_store == THUMB_LOAD + ? T_OPCODE_LDR_IB : T_OPCODE_STR_IB); + + inst.instruction |= Rd | (Rb << 3); + + if (inst.reloc.exp.X_op == O_constant) + { + unsigned offset = inst.reloc.exp.X_add_number; + + if (offset & ~(0x1f << size)) + { + inst.error = "Invalid offset"; + return; + } + inst.instruction |= offset << 6; + } + else + inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET; + } + else + { + /* Register offset */ + if (size == THUMB_WORD) + inst.instruction = (load_store == THUMB_LOAD + ? T_OPCODE_LDR_RW : T_OPCODE_STR_RW); + else if (size == THUMB_HALFWORD) + inst.instruction = (load_store == THUMB_LOAD + ? T_OPCODE_LDR_RH : T_OPCODE_STR_RH); + else + inst.instruction = (load_store == THUMB_LOAD + ? T_OPCODE_LDR_RB : T_OPCODE_STR_RB); + + inst.instruction |= Rd | (Rb << 3) | (Ro << 6); + } + + end_of_line (str); +} + +/* Handle the Format 4 instructions that do not have equivalents in other + formats. That is, ADC, AND, EOR, SBC, ROR, TST, NEG, CMN, ORR, MUL, + BIC and MVN. */ +static void +do_t_arit (str) + char *str; +{ + int Rd, Rs, Rn; + + while (*str == ' ') + str++; + + if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL) + return; + + if (skip_past_comma (&str) == FAIL + || (Rs = thumb_reg (&str, THUMB_REG_LO)) == FAIL) + { + if (! inst.error) + inst.error = bad_args; + return; + } + + if (skip_past_comma (&str) != FAIL) + { + /* Three operand format not allowed for TST, CMN, NEG and MVN. + (It isn't allowed for CMP either, but that isn't handled by this + function.) */ + if (inst.instruction == T_OPCODE_TST + || inst.instruction == T_OPCODE_CMN + || inst.instruction == T_OPCODE_NEG + || inst.instruction == T_OPCODE_MVN) + { + inst.error = bad_args; + return; + } + + if ((Rn = thumb_reg (&str, THUMB_REG_LO)) == FAIL) + return; + + if (Rs != Rd) + { + inst.error = "dest and source1 one must be the same register"; + return; + } + Rs = Rn; + } + + if (inst.instruction == T_OPCODE_MUL + && Rs == Rd) + as_tsktsk ("Rs and Rd must be different in MUL"); + + inst.instruction |= Rd | (Rs << 3); + end_of_line (str); +} + +static void +do_t_add (str) + char *str; +{ + thumb_add_sub (str, 0); +} + +static void +do_t_asr (str) + char *str; +{ + thumb_shift (str, THUMB_ASR); +} + +static void +do_t_branch (str) + char *str; +{ + if (my_get_expression (&inst.reloc.exp, &str)) + return; + inst.reloc.type = BFD_RELOC_ARM_PCREL_BRANCH; + inst.reloc.pc_rel = 1; + end_of_line (str); +} + +static void +do_t_bx (str) + char *str; +{ + int reg; + + while (*str == ' ') + str++; + + if ((reg = thumb_reg (&str, THUMB_REG_ANY)) == FAIL) + return; + + /* This sets THUMB_H2 from the top bit of reg. */ + inst.instruction |= reg << 3; + + /* ??? FIXME: Should add a hacky reloc here if reg is REG_PC. The reloc + should cause the alignment to be checked once it is known. This is + because BX PC only works if the instruction is word aligned. */ + + end_of_line (str); +} + +static void +do_t_compare (str) + char *str; +{ + thumb_mov_compare (str, THUMB_COMPARE); +} + +static void +do_t_ldmstm (str) + char *str; +{ + int Rb; + long range; + + while (*str == ' ') + str++; + + if ((Rb = thumb_reg (&str, THUMB_REG_LO)) == FAIL) + return; + + if (*str != '!') + as_warn ("Inserted missing '!': load/store multiple always writes back base register"); + else + str++; + + if (skip_past_comma (&str) == FAIL + || (range = reg_list (&str)) == FAIL) + { + if (! inst.error) + inst.error = bad_args; + return; + } + + if (inst.reloc.type != BFD_RELOC_NONE) + { + /* This really doesn't seem worth it. */ + inst.reloc.type = BFD_RELOC_NONE; + inst.error = "Expression too complex"; + return; + } + + if (range & ~0xff) + { + inst.error = "only lo-regs valid in load/store multiple"; + return; + } + + inst.instruction |= (Rb << 8) | range; + end_of_line (str); +} + +static void +do_t_ldr (str) + char *str; +{ + thumb_load_store (str, THUMB_LOAD, THUMB_WORD); +} + +static void +do_t_ldrb (str) + char *str; +{ + thumb_load_store (str, THUMB_LOAD, THUMB_BYTE); +} + +static void +do_t_ldrh (str) + char *str; +{ + thumb_load_store (str, THUMB_LOAD, THUMB_HALFWORD); +} + +static void +do_t_lds (str) + char *str; +{ + int Rd, Rb, Ro; + + while (*str == ' ') + str++; + + if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL + || skip_past_comma (&str) == FAIL + || *str++ != '[' + || (Rb = thumb_reg (&str, THUMB_REG_LO)) == FAIL + || skip_past_comma (&str) == FAIL + || (Ro = thumb_reg (&str, THUMB_REG_LO)) == FAIL + || *str++ != ']') + { + if (! inst.error) + inst.error = "Syntax: ldrs[b] Rd, [Rb, Ro]"; + return; + } + + inst.instruction |= Rd | (Rb << 3) | (Ro << 6); + end_of_line (str); +} + +static void +do_t_lsl (str) + char *str; +{ + thumb_shift (str, THUMB_LSL); +} + +static void +do_t_lsr (str) + char *str; +{ + thumb_shift (str, THUMB_LSR); +} + +static void +do_t_mov (str) + char *str; +{ + thumb_mov_compare (str, THUMB_MOVE); +} + +static void +do_t_push_pop (str) + char *str; +{ + long range; + + while (*str == ' ') + str++; + + if ((range = reg_list (&str)) == FAIL) + { + if (! inst.error) + inst.error = bad_args; + return; + } + + if (inst.reloc.type != BFD_RELOC_NONE) + { + /* This really doesn't seem worth it. */ + inst.reloc.type = BFD_RELOC_NONE; + inst.error = "Expression too complex"; + return; + } + + if (range & ~0xff) + { + if ((inst.instruction == T_OPCODE_PUSH + && (range & ~0xff) == 1 << REG_LR) + || (inst.instruction == T_OPCODE_POP + && (range & ~0xff) == 1 << REG_PC)) + { + inst.instruction |= THUMB_PP_PC_LR; + range &= 0xff; + } + else + { + inst.error = "invalid register list to push/pop instruction"; + return; + } + } + + inst.instruction |= range; + end_of_line (str); +} + +static void +do_t_str (str) + char *str; +{ + thumb_load_store (str, THUMB_STORE, THUMB_WORD); +} + +static void +do_t_strb (str) + char *str; +{ + thumb_load_store (str, THUMB_STORE, THUMB_BYTE); +} + +static void +do_t_strh (str) + char *str; +{ + thumb_load_store (str, THUMB_STORE, THUMB_HALFWORD); +} + +static void +do_t_sub (str) + char *str; +{ + thumb_add_sub (str, 1); +} + +static void +do_t_swi (str) + char *str; +{ + while (*str == ' ') + str++; + + if (my_get_expression (&inst.reloc.exp, &str)) + return; + + inst.reloc.type = BFD_RELOC_ARM_SWI; + end_of_line (str); + return; +} + +static void +do_t_adr (str) + char *str; +{ + /* This is a pseudo-op of the form "adr rd, label" to be converted + into a relative address of the form "add rd, pc, #label-.-8" */ + while (*str == ' ') + str++; + + if (reg_required_here (&str, 8) == FAIL + || skip_past_comma (&str) == FAIL + || my_get_expression (&inst.reloc.exp, &str)) + { + if (!inst.error) + inst.error = bad_args; + return; + } + + inst.reloc.type = BFD_RELOC_ARM_THUMB_ADD; + inst.reloc.exp.X_add_number -= 8; /* PC relative adjust */ + inst.reloc.pc_rel = 1; + inst.instruction |= REG_PC; /* Rd is already placed into the instruction */ + end_of_line (str); +} + +static void +insert_reg (entry) + int entry; +{ + int len = strlen (reg_table[entry].name) + 2; + char *buf = (char *) xmalloc (len); + char *buf2 = (char *) xmalloc (len); + int i = 0; + +#ifdef REGISTER_PREFIX + buf[i++] = REGISTER_PREFIX; +#endif + + strcpy (buf + i, reg_table[entry].name); for (i = 0; buf[i]; i++) buf2[i] = islower (buf[i]) ? toupper (buf[i]) : buf[i]; @@ -3216,6 +4558,7 @@ int i; if ((arm_ops_hsh = hash_new ()) == NULL + || (arm_tops_hsh = hash_new ()) == NULL || (arm_cond_hsh = hash_new ()) == NULL || (arm_shift_hsh = hash_new ()) == NULL || (arm_reg_hsh = hash_new ()) == NULL @@ -3224,6 +4567,8 @@ for (i = 0; i < sizeof (insns) / sizeof (struct asm_opcode); i++) hash_insert (arm_ops_hsh, insns[i].template, (PTR) (insns + i)); + for (i = 0; i < sizeof (tinsns) / sizeof (struct thumb_opcode); i++) + hash_insert (arm_tops_hsh, tinsns[i].template, (PTR) (tinsns + i)); for (i = 0; i < sizeof (conds) / sizeof (struct asm_cond); i++) hash_insert (arm_cond_hsh, conds[i].template, (PTR) (conds + i)); for (i = 0; i < sizeof (shift) / sizeof (struct asm_shift); i++) @@ -3480,6 +4825,7 @@ offsetT newval, temp; int sign; char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; + arm_fix_data *arm_data = (arm_fix_data *) fixP->tc_fix_data; assert (fixP->fx_r_type < BFD_RELOC_UNUSED); @@ -3519,15 +4865,41 @@ md_number_to_chars (buf, newval, INSN_SIZE); break; - case BFD_RELOC_ARM_OFFSET_IMM: + case BFD_RELOC_ARM_OFFSET_IMM: sign = value >= 0; - value = validate_offset_imm (value); /* Should be OK ... but .... */ + if ((value = validate_offset_imm (value, 0)) == FAIL) + { + as_bad ("bad immediate value for offset (%d)", val); + break; + } if (value < 0) value = -value; newval = md_chars_to_number (buf, INSN_SIZE); newval &= 0xff7ff000; - newval |= value | (sign ? 0x00800000 : 0); + newval |= value | (sign ? INDEX_UP : 0); + md_number_to_chars (buf, newval, INSN_SIZE); + break; + + case BFD_RELOC_ARM_OFFSET_IMM8: + case BFD_RELOC_ARM_HWLITERAL: + sign = value >= 0; + if ((value = validate_offset_imm (value, 1)) == FAIL) + { + if (fixP->fx_r_type == BFD_RELOC_ARM_HWLITERAL) + as_bad_where (fixP->fx_file, fixP->fx_line, + "invalid literal constant: pool needs to be closer\n"); + else + as_bad ("bad immediate value for offset (%d)", value); + break; + } + + if (value < 0) + value = -value; + + newval = md_chars_to_number (buf, INSN_SIZE); + newval &= 0xff7ff0f0; + newval |= ((value >> 4) << 8) | value & 0xf | (sign ? INDEX_UP : 0); md_number_to_chars (buf, newval, INSN_SIZE); break; @@ -3536,7 +4908,7 @@ if (value < 0) value = -value; - if ((value = validate_immediate (value)) == FAIL) + if ((value = validate_offset_imm (value, 0)) == FAIL) { as_bad_where (fixP->fx_file, fixP->fx_line, "invalid literal constant: pool needs to be closer\n"); @@ -3545,7 +4917,7 @@ newval = md_chars_to_number (buf, INSN_SIZE); newval &= 0xff7ff000; - newval |= value | (sign ? 0x00800000 : 0); + newval |= value | (sign ? INDEX_UP : 0); md_number_to_chars (buf, newval, INSN_SIZE); break; @@ -3570,11 +4942,24 @@ break; case BFD_RELOC_ARM_SWI: - if (((unsigned long) value) > 0x00ffffff) - as_bad_where (fixP->fx_file, fixP->fx_line, "Invalid swi expression"); - newval = md_chars_to_number (buf, INSN_SIZE) & 0xff000000; - newval |= value; - md_number_to_chars (buf, newval , INSN_SIZE); + if (arm_data->thumb_mode) + { + if (((unsigned long) value) > 0xff) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid swi expression"); + newval = md_chars_to_number (buf, THUMB_SIZE) & 0xff00; + newval |= value; + md_number_to_chars (buf, newval, THUMB_SIZE); + } + else + { + if (((unsigned long) value) > 0x00ffffff) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid swi expression"); + newval = md_chars_to_number (buf, INSN_SIZE) & 0xff000000; + newval |= value; + md_number_to_chars (buf, newval , INSN_SIZE); + } break; case BFD_RELOC_ARM_MULTI: @@ -3586,11 +4971,65 @@ break; case BFD_RELOC_ARM_PCREL_BRANCH: - value = (value >> 2) & 0x00ffffff; - newval = md_chars_to_number (buf, INSN_SIZE); - value = (value + (newval & 0x00ffffff)) & 0x00ffffff; - newval = value | (newval & 0xff000000); - md_number_to_chars (buf, newval, INSN_SIZE); + if (arm_data->thumb_mode) + { + unsigned long newval2; + newval = md_chars_to_number (buf, THUMB_SIZE); + if (fixP->fx_size == 4) + { + unsigned long diff; + + newval2 = md_chars_to_number (buf, THUMB_SIZE); + diff = ((newval & 0x7ff) << 12) | ((newval2 & 0x7ff) << 1); + if (diff & 0x400000) + diff |= ~0x3fffff; + value += diff; + if ((value & 0x400000) && ((value & ~0x3fffff) != ~0x3fffff)) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Branch with link out of range"); + + newval = (newval & 0xf800) | ((value & 0x7fffff) >> 12); + newval2 = (newval2 & 0xf800) | ((value & 0xfff) >> 1); + md_number_to_chars (buf, newval, THUMB_SIZE); + md_number_to_chars (buf, newval2, THUMB_SIZE); + } + else + { + if (newval == T_OPCODE_BRANCH) + { + unsigned long diff = (newval & 0x7ff) << 1; + if (diff & 0x800) + diff |= ~0x7ff; + + value += diff; + if ((value & 0x800) && ((value & ~0x7ff) != ~0x7ff)) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Branch out of range"); + newval = (newval & 0xf800) | ((value & 0xfff) >> 1); + } + else + { + unsigned long diff = (newval & 0xff) << 1; + if (diff & 0x100) + diff |= ~0xff; + + value += diff; + if ((value & 0x100) && ((value & ~0xff) != ~0xff)) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Branch out of range"); + newval = (newval & 0xff00) | ((value & 0x1ff) >> 1); + } + md_number_to_chars (buf, newval, THUMB_SIZE); + } + } + else + { + value = (value >> 2) & 0x00ffffff; + newval = md_chars_to_number (buf, INSN_SIZE); + value = (value + (newval & 0x00ffffff)) & 0x00ffffff; + newval = value | (newval & 0xff000000); + md_number_to_chars (buf, newval, INSN_SIZE); + } break; case BFD_RELOC_8: @@ -3617,10 +5056,152 @@ if (value < 0) value = -value; newval = md_chars_to_number (buf, INSN_SIZE) & 0xff7fff00; - newval |= (value >> 2) | (sign ? 0x00800000 : 0); + newval |= (value >> 2) | (sign ? INDEX_UP : 0); md_number_to_chars (buf, newval , INSN_SIZE); break; + case BFD_RELOC_ARM_THUMB_OFFSET: + newval = md_chars_to_number (buf, THUMB_SIZE); + /* Exactly what ranges, and where the offset is inserted depends on + the type of instruction, we can establish this from the top 4 bits */ + switch (newval >> 12) + { + case 4: /* PC load */ + /* PC loads are somewhat odd, bit 2 of the PC is forced to zero + for these loads, so we may need to round up the offset if the + instruction is not word aligned since the final address must + be. */ + + if ((fixP->fx_frag->fr_address + fixP->fx_where + value) & 3) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid offset, target not word aligned"); + + if ((value + 2) & ~0x3fe) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid offset"); + /* Round up, since pc will be rounded down. */ + newval |= (value + 2) >> 2; + break; + + case 9: /* SP load/store */ + if (value & ~0x3fc) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid offset"); + newval |= value >> 2; + break; + + case 6: /* Word load/store */ + if (value & ~0x7c) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid offset"); + newval |= value << 4; /* 6 - 2 */ + break; + + case 7: /* Byte load/store */ + if (value & ~0x1f) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid offset"); + newval |= value << 6; + break; + + case 8: /* Halfword load/store */ + if (value & ~0x3e) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid offset"); + newval |= value << 5; /* 6 - 1 */ + break; + + default: + abort (); + } + md_number_to_chars (buf, newval, THUMB_SIZE); + break; + + case BFD_RELOC_ARM_THUMB_ADD: + /* This is a complicated relocation, since we use it for all of + the following immediate relocations: + 3bit ADD/SUB + 8bit ADD/SUB + 9bit ADD/SUB SP word-aligned + 10bit ADD PC/SP word-aligned + + The type of instruction being processed is encoded in the + instruction field: + 0x8000 SUB + 0x00F0 Rd + 0x000F Rs + */ + newval = md_chars_to_number (buf, THUMB_SIZE); + { + int rd = (newval >> 4) & 0xf; + int rs = newval & 0xf; + int subtract = newval & 0x8000; + + if (rd == REG_SP) + { + if (value & ~0x1fc) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid immediate for stack address calculation"); + newval = subtract ? T_OPCODE_SUB_ST : T_OPCODE_ADD_ST; + newval |= value >> 2; + } + else if (rs == REG_PC || rs == REG_SP) + { + if (subtract || + value & ~0x3fc) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid immediate for address calculation (value = 0x%08X)", value); + newval = (rs == REG_PC ? T_OPCODE_ADD_PC : T_OPCODE_ADD_SP); + newval |= value >> 2; + } + else if (rs == rd) + { + if (value & ~0xff) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid 8bit immediate"); + newval = subtract ? T_OPCODE_SUB_I8 : T_OPCODE_ADD_I8; + newval |= (rd << 8) | value; + } + else + { + if (value & ~0x7) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid 3bit immediate"); + newval = subtract ? T_OPCODE_SUB_I3 : T_OPCODE_ADD_I3; + newval |= rd | (rs << 3) | (value << 6); + } + } + md_number_to_chars (buf, newval , THUMB_SIZE); + break; + + case BFD_RELOC_ARM_THUMB_IMM: + newval = md_chars_to_number (buf, THUMB_SIZE); + switch (newval >> 11) + { + case 0x04: /* 8bit immediate MOV */ + case 0x05: /* 8bit immediate CMP */ + if (value < 0 || value > 255) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Invalid immediate: %d is too large", value); + newval |= value; + break; + + default: + abort (); + } + md_number_to_chars (buf, newval , THUMB_SIZE); + break; + + case BFD_RELOC_ARM_THUMB_SHIFT: + /* 5bit shift value (0..31) */ + if (value < 0 || value > 31) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Illegal Thumb shift value: %d", value); + newval = md_chars_to_number (buf, THUMB_SIZE) & 0xf03f; + newval |= value << 6; + md_number_to_chars (buf, newval , THUMB_SIZE); + break; + case BFD_RELOC_NONE: default: as_bad_where (fixP->fx_file, fixP->fx_line, @@ -3640,8 +5221,7 @@ arelent *reloc; bfd_reloc_code_real_type code; - reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent)); - assert (reloc != 0); + reloc = (arelent *) xmalloc (sizeof (arelent)); reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym; reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; @@ -3681,6 +5261,7 @@ break; case BFD_RELOC_ARM_LITERAL: + case BFD_RELOC_ARM_HWLITERAL: /* If this is called then the a literal has been referenced across a section boundry - possibly due to an implicit dump */ as_bad ("Literal referenced across section boundry (Implicit dump?)"); @@ -3696,6 +5277,11 @@ , fixp->fx_r_type); return NULL; + case BFD_RELOC_ARM_OFFSET_IMM8: + as_bad ("Internal_relocation (type %d) not fixed up (OFFSET_IMM8)" + , fixp->fx_r_type); + return NULL; + case BFD_RELOC_ARM_SHIFT_IMM: as_bad ("Internal_relocation (type %d) not fixed up (SHIFT_IMM)" , fixp->fx_r_type); @@ -3716,6 +5302,11 @@ , fixp->fx_r_type); return NULL; + case BFD_RELOC_ARM_THUMB_OFFSET: + as_bad ("Internal_relocation (type %d) not fixed up (THUMB_OFFSET)" + , fixp->fx_r_type); + return NULL; + default: abort (); } @@ -3771,12 +5362,19 @@ return; } - to = frag_more (INSN_SIZE); - md_number_to_chars (to, inst.instruction, INSN_SIZE); + to = frag_more (inst.size); + if (thumb_mode && (inst.size > 2)) + { + md_number_to_chars (to, inst.instruction >> 16, 2); + to += 2; + inst.size = 2; + } + + md_number_to_chars (to, inst.instruction, inst.size); if (inst.reloc.type != BFD_RELOC_NONE) fix_new_arm (frag_now, to - frag_now->fr_literal, - 4, &inst.reloc.exp, inst.reloc.pc_rel, + inst.size, &inst.reloc.exp, inst.reloc.pc_rel, inst.reloc.type); return; @@ -3787,7 +5385,6 @@ char *str; { char c; - CONST struct asm_opcode *opcode; char *p, *q, *start; /* Align the instruction */ @@ -3821,129 +5418,153 @@ return; } - /* p now points to the end of the opcode, probably white space, but we have - to break the opcode up in case it contains condionals and flags; - keep trying with progressively smaller basic instructions until one - matches, or we run out of opcode. */ - q = (p - str > LONGEST_INST) ? str + LONGEST_INST : p; - for (; q != str; q--) - { - c = *q; - *q = '\0'; - opcode = (CONST struct asm_opcode *) hash_find (arm_ops_hsh, str); - *q = c; - if (opcode && opcode->template) - { - unsigned long flag_bits = 0; - char *r; - - /* Check that this instruction is supported for this CPU */ - if ((opcode->variants & cpu_variant) == 0) - goto try_shorter; + if (thumb_mode) + { + CONST struct thumb_opcode *opcode; + c = *p; + *p = '\0'; + opcode = (CONST struct thumb_opcode *) hash_find (arm_tops_hsh, str); + *p = c; + if (opcode) + { inst.instruction = opcode->value; - if (q == p) /* Just a simple opcode */ + inst.size = opcode->size; + (*opcode->parms)(p); + output_inst (start); + return; + } + } + else + { + CONST struct asm_opcode *opcode; + + inst.size = INSN_SIZE; + /* p now points to the end of the opcode, probably white space, but we + have to break the opcode up in case it contains condionals and flags; + keep trying with progressively smaller basic instructions until one + matches, or we run out of opcode. */ + q = (p - str > LONGEST_INST) ? str + LONGEST_INST : p; + for (; q != str; q--) + { + c = *q; + *q = '\0'; + opcode = (CONST struct asm_opcode *) hash_find (arm_ops_hsh, str); + *q = c; + if (opcode && opcode->template) { - if (opcode->comp_suffix != 0) - as_bad ("Opcode `%s' must have suffix from <%s>\n", str, - opcode->comp_suffix); - else + unsigned long flag_bits = 0; + char *r; + + /* Check that this instruction is supported for this CPU */ + if ((opcode->variants & cpu_variant) == 0) + goto try_shorter; + + inst.instruction = opcode->value; + if (q == p) /* Just a simple opcode */ { - inst.instruction |= COND_ALWAYS; - (*opcode->parms)(q, 0); + if (opcode->comp_suffix != 0) + as_bad ("Opcode `%s' must have suffix from <%s>\n", str, + opcode->comp_suffix); + else + { + inst.instruction |= COND_ALWAYS; + (*opcode->parms)(q, 0); + } + output_inst (start); + return; } - output_inst (start); - return; - } - /* Now check for a conditional */ - r = q; - if (p - r >= 2) - { - CONST struct asm_cond *cond; - char d = *(r + 2); - - *(r + 2) = '\0'; - cond = (CONST struct asm_cond *) hash_find (arm_cond_hsh, r); - *(r + 2) = d; - if (cond) + /* Now check for a conditional */ + r = q; + if (p - r >= 2) { - if (cond->value == 0xf0000000) - as_tsktsk - ("Warning: Use of the 'nv' conditional is deprecated\n"); + CONST struct asm_cond *cond; + char d = *(r + 2); + + *(r + 2) = '\0'; + cond = (CONST struct asm_cond *) hash_find (arm_cond_hsh, r); + *(r + 2) = d; + if (cond) + { + if (cond->value == 0xf0000000) + as_tsktsk ( +"Warning: Use of the 'nv' conditional is deprecated\n"); - inst.instruction |= cond->value; - r += 2; + inst.instruction |= cond->value; + r += 2; + } + else + inst.instruction |= COND_ALWAYS; } else inst.instruction |= COND_ALWAYS; - } - else - inst.instruction |= COND_ALWAYS; - - /* if there is a compulsory suffix, it should come here, before - any optional flags. */ - if (opcode->comp_suffix) - { - CONST char *s = opcode->comp_suffix; - while (*s) - { - inst.suffix++; - if (*r == *s) - break; - s++; - } - - if (*s == '\0') + /* if there is a compulsory suffix, it should come here, before + any optional flags. */ + if (opcode->comp_suffix) { - as_bad ("Opcode `%s' must have suffix from <%s>\n", str, - opcode->comp_suffix); - return; - } - - r++; - } + CONST char *s = opcode->comp_suffix; - /* The remainder, if any should now be flags for the instruction; - Scan these checking each one found with the opcode. */ - if (r != p) - { - char d; - CONST struct asm_flg *flag = opcode->flags; + while (*s) + { + inst.suffix++; + if (*r == *s) + break; + s++; + } - if (flag) - { - int flagno; + if (*s == '\0') + { + as_bad ("Opcode `%s' must have suffix from <%s>\n", str, + opcode->comp_suffix); + return; + } + + r++; + } - d = *p; - *p = '\0'; + /* The remainder, if any should now be flags for the instruction; + Scan these checking each one found with the opcode. */ + if (r != p) + { + char d; + CONST struct asm_flg *flag = opcode->flags; - for (flagno = 0; flag[flagno].template; flagno++) + if (flag) { - if (! strcmp (r, flag[flagno].template)) + int flagno; + + d = *p; + *p = '\0'; + + for (flagno = 0; flag[flagno].template; flagno++) { - flag_bits |= flag[flagno].set_bits; - break; + if (! strcmp (r, flag[flagno].template)) + { + flag_bits |= flag[flagno].set_bits; + break; + } } - } - *p = d; - if (! flag[flagno].template) + *p = d; + if (! flag[flagno].template) + goto try_shorter; + } + else goto try_shorter; } - else - goto try_shorter; + + (*opcode->parms) (p, flag_bits); + output_inst (start); + return; } - (*opcode->parms) (p, flag_bits); - output_inst (start); - return; + try_shorter: + ; } - - try_shorter: - ; } + /* It wasn't an instruction, but it might be a register alias of the form alias .req reg */ @@ -4004,8 +5625,8 @@ * -m[arm]1 Currently not supported. * -m[arm]2, -m[arm]250 Arm 2 and Arm 250 processor * -m[arm]3 Arm 3 processor - * -m[arm]6, -m[arm]7 Arm 6 and 7 processors - * -m[arm]7dm Arm 7dm processors + * -m[arm]6, Arm 6 processors + * -m[arm]7[t][[d]m] Arm 7 processors * -mall All (except the ARM1) * FP variants: * -mfpa10, -mfpa11 FPA10 and 11 co-processor instructions @@ -4026,7 +5647,7 @@ #endif {NULL, no_argument, NULL, 0} }; -size_t md_longopts_size = sizeof(md_longopts); +size_t md_longopts_size = sizeof (md_longopts); int md_parse_option (c, arg) @@ -4065,6 +5686,18 @@ cpu_variant &= ~FPU_ALL; break; + case 't': + /* Limit assembler to generating only Thumb instructions: */ + if (! strcmp (str, "thumb")) + { + cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_THUMB; + cpu_variant = (cpu_variant & ~FPU_ALL) | FPU_NONE; + thumb_mode = 1; + } + else + goto bad; + break; + default: if (! strcmp (str, "all")) { @@ -4109,12 +5742,30 @@ break; case '7': - if (! strcmp (str, "7")) - cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_7; - else if (! strcmp (str, "7dm")) - cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_7DM; - else - goto bad; + str++; /* eat the '7' */ + cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_7; + for (; *str; str++) + { + switch (*str) + { + case 't': + cpu_variant |= ARM_THUMB; + break; + + case 'm': + cpu_variant |= ARM_LONGMUL; + break; + + case 'd': /* debug */ + case 'i': /* embedded ice */ + /* Included for completeness in ARM processor + naming. */ + break; + + default: + goto bad; + } + } break; default: @@ -4137,8 +5788,8 @@ FILE *fp; { fprintf (fp, -"-m[arm]1, -m[arm]2, -m[arm]250,\n-m[arm]3, -m[arm]6, -m[arm]7, -m[arm]7dm\n\ -\t\t\tselect processor architecture\n\ +"-m[arm]1, -m[arm]2, -m[arm]250,\n-m[arm]3, -m[arm]6, -m[arm]7[t][[d]m]\n\ +-mthumb\t\t\tselect processor architecture\n\ -mall\t\t\tallow any instruction\n\ -mfpa10, -mfpa11\tselect floating point architecture\n\ -mfpe-old\t\tdon't allow floating-point multiple instructions\n\ @@ -4167,6 +5818,7 @@ int reloc; { fixS *new_fix; + arm_fix_data *arm_data; switch (exp->X_op) { @@ -4178,25 +5830,16 @@ break; default: - { - const char *fake; - symbolS *symbolP; - - /* FIXME: This should be something which decode_local_label_name - will handle. */ - fake = FAKE_LABEL_NAME; - - /* Putting constant symbols in absolute_section rather than - expr_section is convenient for the old a.out code, for which - S_GET_SEGMENT does not always retrieve the value put in by - S_SET_SEGMENT. */ - symbolP = symbol_new (fake, expr_section, 0, &zero_address_frag); - symbolP->sy_value = *exp; - new_fix = fix_new (frag, where, size, symbolP, 0, pc_rel, reloc); - } + new_fix = fix_new (frag, where, size, make_expr_symbol (exp), 0, + pc_rel, reloc); break; } + /* Mark whether the fix is to a THUMB instruction, or an ARM instruction */ + arm_data = (arm_fix_data *) obstack_alloc (¬es, sizeof (arm_fix_data)); + new_fix->tc_fix_data = (PTR) arm_data; + arm_data->thumb_mode = thumb_mode; + return; } @@ -4226,4 +5869,32 @@ symbolS *sym; { last_label_seen = sym; +} + +int +arm_data_in_code () +{ + if (thumb_mode && ! strncmp (input_line_pointer + 1, "data:", 5)) + { + *input_line_pointer = '/'; + input_line_pointer += 5; + *input_line_pointer = 0; + return 1; + } + return 0; +} + +char * +arm_canonicalize_symbol_name (name) + char *name; +{ + int len; + + if (thumb_mode && (len = strlen (name)) > 5 + && ! strcmp (name + len - 5, "/data")) + { + *(name + len - 5) = 0; + } + + return name; } diff -urN binutils-2.7/gas/config/tc-arm.h binutils-2.8/gas/config/tc-arm.h --- binutils-2.7/gas/config/tc-arm.h Thu Jul 4 12:13:53 1996 +++ binutils-2.8/gas/config/tc-arm.h Wed Apr 30 12:53:17 1997 @@ -1,9 +1,8 @@ /* This file is tc-arm.h + Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) Modified by David Taylor (dtaylor@armltd.co.uk) - Copyright (C) 1994, 1995 Free Software Foundation, Inc. - This file is part of GAS, the GNU Assembler. GAS is free software; you can redistribute it and/or modify @@ -17,11 +16,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #define TC_ARM 1 +#ifndef TARGET_BYTES_BIG_ENDIAN +#define TARGET_BYTES_BIG_ENDIAN 0 +#endif + #define COFF_MAGIC ARMMAGIC #define TARGET_ARCH bfd_arch_arm @@ -32,19 +36,11 @@ #define LITTLE_ENDIAN 1234 #define BIG_ENDIAN 4321 -/* If neither TARGET_BYTES_BIG_ENDIAN nor TARGET_BYTES_LITTLE_ENDIAN - is specified, default to little endian. */ -#ifndef TARGET_BYTES_BIG_ENDIAN -#ifndef TARGET_BYTES_LITTLE_ENDIAN -#define TARGET_BYTES_LITTLE_ENDIAN -#endif -#endif - #ifdef OBJ_AOUT #ifdef TE_RISCIX #define TARGET_FORMAT "a.out-riscix" #else -#ifdef TARGET_BYTES_BIG_ENDIAN +#if TARGET_BYTES_BIG_ENDIAN #define TARGET_FORMAT "a.out-arm-big" #else #define TARGET_FORMAT "a.out-arm-little" @@ -75,6 +71,17 @@ #define obj_fix_adjustable(fixP) 0 +#define TC_FIX_TYPE PTR +#define TC_INIT_FIX_DATA(FIXP) ((FIXP)->tc_fix_data = NULL) + +#define TC_START_LABEL(C,STR) \ + (c == ':' || (c == '/' && arm_data_in_code ())) +int arm_data_in_code PARAMS ((void)); + +#define tc_canonicalize_symbol_name(str) \ + arm_canonicalize_symbol_name (str); +char *arm_canonicalize_symbol_name PARAMS ((char *)); + #if 0 /* It isn't as simple as this */ #define tc_frob_symbol(sym,punt) \ { if (S_IS_LOCAL (sym)) \ @@ -104,9 +111,10 @@ #define LOCAL_LABELS_FB 1 /* Use defaults for OBJ_AOUT. */ +#ifndef BFD_ASSEMBLER #ifndef OBJ_AOUT #define LOCAL_LABEL(name) ((name)[0] == '.' && (name)[1] == 'L') -#define FAKE_LABEL_NAME ".L0\001" +#endif #endif /* end of tc-arm.h */ diff -urN binutils-2.7/gas/config/tc-d10v.c binutils-2.8/gas/config/tc-d10v.c --- binutils-2.7/gas/config/tc-d10v.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/tc-d10v.c Wed Apr 30 12:53:17 1997 @@ -0,0 +1,1430 @@ +/* tc-d10v.c -- Assembler code for the Mitsubishi D10V + + Copyright (C) 1996, 1997 Free Software Foundation. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include "as.h" +#include "subsegs.h" +#include "opcode/d10v.h" +#include "elf/ppc.h" + +const char comment_chars[] = ";"; +const char line_comment_chars[] = "#"; +const char line_separator_chars[] = ""; +const char *md_shortopts = "O"; +const char EXP_CHARS[] = "eE"; +const char FLT_CHARS[] = "dD"; + +int Optimizing = 0; + +#define AT_WORD (-1) + +/* fixups */ +#define MAX_INSN_FIXUPS (5) +struct d10v_fixup +{ + expressionS exp; + int operand; + int pcrel; + int size; + bfd_reloc_code_real_type reloc; +}; + +typedef struct _fixups +{ + int fc; + struct d10v_fixup fix[MAX_INSN_FIXUPS]; + struct _fixups *next; +} Fixups; + +static Fixups FixUps[2]; +static Fixups *fixups; + +/* local functions */ +static int reg_name_search PARAMS ((char *name)); +static int register_name PARAMS ((expressionS *expressionP)); +static int check_range PARAMS ((unsigned long num, int bits, int flags)); +static int postfix PARAMS ((char *p)); +static bfd_reloc_code_real_type get_reloc PARAMS ((struct d10v_operand *op)); +static int get_operands PARAMS ((expressionS exp[])); +static struct d10v_opcode *find_opcode PARAMS ((struct d10v_opcode *opcode, expressionS ops[])); +static unsigned long build_insn PARAMS ((struct d10v_opcode *opcode, expressionS *opers, unsigned long insn)); +static void write_long PARAMS ((struct d10v_opcode *opcode, unsigned long insn, Fixups *fx)); +static void write_1_short PARAMS ((struct d10v_opcode *opcode, unsigned long insn, Fixups *fx)); +static int write_2_short PARAMS ((struct d10v_opcode *opcode1, unsigned long insn1, + struct d10v_opcode *opcode2, unsigned long insn2, int exec_type, Fixups *fx)); +static unsigned long do_assemble PARAMS ((char *str, struct d10v_opcode **opcode)); +static unsigned long d10v_insert_operand PARAMS (( unsigned long insn, int op_type, + offsetT value, int left, fixS *fix)); +static int parallel_ok PARAMS ((struct d10v_opcode *opcode1, unsigned long insn1, + struct d10v_opcode *opcode2, unsigned long insn2, + int exec_type)); + +struct option md_longopts[] = { + {NULL, no_argument, NULL, 0} +}; +size_t md_longopts_size = sizeof(md_longopts); + +static void d10v_dot_word PARAMS ((int)); + +/* The target specific pseudo-ops which we support. */ +const pseudo_typeS md_pseudo_table[] = +{ + { "word", d10v_dot_word, 2 }, + { NULL, NULL, 0 } +}; + +/* Opcode hash table. */ +static struct hash_control *d10v_hash; + +/* reg_name_search does a binary search of the d10v_predefined_registers + array to see if "name" is a valid regiter name. Returns the register + number from the array on success, or -1 on failure. */ + +static int +reg_name_search (name) + char *name; +{ + int middle, low, high; + int cmp; + + low = 0; + high = d10v_reg_name_cnt() - 1; + + do + { + middle = (low + high) / 2; + cmp = strcasecmp (name, d10v_predefined_registers[middle].name); + if (cmp < 0) + high = middle - 1; + else if (cmp > 0) + low = middle + 1; + else + return d10v_predefined_registers[middle].value; + } + while (low <= high); + return -1; +} + +/* register_name() checks the string at input_line_pointer + to see if it is a valid register name */ + +static int +register_name (expressionP) + expressionS *expressionP; +{ + int reg_number; + char c, *p = input_line_pointer; + + while (*p && *p!='\n' && *p!='\r' && *p !=',' && *p!=' ' && *p!=')') + p++; + + c = *p; + if (c) + *p++ = 0; + + /* look to see if it's in the register table */ + reg_number = reg_name_search (input_line_pointer); + if (reg_number >= 0) + { + expressionP->X_op = O_register; + /* temporarily store a pointer to the string here */ + expressionP->X_op_symbol = (struct symbol *)input_line_pointer; + expressionP->X_add_number = reg_number; + input_line_pointer = p; + return 1; + } + if (c) + *(p-1) = c; + return 0; +} + + +static int +check_range (num, bits, flags) + unsigned long num; + int bits; + int flags; +{ + long min, max, bit1; + int retval=0; + + /* don't bother checking 16-bit values */ + if (bits == 16) + return 0; + + if (flags & OPERAND_SHIFT) + { + /* all special shift operands are unsigned */ + /* and <= 16. We allow 0 for now. */ + if (num>16) + return 1; + else + return 0; + } + + if (flags & OPERAND_SIGNED) + { + max = (1 << (bits - 1))-1; + min = - (1 << (bits - 1)); + if (((long)num > max) || ((long)num < min)) + retval = 1; + } + else + { + max = (1 << bits) - 1; + min = 0; + if ((num > max) || (num < min)) + retval = 1; + } + return retval; +} + + +void +md_show_usage (stream) + FILE *stream; +{ + fprintf(stream, "D10V options:\n\ +-O optimize. Will do some operations in parallel.\n"); +} + +int +md_parse_option (c, arg) + int c; + char *arg; +{ + switch (c) + { + case 'O': + /* Optimize. Will attempt to parallelize operations */ + Optimizing = 1; + break; + default: + return 0; + } + return 1; +} + +symbolS * +md_undefined_symbol (name) + char *name; +{ + return 0; +} + +/* Turn a string in input_line_pointer into a floating point constant of type + type, and store the appropriate bytes in *litP. The number of LITTLENUMS + emitted is stored in *sizeP . An error message is returned, or NULL on OK. + */ +char * +md_atof (type, litP, sizeP) + int type; + char *litP; + int *sizeP; +{ + int prec; + LITTLENUM_TYPE words[4]; + char *t; + int i; + + switch (type) + { + case 'f': + prec = 2; + break; + case 'd': + prec = 4; + break; + default: + *sizeP = 0; + return "bad call to md_atof"; + } + + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + + *sizeP = prec * 2; + + for (i = 0; i < prec; i++) + { + md_number_to_chars (litP, (valueT) words[i], 2); + litP += 2; + } + return NULL; +} + +void +md_convert_frag (abfd, sec, fragP) + bfd *abfd; + asection *sec; + fragS *fragP; +{ + abort (); +} + +valueT +md_section_align (seg, addr) + asection *seg; + valueT addr; +{ + int align = bfd_get_section_alignment (stdoutput, seg); + return ((addr + (1 << align) - 1) & (-1 << align)); +} + + +void +md_begin () +{ + char *prev_name = ""; + struct d10v_opcode *opcode; + d10v_hash = hash_new(); + + /* Insert unique names into hash table. The D10v instruction set + has many identical opcode names that have different opcodes based + on the operands. This hash table then provides a quick index to + the first opcode with a particular name in the opcode table. */ + + for (opcode = (struct d10v_opcode *)d10v_opcodes; opcode->name; opcode++) + { + if (strcmp (prev_name, opcode->name)) + { + prev_name = (char *)opcode->name; + hash_insert (d10v_hash, opcode->name, (char *) opcode); + } + } + + fixups = &FixUps[0]; + FixUps[0].next = &FixUps[1]; + FixUps[1].next = &FixUps[0]; +} + + +/* this function removes the postincrement or postdecrement + operator ( '+' or '-' ) from an expression */ + +static int postfix (p) + char *p; +{ + while (*p != '-' && *p != '+') + { + if (*p==0 || *p=='\n' || *p=='\r') + break; + p++; + } + + if (*p == '-') + { + *p = ' '; + return (-1); + } + if (*p == '+') + { + *p = ' '; + return (1); + } + + return (0); +} + + +static bfd_reloc_code_real_type +get_reloc (op) + struct d10v_operand *op; +{ + int bits = op->bits; + + if (bits <= 4) + return (0); + + if (op->flags & OPERAND_ADDR) + { + if (bits == 8) + return (BFD_RELOC_D10V_10_PCREL_R); + else + return (BFD_RELOC_D10V_18_PCREL); + } + + return (BFD_RELOC_16); +} + + +/* get_operands parses a string of operands and returns + an array of expressions */ + +static int +get_operands (exp) + expressionS exp[]; +{ + char *p = input_line_pointer; + int numops = 0; + int post = 0; + + while (*p) + { + while (*p == ' ' || *p == '\t' || *p == ',') + p++; + if (*p==0 || *p=='\n' || *p=='\r') + break; + + if (*p == '@') + { + p++; + exp[numops].X_op = O_absent; + if (*p == '(') + { + p++; + exp[numops].X_add_number = OPERAND_ATPAR; + } + else if (*p == '-') + { + p++; + exp[numops].X_add_number = OPERAND_ATMINUS; + } + else + { + exp[numops].X_add_number = OPERAND_ATSIGN; + post = postfix (p); + } + numops++; + continue; + } + + if (*p == ')') + { + /* just skip the trailing paren */ + p++; + continue; + } + + input_line_pointer = p; + + /* check to see if it might be a register name */ + if (!register_name (&exp[numops])) + { + /* parse as an expression */ + expression (&exp[numops]); + } + + if (!strncasecmp (input_line_pointer, "@word", 5)) + { + if (exp[numops].X_op == O_register) + { + /* if it looked like a register name but was followed by "@word" */ + /* then it was really a symbol, so change it to one */ + exp[numops].X_op = O_symbol; + exp[numops].X_add_symbol = symbol_find_or_make ((char *)exp[numops].X_op_symbol); + exp[numops].X_op_symbol = NULL; + } + exp[numops].X_add_number = AT_WORD; + input_line_pointer += 5; + } + + if (exp[numops].X_op == O_illegal) + as_bad ("illegal operand"); + else if (exp[numops].X_op == O_absent) + as_bad ("missing operand"); + + numops++; + p = input_line_pointer; + } + + switch (post) + { + case -1: /* postdecrement mode */ + exp[numops].X_op = O_absent; + exp[numops++].X_add_number = OPERAND_MINUS; + break; + case 1: /* postincrement mode */ + exp[numops].X_op = O_absent; + exp[numops++].X_add_number = OPERAND_PLUS; + break; + } + + exp[numops].X_op = 0; + return (numops); +} + +static unsigned long +d10v_insert_operand (insn, op_type, value, left, fix) + unsigned long insn; + int op_type; + offsetT value; + int left; + fixS *fix; +{ + int shift, bits; + + shift = d10v_operands[op_type].shift; + if (left) + shift += 15; + + bits = d10v_operands[op_type].bits; + + /* truncate to the proper number of bits */ + if (check_range (value, bits, d10v_operands[op_type].flags)) + as_bad_where (fix->fx_file, fix->fx_line, "operand out of range: %d", value); + + value &= 0x7FFFFFFF >> (31 - bits); + insn |= (value << shift); + + return insn; +} + + +/* build_insn takes a pointer to the opcode entry in the opcode table + and the array of operand expressions and returns the instruction */ + +static unsigned long +build_insn (opcode, opers, insn) + struct d10v_opcode *opcode; + expressionS *opers; + unsigned long insn; +{ + int i, bits, shift, flags, format; + unsigned int number; + + /* the insn argument is only used for the DIVS kludge */ + if (insn) + format = LONG_R; + else + { + insn = opcode->opcode; + format = opcode->format; + } + + for (i=0;opcode->operands[i];i++) + { + flags = d10v_operands[opcode->operands[i]].flags; + bits = d10v_operands[opcode->operands[i]].bits; + shift = d10v_operands[opcode->operands[i]].shift; + number = opers[i].X_add_number; + + if (flags & OPERAND_REG) + { + number &= REGISTER_MASK; + if (format == LONG_L) + shift += 15; + } + + if (opers[i].X_op != O_register && opers[i].X_op != O_constant) + { + /* now create a fixup */ + + if (fixups->fc >= MAX_INSN_FIXUPS) + as_fatal ("too many fixups"); + + if (opers[i].X_op == O_symbol && number == AT_WORD) + { + number = opers[i].X_add_number = 0; + fixups->fix[fixups->fc].reloc = BFD_RELOC_D10V_18; + } else + fixups->fix[fixups->fc].reloc = + get_reloc((struct d10v_operand *)&d10v_operands[opcode->operands[i]]); + + if (fixups->fix[fixups->fc].reloc == BFD_RELOC_16 || + fixups->fix[fixups->fc].reloc == BFD_RELOC_D10V_18) + fixups->fix[fixups->fc].size = 2; + else + fixups->fix[fixups->fc].size = 4; + + fixups->fix[fixups->fc].exp = opers[i]; + fixups->fix[fixups->fc].operand = opcode->operands[i]; + fixups->fix[fixups->fc].pcrel = (flags & OPERAND_ADDR) ? true : false; + (fixups->fc)++; + } + + /* truncate to the proper number of bits */ + if ((opers[i].X_op == O_constant) && check_range (number, bits, flags)) + as_bad("operand out of range: %d",number); + number &= 0x7FFFFFFF >> (31 - bits); + insn = insn | (number << shift); + } + + /* kludge: for DIVS, we need to put the operands in twice */ + /* on the second pass, format is changed to LONG_R to force */ + /* the second set of operands to not be shifted over 15 */ + if ((opcode->opcode == OPCODE_DIVS) && (format==LONG_L)) + insn = build_insn (opcode, opers, insn); + + return insn; +} + +/* write out a long form instruction */ +static void +write_long (opcode, insn, fx) + struct d10v_opcode *opcode; + unsigned long insn; + Fixups *fx; +{ + int i, where; + char *f = frag_more(4); + + insn |= FM11; + number_to_chars_bigendian (f, insn, 4); + + for (i=0; i < fx->fc; i++) + { + if (fx->fix[i].reloc) + { + where = f - frag_now->fr_literal; + if (fx->fix[i].size == 2) + where += 2; + + if (fx->fix[i].reloc == BFD_RELOC_D10V_18) + fx->fix[i].operand |= 4096; + + fix_new_exp (frag_now, + where, + fx->fix[i].size, + &(fx->fix[i].exp), + fx->fix[i].pcrel, + fx->fix[i].operand|2048); + } + } + fx->fc = 0; +} + + +/* write out a short form instruction by itself */ +static void +write_1_short (opcode, insn, fx) + struct d10v_opcode *opcode; + unsigned long insn; + Fixups *fx; +{ + char *f = frag_more(4); + int i, where; + + if (opcode->exec_type & PARONLY) + as_fatal ("Instruction must be executed in parallel with another instruction."); + + /* the other container needs to be NOP */ + /* according to 4.3.1: for FM=00, sub-instructions performed only + by IU cannot be encoded in L-container. */ + if (opcode->unit == IU) + insn |= FM00 | (NOP << 15); /* right container */ + else + insn = FM00 | (insn << 15) | NOP; /* left container */ + + number_to_chars_bigendian (f, insn, 4); + for (i=0; i < fx->fc; i++) + { + if (fx->fix[i].reloc) + { + where = f - frag_now->fr_literal; + if (fx->fix[i].size == 2) + where += 2; + + if (fx->fix[i].reloc == BFD_RELOC_D10V_18) + fx->fix[i].operand |= 4096; + + /* if it's an R reloc, we may have to switch it to L */ + if ( (fx->fix[i].reloc == BFD_RELOC_D10V_10_PCREL_R) && (opcode->unit != IU) ) + fx->fix[i].operand |= 1024; + + fix_new_exp (frag_now, + where, + fx->fix[i].size, + &(fx->fix[i].exp), + fx->fix[i].pcrel, + fx->fix[i].operand|2048); + } + } + fx->fc = 0; +} + +/* write out a short form instruction if possible */ +/* return number of instructions not written out */ +static int +write_2_short (opcode1, insn1, opcode2, insn2, exec_type, fx) + struct d10v_opcode *opcode1, *opcode2; + unsigned long insn1, insn2; + int exec_type; + Fixups *fx; +{ + unsigned long insn; + char *f; + int i,j, where; + + if ( (exec_type != 1) && ((opcode1->exec_type & PARONLY) + || (opcode2->exec_type & PARONLY))) + as_fatal("Instruction must be executed in parallel"); + + if ( (opcode1->format & LONG_OPCODE) || (opcode2->format & LONG_OPCODE)) + as_fatal ("Long instructions may not be combined."); + + if(opcode1->exec_type & BRANCH_LINK && opcode2->exec_type != PARONLY) + { + /* subroutines must be called from 32-bit boundaries */ + /* so the return address will be correct */ + write_1_short (opcode1, insn1, fx->next); + return (1); + } + + switch (exec_type) + { + case 0: /* order not specified */ + if ( Optimizing && parallel_ok (opcode1, insn1, opcode2, insn2, exec_type)) + { + /* parallel */ + if (opcode1->unit == IU) + insn = FM00 | (insn2 << 15) | insn1; + else if (opcode2->unit == MU) + insn = FM00 | (insn2 << 15) | insn1; + else + { + insn = FM00 | (insn1 << 15) | insn2; + fx = fx->next; + } + } + else if (opcode1->unit == IU) + { + /* reverse sequential */ + insn = FM10 | (insn2 << 15) | insn1; + } + else + { + /* sequential */ + insn = FM01 | (insn1 << 15) | insn2; + fx = fx->next; + } + break; + case 1: /* parallel */ + if (opcode1->exec_type & SEQ || opcode2->exec_type & SEQ) + as_fatal ("One of these instructions may not be executed in parallel."); + + if (opcode1->unit == IU) + { + if (opcode2->unit == IU) + as_fatal ("Two IU instructions may not be executed in parallel"); + as_warn ("Swapping instruction order"); + insn = FM00 | (insn2 << 15) | insn1; + } + else if (opcode2->unit == MU) + { + if (opcode1->unit == MU) + as_fatal ("Two MU instructions may not be executed in parallel"); + as_warn ("Swapping instruction order"); + insn = FM00 | (insn2 << 15) | insn1; + } + else + { + insn = FM00 | (insn1 << 15) | insn2; + fx = fx->next; + } + break; + case 2: /* sequential */ + if (opcode1->unit == IU) + as_fatal ("IU instruction may not be in the left container"); + insn = FM01 | (insn1 << 15) | insn2; + fx = fx->next; + break; + case 3: /* reverse sequential */ + if (opcode2->unit == MU) + as_fatal ("MU instruction may not be in the right container"); + insn = FM10 | (insn1 << 15) | insn2; + fx = fx->next; + break; + default: + as_fatal("unknown execution type passed to write_2_short()"); + } + + f = frag_more(4); + number_to_chars_bigendian (f, insn, 4); + + for (j=0; j<2; j++) + { + for (i=0; i < fx->fc; i++) + { + if (fx->fix[i].reloc) + { + where = f - frag_now->fr_literal; + if (fx->fix[i].size == 2) + where += 2; + + if ( (fx->fix[i].reloc == BFD_RELOC_D10V_10_PCREL_R) && (j == 0) ) + fx->fix[i].operand |= 1024; + + if (fx->fix[i].reloc == BFD_RELOC_D10V_18) + fx->fix[i].operand |= 4096; + + fix_new_exp (frag_now, + where, + fx->fix[i].size, + &(fx->fix[i].exp), + fx->fix[i].pcrel, + fx->fix[i].operand|2048); + } + } + fx->fc = 0; + fx = fx->next; + } + return (0); +} + + +/* Check 2 instructions and determine if they can be safely */ +/* executed in parallel. Returns 1 if they can be. */ +static int +parallel_ok (op1, insn1, op2, insn2, exec_type) + struct d10v_opcode *op1, *op2; + unsigned long insn1, insn2; + int exec_type; +{ + int i, j, flags, mask, shift, regno; + unsigned long ins, mod[2], used[2]; + struct d10v_opcode *op; + + if ((op1->exec_type & SEQ) != 0 || (op2->exec_type & SEQ) != 0 + || (op1->exec_type & PAR) == 0 || (op2->exec_type & PAR) == 0 + || (op1->unit == BOTH) || (op2->unit == BOTH) + || (op1->unit == IU && op2->unit == IU) + || (op1->unit == MU && op2->unit == MU)) + return 0; + + /* If the first instruction is a branch and this is auto parallazation, + don't combine with any second instruction. */ + if (exec_type == 0 && (op1->exec_type & BRANCH) != 0) + return 0; + + /* The idea here is to create two sets of bitmasks (mod and used) */ + /* which indicate which registers are modified or used by each instruction. */ + /* The operation can only be done in parallel if instruction 1 and instruction 2 */ + /* modify different registers, and neither instruction modifies any registers */ + /* the other is using. Accesses to control registers, PSW, and memory are treated */ + /* as accesses to a single register. So if both instructions write memory or one */ + /* instruction writes memory and the other reads, then they cannot be done in parallel. */ + /* Likewise, if one instruction mucks with the psw and the other reads the PSW */ + /* (which includes C, F0, and F1), then they cannot operate safely in parallel. */ + + /* the bitmasks (mod and used) look like this (bit 31 = MSB) */ + /* r0-r15 0-15 */ + /* a0-a1 16-17 */ + /* cr (not psw) 18 */ + /* psw 19 */ + /* mem 20 */ + + for (j=0;j<2;j++) + { + if (j == 0) + { + op = op1; + ins = insn1; + } + else + { + op = op2; + ins = insn2; + } + mod[j] = used[j] = 0; + if (op->exec_type & BRANCH_LINK) + mod[j] |= 1 << 13; + + for (i = 0; op->operands[i]; i++) + { + flags = d10v_operands[op->operands[i]].flags; + shift = d10v_operands[op->operands[i]].shift; + mask = 0x7FFFFFFF >> (31 - d10v_operands[op->operands[i]].bits); + if (flags & OPERAND_REG) + { + regno = (ins >> shift) & mask; + if (flags & OPERAND_ACC) + regno += 16; + else if (flags & OPERAND_CONTROL) /* mvtc or mvfc */ + { + if (regno == 0) + regno = 19; + else + regno = 18; + } + else if (flags & OPERAND_FLAG) + regno = 19; + + if ( flags & OPERAND_DEST ) + { + mod[j] |= 1 << regno; + if (flags & OPERAND_EVEN) + mod[j] |= 1 << (regno + 1); + } + else + { + used[j] |= 1 << regno ; + if (flags & OPERAND_EVEN) + used[j] |= 1 << (regno + 1); + } + } + } + if (op->exec_type & RMEM) + used[j] |= 1 << 20; + else if (op->exec_type & WMEM) + mod[j] |= 1 << 20; + else if (op->exec_type & RF0) + used[j] |= 1 << 19; + else if (op->exec_type & WF0) + mod[j] |= 1 << 19; + else if (op->exec_type & WCAR) + mod[j] |= 1 << 19; + } + if ((mod[0] & mod[1]) == 0 && (mod[0] & used[1]) == 0 && (mod[1] & used[0]) == 0) + return 1; + return 0; +} + + +/* This is the main entry point for the machine-dependent assembler. str points to a + machine-dependent instruction. This function is supposed to emit the frags/bytes + it assembles to. For the D10V, it mostly handles the special VLIW parsing and packing + and leaves the difficult stuff to do_assemble(). + */ + +static unsigned long prev_insn; +static struct d10v_opcode *prev_opcode = 0; +static subsegT prev_subseg; +static segT prev_seg = 0;; + +void +md_assemble (str) + char *str; +{ + struct d10v_opcode *opcode; + unsigned long insn; + int extype=0; /* execution type; parallel, etc */ + static int etype=0; /* saved extype. used for multiline instructions */ + char *str2; + + if (etype == 0) + { + /* look for the special multiple instruction separators */ + str2 = strstr (str, "||"); + if (str2) + extype = 1; + else + { + str2 = strstr (str, "->"); + if (str2) + extype = 2; + else + { + str2 = strstr (str, "<-"); + if (str2) + extype = 3; + } + } + /* str2 points to the separator, if one */ + if (str2) + { + *str2 = 0; + + /* if two instructions are present and we already have one saved + then first write it out */ + d10v_cleanup(); + + /* assemble first instruction and save it */ + prev_insn = do_assemble (str, &prev_opcode); + if (prev_insn == -1) + as_fatal ("can't find opcode "); + fixups = fixups->next; + str = str2 + 2; + } + } + + insn = do_assemble (str, &opcode); + if (insn == -1) + { + if (extype) + { + etype = extype; + return; + } + as_fatal ("can't find opcode "); + } + + if (etype) + { + extype = etype; + etype = 0; + } + + /* if this is a long instruction, write it and any previous short instruction */ + if (opcode->format & LONG_OPCODE) + { + if (extype) + as_fatal("Unable to mix instructions as specified"); + d10v_cleanup(); + write_long (opcode, insn, fixups); + prev_opcode = NULL; + return; + } + + if (prev_opcode && prev_seg && ((prev_seg != now_seg) || (prev_subseg != now_subseg))) + d10v_cleanup(); + + if (prev_opcode && (write_2_short (prev_opcode, prev_insn, opcode, insn, extype, fixups) == 0)) + { + /* no instructions saved */ + prev_opcode = NULL; + } + else + { + if (extype) + as_fatal("Unable to mix instructions as specified"); + /* save off last instruction so it may be packed on next pass */ + prev_opcode = opcode; + prev_insn = insn; + prev_seg = now_seg; + prev_subseg = now_subseg; + fixups = fixups->next; + } +} + + +/* do_assemble assembles a single instruction and returns an opcode */ +/* it returns -1 (an invalid opcode) on error */ + +static unsigned long +do_assemble (str, opcode) + char *str; + struct d10v_opcode **opcode; +{ + unsigned char *op_start, *save; + unsigned char *op_end; + char name[20]; + int nlen = 0; + expressionS myops[6]; + unsigned long insn; + + /* Drop leading whitespace */ + while (*str == ' ') + str++; + + /* find the opcode end */ + for (op_start = op_end = (unsigned char *) (str); + *op_end + && nlen < 20 + && !is_end_of_line[*op_end] && *op_end != ' '; + op_end++) + { + name[nlen] = tolower(op_start[nlen]); + nlen++; + } + name[nlen] = 0; + + if (nlen == 0) + return (-1); + + /* find the first opcode with the proper name */ + *opcode = (struct d10v_opcode *)hash_find (d10v_hash, name); + if (*opcode == NULL) + as_fatal ("unknown opcode: %s",name); + + save = input_line_pointer; + input_line_pointer = op_end; + *opcode = find_opcode (*opcode, myops); + if (*opcode == 0) + return -1; + input_line_pointer = save; + + insn = build_insn ((*opcode), myops, 0); + return (insn); +} + +/* find_opcode() gets a pointer to an entry in the opcode table. */ +/* It must look at all opcodes with the same name and use the operands */ +/* to choose the correct opcode. */ + +static struct d10v_opcode * +find_opcode (opcode, myops) + struct d10v_opcode *opcode; + expressionS myops[]; +{ + int i, match, done; + struct d10v_opcode *next_opcode; + + /* get all the operands and save them as expressions */ + get_operands (myops); + + /* now see if the operand is a fake. If so, find the correct size */ + /* instruction, if possible */ + if (opcode->format == OPCODE_FAKE) + { + int opnum = opcode->operands[0]; + + if (myops[opnum].X_op == O_register) + { + myops[opnum].X_op = O_symbol; + myops[opnum].X_add_symbol = symbol_find_or_make ((char *)myops[opnum].X_op_symbol); + myops[opnum].X_add_number = 0; + myops[opnum].X_op_symbol = NULL; + } + + if (myops[opnum].X_op == O_constant || (myops[opnum].X_op == O_symbol && + S_IS_DEFINED(myops[opnum].X_add_symbol) && + (S_GET_SEGMENT(myops[opnum].X_add_symbol) == now_seg))) + { + next_opcode=opcode+1; + for (i=0; opcode->operands[i+1]; i++) + { + int bits = d10v_operands[next_opcode->operands[opnum]].bits; + int flags = d10v_operands[next_opcode->operands[opnum]].flags; + if (flags & OPERAND_ADDR) + bits += 2; + if (myops[opnum].X_op == O_constant) + { + if (!check_range (myops[opnum].X_add_number, bits, flags)) + return next_opcode; + } + else + { + fragS *f; + long value; + /* calculate the current address by running through the previous frags */ + /* and adding our current offset */ + for (value = 0, f = frchain_now->frch_root; f; f = f->fr_next) + value += f->fr_fix + f->fr_offset; + + if (flags & OPERAND_ADDR) + value = S_GET_VALUE(myops[opnum].X_add_symbol) - value - + (obstack_next_free(&frchain_now->frch_obstack) - frag_now->fr_literal); + else + value = S_GET_VALUE(myops[opnum].X_add_symbol); + + if (myops[opnum].X_add_number == AT_WORD) + { + if (bits > 4) + { + bits += 2; + if (!check_range (value, bits, flags)) + return next_opcode; + } + } + else if (!check_range (value, bits, flags)) + return next_opcode; + } + next_opcode++; + } + as_fatal ("value out of range"); + } + else + { + /* not a constant, so use a long instruction */ + return opcode+2; + } + } + else + { + match = 0; + /* now search the opcode table table for one with operands */ + /* that matches what we've got */ + while (!match) + { + match = 1; + for (i = 0; opcode->operands[i]; i++) + { + int flags = d10v_operands[opcode->operands[i]].flags; + int X_op = myops[i].X_op; + int num = myops[i].X_add_number; + + if (X_op==0) + { + match=0; + break; + } + + if (flags & OPERAND_REG) + { + if ((X_op != O_register) || + ((flags & OPERAND_ACC) != (num & OPERAND_ACC)) || + ((flags & OPERAND_FLAG) != (num & OPERAND_FLAG)) || + ((flags & OPERAND_CONTROL) != (num & OPERAND_CONTROL))) + { + match=0; + break; + } + } + + if (((flags & OPERAND_MINUS) && ((X_op != O_absent) || (num != OPERAND_MINUS))) || + ((flags & OPERAND_PLUS) && ((X_op != O_absent) || (num != OPERAND_PLUS))) || + ((flags & OPERAND_ATMINUS) && ((X_op != O_absent) || (num != OPERAND_ATMINUS))) || + ((flags & OPERAND_ATPAR) && ((X_op != O_absent) || (num != OPERAND_ATPAR))) || + ((flags & OPERAND_ATSIGN) && ((X_op != O_absent) || (num != OPERAND_ATSIGN)))) + { + match=0; + break; + } + } + /* we're only done if the operands matched so far AND there + are no more to check */ + if (match && myops[i].X_op==0) + break; + else + match = 0; + + next_opcode = opcode+1; + if (next_opcode->opcode == 0) + break; + if (strcmp(next_opcode->name, opcode->name)) + break; + opcode = next_opcode; + } + } + + if (!match) + { + as_bad ("bad opcode or operands"); + return (0); + } + + /* Check that all registers that are required to be even are. */ + /* Also, if any operands were marked as registers, but were really symbols */ + /* fix that here. */ + for (i=0; opcode->operands[i]; i++) + { + if ((d10v_operands[opcode->operands[i]].flags & OPERAND_EVEN) && + (myops[i].X_add_number & 1)) + as_fatal("Register number must be EVEN"); + if (myops[i].X_op == O_register) + { + if (!(d10v_operands[opcode->operands[i]].flags & OPERAND_REG)) + { + myops[i].X_op = O_symbol; + myops[i].X_add_symbol = symbol_find_or_make ((char *)myops[i].X_op_symbol); + myops[i].X_add_number = 0; + myops[i].X_op_symbol = NULL; + } + } + } + return opcode; +} + +/* if while processing a fixup, a reloc really needs to be created */ +/* then it is done here */ + +arelent * +tc_gen_reloc (seg, fixp) + asection *seg; + fixS *fixp; +{ + arelent *reloc; + reloc = (arelent *) xmalloc (sizeof (arelent)); + reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym; + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); + if (reloc->howto == (reloc_howto_type *) NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + "reloc %d not supported by object file format", (int)fixp->fx_r_type); + return NULL; + } + reloc->addend = fixp->fx_addnumber; + return reloc; +} + +int +md_estimate_size_before_relax (fragp, seg) + fragS *fragp; + asection *seg; +{ + abort (); + return 0; +} + +long +md_pcrel_from_section (fixp, sec) + fixS *fixp; + segT sec; +{ + if (fixp->fx_addsy != (symbolS *)NULL && (!S_IS_DEFINED (fixp->fx_addsy) || + (S_GET_SEGMENT (fixp->fx_addsy) != sec))) + return 0; + return fixp->fx_frag->fr_address + fixp->fx_where; +} + +int +md_apply_fix3 (fixp, valuep, seg) + fixS *fixp; + valueT *valuep; + segT seg; +{ + char *where; + unsigned long insn; + long value; + int op_type; + int left=0; + + if (fixp->fx_addsy == (symbolS *) NULL) + { + value = *valuep; + fixp->fx_done = 1; + } + else if (fixp->fx_pcrel) + value = *valuep; + else + { + value = fixp->fx_offset; + if (fixp->fx_subsy != (symbolS *) NULL) + { + if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section) + value -= S_GET_VALUE (fixp->fx_subsy); + else + { + /* We don't actually support subtracting a symbol. */ + as_bad_where (fixp->fx_file, fixp->fx_line, + "expression too complex"); + } + } + } + + op_type = fixp->fx_r_type; + if (op_type & 2048) + { + op_type -= 2048; + if (op_type & 1024) + { + op_type -= 1024; + fixp->fx_r_type = BFD_RELOC_D10V_10_PCREL_L; + left = 1; + } + else if (op_type & 4096) + { + op_type -= 4096; + fixp->fx_r_type = BFD_RELOC_D10V_18; + } + else + fixp->fx_r_type = get_reloc((struct d10v_operand *)&d10v_operands[op_type]); + } + + /* Fetch the instruction, insert the fully resolved operand + value, and stuff the instruction back again. */ + where = fixp->fx_frag->fr_literal + fixp->fx_where; + insn = bfd_getb32 ((unsigned char *) where); + + switch (fixp->fx_r_type) + { + case BFD_RELOC_D10V_10_PCREL_L: + case BFD_RELOC_D10V_10_PCREL_R: + case BFD_RELOC_D10V_18_PCREL: + case BFD_RELOC_D10V_18: + /* instruction addresses are always right-shifted by 2 */ + value >>= 2; + if (fixp->fx_size == 2) + bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + else + { + insn = d10v_insert_operand (insn, op_type, (offsetT)value, left, fixp); + bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + } + break; + case BFD_RELOC_32: + bfd_putb32 ((bfd_vma) value, (unsigned char *) where); + break; + case BFD_RELOC_16: + bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + break; + default: + as_fatal ("line %d: unknown relocation type: 0x%x",fixp->fx_line,fixp->fx_r_type); + } + return 0; +} + +/* d10v_cleanup() is called after the assembler has finished parsing the input + file or after a label is defined. Because the D10V assembler sometimes saves short + instructions to see if it can package them with the next instruction, there may + be a short instruction that still needs written. */ +int +d10v_cleanup () +{ + segT seg; + subsegT subseg; + + if (prev_opcode) + { + seg = now_seg; + subseg = now_subseg; + subseg_set (prev_seg, prev_subseg); + write_1_short (prev_opcode, prev_insn, fixups->next); + subseg_set (seg, subseg); + prev_opcode = NULL; + } + return 1; +} + +/* Like normal .word, except support @word */ +/* clobbers input_line_pointer, checks end-of-line. */ +static void +d10v_dot_word (nbytes) + register int nbytes; /* 1=.byte, 2=.word, 4=.long */ +{ + expressionS exp; + bfd_reloc_code_real_type reloc; + char *p; + int offset; + + if (is_it_end_of_statement ()) + { + demand_empty_rest_of_line (); + return; + } + + do + { + expression (&exp); + if (!strncasecmp (input_line_pointer, "@word", 5)) + { + exp.X_add_number = 0; + input_line_pointer += 5; + + p = frag_more (2); + fix_new_exp (frag_now, p - frag_now->fr_literal, 2, + &exp, 0, BFD_RELOC_D10V_18); + } + else + emit_expr (&exp, 2); + } + while (*input_line_pointer++ == ','); + + input_line_pointer--; /* Put terminator back into stream. */ + demand_empty_rest_of_line (); +} + + +/* Mitsubishi asked that we support some old syntax that apparently */ +/* had immediate operands starting with '#'. This is in some of their */ +/* sample code but is not documented (although it appears in some */ +/* examples in their assembler manual). For now, we'll solve this */ +/* compatibility problem by simply ignoring any '#' at the beginning */ +/* of an operand. */ + +/* operands that begin with '#' should fall through to here */ +/* from expr.c */ + +void +md_operand (expressionP) + expressionS *expressionP; +{ + if (*input_line_pointer == '#') + { + input_line_pointer++; + expression (expressionP); + } +} + diff -urN binutils-2.7/gas/config/tc-d10v.h binutils-2.8/gas/config/tc-d10v.h --- binutils-2.7/gas/config/tc-d10v.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/tc-d10v.h Wed Apr 30 12:53:17 1997 @@ -0,0 +1,56 @@ +/* tc-d10v.h -- Header file for tc-d10v.c. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Written by Martin Hunt, Cygnus Support. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#define TC_D10V + +#define TARGET_BYTES_BIG_ENDIAN 0 + +#ifndef BFD_ASSEMBLER + #error D10V support requires BFD_ASSEMBLER +#endif + +/* The target BFD architecture. */ +#define TARGET_ARCH bfd_arch_d10v + +#define TARGET_FORMAT "elf32-d10v" + +#define MD_APPLY_FIX3 + +/* call md_pcrel_from_section, not md_pcrel_from */ +#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC) + +/* Permit temporary numeric labels. */ +#define LOCAL_LABELS_FB 1 + +#define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */ + +/* We don't need to handle .word strangely. */ +#define WORKING_DOT_WORD + +#define md_number_to_chars number_to_chars_bigendian + +int d10v_cleanup PARAMS ((void)); +#define md_after_pass_hook() d10v_cleanup() +#define md_cleanup() d10v_cleanup() +#define md_do_align(a,b,c,d,e) d10v_cleanup() +#define TC_START_LABEL(ch, ptr) (ch == ':' && d10v_cleanup()) + + diff -urN binutils-2.7/gas/config/tc-generic.h binutils-2.8/gas/config/tc-generic.h --- binutils-2.7/gas/config/tc-generic.h Thu Jul 4 12:13:53 1996 +++ binutils-2.8/gas/config/tc-generic.h Wed Apr 30 12:53:17 1997 @@ -1,7 +1,6 @@ - /* This file is tc-generic.h - Copyright (C) 1987-1992 Free Software Foundation, Inc. + Copyright (C) 1987, 91, 92, 95, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,9 +14,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with GAS; see the file COPYING. If not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * This file is tc-generic.h and is intended to be a template for target cpu @@ -27,6 +26,8 @@ */ #define TC_GENERIC 1 + +#define TARGET_BYTES_BIG_ENDIAN 0 /* * Local Variables: diff -urN binutils-2.7/gas/config/tc-h8300.c binutils-2.8/gas/config/tc-h8300.c --- binutils-2.7/gas/config/tc-h8300.c Thu Jul 4 12:32:14 1996 +++ binutils-2.8/gas/config/tc-h8300.c Wed Apr 30 12:53:17 1997 @@ -47,6 +47,7 @@ void cons (); int Hmode; +int Smode; #define PSIZE (Hmode ? L_32 : L_16) #define DMODE (L_16) #define DSYMMODE (Hmode ? L_24 : L_16) @@ -57,9 +58,16 @@ h8300hmode () { Hmode = 1; + Smode = 0; } void +h8300smode () +{ + Smode = 1; + Hmode = 1; +} +void sbranch (size) int size; { @@ -75,6 +83,7 @@ { {"h8300h", h8300hmode, 0}, + {"h8300s", h8300smode, 0}, {"sbranch", sbranch, L_8}, {"lbranch", sbranch, L_16}, @@ -211,6 +220,12 @@ *reg = 0; return 3; } + if (src[0] == 'e' && src[1] == 'x' && src[2] == 'r') + { + *mode = EXR; + *reg = 0; + return 3; + } if (src[0] == 'f' && src[1] == 'p') { *mode = PSIZE | REG | direction; @@ -380,6 +395,38 @@ op->mode = E; + /* Gross. Gross. ldm and stm have a format not easily handled + by get_operand. We deal with it explicitly here. */ + if (src[0] == 'e' && src[1] == 'r' && isdigit(src[2]) + && src[3] == '-' && src[4] == 'e' && src[5] == 'r' && isdigit(src[6])) + { + int low, high; + + low = src[2] - '0'; + high = src[6] - '0'; + + if (high < low) + as_bad ("Invalid register list for ldm/stm\n"); + + if (low % 2) + as_bad ("Invalid register list for ldm/stm\n"); + + if (high - low > 4) + as_bad ("Invalid register list for ldm/stm\n"); + + if (high - low != 2 + && low % 4) + as_bad ("Invalid register list for ldm/stm\n"); + + /* Even sicker. We encode two registers into op->reg. One + for the low register to save, the other for the high + register to save; we also set the high bit in op->reg + so we know this is "very special". */ + op->reg = 0x80000000 | (high << 8) | low; + op->mode = REG; + *ptr = src + 7; + return; + } len = parse_reg (src, &op->mode, &op->reg, direction); if (len) @@ -527,6 +574,14 @@ return; } + else if (strncmp (src, "mach", 4) == 0 + || strncmp (src, "macl", 4) == 0) + { + op->reg = src[3] == 'l'; + op->mode = MACREG; + *ptr = src + 4; + return; + } else { src = parse_exp (src, &op->exp); @@ -609,9 +664,10 @@ */ static struct h8_opcode * -get_specific (opcode, operands) +get_specific (opcode, operands, size) struct h8_opcode *opcode; struct h8_op *operands; + int size; { struct h8_opcode *this_try = opcode; int found = 0; @@ -626,90 +682,96 @@ while (this_index == opcode->idx && !found) { - unsigned int i; found = 1; this_try = opcode++; - for (i = 0; i < this_try->noperands && found; i++) + if (this_try->noperands == 0) { - op_type op = this_try->args.nib[i]; - int x = operands[i].mode; + int this_size; - if ((op & (DISP | REG)) == (DISP | REG) - && ((x & (DISP | REG)) == (DISP | REG))) - { - dispreg = operands[i].reg; - } - else if (op & REG) + this_size = this_try->how & SN; + if (this_size != size && (this_size != SB || size != SN)) + found = 0; + } + else + { + unsigned int i; + + for (i = 0; i < this_try->noperands && found; i++) { - if (!(x & REG)) - found = 0; + op_type op = this_try->args.nib[i]; + int x = operands[i].mode; - if (x & L_P) + if ((op & (DISP | REG)) == (DISP | REG) + && ((x & (DISP | REG)) == (DISP | REG))) { - x = (x & ~L_P) | (Hmode ? L_32 : L_16); + dispreg = operands[i].reg; } - if (op & L_P) + else if (op & REG) { - op = (op & ~L_P) | (Hmode ? L_32 : L_16); - } - - opsize = op & SIZE; + if (!(x & REG)) + found = 0; - /* The size of the reg is v important */ - if ((op & SIZE) != (x & SIZE)) - found = 0; - } - else if ((op & ABSJMP) && (x & ABS)) - { - operands[i].mode &= ~ABS; - operands[i].mode |= ABSJMP; - /* But it may not be 24 bits long */ - if (!Hmode) + if (x & L_P) + x = (x & ~L_P) | (Hmode ? L_32 : L_16); + if (op & L_P) + op = (op & ~L_P) | (Hmode ? L_32 : L_16); + + opsize = op & SIZE; + + /* The size of the reg is v important */ + if ((op & SIZE) != (x & SIZE)) + found = 0; + } + else if ((op & ABSJMP) && (x & ABS)) { - operands[i].mode &= ~SIZE; - operands[i].mode |= L_16; + operands[i].mode &= ~ABS; + operands[i].mode |= ABSJMP; + /* But it may not be 24 bits long */ + if (!Hmode) + { + operands[i].mode &= ~SIZE; + operands[i].mode |= L_16; + } } - - - } - else if ((op & (KBIT | DBIT)) && (x & IMM)) - { - /* This is ok if the immediate value is sensible */ - - } - else if (op & PCREL) - { - - /* The size of the displacement is important */ - if ((op & SIZE) != (x & SIZE)) - found = 0; - - } - else if ((op & (DISP | IMM | ABS)) - && (op & (DISP | IMM | ABS)) == (x & (DISP | IMM | ABS))) - { - /* Promote a L_24 to L_32 if it makes us match. */ - if ((x & L_24) && (op & L_32)) + else if ((op & (KBIT | DBIT)) && (x & IMM)) { - x &= ~L_24; - x |= L_32; + /* This is ok if the immediate value is sensible */ } - /* Promote an L8 to L_16 if it makes us match. */ - if (op & ABS && op & L_8 && op & DISP) + else if (op & PCREL) { - if (x & L_16) - found= 1; + /* The size of the displacement is important */ + if ((op & SIZE) != (x & SIZE)) + found = 0; } - else if ((x & SIZE) != 0 - && ((op & SIZE) != (x & SIZE))) - found = 0; - } - else if ((op & MODE) != (x & MODE)) - { - found = 0; + else if ((op & (DISP | IMM | ABS)) + && (op & (DISP | IMM | ABS)) == (x & (DISP | IMM | ABS))) + { + /* Promote a L_24 to L_32 if it makes us match. */ + if ((x & L_24) && (op & L_32)) + { + x &= ~L_24; + x |= L_32; + } + /* Promote an L8 to L_16 if it makes us match. */ + if (op & ABS && op & L_8 && op & DISP) + { + if (x & L_16) + found= 1; + } + else if ((x & SIZE) != 0 + && ((op & SIZE) != (x & SIZE))) + found = 0; + } + else if ((op & MACREG) != (x & MACREG)) + { + found = 0; + } + else if ((op & MODE) != (x & MODE)) + { + found = 0; + } } - } } if (found) @@ -967,12 +1029,28 @@ nib |= 0x8; } + if (c & MACREG) + { + nib = 2 + operand[d].reg; + } } nibble_count++; *p++ = nib; } + /* Disgusting. Why, oh why didn't someone ask us for advice + on the assembler format. */ + if (strcmp (this_try->name, "stm.l") == 0 + || strcmp (this_try->name, "ldm.l") == 0) + { + int high, low; + high = (operand[this_try->name[0] == 'l' ? 1 : 0].reg >> 8) & 0xf; + low = operand[this_try->name[0] == 'l' ? 1 : 0].reg & 0xf; + + asnibbles[2] = high - low; + asnibbles[7] = (this_try->name[0] == 'l') ? high : low; + } for (i = 0; i < this_try->length; i++) { @@ -1146,6 +1224,7 @@ char *dot = 0; char c; + int size; /* Drop leading whitespace */ while (*str == ' ') @@ -1191,7 +1270,25 @@ *op_end = c; prev_opcode = opcode; - opcode = get_specific (opcode, operand); + size = SN; + if (dot) + { + switch (*dot) + { + case 'b': + size = SB; + break; + + case 'w': + size = SW; + break; + + case 'l': + size = SL; + break; + } + } + opcode = get_specific (opcode, operand, size); if (opcode == 0) { diff -urN binutils-2.7/gas/config/tc-h8300.h binutils-2.8/gas/config/tc-h8300.h --- binutils-2.7/gas/config/tc-h8300.h Thu Jul 4 12:32:15 1996 +++ binutils-2.8/gas/config/tc-h8300.h Wed Apr 30 12:53:17 1997 @@ -1,6 +1,5 @@ /* This file is tc-h8300.h - - Copyright (C) 1987-1992 Free Software Foundation, Inc. + Copyright (C) 1987-1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #define TC_H8300 @@ -27,9 +27,7 @@ #define TC_COFF_FIX2RTYPE(fixP) abort(); #define BFD_ARCH bfd_arch_h8300 -#define COFF_MAGIC \ - (\ - Hmode ? 0x8301 : 0x8300) +#define COFF_MAGIC ( Smode ? 0x8302 : Hmode ? 0x8301 : 0x8300) #define TC_COUNT_RELOC(x) (1) #define IGNORE_NONSTANDARD_ESCAPES @@ -40,12 +38,12 @@ #define TC_CONS_RELOC (Hmode ? R_RELLONG: R_RELWORD) #define DO_NOT_STRIP 0 -#define DO_STRIP 0 #define LISTING_HEADER "Hitachi H8/300 GAS " #define NEED_FX_R_TYPE 1 #define RELOC_32 1234 extern int Hmode; +extern int Smode; #define md_operand(x) diff -urN binutils-2.7/gas/config/tc-h8500.h binutils-2.8/gas/config/tc-h8500.h --- binutils-2.7/gas/config/tc-h8500.h Thu Jul 4 12:13:55 1996 +++ binutils-2.8/gas/config/tc-h8500.h Wed Apr 30 12:53:17 1997 @@ -1,6 +1,5 @@ /* This file is tc-h8500.h - - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 95, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #define TC_H8500 @@ -34,7 +34,6 @@ #define TC_RELOC_MANGLE(s,a,b,c) tc_reloc_mangle(a,b,c) #define DO_NOT_STRIP 0 -#define DO_STRIP 0 #define LISTING_HEADER "Hitachi H8/500 GAS " #define NEED_FX_R_TYPE 1 #define RELOC_32 1234 diff -urN binutils-2.7/gas/config/tc-hppa.c binutils-2.8/gas/config/tc-hppa.c --- binutils-2.7/gas/config/tc-hppa.c Thu Jul 4 12:14:02 1996 +++ binutils-2.8/gas/config/tc-hppa.c Wed Apr 30 12:53:18 1997 @@ -1,5 +1,5 @@ /* tc-hppa.c -- Assemble for the PA - Copyright (C) 1989, 1996 Free Software Foundation, Inc. + Copyright (C) 1989, 1996, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -418,7 +418,7 @@ struct hppa_fix_struct { /* The field selector. */ - enum hppa_reloc_field_selector_type fx_r_field; + enum hppa_reloc_field_selector_type_alt fx_r_field; /* Type of fixup. */ int fx_r_type; @@ -544,14 +544,17 @@ static int reg_name_search PARAMS ((char *)); static int pa_chk_field_selector PARAMS ((char **)); static int is_same_frag PARAMS ((fragS *, fragS *)); -static void pa_build_unwind_subspace PARAMS ((struct call_info *)); static void process_exit PARAMS ((void)); static sd_chain_struct *pa_parse_space_stmt PARAMS ((char *, int)); static int log2 PARAMS ((int)); static int pa_next_subseg PARAMS ((sd_chain_struct *)); static unsigned int pa_stringer_aux PARAMS ((char *)); static void pa_spaces_begin PARAMS ((void)); + +#ifdef OBJ_ELF static void hppa_elf_mark_end_of_function PARAMS ((void)); +static void pa_build_unwind_subspace PARAMS ((struct call_info *)); +#endif /* File and gloally scoped variable declarations. */ @@ -1196,7 +1199,7 @@ expressionS *exp; int pcrel; bfd_reloc_code_real_type r_type; - enum hppa_reloc_field_selector_type r_field; + enum hppa_reloc_field_selector_type_alt r_field; int r_format; long arg_reloc; int* unwind_bits; @@ -2619,28 +2622,21 @@ assert (hppa_fixp != 0); assert (section != 0); - reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent)); - assert (reloc != 0); + reloc = (arelent *) xmalloc (sizeof (arelent)); reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym; codes = (bfd_reloc_code_real_type **) hppa_gen_reloc_type (stdoutput, fixp->fx_r_type, hppa_fixp->fx_r_format, hppa_fixp->fx_r_field, - fixp->fx_subsy != NULL); + fixp->fx_subsy != NULL, + fixp->fx_addsy->bsym); for (n_relocs = 0; codes[n_relocs]; n_relocs++) ; - relocs = (arelent **) - bfd_alloc_by_size_t (stdoutput, sizeof (arelent *) * n_relocs + 1); - assert (relocs != 0); - - reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, - sizeof (arelent) * n_relocs); - if (n_relocs > 0) - assert (reloc != 0); - + relocs = (arelent **) xmalloc (sizeof (arelent *) * n_relocs + 1); + reloc = (arelent *) xmalloc (sizeof (arelent) * n_relocs); for (i = 0; i < n_relocs; i++) relocs[i] = &reloc[i]; @@ -2916,7 +2912,7 @@ { char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; struct hppa_fix_struct *hppa_fixP; - long new_val, result; + long new_val, result = 0; unsigned int w1, w2, w, resulti; hppa_fixP = (struct hppa_fix_struct *) fixP->tc_fix_data; @@ -4048,7 +4044,7 @@ temp_fill = 0; p = frag_var (rs_fill, (int) temp_size, (int) temp_size, - (relax_substateT) 0, (symbolS *) 0, 1, NULL); + (relax_substateT) 0, (symbolS *) 0, (offsetT) 1, NULL); bzero (p, temp_size); /* Convert 2 bytes at a time. */ @@ -6114,6 +6110,7 @@ sd_chain_struct *space; int quadrant; { +#ifdef OBJ_SOM /* FIXME. Assumes everyone puts read/write data at 0x4000000, this is not correct for the PA OSF1 port. */ if ((strcmp (SPACE_NAME (space), "$PRIVATE$") == 0) && quadrant == 1) @@ -6122,6 +6119,8 @@ return 0x40000000; else return 0; +#endif + return 0; } /* FIXME. Needs documentation. */ diff -urN binutils-2.7/gas/config/tc-hppa.h binutils-2.8/gas/config/tc-hppa.h --- binutils-2.7/gas/config/tc-hppa.h Thu Jul 4 12:14:02 1996 +++ binutils-2.8/gas/config/tc-hppa.h Wed Apr 30 12:53:18 1997 @@ -1,6 +1,5 @@ -/* tc-hppa.h -- Header file for the PA */ - -/* Copyright (C) 1989, 1993 Free Software Foundation, Inc. +/* tc-hppa.h -- Header file for the PA + Copyright (C) 1989, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* HP PA-RISC support was contributed by the Center for Software Science @@ -39,9 +39,10 @@ #define TC_HPPA 1 #endif -#define TARGET_ARCH bfd_arch_hppa #define TARGET_BYTES_BIG_ENDIAN 1 +#define TARGET_ARCH bfd_arch_hppa + /* FIXME. The lack of a place to put things which are both target cpu and target format dependent makes hacks like this necessary. */ #ifdef OBJ_ELF @@ -60,9 +61,6 @@ #define TRUE (!FALSE) #endif -/* Local labels have an "L$" prefix. */ -#define LOCAL_LABEL(name) ((name)[0] == 'L' && (name)[1] == '$') -#define FAKE_LABEL_NAME "L$0\001" #define ASEC_NULL (asection *)0 /* Labels are not required to have a colon for a suffix. */ @@ -114,7 +112,7 @@ /* Similarly for an exclamation point. It is used in FP comparison instructions and as an end of line marker. When used in an instruction it will always follow a comma. */ -#define TC_EOL_IN_INSN(PTR) (is_end_of_line[*(PTR)] && (PTR)[-1] == ',') +#define TC_EOL_IN_INSN(PTR) (*(PTR) == '!' && (PTR)[-1] == ',') #define tc_fix_adjustable hppa_fix_adjustable @@ -145,14 +143,8 @@ #endif #ifdef OBJ_ELF -/* Arggg. The generic BFD ELF code always adds in the section->vma - to non-common symbols. This is a lose on the PA. To make matters - worse, the generic ELF code already defined obj_frob_symbol. */ #define tc_frob_symbol(sym,punt) \ { \ - if (S_GET_SEGMENT (sym) != &bfd_com_section \ - && S_GET_SEGMENT (sym) != &bfd_und_section) \ - S_SET_VALUE ((sym), (S_GET_VALUE (sym) - (sym)->bsym->section->vma)); \ if ((S_GET_SEGMENT (sym) == &bfd_und_section && sym->sy_used == 0) \ || (S_GET_SEGMENT (sym) == &bfd_abs_section \ && (sym->bsym->flags & BSF_EXPORT) == 0)) \ diff -urN binutils-2.7/gas/config/tc-i386.c binutils-2.8/gas/config/tc-i386.c --- binutils-2.7/gas/config/tc-i386.c Thu Jul 4 12:14:04 1996 +++ binutils-2.8/gas/config/tc-i386.c Wed Apr 30 12:53:18 1997 @@ -1,5 +1,5 @@ /* i386.c -- Assemble code for the Intel 80386 - Copyright (C) 1989, 1991, 1992, 1993 Free Software Foundation. + Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation. This file is part of GAS, the GNU Assembler. @@ -14,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* Intel 80386 machine specific gas. @@ -36,6 +37,18 @@ #define TC_RELOC(X,Y) (Y) #endif +static unsigned long mode_from_disp_size PARAMS ((unsigned long)); +static int fits_in_signed_byte PARAMS ((long)); +static int fits_in_unsigned_byte PARAMS ((long)); +static int fits_in_unsigned_word PARAMS ((long)); +static int fits_in_signed_word PARAMS ((long)); +static int smallest_imm_type PARAMS ((long)); +static void set_16bit_code_flag PARAMS ((int)); +#ifdef BFD_ASSEMBLER +static bfd_reloc_code_real_type reloc + PARAMS ((int, int, bfd_reloc_code_real_type)); +#endif + /* 'md_assemble ()' gathers together information and puts it into a i386_insn. */ @@ -103,7 +116,7 @@ /* This array holds the chars that always start a comment. If the pre-processor is disabled, these aren't very useful */ -#if defined (TE_I386AIX) || defined (OBJ_ELF) +#if defined (TE_I386AIX) || defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) const char comment_chars[] = "#/"; #else const char comment_chars[] = "#"; @@ -117,7 +130,7 @@ #NO_APP at the beginning of its output. */ /* Also note that comments started like this one will always work if '/' isn't otherwise defined. */ -#if defined (TE_I386AIX) || defined (OBJ_ELF) +#if defined (TE_I386AIX) || defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) const char line_comment_chars[] = ""; #else const char line_comment_chars[] = "/"; @@ -247,39 +260,61 @@ int count; { /* Various efficient no-op patterns for aligning code labels. */ - static const char f32_1[] = {0x90}; - static const char f32_2[] = {0x8d,0x36}; - static const char f32_3[] = {0x8d,0x76,0x00}; - static const char f32_4[] = {0x8d,0x74,0x26,0x00}; - static const char f32_5[] = {0x90, - 0x8d,0x74,0x26,0x00}; - static const char f32_6[] = {0x8d,0xb6,0x00,0x00,0x00,0x00}; - static const char f32_7[] = {0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; - static const char f32_8[] = {0x90, - 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; - static const char f32_9[] = {0x8d,0x36, - 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; - static const char f32_10[] = {0x8d,0x76,0x00, - 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; - static const char f32_11[] = {0x8d,0x74,0x26,0x00, - 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; - static const char f32_12[] = {0x8d,0xb6,0x00,0x00,0x00,0x00, - 0x8d,0xb6,0x00,0x00,0x00,0x00}; - static const char f32_13[] = {0x8d,0xb6,0x00,0x00,0x00,0x00, - 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; - static const char f32_14[] = {0x8d,0xb4,0x26,0x00,0x00,0x00,0x00, - 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; - static const char f32_15[] = {0xeb,0x0d,0x90,0x90,0x90,0x90,0x90, - 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90}; - static const char f16_4[] = {0x8d,0xb6,0x00,0x00}; - static const char f16_5[] = {0x90, - 0x8d,0xb6,0x00,0x00}; - static const char f16_6[] = {0x8d,0x36, - 0x8d,0xb6,0x00,0x00}; - static const char f16_7[] = {0x8d,0x76,0x00, - 0x8d,0xb6,0x00,0x00}; - static const char f16_8[] = {0x8d,0xb6,0x00,0x00, - 0x8d,0xb6,0x00,0x00}; + /* Note: Don't try to assemble the instructions in the comments. */ + /* 0L and 0w are not legal */ + static const char f32_1[] = + {0x90}; /* nop */ + static const char f32_2[] = + {0x89,0xf6}; /* movl %esi,%esi */ + static const char f32_3[] = + {0x8d,0x76,0x00}; /* leal 0(%esi),%esi */ + static const char f32_4[] = + {0x8d,0x74,0x26,0x00}; /* leal 0(%esi,1),%esi */ + static const char f32_5[] = + {0x90, /* nop */ + 0x8d,0x74,0x26,0x00}; /* leal 0(%esi,1),%esi */ + static const char f32_6[] = + {0x8d,0xb6,0x00,0x00,0x00,0x00}; /* leal 0L(%esi),%esi */ + static const char f32_7[] = + {0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; /* leal 0L(%esi,1),%esi */ + static const char f32_8[] = + {0x90, /* nop */ + 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; /* leal 0L(%esi,1),%esi */ + static const char f32_9[] = + {0x89,0xf6, /* movl %esi,%esi */ + 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ + static const char f32_10[] = + {0x8d,0x76,0x00, /* leal 0(%esi),%esi */ + 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ + static const char f32_11[] = + {0x8d,0x74,0x26,0x00, /* leal 0(%esi,1),%esi */ + 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ + static const char f32_12[] = + {0x8d,0xb6,0x00,0x00,0x00,0x00, /* leal 0L(%esi),%esi */ + 0x8d,0xbf,0x00,0x00,0x00,0x00}; /* leal 0L(%edi),%edi */ + static const char f32_13[] = + {0x8d,0xb6,0x00,0x00,0x00,0x00, /* leal 0L(%esi),%esi */ + 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ + static const char f32_14[] = + {0x8d,0xb4,0x26,0x00,0x00,0x00,0x00, /* leal 0L(%esi,1),%esi */ + 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ + static const char f32_15[] = + {0xeb,0x0d,0x90,0x90,0x90,0x90,0x90, /* jmp .+15; lotsa nops */ + 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90}; + static const char f16_4[] = + {0x8d,0xb6,0x00,0x00}; /* lea 0w(%si),%si */ + static const char f16_5[] = + {0x90, /* nop */ + 0x8d,0xb6,0x00,0x00}; /* lea 0w(%si),%si */ + static const char f16_6[] = + {0x89,0xf6, /* mov %si,%si */ + 0x8d,0xbd,0x00,0x00}; /* lea 0w(%di),%di */ + static const char f16_7[] = + {0x8d,0x76,0x00, /* lea 0(%si),%si */ + 0x8d,0xbd,0x00,0x00}; /* lea 0w(%di),%di */ + static const char f16_8[] = + {0x8d,0xb6,0x00,0x00, /* lea 0w(%si),%si */ + 0x8d,0xbd,0x00,0x00}; /* lea 0w(%di),%di */ static const char *const f32_patt[] = { f32_1, f32_2, f32_3, f32_4, f32_5, f32_6, f32_7, f32_8, f32_9, f32_10, f32_11, f32_12, f32_13, f32_14, f32_15 @@ -386,7 +421,8 @@ : (Imm32)); } /* smallest_imm_type() */ -void set_16bit_code_flag(new_16bit_code_flag) +static void +set_16bit_code_flag (new_16bit_code_flag) int new_16bit_code_flag; { flag_16bit_code = new_16bit_code_flag; @@ -554,10 +590,13 @@ operand_chars[(unsigned char) *p] = *p; } -#ifdef OBJ_ELF - record_alignment (text_section, 2); - record_alignment (data_section, 2); - record_alignment (bss_section, 2); +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) + if (OUTPUT_FLAVOR == bfd_target_elf_flavour) + { + record_alignment (text_section, 2); + record_alignment (data_section, 2); + record_alignment (bss_section, 2); + } #endif } @@ -750,14 +789,6 @@ pcrel ? "pc-relative " : ""); return BFD_RELOC_NONE; } -#else -#define reloc(SIZE,PCREL,OTHER) 0 -#define BFD_RELOC_32 0 -#define BFD_RELOC_32_PCREL 0 -#define BFD_RELOC_386_PLT32 0 -#define BFD_RELOC_386_GOT32 0 -#define BFD_RELOC_386_GOTOFF 0 -#endif /* * Here we decide which fixups can be adjusted to make them relative to @@ -773,16 +804,24 @@ /* Prevent all adjustments to global symbols. */ if (S_IS_EXTERN (fixP->fx_addsy)) return 0; -#endif -#ifdef BFD_ASSEMBLER + if (S_IS_WEAK (fixP->fx_addsy)) + return 0; +#endif /* ! defined (OBJ_AOUT) */ /* adjust_reloc_syms doesn't know about the GOT */ if (fixP->fx_r_type == BFD_RELOC_386_GOTOFF || fixP->fx_r_type == BFD_RELOC_386_PLT32 || fixP->fx_r_type == BFD_RELOC_386_GOT32) return 0; -#endif return 1; } +#else +#define reloc(SIZE,PCREL,OTHER) 0 +#define BFD_RELOC_32 0 +#define BFD_RELOC_32_PCREL 0 +#define BFD_RELOC_386_PLT32 0 +#define BFD_RELOC_386_GOT32 0 +#define BFD_RELOC_386_GOTOFF 0 +#endif /* This is the guts of the machine-dependent assembler. LINE points to a machine dependent instruction. This function is supposed to emit @@ -821,8 +860,8 @@ unsigned int expecting_operand = 0; /* 1 if we found a prefix only acceptable with string insns. */ unsigned int expecting_string_instruction = 0; - /* Non-zero if operand parens not balenced. */ - unsigned int paren_not_balenced; + /* Non-zero if operand parens not balanced. */ + unsigned int paren_not_balanced; char *token_start = l; while (!is_space_char (*l) && *l != END_OF_INSN) @@ -941,14 +980,14 @@ l++; } token_start = l; /* after white space */ - paren_not_balenced = 0; - while (paren_not_balenced || *l != ',') + paren_not_balanced = 0; + while (paren_not_balanced || *l != ',') { if (*l == END_OF_INSN) { - if (paren_not_balenced) + if (paren_not_balanced) { - as_bad ("unbalenced parenthesis in %s operand.", + as_bad ("unbalanced parenthesis in %s operand.", ordinal_names[i.operands]); return; } @@ -963,9 +1002,9 @@ return; } if (*l == '(') - ++paren_not_balenced; + ++paren_not_balanced; if (*l == ')') - --paren_not_balenced; + --paren_not_balanced; l++; } if (l != token_start) @@ -1302,6 +1341,13 @@ i.reg_operands = 2; } + /* The clr %reg instruction is converted into xor %reg, %reg. */ + if (t->opcode_modifier & iclrKludge) + { + i.regs[1] = i.regs[0]; + i.reg_operands = 2; + } + /* Certain instructions expect the destination to be in the i.rm.reg field. This is by far the exceptional case. For these instructions, if the source operand is a register, we must reverse @@ -1649,7 +1695,7 @@ ? ENCODE_RELAX_STATE (UNCOND_JUMP, BYTE) : ENCODE_RELAX_STATE (COND_JUMP, BYTE)), i.disps[0]->X_add_symbol, - (long) n, p); + (offsetT) n, p); } } else if (t->opcode_modifier & (JumpByte | JumpDword)) @@ -2116,18 +2162,18 @@ found_base_index_form = 0; if (*base_string == ')') { - unsigned int parens_balenced = 1; + unsigned int parens_balanced = 1; /* We've already checked that the number of left & right ()'s are equal, so this loop will not be infinite. */ do { base_string--; if (*base_string == ')') - parens_balenced++; + parens_balanced++; if (*base_string == '(') - parens_balenced--; + parens_balanced--; } - while (parens_balenced); + while (parens_balanced); base_string++; /* Skip past '('. */ if (*base_string == REGISTER_PREFIX || *base_string == ',') found_base_index_form = 1; @@ -2625,10 +2671,14 @@ */ if (fixP->fx_r_type == BFD_RELOC_32_PCREL && fixP->fx_addsy) { - value += fixP->fx_where + fixP->fx_frag->fr_address; -#ifdef OBJ_ELF - if (S_GET_SEGMENT (fixP->fx_addsy) == seg - || (fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) != 0) +#ifndef OBJ_AOUT + if (OUTPUT_FLAVOR == bfd_target_elf_flavour) + value += fixP->fx_where + fixP->fx_frag->fr_address; +#endif +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) + if (OUTPUT_FLAVOR == bfd_target_elf_flavour + && (S_GET_SEGMENT (fixP->fx_addsy) == seg + || (fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) != 0)) { /* Yes, we add the values in twice. This is because bfd_perform_relocation subtracts them out again. I think @@ -2641,8 +2691,9 @@ /* Fix a few things - the dynamic linker expects certain values here, and we must not dissappoint it. */ -#ifdef OBJ_ELF - if (fixP->fx_addsy) +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) + if (OUTPUT_FLAVOR == bfd_target_elf_flavour + && fixP->fx_addsy) switch(fixP->fx_r_type) { case BFD_RELOC_386_PLT32: /* Make the jump instruction point to the address of the operand. At @@ -2831,7 +2882,7 @@ flag_do_long_jump = 1; break; -#ifdef OBJ_ELF +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) /* -k: Ignore for FreeBSD compatibility. */ case 'k': break; @@ -2860,9 +2911,32 @@ fprintf (stream, "\ -m do long jump\n"); } - -/* We have no need to default values of symbols. */ +#ifdef BFD_ASSEMBLER +#ifdef OBJ_MAYBE_ELF +#ifdef OBJ_MAYBE_COFF + +/* Pick the target format to use. */ + +const char * +i386_target_format () +{ + switch (OUTPUT_FLAVOR) + { + case bfd_target_coff_flavour: + return "coff-i386"; + case bfd_target_elf_flavour: + return "elf32-i386"; + default: + abort (); + return NULL; + } +} + +#endif /* OBJ_MAYBE_COFF */ +#endif /* OBJ_MAYBE_ELF */ +#endif /* BFD_ASSEMBLER */ + /* ARGSUSED */ symbolS * md_undefined_symbol (name) @@ -2953,15 +3027,11 @@ default: switch (F (fixp->fx_size, fixp->fx_pcrel)) { -#ifndef OBJ_ELF MAP (1, 0, BFD_RELOC_8); MAP (2, 0, BFD_RELOC_16); -#endif MAP (4, 0, BFD_RELOC_32); -#ifndef OBJ_ELF MAP (1, 1, BFD_RELOC_8_PCREL); MAP (2, 1, BFD_RELOC_16_PCREL); -#endif MAP (4, 1, BFD_RELOC_32_PCREL); default: as_bad ("Can not do %d byte %srelocation", fixp->fx_size, @@ -2976,8 +3046,7 @@ && fixp->fx_addsy == GOT_symbol) code = BFD_RELOC_386_GOTPC; - rel = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent)); - assert (rel != 0); + rel = (arelent *) xmalloc (sizeof (arelent)); rel->sym_ptr_ptr = &fixp->fx_addsy->bsym; rel->address = fixp->fx_frag->fr_address + fixp->fx_where; if (fixp->fx_pcrel) @@ -2986,15 +3055,14 @@ rel->addend = 0; rel->howto = bfd_reloc_type_lookup (stdoutput, code); - if (!rel->howto) + if (rel->howto == NULL) { - const char *name; - - name = S_GET_NAME (fixp->fx_addsy); - if (name == NULL) - name = ""; - as_fatal ("Cannot generate relocation type for symbol %s, code %s", - name, bfd_get_reloc_code_name (code)); + as_bad_where (fixp->fx_file, fixp->fx_line, + "Cannot represent relocation type %s", + bfd_get_reloc_code_name (code)); + /* Set howto to a garbage value so that we can keep going. */ + rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32); + assert (rel->howto != NULL); } return rel; @@ -3070,99 +3138,4 @@ #endif /* BFD_ASSEMBLER? */ -#ifdef SCO_ELF - -/* Heavily plagarized from obj_elf_version. The idea is to emit the - SCO specific identifier in the .notes section to satisfy the SCO - linker. - - This looks more complicated than it really is. As opposed to the - "obvious" solution, this should handle the cross dev cases - correctly. (i.e, hosting on a 64 bit big endian processor, but - generating SCO Elf code) Efficiency isn't a concern, as there - should be exactly one of these sections per object module. - - SCO OpenServer 5 identifies it's ELF modules with a standard ELF - .note section. - - int_32 namesz = 4 ; Name size - int_32 descsz = 12 ; Descriptive information - int_32 type = 1 ; - char name[4] = "SCO" ; Originator name ALWAYS SCO + NULL - int_32 version = (major ver # << 16) | version of tools ; - int_32 source = (tool_id << 16 ) | 1 ; - int_32 info = 0 ; These are set by the SCO tools, but we - don't know enough about the source - environment to set them. SCO ld currently - ignores them, and recommends we set them - to zero. */ - -#define SCO_MAJOR_VERSION 0x1 -#define SCO_MINOR_VERSION 0x1 - -void -sco_id () -{ - char *name; - unsigned int c; - char ch; - char *p; - asection *seg = now_seg; - subsegT subseg = now_subseg; - Elf_Internal_Note i_note; - Elf_External_Note e_note; - asection *note_secp = (asection *) NULL; - int i, len; - - /* create the .note section */ - - note_secp = subseg_new (".note", 0); - bfd_set_section_flags (stdoutput, - note_secp, - SEC_HAS_CONTENTS | SEC_READONLY); - - /* process the version string */ - - i_note.namesz = 4; - i_note.descsz = 12; /* 12 descriptive bytes */ - i_note.type = NT_VERSION; /* Contains a version string */ - - p = frag_more (sizeof (i_note.namesz)); - md_number_to_chars (p, (valueT) i_note.namesz, 4); - - p = frag_more (sizeof (i_note.descsz)); - md_number_to_chars (p, (valueT) i_note.descsz, 4); - - p = frag_more (sizeof (i_note.type)); - md_number_to_chars (p, (valueT) i_note.type, 4); - - p = frag_more (4); - strcpy (p, "SCO"); - - /* Note: this is the version number of the ELF we're representing */ - p = frag_more (4); - md_number_to_chars (p, (SCO_MAJOR_VERSION << 16) | (SCO_MINOR_VERSION), 4); - - /* Here, we pick a magic number for ourselves (yes, I "registered" - it with SCO. The bottom bit shows that we are compat with the - SCO ABI. */ - p = frag_more (4); - md_number_to_chars (p, 0x4c520000 | 0x0001, 4); - - /* If we knew (or cared) what the source language options were, we'd - fill them in here. SCO has given us permission to ignore these - and just set them to zero. */ - p = frag_more (4); - md_number_to_chars (p, 0x0000, 4); - - frag_align (2, 0); - - /* We probably can't restore the current segment, for there likely - isn't one yet... */ - if (seg && subseg) - subseg_set (seg, subseg); -} - -#endif /* SCO_ELF */ - /* end of tc-i386.c */ diff -urN binutils-2.7/gas/config/tc-i386.h binutils-2.8/gas/config/tc-i386.h --- binutils-2.7/gas/config/tc-i386.h Thu Jul 4 12:14:05 1996 +++ binutils-2.8/gas/config/tc-i386.h Wed Apr 30 12:53:18 1997 @@ -1,5 +1,5 @@ /* tc-i386.h -- Header file for tc-i386.c - Copyright (C) 1989, 92, 93, 94, 95, 1996 Free Software Foundation. + Copyright (C) 1989, 92, 93, 94, 95, 96, 1997 Free Software Foundation. This file is part of GAS, the GNU Assembler. @@ -14,12 +14,19 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #ifndef TC_I386 #define TC_I386 1 +#ifdef ANSI_PROTOTYPES +struct fix; +#endif + +#define TARGET_BYTES_BIG_ENDIAN 0 + #ifdef TE_LYNX #define TARGET_FORMAT "coff-i386-lynx" #endif @@ -36,6 +43,7 @@ (X) != BFD_RELOC_386_GOTPC) ? Y : X) #define tc_fix_adjustable(X) tc_i386_fix_adjustable(X) +extern int tc_i386_fix_adjustable PARAMS ((struct fix *)); /* This is the relocation type for direct references to GLOBAL_OFFSET_TABLE. * It comes up in complicated expressions such as @@ -59,7 +67,6 @@ && (FIX)->fx_r_type != BFD_RELOC_386_GOTPC) #define TARGET_ARCH bfd_arch_i386 -#define TARGET_BYTES_BIG_ENDIAN 0 #ifdef OBJ_AOUT #ifdef TE_NetBSD @@ -74,6 +81,9 @@ #ifdef TE_Mach #define TARGET_FORMAT "a.out-mach3" #endif +#ifdef TE_DYNIX +#define TARGET_FORMAT "a.out-i386-dynix" +#endif #ifndef TARGET_FORMAT #define TARGET_FORMAT "a.out-i386" #endif @@ -83,6 +93,13 @@ #define TARGET_FORMAT "elf32-i386" #endif +#ifdef OBJ_MAYBE_ELF +#ifdef OBJ_MAYBE_COFF +extern const char *i386_target_format PARAMS ((void)); +#define TARGET_FORMAT i386_target_format () +#endif +#endif + #else /* ! BFD_ASSEMBLER */ /* COFF STUFF */ @@ -93,7 +110,7 @@ #define TC_COUNT_RELOC(x) ((x)->fx_addsy || (x)->fx_r_type==7) #define TC_FORCE_RELOCATION(x) ((x)->fx_r_type==7) #define TC_COFF_FIX2RTYPE(fixP) tc_coff_fix2rtype(fixP) -extern short tc_coff_fix2rtype (); +extern short tc_coff_fix2rtype PARAMS ((struct fix *)); #define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag) extern int tc_coff_sizemachdep PARAMS ((fragS *frag)); #define SUB_SEGMENT_ALIGN(SEG) 2 @@ -121,14 +138,16 @@ #endif #define tc_coff_symbol_emit_hook(a) ; /* not used */ +#ifndef BFD_ASSEMBLER #ifndef OBJ_AOUT #ifndef TE_PE /* Local labels starts with .L */ #define LOCAL_LABEL(name) (name[0] == '.' \ && (name[1] == 'L' || name[1] == 'X' || name[1] == '.')) -#define FAKE_LABEL_NAME ".L0\001" #endif #endif +#endif + #define LOCAL_LABELS_FB 1 #define tc_aout_pre_write_hook(x) {;} /* not used */ @@ -276,6 +295,7 @@ #define ReverseRegRegmem 0x10000 #define Data16 0x20000 /* needs data prefix if in 32-bit mode */ #define Data32 0x40000 /* needs data prefix if in 16-bit mode */ +#define iclrKludge 0x80000 /* used to convert clr to xor */ /* (opcode_modifier & COMES_IN_ALL_SIZES) is true if the instuction comes in byte, word, and dword sizes and is encoded into @@ -363,7 +383,7 @@ #endif #ifdef BFD_ASSEMBLER -void i386_validate_fix (); +void i386_validate_fix PARAMS ((struct fix *)); #define TC_VALIDATE_FIX(FIXP,SEGTYPE,SKIP) i386_validate_fix(FIXP) #endif @@ -377,14 +397,14 @@ extern int flag_16bit_code; -#define md_do_align(n, fill, len, around) \ +#define md_do_align(n, fill, len, max, around) \ if ((n) && !need_pass_2 \ && (!(fill) || ((char)*(fill) == (char)0x90 && (len) == 1)) \ && now_seg != data_section && now_seg != bss_section) \ { \ char *p; \ - p = frag_var(rs_align_code, 15, 1, (relax_substateT) 0, \ - (symbolS *) 0, (long) (n), (char *) 0); \ + p = frag_var (rs_align_code, 15, 1, (relax_substateT) max, \ + (symbolS *) 0, (offsetT) (n), (char *) 0); \ *p = 0x90; \ goto around; \ } diff -urN binutils-2.7/gas/config/tc-i960.c binutils-2.8/gas/config/tc-i960.c --- binutils-2.7/gas/config/tc-i960.c Thu Jul 4 12:14:10 1996 +++ binutils-2.8/gas/config/tc-i960.c Wed Apr 30 12:53:19 1997 @@ -1,5 +1,6 @@ /* tc-i960.c - All the i80960-specific stuff - Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. This file is part of GAS. @@ -14,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* See comment on md_parse_option for 80960-specific invocation options. */ @@ -1204,7 +1206,7 @@ } subseg_set (data_section, 0); /* .data */ - frag_align (2, 0); /* .align 2 */ + frag_align (2, 0, 0); /* .align 2 */ record_alignment (now_seg, 2); colon (BR_TAB_NAME); /* BR_TAB_NAME: */ emit (0); /* .word 0 #link to next table */ @@ -1695,6 +1697,10 @@ } } + /* Parse the displacement; this must be done before emitting the + opcode, in case it is an expression using `.'. */ + parse_expr (instr.e, &expr); + /* Output opcode */ outP = emit (instr.opcode); @@ -1703,8 +1709,7 @@ return; } - /* Parse and process the displacement */ - parse_expr (instr.e, &expr); + /* Process the displacement */ switch (expr.X_op) { case O_illegal: @@ -3110,7 +3115,7 @@ #ifdef OBJ_COFF - callP->sy_symbol.ost_auxent[1].x_bal.x_balntry = (int) balP; + callP->sy_tc = balP; S_SET_NUMBER_AUXILIARY (callP, 2); #else /* ! OBJ_COFF */ @@ -3131,8 +3136,8 @@ #endif /* ! OBJ_COFF */ } -char * -_tc_get_bal_of_call (callP) +symbolS * +tc_get_bal_of_call (callP) symbolS *callP; { symbolS *retval; @@ -3140,7 +3145,7 @@ know (TC_S_IS_CALLNAME (callP)); #ifdef OBJ_COFF - retval = (symbolS *) (callP->sy_symbol.ost_auxent[1].x_bal.x_balntry); + retval = callP->sy_tc; #else #ifdef OBJ_ABOUT retval = symbol_next (callP); @@ -3150,7 +3155,7 @@ #endif /* ! OBJ_COFF */ know (TC_S_IS_BALNAME (retval)); - return ((char *) retval); + return retval; } /* _tc_get_bal_of_call() */ void diff -urN binutils-2.7/gas/config/tc-i960.h binutils-2.8/gas/config/tc-i960.h --- binutils-2.7/gas/config/tc-i960.h Thu Jul 4 12:14:10 1996 +++ binutils-2.8/gas/config/tc-i960.h Wed Apr 30 12:53:19 1997 @@ -1,5 +1,5 @@ /* tc-i960.h - Basic 80960 instruction formats. - Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,13 +14,16 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public - License along with GAS; see the file COPYING. If not, write - to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #ifndef TC_I960 #define TC_I960 1 +#define TARGET_BYTES_BIG_ENDIAN 0 + /* * The 'COJ' instructions are actually COBR instructions with the 'b' in * the mnemonic replaced by a 'j'; they are ALWAYS "de-optimized" if necessary: @@ -118,6 +121,10 @@ }; #ifdef OBJ_COFF + +/* We store the bal information in the sy_tc field. */ +#define TC_SYMFIELD_TYPE struct symbol * + #define TC_ADJUST_RELOC_COUNT(FIXP,COUNT) \ { fixS *tcfixp = (FIXP); \ for (;tcfixp;tcfixp=tcfixp->fx_next) \ @@ -132,16 +139,16 @@ #define tc_fix_adjustable(FIXP) ((FIXP)->fx_bsr == 0) -void brtab_emit PARAMS ((void)); +extern void brtab_emit PARAMS ((void)); #define md_end() brtab_emit () -void reloc_callj (); /* this is really reloc_callj(fixS *fixP) but I don't want to change header inclusion order. */ -void tc_set_bal_of_call (); /* this is really tc_set_bal_of_call(symbolS *callP, symbolS *balP) */ +extern void reloc_callj (); + +extern void tc_set_bal_of_call PARAMS ((struct symbol *, struct symbol *)); -char *_tc_get_bal_of_call (); /* this is really symbolS *tc_get_bal_of_call(symbolS *callP). */ -#define tc_get_bal_of_call(c) ((symbolS *) _tc_get_bal_of_call(c)) +extern struct symbol *tc_get_bal_of_call PARAMS ((struct symbol *)); -void i960_handle_align (); +extern void i960_handle_align (); #define HANDLE_ALIGN(FRAG) i960_handle_align (FRAG) #define NEED_FX_R_TYPE #define NO_RELOC -1 diff -urN binutils-2.7/gas/config/tc-m32r.c binutils-2.8/gas/config/tc-m32r.c --- binutils-2.7/gas/config/tc-m32r.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/tc-m32r.c Wed Apr 30 12:53:19 1997 @@ -0,0 +1,1011 @@ +/* tc-m32r.c -- Assembler for the Mitsubishi M32R. + Copyright (C) 1996, 1997 Free Software Foundation. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include "as.h" +#include "subsegs.h" +#include "cgen-opc.h" + +/* Non-null if last insn was a 16 bit insn on a 32 bit boundary + (i.e. was the first of two 16 bit insns). */ +static const struct cgen_insn *prev_insn = NULL; + +/* Non-zero if we've seen a relaxable insn since the last 32 bit + alignment request. */ +static int seen_relaxable_p = 0; + +/* Non-zero if -relax specified, in which case sufficient relocs are output + for the linker to do relaxing. + We do simple forms of relaxing internally, but they are always done. + This flag does not apply to them. */ +static int m32r_relax; + +/* If non-NULL, pointer to cpu description file to read. + This allows runtime additions to the assembler. */ +static char *m32r_cpu_desc; + +/* stuff for .scomm symbols. */ +static segT sbss_section; +static asection scom_section; +static asymbol scom_symbol; + +const char comment_chars[] = ";"; +const char line_comment_chars[] = "#"; +const char line_separator_chars[] = ""; +const char EXP_CHARS[] = "eE"; +const char FLT_CHARS[] = "dD"; + +/* Relocations against symbols are done in two + parts, with a HI relocation and a LO relocation. Each relocation + has only 16 bits of space to store an addend. This means that in + order for the linker to handle carries correctly, it must be able + to locate both the HI and the LO relocation. This means that the + relocations must appear in order in the relocation table. + + In order to implement this, we keep track of each unmatched HI + relocation. We then sort them so that they immediately precede the + corresponding LO relocation. */ + +struct m32r_hi_fixup +{ + /* Next HI fixup. */ + struct m32r_hi_fixup *next; + /* This fixup. */ + fixS *fixp; + /* The section this fixup is in. */ + segT seg; +}; + +/* The list of unmatched HI relocs. */ + +static struct m32r_hi_fixup *m32r_hi_fixup_list; + +static void m32r_record_hi16 PARAMS ((int, fixS *, segT seg)); + +const char *md_shortopts = ""; + +struct option md_longopts[] = { +#if 0 /* not supported yet */ +#define OPTION_RELAX (OPTION_MD_BASE) + {"relax", no_argument, NULL, OPTION_RELAX}, +#define OPTION_CPU_DESC (OPTION_MD_BASE + 1) + {"cpu-desc", required_argument, NULL, OPTION_CPU_DESC}, +#endif + {NULL, no_argument, NULL, 0} +}; +size_t md_longopts_size = sizeof(md_longopts); + +int +md_parse_option (c, arg) + int c; + char *arg; +{ + switch (c) + { +#if 0 /* not supported yet */ + case OPTION_RELAX: + m32r_relax = 1; + break; + case OPTION_CPU_DESC: + m32r_cpu_desc = arg; + break; +#endif + default: + return 0; + } + return 1; +} + +void +md_show_usage (stream) + FILE *stream; +{ + fprintf (stream, "M32R options:\n"); +#if 0 + fprintf (stream, "\ +--relax create linker relaxable code\n"); + fprintf (stream, "\ +--cpu-desc provide runtime cpu description file\n"); +#else + fprintf (stream, "[none]\n"); +#endif +} + +static void fill_insn PARAMS ((int)); +static void m32r_scomm PARAMS ((int)); + +/* Set by md_assemble for use by m32r_fill_insn. */ +static subsegT prev_subseg; +static segT prev_seg; + +/* The target specific pseudo-ops which we support. */ +const pseudo_typeS md_pseudo_table[] = +{ + { "word", cons, 4 }, + { "fillinsn", fill_insn, 0 }, + { "scomm", m32r_scomm, 0 }, + { NULL, NULL, 0 } +}; + +/* FIXME: Should be machine generated. */ +#define NOP_INSN 0x7000 +#define PAR_NOP_INSN 0xf000 /* can only be used in 2nd slot */ + +/* When we align the .text section, insert the correct NOP pattern. + N is the power of 2 alignment. LEN is the length of pattern FILL. + MAX is the maximum number of characters to skip when doing the alignment, + or 0 if there is no maximum. */ + +int +m32r_do_align (n, fill, len, max) + int n; + const char *fill; + int len; + int max; +{ + if ((fill == NULL || (*fill == 0 && len == 1)) + && (now_seg->flags & SEC_CODE) != 0 + /* Only do this special handling if aligning to at least a + 4 byte boundary. */ + && n > 1 + /* Only do this special handling if we're allowed to emit at + least two bytes. */ + && (max == 0 || max > 1)) + { + static const unsigned char nop_pattern[] = { 0xf0, 0x00 }; + +#if 0 + /* First align to a 2 byte boundary, in case there is an odd .byte. */ + /* FIXME: How much memory will cause gas to use when assembling a big + program? Perhaps we can avoid the frag_align call? */ + frag_align (1, 0, 0); +#endif + /* Next align to a 4 byte boundary (we know n >= 2) using a parallel + nop. */ + frag_align_pattern (2, nop_pattern, sizeof nop_pattern, 0); + /* If doing larger alignments use a repeating sequence of appropriate + nops. */ + if (n > 2) + { + static const unsigned char multi_nop_pattern[] = { 0x70, 0x00, 0xf0, 0x00 }; + frag_align_pattern (n, multi_nop_pattern, sizeof multi_nop_pattern, + max ? max - 2 : 0); + } + return 1; + } + + return 0; +} + +static void +assemble_nop (opcode) + int opcode; +{ + char *f = frag_more (2); + md_number_to_chars (f, opcode, 2); +} + +/* If the last instruction was the first of 2 16 bit insns, + output a nop to move the PC to a 32 bit boundary. + + This is done via an alignment specification since branch relaxing + may make it unnecessary. + + Internally, we need to output one of these each time a 32 bit insn is + seen after an insn that is relaxable. */ + +static void +fill_insn (ignore) + int ignore; +{ + (void) m32r_do_align (2, NULL, 0, 0); + prev_insn = NULL; + seen_relaxable_p = 0; +} + +/* Cover function to fill_insn called after a label and at end of assembly. + + The result is always 1: we're called in a conditional to see if the + current line is a label. */ + +int +m32r_fill_insn (done) + int done; +{ + segT seg; + subsegT subseg; + + if (prev_seg != NULL) + { + seg = now_seg; + subseg = now_subseg; + subseg_set (prev_seg, prev_subseg); + fill_insn (0); + subseg_set (seg, subseg); + } + return 1; +} + +void +md_begin () +{ + flagword applicable; + segT seg; + subsegT subseg; + + /* Initialize the `cgen' interface. */ + + /* This is a callback from cgen to gas to parse operands. */ + cgen_parse_operand_fn = cgen_parse_operand; + /* Set the machine number and endian. */ + CGEN_SYM (init_asm) (0 /* mach number */, + target_big_endian ? CGEN_ENDIAN_BIG : CGEN_ENDIAN_LITTLE); + +#if 0 /* not supported yet */ + /* If a runtime cpu description file was provided, parse it. */ + if (m32r_cpu_desc != NULL) + { + const char *errmsg; + + errmsg = cgen_read_cpu_file (m32r_cpu_desc); + if (errmsg != NULL) + as_bad ("%s: %s", m32r_cpu_desc, errmsg); + } +#endif + + /* Save the current subseg so we can restore it [it's the default one and + we don't want the initial section to be .sbss. */ + seg = now_seg; + subseg = now_subseg; + + /* The sbss section is for local .scomm symbols. */ + sbss_section = subseg_new (".sbss", 0); + /* This is copied from perform_an_assembly_pass. */ + applicable = bfd_applicable_section_flags (stdoutput); + bfd_set_section_flags (stdoutput, sbss_section, applicable & SEC_ALLOC); +#if 0 /* What does this do? [see perform_an_assembly_pass] */ + seg_info (bss_section)->bss = 1; +#endif + + subseg_set (seg, subseg); + + /* We must construct a fake section similar to bfd_com_section + but with the name .scommon. */ + scom_section = bfd_com_section; + scom_section.name = ".scommon"; + scom_section.output_section = &scom_section; + scom_section.symbol = &scom_symbol; + scom_section.symbol_ptr_ptr = &scom_section.symbol; + scom_symbol = *bfd_com_section.symbol; + scom_symbol.name = ".scommon"; + scom_symbol.section = &scom_section; +} + +void +md_assemble (str) + char *str; +{ +#ifdef CGEN_INT_INSN + cgen_insn_t buffer[CGEN_MAX_INSN_SIZE / sizeof (cgen_insn_t)]; +#else + char buffer[CGEN_MAX_INSN_SIZE]; +#endif + struct cgen_fields fields; + const struct cgen_insn *insn; + char *errmsg; + + /* Initialize GAS's cgen interface for a new instruction. */ + cgen_asm_init_parse (); + + insn = CGEN_SYM (assemble_insn) (str, &fields, buffer, &errmsg); + if (!insn) + { + as_bad (errmsg); + return; + } + + if (CGEN_INSN_BITSIZE (insn) == 32) + { + /* 32 bit insns must live on 32 bit boundaries. */ + /* FIXME: If calling fill_insn too many times turns us into a memory + pig, can we call assemble_nop instead of !seen_relaxable_p? */ + if (prev_insn || seen_relaxable_p) + fill_insn (0); + cgen_asm_finish_insn (insn, buffer, CGEN_FIELDS_BITSIZE (&fields)); + } + else + { + /* Keep track of whether we've seen a pair of 16 bit insns. + PREV_INSN is NULL when we're on a 32 bit boundary. */ + if (prev_insn) + prev_insn = NULL; + else + prev_insn = insn; + cgen_asm_finish_insn (insn, buffer, CGEN_FIELDS_BITSIZE (&fields)); + + /* If the insn needs the following one to be on a 32 bit boundary + (e.g. subroutine calls), fill this insn's slot. */ + if (prev_insn + && CGEN_INSN_ATTR (insn, CGEN_INSN_FILL_SLOT) != 0) + fill_insn (0); + } + + /* If this is a relaxable insn (can be replaced with a larger version) + mark the fact so that we can emit an alignment directive for a following + 32 bit insn if we see one. */ + if (CGEN_INSN_ATTR (insn, CGEN_INSN_RELAXABLE) != 0) + seen_relaxable_p = 1; + + /* Set these so m32r_fill_insn can use them. */ + prev_seg = now_seg; + prev_subseg = now_subseg; +} + +/* The syntax in the manual says constants begin with '#'. + We just ignore it. */ + +void +md_operand (expressionP) + expressionS *expressionP; +{ + if (*input_line_pointer == '#') + { + input_line_pointer++; + expression (expressionP); + } +} + +valueT +md_section_align (segment, size) + segT segment; + valueT size; +{ + int align = bfd_get_section_alignment (stdoutput, segment); + return ((size + (1 << align) - 1) & (-1 << align)); +} + +symbolS * +md_undefined_symbol (name) + char *name; +{ + return 0; +} + +/* .scomm pseudo-op handler. + + This is a new pseudo-op to handle putting objects in .scommon. + By doing this the linker won't need to do any work and more importantly + it removes the implicit -G arg necessary to correctly link the object file. +*/ + +static void +m32r_scomm (ignore) + int ignore; +{ + register char *name; + register char c; + register char *p; + offsetT size; + register symbolS *symbolP; + offsetT align; + int align2; + + name = input_line_pointer; + c = get_symbol_end (); + + /* just after name is now '\0' */ + p = input_line_pointer; + *p = c; + SKIP_WHITESPACE (); + if (*input_line_pointer != ',') + { + as_bad ("Expected comma after symbol-name: rest of line ignored."); + ignore_rest_of_line (); + return; + } + + input_line_pointer++; /* skip ',' */ + if ((size = get_absolute_expression ()) < 0) + { + as_warn (".SCOMMon length (%ld.) <0! Ignored.", (long) size); + ignore_rest_of_line (); + return; + } + + /* The third argument to .scomm is the alignment. */ + if (*input_line_pointer != ',') + align = 8; + else + { + ++input_line_pointer; + align = get_absolute_expression (); + if (align <= 0) + { + as_warn ("ignoring bad alignment"); + align = 8; + } + } + /* Convert to a power of 2 alignment. */ + if (align) + { + for (align2 = 0; (align & 1) == 0; align >>= 1, ++align2) + continue; + if (align != 1) + { + as_bad ("Common alignment not a power of 2"); + ignore_rest_of_line (); + return; + } + } + else + align2 = 0; + + *p = 0; + symbolP = symbol_find_or_make (name); + *p = c; + + if (S_IS_DEFINED (symbolP)) + { + as_bad ("Ignoring attempt to re-define symbol `%s'.", + S_GET_NAME (symbolP)); + ignore_rest_of_line (); + return; + } + + if (S_GET_VALUE (symbolP) && S_GET_VALUE (symbolP) != (valueT) size) + { + as_bad ("Length of .scomm \"%s\" is already %ld. Not changed to %ld.", + S_GET_NAME (symbolP), + (long) S_GET_VALUE (symbolP), + (long) size); + + ignore_rest_of_line (); + return; + } + + if (symbolP->local) + { + segT old_sec = now_seg; + int old_subsec = now_subseg; + char *pfrag; + + record_alignment (sbss_section, align2); + subseg_set (sbss_section, 0); + if (align2) + frag_align (align2, 0, 0); + if (S_GET_SEGMENT (symbolP) == sbss_section) + symbolP->sy_frag->fr_symbol = 0; + symbolP->sy_frag = frag_now; + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size, + (char *) 0); + *pfrag = 0; + S_SET_SIZE (symbolP, size); + S_SET_SEGMENT (symbolP, sbss_section); + S_CLEAR_EXTERNAL (symbolP); + subseg_set (old_sec, old_subsec); + } + else + { + S_SET_VALUE (symbolP, (valueT) size); + S_SET_ALIGN (symbolP, align2); + S_SET_EXTERNAL (symbolP); + S_SET_SEGMENT (symbolP, &scom_section); + } + + demand_empty_rest_of_line (); +} + +/* Interface to relax_segment. */ + +/* FIXME: Build table by hand, get it working, then machine generate. */ + +const relax_typeS md_relax_table[] = +{ +/* The fields are: + 1) most positive reach of this state, + 2) most negative reach of this state, + 3) how many bytes this mode will add to the size of the current frag + 4) which index into the table to try if we can't fit into this one. */ + + /* The first entry must be unused because an `rlx_more' value of zero ends + each list. */ + {1, 1, 0, 0}, + + /* The displacement used by GAS is from the end of the 2 byte insn, + so we subtract 2 from the following. */ + /* 16 bit insn, 8 bit disp -> 10 bit range. + This doesn't handle a branch in the right slot at the border: + the "& -4" isn't taken into account. It's not important enough to + complicate things over it, so we subtract an extra 2 (or + 2 in -ve + case). */ + {511 - 2 - 2, -512 - 2 + 2, 0, 2 }, + /* 32 bit insn, 24 bit disp -> 26 bit range. */ + {0x2000000 - 1 - 2, -0x2000000 - 2, 2, 0 }, + /* Same thing, but with leading nop for alignment. */ + {0x2000000 - 1 - 2, -0x2000000 - 2, 4, 0 } +}; + +long +m32r_relax_frag (fragP, stretch) + fragS *fragP; + long stretch; +{ + /* Address of branch insn. */ + long address = fragP->fr_address + fragP->fr_fix - 2; + long growth = 0; + + /* Keep 32 bit insns aligned on 32 bit boundaries. */ + if (fragP->fr_subtype == 2) + { + if ((address & 3) != 0) + { + fragP->fr_subtype = 3; + growth = 2; + } + } + else if (fragP->fr_subtype == 3) + { + if ((address & 3) == 0) + { + fragP->fr_subtype = 2; + growth = -2; + } + } + else + { + growth = relax_frag (fragP, stretch); + + /* Long jump on odd halfword boundary? */ + if (fragP->fr_subtype == 2 && (address & 3) != 0) + { + fragP->fr_subtype = 3; + growth += 2; + } + } + + return growth; +} + +/* Return an initial guess of the length by which a fragment must grow to + hold a branch to reach its destination. + Also updates fr_type/fr_subtype as necessary. + + Called just before doing relaxation. + Any symbol that is now undefined will not become defined. + The guess for fr_var is ACTUALLY the growth beyond fr_fix. + Whatever we do to grow fr_fix or fr_var contributes to our returned value. + Although it may not be explicit in the frag, pretend fr_var starts with a + 0 value. */ + +int +md_estimate_size_before_relax (fragP, segment) + fragS *fragP; + segT segment; +{ + int old_fr_fix = fragP->fr_fix; + char *opcode = fragP->fr_opcode; + + /* The only thing we have to handle here are symbols outside of the + current segment. They may be undefined or in a different segment in + which case linker scripts may place them anywhere. + However, we can't finish the fragment here and emit the reloc as insn + alignment requirements may move the insn about. */ + + if (S_GET_SEGMENT (fragP->fr_symbol) != segment) + { + /* The symbol is undefined in this segment. + Change the relaxation subtype to the max allowable and leave + all further handling to md_convert_frag. */ + fragP->fr_subtype = 2; + +#if 0 /* Can't use this, but leave in for illustration. */ + /* Change 16 bit insn to 32 bit insn. */ + opcode[0] |= 0x80; + + /* Increase known (fixed) size of fragment. */ + fragP->fr_fix += 2; + + /* Create a relocation for it. */ + fix_new (fragP, old_fr_fix, 4, + fragP->fr_symbol, + fragP->fr_offset, 1 /* pcrel */, + /* FIXME: Can't use a real BFD reloc here. + cgen_md_apply_fix3 can't handle it. */ + BFD_RELOC_M32R_26_PCREL); + + /* Mark this fragment as finished. */ + frag_wane (fragP); +#else + return 2; +#endif + } + + return (fragP->fr_var + fragP->fr_fix - old_fr_fix); +} + +/* *fragP has been relaxed to its final size, and now needs to have + the bytes inside it modified to conform to the new size. + + Called after relaxation is finished. + fragP->fr_type == rs_machine_dependent. + fragP->fr_subtype is the subtype of what the address relaxed to. */ + +void +md_convert_frag (abfd, sec, fragP) + bfd *abfd; + segT sec; + fragS *fragP; +{ + char *opcode, *displacement; + int target_address, opcode_address, extension, addend; + + opcode = fragP->fr_opcode; + + /* Address opcode resides at in file space. */ + opcode_address = fragP->fr_address + fragP->fr_fix - 2; + + switch (fragP->fr_subtype) + { + case 1 : + extension = 0; + displacement = &opcode[1]; + break; + case 2 : + opcode[0] |= 0x80; + extension = 2; + displacement = &opcode[1]; + break; + case 3 : + opcode[2] = opcode[0] | 0x80; + md_number_to_chars (opcode, PAR_NOP_INSN, 2); + opcode_address += 2; + extension = 4; + displacement = &opcode[3]; + break; + default : + abort (); + } + + if (S_GET_SEGMENT (fragP->fr_symbol) != sec) + { + /* symbol must be resolved by linker */ + if (fragP->fr_offset & 3) + as_warn ("Addend to unresolved symbol not on word boundary."); + addend = fragP->fr_offset >> 2; + } + else + { + /* Address we want to reach in file space. */ + target_address = S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset; + target_address += fragP->fr_symbol->sy_frag->fr_address; + addend = (target_address - (opcode_address & -4)) >> 2; + } + + /* Create a relocation for symbols that must be resolved by the linker. + Otherwise output the completed insn. */ + + if (S_GET_SEGMENT (fragP->fr_symbol) != sec) + { + assert (fragP->fr_subtype != 1); + assert (fragP->fr_targ.cgen.insn != 0); + cgen_record_fixup (fragP, + /* Offset of branch insn in frag. */ + fragP->fr_fix + extension - 4, + fragP->fr_targ.cgen.insn, + 4 /*length*/, + /* FIXME: quick hack */ +#if 0 + CGEN_OPERAND_ENTRY (fragP->fr_targ.cgen.opindex), +#else + CGEN_OPERAND_ENTRY (M32R_OPERAND_DISP24), +#endif + fragP->fr_targ.cgen.opinfo, + fragP->fr_symbol, fragP->fr_offset); + } + +#define SIZE_FROM_RELAX_STATE(n) ((n) == 1 ? 1 : 3) + + md_number_to_chars (displacement, (valueT) addend, + SIZE_FROM_RELAX_STATE (fragP->fr_subtype)); + + fragP->fr_fix += extension; +} + +/* Functions concerning relocs. */ + +/* The location from which a PC relative jump should be calculated, + given a PC relative reloc. */ + +long +md_pcrel_from_section (fixP, sec) + fixS *fixP; + segT sec; +{ + if (fixP->fx_addsy != (symbolS *) NULL + && (! S_IS_DEFINED (fixP->fx_addsy) + || S_GET_SEGMENT (fixP->fx_addsy) != sec)) + { + /* The symbol is undefined (or is defined but not in this section). + Let the linker figure it out. */ + return 0; + } + + return (fixP->fx_frag->fr_address + fixP->fx_where) & -4L; +} + +/* Return the bfd reloc type for OPERAND of INSN at fixup FIXP. + Returns BFD_RELOC_NONE if no reloc type can be found. + *FIXP may be modified if desired. */ + +bfd_reloc_code_real_type +CGEN_SYM (lookup_reloc) (insn, operand, fixP) + const struct cgen_insn *insn; + const struct cgen_operand *operand; + fixS *fixP; +{ + switch (CGEN_OPERAND_TYPE (operand)) + { + case M32R_OPERAND_DISP8 : return BFD_RELOC_M32R_10_PCREL; + case M32R_OPERAND_DISP16 : return BFD_RELOC_M32R_18_PCREL; + case M32R_OPERAND_DISP24 : return BFD_RELOC_M32R_26_PCREL; + case M32R_OPERAND_UIMM24 : return BFD_RELOC_M32R_24; + case M32R_OPERAND_HI16 : + case M32R_OPERAND_SLO16 : + case M32R_OPERAND_ULO16 : + /* If low/high/shigh/sda was used, it is recorded in `opinfo'. */ + if (fixP->tc_fix_data.opinfo != 0) + return fixP->tc_fix_data.opinfo; + break; + } + return BFD_RELOC_NONE; +} + +/* Called while parsing an instruction to create a fixup. + We need to check for HI16 relocs and queue them up for later sorting. */ + +fixS * +m32r_cgen_record_fixup_exp (frag, where, insn, length, operand, opinfo, exp) + fragS *frag; + int where; + const struct cgen_insn *insn; + int length; + const struct cgen_operand *operand; + int opinfo; + expressionS *exp; +{ + fixS *fixP = cgen_record_fixup_exp (frag, where, insn, length, + operand, opinfo, exp); + + switch (CGEN_OPERAND_TYPE (operand)) + { + case M32R_OPERAND_HI16 : + /* If low/high/shigh/sda was used, it is recorded in `opinfo'. */ + if (fixP->tc_fix_data.opinfo == BFD_RELOC_M32R_HI16_SLO + || fixP->tc_fix_data.opinfo == BFD_RELOC_M32R_HI16_ULO) + m32r_record_hi16 (fixP->tc_fix_data.opinfo, fixP, now_seg); + break; + } + + return fixP; +} + +/* Record a HI16 reloc for later matching with its LO16 cousin. */ + +static void +m32r_record_hi16 (reloc_type, fixP, seg) + int reloc_type; + fixS *fixP; + segT seg; +{ + struct m32r_hi_fixup *hi_fixup; + + assert (reloc_type == BFD_RELOC_M32R_HI16_SLO + || reloc_type == BFD_RELOC_M32R_HI16_ULO); + + hi_fixup = ((struct m32r_hi_fixup *) + xmalloc (sizeof (struct m32r_hi_fixup))); + hi_fixup->fixp = fixP; + hi_fixup->seg = now_seg; + hi_fixup->next = m32r_hi_fixup_list; + m32r_hi_fixup_list = hi_fixup; +} + +/* Return BFD reloc type from opinfo field in a fixS. + It's tricky using fx_r_type in m32r_frob_file because the values + are BFD_RELOC_UNUSED + operand number. */ +#define FX_OPINFO_R_TYPE(f) ((f)->tc_fix_data.opinfo) + +/* Sort any unmatched HI16 relocs so that they immediately precede + the corresponding LO16 reloc. This is called before md_apply_fix and + tc_gen_reloc. */ + +void +m32r_frob_file () +{ + struct m32r_hi_fixup *l; + + for (l = m32r_hi_fixup_list; l != NULL; l = l->next) + { + segment_info_type *seginfo; + int pass; + + assert (FX_OPINFO_R_TYPE (l->fixp) == BFD_RELOC_M32R_HI16_SLO + || FX_OPINFO_R_TYPE (l->fixp) == BFD_RELOC_M32R_HI16_ULO); + + /* Check quickly whether the next fixup happens to be a matching low. */ + if (l->fixp->fx_next != NULL + && FX_OPINFO_R_TYPE (l->fixp->fx_next) == BFD_RELOC_M32R_LO16 + && l->fixp->fx_addsy == l->fixp->fx_next->fx_addsy + && l->fixp->fx_offset == l->fixp->fx_next->fx_offset) + continue; + + /* Look through the fixups for this segment for a matching `low'. + When we find one, move the high/shigh just in front of it. We do + this in two passes. In the first pass, we try to find a + unique `low'. In the second pass, we permit multiple high's + relocs for a single `low'. */ + seginfo = seg_info (l->seg); + for (pass = 0; pass < 2; pass++) + { + fixS *f, *prev; + + prev = NULL; + for (f = seginfo->fix_root; f != NULL; f = f->fx_next) + { + /* Check whether this is a `low' fixup which matches l->fixp. */ + if (FX_OPINFO_R_TYPE (f) == BFD_RELOC_M32R_LO16 + && f->fx_addsy == l->fixp->fx_addsy + && f->fx_offset == l->fixp->fx_offset + && (pass == 1 + || prev == NULL + || (FX_OPINFO_R_TYPE (prev) != BFD_RELOC_M32R_HI16_SLO + && FX_OPINFO_R_TYPE (prev) != BFD_RELOC_M32R_HI16_ULO) + || prev->fx_addsy != f->fx_addsy + || prev->fx_offset != f->fx_offset)) + { + fixS **pf; + + /* Move l->fixp before f. */ + for (pf = &seginfo->fix_root; + *pf != l->fixp; + pf = &(*pf)->fx_next) + assert (*pf != NULL); + + *pf = l->fixp->fx_next; + + l->fixp->fx_next = f; + if (prev == NULL) + seginfo->fix_root = l->fixp; + else + prev->fx_next = l->fixp; + + break; + } + + prev = f; + } + + if (f != NULL) + break; + + if (pass == 1) + as_warn_where (l->fixp->fx_file, l->fixp->fx_line, + "Unmatched high/shigh reloc"); + } + } +} + +/* See whether we need to force a relocation into the output file. + This is used to force out switch and PC relative relocations when + relaxing. */ + +int +m32r_force_relocation (fix) + fixS *fix; +{ + if (! m32r_relax) + return 0; + + return (fix->fx_pcrel + || 0 /* ??? */); +} + +/* Write a value out to the object file, using the appropriate endianness. */ + +void +md_number_to_chars (buf, val, n) + char *buf; + valueT val; + int n; +{ + if (target_big_endian) + number_to_chars_bigendian (buf, val, n); + else + number_to_chars_littleendian (buf, val, n); +} + +/* Turn a string in input_line_pointer into a floating point constant of type + type, and store the appropriate bytes in *litP. The number of LITTLENUMS + emitted is stored in *sizeP . An error message is returned, or NULL on OK. +*/ + +/* Equal to MAX_PRECISION in atof-ieee.c */ +#define MAX_LITTLENUMS 6 + +char * +md_atof (type, litP, sizeP) + char type; + char *litP; + int *sizeP; +{ + int i,prec; + LITTLENUM_TYPE words[MAX_LITTLENUMS]; + LITTLENUM_TYPE *wordP; + char *t; + char *atof_ieee (); + + switch (type) + { + case 'f': + case 'F': + case 's': + case 'S': + prec = 2; + break; + + case 'd': + case 'D': + case 'r': + case 'R': + prec = 4; + break; + + /* FIXME: Some targets allow other format chars for bigger sizes here. */ + + default: + *sizeP = 0; + return "Bad call to md_atof()"; + } + + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + *sizeP = prec * sizeof (LITTLENUM_TYPE); + + if (target_big_endian) + { + for (i = 0; i < prec; i++) + { + md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + } + else + { + for (i = prec - 1; i >= 0; i--) + { + md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + } + + return 0; +} diff -urN binutils-2.7/gas/config/tc-m32r.h binutils-2.8/gas/config/tc-m32r.h --- binutils-2.7/gas/config/tc-m32r.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/tc-m32r.h Wed Apr 30 12:53:19 1997 @@ -0,0 +1,112 @@ +/* tc-m32r.h -- Header file for tc-m32r.c. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define TC_M32R + +#ifndef BFD_ASSEMBLER +/* leading space so will compile with cc */ + #error M32R support requires BFD_ASSEMBLER +#endif + +#define LISTING_HEADER "M32R GAS " + +/* The target BFD architecture. */ +#define TARGET_ARCH bfd_arch_m32r + +#define TARGET_FORMAT "elf32-m32r" + +#define TARGET_BYTES_BIG_ENDIAN 1 + +/* call md_pcrel_from_section, not md_pcrel_from */ +#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC) + +/* Permit temporary numeric labels. */ +#define LOCAL_LABELS_FB 1 + +#define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */ + +/* We don't need to handle .word strangely. */ +#define WORKING_DOT_WORD + +/* For 8 vs 16 vs 32 bit branch selection. */ +extern const struct relax_type md_relax_table[]; +#define TC_GENERIC_RELAX_TABLE md_relax_table +#if 0 +extern void m32r_prepare_relax_scan (); +#define md_prepare_relax_scan(fragP, address, aim, this_state, this_type) \ +m32r_prepare_relax_scan (fragP, address, aim, this_state, this_type) +#else +#define md_relax_frag(fragP, stretch) \ +m32r_relax_frag (fragP, stretch) +#endif +/* Account for nop if 32 bit insn falls on odd halfword boundary. */ +#define TC_CGEN_MAX_RELAX(insn, len) (6) + +/* Alignments are used to ensure 32 bit insns live on 32 bit boundaries, so + we use a special alignment function to insert the correct nop pattern. */ +extern int m32r_do_align PARAMS ((int, const char *, int, int)); +#define md_do_align(n, fill, len, max, l) \ +if (m32r_do_align (n, fill, len, max)) goto l + +/* FIXME: Obviously the cgen_xxx decls here should be in a header. Later. */ + +#define MD_APPLY_FIX3 +extern int cgen_md_apply_fix3 (); +#define md_apply_fix3 cgen_md_apply_fix3 + +#define md_init_frag(fragP) \ +do { \ + (fragP)->fr_targ.cgen.insn = 0; \ + (fragP)->fr_targ.cgen.opindex = 0; \ + (fragP)->fr_targ.cgen.opinfo = 0; \ +} while (0); + +/* After creating a fixup for an instruction operand, we need to check for + HI16 relocs and queue them up for later sorting. */ +#define md_cgen_record_fixup_exp m32r_cgen_record_fixup_exp +extern struct fix *m32r_cgen_record_fixup_exp (); +extern struct fix *cgen_record_fixup_exp (); + +#define TC_HANDLES_FX_DONE + +/* Record a pointer to the insn table entry for each fixup. */ +#define TC_FIX_TYPE struct { PTR insn; int opinfo; } +#define TC_INIT_FIX_DATA(FIXP) \ + ((FIXP)->tc_fix_data.insn = NULL, (FIXP)->tc_fix_data.opinfo = 0) + +extern arelent *cgen_tc_gen_reloc (); +#define tc_gen_reloc cgen_tc_gen_reloc + +#define tc_frob_file() m32r_frob_file () +extern void m32r_frob_file PARAMS ((void)); + +/* When relaxing, we need to emit various relocs we otherwise wouldn't. */ +#define TC_FORCE_RELOCATION(fix) m32r_force_relocation (fix) +extern int m32r_force_relocation (); + +/* Ensure insns at labels are aligned to 32 bit boundaries. */ +int m32r_fill_insn PARAMS ((int)); +#define md_after_pass_hook() m32r_fill_insn (1) +#define TC_START_LABEL(ch, ptr) (ch == ':' && m32r_fill_insn (0)) + +/* Add extra M32R sections. */ +#define ELF_TC_SPECIAL_SECTIONS \ + { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \ + { ".sbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, diff -urN binutils-2.7/gas/config/tc-m68k.c binutils-2.8/gas/config/tc-m68k.c --- binutils-2.7/gas/config/tc-m68k.c Mon Jul 8 14:14:01 1996 +++ binutils-2.8/gas/config/tc-m68k.c Wed Apr 30 12:53:20 1997 @@ -1,5 +1,6 @@ /* tc-m68k.c -- Assemble for the m68k family - Copyright (C) 1987, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1987, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -30,7 +31,7 @@ pre-processor is disabled, these aren't very useful. The macro tc_comment_chars points to this. We use this, rather than the usual comment_chars, so that the --bitwise-or option will work. */ -#if (defined (OBJ_ELF) && ! defined (TE_PSOS) && ! defined (TE_LINUX)) || defined (TE_DELTA) +#if defined (TE_SVR4) || defined (TE_DELTA) const char *m68k_comment_chars = "|#"; #else const char *m68k_comment_chars = "|"; @@ -43,7 +44,7 @@ first line of the input file. This is because the compiler outputs #NO_APP at the beginning of its output. */ /* Also note that comments like this one will always work. */ -const char line_comment_chars[] = "#"; +const char line_comment_chars[] = "#*"; const char line_separator_chars[] = ""; @@ -95,6 +96,34 @@ be 32 bits. */ static int m68k_rel32 = 1; +/* This is non-zero if m68k_rel32 was set from the command line. */ +static int m68k_rel32_from_cmdline; + +/* The default width to use for an index register when using a base + displacement. */ +static enum m68k_size m68k_index_width_default = SIZE_LONG; + +/* We want to warn if any text labels are misaligned. In order to get + the right line number, we need to record the line number for each + label. */ + +struct label_line +{ + struct label_line *next; + symbolS *label; + char *file; + unsigned int line; + int text; +}; + +/* The list of labels. */ + +static struct label_line *labels; + +/* The current label. */ + +static struct label_line *current_label; + /* Its an arbitrary name: This means I don't approve of it */ /* See flames below */ static struct obstack robyn; @@ -189,7 +218,7 @@ { int fragoff; /* Where in the current opcode the frag ends */ symbolS *fadd; - long foff; + offsetT foff; int fragty; } fragb[4]; @@ -222,6 +251,9 @@ #define float_of_arch(x) ((x) & mfloat) #define mmu_of_arch(x) ((x) & mmmu) +/* Macros for determining if cpu supports a specific addressing mode */ +#define HAVE_LONG_BRANCH(x) ((x) & (m68020|m68030|m68040|m68060|cpu32)) + static struct m68k_it the_ins; /* the instruction being assembled */ #define op(ex) ((ex)->exp.X_op) @@ -233,6 +265,12 @@ #define addword(w) the_ins.opcode[the_ins.numo++]=(w) +/* Static functions. */ + +static void insop PARAMS ((int, struct m68k_incant *)); +static void add_fix PARAMS ((int, struct m68k_exp *, int, int)); +static void add_frag PARAMS ((symbolS *, offsetT, int)); + /* Like addword, but goes BEFORE general operands */ static void insop (w, opcode) @@ -254,12 +292,12 @@ Blecch. */ static void add_fix (width, exp, pc_rel, pc_fix) - char width; + int width; struct m68k_exp *exp; int pc_rel; int pc_fix; { - the_ins.reloc[the_ins.nrel].n = (((width)=='B') + the_ins.reloc[the_ins.nrel].n = ((width == 'B' || width == '3') ? (the_ins.numo*2-1) : (((width)=='b') ? (the_ins.numo*2+1) @@ -284,9 +322,9 @@ ADD becomes the FR_SYMBOL field of the frag, and OFF the FR_OFFSET. */ static void -add_frag(add,off,type) +add_frag (add, off, type) symbolS *add; - long off; + offsetT off; int type; { the_ins.fragb[the_ins.nfrag].fragoff=the_ins.numo; @@ -300,6 +338,10 @@ static char *crack_operand PARAMS ((char *str, struct m68k_op *opP)); static int get_num PARAMS ((struct m68k_exp *exp, int ok)); +static void m68k_ip PARAMS ((char *)); +static void insert_reg PARAMS ((const char *, int)); +static void select_control_regs PARAMS ((void)); +static void init_regtable PARAMS ((void)); static int reverse_16_bits PARAMS ((int in)); static int reverse_8_bits PARAMS ((int in)); static void install_gen_operand PARAMS ((int mode, int val)); @@ -327,6 +369,8 @@ static void s_mri_until PARAMS ((int)); static void s_mri_while PARAMS ((int)); static void s_mri_endw PARAMS ((int)); +static void md_apply_fix_2 PARAMS ((fixS *, offsetT)); +static void md_convert_frag_1 PARAMS ((fragS *)); static int current_architecture; @@ -504,7 +548,10 @@ /* The mote pseudo ops are put into the opcode table, since they don't start with a . they look like opcodes to gas. */ -extern void obj_coff_section (); + +#ifdef M68KCOFF +extern void obj_coff_section PARAMS ((int)); +#endif CONST pseudo_typeS mote_pseudo_table[] = { @@ -824,8 +871,7 @@ #undef F #undef MAP - reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent)); - assert (reloc != 0); + reloc = (arelent *) xmalloc (sizeof (arelent)); reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym; reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; #ifndef OBJ_ELF @@ -872,7 +918,6 @@ char c; int losing; int opsfound; - char *crack_operand (); LITTLENUM_TYPE words[6]; LITTLENUM_TYPE *wordp; unsigned long ok_arch = 0; @@ -992,12 +1037,10 @@ /* If we didn't get the right number of ops, or we have no common model with this pattern then reject this pattern. */ + ok_arch |= opcode->m_arch; if (opsfound != opcode->m_opnum || ((opcode->m_arch & current_architecture) == 0)) - { - ++losing; - ok_arch |= opcode->m_arch; - } + ++losing; else { for (s = opcode->m_operands, opP = &the_ins.operands[0]; @@ -1048,6 +1091,99 @@ } break; + case '<': + switch (opP->mode) + { + case DREG: + case AREG: + case FPREG: + case CONTROL: + case IMMED: + case ADEC: + case REGLST: + losing++; + break; + default: + break; + } + break; + + case '>': + switch (opP->mode) + { + case DREG: + case AREG: + case FPREG: + case CONTROL: + case IMMED: + case AINC: + case REGLST: + losing++; + break; + case ABSL: + break; + default: + if (opP->reg == PC + || opP->reg == ZPC) + losing++; + break; + } + break; + + case 'm': + switch (opP->mode) + { + case DREG: + case AREG: + case AINDR: + case AINC: + case ADEC: + break; + default: + losing++; + } + break; + + case 'n': + switch (opP->mode) + { + case DISP: + break; + default: + losing++; + } + break; + + case 'o': + switch (opP->mode) + { + case BASE: + case ABSL: + case IMMED: + break; + default: + losing++; + } + break; + + case 'p': + switch (opP->mode) + { + case DREG: + case AREG: + case AINDR: + case AINC: + case ADEC: + break; + case DISP: + if (opP->reg == PC || opP->reg == ZPC) + losing++; + break; + default: + losing++; + } + break; + case '#': if (opP->mode != IMMED) losing++; @@ -1056,6 +1192,11 @@ && (opP->disp.exp.X_op != O_constant || ! isbyte (opP->disp.exp.X_add_number))) losing++; + else if (s[1] == 'B' + && ! isvar (&opP->disp) + && (opP->disp.exp.X_op != O_constant + || ! issbyte (opP->disp.exp.X_add_number))) + losing++; else if (s[1] == 'w' && ! isvar (&opP->disp) && (opP->disp.exp.X_op != O_constant @@ -1561,7 +1702,7 @@ && !(ok_arch & current_architecture)) { char buf[200], *cp; - int len; + strcpy (buf, "invalid instruction for this architecture; needs "); cp = buf + strlen (buf); @@ -1603,8 +1744,7 @@ } } } - len = cp - buf + 1; - cp = malloc (len); + cp = xmalloc (strlen (buf) + 1); strcpy (cp, buf); the_ins.error = cp; } @@ -1642,6 +1782,12 @@ case '?': case '/': case '`': + case '<': + case '>': + case 'm': + case 'n': + case 'o': + case 'p': #ifndef NO_68851 case '|': #endif @@ -1893,17 +2039,18 @@ { nextword |= (opP->index.reg - DATA) << 12; - if (opP->index.size == SIZE_UNSPEC - || opP->index.size == SIZE_LONG) + if (opP->index.size == SIZE_LONG + || (opP->index.size == SIZE_UNSPEC + && m68k_index_width_default == SIZE_LONG)) nextword |= 0x800; - if (cpu_of_arch (current_architecture) < m68020) + if ((opP->index.scale != 1 + && cpu_of_arch (current_architecture) < m68020) + || (opP->index.scale == 8 + && current_architecture == mcf5200)) { - if (opP->index.scale != 1) - { - opP->error = - "scale factor invalid on this architecture; needs cpu32 or 68020 or higher"; - } + opP->error = + "scale factor invalid on this architecture; needs cpu32 or 68020 or higher"; } switch (opP->index.scale) @@ -1974,6 +2121,12 @@ #endif ) { + /* The code in md_convert_frag_1 needs to be + able to adjust nextword. Call frag_grow + to ensure that we have enough space in + the frag obstack to make all the bytes + contiguous. */ + frag_grow (14); nextword += baseo & 0xff; addword (nextword); add_frag (adds (&opP->disp), offs (&opP->disp), @@ -2116,7 +2269,7 @@ && opP->disp.pic_reloc == pic_none #endif && S_GET_SEGMENT (adds (&opP->disp)) == now_seg - && cpu_of_arch (current_architecture) >= m68020 + && HAVE_LONG_BRANCH(current_architecture) && !flag_long_jumps && !strchr ("~%&$?", s[0])) { @@ -2187,6 +2340,13 @@ the_ins.reloc[the_ins.nrel - 1].n = (opcode->m_codenum) * 2 + 1; break; + case 'B': + if (!issbyte (tmpreg)) + opP->error = "out of range"; + opcode->m_opcode |= tmpreg; + if (isvar (&opP->disp)) + the_ins.reloc[the_ins.nrel - 1].n = opcode->m_codenum * 2 - 1; + break; case 'w': if (!isword (tmpreg)) opP->error = "out of range"; @@ -2213,6 +2373,7 @@ tmpreg &= 0xFF; case '8': case 'C': + case 'j': install_operand (s[1], tmpreg); break; default: @@ -2244,8 +2405,8 @@ break; case 'L': long_branch: - if (cpu_of_arch (current_architecture) < m68020) - as_warn ("Can't use long branches on 68000/68010"); + if (!HAVE_LONG_BRANCH(current_architecture)) + as_warn ("Can't use long branches on 68000/68010/5200"); the_ins.opcode[the_ins.numo - 1] |= 0xff; add_fix ('l', &opP->disp, 1, 0); addword (0); @@ -2268,7 +2429,7 @@ BCC68000 for the case where opnd is absolute (it needs to use the 68000 hack since no conditional abs jumps). */ - if (((cpu_of_arch (current_architecture) < m68020) + if (( !HAVE_LONG_BRANCH(current_architecture) || (0 == adds (&opP->disp))) && (the_ins.opcode[0] >= 0x6200) && (the_ins.opcode[0] <= 0x6f00)) @@ -2305,15 +2466,15 @@ if (subs (&opP->disp)) { add_fix ('l', &opP->disp, 1, 0); - add_frag ((symbolS *) 0, (long) 0, TAB (FBRANCH, LONG)); + add_frag ((symbolS *) 0, (offsetT) 0, TAB (FBRANCH, LONG)); } else if (adds (&opP->disp)) add_frag (adds (&opP->disp), offs (&opP->disp), TAB (FBRANCH, SZ_UNDEF)); else { - /* add_frag((symbolS *) 0, offs(&opP->disp), - TAB(FBRANCH,SHORT)); */ + /* add_frag ((symbolS *) 0, offs (&opP->disp), + TAB(FBRANCH,SHORT)); */ the_ins.opcode[the_ins.numo - 1] |= 0x40; add_fix ('l', &opP->disp, 1, 0); addword (0); @@ -2916,7 +3077,7 @@ void insert_reg (regname, regnum) - char *regname; + const char *regname; int regnum; { char buf[100]; @@ -3027,11 +3188,13 @@ { "dacr0", DTT0 }, /* Data Access Control Register 0 */ { "dacr1", DTT1 }, /* Data Access Control Register 0 */ - /* mcf5200 versions of same */ - { "acr2", ITT0 }, /* Access Control Unit 2 */ - { "acr3", ITT1 }, /* Access Control Unit 3 */ - { "acr0", DTT0 }, /* Access Control Unit 0 */ - { "acr1", DTT1 }, /* Access Control Unit 1 */ + /* mcf5200 versions of same. The ColdFire programmer's reference + manual indicated that the order is 2,3,0,1, but Ken Rose + says that 0,1,2,3 is the correct order. */ + { "acr0", ITT0 }, /* Access Control Unit 0 */ + { "acr1", ITT1 }, /* Access Control Unit 1 */ + { "acr2", DTT0 }, /* Access Control Unit 2 */ + { "acr3", DTT1 }, /* Access Control Unit 3 */ { "tc", TC }, /* MMU Translation Control Register */ { "tcr", TC }, @@ -3188,6 +3351,13 @@ return; } + /* If there is a current label, record that it marks an instruction. */ + if (current_label != NULL) + { + current_label->text = 1; + current_label = NULL; + } + if (the_ins.nfrag == 0) { /* No frag hacking involved; just put it out */ @@ -3211,9 +3381,10 @@ n = 1; break; case '3': - n = 2; + n = 1; break; case 'w': + case 'W': n = 2; break; case 'l': @@ -3233,6 +3404,8 @@ get_reloc_code (n, the_ins.reloc[m].pcrel, the_ins.reloc[m].pic_reloc)); fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix; + if (the_ins.reloc[m].wid == 'B') + fixP->fx_signed = 1; } return; } @@ -3342,7 +3515,8 @@ { flag_reg_prefix_optional = 1; m68k_abspcadd = 1; - m68k_rel32 = 0; + if (! m68k_rel32_from_cmdline) + m68k_rel32 = 0; } op_hash = hash_new (); @@ -3502,6 +3676,39 @@ #endif } +static void +select_control_regs () +{ + /* Note which set of "movec" control registers is available. */ + switch (cpu_of_arch (current_architecture)) + { + case m68000: + control_regs = m68000_control_regs; + break; + case m68010: + control_regs = m68010_control_regs; + break; + case m68020: + case m68030: + control_regs = m68020_control_regs; + break; + case m68040: + control_regs = m68040_control_regs; + break; + case m68060: + control_regs = m68060_control_regs; + break; + case cpu32: + control_regs = cpu32_control_regs; + break; + case mcf5200: + control_regs = mcf5200_control_regs; + break; + default: + abort (); + } +} + void m68k_init_after_args () { @@ -3566,38 +3773,63 @@ #endif /* Note which set of "movec" control registers is available. */ - switch (cpu_of_arch (current_architecture)) - { - case m68000: - control_regs = m68000_control_regs; - break; - case m68010: - control_regs = m68010_control_regs; - break; - case m68020: - case m68030: - control_regs = m68020_control_regs; - break; - case m68040: - control_regs = m68040_control_regs; - break; - case m68060: - control_regs = m68060_control_regs; - break; - case cpu32: - control_regs = cpu32_control_regs; - break; - case mcf5200: - control_regs = mcf5200_control_regs; - break; - default: - abort (); - } + select_control_regs (); if (cpu_of_arch (current_architecture) < m68020) md_relax_table[TAB (PCINDEX, BYTE)].rlx_more = 0; } + +/* This is called when a label is defined. */ + +void +m68k_frob_label (sym) + symbolS *sym; +{ + struct label_line *n; + + n = (struct label_line *) xmalloc (sizeof *n); + n->next = labels; + n->label = sym; + as_where (&n->file, &n->line); + n->text = 0; + labels = n; + current_label = n; +} + +/* This is called when a value that is not an instruction is emitted. */ + +void +m68k_flush_pending_output () +{ + current_label = NULL; +} + +/* This is called at the end of the assembly, when the final value of + the label is known. We warn if this is a text symbol aligned at an + odd location. */ + +void +m68k_frob_symbol (sym) + symbolS *sym; +{ + if ((S_GET_VALUE (sym) & 1) != 0) + { + struct label_line *l; + for (l = labels; l != NULL; l = l->next) + { + if (l->label == sym) + { + if (l->text) + as_warn_where (l->file, l->line, + "text label `%s' aligned to odd boundary", + S_GET_NAME (sym)); + break; + } + } + } +} + /* This is called if we go in or out of MRI mode because of the .mri pseudo-op. */ @@ -3615,7 +3847,8 @@ #endif } m68k_abspcadd = 1; - m68k_rel32 = 0; + if (! m68k_rel32_from_cmdline) + m68k_rel32 = 0; } else { @@ -3631,7 +3864,8 @@ #endif } m68k_abspcadd = 0; - m68k_rel32 = 1; + if (! m68k_rel32_from_cmdline) + m68k_rel32 = 1; } } @@ -3653,7 +3887,6 @@ LITTLENUM_TYPE words[MAX_LITTLENUMS]; LITTLENUM_TYPE *wordP; char *t; - char *atof_ieee (); switch (type) { @@ -3774,7 +4007,7 @@ like "0xff" for a byte field. So extend the upper part of the range to accept such numbers. We arbitrarily disallow "-0xff" or "0xff+0xff", so that we can do any range checking at all. */ - if (!fixP->fx_pcrel) + if (! fixP->fx_pcrel && ! fixP->fx_signed) upper_limit = upper_limit * 2 + 1; if ((addressT) val > upper_limit @@ -3861,7 +4094,7 @@ ext = 2; break; case TAB (ABRANCH, LONG): - if (cpu_of_arch (current_architecture) < m68020) + if (!HAVE_LONG_BRANCH(current_architecture)) { if (fragP->fr_opcode[0] == 0x61) /* BSR */ @@ -4072,7 +4305,7 @@ fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), BYTE); break; } - else if ((fragP->fr_symbol == 0) || (cpu_of_arch (current_architecture) < m68020)) + else if ((fragP->fr_symbol == 0) || !HAVE_LONG_BRANCH(current_architecture)) { /* On 68000, or for absolute value, switch to abs long */ /* FIXME, we should check abs val, pick short or long */ @@ -4386,7 +4619,7 @@ { valueT offset; - if (cpu_of_arch (current_architecture) < m68020) + if (!HAVE_LONG_BRANCH(current_architecture)) { offset = to_addr - S_GET_VALUE (to_symbol); md_number_to_chars (ptr, (valueT) 0x4EF9, 2); @@ -4549,7 +4782,6 @@ } /* These are the back-ends for the various machine dependent pseudo-ops. */ -void demand_empty_rest_of_line (); /* Hate those extra verbose names */ static void s_data1 (ignore) @@ -4588,8 +4820,9 @@ temp = 1; /* JF should be 2? */ temp_fill = get_absolute_expression (); if (!need_pass_2) /* Never make frag if expect extra pass. */ - frag_align (temp, (int) temp_fill); + frag_align (temp, (int) temp_fill, 0); demand_empty_rest_of_line (); + record_alignment (now_seg, temp); } static void @@ -4601,6 +4834,18 @@ /* Pseudo-ops handled for MRI compatibility. */ +/* This function returns non-zero if the argument is a conditional + pseudo-op. This is called when checking whether a pending + alignment is needed. */ + +int +m68k_conditional_pseudoop (pop) + pseudo_typeS *pop; +{ + return (pop->poc_handler == s_mri_if + || pop->poc_handler == s_mri_else); +} + /* Handle an MRI style chip specification. */ static void @@ -4611,7 +4856,11 @@ int i; s = input_line_pointer; - c = get_symbol_end (); + /* We can't use get_symbol_end since the processor names are not proper + symbols. */ + while (is_part_of_name (c = *input_line_pointer++)) + ; + *--input_line_pointer = 0; for (i = 0; i < n_archs; i++) if (strcasecmp (s, archs[i].name) == 0) break; @@ -4634,13 +4883,20 @@ { ++input_line_pointer; s = input_line_pointer; - c = get_symbol_end (); + /* We can't use get_symbol_end since the processor names are not + proper symbols. */ + while (is_part_of_name (c = *input_line_pointer++)) + ; + *--input_line_pointer = 0; if (strcmp (s, "68881") == 0) current_architecture |= m68881; else if (strcmp (s, "68851") == 0) current_architecture |= m68851; *input_line_pointer = c; } + + /* Update info about available control registers. */ + select_control_regs (); } /* The MRI CHIP pseudo-op. */ @@ -6251,6 +6507,14 @@ OPTION_REGISTER_PREFIX_OPTIONAL}, #define OPTION_BITWISE_OR (OPTION_MD_BASE + 2) {"bitwise-or", no_argument, NULL, OPTION_BITWISE_OR}, +#define OPTION_BASE_SIZE_DEFAULT_16 (OPTION_MD_BASE + 3) + {"base-size-default-16", no_argument, NULL, OPTION_BASE_SIZE_DEFAULT_16}, +#define OPTION_BASE_SIZE_DEFAULT_32 (OPTION_MD_BASE + 4) + {"base-size-default-32", no_argument, NULL, OPTION_BASE_SIZE_DEFAULT_32}, +#define OPTION_DISP_SIZE_DEFAULT_16 (OPTION_MD_BASE + 5) + {"disp-size-default-16", no_argument, NULL, OPTION_DISP_SIZE_DEFAULT_16}, +#define OPTION_DISP_SIZE_DEFAULT_32 (OPTION_MD_BASE + 6) + {"disp-size-default-32", no_argument, NULL, OPTION_DISP_SIZE_DEFAULT_32}, {NULL, no_argument, NULL, 0} }; size_t md_longopts_size = sizeof(md_longopts); @@ -6383,6 +6647,24 @@ } break; + case OPTION_BASE_SIZE_DEFAULT_16: + m68k_index_width_default = SIZE_WORD; + break; + + case OPTION_BASE_SIZE_DEFAULT_32: + m68k_index_width_default = SIZE_LONG; + break; + + case OPTION_DISP_SIZE_DEFAULT_16: + m68k_rel32 = 0; + m68k_rel32_from_cmdline = 1; + break; + + case OPTION_DISP_SIZE_DEFAULT_32: + m68k_rel32 = 1; + m68k_rel32_from_cmdline = 1; + break; + default: return 0; } @@ -6399,7 +6681,7 @@ -l use 1 word for refs to undefined symbols [default 2]\n\ -m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060\n\ | -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -m68360\n\ - | -mcpu32 | -mcf5200\n\ + | -mcpu32 | -m5200\n\ specify variant of 680X0 architecture [default 68020]\n\ -m68881 | -m68882 | -mno-68881 | -mno-68882\n\ target has/lacks floating-point coprocessor\n\ @@ -6413,6 +6695,11 @@ --register-prefix-optional\n\ recognize register names without prefix character\n\ --bitwise-or do not treat `|' as a comment character\n"); + fprintf (stream, "\ +--base-size-default-16 base reg without size is 16 bits\n\ +--base-size-default-32 base reg without size is 32 bits (default)\n\ +--disp-size-default-16 displacement with unknown size is 16 bits\n\ +--disp-size-default-32 displacement with unknown size is 32 bits (default)\n"); } #ifdef TEST2 @@ -6543,6 +6830,8 @@ } #ifndef BFD_ASSEMBLER +#ifdef OBJ_COFF + /*ARGSUSED*/ void tc_coff_symbol_emit_hook (ignore) @@ -6567,6 +6856,8 @@ return 0; } } + +#endif #endif /* end of tc-m68k.c */ diff -urN binutils-2.7/gas/config/tc-m68k.h binutils-2.8/gas/config/tc-m68k.h --- binutils-2.7/gas/config/tc-m68k.h Thu Jul 4 12:14:19 1996 +++ binutils-2.8/gas/config/tc-m68k.h Wed Apr 30 12:53:20 1997 @@ -1,6 +1,5 @@ /* This file is tc-m68k.h - - Copyright (C) 1987, 89, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1987, 89, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,11 +15,17 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #define TC_M68K 1 +#ifdef ANSI_PROTOTYPES +struct symbol; +struct fix; +#endif + #define TARGET_BYTES_BIG_ENDIAN 1 #ifdef OBJ_AOUT @@ -54,6 +59,9 @@ #ifdef TE_AUX #define TARGET_FORMAT "coff-m68k-aux" #endif +#ifdef TE_DELTA +#define TARGET_FORMAT "coff-m68k-sysv" +#endif #ifndef COFF_MAGIC #define COFF_MAGIC MC68MAGIC @@ -92,43 +100,62 @@ #define LISTING_LHS_CONT_LINES 4/* And 4 lines max */ #define LISTING_HEADER "68K GAS " -/* Copied from write.c */ -#define M68K_AIM_KLUDGE(aim, this_state,this_type) \ - if (aim==0 && this_state== 4) { /* hard encoded from tc-m68k.c */ \ - aim=this_type->rlx_forward+1; /* Force relaxation into word mode */ \ - } - #ifndef REGISTER_PREFIX #define REGISTER_PREFIX '%' #endif #if !defined (REGISTER_PREFIX_OPTIONAL) #if defined (M68KCOFF) || defined (OBJ_ELF) +#ifndef BFD_ASSEMBLER #define LOCAL_LABEL(name) (name[0] == '.' \ && (name[1] == 'L' || name[1] == '.')) -#define FAKE_LABEL_NAME ".L0\001" +#endif /* ! BFD_ASSEMBLER */ #define REGISTER_PREFIX_OPTIONAL 0 -#else +#else /* ! (COFF || ELF) */ #define REGISTER_PREFIX_OPTIONAL 1 -#endif +#endif /* ! (COFF || ELF) */ #endif /* not def REGISTER_PREFIX and not def OPTIONAL_REGISTER_PREFIX */ #ifdef TE_DELTA -/* On the Delta, `%' can occur within a label name. I'm assuming it - can't be used as the initial character. If that's not true, more - work will be needed to fix this up. */ -#define LEX_PCT 1 +/* On the Delta, `%' can occur within a label name, but not as the + initial character. */ +#define LEX_PCT LEX_NAME +/* On the Delta, `~' can start a label name, but is converted to '.'. */ +#define LEX_TILDE LEX_BEGIN_NAME +#define tc_canonicalize_symbol_name(s) ((*(s) == '~' ? *(s) = '.' : '.'), s) /* On the Delta, dots are not required before pseudo-ops. */ #define NO_PSEUDO_DOT +#ifndef BFD_ASSEMBLER +#undef LOCAL_LABEL +#define LOCAL_LABEL(name) \ + (name[0] == '.' || (name[0] == 'L' && name[1] == '%')) +#endif #endif extern void m68k_mri_mode_change PARAMS ((int)); #define MRI_MODE_CHANGE(i) m68k_mri_mode_change (i) +extern int m68k_conditional_pseudoop PARAMS ((pseudo_typeS *)); +#define tc_conditional_pseudoop(pop) m68k_conditional_pseudoop (pop) + +extern void m68k_frob_label PARAMS ((struct symbol *)); +#define tc_frob_label(sym) m68k_frob_label (sym) + +extern void m68k_flush_pending_output PARAMS ((void)); +#define md_flush_pending_output() m68k_flush_pending_output () + +extern void m68k_frob_symbol PARAMS ((struct symbol *)); + #ifdef BFD_ASSEMBLER -#define tc_frob_symbol(sym,punt) \ - if (S_GET_SEGMENT (sym) == reg_section) punt = 1 +#define tc_frob_symbol(sym,punt) \ +do \ + { \ + if (S_GET_SEGMENT (sym) == reg_section) \ + punt = 1; \ + m68k_frob_symbol (sym); \ + } \ +while (0) #define NO_RELOC BFD_RELOC_NONE @@ -147,11 +174,16 @@ && (FIX)->fx_r_type != BFD_RELOC_32_GOT_PCREL) #define tc_fix_adjustable(X) tc_m68k_fix_adjustable(X) +extern int tc_m68k_fix_adjustable PARAMS ((struct fix *)); #endif -#else +#else /* ! BFD_ASSEMBLER */ + +#define tc_frob_coff_symbol(sym) m68k_frob_symbol (sym) + #define NO_RELOC 0 -#endif + +#endif /* ! BFD_ASSEMBLER */ #define DIFF_EXPR_OK @@ -168,5 +200,12 @@ extern struct relax_type md_relax_table[]; #define TC_GENERIC_RELAX_TABLE md_relax_table + +/* Copied from write.c */ +/* This was formerly called M68K_AIM_KLUDGE. */ +#define md_prepare_relax_scan(fragP, address, aim, this_state, this_type) \ + if (aim==0 && this_state== 4) { /* hard encoded from tc-m68k.c */ \ + aim=this_type->rlx_forward+1; /* Force relaxation into word mode */ \ + } /* end of tc-m68k.h */ diff -urN binutils-2.7/gas/config/tc-m88k.c binutils-2.8/gas/config/tc-m88k.c --- binutils-2.7/gas/config/tc-m88k.c Thu Jul 4 12:14:19 1996 +++ binutils-2.8/gas/config/tc-m88k.c Wed Apr 30 12:53:20 1997 @@ -1,7 +1,7 @@ /* m88k.c -- Assembler for the Motorola 88000 Contributed by Devon Bowen of Buffalo University and Torbjorn Granlund of the Swedish Institute of Computer Science. - Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,8 +17,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GAS; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +along with GAS; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ #include #include "as.h" @@ -1073,7 +1074,6 @@ LITTLENUM_TYPE words[MAX_LITTLENUMS]; LITTLENUM_TYPE *wordP; char *t; - char *atof_ieee (); switch (type) { @@ -1291,7 +1291,7 @@ subseg_set (SEG_BSS, 1); /* switch to bss */ if (bss_align) - frag_align (bss_align, 0); + frag_align (bss_align, 0, 0); /* detach from old frag */ if (symbolP->sy_type == N_BSS && symbolP->sy_frag != NULL) @@ -1299,7 +1299,7 @@ symbolP->sy_frag = frag_now; p = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP, - temp, (char *)0); + (offsetT) temp, (char *)0); *p = 0; S_SET_SEGMENT (symbolP, SEG_BSS); @@ -1433,16 +1433,17 @@ /* When we align the .init section, insert the correct NOP pattern. */ int -m88k_do_align (n, fill, len) +m88k_do_align (n, fill, max, len) int n; const char *fill; int len; + int max; { - if ((fill == NULL || (*fill == 0 && len == 1)) + if (fill == NULL && strcmp (obj_segment_name (now_seg), ".init") == 0) { static const unsigned char nop_pattern[] = { 0xf4, 0x00, 0x58, 0x00 }; - frag_align_pattern (n, nop_pattern, sizeof (nop_pattern)); + frag_align_pattern (n, nop_pattern, sizeof (nop_pattern), max); return 1; } return 0; diff -urN binutils-2.7/gas/config/tc-m88k.h binutils-2.8/gas/config/tc-m88k.h --- binutils-2.7/gas/config/tc-m88k.h Thu Jul 4 12:14:20 1996 +++ binutils-2.8/gas/config/tc-m88k.h Wed Apr 30 12:53:20 1997 @@ -1,7 +1,7 @@ /* m88k.h -- Assembler for the Motorola 88000 Contributed by Devon Bowen of Buffalo University and Torbjorn Granlund of the Swedish Institute of Computer Science. - Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,8 +17,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GAS; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +along with GAS; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ #define TC_M88K @@ -61,9 +62,12 @@ /* The m88k uses '@' to start local labels. */ #define LEX_AT (LEX_BEGIN_NAME | LEX_NAME) + +#ifndef BFD_ASSEMBLER #define LOCAL_LABEL(name) \ ((name[0] =='@' && (name [1] == 'L' || name [1] == '.')) \ || (name[0] == 'L' && name[1] == '0' && name[2] == '\001')) +#endif /* The m88k uses pseudo-ops with no leading period. */ #define NO_PSEUDO_DOT @@ -98,7 +102,7 @@ /* We use a special alignment function to insert the correct nop pattern in .init. */ -extern int m88k_do_align PARAMS ((int, const char *, int)); -#define md_do_align(n,fill,len,l) if (m88k_do_align(n,fill,len)) goto l +extern int m88k_do_align PARAMS ((int, const char *, int, int)); +#define md_do_align(n,fill,len,max,l) if (m88k_do_align(n,fill,max,len)) goto l #endif /* M88KCOFF */ diff -urN binutils-2.7/gas/config/tc-mips.c binutils-2.8/gas/config/tc-mips.c --- binutils-2.7/gas/config/tc-mips.c Thu Jul 4 12:14:24 1996 +++ binutils-2.8/gas/config/tc-mips.c Wed Apr 30 12:53:20 1997 @@ -1,5 +1,5 @@ /* tc-mips.c -- assemble code for a MIPS chip. - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Contributed by the OSF and Ralph Campbell. Written by Keith Knowles and Ralph Campbell, working independently. Modified for ECOFF and R4000 support by Ian Lance Taylor of Cygnus @@ -25,7 +25,6 @@ #include "as.h" #include "config.h" #include "subsegs.h" -#include "libiberty.h" #include @@ -37,9 +36,17 @@ #endif #include "opcode/mips.h" +#include "itbl-ops.h" + +#ifdef DEBUG +#define DBG(x) printf x +#else +#define DBG(x) +#endif #ifdef OBJ_MAYBE_ELF /* Clean up namespace so we can include obj-elf.h too. */ +static int mips_output_flavor PARAMS ((void)); static int mips_output_flavor () { return OUTPUT_FLAVOR; } #undef OBJ_PROCESS_STAB #undef OUTPUT_FLAVOR @@ -49,6 +56,7 @@ #undef S_SET_SIZE #undef TARGET_SYMBOL_FIELDS #undef obj_frob_file +#undef obj_frob_file_after_relocs #undef obj_frob_symbol #undef obj_pop_insert #undef obj_sec_sym_ok_for_reloc @@ -70,9 +78,12 @@ #include "ecoff.h" +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) static char *mips_regmask_frag; +#endif #define AT 1 +#define TREG 24 #define PIC_CALL_REG 25 #define KT0 26 #define KT1 27 @@ -81,6 +92,14 @@ #define FP 30 #define RA 31 +#define ILLEGAL_REG (32) + +/* Allow override of standard little-endian ECOFF format. */ + +#ifndef ECOFF_LITTLE_FORMAT +#define ECOFF_LITTLE_FORMAT "ecoff-littlemips" +#endif + extern int target_big_endian; /* 1 is we should use the 64 bit MIPS ELF ABI, 0 if we should use the @@ -96,7 +115,7 @@ case bfd_target_aout_flavour: return target_big_endian ? "a.out-mips-big" : "a.out-mips-little"; case bfd_target_ecoff_flavour: - return target_big_endian ? "ecoff-bigmips" : "ecoff-littlemips"; + return target_big_endian ? "ecoff-bigmips" : ECOFF_LITTLE_FORMAT; case bfd_target_elf_flavour: return (target_big_endian ? (mips_64 ? "elf64-bigmips" : "elf32-bigmips") @@ -115,16 +134,56 @@ ? ".rodata" \ : (abort (), "")) +/* This is the set of options which may be modified by the .set + pseudo-op. We use a struct so that .set push and .set pop are more + reliable. */ + +struct mips_set_options +{ + /* MIPS ISA (Instruction Set Architecture) level. This is set to -1 + if it has not been initialized. Changed by `.set mipsN', and the + -mipsN command line option, and the default CPU. */ + int isa; + /* Whether we are assembling for the mips16 processor. 0 if we are + not, 1 if we are, and -1 if the value has not been initialized. + Changed by `.set mips16' and `.set nomips16', and the -mips16 and + -nomips16 command line options, and the default CPU. */ + int mips16; + /* Non-zero if we should not reorder instructions. Changed by `.set + reorder' and `.set noreorder'. */ + int noreorder; + /* Non-zero if we should not permit the $at ($1) register to be used + in instructions. Changed by `.set at' and `.set noat'. */ + int noat; + /* Non-zero if we should warn when a macro instruction expands into + more than one machine instruction. Changed by `.set nomacro' and + `.set macro'. */ + int warn_about_macros; + /* Non-zero if we should not move instructions. Changed by `.set + move', `.set volatile', `.set nomove', and `.set novolatile'. */ + int nomove; + /* Non-zero if we should not optimize branches by moving the target + of the branch into the delay slot. Actually, we don't perform + this optimization anyhow. Changed by `.set bopt' and `.set + nobopt'. */ + int nobopt; + /* Non-zero if we should not autoextend mips16 instructions. + Changed by `.set autoextend' and `.set noautoextend'. */ + int noautoextend; +}; + +/* This is the struct we use to hold the current set of options. Note + that we must set the isa and mips16 fields to -1 to indicate that + they have not been initialized. */ + +static struct mips_set_options mips_opts = { -1, -1 }; + /* These variables are filled in with the masks of registers used. The object format code reads them and puts them in the appropriate place. */ unsigned long mips_gprmask; unsigned long mips_cprmask[4]; -/* MIPS ISA (Instruction Set Architecture) level (may be changed - temporarily using .set mipsN). */ -static int mips_isa = -1; - /* MIPS ISA we are using for this output file. */ static int file_mips_isa; @@ -140,12 +199,14 @@ /* Whether the 4100 MADD16 and DMADD16 are permitted. */ static int mips_4100 = -1; + /* Whether the processor uses hardware interlocks, and thus does not require nops to be inserted. */ static int interlocks = -1; /* As with "interlocks" this is used by hardware that has FP (co-processor) interlocks. */ +/* Itbl support may require additional care here. */ static int cop_interlocks = -1; /* MIPS PIC level. */ @@ -179,12 +240,9 @@ instructions. */ static int mips_trap; -static int mips_warn_about_macros; -static int mips_noreorder; +/* Non-zero if any .set noreorder directives were used. */ + static int mips_any_noreorder; -static int mips_nomove; -static int mips_noat; -static int mips_nobopt; /* The size of the small data section. */ static int g_switch_value = 8; @@ -205,11 +263,14 @@ I don't know if a fix is needed for the SVR4_PIC mode. I've only fixed it for the non-PIC mode. KR 95/04/07 */ -static int nopic_need_relax PARAMS ((symbolS *)); +static int nopic_need_relax PARAMS ((symbolS *, int)); /* handle of the OPCODE hash table */ static struct hash_control *op_hash = NULL; +/* The opcode hash table we use for the mips16. */ +static struct hash_control *mips16_op_hash = NULL; + /* This array holds the chars that always start a comment. If the pre-processor is disabled, these aren't very useful */ const char comment_chars[] = "#"; @@ -241,13 +302,8 @@ static char *insn_error; -static int byte_order; - static int auto_align = 1; -/* Symbol labelling the current insn. */ -static symbolS *insn_label; - /* When outputting SVR4 PIC code, the assembler needs to know the offset in the stack frame from which to restore the $gp register. This is set by the .cprestore pseudo-op, and saved in this @@ -290,6 +346,9 @@ /* The offset into prev_insn_frag for the previous instruction. */ static long prev_insn_where; +/* The reloc type for the previous instruction, if any. */ +static bfd_reloc_code_real_type prev_insn_reloc_type; + /* The reloc for the previous instruction, if any. */ static fixS *prev_insn_fixp; @@ -299,10 +358,30 @@ /* Non-zero if the previous instruction was in a .set noreorder. */ static int prev_insn_unreordered; +/* Non-zero if the previous instruction uses an extend opcode (if + mips16). */ +static int prev_insn_extended; + /* Non-zero if the previous previous instruction was in a .set noreorder. */ static int prev_prev_insn_unreordered; +/* If this is set, it points to a frag holding nop instructions which + were inserted before the start of a noreorder section. If those + nops turn out to be unnecessary, the size of the frag can be + decreased. */ +static fragS *prev_nop_frag; + +/* The number of nop instructions we created in prev_nop_frag. */ +static int prev_nop_frag_holds; + +/* The number of nop instructions that we know we need in + prev_nop_frag. */ +static int prev_nop_frag_required; + +/* The number of instructions we've seen since prev_nop_frag. */ +static int prev_nop_frag_since; + /* For ECOFF and ELF, relocations against symbols are done in two parts, with a HI relocation and a LO relocation. Each relocation has only 16 bits of space to store an addend. This means that in @@ -327,6 +406,25 @@ /* The list of unmatched HI relocs. */ static struct mips_hi_fixup *mips_hi_fixup_list; + +/* Map normal MIPS register numbers to mips16 register numbers. */ + +#define X ILLEGAL_REG +static const int mips32_to_16_reg_map[] = +{ + X, X, 2, 3, 4, 5, 6, 7, + X, X, X, X, X, X, X, X, + 0, 1, X, X, X, X, X, X, + X, X, X, X, X, X, X, X +}; +#undef X + +/* Map mips16 register numbers to normal MIPS register numbers. */ + +static const int mips16_to_32_reg_map[] = +{ + 16, 17, 2, 3, 4, 5, 6, 7 +}; /* Since the MIPS does not have multiple forms of PC relative instructions, we do not have to do relaxing as is done on other @@ -391,18 +489,58 @@ one if needed. */ #define RELAX_ENCODE(old, new, reloc1, reloc2, reloc3, warn) \ ((relax_substateT) \ - (((old) << 24) \ + (((old) << 23) \ | ((new) << 16) \ | (((reloc1) + 64) << 9) \ | (((reloc2) + 64) << 2) \ | ((reloc3) ? (1 << 1) : 0) \ | ((warn) ? 1 : 0))) -#define RELAX_OLD(i) (((i) >> 24) & 0xff) -#define RELAX_NEW(i) (((i) >> 16) & 0xff) +#define RELAX_OLD(i) (((i) >> 23) & 0x7f) +#define RELAX_NEW(i) (((i) >> 16) & 0x7f) #define RELAX_RELOC1(i) ((bfd_vma)(((i) >> 9) & 0x7f) - 64) #define RELAX_RELOC2(i) ((bfd_vma)(((i) >> 2) & 0x7f) - 64) #define RELAX_RELOC3(i) (((i) >> 1) & 1) #define RELAX_WARN(i) ((i) & 1) + +/* For mips16 code, we use an entirely different form of relaxation. + mips16 supports two versions of most instructions which take + immediate values: a small one which takes some small value, and a + larger one which takes a 16 bit value. Since branches also follow + this pattern, relaxing these values is required. + + We can assemble both mips16 and normal MIPS code in a single + object. Therefore, we need to support this type of relaxation at + the same time that we support the relaxation described above. We + use the high bit of the subtype field to distinguish these cases. + + The information we store for this type of relaxation is the + argument code found in the opcode file for this relocation, whether + the user explicitly requested a small or extended form, and whether + the relocation is in a jump or jal delay slot. That tells us the + size of the value, and how it should be stored. We also store + whether the fragment is considered to be extended or not. We also + store whether this is known to be a branch to a different section, + whether we have tried to relax this frag yet, and whether we have + ever extended a PC relative fragment because of a shift count. */ +#define RELAX_MIPS16_ENCODE(type, small, ext, dslot, jal_dslot) \ + (0x80000000 \ + | ((type) & 0xff) \ + | ((small) ? 0x100 : 0) \ + | ((ext) ? 0x200 : 0) \ + | ((dslot) ? 0x400 : 0) \ + | ((jal_dslot) ? 0x800 : 0)) +#define RELAX_MIPS16_P(i) (((i) & 0x80000000) != 0) +#define RELAX_MIPS16_TYPE(i) ((i) & 0xff) +#define RELAX_MIPS16_USER_SMALL(i) (((i) & 0x100) != 0) +#define RELAX_MIPS16_USER_EXT(i) (((i) & 0x200) != 0) +#define RELAX_MIPS16_DSLOT(i) (((i) & 0x400) != 0) +#define RELAX_MIPS16_JAL_DSLOT(i) (((i) & 0x800) != 0) +#define RELAX_MIPS16_EXTENDED(i) (((i) & 0x1000) != 0) +#define RELAX_MIPS16_MARK_EXTENDED(i) ((i) | 0x1000) +#define RELAX_MIPS16_CLEAR_EXTENDED(i) ((i) &~ 0x1000) +#define RELAX_MIPS16_LONG_BRANCH(i) (((i) & 0x2000) != 0) +#define RELAX_MIPS16_MARK_LONG_BRANCH(i) ((i) | 0x2000) +#define RELAX_MIPS16_CLEAR_LONG_BRANCH(i) ((i) &~ 0x2000) /* Prototypes for static functions. */ @@ -413,16 +551,19 @@ #define internalError() as_fatal ("MIPS internal Error"); #endif +enum mips_regclass { MIPS_GR_REG, MIPS_FP_REG, MIPS16_REG }; + static int insn_uses_reg PARAMS ((struct mips_cl_insn *ip, - unsigned int reg, int fpr)); + unsigned int reg, enum mips_regclass class)); static int reg_needs_delay PARAMS ((int)); +static void mips16_mark_labels PARAMS ((void)); static void append_insn PARAMS ((char *place, struct mips_cl_insn * ip, expressionS * p, bfd_reloc_code_real_type r, boolean)); -static void mips_no_prev_insn PARAMS ((void)); -static void mips_emit_delays PARAMS ((void)); +static void mips_no_prev_insn PARAMS ((int)); +static void mips_emit_delays PARAMS ((boolean)); #ifdef USE_STDARG static void macro_build PARAMS ((char *place, int *counter, expressionS * ep, const char *name, const char *fmt, @@ -430,6 +571,9 @@ #else static void macro_build (); #endif +static void mips16_macro_build PARAMS ((char *, int *, expressionS *, + const char *, const char *, + va_list)); static void macro_build_lui PARAMS ((char *place, int *counter, expressionS * ep, int regnum)); static void set_at PARAMS ((int *counter, int reg, int unsignedp)); @@ -438,10 +582,15 @@ static void load_register PARAMS ((int *, int, expressionS *, int)); static void load_address PARAMS ((int *counter, int reg, expressionS *ep)); static void macro PARAMS ((struct mips_cl_insn * ip)); +static void mips16_macro PARAMS ((struct mips_cl_insn * ip)); #ifdef LOSING_COMPILER static void macro2 PARAMS ((struct mips_cl_insn * ip)); #endif static void mips_ip PARAMS ((char *str, struct mips_cl_insn * ip)); +static void mips16_ip PARAMS ((char *str, struct mips_cl_insn * ip)); +static void mips16_immed PARAMS ((char *, unsigned int, int, offsetT, boolean, + boolean, boolean, unsigned long *, + boolean *, unsigned short *)); static int my_getSmallExpression PARAMS ((expressionS * ep, char *str)); static void my_getExpression PARAMS ((expressionS * ep, char *str)); static symbolS *get_symbol PARAMS ((void)); @@ -458,12 +607,15 @@ static void s_cprestore PARAMS ((int)); static void s_gpword PARAMS ((int)); static void s_cpadd PARAMS ((int)); +static void s_insn PARAMS ((int)); static void md_obj_begin PARAMS ((void)); static void md_obj_end PARAMS ((void)); static long get_number PARAMS ((void)); static void s_ent PARAMS ((int)); static void s_mipsend PARAMS ((int)); static void s_file PARAMS ((int)); +static void s_mips_stab PARAMS ((int)); +static int mips16_extended_frag PARAMS ((fragS *, asection *, long)); /* Pseudo-op table. @@ -496,6 +648,7 @@ {"cprestore", s_cprestore, 0}, {"gpword", s_gpword, 0}, {"cpadd", s_cpadd, 0}, + {"insn", s_insn, 0}, /* Relatively generic pseudo-ops that happen to be used on MIPS chips. */ @@ -521,6 +674,7 @@ {"quad", s_cons, 3}, {"short", s_cons, 1}, {"single", s_float_cons, 'f'}, + {"stabn", s_mips_stab, 'n'}, {"text", s_change_sec, 't'}, {"word", s_cons, 2}, { 0 }, @@ -553,6 +707,30 @@ pop_insert (mips_nonecoff_pseudo_table); } +/* Symbols labelling the current insn. */ + +struct insn_label_list +{ + struct insn_label_list *next; + symbolS *label; +}; + +static struct insn_label_list *insn_labels; +static struct insn_label_list *free_insn_labels; + +static void mips_clear_insn_labels PARAMS ((void)); + +static inline void +mips_clear_insn_labels () +{ + register struct insn_label_list **pl; + + for (pl = &free_insn_labels; *pl != NULL; pl = &(*pl)->next) + ; + *pl = insn_labels; + insn_labels = NULL; +} + static char *expr_end; /* Expressions which appear in instructions. These are set by @@ -570,6 +748,10 @@ static boolean imm_unmatched_hi; +/* These are set by mips16_ip if an explicit extension is used. */ + +static boolean mips16_small, mips16_ext; + /* * This function is called once, at assembler startup time. It should * set up all the tables, etc. that the MD part of the assembler will need. @@ -581,7 +763,7 @@ register const char *retval = NULL; register unsigned int i = 0; - if (mips_isa == -1) + if (mips_opts.isa == -1) { const char *cpu; char *a = NULL; @@ -597,14 +779,14 @@ if (strcmp (cpu, "mips") == 0) { - mips_isa = 1; + mips_opts.isa = 1; if (mips_cpu == -1) mips_cpu = 3000; } else if (strcmp (cpu, "r6000") == 0 || strcmp (cpu, "mips2") == 0) { - mips_isa = 2; + mips_opts.isa = 2; if (mips_cpu == -1) mips_cpu = 6000; } @@ -612,26 +794,26 @@ || strcmp (cpu, "r4000") == 0 || strcmp (cpu, "mips3") == 0) { - mips_isa = 3; + mips_opts.isa = 3; if (mips_cpu == -1) mips_cpu = 4000; } else if (strcmp (cpu, "r4400") == 0) { - mips_isa = 3; + mips_opts.isa = 3; if (mips_cpu == -1) mips_cpu = 4400; } else if (strcmp (cpu, "mips64orion") == 0 || strcmp (cpu, "r4600") == 0) { - mips_isa = 3; + mips_opts.isa = 3; if (mips_cpu == -1) mips_cpu = 4600; } else if (strcmp (cpu, "r4650") == 0) { - mips_isa = 3; + mips_opts.isa = 3; if (mips_cpu == -1) mips_cpu = 4650; if (mips_4650 == -1) @@ -639,13 +821,13 @@ } else if (strcmp (cpu, "mips64vr4300") == 0) { - mips_isa = 3; + mips_opts.isa = 3; if (mips_cpu == -1) mips_cpu = 4300; } else if (strcmp (cpu, "mips64vr4100") == 0) { - mips_isa = 3; + mips_opts.isa = 3; if (mips_cpu == -1) mips_cpu = 4100; if (mips_4100 == -1) @@ -653,28 +835,41 @@ } else if (strcmp (cpu, "r4010") == 0) { - mips_isa = 2; + mips_opts.isa = 2; if (mips_cpu == -1) mips_cpu = 4010; if (mips_4010 == -1) mips_4010 = 1; } + else if (strcmp (cpu, "r5000") == 0 + || strcmp (cpu, "mips64vr5000") == 0) + { + mips_opts.isa = 4; + if (mips_cpu == -1) + mips_cpu = 5000; + } else if (strcmp (cpu, "r8000") == 0 || strcmp (cpu, "mips4") == 0) { - mips_isa = 4; + mips_opts.isa = 4; if (mips_cpu == -1) mips_cpu = 8000; } else if (strcmp (cpu, "r10000") == 0) { - mips_isa = 4; + mips_opts.isa = 4; if (mips_cpu == -1) mips_cpu = 10000; } + else if (strcmp (cpu, "mips16") == 0) + { + mips_opts.isa = 3; + if (mips_cpu == -1) + mips_cpu = 0; /* FIXME */ + } else { - mips_isa = 1; + mips_opts.isa = 1; if (mips_cpu == -1) mips_cpu = 3000; } @@ -683,6 +878,14 @@ free (a); } + if (mips_opts.mips16 < 0) + { + if (strncmp (TARGET_CPU, "mips16", sizeof "mips16" - 1) == 0) + mips_opts.mips16 = 1; + else + mips_opts.mips16 = 0; + } + if (mips_4650 < 0) mips_4650 = 0; @@ -692,20 +895,22 @@ if (mips_4100 < 0) mips_4100 = 0; - if (mips_4650 || mips_4010 || mips_4100 || mips_cpu == 4300) + + if (mips_4010 || mips_cpu == 4300) interlocks = 1; else interlocks = 0; + /* Itbl support may require additional care here. */ if (mips_cpu == 4300) cop_interlocks = 1; else cop_interlocks = 0; - if (mips_isa < 2 && mips_trap) + if (mips_opts.isa < 2 && mips_trap) as_bad ("trap exception not supported at ISA 1"); - switch (mips_isa) + switch (mips_opts.isa) { case 1: ok = bfd_set_arch_mach (stdoutput, bfd_arch_mips, 3000); @@ -723,7 +928,7 @@ if (! ok) as_warn ("Could not set architecture and machine"); - file_mips_isa = mips_isa; + file_mips_isa = mips_opts.isa; op_hash = hash_new (); @@ -753,7 +958,56 @@ while ((i < NUMOPCODES) && !strcmp (mips_opcodes[i].name, name)); } - mips_no_prev_insn (); + mips16_op_hash = hash_new (); + + i = 0; + while (i < bfd_mips16_num_opcodes) + { + const char *name = mips16_opcodes[i].name; + + retval = hash_insert (mips16_op_hash, name, (PTR) &mips16_opcodes[i]); + if (retval != NULL) + as_fatal ("internal error: can't hash `%s': %s\n", + mips16_opcodes[i].name, retval); + do + { + if (mips16_opcodes[i].pinfo != INSN_MACRO + && ((mips16_opcodes[i].match & mips16_opcodes[i].mask) + != mips16_opcodes[i].match)) + as_fatal ("internal error: bad opcode: `%s' \"%s\"\n", + mips16_opcodes[i].name, mips16_opcodes[i].args); + ++i; + } + while (i < bfd_mips16_num_opcodes + && strcmp (mips16_opcodes[i].name, name) == 0); + } + + /* We add all the general register names to the symbol table. This + helps us detect invalid uses of them. */ + for (i = 0; i < 32; i++) + { + char buf[5]; + + sprintf (buf, "$%d", i); + symbol_table_insert (symbol_new (buf, reg_section, i, + &zero_address_frag)); + } + symbol_table_insert (symbol_new ("$fp", reg_section, FP, + &zero_address_frag)); + symbol_table_insert (symbol_new ("$sp", reg_section, SP, + &zero_address_frag)); + symbol_table_insert (symbol_new ("$gp", reg_section, GP, + &zero_address_frag)); + symbol_table_insert (symbol_new ("$at", reg_section, AT, + &zero_address_frag)); + symbol_table_insert (symbol_new ("$kt0", reg_section, KT0, + &zero_address_frag)); + symbol_table_insert (symbol_new ("$kt1", reg_section, KT1, + &zero_address_frag)); + symbol_table_insert (symbol_new ("$pc", reg_section, -1, + &zero_address_frag)); + + mips_no_prev_insn (false); mips_gprmask = 0; mips_cprmask[0] = 0; @@ -769,30 +1023,40 @@ if (OUTPUT_FLAVOR == bfd_target_elf_flavour) { - /* Sections must be aligned to 16 byte boundaries. */ - (void) bfd_set_section_alignment (stdoutput, text_section, 4); - (void) bfd_set_section_alignment (stdoutput, data_section, 4); - (void) bfd_set_section_alignment (stdoutput, bss_section, 4); + /* On a native system, sections must be aligned to 16 byte + boundaries. When configured for an embedded ELF target, we + don't bother. */ + if (strcmp (TARGET_OS, "elf") != 0) + { + (void) bfd_set_section_alignment (stdoutput, text_section, 4); + (void) bfd_set_section_alignment (stdoutput, data_section, 4); + (void) bfd_set_section_alignment (stdoutput, bss_section, 4); + } /* Create a .reginfo section for register masks and a .mdebug section for debugging information. */ { segT seg; subsegT subseg; + flagword flags; segT sec; seg = now_seg; subseg = now_subseg; + /* The ABI says this section should be loaded so that the + running program can access it. However, we don't load it + if we are configured for an embedded target */ + flags = SEC_READONLY | SEC_DATA; + if (strcmp (TARGET_OS, "elf") != 0) + flags |= SEC_ALLOC | SEC_LOAD; + if (! mips_64) { sec = subseg_new (".reginfo", (subsegT) 0); - /* The ABI says this section should be loaded so that the - running program can access it. */ - (void) bfd_set_section_flags (stdoutput, sec, - (SEC_ALLOC | SEC_LOAD - | SEC_READONLY | SEC_DATA)); + + (void) bfd_set_section_flags (stdoutput, sec, flags); (void) bfd_set_section_alignment (stdoutput, sec, 2); #ifdef OBJ_ELF @@ -804,9 +1068,7 @@ /* The 64-bit ABI uses a .MIPS.options section rather than .reginfo section. */ sec = subseg_new (".MIPS.options", (subsegT) 0); - (void) bfd_set_section_flags (stdoutput, sec, - (SEC_ALLOC | SEC_LOAD - | SEC_READONLY | SEC_DATA)); + (void) bfd_set_section_flags (stdoutput, sec, flags); (void) bfd_set_section_alignment (stdoutput, sec, 3); #ifdef OBJ_ELF @@ -864,15 +1126,27 @@ offset_expr.X_op = O_absent; offset_reloc = BFD_RELOC_UNUSED; - mips_ip (str, &insn); + if (mips_opts.mips16) + mips16_ip (str, &insn); + else + { + mips_ip (str, &insn); + DBG(("returned from mips_ip(%s) insn_opcode = 0x%x\n", + str, insn.insn_opcode)); + } + if (insn_error) { as_bad ("%s `%s'", insn_error, str); return; } + if (insn.insn_mo->pinfo == INSN_MACRO) { - macro (&insn); + if (mips_opts.mips16) + mips16_macro (&insn); + else + macro (&insn); } else { @@ -886,21 +1160,29 @@ } } -/* See whether instruction IP reads register REG. If FPR is non-zero, - REG is a floating point register. */ +/* See whether instruction IP reads register REG. CLASS is the type + of register. */ static int -insn_uses_reg (ip, reg, fpr) +insn_uses_reg (ip, reg, class) struct mips_cl_insn *ip; unsigned int reg; - int fpr; + enum mips_regclass class; { + if (class == MIPS16_REG) + { + assert (mips_opts.mips16); + reg = mips16_to_32_reg_map[reg]; + class = MIPS_GR_REG; + } + /* Don't report on general register 0, since it never changes. */ - if (! fpr && reg == 0) + if (class == MIPS_GR_REG && reg == 0) return 0; - if (fpr) + if (class == MIPS_FP_REG) { + assert (! mips_opts.mips16); /* If we are called with either $f0 or $f1, we must check $f0. This is not optimal, because it will introduce an unnecessary NOP between "lwc1 $f0" and "swc1 $f1". To fix this we would @@ -909,15 +1191,15 @@ because there is no instruction that sets both $f0 and $f1 and requires a delay. */ if ((ip->insn_mo->pinfo & INSN_READ_FPR_S) - && (((ip->insn_opcode >> OP_SH_FS) & OP_MASK_FS) + && ((((ip->insn_opcode >> OP_SH_FS) & OP_MASK_FS) &~(unsigned)1) == (reg &~ (unsigned) 1))) return 1; if ((ip->insn_mo->pinfo & INSN_READ_FPR_T) - && (((ip->insn_opcode >> OP_SH_FT) & OP_MASK_FT) + && ((((ip->insn_opcode >> OP_SH_FT) & OP_MASK_FT) &~(unsigned)1) == (reg &~ (unsigned) 1))) return 1; } - else + else if (! mips_opts.mips16) { if ((ip->insn_mo->pinfo & INSN_READ_GPR_S) && ((ip->insn_opcode >> OP_SH_RS) & OP_MASK_RS) == reg) @@ -926,6 +1208,34 @@ && ((ip->insn_opcode >> OP_SH_RT) & OP_MASK_RT) == reg) return 1; } + else + { + if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_X) + && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_RX) + & MIPS16OP_MASK_RX)] + == reg)) + return 1; + if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Y) + && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_RY) + & MIPS16OP_MASK_RY)] + == reg)) + return 1; + if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Z) + && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_MOVE32Z) + & MIPS16OP_MASK_MOVE32Z)] + == reg)) + return 1; + if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_T) && reg == TREG) + return 1; + if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_SP) && reg == SP) + return 1; + if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_31) && reg == RA) + return 1; + if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_GPR_X) + && ((ip->insn_opcode >> MIPS16OP_SH_REGR32) + & MIPS16OP_MASK_REGR32) == reg) + return 1; + } return 0; } @@ -940,16 +1250,17 @@ unsigned long prev_pinfo; prev_pinfo = prev_insn.insn_mo->pinfo; - if (! mips_noreorder - && mips_isa < 4 + if (! mips_opts.noreorder + && mips_opts.isa < 4 && ((prev_pinfo & INSN_LOAD_COPROC_DELAY) - || (mips_isa < 2 + || (mips_opts.isa < 2 && (prev_pinfo & INSN_LOAD_MEMORY_DELAY)))) { /* A load from a coprocessor or from memory. All load delays delay the use of general register rt for one instruction on the r3000. The r6000 and r4000 use interlocks. */ + /* Itbl support may require additional care here. */ know (prev_pinfo & INSN_WRITE_GPR_T); if (reg == ((prev_insn.insn_opcode >> OP_SH_RT) & OP_MASK_RT)) return 1; @@ -958,6 +1269,33 @@ return 0; } +/* Mark instruction labels in mips16 mode. This permits the linker to + handle them specially, such as generating jalx instructions when + needed. We also make them odd for the duration of the assembly, in + order to generate the right sort of code. We will make them even + in the adjust_symtab routine, while leaving them marked. This is + convenient for the debugger and the disassembler. The linker knows + to make them odd again. */ + +static void +mips16_mark_labels () +{ + if (mips_opts.mips16) + { + struct insn_label_list *l; + + for (l = insn_labels; l != NULL; l = l->next) + { +#ifdef OBJ_ELF + if (OUTPUT_FLAVOR == bfd_target_elf_flavour) + S_SET_OTHER (l->label, STO_MIPS16); +#endif + if ((l->label->sy_value.X_add_number & 1) == 0) + ++l->label->sy_value.X_add_number; + } + } +} + /* Output an instruction. PLACE is where to put the instruction; if it is NULL, this uses frag_more to get room. IP is the instruction information. ADDRESS_EXPR is an operand of the instruction to be @@ -976,11 +1314,17 @@ fixS *fixp; int nops = 0; + /* Mark instruction labels in mips16 mode. */ + if (mips_opts.mips16) + mips16_mark_labels (); + prev_pinfo = prev_insn.insn_mo->pinfo; pinfo = ip->insn_mo->pinfo; - if (place == NULL && ! mips_noreorder) + if (place == NULL && (! mips_opts.noreorder || prev_nop_frag != NULL)) { + int prev_prev_nop; + /* If the previous insn required any delay slots, see if we need to insert a NOP or two. There are eight kinds of possible hazards, of which an instruction can have at most one type. @@ -1002,32 +1346,38 @@ it. */ /* This is how a NOP is emitted. */ -#define emit_nop() md_number_to_chars (frag_more (4), 0, 4) +#define emit_nop() \ + (mips_opts.mips16 \ + ? md_number_to_chars (frag_more (2), 0x6500, 2) \ + : md_number_to_chars (frag_more (4), 0, 4)) /* The previous insn might require a delay slot, depending upon the contents of the current insn. */ - if (mips_isa < 4 + if (! mips_opts.mips16 + && mips_opts.isa < 4 && (((prev_pinfo & INSN_LOAD_COPROC_DELAY) && ! cop_interlocks) - || (mips_isa < 2 + || (mips_opts.isa < 2 && (prev_pinfo & INSN_LOAD_MEMORY_DELAY)))) { /* A load from a coprocessor or from memory. All load delays delay the use of general register rt for one instruction on the r3000. The r6000 and r4000 use interlocks. */ + /* Itbl support may require additional care here. */ know (prev_pinfo & INSN_WRITE_GPR_T); if (mips_optimize == 0 || insn_uses_reg (ip, ((prev_insn.insn_opcode >> OP_SH_RT) & OP_MASK_RT), - 0)) + MIPS_GR_REG)) ++nops; } - else if (mips_isa < 4 + else if (! mips_opts.mips16 + && mips_opts.isa < 4 && (((prev_pinfo & INSN_COPROC_MOVE_DELAY) && ! cop_interlocks) - || (mips_isa < 2 + || (mips_opts.isa < 2 && (prev_pinfo & INSN_COPROC_MEMORY_DELAY)))) { /* A generic coprocessor delay. The previous instruction @@ -1044,13 +1394,16 @@ knowledge of CP0 handling, and the coprocessors other than the floating point unit are not distinguished at all. */ + /* Itbl support may require additional care here. FIXME! + Need to modify this to include knowledge about + user specified delays! */ if (prev_pinfo & INSN_WRITE_FPR_T) { if (mips_optimize == 0 || insn_uses_reg (ip, ((prev_insn.insn_opcode >> OP_SH_FT) & OP_MASK_FT), - 1)) + MIPS_FP_REG)) ++nops; } else if (prev_pinfo & INSN_WRITE_FPR_S) @@ -1059,7 +1412,7 @@ || insn_uses_reg (ip, ((prev_insn.insn_opcode >> OP_SH_FS) & OP_MASK_FS), - 1)) + MIPS_FP_REG)) ++nops; } else @@ -1070,6 +1423,7 @@ instruction may set the condition codes, and the current instruction uses them, we must insert two NOPS. */ + /* Itbl support may require additional care here. */ if (mips_optimize == 0 || ((prev_pinfo & INSN_WRITE_COND_CODE) && (pinfo & INSN_READ_COND_CODE))) @@ -1078,7 +1432,8 @@ ++nops; } } - else if (mips_isa < 4 + else if (! mips_opts.mips16 + && mips_opts.isa < 4 && (prev_pinfo & INSN_WRITE_COND_CODE) && ! cop_interlocks) { @@ -1087,6 +1442,7 @@ (this means it is a floating point comparison instruction). If this instruction uses the condition codes, we need to insert a single NOP. */ + /* Itbl support may require additional care here. */ if (mips_optimize == 0 || (pinfo & INSN_READ_COND_CODE)) ++nops; @@ -1095,8 +1451,7 @@ { /* The previous instruction reads the LO register; if the current instruction writes to the LO register, we must - insert two NOPS. The R4650, VR4100 and VR4300 have - interlocks. */ + insert two NOPS. Some newer processors have interlocks. */ if (! interlocks && (mips_optimize == 0 || (pinfo & INSN_WRITE_LO))) @@ -1106,50 +1461,65 @@ { /* The previous instruction reads the HI register; if the current instruction writes to the HI register, we must - insert a NOP. The R4650, VR4100 and VR4300 have - interlocks. */ + insert a NOP. Some newer processors have interlocks. */ if (! interlocks && (mips_optimize == 0 || (pinfo & INSN_WRITE_HI))) nops += 2; } + /* If the previous instruction was in a noreorder section, then + we don't want to insert the nop after all. */ + /* Itbl support may require additional care here. */ + if (prev_insn_unreordered) + nops = 0; + /* There are two cases which require two intervening instructions: 1) setting the condition codes using a move to coprocessor instruction which requires a general coprocessor delay and then reading the condition codes 2) reading the HI - or LO register and then writing to it (except on the R4650, - VR4100, and VR4300 which have interlocks). If we are not - already emitting a NOP instruction, we must check for these - cases compared to the instruction previous to the previous - instruction. */ - if (nops == 0 - && ((mips_isa < 4 - && (prev_prev_insn.insn_mo->pinfo & INSN_COPROC_MOVE_DELAY) - && (prev_prev_insn.insn_mo->pinfo & INSN_WRITE_COND_CODE) - && (pinfo & INSN_READ_COND_CODE) - && ! cop_interlocks) - || ((prev_prev_insn.insn_mo->pinfo & INSN_READ_LO) - && (pinfo & INSN_WRITE_LO) - && ! interlocks) - || ((prev_prev_insn.insn_mo->pinfo & INSN_READ_HI) - && (pinfo & INSN_WRITE_HI) - && ! interlocks))) + or LO register and then writing to it (except on processors + which have interlocks). If we are not already emitting a NOP + instruction, we must check for these cases compared to the + instruction previous to the previous instruction. */ + if ((! mips_opts.mips16 + && mips_opts.isa < 4 + && (prev_prev_insn.insn_mo->pinfo & INSN_COPROC_MOVE_DELAY) + && (prev_prev_insn.insn_mo->pinfo & INSN_WRITE_COND_CODE) + && (pinfo & INSN_READ_COND_CODE) + && ! cop_interlocks) + || ((prev_prev_insn.insn_mo->pinfo & INSN_READ_LO) + && (pinfo & INSN_WRITE_LO) + && ! interlocks) + || ((prev_prev_insn.insn_mo->pinfo & INSN_READ_HI) + && (pinfo & INSN_WRITE_HI) + && ! interlocks)) + prev_prev_nop = 1; + else + prev_prev_nop = 0; + + if (prev_prev_insn_unreordered) + prev_prev_nop = 0; + + if (prev_prev_nop && nops == 0) ++nops; /* If we are being given a nop instruction, don't bother with one of the nops we would otherwise output. This will only happen when a nop instruction is used with mips_optimize set to 0. */ - if (nops > 0 && ip->insn_opcode == 0) + if (nops > 0 + && ! mips_opts.noreorder + && ip->insn_opcode == (mips_opts.mips16 ? 0x6500 : 0)) --nops; /* Now emit the right number of NOP instructions. */ - if (nops > 0) + if (nops > 0 && ! mips_opts.noreorder) { fragS *old_frag; unsigned long old_frag_offset; int i; + struct insn_label_list *l; old_frag = frag_now; old_frag_offset = frag_now_fix (); @@ -1171,11 +1541,14 @@ frag_grow (40); } - if (insn_label != NULL) + for (l = insn_labels; l != NULL; l = l->next) { - assert (S_GET_SEGMENT (insn_label) == now_seg); - insn_label->sy_frag = frag_now; - S_SET_VALUE (insn_label, (valueT) frag_now_fix ()); + assert (S_GET_SEGMENT (l->label) == now_seg); + l->label->sy_frag = frag_now; + S_SET_VALUE (l->label, (valueT) frag_now_fix ()); + /* mips16 text labels are stored as odd. */ + if (mips_opts.mips16) + ++l->label->sy_value.X_add_number; } #ifndef NO_ECOFF_DEBUGGING @@ -1183,14 +1556,82 @@ ecoff_fix_loc (old_frag, old_frag_offset); #endif } + else if (prev_nop_frag != NULL) + { + /* We have a frag holding nops we may be able to remove. If + we don't need any nops, we can decrease the size of + prev_nop_frag by the size of one instruction. If we do + need some nops, we count them in prev_nops_required. */ + if (prev_nop_frag_since == 0) + { + if (nops == 0) + { + prev_nop_frag->fr_fix -= mips_opts.mips16 ? 2 : 4; + --prev_nop_frag_holds; + } + else + prev_nop_frag_required += nops; + } + else + { + if (prev_prev_nop == 0) + { + prev_nop_frag->fr_fix -= mips_opts.mips16 ? 2 : 4; + --prev_nop_frag_holds; + } + else + ++prev_nop_frag_required; + } + + if (prev_nop_frag_holds <= prev_nop_frag_required) + prev_nop_frag = NULL; + + ++prev_nop_frag_since; + + /* Sanity check: by the time we reach the second instruction + after prev_nop_frag, we should have used up all the nops + one way or another. */ + assert (prev_nop_frag_since <= 1 || prev_nop_frag == NULL); + } } - - if (place == NULL) - f = frag_more (4); - else + + if (reloc_type > BFD_RELOC_UNUSED) + { + /* We need to set up a variant frag. */ + assert (mips_opts.mips16 && address_expr != NULL); + f = frag_var (rs_machine_dependent, 4, 0, + RELAX_MIPS16_ENCODE (reloc_type - BFD_RELOC_UNUSED, + mips16_small, mips16_ext, + (prev_pinfo + & INSN_UNCOND_BRANCH_DELAY), + (prev_insn_reloc_type + == BFD_RELOC_MIPS16_JMP)), + make_expr_symbol (address_expr), (offsetT) 0, + (char *) NULL); + } + else if (place != NULL) f = place; + else if (mips_opts.mips16 + && ! ip->use_extend + && reloc_type != BFD_RELOC_MIPS16_JMP) + { + /* Make sure there is enough room to swap this instruction with + a following jump instruction. */ + frag_grow (6); + f = frag_more (2); + } + else + { + if (mips_opts.mips16 + && mips_opts.noreorder + && (prev_pinfo & INSN_UNCOND_BRANCH_DELAY) != 0) + as_warn ("extended instruction in delay slot"); + + f = frag_more (4); + } + fixp = NULL; - if (address_expr != NULL) + if (address_expr != NULL && reloc_type < BFD_RELOC_UNUSED) { if (address_expr->X_op == O_constant) { @@ -1205,6 +1646,22 @@ break; case BFD_RELOC_MIPS_JMP: + if ((address_expr->X_add_number & 3) != 0) + as_bad ("jump to misaligned address (0x%lx)", + (unsigned long) address_expr->X_add_number); + ip->insn_opcode |= (address_expr->X_add_number >> 2) & 0x3ffffff; + break; + + case BFD_RELOC_MIPS16_JMP: + if ((address_expr->X_add_number & 3) != 0) + as_bad ("jump to misaligned address (0x%lx)", + (unsigned long) address_expr->X_add_number); + ip->insn_opcode |= + (((address_expr->X_add_number & 0x7c0000) << 3) + | ((address_expr->X_add_number & 0xf800000) >> 7) + | ((address_expr->X_add_number & 0x3fffc) >> 2)); + break; + case BFD_RELOC_16_PCREL_S2: goto need_reloc; @@ -1214,7 +1671,6 @@ } else { - assert (reloc_type != BFD_RELOC_UNUSED); need_reloc: /* Don't generate a reloc if we are writing into a variant frag. */ @@ -1240,33 +1696,80 @@ } } - md_number_to_chars (f, ip->insn_opcode, 4); + if (! mips_opts.mips16) + md_number_to_chars (f, ip->insn_opcode, 4); + else if (reloc_type == BFD_RELOC_MIPS16_JMP) + { + md_number_to_chars (f, ip->insn_opcode >> 16, 2); + md_number_to_chars (f + 2, ip->insn_opcode & 0xffff, 2); + } + else + { + if (ip->use_extend) + { + md_number_to_chars (f, 0xf000 | ip->extend, 2); + f += 2; + } + md_number_to_chars (f, ip->insn_opcode, 2); + } /* Update the register mask information. */ - if (pinfo & INSN_WRITE_GPR_D) - mips_gprmask |= 1 << ((ip->insn_opcode >> OP_SH_RD) & OP_MASK_RD); - if ((pinfo & (INSN_WRITE_GPR_T | INSN_READ_GPR_T)) != 0) - mips_gprmask |= 1 << ((ip->insn_opcode >> OP_SH_RT) & OP_MASK_RT); - if (pinfo & INSN_READ_GPR_S) - mips_gprmask |= 1 << ((ip->insn_opcode >> OP_SH_RS) & OP_MASK_RS); - if (pinfo & INSN_WRITE_GPR_31) - mips_gprmask |= 1 << 31; - if (pinfo & INSN_WRITE_FPR_D) - mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FD) & OP_MASK_FD); - if ((pinfo & (INSN_WRITE_FPR_S | INSN_READ_FPR_S)) != 0) - mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FS) & OP_MASK_FS); - if ((pinfo & (INSN_WRITE_FPR_T | INSN_READ_FPR_T)) != 0) - mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FT) & OP_MASK_FT); - if ((pinfo & INSN_READ_FPR_R) != 0) - mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FR) & OP_MASK_FR); - if (pinfo & INSN_COP) + if (! mips_opts.mips16) + { + if (pinfo & INSN_WRITE_GPR_D) + mips_gprmask |= 1 << ((ip->insn_opcode >> OP_SH_RD) & OP_MASK_RD); + if ((pinfo & (INSN_WRITE_GPR_T | INSN_READ_GPR_T)) != 0) + mips_gprmask |= 1 << ((ip->insn_opcode >> OP_SH_RT) & OP_MASK_RT); + if (pinfo & INSN_READ_GPR_S) + mips_gprmask |= 1 << ((ip->insn_opcode >> OP_SH_RS) & OP_MASK_RS); + if (pinfo & INSN_WRITE_GPR_31) + mips_gprmask |= 1 << 31; + if (pinfo & INSN_WRITE_FPR_D) + mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FD) & OP_MASK_FD); + if ((pinfo & (INSN_WRITE_FPR_S | INSN_READ_FPR_S)) != 0) + mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FS) & OP_MASK_FS); + if ((pinfo & (INSN_WRITE_FPR_T | INSN_READ_FPR_T)) != 0) + mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FT) & OP_MASK_FT); + if ((pinfo & INSN_READ_FPR_R) != 0) + mips_cprmask[1] |= 1 << ((ip->insn_opcode >> OP_SH_FR) & OP_MASK_FR); + if (pinfo & INSN_COP) + { + /* We don't keep enough information to sort these cases out. + The itbl support does keep this information however, although + we currently don't support itbl fprmats as part of the cop + instruction. May want to add this support in the future. */ + } + /* Never set the bit for $0, which is always zero. */ + mips_gprmask &=~ 1 << 0; + } + else { - /* We don't keep enough information to sort these cases out. */ + if (pinfo & (MIPS16_INSN_WRITE_X | MIPS16_INSN_READ_X)) + mips_gprmask |= 1 << ((ip->insn_opcode >> MIPS16OP_SH_RX) + & MIPS16OP_MASK_RX); + if (pinfo & (MIPS16_INSN_WRITE_Y | MIPS16_INSN_READ_Y)) + mips_gprmask |= 1 << ((ip->insn_opcode >> MIPS16OP_SH_RY) + & MIPS16OP_MASK_RY); + if (pinfo & MIPS16_INSN_WRITE_Z) + mips_gprmask |= 1 << ((ip->insn_opcode >> MIPS16OP_SH_RZ) + & MIPS16OP_MASK_RZ); + if (pinfo & (MIPS16_INSN_WRITE_T | MIPS16_INSN_READ_T)) + mips_gprmask |= 1 << TREG; + if (pinfo & (MIPS16_INSN_WRITE_SP | MIPS16_INSN_READ_SP)) + mips_gprmask |= 1 << SP; + if (pinfo & (MIPS16_INSN_WRITE_31 | MIPS16_INSN_READ_31)) + mips_gprmask |= 1 << RA; + if (pinfo & MIPS16_INSN_WRITE_GPR_Y) + mips_gprmask |= 1 << MIPS16OP_EXTRACT_REG32R (ip->insn_opcode); + if (pinfo & MIPS16_INSN_READ_Z) + mips_gprmask |= 1 << ((ip->insn_opcode >> MIPS16OP_SH_MOVE32Z) + & MIPS16OP_MASK_MOVE32Z); + if (pinfo & MIPS16_INSN_READ_GPR_X) + mips_gprmask |= 1 << ((ip->insn_opcode >> MIPS16OP_SH_REGR32) + & MIPS16OP_MASK_REGR32); } - /* Never set the bit for $0, which is always zero. */ - mips_gprmask &=~ 1 << 0; - if (place == NULL && ! mips_noreorder) + if (place == NULL && ! mips_opts.noreorder) { /* Filling the branch delay slot is more complex. We try to switch the branch with the previous instruction, which we can @@ -1279,7 +1782,7 @@ if (mips_optimize < 2 /* If we have seen .set volatile or .set nomove, don't optimize. */ - || mips_nomove != 0 + || mips_opts.nomove != 0 /* If we had to emit any NOP instructions, then we already know we can not swap. */ || nops != 0 @@ -1311,10 +1814,13 @@ whether there is a label on this instruction. If there are any branches to anything other than a label, users must use .set noreorder. */ - || insn_label != NULL + || insn_labels != NULL /* If the previous instruction is in a variant frag, we - can not do the swap. */ - || prev_insn_frag->fr_type == rs_machine_dependent + can not do the swap. This does not apply to the + mips16, which uses variant frags for different + purposes. */ + || (! mips_opts.mips16 + && prev_insn_frag->fr_type == rs_machine_dependent) /* If the branch reads the condition codes, we don't even try to swap, because in the sequence ctc1 $X,$31 @@ -1323,13 +1829,16 @@ bc1t LABEL we can not swap, and I don't feel like handling that case. */ - || (mips_isa < 4 + || (! mips_opts.mips16 + && mips_opts.isa < 4 && (pinfo & INSN_READ_COND_CODE)) /* We can not swap with an instruction that requires a delay slot, becase the target of the branch might interfere with that instruction. */ - || (mips_isa < 4 + || (! mips_opts.mips16 + && mips_opts.isa < 4 && (prev_pinfo + /* Itbl support may require additional care here. */ & (INSN_LOAD_COPROC_DELAY | INSN_COPROC_MOVE_DELAY | INSN_WRITE_COND_CODE))) @@ -1337,9 +1846,11 @@ && (prev_pinfo & (INSN_READ_LO | INSN_READ_HI))) - || (mips_isa < 2 + || (! mips_opts.mips16 + && mips_opts.isa < 2 && (prev_pinfo & (INSN_LOAD_MEMORY_DELAY + /* Itbl support may require additional care here. */ | INSN_COPROC_MEMORY_DELAY))) /* We can not swap with a branch instruction. */ || (prev_pinfo @@ -1352,20 +1863,51 @@ || (prev_pinfo & INSN_TRAP) /* If the branch reads a register that the previous instruction sets, we can not swap. */ - || ((prev_pinfo & INSN_WRITE_GPR_T) + || (! mips_opts.mips16 + && (prev_pinfo & INSN_WRITE_GPR_T) && insn_uses_reg (ip, ((prev_insn.insn_opcode >> OP_SH_RT) & OP_MASK_RT), - 0)) - || ((prev_pinfo & INSN_WRITE_GPR_D) + MIPS_GR_REG)) + || (! mips_opts.mips16 + && (prev_pinfo & INSN_WRITE_GPR_D) && insn_uses_reg (ip, ((prev_insn.insn_opcode >> OP_SH_RD) & OP_MASK_RD), - 0)) + MIPS_GR_REG)) + || (mips_opts.mips16 + && (((prev_pinfo & MIPS16_INSN_WRITE_X) + && insn_uses_reg (ip, + ((prev_insn.insn_opcode + >> MIPS16OP_SH_RX) + & MIPS16OP_MASK_RX), + MIPS16_REG)) + || ((prev_pinfo & MIPS16_INSN_WRITE_Y) + && insn_uses_reg (ip, + ((prev_insn.insn_opcode + >> MIPS16OP_SH_RY) + & MIPS16OP_MASK_RY), + MIPS16_REG)) + || ((prev_pinfo & MIPS16_INSN_WRITE_Z) + && insn_uses_reg (ip, + ((prev_insn.insn_opcode + >> MIPS16OP_SH_RZ) + & MIPS16OP_MASK_RZ), + MIPS16_REG)) + || ((prev_pinfo & MIPS16_INSN_WRITE_T) + && insn_uses_reg (ip, TREG, MIPS_GR_REG)) + || ((prev_pinfo & MIPS16_INSN_WRITE_31) + && insn_uses_reg (ip, RA, MIPS_GR_REG)) + || ((prev_pinfo & MIPS16_INSN_WRITE_GPR_Y) + && insn_uses_reg (ip, + MIPS16OP_EXTRACT_REG32R (prev_insn. + insn_opcode), + MIPS_GR_REG)))) /* If the branch writes a register that the previous instruction sets, we can not swap (we know that branches write only to RD or to $31). */ - || ((prev_pinfo & INSN_WRITE_GPR_T) + || (! mips_opts.mips16 + && (prev_pinfo & INSN_WRITE_GPR_T) && (((pinfo & INSN_WRITE_GPR_D) && (((prev_insn.insn_opcode >> OP_SH_RT) & OP_MASK_RT) == ((ip->insn_opcode >> OP_SH_RD) & OP_MASK_RD))) @@ -1373,7 +1915,8 @@ && (((prev_insn.insn_opcode >> OP_SH_RT) & OP_MASK_RT) == 31)))) - || ((prev_pinfo & INSN_WRITE_GPR_D) + || (! mips_opts.mips16 + && (prev_pinfo & INSN_WRITE_GPR_D) && (((pinfo & INSN_WRITE_GPR_D) && (((prev_insn.insn_opcode >> OP_SH_RD) & OP_MASK_RD) == ((ip->insn_opcode >> OP_SH_RD) & OP_MASK_RD))) @@ -1381,33 +1924,63 @@ && (((prev_insn.insn_opcode >> OP_SH_RD) & OP_MASK_RD) == 31)))) + || (mips_opts.mips16 + && (pinfo & MIPS16_INSN_WRITE_31) + && ((prev_pinfo & MIPS16_INSN_WRITE_31) + || ((prev_pinfo & MIPS16_INSN_WRITE_GPR_Y) + && (MIPS16OP_EXTRACT_REG32R (prev_insn.insn_opcode) + == RA)))) /* If the branch writes a register that the previous instruction reads, we can not swap (we know that branches only write to RD or to $31). */ - || ((pinfo & INSN_WRITE_GPR_D) + || (! mips_opts.mips16 + && (pinfo & INSN_WRITE_GPR_D) && insn_uses_reg (&prev_insn, ((ip->insn_opcode >> OP_SH_RD) & OP_MASK_RD), - 0)) - || ((pinfo & INSN_WRITE_GPR_31) - && insn_uses_reg (&prev_insn, 31, 0)) + MIPS_GR_REG)) + || (! mips_opts.mips16 + && (pinfo & INSN_WRITE_GPR_31) + && insn_uses_reg (&prev_insn, 31, MIPS_GR_REG)) + || (mips_opts.mips16 + && (pinfo & MIPS16_INSN_WRITE_31) + && insn_uses_reg (&prev_insn, RA, MIPS_GR_REG)) /* If we are generating embedded PIC code, the branch might be expanded into a sequence which uses $at, so we can't swap with an instruction which reads it. */ || (mips_pic == EMBEDDED_PIC - && insn_uses_reg (&prev_insn, AT, 0)) + && insn_uses_reg (&prev_insn, AT, MIPS_GR_REG)) /* If the previous previous instruction has a load delay, and sets a register that the branch reads, we can not swap. */ - || (mips_isa < 4 + || (! mips_opts.mips16 + && mips_opts.isa < 4 + /* Itbl support may require additional care here. */ && ((prev_prev_insn.insn_mo->pinfo & INSN_LOAD_COPROC_DELAY) - || (mips_isa < 2 + || (mips_opts.isa < 2 && (prev_prev_insn.insn_mo->pinfo & INSN_LOAD_MEMORY_DELAY))) && insn_uses_reg (ip, ((prev_prev_insn.insn_opcode >> OP_SH_RT) & OP_MASK_RT), - 0))) + MIPS_GR_REG)) + /* If one instruction sets a condition code and the + other one uses a condition code, we can not swap. */ + || ((pinfo & INSN_READ_COND_CODE) + && (prev_pinfo & INSN_WRITE_COND_CODE)) + || ((pinfo & INSN_WRITE_COND_CODE) + && (prev_pinfo & INSN_READ_COND_CODE)) + /* If the previous instruction uses the PC, we can not + swap. */ + || (mips_opts.mips16 + && (prev_pinfo & MIPS16_INSN_READ_PC)) + /* If the previous instruction was extended, we can not + swap. */ + || (mips_opts.mips16 && prev_insn_extended) + /* If the previous instruction had a fixup in mips16 + mode, we can not swap. This normally means that the + previous instruction was a 4 byte branch anyhow. */ + || (mips_opts.mips16 && prev_insn_fixp)) { /* We could do even better for unconditional branches to portions of this object file; we could pick up the @@ -1420,24 +1993,53 @@ } else { - char *prev_f; - char temp[4]; - /* It looks like we can actually do the swap. */ - prev_f = prev_insn_frag->fr_literal + prev_insn_where; - memcpy (temp, prev_f, 4); - memcpy (prev_f, f, 4); - memcpy (f, temp, 4); - if (prev_insn_fixp) + if (! mips_opts.mips16) { - prev_insn_fixp->fx_frag = frag_now; - prev_insn_fixp->fx_where = f - frag_now->fr_literal; + char *prev_f; + char temp[4]; + + prev_f = prev_insn_frag->fr_literal + prev_insn_where; + memcpy (temp, prev_f, 4); + memcpy (prev_f, f, 4); + memcpy (f, temp, 4); + if (prev_insn_fixp) + { + prev_insn_fixp->fx_frag = frag_now; + prev_insn_fixp->fx_where = f - frag_now->fr_literal; + } + if (fixp) + { + fixp->fx_frag = prev_insn_frag; + fixp->fx_where = prev_insn_where; + } } - if (fixp) + else { - fixp->fx_frag = prev_insn_frag; - fixp->fx_where = prev_insn_where; + char *prev_f; + char temp[2]; + + assert (prev_insn_fixp == NULL); + prev_f = prev_insn_frag->fr_literal + prev_insn_where; + memcpy (temp, prev_f, 2); + memcpy (prev_f, f, 2); + if (reloc_type != BFD_RELOC_MIPS16_JMP) + { + assert (reloc_type == BFD_RELOC_UNUSED); + memcpy (f, temp, 2); + } + else + { + memcpy (f, f + 2, 2); + memcpy (f + 2, temp, 2); + } + if (fixp) + { + fixp->fx_frag = prev_insn_frag; + fixp->fx_where = prev_insn_where; + } } + /* Update the previous insn information; leave prev_insn unchanged. */ prev_prev_insn = *ip; @@ -1451,6 +2053,10 @@ prev_prev_insn.insn_mo = &dummy_opcode; prev_insn.insn_mo = &dummy_opcode; } + + prev_insn_fixp = NULL; + prev_insn_reloc_type = BFD_RELOC_UNUSED; + prev_insn_extended = 0; } else if (pinfo & INSN_COND_BRANCH_LIKELY) { @@ -1462,6 +2068,9 @@ /* Update the previous insn information. */ prev_prev_insn = *ip; prev_insn.insn_mo = &dummy_opcode; + prev_insn_fixp = NULL; + prev_insn_reloc_type = BFD_RELOC_UNUSED; + prev_insn_extended = 0; } else { @@ -1476,49 +2085,79 @@ immediately; since this insn is not a branch, we know it is not in a delay slot. */ prev_insn_is_delay_slot = 0; + + prev_insn_fixp = fixp; + prev_insn_reloc_type = reloc_type; + if (mips_opts.mips16) + prev_insn_extended = (ip->use_extend + || reloc_type > BFD_RELOC_UNUSED); } prev_prev_insn_unreordered = prev_insn_unreordered; prev_insn_unreordered = 0; prev_insn_frag = frag_now; prev_insn_where = f - frag_now->fr_literal; - prev_insn_fixp = fixp; prev_insn_valid = 1; } + else if (place == NULL) + { + /* We need to record a bit of information even when we are not + reordering, in order to determine the base address for mips16 + PC relative relocs. */ + prev_prev_insn = prev_insn; + prev_insn = *ip; + prev_insn_reloc_type = reloc_type; + prev_prev_insn_unreordered = prev_insn_unreordered; + prev_insn_unreordered = 1; + } /* We just output an insn, so the next one doesn't have a label. */ - insn_label = NULL; + mips_clear_insn_labels (); } /* This function forgets that there was any previous instruction or - label. */ + label. If PRESERVE is non-zero, it remembers enough information to + know whether nops are needed before a noreorder section. */ static void -mips_no_prev_insn () +mips_no_prev_insn (preserve) + int preserve; { - prev_insn.insn_mo = &dummy_opcode; - prev_prev_insn.insn_mo = &dummy_opcode; + if (! preserve) + { + prev_insn.insn_mo = &dummy_opcode; + prev_prev_insn.insn_mo = &dummy_opcode; + prev_nop_frag = NULL; + prev_nop_frag_holds = 0; + prev_nop_frag_required = 0; + prev_nop_frag_since = 0; + } prev_insn_valid = 0; prev_insn_is_delay_slot = 0; prev_insn_unreordered = 0; + prev_insn_extended = 0; + prev_insn_reloc_type = BFD_RELOC_UNUSED; prev_prev_insn_unreordered = 0; - insn_label = NULL; + mips_clear_insn_labels (); } /* This function must be called whenever we turn on noreorder or emit something other than instructions. It inserts any NOPS which might be needed by the previous instruction, and clears the information - kept for the previous instructions. */ + kept for the previous instructions. The INSNS parameter is true if + instructions are to follow. */ static void -mips_emit_delays () +mips_emit_delays (insns) + boolean insns; { - if (! mips_noreorder) + if (! mips_opts.noreorder) { - int nop; + int nops; - nop = 0; - if ((mips_isa < 4 + nops = 0; + if ((! mips_opts.mips16 + && mips_opts.isa < 4 && (! cop_interlocks && (prev_insn.insn_mo->pinfo & (INSN_LOAD_COPROC_DELAY @@ -1528,40 +2167,82 @@ && (prev_insn.insn_mo->pinfo & (INSN_READ_LO | INSN_READ_HI))) - || (mips_isa < 2 + || (! mips_opts.mips16 + && mips_opts.isa < 2 && (prev_insn.insn_mo->pinfo & (INSN_LOAD_MEMORY_DELAY | INSN_COPROC_MEMORY_DELAY)))) { - nop = 1; - if ((mips_isa < 4 + /* Itbl support may require additional care here. */ + ++nops; + if ((! mips_opts.mips16 + && mips_opts.isa < 4 && (! cop_interlocks && prev_insn.insn_mo->pinfo & INSN_WRITE_COND_CODE)) || (! interlocks && ((prev_insn.insn_mo->pinfo & INSN_READ_HI) || (prev_insn.insn_mo->pinfo & INSN_READ_LO)))) - emit_nop (); + ++nops; + + if (prev_insn_unreordered) + nops = 0; } - else if ((mips_isa < 4 + else if ((! mips_opts.mips16 + && mips_opts.isa < 4 && (! cop_interlocks && prev_prev_insn.insn_mo->pinfo & INSN_WRITE_COND_CODE)) || (! interlocks && ((prev_prev_insn.insn_mo->pinfo & INSN_READ_HI) || (prev_prev_insn.insn_mo->pinfo & INSN_READ_LO)))) - nop = 1; - if (nop) { - emit_nop (); - if (insn_label != NULL) + /* Itbl support may require additional care here. */ + if (! prev_prev_insn_unreordered) + ++nops; + } + + if (nops > 0) + { + struct insn_label_list *l; + + if (insns) + { + /* Record the frag which holds the nop instructions, so + that we can remove them if we don't need them. */ + frag_grow (mips_opts.mips16 ? nops * 2 : nops * 4); + prev_nop_frag = frag_now; + prev_nop_frag_holds = nops; + prev_nop_frag_required = 0; + prev_nop_frag_since = 0; + } + + for (; nops > 0; --nops) + emit_nop (); + + if (insns) + { + /* Move on to a new frag, so that it is safe to simply + decrease the size of prev_nop_frag. */ + frag_wane (frag_now); + frag_new (0); + } + + for (l = insn_labels; l != NULL; l = l->next) { - assert (S_GET_SEGMENT (insn_label) == now_seg); - insn_label->sy_frag = frag_now; - S_SET_VALUE (insn_label, (valueT) frag_now_fix ()); + assert (S_GET_SEGMENT (l->label) == now_seg); + l->label->sy_frag = frag_now; + S_SET_VALUE (l->label, (valueT) frag_now_fix ()); + /* mips16 text labels are stored as odd. */ + if (mips_opts.mips16) + ++l->label->sy_value.X_add_number; } } } - mips_no_prev_insn (); + /* Mark instruction labels in mips16 mode. */ + if (mips_opts.mips16 && insns) + mips16_mark_labels (); + + mips_no_prev_insn (insns); } /* Build an instruction created by a macro expansion. This is passed @@ -1603,12 +2284,19 @@ * print a warning if needed. We need to pass ip as a parameter * to generate a better warning message here... */ - if (mips_warn_about_macros && place == NULL && *counter == 1) + if (mips_opts.warn_about_macros && place == NULL && *counter == 1) as_warn ("Macro instruction expanded into multiple instructions"); if (place == NULL) *counter += 1; /* bump instruction counter */ + if (mips_opts.mips16) + { + mips16_macro_build (place, counter, ep, name, fmt, args); + va_end (args); + return; + } + r = BFD_RELOC_UNUSED; insn.insn_mo = (struct mips_opcode *) hash_find (op_hash, name); assert (insn.insn_mo); @@ -1617,17 +2305,18 @@ while (strcmp (fmt, insn.insn_mo->args) != 0 || insn.insn_mo->pinfo == INSN_MACRO || ((insn.insn_mo->pinfo & INSN_ISA) == INSN_ISA2 - && mips_isa < 2) + && mips_opts.isa < 2) || ((insn.insn_mo->pinfo & INSN_ISA) == INSN_ISA3 - && mips_isa < 3) + && mips_opts.isa < 3) || ((insn.insn_mo->pinfo & INSN_ISA) == INSN_ISA4 - && mips_isa < 4) + && mips_opts.isa < 4) || ((insn.insn_mo->pinfo & INSN_ISA) == INSN_4650 && ! mips_4650) || ((insn.insn_mo->pinfo & INSN_ISA) == INSN_4010 && ! mips_4010) || ((insn.insn_mo->pinfo & INSN_ISA) == INSN_4100 - && ! mips_4100)) + && ! mips_4100) + ) { ++insn.insn_mo; assert (insn.insn_mo->name); @@ -1760,58 +2449,186 @@ append_insn (place, &insn, ep, r, false); } -/* - * Generate a "lui" instruction. - */ static void -macro_build_lui (place, counter, ep, regnum) +mips16_macro_build (place, counter, ep, name, fmt, args) char *place; int *counter; expressionS *ep; - int regnum; + const char *name; + const char *fmt; + va_list args; { - expressionS high_expr; struct mips_cl_insn insn; bfd_reloc_code_real_type r; - CONST char *name = "lui"; - CONST char *fmt = "t,u"; - if (place == NULL) - high_expr = *ep; - else - { - high_expr.X_op = O_constant; - high_expr.X_add_number = ep->X_add_number; - } + r = BFD_RELOC_UNUSED; + insn.insn_mo = (struct mips_opcode *) hash_find (mips16_op_hash, name); + assert (insn.insn_mo); + assert (strcmp (name, insn.insn_mo->name) == 0); - if (high_expr.X_op == O_constant) - { - /* we can compute the instruction now without a relocation entry */ - if (high_expr.X_add_number & 0x8000) - high_expr.X_add_number += 0x10000; - high_expr.X_add_number = - ((unsigned long) high_expr.X_add_number >> 16) & 0xffff; - r = BFD_RELOC_UNUSED; - } - else + while (strcmp (fmt, insn.insn_mo->args) != 0 + || insn.insn_mo->pinfo == INSN_MACRO) { - assert (ep->X_op == O_symbol); - /* _gp_disp is a special case, used from s_cpload. */ - assert (mips_pic == NO_PIC - || strcmp (S_GET_NAME (ep->X_add_symbol), "_gp_disp") == 0); - r = BFD_RELOC_HI16_S; + ++insn.insn_mo; + assert (insn.insn_mo->name); + assert (strcmp (name, insn.insn_mo->name) == 0); } - /* - * If the macro is about to expand into a second instruction, - * print a warning if needed. We need to pass ip as a parameter - * to generate a better warning message here... - */ - if (mips_warn_about_macros && place == NULL && *counter == 1) - as_warn ("Macro instruction expanded into multiple instructions"); + insn.insn_opcode = insn.insn_mo->match; + insn.use_extend = false; - if (place == NULL) - *counter += 1; /* bump instruction counter */ + for (;;) + { + int c; + + c = *fmt++; + switch (c) + { + case '\0': + break; + + case ',': + case '(': + case ')': + continue; + + case 'y': + case 'w': + insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_RY; + continue; + + case 'x': + case 'v': + insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_RX; + continue; + + case 'z': + insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_RZ; + continue; + + case 'Z': + insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_MOVE32Z; + continue; + + case '0': + case 'S': + case 'P': + case 'R': + continue; + + case 'X': + insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_REGR32; + continue; + + case 'Y': + { + int regno; + + regno = va_arg (args, int); + regno = ((regno & 7) << 2) | ((regno & 0x18) >> 3); + insn.insn_opcode |= regno << MIPS16OP_SH_REG32R; + } + continue; + + case '<': + case '>': + case '4': + case '5': + case 'H': + case 'W': + case 'D': + case 'j': + case '8': + case 'V': + case 'C': + case 'U': + case 'k': + case 'K': + case 'p': + case 'q': + { + assert (ep != NULL); + + if (ep->X_op != O_constant) + r = BFD_RELOC_UNUSED + c; + else + { + mips16_immed ((char *) NULL, 0, c, ep->X_add_number, false, + false, false, &insn.insn_opcode, + &insn.use_extend, &insn.extend); + ep = NULL; + r = BFD_RELOC_UNUSED; + } + } + continue; + + case '6': + insn.insn_opcode |= va_arg (args, int) << MIPS16OP_SH_IMM6; + continue; + } + + break; + } + + assert (r == BFD_RELOC_UNUSED ? ep == NULL : ep != NULL); + + append_insn (place, &insn, ep, r, false); +} + +/* + * Generate a "lui" instruction. + */ +static void +macro_build_lui (place, counter, ep, regnum) + char *place; + int *counter; + expressionS *ep; + int regnum; +{ + expressionS high_expr; + struct mips_cl_insn insn; + bfd_reloc_code_real_type r; + CONST char *name = "lui"; + CONST char *fmt = "t,u"; + + assert (! mips_opts.mips16); + + if (place == NULL) + high_expr = *ep; + else + { + high_expr.X_op = O_constant; + high_expr.X_add_number = ep->X_add_number; + } + + if (high_expr.X_op == O_constant) + { + /* we can compute the instruction now without a relocation entry */ + if (high_expr.X_add_number & 0x8000) + high_expr.X_add_number += 0x10000; + high_expr.X_add_number = + ((unsigned long) high_expr.X_add_number >> 16) & 0xffff; + r = BFD_RELOC_UNUSED; + } + else + { + assert (ep->X_op == O_symbol); + /* _gp_disp is a special case, used from s_cpload. */ + assert (mips_pic == NO_PIC + || strcmp (S_GET_NAME (ep->X_add_symbol), "_gp_disp") == 0); + r = BFD_RELOC_HI16_S; + } + + /* + * If the macro is about to expand into a second instruction, + * print a warning if needed. We need to pass ip as a parameter + * to generate a better warning message here... + */ + if (mips_opts.warn_about_macros && place == NULL && *counter == 1) + as_warn ("Macro instruction expanded into multiple instructions"); + + if (place == NULL) + *counter += 1; /* bump instruction counter */ insn.insn_mo = (struct mips_opcode *) hash_find (op_hash, name); assert (insn.insn_mo); @@ -1862,6 +2679,82 @@ as_warn ("Instruction %s requires absolute expression", ip->insn_mo->name); } +/* Count the leading zeroes by performing a binary chop. This is a + bulky bit of source, but performance is a LOT better for the + majority of values than a simple loop to count the bits: + for (lcnt = 0; (lcnt < 32); lcnt++) + if ((v) & (1 << (31 - lcnt))) + break; + However it is not code size friendly, and the gain will drop a bit + on certain cached systems. +*/ +#define COUNT_TOP_ZEROES(v) \ + (((v) & ~0xffff) == 0 \ + ? ((v) & ~0xff) == 0 \ + ? ((v) & ~0xf) == 0 \ + ? ((v) & ~0x3) == 0 \ + ? ((v) & ~0x1) == 0 \ + ? !(v) \ + ? 32 \ + : 31 \ + : 30 \ + : ((v) & ~0x7) == 0 \ + ? 29 \ + : 28 \ + : ((v) & ~0x3f) == 0 \ + ? ((v) & ~0x1f) == 0 \ + ? 27 \ + : 26 \ + : ((v) & ~0x7f) == 0 \ + ? 25 \ + : 24 \ + : ((v) & ~0xfff) == 0 \ + ? ((v) & ~0x3ff) == 0 \ + ? ((v) & ~0x1ff) == 0 \ + ? 23 \ + : 22 \ + : ((v) & ~0x7ff) == 0 \ + ? 21 \ + : 20 \ + : ((v) & ~0x3fff) == 0 \ + ? ((v) & ~0x1fff) == 0 \ + ? 19 \ + : 18 \ + : ((v) & ~0x7fff) == 0 \ + ? 17 \ + : 16 \ + : ((v) & ~0xffffff) == 0 \ + ? ((v) & ~0xfffff) == 0 \ + ? ((v) & ~0x3ffff) == 0 \ + ? ((v) & ~0x1ffff) == 0 \ + ? 15 \ + : 14 \ + : ((v) & ~0x7ffff) == 0 \ + ? 13 \ + : 12 \ + : ((v) & ~0x3fffff) == 0 \ + ? ((v) & ~0x1fffff) == 0 \ + ? 11 \ + : 10 \ + : ((v) & ~0x7fffff) == 0 \ + ? 9 \ + : 8 \ + : ((v) & ~0xfffffff) == 0 \ + ? ((v) & ~0x3ffffff) == 0 \ + ? ((v) & ~0x1ffffff) == 0 \ + ? 7 \ + : 6 \ + : ((v) & ~0x7ffffff) == 0 \ + ? 5 \ + : 4 \ + : ((v) & ~0x3fffffff) == 0 \ + ? ((v) & ~0x1fffffff) == 0 \ + ? 3 \ + : 2 \ + : ((v) & ~0x7fffffff) == 0 \ + ? 1 \ + : 0) + /* load_register() * This routine generates the least number of instructions neccessary to load * an absolute expression value into a register. @@ -1873,8 +2766,8 @@ expressionS *ep; int dbl; { - int shift, freg; - expressionS hi32, lo32, tmp; + int freg; + expressionS hi32, lo32; if (ep->X_op != O_big) { @@ -1908,8 +2801,12 @@ || ! ep->X_unsigned || sizeof (ep->X_add_number) > 4 || (ep->X_add_number & 0x80000000) == 0)) - || (mips_isa < 3 - && (ep->X_add_number &~ 0xffffffff) == 0)) + || ((mips_opts.isa < 3 || ! dbl) + && (ep->X_add_number &~ (offsetT) 0xffffffff) == 0) + || (mips_opts.isa < 3 + && ! dbl + && ((ep->X_add_number &~ (offsetT) 0xffffffff) + == ~ (offsetT) 0xffffffff))) { /* 32 bit values require an lui. */ macro_build ((char *) NULL, counter, ep, "lui", "t,u", reg, @@ -1919,24 +2816,11 @@ (int) BFD_RELOC_LO16); return; } - else - { - /* 32 bit value with high bit set being loaded into a 64 bit - register. We can't use lui, because that would - incorrectly set the 32 high bits. */ - generic_bignum[3] = 0; - generic_bignum[2] = 0; - generic_bignum[1] = (ep->X_add_number >> 16) & 0xffff; - generic_bignum[0] = ep->X_add_number & 0xffff; - tmp.X_op = O_big; - tmp.X_add_number = 4; - ep = &tmp; - } } /* The value is larger than 32 bits. */ - if (mips_isa < 3) + if (mips_opts.isa < 3) { as_bad ("Number larger than 32 bits"); macro_build ((char *) NULL, counter, ep, "addiu", "t,r,j", reg, 0, @@ -1947,11 +2831,9 @@ if (ep->X_op != O_big) { hi32 = *ep; - shift = 32; - hi32.X_add_number >>= shift; + hi32.X_add_number = (valueT) hi32.X_add_number >> 16; + hi32.X_add_number = (valueT) hi32.X_add_number >> 16; hi32.X_add_number &= 0xffffffff; - if ((hi32.X_add_number & 0x80000000) != 0) - hi32.X_add_number |= ~ (offsetT) 0xffffffff; lo32 = *ep; lo32.X_add_number &= 0xffffffff; } @@ -1972,23 +2854,130 @@ freg = 0; else { + int shift, bit; + unsigned long hi, lo; + if (hi32.X_add_number == 0xffffffff) { if ((lo32.X_add_number & 0xffff8000) == 0xffff8000) { - macro_build ((char *) NULL, counter, &lo32, "addiu", "t,r,j", reg, 0, - (int) BFD_RELOC_LO16); + macro_build ((char *) NULL, counter, &lo32, "addiu", "t,r,j", + reg, 0, (int) BFD_RELOC_LO16); return; } if (lo32.X_add_number & 0x80000000) { macro_build ((char *) NULL, counter, &lo32, "lui", "t,u", reg, (int) BFD_RELOC_HI16); - macro_build ((char *) NULL, counter, &lo32, "ori", "t,r,i", reg, reg, - (int) BFD_RELOC_LO16); + if (lo32.X_add_number & 0xffff) + macro_build ((char *) NULL, counter, &lo32, "ori", "t,r,i", + reg, reg, (int) BFD_RELOC_LO16); + return; + } + } + + /* Check for 16bit shifted constant. We know that hi32 is + non-zero, so start the mask on the first bit of the hi32 + value. */ + shift = 17; + do + { + unsigned long himask, lomask; + + if (shift < 32) + { + himask = 0xffff >> (32 - shift); + lomask = (0xffff << shift) & 0xffffffff; + } + else + { + himask = 0xffff << (shift - 32); + lomask = 0; + } + if ((hi32.X_add_number & ~ (offsetT) himask) == 0 + && (lo32.X_add_number & ~ (offsetT) lomask) == 0) + { + expressionS tmp; + + tmp.X_op = O_constant; + if (shift < 32) + tmp.X_add_number = ((hi32.X_add_number << (32 - shift)) + | (lo32.X_add_number >> shift)); + else + tmp.X_add_number = hi32.X_add_number >> (shift - 32); + macro_build ((char *) NULL, counter, &tmp, "ori", "t,r,i", reg, 0, + (int) BFD_RELOC_LO16); + macro_build ((char *) NULL, counter, NULL, + (shift >= 32) ? "dsll32" : "dsll", + "d,w,<", reg, reg, + (shift >= 32) ? shift - 32 : shift); + return; + } + shift++; + } while (shift <= (64 - 16)); + + /* Find the bit number of the lowest one bit, and store the + shifted value in hi/lo. */ + hi = (unsigned long) (hi32.X_add_number & 0xffffffff); + lo = (unsigned long) (lo32.X_add_number & 0xffffffff); + if (lo != 0) + { + bit = 0; + while ((lo & 1) == 0) + { + lo >>= 1; + ++bit; + } + lo |= (hi & (((unsigned long) 1 << bit) - 1)) << (32 - bit); + hi >>= bit; + } + else + { + bit = 32; + while ((hi & 1) == 0) + { + hi >>= 1; + ++bit; + } + lo = hi; + hi = 0; + } + + /* Optimize if the shifted value is a (power of 2) - 1. */ + if ((hi == 0 && ((lo + 1) & lo) == 0) + || (lo == 0xffffffff && ((hi + 1) & hi) == 0)) + { + shift = COUNT_TOP_ZEROES ((unsigned int) hi32.X_add_number); + if (shift != 0) + { + expressionS tmp; + + /* This instruction will set the register to be all + ones. */ + tmp.X_op = O_constant; + tmp.X_add_number = (offsetT) -1; + macro_build ((char *) NULL, counter, &tmp, "addiu", "t,r,j", + reg, 0, (int) BFD_RELOC_LO16); + if (bit != 0) + { + bit += shift; + macro_build ((char *) NULL, counter, NULL, + (bit >= 32) ? "dsll32" : "dsll", + "d,w,<", reg, reg, + (bit >= 32) ? bit - 32 : bit); + } + macro_build ((char *) NULL, counter, NULL, + (shift >= 32) ? "dsrl32" : "dsrl", + "d,w,<", reg, reg, + (shift >= 32) ? shift - 32 : shift); return; } } + + /* Sign extend hi32 before calling load_register, because we can + generally get better code when we load a sign extended value. */ + if ((hi32.X_add_number & 0x80000000) != 0) + hi32.X_add_number |= ~ (offsetT) 0xffffffff; load_register (counter, reg, &hi32, 0); freg = reg; } @@ -2010,7 +2999,7 @@ macro_build ((char *) NULL, counter, &lo32, "lui", "t,u", reg, (int) BFD_RELOC_HI16); macro_build ((char *) NULL, counter, NULL, "dsrl32", "d,w,<", reg, - reg, 32); + reg, 0); return; } @@ -2065,23 +3054,24 @@ addiu $reg,$reg, (BFD_RELOC_LO16) If we have an addend, we always use the latter form. */ if ((valueT) ep->X_add_number >= MAX_GPREL_OFFSET - || nopic_need_relax (ep->X_add_symbol)) + || nopic_need_relax (ep->X_add_symbol, 1)) p = NULL; else { frag_grow (20); macro_build ((char *) NULL, counter, ep, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", reg, GP, (int) BFD_RELOC_MIPS_GPREL); p = frag_var (rs_machine_dependent, 8, 0, - RELAX_ENCODE (4, 8, 0, 4, 0, mips_warn_about_macros), - ep->X_add_symbol, (long) 0, (char *) NULL); + RELAX_ENCODE (4, 8, 0, 4, 0, + mips_opts.warn_about_macros), + ep->X_add_symbol, (offsetT) 0, (char *) NULL); } macro_build_lui (p, counter, ep, reg); if (p != NULL) p += 4; macro_build (p, counter, ep, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", reg, reg, (int) BFD_RELOC_LO16); } else if (mips_pic == SVR4_PIC && ! mips_big_got) @@ -2099,14 +3089,14 @@ ep->X_add_number = 0; frag_grow (20); macro_build ((char *) NULL, counter, ep, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT16, GP); macro_build ((char *) NULL, counter, (expressionS *) NULL, "nop", ""); p = frag_var (rs_machine_dependent, 4, 0, - RELAX_ENCODE (0, 4, -8, 0, 0, mips_warn_about_macros), - ep->X_add_symbol, (long) 0, (char *) NULL); + RELAX_ENCODE (0, 4, -8, 0, 0, mips_opts.warn_about_macros), + ep->X_add_symbol, (offsetT) 0, (char *) NULL); macro_build (p, counter, ep, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", reg, reg, (int) BFD_RELOC_LO16); if (ex.X_add_number != 0) { @@ -2114,7 +3104,7 @@ as_bad ("PIC code offset overflow (max 16 signed bits)"); ex.X_op = O_constant; macro_build ((char *) NULL, counter, &ex, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", reg, reg, (int) BFD_RELOC_LO16); } } @@ -2143,15 +3133,15 @@ macro_build ((char *) NULL, counter, ep, "lui", "t,u", reg, (int) BFD_RELOC_MIPS_GOT_HI16); macro_build ((char *) NULL, counter, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", reg, reg, GP); macro_build ((char *) NULL, counter, ep, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT_LO16, reg); p = frag_var (rs_machine_dependent, 12 + off, 0, RELAX_ENCODE (12, 12 + off, off, 8 + off, 0, - mips_warn_about_macros), - ep->X_add_symbol, (long) 0, (char *) NULL); + mips_opts.warn_about_macros), + ep->X_add_symbol, (offsetT) 0, (char *) NULL); if (off > 0) { /* We need a nop before loading from $gp. This special @@ -2162,13 +3152,13 @@ p += 4; } macro_build (p, counter, ep, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT16, GP); p += 4; macro_build (p, counter, (expressionS *) NULL, "nop", ""); p += 4; macro_build (p, counter, ep, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", reg, reg, (int) BFD_RELOC_LO16); if (ex.X_add_number != 0) { @@ -2176,7 +3166,7 @@ as_bad ("PIC code offset overflow (max 16 signed bits)"); ex.X_op = O_constant; macro_build ((char *) NULL, counter, &ex, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", reg, reg, (int) BFD_RELOC_LO16); } } @@ -2186,7 +3176,7 @@ addiu $reg,$gp, (BFD_RELOC_MIPS_GPREL) */ macro_build ((char *) NULL, counter, ep, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", reg, GP, (int) BFD_RELOC_MIPS_GPREL); } else @@ -2234,6 +3224,8 @@ char *p; int hold_mips_optimize; + assert (! mips_opts.mips16); + treg = (ip->insn_opcode >> 16) & 0x1f; dreg = (ip->insn_opcode >> 11) & 0x1f; sreg = breg = (ip->insn_opcode >> 21) & 0x1f; @@ -2254,8 +3246,8 @@ sub v0,$zero,$a0 */ - mips_emit_delays (); - ++mips_noreorder; + mips_emit_delays (true); + ++mips_opts.noreorder; mips_any_noreorder = 1; expr1.X_add_number = 8; @@ -2268,7 +3260,7 @@ dbl ? "dsub" : "sub", "d,v,t", dreg, 0, sreg); - --mips_noreorder; + --mips_opts.noreorder; return; case M_ADD_I: @@ -2386,7 +3378,7 @@ case M_BGT_I: /* check for > max integer */ maxnum = 0x7fffffff; - if (mips_isa >= 3) + if (mips_opts.isa >= 3) { maxnum <<= 16; maxnum |= 0xffff; @@ -2394,7 +3386,7 @@ maxnum |= 0xffff; } if (imm_expr.X_add_number >= maxnum - && (mips_isa < 3 || sizeof (maxnum) > 4)) + && (mips_opts.isa < 3 || sizeof (maxnum) > 4)) { do_false: /* result is always false */ @@ -2432,7 +3424,7 @@ return; } maxnum = 0x7fffffff; - if (mips_isa >= 3) + if (mips_opts.isa >= 3) { maxnum <<= 16; maxnum |= 0xffff; @@ -2441,7 +3433,7 @@ } maxnum = - maxnum - 1; if (imm_expr.X_add_number <= maxnum - && (mips_isa < 3 || sizeof (maxnum) > 4)) + && (mips_opts.isa < 3 || sizeof (maxnum) > 4)) { do_true: /* result is always true */ @@ -2569,7 +3561,7 @@ likely = 1; case M_BLE_I: maxnum = 0x7fffffff; - if (mips_isa >= 3) + if (mips_opts.isa >= 3) { maxnum <<= 16; maxnum |= 0xffff; @@ -2577,7 +3569,7 @@ maxnum |= 0xffff; } if (imm_expr.X_add_number >= maxnum - && (mips_isa < 3 || sizeof (maxnum) > 4)) + && (mips_opts.isa < 3 || sizeof (maxnum) > 4)) goto do_true; imm_expr.X_add_number++; /* FALLTHROUGH */ @@ -2712,8 +3704,8 @@ return; } - mips_emit_delays (); - ++mips_noreorder; + mips_emit_delays (true); + ++mips_opts.noreorder; mips_any_noreorder = 1; macro_build ((char *) NULL, &icnt, NULL, dbl ? "ddiv" : "div", @@ -2756,7 +3748,7 @@ macro_build ((char *) NULL, &icnt, NULL, "nop", "", 0); macro_build ((char *) NULL, &icnt, NULL, "break", "c", 6); } - --mips_noreorder; + --mips_opts.noreorder; macro_build ((char *) NULL, &icnt, NULL, s, "d", dreg); break; @@ -2852,8 +3844,8 @@ s = "ddivu"; s2 = "mfhi"; do_divu3: - mips_emit_delays (); - ++mips_noreorder; + mips_emit_delays (true); + ++mips_opts.noreorder; mips_any_noreorder = 1; macro_build ((char *) NULL, &icnt, NULL, s, "z,s,t", sreg, treg); if (mips_trap) @@ -2865,7 +3857,7 @@ macro_build ((char *) NULL, &icnt, NULL, "nop", "", 0); macro_build ((char *) NULL, &icnt, NULL, "break", "c", 7); } - --mips_noreorder; + --mips_opts.noreorder; macro_build ((char *) NULL, &icnt, NULL, s2, "d", dreg); return; @@ -2898,7 +3890,7 @@ macro_build ((char *) NULL, &icnt, &offset_expr, "lui", "t,u", treg, (int) BFD_RELOC_PCREL_HI16_S); macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", treg, treg, (int) BFD_RELOC_PCREL_LO16); return; } @@ -2933,25 +3925,25 @@ If we have a constant, we need two instructions anyhow, so we may as well always use the latter form. */ if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET - || nopic_need_relax (offset_expr.X_add_symbol)) + || nopic_need_relax (offset_expr.X_add_symbol, 1)) p = NULL; else { frag_grow (20); macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", tempreg, GP, (int) BFD_RELOC_MIPS_GPREL); p = frag_var (rs_machine_dependent, 8, 0, RELAX_ENCODE (4, 8, 0, 4, 0, - mips_warn_about_macros), - offset_expr.X_add_symbol, (long) 0, + mips_opts.warn_about_macros), + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); } macro_build_lui (p, &icnt, &offset_expr, tempreg); if (p != NULL) p += 4; macro_build (p, &icnt, &offset_expr, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16); } else if (mips_pic == SVR4_PIC && ! mips_big_got) @@ -3006,9 +3998,9 @@ p = frag_var (rs_machine_dependent, 8 - off, 0, RELAX_ENCODE (0, 8 - off, -4 - off, 4 - off, 0, (breg == 0 - ? mips_warn_about_macros + ? mips_opts.warn_about_macros : 0)), - offset_expr.X_add_symbol, (long) 0, + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); if (breg == 0) { @@ -3016,7 +4008,7 @@ p += 4; } macro_build (p, &icnt, &expr1, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16); /* FIXME: If breg == 0, and the next instruction uses $tempreg, then if this variant case is used an extra @@ -3028,11 +4020,11 @@ macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", ""); macro_build ((char *) NULL, &icnt, &expr1, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16); (void) frag_var (rs_machine_dependent, 0, 0, RELAX_ENCODE (0, 0, -12, -4, 0, 0), - offset_expr.X_add_symbol, (long) 0, + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); } else @@ -3053,7 +4045,7 @@ macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", ""); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", treg, AT, breg); breg = 0; tempreg = treg; @@ -3068,14 +4060,14 @@ mips_optimize = hold_mips_optimize; macro_build ((char *) NULL, &icnt, &expr1, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", AT, AT, (int) BFD_RELOC_LO16); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", tempreg, tempreg, AT); (void) frag_var (rs_machine_dependent, 0, 0, RELAX_ENCODE (0, 0, -16 + off1, -8, 0, 0), - offset_expr.X_add_symbol, (long) 0, + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); used_at = 1; } @@ -3130,7 +4122,7 @@ macro_build ((char *) NULL, &icnt, &offset_expr, "lui", "t,u", tempreg, (int) BFD_RELOC_MIPS_GOT_HI16); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", tempreg, tempreg, GP); macro_build ((char *) NULL, &icnt, &offset_expr, dbl ? "ld" : "lw", @@ -3156,9 +4148,9 @@ RELAX_ENCODE (12 + off, 12 + gpdel, gpdel, 8 + gpdel, 0, (breg == 0 - ? mips_warn_about_macros + ? mips_opts.warn_about_macros : 0)), - offset_expr.X_add_symbol, (long) 0, + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); } else if (expr1.X_add_number >= -0x8000 @@ -3167,15 +4159,15 @@ macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", ""); macro_build ((char *) NULL, &icnt, &expr1, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16); p = frag_var (rs_machine_dependent, 12 + gpdel, 0, RELAX_ENCODE (20, 12 + gpdel, gpdel, 8 + gpdel, 0, (breg == 0 - ? mips_warn_about_macros + ? mips_opts.warn_about_macros : 0)), - offset_expr.X_add_symbol, (long) 0, + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); } else @@ -3200,7 +4192,7 @@ macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", ""); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", treg, AT, breg); dreg = treg; adj = 8; @@ -3214,19 +4206,19 @@ mips_optimize = hold_mips_optimize; macro_build ((char *) NULL, &icnt, &expr1, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", AT, AT, (int) BFD_RELOC_LO16); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", dreg, dreg, AT); p = frag_var (rs_machine_dependent, 16 + gpdel + adj, 0, RELAX_ENCODE (24 + adj, 16 + gpdel + adj, gpdel, 8 + gpdel, 0, (breg == 0 - ? mips_warn_about_macros + ? mips_opts.warn_about_macros : 0)), - offset_expr.X_add_symbol, (long) 0, + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); used_at = 1; @@ -3249,7 +4241,7 @@ macro_build (p, &icnt, (expressionS *) NULL, "nop", ""); p += 4; macro_build (p, &icnt, &expr1, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16); /* FIXME: If add_number is 0, and there was no base register, the external symbol case ended with a load, @@ -3267,7 +4259,7 @@ macro_build (p, &icnt, (expressionS *) NULL, "nop", ""); p += 4; macro_build (p, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", treg, AT, breg); p += 4; tempreg = treg; @@ -3279,11 +4271,11 @@ macro_build_lui (p, &icnt, &expr1, AT); p += 4; macro_build (p, &icnt, &expr1, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", AT, AT, (int) BFD_RELOC_LO16); p += 4; macro_build (p, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", tempreg, tempreg, AT); p += 4; } @@ -3294,7 +4286,7 @@ addiu $tempreg,$gp, (BFD_RELOC_MIPS_GPREL) */ macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", tempreg, GP, (int) BFD_RELOC_MIPS_GPREL); } else @@ -3302,7 +4294,7 @@ if (breg != 0) macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", treg, tempreg, breg); if (! used_at) @@ -3344,7 +4336,7 @@ { expr1.X_add_number = mips_cprestore_offset; macro_build ((char *) NULL, &icnt, &expr1, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", GP, (int) BFD_RELOC_LO16, mips_frame_reg); } } @@ -3385,14 +4377,15 @@ if (! mips_big_got) { macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", PIC_CALL_REG, (int) BFD_RELOC_MIPS_CALL16, GP); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", ""); p = frag_var (rs_machine_dependent, 4, 0, RELAX_ENCODE (0, 4, -8, 0, 0, 0), - offset_expr.X_add_symbol, (long) 0, (char *) NULL); + offset_expr.X_add_symbol, (offsetT) 0, + (char *) NULL); } else { @@ -3405,10 +4398,10 @@ macro_build ((char *) NULL, &icnt, &offset_expr, "lui", "t,u", PIC_CALL_REG, (int) BFD_RELOC_MIPS_CALL_HI16); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", PIC_CALL_REG, PIC_CALL_REG, GP); macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", PIC_CALL_REG, (int) BFD_RELOC_MIPS_CALL_LO16, PIC_CALL_REG); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, @@ -3416,14 +4409,15 @@ p = frag_var (rs_machine_dependent, 12 + gpdel, 0, RELAX_ENCODE (16, 12 + gpdel, gpdel, 8 + gpdel, 0, 0), - offset_expr.X_add_symbol, (long) 0, (char *) NULL); + offset_expr.X_add_symbol, (offsetT) 0, + (char *) NULL); if (gpdel > 0) { macro_build (p, &icnt, (expressionS *) NULL, "nop", ""); p += 4; } macro_build (p, &icnt, &offset_expr, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", PIC_CALL_REG, (int) BFD_RELOC_MIPS_GOT16, GP); p += 4; @@ -3431,7 +4425,7 @@ p += 4; } macro_build (p, &icnt, &offset_expr, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", PIC_CALL_REG, PIC_CALL_REG, (int) BFD_RELOC_LO16); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, @@ -3440,12 +4434,12 @@ as_warn ("No .cprestore pseudo-op used in PIC code"); else { - if (mips_noreorder) + if (mips_opts.noreorder) macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", ""); expr1.X_add_number = mips_cprestore_offset; macro_build ((char *) NULL, &icnt, &expr1, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", GP, (int) BFD_RELOC_LO16, mips_frame_reg); } @@ -3479,18 +4473,22 @@ goto ld; case M_LWC0_AB: s = "lwc0"; + /* Itbl support may require additional care here. */ coproc = 1; goto ld; case M_LWC1_AB: s = "lwc1"; + /* Itbl support may require additional care here. */ coproc = 1; goto ld; case M_LWC2_AB: s = "lwc2"; + /* Itbl support may require additional care here. */ coproc = 1; goto ld; case M_LWC3_AB: s = "lwc3"; + /* Itbl support may require additional care here. */ coproc = 1; goto ld; case M_LWL_AB: @@ -3503,14 +4501,17 @@ goto ld; case M_LDC1_AB: s = "ldc1"; + /* Itbl support may require additional care here. */ coproc = 1; goto ld; case M_LDC2_AB: s = "ldc2"; + /* Itbl support may require additional care here. */ coproc = 1; goto ld; case M_LDC3_AB: s = "ldc3"; + /* Itbl support may require additional care here. */ coproc = 1; goto ld; case M_LDL_AB: @@ -3552,18 +4553,22 @@ goto st; case M_SWC0_AB: s = "swc0"; + /* Itbl support may require additional care here. */ coproc = 1; goto st; case M_SWC1_AB: s = "swc1"; + /* Itbl support may require additional care here. */ coproc = 1; goto st; case M_SWC2_AB: s = "swc2"; + /* Itbl support may require additional care here. */ coproc = 1; goto st; case M_SWC3_AB: s = "swc3"; + /* Itbl support may require additional care here. */ coproc = 1; goto st; case M_SWL_AB: @@ -3581,13 +4586,16 @@ case M_SDC1_AB: s = "sdc1"; coproc = 1; + /* Itbl support may require additional care here. */ goto st; case M_SDC2_AB: s = "sdc2"; + /* Itbl support may require additional care here. */ coproc = 1; goto st; case M_SDC3_AB: s = "sdc3"; + /* Itbl support may require additional care here. */ coproc = 1; goto st; case M_SDL_AB: @@ -3599,6 +4607,7 @@ tempreg = AT; used_at = 1; ld_st: + /* Itbl support may require additional care here. */ if (mask == M_LWC1_AB || mask == M_SWC1_AB || mask == M_LDC1_AB @@ -3644,7 +4653,7 @@ if (breg == 0) { if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET - || nopic_need_relax (offset_expr.X_add_symbol)) + || nopic_need_relax (offset_expr.X_add_symbol, 1)) p = NULL; else { @@ -3653,9 +4662,10 @@ treg, (int) BFD_RELOC_MIPS_GPREL, GP); p = frag_var (rs_machine_dependent, 8, 0, RELAX_ENCODE (4, 8, 0, 4, 0, - (mips_warn_about_macros - || (used_at && mips_noat))), - offset_expr.X_add_symbol, (long) 0, + (mips_opts.warn_about_macros + || (used_at + && mips_opts.noat))), + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); used_at = 0; } @@ -3668,26 +4678,26 @@ else { if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET - || nopic_need_relax (offset_expr.X_add_symbol)) + || nopic_need_relax (offset_expr.X_add_symbol, 1)) p = NULL; else { frag_grow (28); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", tempreg, breg, GP); macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt, treg, (int) BFD_RELOC_MIPS_GPREL, tempreg); p = frag_var (rs_machine_dependent, 12, 0, RELAX_ENCODE (8, 12, 0, 8, 0, 0), - offset_expr.X_add_symbol, (long) 0, + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); } macro_build_lui (p, &icnt, &offset_expr, tempreg); if (p != NULL) p += 4; macro_build (p, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", tempreg, tempreg, breg); if (p != NULL) p += 4; @@ -3720,19 +4730,19 @@ as_bad ("PIC code offset overflow (max 16 signed bits)"); frag_grow (20); macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT16, GP); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", ""); p = frag_var (rs_machine_dependent, 4, 0, RELAX_ENCODE (0, 4, -8, 0, 0, 0), - offset_expr.X_add_symbol, (long) 0, + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); macro_build (p, &icnt, &offset_expr, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16); if (breg != 0) macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", tempreg, tempreg, breg); macro_build ((char *) NULL, &icnt, &expr1, s, fmt, treg, (int) BFD_RELOC_LO16, tempreg); @@ -3771,32 +4781,32 @@ macro_build ((char *) NULL, &icnt, &offset_expr, "lui", "t,u", tempreg, (int) BFD_RELOC_MIPS_GOT_HI16); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", tempreg, tempreg, GP); macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT_LO16, tempreg); p = frag_var (rs_machine_dependent, 12 + gpdel, 0, RELAX_ENCODE (12, 12 + gpdel, gpdel, 8 + gpdel, 0, 0), - offset_expr.X_add_symbol, (long) 0, (char *) NULL); + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); if (gpdel > 0) { macro_build (p, &icnt, (expressionS *) NULL, "nop", ""); p += 4; } macro_build (p, &icnt, &offset_expr, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT16, GP); p += 4; macro_build (p, &icnt, (expressionS *) NULL, "nop", ""); p += 4; macro_build (p, &icnt, &offset_expr, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16); if (breg != 0) macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", tempreg, tempreg, breg); macro_build ((char *) NULL, &icnt, &expr1, s, fmt, treg, (int) BFD_RELOC_LO16, tempreg); @@ -3819,7 +4829,7 @@ else { macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", tempreg, breg, GP); macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt, treg, (int) BFD_RELOC_MIPS_GPREL, tempreg); @@ -3873,7 +4883,7 @@ else if (mips_pic == SVR4_PIC) { macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP); } else if (mips_pic == EMBEDDED_PIC) @@ -3881,7 +4891,7 @@ /* For embedded PIC we pick up the entire address off $gp in a single instruction. */ macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", AT, GP, (int) BFD_RELOC_MIPS_GPREL); offset_expr.X_op = O_constant; offset_expr.X_add_number = 0; @@ -3890,7 +4900,7 @@ abort (); /* Now we load the register(s). */ - if (mips_isa >= 3) + if (mips_opts.isa >= 3) macro_build ((char *) NULL, &icnt, &offset_expr, "ld", "t,o(b)", treg, (int) BFD_RELOC_LO16, AT); else @@ -3920,7 +4930,7 @@ s = segment_name (S_GET_SEGMENT (offset_expr.X_add_symbol)); if (strcmp (s, ".lit8") == 0) { - if (mips_isa >= 2) + if (mips_opts.isa >= 2) { macro_build ((char *) NULL, &icnt, &offset_expr, "ldc1", "T,o(b)", treg, (int) BFD_RELOC_MIPS_LITERAL, GP); @@ -3935,7 +4945,7 @@ assert (strcmp (s, RDATA_SECTION_NAME) == 0); if (mips_pic == SVR4_PIC) macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP); else { @@ -3943,7 +4953,7 @@ macro_build_lui ((char *) NULL, &icnt, &offset_expr, AT); } - if (mips_isa >= 2) + if (mips_opts.isa >= 2) { macro_build ((char *) NULL, &icnt, &offset_expr, "ldc1", "T,o(b)", treg, (int) BFD_RELOC_LO16, AT); @@ -3965,15 +4975,15 @@ to adjust when loading from memory. */ r = BFD_RELOC_LO16; dob: - assert (mips_isa < 2); + assert (mips_opts.isa < 2); macro_build ((char *) NULL, &icnt, &offset_expr, "lwc1", "T,o(b)", - byte_order == LITTLE_ENDIAN ? treg : treg + 1, + target_big_endian ? treg + 1 : treg, (int) r, breg); /* FIXME: A possible overflow which I don't know how to deal with. */ offset_expr.X_add_number += 4; macro_build ((char *) NULL, &icnt, &offset_expr, "lwc1", "T,o(b)", - byte_order == LITTLE_ENDIAN ? treg + 1 : treg, + target_big_endian ? treg : treg + 1, (int) r, breg); /* To avoid confusion in tc_gen_reloc, we must ensure that this @@ -3997,8 +5007,9 @@ * But, the resulting address is the same after relocation so why * generate the extra instruction? */ + /* Itbl support may require additional care here. */ coproc = 1; - if (mips_isa >= 2) + if (mips_opts.isa >= 2) { s = "ldc1"; goto ld; @@ -4009,7 +5020,7 @@ goto ldd_std; case M_S_DAB: - if (mips_isa >= 2) + if (mips_opts.isa >= 2) { s = "sdc1"; goto st; @@ -4017,11 +5028,12 @@ s = "swc1"; fmt = "T,o(b)"; + /* Itbl support may require additional care here. */ coproc = 1; goto ldd_std; case M_LD_AB: - if (mips_isa >= 3) + if (mips_opts.isa >= 3) { s = "ld"; goto ld; @@ -4032,7 +5044,7 @@ goto ldd_std; case M_SD_AB: - if (mips_isa >= 3) + if (mips_opts.isa >= 3) { s = "sd"; goto st; @@ -4052,7 +5064,8 @@ /* Even on a big endian machine $fn comes before $fn+1. We have to adjust when loading from memory. We set coproc if we must load $fn+1 first. */ - if (byte_order == LITTLE_ENDIAN) + /* Itbl support may require additional care here. */ + if (! target_big_endian) coproc = 0; if (mips_pic == NO_PIC @@ -4073,7 +5086,7 @@ lui instruction. If there is a constant, we always use the last case. */ if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET - || nopic_need_relax (offset_expr.X_add_symbol)) + || nopic_need_relax (offset_expr.X_add_symbol, 1)) { p = NULL; used_at = 1; @@ -4093,13 +5106,14 @@ { frag_grow (36); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", AT, breg, GP); tempreg = AT; off = 4; used_at = 1; } + /* Itbl support may require additional care here. */ macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt, coproc ? treg + 1 : treg, (int) BFD_RELOC_MIPS_GPREL, tempreg); @@ -4109,6 +5123,7 @@ undesired nop. */ hold_mips_optimize = mips_optimize; mips_optimize = 2; + /* Itbl support may require additional care here. */ macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt, coproc ? treg : treg + 1, (int) BFD_RELOC_MIPS_GPREL, tempreg); @@ -4116,8 +5131,8 @@ p = frag_var (rs_machine_dependent, 12 + off, 0, RELAX_ENCODE (8 + off, 12 + off, 0, 4 + off, 1, - used_at && mips_noat), - offset_expr.X_add_symbol, (long) 0, + used_at && mips_opts.noat), + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); /* We just generated two relocs. When tc_gen_reloc @@ -4137,11 +5152,12 @@ if (breg != 0) { macro_build (p, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", AT, breg, AT); if (p != NULL) p += 4; } + /* Itbl support may require additional care here. */ macro_build (p, &icnt, &offset_expr, s, fmt, coproc ? treg + 1 : treg, (int) BFD_RELOC_LO16, AT); @@ -4149,6 +5165,7 @@ p += 4; /* FIXME: How do we handle overflow here? */ offset_expr.X_add_number += 4; + /* Itbl support may require additional care here. */ macro_build (p, &icnt, &offset_expr, s, fmt, coproc ? treg : treg + 1, (int) BFD_RELOC_LO16, AT); @@ -4182,13 +5199,14 @@ off = 4; frag_grow (24 + off); macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", ""); if (breg != 0) macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", AT, breg, AT); + /* Itbl support may require additional care here. */ macro_build ((char *) NULL, &icnt, &expr1, s, fmt, coproc ? treg + 1 : treg, (int) BFD_RELOC_LO16, AT); @@ -4198,6 +5216,7 @@ nop. */ hold_mips_optimize = mips_optimize; mips_optimize = 2; + /* Itbl support may require additional care here. */ macro_build ((char *) NULL, &icnt, &expr1, s, fmt, coproc ? treg : treg + 1, (int) BFD_RELOC_LO16, AT); @@ -4205,7 +5224,7 @@ (void) frag_var (rs_machine_dependent, 0, 0, RELAX_ENCODE (0, 0, -16 - off, -8, 1, 0), - offset_expr.X_add_symbol, (long) 0, + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); } else if (mips_pic == SVR4_PIC) @@ -4245,16 +5264,17 @@ macro_build ((char *) NULL, &icnt, &offset_expr, "lui", "t,u", AT, (int) BFD_RELOC_MIPS_GOT_HI16); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", AT, AT, GP); macro_build ((char *) NULL, &icnt, &offset_expr, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT_LO16, AT); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", ""); if (breg != 0) macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", AT, breg, AT); + /* Itbl support may require additional care here. */ macro_build ((char *) NULL, &icnt, &expr1, s, fmt, coproc ? treg + 1 : treg, (int) BFD_RELOC_LO16, AT); @@ -4264,6 +5284,7 @@ nop. */ hold_mips_optimize = mips_optimize; mips_optimize = 2; + /* Itbl support may require additional care here. */ macro_build ((char *) NULL, &icnt, &expr1, s, fmt, coproc ? treg : treg + 1, (int) BFD_RELOC_LO16, AT); @@ -4273,7 +5294,7 @@ p = frag_var (rs_machine_dependent, 16 + gpdel + off, 0, RELAX_ENCODE (24 + off, 16 + gpdel + off, gpdel, 8 + gpdel + off, 1, 0), - offset_expr.X_add_symbol, (long) 0, + offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); if (gpdel > 0) { @@ -4281,7 +5302,7 @@ p += 4; } macro_build (p, &icnt, &offset_expr, - mips_isa < 3 ? "lw" : "ld", + mips_opts.isa < 3 ? "lw" : "ld", "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP); p += 4; macro_build (p, &icnt, (expressionS *) NULL, "nop", ""); @@ -4289,10 +5310,11 @@ if (breg != 0) { macro_build (p, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", AT, breg, AT); p += 4; } + /* Itbl support may require additional care here. */ macro_build (p, &icnt, &expr1, s, fmt, coproc ? treg + 1 : treg, (int) BFD_RELOC_LO16, AT); @@ -4303,6 +5325,7 @@ nop. */ hold_mips_optimize = mips_optimize; mips_optimize = 2; + /* Itbl support may require additional care here. */ macro_build (p, &icnt, &expr1, s, fmt, coproc ? treg : treg + 1, (int) BFD_RELOC_LO16, AT); @@ -4326,16 +5349,18 @@ else { macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", AT, breg, GP); tempreg = AT; used_at = 1; } + /* Itbl support may require additional care here. */ macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt, coproc ? treg + 1 : treg, (int) BFD_RELOC_MIPS_GPREL, tempreg); offset_expr.X_add_number += 4; + /* Itbl support may require additional care here. */ macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt, coproc ? treg : treg + 1, (int) BFD_RELOC_MIPS_GPREL, tempreg); @@ -4354,19 +5379,70 @@ case M_SD_OB: s = "sw"; sd_ob: - assert (mips_isa < 3); + assert (mips_opts.isa < 3); macro_build ((char *) NULL, &icnt, &offset_expr, s, "t,o(b)", treg, (int) BFD_RELOC_LO16, breg); offset_expr.X_add_number += 4; macro_build ((char *) NULL, &icnt, &offset_expr, s, "t,o(b)", treg + 1, (int) BFD_RELOC_LO16, breg); return; + + /* New code added to support COPZ instructions. + This code builds table entries out of the macros in mip_opcodes. + R4000 uses interlocks to handle coproc delays. + Other chips (like the R3000) require nops to be inserted for delays. + + FIXME: Currently, we require that the user handle delays. + In order to fill delay slots for non-interlocked chips, + we must have a way to specify delays based on the coprocessor. + Eg. 4 cycles if load coproc reg from memory, 1 if in cache, etc. + What are the side-effects of the cop instruction? + What cache support might we have and what are its effects? + Both coprocessor & memory require delays. how long??? + What registers are read/set/modified? + + If an itbl is provided to interpret cop instructions, + this knowledge can be encoded in the itbl spec. */ + + case M_COP0: + s = "cop0"; + goto copz; + case M_COP1: + s = "cop1"; + goto copz; + case M_COP2: + s = "cop2"; + goto copz; + case M_COP3: + s = "cop3"; + copz: + /* For now we just do C (same as Cz). */ + macro_build ((char *) NULL, &icnt, &offset_expr, s, "C"); + return; + #ifdef LOSING_COMPILER default: + /* Try and see if this is a new itbl instruction. + This code builds table entries out of the macros in mip_opcodes. + FIXME: For now we just assemble the expression and pass it's + value along as a 32-bit immediate. + We may want to have the assembler assemble this value, + so that we gain the assembler's knowledge of delay slots, + symbols, etc. + Would it be more efficient to use mask (id) here? */ + if (itbl_have_entries + && (immed_expr = itbl_assemble (ip->insn_mo->name, ""))) + { + s = ip->insn_mo->name; + s2 = "cop3"; + coproc = ITBL_DECODE_PNUM (immed_expr);; + macro_build ((char *) NULL, &icnt, &immed_expr, s, "C"); + return; + } macro2 (ip); return; } - if (mips_noat) + if (mips_opts.noat) as_warn ("Macro used $at after \".set noat\""); } @@ -4431,8 +5507,8 @@ case M_DMULO: dbl = 1; case M_MULO: - mips_emit_delays (); - ++mips_noreorder; + mips_emit_delays (true); + ++mips_opts.noreorder; mips_any_noreorder = 1; macro_build ((char *) NULL, &icnt, NULL, dbl ? "dmult" : "mult", @@ -4451,15 +5527,15 @@ macro_build ((char *) NULL, &icnt, NULL, "nop", "", 0); macro_build ((char *) NULL, &icnt, NULL, "break", "c", 6); } - --mips_noreorder; + --mips_opts.noreorder; macro_build ((char *) NULL, &icnt, NULL, "mflo", "d", dreg); break; case M_DMULOU: dbl = 1; case M_MULOU: - mips_emit_delays (); - ++mips_noreorder; + mips_emit_delays (true); + ++mips_opts.noreorder; mips_any_noreorder = 1; macro_build ((char *) NULL, &icnt, NULL, dbl ? "dmultu" : "multu", @@ -4475,7 +5551,7 @@ macro_build ((char *) NULL, &icnt, NULL, "nop", "", 0); macro_build ((char *) NULL, &icnt, NULL, "break", "c", 6); } - --mips_noreorder; + --mips_opts.noreorder; break; case M_ROL: @@ -4511,15 +5587,15 @@ break; case M_S_DOB: - assert (mips_isa < 2); + assert (mips_opts.isa < 2); /* Even on a big endian machine $fn comes before $fn+1. We have to adjust when storing to memory. */ macro_build ((char *) NULL, &icnt, &offset_expr, "swc1", "T,o(b)", - byte_order == LITTLE_ENDIAN ? treg : treg + 1, + target_big_endian ? treg + 1 : treg, (int) BFD_RELOC_LO16, breg); offset_expr.X_add_number += 4; macro_build ((char *) NULL, &icnt, &offset_expr, "swc1", "T,o(b)", - byte_order == LITTLE_ENDIAN ? treg + 1 : treg, + target_big_endian ? treg : treg + 1, (int) BFD_RELOC_LO16, breg); return; @@ -4563,7 +5639,7 @@ { imm_expr.X_add_number = -imm_expr.X_add_number; macro_build ((char *) NULL, &icnt, &imm_expr, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", dreg, sreg, (int) BFD_RELOC_LO16); used_at = 0; @@ -4708,7 +5784,7 @@ as_warn ("Instruction %s: result is always true", ip->insn_mo->name); macro_build ((char *) NULL, &icnt, &expr1, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", dreg, 0, (int) BFD_RELOC_LO16); return; } @@ -4722,7 +5798,7 @@ { imm_expr.X_add_number = -imm_expr.X_add_number; macro_build ((char *) NULL, &icnt, &imm_expr, - mips_isa < 3 ? "addiu" : "daddiu", + mips_opts.isa < 3 ? "addiu" : "daddiu", "t,r,j", dreg, sreg, (int) BFD_RELOC_LO16); used_at = 0; } @@ -4796,7 +5872,7 @@ case M_TRUNCWD: case M_TRUNCWS: - assert (mips_isa < 2); + assert (mips_opts.isa < 2); sreg = (ip->insn_opcode >> 11) & 0x1f; /* floating reg */ dreg = (ip->insn_opcode >> 06) & 0x1f; /* floating reg */ @@ -4804,8 +5880,8 @@ * Is the double cfc1 instruction a bug in the mips assembler; * or is there a reason for it? */ - mips_emit_delays (); - ++mips_noreorder; + mips_emit_delays (true); + ++mips_opts.noreorder; mips_any_noreorder = 1; macro_build ((char *) NULL, &icnt, NULL, "cfc1", "t,G", treg, 31); macro_build ((char *) NULL, &icnt, NULL, "cfc1", "t,G", treg, 31); @@ -4822,7 +5898,7 @@ mask == M_TRUNCWD ? "cvt.w.d" : "cvt.w.s", "D,S", dreg, sreg); macro_build ((char *) NULL, &icnt, NULL, "ctc1", "t,G", treg, 31); macro_build ((char *) NULL, &icnt, NULL, "nop", ""); - --mips_noreorder; + --mips_opts.noreorder; break; case M_ULH: @@ -4834,11 +5910,11 @@ if (offset_expr.X_add_number >= 0x7fff) as_bad ("operand overflow"); /* avoid load delay */ - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) offset_expr.X_add_number += 1; macro_build ((char *) NULL, &icnt, &offset_expr, s, "t,o(b)", treg, (int) BFD_RELOC_LO16, breg); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) offset_expr.X_add_number -= 1; else offset_expr.X_add_number += 1; @@ -4860,11 +5936,11 @@ ulw: if (offset_expr.X_add_number >= 0x8000 - off) as_bad ("operand overflow"); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) offset_expr.X_add_number += off; macro_build ((char *) NULL, &icnt, &offset_expr, s, "t,o(b)", treg, (int) BFD_RELOC_LO16, breg); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) offset_expr.X_add_number -= off; else offset_expr.X_add_number += off; @@ -4885,15 +5961,15 @@ load_address (&icnt, AT, &offset_expr); if (breg != 0) macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", AT, AT, breg); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) expr1.X_add_number = off; else expr1.X_add_number = 0; macro_build ((char *) NULL, &icnt, &expr1, s, "t,o(b)", treg, (int) BFD_RELOC_LO16, AT); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) expr1.X_add_number = 0; else expr1.X_add_number = off; @@ -4906,14 +5982,14 @@ load_address (&icnt, AT, &offset_expr); if (breg != 0) macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", AT, AT, breg); - if (byte_order == BIG_ENDIAN) + if (target_big_endian) expr1.X_add_number = 0; macro_build ((char *) NULL, &icnt, &expr1, mask == M_ULH_A ? "lb" : "lbu", "t,o(b)", treg, (int) BFD_RELOC_LO16, AT); - if (byte_order == BIG_ENDIAN) + if (target_big_endian) expr1.X_add_number = 1; else expr1.X_add_number = 0; @@ -4928,12 +6004,12 @@ case M_USH: if (offset_expr.X_add_number >= 0x7fff) as_bad ("operand overflow"); - if (byte_order == BIG_ENDIAN) + if (target_big_endian) offset_expr.X_add_number += 1; macro_build ((char *) NULL, &icnt, &offset_expr, "sb", "t,o(b)", treg, (int) BFD_RELOC_LO16, breg); macro_build ((char *) NULL, &icnt, NULL, "srl", "d,w,<", AT, treg, 8); - if (byte_order == BIG_ENDIAN) + if (target_big_endian) offset_expr.X_add_number -= 1; else offset_expr.X_add_number += 1; @@ -4953,11 +6029,11 @@ usw: if (offset_expr.X_add_number >= 0x8000 - off) as_bad ("operand overflow"); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) offset_expr.X_add_number += off; macro_build ((char *) NULL, &icnt, &offset_expr, s, "t,o(b)", treg, (int) BFD_RELOC_LO16, breg); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) offset_expr.X_add_number -= off; else offset_expr.X_add_number += off; @@ -4978,15 +6054,15 @@ load_address (&icnt, AT, &offset_expr); if (breg != 0) macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", AT, AT, breg); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) expr1.X_add_number = off; else expr1.X_add_number = 0; macro_build ((char *) NULL, &icnt, &expr1, s, "t,o(b)", treg, (int) BFD_RELOC_LO16, AT); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) expr1.X_add_number = 0; else expr1.X_add_number = off; @@ -4998,21 +6074,21 @@ load_address (&icnt, AT, &offset_expr); if (breg != 0) macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", AT, AT, breg); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) expr1.X_add_number = 0; macro_build ((char *) NULL, &icnt, &expr1, "sb", "t,o(b)", treg, (int) BFD_RELOC_LO16, AT); macro_build ((char *) NULL, &icnt, NULL, "srl", "d,w,<", treg, treg, 8); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) expr1.X_add_number = 1; else expr1.X_add_number = 0; macro_build ((char *) NULL, &icnt, &expr1, "sb", "t,o(b)", treg, (int) BFD_RELOC_LO16, AT); - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) expr1.X_add_number = 0; else expr1.X_add_number = 1; @@ -5025,13 +6101,256 @@ break; default: + /* FIXME: Check if this is one of the itbl macros, since they + are added dynamically. */ as_bad ("Macro %s not implemented yet", ip->insn_mo->name); break; } - if (mips_noat) + if (mips_opts.noat) as_warn ("Macro used $at after \".set noat\""); } +/* Implement macros in mips16 mode. */ + +static void +mips16_macro (ip) + struct mips_cl_insn *ip; +{ + int mask; + int xreg, yreg, zreg, tmp; + int icnt; + expressionS expr1; + int dbl; + const char *s, *s2, *s3; + + mask = ip->insn_mo->mask; + + xreg = (ip->insn_opcode >> MIPS16OP_SH_RX) & MIPS16OP_MASK_RX; + yreg = (ip->insn_opcode >> MIPS16OP_SH_RY) & MIPS16OP_MASK_RY; + zreg = (ip->insn_opcode >> MIPS16OP_SH_RZ) & MIPS16OP_MASK_RZ; + + icnt = 0; + + expr1.X_op = O_constant; + expr1.X_op_symbol = NULL; + expr1.X_add_symbol = NULL; + expr1.X_add_number = 1; + + dbl = 0; + + switch (mask) + { + default: + internalError (); + + case M_DDIV_3: + dbl = 1; + case M_DIV_3: + s = "mflo"; + goto do_div3; + case M_DREM_3: + dbl = 1; + case M_REM_3: + s = "mfhi"; + do_div3: + mips_emit_delays (true); + ++mips_opts.noreorder; + mips_any_noreorder = 1; + macro_build ((char *) NULL, &icnt, NULL, + dbl ? "ddiv" : "div", + "0,x,y", xreg, yreg); + expr1.X_add_number = 2; + macro_build ((char *) NULL, &icnt, &expr1, "bnez", "x,p", yreg); + macro_build ((char *) NULL, &icnt, NULL, "break", "6", 7); + /* FIXME: The normal code checks for of -1 / -0x80000000 here, + since that causes an overflow. We should do that as well, + but I don't see how to do the comparisons without a temporary + register. */ + --mips_opts.noreorder; + macro_build ((char *) NULL, &icnt, NULL, s, "x", zreg); + break; + + case M_DIVU_3: + s = "divu"; + s2 = "mflo"; + goto do_divu3; + case M_REMU_3: + s = "divu"; + s2 = "mfhi"; + goto do_divu3; + case M_DDIVU_3: + s = "ddivu"; + s2 = "mflo"; + goto do_divu3; + case M_DREMU_3: + s = "ddivu"; + s2 = "mfhi"; + do_divu3: + mips_emit_delays (true); + ++mips_opts.noreorder; + mips_any_noreorder = 1; + macro_build ((char *) NULL, &icnt, NULL, s, "0,x,y", xreg, yreg); + expr1.X_add_number = 2; + macro_build ((char *) NULL, &icnt, &expr1, "bnez", "x,p", yreg); + macro_build ((char *) NULL, &icnt, NULL, "break", "6", 7); + --mips_opts.noreorder; + macro_build ((char *) NULL, &icnt, NULL, s2, "x", zreg); + break; + + case M_DMUL: + dbl = 1; + case M_MUL: + macro_build ((char *) NULL, &icnt, NULL, + dbl ? "dmultu" : "multu", + "x,y", xreg, yreg); + macro_build ((char *) NULL, &icnt, NULL, "mflo", "x", zreg); + return; + + case M_DSUBU_I: + dbl = 1; + goto do_subu; + case M_SUBU_I: + do_subu: + imm_expr.X_add_number = -imm_expr.X_add_number; + macro_build ((char *) NULL, &icnt, &imm_expr, + dbl ? "daddiu" : "addiu", + "y,x,4", yreg, xreg); + break; + + case M_SUBU_I_2: + imm_expr.X_add_number = -imm_expr.X_add_number; + macro_build ((char *) NULL, &icnt, &imm_expr, "addiu", + "x,k", xreg); + break; + + case M_DSUBU_I_2: + imm_expr.X_add_number = -imm_expr.X_add_number; + macro_build ((char *) NULL, &icnt, &imm_expr, "daddiu", + "y,j", yreg); + break; + + case M_BEQ: + s = "cmp"; + s2 = "bteqz"; + goto do_branch; + case M_BNE: + s = "cmp"; + s2 = "btnez"; + goto do_branch; + case M_BLT: + s = "slt"; + s2 = "btnez"; + goto do_branch; + case M_BLTU: + s = "sltu"; + s2 = "btnez"; + goto do_branch; + case M_BLE: + s = "slt"; + s2 = "bteqz"; + goto do_reverse_branch; + case M_BLEU: + s = "sltu"; + s2 = "bteqz"; + goto do_reverse_branch; + case M_BGE: + s = "slt"; + s2 = "bteqz"; + goto do_branch; + case M_BGEU: + s = "sltu"; + s2 = "bteqz"; + goto do_branch; + case M_BGT: + s = "slt"; + s2 = "btnez"; + goto do_reverse_branch; + case M_BGTU: + s = "sltu"; + s2 = "btnez"; + + do_reverse_branch: + tmp = xreg; + xreg = yreg; + yreg = tmp; + + do_branch: + macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "x,y", + xreg, yreg); + macro_build ((char *) NULL, &icnt, &offset_expr, s2, "p"); + break; + + case M_BEQ_I: + s = "cmpi"; + s2 = "bteqz"; + s3 = "x,U"; + goto do_branch_i; + case M_BNE_I: + s = "cmpi"; + s2 = "btnez"; + s3 = "x,U"; + goto do_branch_i; + case M_BLT_I: + s = "slti"; + s2 = "btnez"; + s3 = "x,8"; + goto do_branch_i; + case M_BLTU_I: + s = "sltiu"; + s2 = "btnez"; + s3 = "x,8"; + goto do_branch_i; + case M_BLE_I: + s = "slti"; + s2 = "btnez"; + s3 = "x,8"; + goto do_addone_branch_i; + case M_BLEU_I: + s = "sltiu"; + s2 = "btnez"; + s3 = "x,8"; + goto do_addone_branch_i; + case M_BGE_I: + s = "slti"; + s2 = "bteqz"; + s3 = "x,8"; + goto do_branch_i; + case M_BGEU_I: + s = "sltiu"; + s2 = "bteqz"; + s3 = "x,8"; + goto do_branch_i; + case M_BGT_I: + s = "slti"; + s2 = "bteqz"; + s3 = "x,8"; + goto do_addone_branch_i; + case M_BGTU_I: + s = "sltiu"; + s2 = "bteqz"; + s3 = "x,8"; + + do_addone_branch_i: + ++imm_expr.X_add_number; + + do_branch_i: + macro_build ((char *) NULL, &icnt, &imm_expr, s, s3, xreg); + macro_build ((char *) NULL, &icnt, &offset_expr, s2, "p"); + break; + + case M_ABS: + expr1.X_add_number = 0; + macro_build ((char *) NULL, &icnt, &expr1, "slti", "x,8", yreg); + if (xreg != yreg) + macro_build ((char *) NULL, &icnt, (expressionS *) NULL, + "move", "y,X", xreg, yreg); + expr1.X_add_number = 2; + macro_build ((char *) NULL, &icnt, &expr1, "bteqz", "p"); + macro_build ((char *) NULL, &icnt, (expressionS *) NULL, + "neg", "x,w", xreg, xreg); + } +} + /* This routine assembles an instruction into its binary format. As a side effect, it sets one of the global variables imm_reloc or offset_reloc to the type of relocation to do if one of the operands @@ -5053,20 +6372,11 @@ insn_error = NULL; - for (s = str; islower (*s) || (*s >= '0' && *s <= '3') || *s == '6' || *s == '.'; ++s) + for (s = str; *s != '\0' && !isspace(*s); ++s) continue; - switch (*s) - { - case '\0': - break; - - case ' ': - *s++ = '\0'; - break; + if (isspace (*s)) + *s++ = '\0'; - default: - as_fatal ("Unknown opcode: `%s'", str); - } if ((insn = (struct mips_opcode *) hash_find (op_hash, str)) == NULL) { insn_error = "unrecognized opcode"; @@ -5090,13 +6400,15 @@ else insn_isa = 1; - if (insn_isa > mips_isa - || ((insn->pinfo & INSN_ISA) == INSN_4650 - && ! mips_4650) - || ((insn->pinfo & INSN_ISA) == INSN_4010 - && ! mips_4010) - || ((insn->pinfo & INSN_ISA) == INSN_4100 - && ! mips_4100)) + if (insn_isa > mips_opts.isa + || (insn->pinfo != INSN_MACRO + && (((insn->pinfo & INSN_ISA) == INSN_4650 + && ! mips_4650) + || ((insn->pinfo & INSN_ISA) == INSN_4010 + && ! mips_4010) + || ((insn->pinfo & INSN_ISA) == INSN_4100 + && ! mips_4100) + ))) { if (insn + 1 < &mips_opcodes[NUMOPCODES] && strcmp (insn->name, insn[1].name) == 0) @@ -5104,7 +6416,15 @@ ++insn; continue; } - insn_error = "opcode not supported on this processor"; + if (insn_isa <= mips_opts.isa) + insn_error = "opcode not supported on this processor"; + else + { + static char buf[100]; + + sprintf (buf, "opcode requires -mips%d or greater", insn_isa); + insn_error = buf; + } return; } @@ -5306,11 +6626,36 @@ s += 4; regno = KT1; } + else if (itbl_have_entries) + { + char *p, *n; + int r; + + p = s+1; /* advance past '$' */ + n = itbl_get_field (&p); /* n is name */ + + /* See if this is a register defined in an + itbl entry */ + r = itbl_get_reg_val (n); + if (r) + { + /* Get_field advances to the start of + the next field, so we need to back + rack to the end of the last field. */ + if (p) + s = p - 1; + else + s = strchr (s,'\0'); + regno = r; + } + else + goto notreg; + } else goto notreg; } if (regno == AT - && ! mips_noat + && ! mips_opts.noat && *args != 'E' && *args != 'G') as_warn ("Used $at without \".set noat\""); @@ -5329,6 +6674,9 @@ /* 'z' only matches $0. */ if (c == 'z' && regno != 0) break; + + /* Now that we have assembled one operand, we use the args string + * to figure out where it goes in the instruction. */ switch (c) { case 'r': @@ -5361,6 +6709,11 @@ is $0. This only matches $0, and is checked outside the switch. */ break; + case 'D': + /* Itbl operand; not yet implemented. FIXME ?? */ + break; + /* What about all other operands like 'i', which + can be specified in the opcode table? */ } lastregno = regno; continue; @@ -5401,11 +6754,13 @@ as_bad ("Invalid float register number (%d)", regno); if ((regno & 1) != 0 - && mips_isa < 3 - && ! (strcmp (str, "mtc1") == 0 || - strcmp (str, "mfc1") == 0 || - strcmp (str, "lwc1") == 0 || - strcmp (str, "swc1") == 0)) + && mips_opts.isa < 3 + && ! (strcmp (str, "mtc1") == 0 + || strcmp (str, "mfc1") == 0 + || strcmp (str, "lwc1") == 0 + || strcmp (str, "swc1") == 0 + || strcmp (str, "l.s") == 0 + || strcmp (str, "s.s") == 0)) as_warn ("Float register should be even, was %d", regno); @@ -5532,7 +6887,7 @@ )) { imm_expr.X_op = O_constant; - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) imm_expr.X_add_number = (((((((int) temp[3] << 8) | temp[2]) << 8) @@ -5577,8 +6932,9 @@ | SEC_LOAD | SEC_READONLY | SEC_DATA)); - frag_align (*args == 'l' ? 2 : 3, 0); - if (OUTPUT_FLAVOR == bfd_target_elf_flavour) + frag_align (*args == 'l' ? 2 : 3, 0, 0); + if (OUTPUT_FLAVOR == bfd_target_elf_flavour + && strcmp (TARGET_OS, "elf") != 0) record_alignment (new_seg, 4); else record_alignment (new_seg, *args == 'l' ? 2 : 3); @@ -5666,7 +7022,7 @@ && imm_expr.X_op == O_constant) || (more && imm_expr.X_add_number < 0 - && mips_isa >= 3 + && mips_opts.isa >= 3 && imm_expr.X_unsigned && sizeof (imm_expr.X_add_number) <= 4)) { @@ -5757,20 +7113,23 @@ case 'N': /* 3 bit branch condition code */ case 'M': /* 3 bit compare condition code */ - my_getExpression (&imm_expr, s); - check_absolute_expr (ip, &imm_expr); - if ((unsigned long) imm_expr.X_add_number > 7) + if (strncmp (s, "$fcc", 4) != 0) + break; + s += 4; + regno = 0; + do { - as_warn ("Condition code > 7 (%ld)", - (long) imm_expr.X_add_number); - imm_expr.X_add_number &= 7; + regno *= 10; + regno += *s - '0'; + ++s; } + while (isdigit (*s)); + if (regno > 7) + as_bad ("invalid condition code register $fcc%d", regno); if (*args == 'N') - ip->insn_opcode |= imm_expr.X_add_number << OP_SH_BCC; + ip->insn_opcode |= regno << OP_SH_BCC; else - ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CCC; - imm_expr.X_op = O_absent; - s = expr_end; + ip->insn_opcode |= regno << OP_SH_CCC; continue; default: @@ -5792,6 +7151,718 @@ } } +/* This routine assembles an instruction into its binary format when + assembling for the mips16. As a side effect, it sets one of the + global variables imm_reloc or offset_reloc to the type of + relocation to do if one of the operands is an address expression. + It also sets mips16_small and mips16_ext if the user explicitly + requested a small or extended instruction. */ + +static void +mips16_ip (str, ip) + char *str; + struct mips_cl_insn *ip; +{ + char *s; + const char *args; + struct mips_opcode *insn; + char *argsstart; + unsigned int regno; + unsigned int lastregno = 0; + char *s_reset; + + insn_error = NULL; + + mips16_small = false; + mips16_ext = false; + + for (s = str; islower (*s); ++s) + ; + switch (*s) + { + case '\0': + break; + + case ' ': + *s++ = '\0'; + break; + + case '.': + if (s[1] == 't' && s[2] == ' ') + { + *s = '\0'; + mips16_small = true; + s += 3; + break; + } + else if (s[1] == 'e' && s[2] == ' ') + { + *s = '\0'; + mips16_ext = true; + s += 3; + break; + } + /* Fall through. */ + default: + insn_error = "unknown opcode"; + return; + } + + if (mips_opts.noautoextend && ! mips16_ext) + mips16_small = true; + + if ((insn = (struct mips_opcode *) hash_find (mips16_op_hash, str)) == NULL) + { + insn_error = "unrecognized opcode"; + return; + } + + argsstart = s; + for (;;) + { + assert (strcmp (insn->name, str) == 0); + + ip->insn_mo = insn; + ip->insn_opcode = insn->match; + ip->use_extend = false; + imm_expr.X_op = O_absent; + imm_reloc = BFD_RELOC_UNUSED; + offset_expr.X_op = O_absent; + offset_reloc = BFD_RELOC_UNUSED; + for (args = insn->args; 1; ++args) + { + int c; + + if (*s == ' ') + ++s; + + /* In this switch statement we call break if we did not find + a match, continue if we did find a match, or return if we + are done. */ + + c = *args; + switch (c) + { + case '\0': + if (*s == '\0') + { + /* Stuff the immediate value in now, if we can. */ + if (imm_expr.X_op == O_constant + && imm_reloc > BFD_RELOC_UNUSED + && insn->pinfo != INSN_MACRO) + { + mips16_immed ((char *) NULL, 0, + imm_reloc - BFD_RELOC_UNUSED, + imm_expr.X_add_number, true, mips16_small, + mips16_ext, &ip->insn_opcode, + &ip->use_extend, &ip->extend); + imm_expr.X_op = O_absent; + imm_reloc = BFD_RELOC_UNUSED; + } + + return; + } + break; + + case ',': + if (*s++ == c) + continue; + s--; + switch (*++args) + { + case 'v': + ip->insn_opcode |= lastregno << MIPS16OP_SH_RX; + continue; + case 'w': + ip->insn_opcode |= lastregno << MIPS16OP_SH_RY; + continue; + } + break; + + case '(': + case ')': + if (*s++ == c) + continue; + break; + + case 'v': + case 'w': + if (s[0] != '$') + { + if (c == 'v') + ip->insn_opcode |= lastregno << MIPS16OP_SH_RX; + else + ip->insn_opcode |= lastregno << MIPS16OP_SH_RY; + ++args; + continue; + } + /* Fall through. */ + case 'x': + case 'y': + case 'z': + case 'Z': + case '0': + case 'S': + case 'R': + case 'X': + case 'Y': + if (s[0] != '$') + break; + s_reset = s; + if (isdigit (s[1])) + { + ++s; + regno = 0; + do + { + regno *= 10; + regno += *s - '0'; + ++s; + } + while (isdigit (*s)); + if (regno > 31) + { + as_bad ("invalid register number (%d)", regno); + regno = 2; + } + } + else + { + if (s[1] == 'f' && s[2] == 'p') + { + s += 3; + regno = FP; + } + else if (s[1] == 's' && s[2] == 'p') + { + s += 3; + regno = SP; + } + else if (s[1] == 'g' && s[2] == 'p') + { + s += 3; + regno = GP; + } + else if (s[1] == 'a' && s[2] == 't') + { + s += 3; + regno = AT; + } + else if (s[1] == 'k' && s[2] == 't' && s[3] == '0') + { + s += 4; + regno = KT0; + } + else if (s[1] == 'k' && s[2] == 't' && s[3] == '1') + { + s += 4; + regno = KT1; + } + else + break; + } + + if (*s == ' ') + ++s; + if (args[1] != *s) + { + if (c == 'v' || c == 'w') + { + regno = mips16_to_32_reg_map[lastregno]; + s = s_reset; + args++; + } + } + + switch (c) + { + case 'x': + case 'y': + case 'z': + case 'v': + case 'w': + case 'Z': + regno = mips32_to_16_reg_map[regno]; + break; + + case '0': + if (regno != 0) + regno = ILLEGAL_REG; + break; + + case 'S': + if (regno != SP) + regno = ILLEGAL_REG; + break; + + case 'R': + if (regno != RA) + regno = ILLEGAL_REG; + break; + + case 'X': + case 'Y': + if (regno == AT && ! mips_opts.noat) + as_warn ("used $at without \".set noat\""); + break; + + default: + internalError (); + } + + if (regno == ILLEGAL_REG) + break; + + switch (c) + { + case 'x': + case 'v': + ip->insn_opcode |= regno << MIPS16OP_SH_RX; + break; + case 'y': + case 'w': + ip->insn_opcode |= regno << MIPS16OP_SH_RY; + break; + case 'z': + ip->insn_opcode |= regno << MIPS16OP_SH_RZ; + break; + case 'Z': + ip->insn_opcode |= regno << MIPS16OP_SH_MOVE32Z; + case '0': + case 'S': + case 'R': + break; + case 'X': + ip->insn_opcode |= regno << MIPS16OP_SH_REGR32; + break; + case 'Y': + regno = ((regno & 7) << 2) | ((regno & 0x18) >> 3); + ip->insn_opcode |= regno << MIPS16OP_SH_REG32R; + break; + default: + internalError (); + } + + lastregno = regno; + continue; + + case 'P': + if (strncmp (s, "$pc", 3) == 0) + { + s += 3; + continue; + } + break; + + case '<': + case '>': + case '[': + case ']': + case '4': + case '5': + case 'H': + case 'W': + case 'D': + case 'j': + case '8': + case 'V': + case 'C': + case 'U': + case 'k': + case 'K': + if (s[0] == '%' + && strncmp (s + 1, "gprel(", sizeof "gprel(" - 1) == 0) + { + /* This is %gprel(SYMBOL). We need to read SYMBOL, + and generate the appropriate reloc. If the text + inside %gprel is not a symbol name with an + optional offset, then we generate a normal reloc + and will probably fail later. */ + my_getExpression (&imm_expr, s + sizeof "%gprel" - 1); + if (imm_expr.X_op == O_symbol) + { + mips16_ext = true; + imm_reloc = BFD_RELOC_MIPS16_GPREL; + s = expr_end; + ip->use_extend = true; + ip->extend = 0; + continue; + } + } + else + { + /* Just pick up a normal expression. */ + my_getExpression (&imm_expr, s); + } + + if (imm_expr.X_op == O_register) + { + /* What we thought was an expression turned out to + be a register. */ + + if (s[0] == '(' && args[1] == '(') + { + /* It looks like the expression was omitted + before a register indirection, which means + that the expression is implicitly zero. We + still set up imm_expr, so that we handle + explicit extensions correctly. */ + imm_expr.X_op = O_constant; + imm_expr.X_add_number = 0; + imm_reloc = (int) BFD_RELOC_UNUSED + c; + continue; + } + + break; + } + + /* We need to relax this instruction. */ + imm_reloc = (int) BFD_RELOC_UNUSED + c; + s = expr_end; + continue; + + case 'p': + case 'q': + case 'A': + case 'B': + case 'E': + /* We use offset_reloc rather than imm_reloc for the PC + relative operands. This lets macros with both + immediate and address operands work correctly. */ + my_getExpression (&offset_expr, s); + + if (offset_expr.X_op == O_register) + break; + + /* We need to relax this instruction. */ + offset_reloc = (int) BFD_RELOC_UNUSED + c; + s = expr_end; + continue; + + case '6': /* break code */ + my_getExpression (&imm_expr, s); + check_absolute_expr (ip, &imm_expr); + if ((unsigned long) imm_expr.X_add_number > 63) + { + as_warn ("Invalid value for `%s' (%lu)", + ip->insn_mo->name, + (unsigned long) imm_expr.X_add_number); + imm_expr.X_add_number &= 0x3f; + } + ip->insn_opcode |= imm_expr.X_add_number << MIPS16OP_SH_IMM6; + imm_expr.X_op = O_absent; + s = expr_end; + continue; + + case 'a': /* 26 bit address */ + my_getExpression (&offset_expr, s); + s = expr_end; + offset_reloc = BFD_RELOC_MIPS16_JMP; + ip->insn_opcode <<= 16; + continue; + + case 'l': /* register list for entry macro */ + case 'L': /* register list for exit macro */ + { + int mask; + + if (c == 'l') + mask = 0; + else + mask = 7 << 3; + while (*s != '\0') + { + int freg, reg1, reg2; + + while (*s == ' ' || *s == ',') + ++s; + if (*s != '$') + { + as_bad ("can't parse register list"); + break; + } + ++s; + if (*s != 'f') + freg = 0; + else + { + freg = 1; + ++s; + } + reg1 = 0; + while (isdigit (*s)) + { + reg1 *= 10; + reg1 += *s - '0'; + ++s; + } + if (*s == ' ') + ++s; + if (*s != '-') + reg2 = reg1; + else + { + ++s; + if (*s != '$') + break; + ++s; + if (freg) + { + if (*s == 'f') + ++s; + else + { + as_bad ("invalid register list"); + break; + } + } + reg2 = 0; + while (isdigit (*s)) + { + reg2 *= 10; + reg2 += *s - '0'; + ++s; + } + } + if (freg && reg1 == 0 && reg2 == 0 && c == 'L') + { + mask &= ~ (7 << 3); + mask |= 5 << 3; + } + else if (freg && reg1 == 0 && reg2 == 1 && c == 'L') + { + mask &= ~ (7 << 3); + mask |= 6 << 3; + } + else if (reg1 == 4 && reg2 >= 4 && reg2 <= 7 && c != 'L') + mask |= (reg2 - 3) << 3; + else if (reg1 == 16 && reg2 >= 16 && reg2 <= 17) + mask |= (reg2 - 15) << 1; + else if (reg1 == 31 && reg2 == 31) + mask |= 1; + else + { + as_bad ("invalid register list"); + break; + } + } + /* The mask is filled in in the opcode table for the + benefit of the disassembler. We remove it before + applying the actual mask. */ + ip->insn_opcode &= ~ ((7 << 3) << MIPS16OP_SH_IMM6); + ip->insn_opcode |= mask << MIPS16OP_SH_IMM6; + } + continue; + + case 'e': /* extend code */ + my_getExpression (&imm_expr, s); + check_absolute_expr (ip, &imm_expr); + if ((unsigned long) imm_expr.X_add_number > 0x7ff) + { + as_warn ("Invalid value for `%s' (%lu)", + ip->insn_mo->name, + (unsigned long) imm_expr.X_add_number); + imm_expr.X_add_number &= 0x7ff; + } + ip->insn_opcode |= imm_expr.X_add_number; + imm_expr.X_op = O_absent; + s = expr_end; + continue; + + default: + internalError (); + } + break; + } + + /* Args don't match. */ + if (insn + 1 < &mips16_opcodes[bfd_mips16_num_opcodes] && + strcmp (insn->name, insn[1].name) == 0) + { + ++insn; + s = argsstart; + continue; + } + + insn_error = "illegal operands"; + + return; + } +} + +/* This structure holds information we know about a mips16 immediate + argument type. */ + +struct mips16_immed_operand +{ + /* The type code used in the argument string in the opcode table. */ + int type; + /* The number of bits in the short form of the opcode. */ + int nbits; + /* The number of bits in the extended form of the opcode. */ + int extbits; + /* The amount by which the short form is shifted when it is used; + for example, the sw instruction has a shift count of 2. */ + int shift; + /* The amount by which the short form is shifted when it is stored + into the instruction code. */ + int op_shift; + /* Non-zero if the short form is unsigned. */ + int unsp; + /* Non-zero if the extended form is unsigned. */ + int extu; + /* Non-zero if the value is PC relative. */ + int pcrel; +}; + +/* The mips16 immediate operand types. */ + +static const struct mips16_immed_operand mips16_immed_operands[] = +{ + { '<', 3, 5, 0, MIPS16OP_SH_RZ, 1, 1, 0 }, + { '>', 3, 5, 0, MIPS16OP_SH_RX, 1, 1, 0 }, + { '[', 3, 6, 0, MIPS16OP_SH_RZ, 1, 1, 0 }, + { ']', 3, 6, 0, MIPS16OP_SH_RX, 1, 1, 0 }, + { '4', 4, 15, 0, MIPS16OP_SH_IMM4, 0, 0, 0 }, + { '5', 5, 16, 0, MIPS16OP_SH_IMM5, 1, 0, 0 }, + { 'H', 5, 16, 1, MIPS16OP_SH_IMM5, 1, 0, 0 }, + { 'W', 5, 16, 2, MIPS16OP_SH_IMM5, 1, 0, 0 }, + { 'D', 5, 16, 3, MIPS16OP_SH_IMM5, 1, 0, 0 }, + { 'j', 5, 16, 0, MIPS16OP_SH_IMM5, 0, 0, 0 }, + { '8', 8, 16, 0, MIPS16OP_SH_IMM8, 1, 0, 0 }, + { 'V', 8, 16, 2, MIPS16OP_SH_IMM8, 1, 0, 0 }, + { 'C', 8, 16, 3, MIPS16OP_SH_IMM8, 1, 0, 0 }, + { 'U', 8, 16, 0, MIPS16OP_SH_IMM8, 1, 1, 0 }, + { 'k', 8, 16, 0, MIPS16OP_SH_IMM8, 0, 0, 0 }, + { 'K', 8, 16, 3, MIPS16OP_SH_IMM8, 0, 0, 0 }, + { 'p', 8, 16, 0, MIPS16OP_SH_IMM8, 0, 0, 1 }, + { 'q', 11, 16, 0, MIPS16OP_SH_IMM8, 0, 0, 1 }, + { 'A', 8, 16, 2, MIPS16OP_SH_IMM8, 1, 0, 1 }, + { 'B', 5, 16, 3, MIPS16OP_SH_IMM5, 1, 0, 1 }, + { 'E', 5, 16, 2, MIPS16OP_SH_IMM5, 1, 0, 1 } +}; + +#define MIPS16_NUM_IMMED \ + (sizeof mips16_immed_operands / sizeof mips16_immed_operands[0]) + +/* Handle a mips16 instruction with an immediate value. This or's the + small immediate value into *INSN. It sets *USE_EXTEND to indicate + whether an extended value is needed; if one is needed, it sets + *EXTEND to the value. The argument type is TYPE. The value is VAL. + If SMALL is true, an unextended opcode was explicitly requested. + If EXT is true, an extended opcode was explicitly requested. If + WARN is true, warn if EXT does not match reality. */ + +static void +mips16_immed (file, line, type, val, warn, small, ext, insn, use_extend, + extend) + char *file; + unsigned int line; + int type; + offsetT val; + boolean warn; + boolean small; + boolean ext; + unsigned long *insn; + boolean *use_extend; + unsigned short *extend; +{ + register const struct mips16_immed_operand *op; + int mintiny, maxtiny; + boolean needext; + + op = mips16_immed_operands; + while (op->type != type) + { + ++op; + assert (op < mips16_immed_operands + MIPS16_NUM_IMMED); + } + + if (op->unsp) + { + if (type == '<' || type == '>' || type == '[' || type == ']') + { + mintiny = 1; + maxtiny = 1 << op->nbits; + } + else + { + mintiny = 0; + maxtiny = (1 << op->nbits) - 1; + } + } + else + { + mintiny = - (1 << (op->nbits - 1)); + maxtiny = (1 << (op->nbits - 1)) - 1; + } + + /* Branch offsets have an implicit 0 in the lowest bit. */ + if (type == 'p' || type == 'q') + val /= 2; + + if ((val & ((1 << op->shift) - 1)) != 0 + || val < (mintiny << op->shift) + || val > (maxtiny << op->shift)) + needext = true; + else + needext = false; + + if (warn && ext && ! needext) + as_warn_where (file, line, "extended operand requested but not required"); + if (small && needext) + as_bad_where (file, line, "invalid unextended operand value"); + + if (small || (! ext && ! needext)) + { + int insnval; + + *use_extend = false; + insnval = ((val >> op->shift) & ((1 << op->nbits) - 1)); + insnval <<= op->op_shift; + *insn |= insnval; + } + else + { + long minext, maxext; + int extval; + + if (op->extu) + { + minext = 0; + maxext = (1 << op->extbits) - 1; + } + else + { + minext = - (1 << (op->extbits - 1)); + maxext = (1 << (op->extbits - 1)) - 1; + } + if (val < minext || val > maxext) + as_bad_where (file, line, + "operand value out of range for instruction"); + + *use_extend = true; + if (op->extbits == 16) + { + extval = ((val >> 11) & 0x1f) | (val & 0x7e0); + val &= 0x1f; + } + else if (op->extbits == 15) + { + extval = ((val >> 11) & 0xf) | (val & 0x7f0); + val &= 0xf; + } + else + { + extval = ((val & 0x1f) << 6) | (val & 0x20); + val = 0; + } + + *extend = (unsigned short) extval; + *insn |= val; + } +} + #define LP '(' #define RP ')' @@ -5894,6 +7965,19 @@ expression (ep); expr_end = input_line_pointer; input_line_pointer = save_in; + + /* If we are in mips16 mode, and this is an expression based on `.', + then we bump the value of the symbol by 1 since that is how other + text symbols are handled. We don't bother to handle complex + expressions, just `.' plus or minus a constant. */ + if (mips_opts.mips16 + && ep->X_op == O_symbol + && strcmp (S_GET_NAME (ep->X_add_symbol), FAKE_LABEL_NAME) == 0 + && S_GET_SEGMENT (ep->X_add_symbol) == now_seg + && ep->X_add_symbol->sy_frag == frag_now + && ep->X_add_symbol->sy_value.X_op == O_constant + && ep->X_add_symbol->sy_value.X_add_number == frag_now_fix ()) + ++ep->X_add_symbol->sy_value.X_add_number; } /* Turn a string in input_line_pointer into a floating point constant @@ -5933,7 +8017,7 @@ *sizeP = prec * 2; - if (byte_order == LITTLE_ENDIAN) + if (! target_big_endian) { for (i = prec - 1; i >= 0; i--) { @@ -5959,19 +8043,10 @@ valueT val; int n; { - switch (byte_order) - { - case LITTLE_ENDIAN: - number_to_chars_littleendian (buf, val, n); - break; - - case BIG_ENDIAN: - number_to_chars_bigendian (buf, val, n); - break; - - default: - internalError (); - } + if (target_big_endian) + number_to_chars_bigendian (buf, val, n); + else + number_to_chars_littleendian (buf, val, n); } CONST char *md_shortopts = "O::g::G:"; @@ -6012,6 +8087,10 @@ {"m4100", no_argument, NULL, OPTION_M4100}, #define OPTION_NO_M4100 (OPTION_MD_BASE + 18) {"no-m4100", no_argument, NULL, OPTION_NO_M4100}, +#define OPTION_MIPS16 (OPTION_MD_BASE + 22) + {"mips16", no_argument, NULL, OPTION_MIPS16}, +#define OPTION_NO_MIPS16 (OPTION_MD_BASE + 23) + {"no-mips16", no_argument, NULL, OPTION_NO_MIPS16}, #define OPTION_CALL_SHARED (OPTION_MD_BASE + 7) #define OPTION_NON_SHARED (OPTION_MD_BASE + 8) @@ -6070,29 +8149,29 @@ optimizations which limit full symbolic debugging. We take that to be equivalent to -O0. */ if (mips_debug == 2) - mips_optimize = 0; + mips_optimize = 1; break; case OPTION_MIPS1: - mips_isa = 1; + mips_opts.isa = 1; if (mips_cpu == -1) mips_cpu = 3000; break; case OPTION_MIPS2: - mips_isa = 2; + mips_opts.isa = 2; if (mips_cpu == -1) mips_cpu = 6000; break; case OPTION_MIPS3: - mips_isa = 3; + mips_opts.isa = 3; if (mips_cpu == -1) mips_cpu = 4000; break; case OPTION_MIPS4: - mips_isa = 4; + mips_opts.isa = 4; if (mips_cpu == -1) mips_cpu = 8000; break; @@ -6176,6 +8255,13 @@ } break; + case '5': + if (strcmp (p, "5000") == 0 + || strcmp (p, "5k") == 0 + || strcmp (p, "5K") == 0) + mips_cpu = 5000; + break; + case '6': if (strcmp (p, "6000") == 0 || strcmp (p, "6k") == 0 @@ -6196,7 +8282,7 @@ break; } - if (sv && mips_cpu != 4300 && mips_cpu != 4100) + if (sv && mips_cpu != 4300 && mips_cpu != 4100 && mips_cpu != 5000) { as_bad ("ignoring invalid leading 'v' in -mcpu=%s switch", arg); return 0; @@ -6235,6 +8321,17 @@ mips_4100 = 0; break; + + case OPTION_MIPS16: + mips_opts.mips16 = 1; + mips_no_prev_insn (false); + break; + + case OPTION_NO_MIPS16: + mips_opts.mips16 = 0; + mips_no_prev_insn (false); + break; + case OPTION_MEMBEDDED_PIC: mips_pic = EMBEDDED_PIC; if (USE_GLOBAL_POINTER_OPT && g_switch_seen) @@ -6350,6 +8447,9 @@ -m4100 permit VR4100 instructions\n\ -no-m4100 do not permit VR4100 instructions\n"); fprintf(stream, "\ +-mips16 generate mips16 instructions\n\ +-no-mips16 do not generate mips16 instructions\n"); + fprintf(stream, "\ -O0 remove unneeded NOPs, do not swap branches\n\ -O remove unneeded NOPs and swap branches\n\ --trap, --no-break trap exception on div by 0 and mult overflow\n\ @@ -6363,16 +8463,15 @@ -64 create 64 bit object file\n"); #endif } - + void mips_init_after_args () { - if (target_big_endian) - byte_order = BIG_ENDIAN; - else - byte_order = LITTLE_ENDIAN; + /* initialize opcodes */ + bfd_mips_num_opcodes = bfd_mips_num_builtin_opcodes; + mips_opcodes = (struct mips_opcode*) mips_builtin_opcodes; } - + long md_pcrel_from (fixP) fixS *fixP; @@ -6401,14 +8500,16 @@ unsigned int nbytes; expressionS *exp; { +#ifndef OBJ_ELF /* If we are assembling in 32 bit mode, turn an 8 byte reloc into a 4 byte reloc. */ if (nbytes == 8 && ! mips_64) { - if (byte_order == BIG_ENDIAN) + if (target_big_endian) where += 4; nbytes = 4; } +#endif if (nbytes != 2 && nbytes != 4 && nbytes != 8) as_bad ("Unsupported reloc size %d", nbytes); @@ -6419,6 +8520,24 @@ : (nbytes == 4 ? BFD_RELOC_32 : BFD_RELOC_64))); } +/* This is called before the symbol table is processed. In order to + work with gcc when using mips-tfile, we must keep all local labels. + However, in other cases, we want to discard them. If we were + called with -g, but we didn't see any debugging information, it may + mean that gcc is smuggling debugging information through to + mips-tfile, in which case we must generate all local labels. */ + +void +mips_frob_file_before_adjust () +{ +#ifndef NO_ECOFF_DEBUGGING + if (ECOFF_DEBUGGING + && mips_debug != 0 + && ! ecoff_debugging_seen) + flag_keep_locals = 1; +#endif +} + /* Sort any unmatched HI16_S relocs so that they immediately precede the corresponding LO reloc. This is called before md_apply_fix and tc_gen_reloc. Unmatched HI16_S relocs can only be generated by @@ -6537,9 +8656,30 @@ unsigned char *buf; long insn, value; - assert (fixP->fx_size == 4 || fixP->fx_r_type == BFD_RELOC_16); + assert (fixP->fx_size == 4 + || fixP->fx_r_type == BFD_RELOC_16 + || fixP->fx_r_type == BFD_RELOC_64); value = *valueP; + + /* If we aren't adjusting this fixup to be against the section + symbol, we need to adjust the value. */ +#ifdef OBJ_ELF + if (fixP->fx_addsy != NULL + && OUTPUT_FLAVOR == bfd_target_elf_flavour + && S_GET_OTHER (fixP->fx_addsy) == STO_MIPS16) + { + value -= S_GET_VALUE (fixP->fx_addsy); + if (value != 0 && ! fixP->fx_pcrel) + { + /* In this case, the bfd_install_relocation routine will + incorrectly add the symbol value back in. We just want + the addend to appear in the object file. */ + value -= S_GET_VALUE (fixP->fx_addsy); + } + } +#endif + fixP->fx_addnumber = value; /* Remember value for tc_gen_reloc */ if (fixP->fx_addsy == NULL && ! fixP->fx_pcrel) @@ -6559,15 +8699,23 @@ case BFD_RELOC_MIPS_GOT_LO16: case BFD_RELOC_MIPS_CALL_HI16: case BFD_RELOC_MIPS_CALL_LO16: + case BFD_RELOC_MIPS16_GPREL: if (fixP->fx_pcrel) as_bad_where (fixP->fx_file, fixP->fx_line, "Invalid PC relative reloc"); /* Nothing needed to do. The value comes from the reloc entry */ break; + case BFD_RELOC_MIPS16_JMP: + /* We currently always generate a reloc against a symbol, which + means that we don't want an addend even if the symbol is + defined. */ + fixP->fx_addnumber = 0; + break; + case BFD_RELOC_PCREL_HI16_S: /* The addend for this is tricky if it is internal, so we just - do everything here rather than in bfd_perform_relocation. */ + do everything here rather than in bfd_install_relocation. */ if ((fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) == 0) { /* For an external symbol adjust by the address to make it @@ -6580,22 +8728,51 @@ value += 0x10000; value >>= 16; buf = (unsigned char *) fixP->fx_frag->fr_literal + fixP->fx_where; - if (byte_order == BIG_ENDIAN) + if (target_big_endian) buf += 2; md_number_to_chars (buf, value, 2); break; case BFD_RELOC_PCREL_LO16: /* The addend for this is tricky if it is internal, so we just - do everything here rather than in bfd_perform_relocation. */ + do everything here rather than in bfd_install_relocation. */ if ((fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) == 0) value += fixP->fx_frag->fr_address + fixP->fx_where; buf = (unsigned char *) fixP->fx_frag->fr_literal + fixP->fx_where; - if (byte_order == BIG_ENDIAN) + if (target_big_endian) buf += 2; md_number_to_chars (buf, value, 2); break; + case BFD_RELOC_64: + /* This is handled like BFD_RELOC_32, but we output a sign + extended value if we are only 32 bits. */ + if (fixP->fx_done + || (mips_pic == EMBEDDED_PIC && SWITCH_TABLE (fixP))) + { + if (8 <= sizeof (valueT)) + md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where, + value, 8); + else + { + long w1, w2; + long hiv; + + w1 = w2 = fixP->fx_where; + if (target_big_endian) + w1 += 4; + else + w2 += 4; + md_number_to_chars (fixP->fx_frag->fr_literal + w1, value, 4); + if ((value & 0x80000000) != 0) + hiv = 0xffffffff; + else + hiv = 0; + md_number_to_chars (fixP->fx_frag->fr_literal + w2, hiv, 4); + } + } + break; + case BFD_RELOC_32: /* If we are deleting this reloc entry, we must fill in the value now. This can happen if we have a .word which is not @@ -6626,7 +8803,7 @@ as_bad_where (fixP->fx_file, fixP->fx_line, "relocation overflow"); buf = (unsigned char *) fixP->fx_frag->fr_literal + fixP->fx_where; - if (byte_order == BIG_ENDIAN) + if (target_big_endian) buf += 2; md_number_to_chars (buf, value, 2); } @@ -6638,27 +8815,17 @@ * might be deleting the relocation entry (i.e., a branch within * the current segment). */ - if (value & 0x3) - as_warn_where (fixP->fx_file, fixP->fx_line, - "Branch to odd address (%lx)", value); + if ((value & 0x3) != 0) + as_bad_where (fixP->fx_file, fixP->fx_line, + "Branch to odd address (%lx)", value); value >>= 2; /* update old instruction data */ buf = (unsigned char *) (fixP->fx_where + fixP->fx_frag->fr_literal); - switch (byte_order) - { - case LITTLE_ENDIAN: - insn = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; - break; - - case BIG_ENDIAN: - insn = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; - break; - - default: - internalError (); - return 0; - } + if (target_big_endian) + insn = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; + else + insn = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; if (value >= -0x8000 && value < 0x8000) insn |= value & 0xffff; @@ -6695,7 +8862,7 @@ handle these cases, but it appears to do it incorrectly. */ as_bad_where (fixP->fx_file, fixP->fx_line, - "Relocation overflow"); + "Branch out of range"); } } @@ -6820,8 +8987,8 @@ int fill; symbolS *label; { - mips_emit_delays (); - frag_align (to, fill); + mips_emit_delays (false); + frag_align (to, fill, 0); record_alignment (now_seg, to); if (label != NULL) { @@ -6872,7 +9039,8 @@ if (temp) { auto_align = 1; - mips_align (temp, (int) temp_fill, insn_label); + mips_align (temp, (int) temp_fill, + insn_labels != NULL ? insn_labels->label : NULL); } else { @@ -6885,8 +9053,8 @@ void mips_flush_pending_output () { - mips_emit_delays (); - insn_label = NULL; + mips_emit_delays (false); + mips_clear_insn_labels (); } static void @@ -6902,7 +9070,17 @@ && (sec == 'd' || sec == 'r')) sec = 's'; - mips_emit_delays (); +#ifdef OBJ_ELF + /* The ELF backend needs to know that we are changing sections, so + that .previous works correctly. We could do something like check + for a obj_section_change_hook macro, but that might be confusing + as it would not be appropriate to use it in the section changing + functions in read.c, since obj-elf.c intercepts those. FIXME: + This should be cleaner, somehow. */ + obj_elf_section_change_hook (); +#endif + + mips_emit_delays (false); switch (sec) { case 't': @@ -6929,7 +9107,8 @@ | SEC_READONLY | SEC_RELOC | SEC_DATA)); - bfd_set_section_alignment (stdoutput, seg, 4); + if (strcmp (TARGET_OS, "elf") != 0) + bfd_set_section_alignment (stdoutput, seg, 4); } demand_empty_rest_of_line (); } @@ -6950,7 +9129,8 @@ bfd_set_section_flags (stdoutput, seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA); - bfd_set_section_alignment (stdoutput, seg, 4); + if (strcmp (TARGET_OS, "elf") != 0) + bfd_set_section_alignment (stdoutput, seg, 4); } demand_empty_rest_of_line (); break; @@ -6978,11 +9158,11 @@ { symbolS *label; - label = insn_label; - mips_emit_delays (); + label = insn_labels != NULL ? insn_labels->label : NULL; + mips_emit_delays (false); if (log_size > 0 && auto_align) mips_align (log_size, 0, label); - insn_label = NULL; + mips_clear_insn_labels (); cons (1 << log_size); } @@ -6992,9 +9172,9 @@ { symbolS *label; - label = insn_label; + label = insn_labels != NULL ? insn_labels->label : NULL; - mips_emit_delays (); + mips_emit_delays (false); if (auto_align) if (type == 'd') @@ -7002,7 +9182,7 @@ else mips_align (2, 0, label); - insn_label = NULL; + mips_clear_insn_labels (); float_cons (type); } @@ -7095,6 +9275,18 @@ demand_empty_rest_of_line (); } +/* This structure is used to hold a stack of .set values. */ + +struct mips_option_stack +{ + struct mips_option_stack *next; + struct mips_set_options options; +}; + +static struct mips_option_stack *mips_opts_stack; + +/* Handle the .set pseudo-op. */ + static void s_mipsset (x) int x; @@ -7108,53 +9300,63 @@ if (strcmp (name, "reorder") == 0) { - if (mips_noreorder) + if (mips_opts.noreorder && prev_nop_frag != NULL) { - prev_insn_unreordered = 1; - prev_prev_insn_unreordered = 1; + /* If we still have pending nops, we can discard them. The + usual nop handling will insert any that are still + needed. */ + prev_nop_frag->fr_fix -= (prev_nop_frag_holds + * (mips_opts.mips16 ? 2 : 4)); + prev_nop_frag = NULL; } - mips_noreorder = 0; + mips_opts.noreorder = 0; } else if (strcmp (name, "noreorder") == 0) { - mips_emit_delays (); - mips_noreorder = 1; + mips_emit_delays (true); + mips_opts.noreorder = 1; mips_any_noreorder = 1; } else if (strcmp (name, "at") == 0) { - mips_noat = 0; + mips_opts.noat = 0; } else if (strcmp (name, "noat") == 0) { - mips_noat = 1; + mips_opts.noat = 1; } else if (strcmp (name, "macro") == 0) { - mips_warn_about_macros = 0; + mips_opts.warn_about_macros = 0; } else if (strcmp (name, "nomacro") == 0) { - if (mips_noreorder == 0) + if (mips_opts.noreorder == 0) as_bad ("`noreorder' must be set before `nomacro'"); - mips_warn_about_macros = 1; + mips_opts.warn_about_macros = 1; } else if (strcmp (name, "move") == 0 || strcmp (name, "novolatile") == 0) { - mips_nomove = 0; + mips_opts.nomove = 0; } else if (strcmp (name, "nomove") == 0 || strcmp (name, "volatile") == 0) { - mips_nomove = 1; + mips_opts.nomove = 1; } else if (strcmp (name, "bopt") == 0) { - mips_nobopt = 0; + mips_opts.nobopt = 0; } else if (strcmp (name, "nobopt") == 0) { - mips_nobopt = 1; + mips_opts.nobopt = 1; } + else if (strcmp (name, "mips16") == 0 + || strcmp (name, "MIPS-16") == 0) + mips_opts.mips16 = 1; + else if (strcmp (name, "nomips16") == 0 + || strcmp (name, "noMIPS-16") == 0) + mips_opts.mips16 = 0; else if (strncmp (name, "mips", 4) == 0) { int isa; @@ -7163,11 +9365,52 @@ say, misuse can cause serious problems. */ isa = atoi (name + 4); if (isa == 0) - mips_isa = file_mips_isa; + mips_opts.isa = file_mips_isa; else if (isa < 1 || isa > 4) as_bad ("unknown ISA level"); else - mips_isa = isa; + mips_opts.isa = isa; + } + else if (strcmp (name, "autoextend") == 0) + mips_opts.noautoextend = 0; + else if (strcmp (name, "noautoextend") == 0) + mips_opts.noautoextend = 1; + else if (strcmp (name, "push") == 0) + { + struct mips_option_stack *s; + + s = (struct mips_option_stack *) xmalloc (sizeof *s); + s->next = mips_opts_stack; + s->options = mips_opts; + mips_opts_stack = s; + } + else if (strcmp (name, "pop") == 0) + { + struct mips_option_stack *s; + + s = mips_opts_stack; + if (s == NULL) + as_bad (".set pop with no .set push"); + else + { + /* If we're changing the reorder mode we need to handle + delay slots correctly. */ + if (s->options.noreorder && ! mips_opts.noreorder) + mips_emit_delays (true); + else if (! s->options.noreorder && mips_opts.noreorder) + { + if (prev_nop_frag != NULL) + { + prev_nop_frag->fr_fix -= (prev_nop_frag_holds + * (mips_opts.mips16 ? 2 : 4)); + prev_nop_frag = NULL; + } + } + + mips_opts = s->options; + mips_opts_stack = s->next; + free (s); + } } else { @@ -7220,7 +9463,7 @@ } /* .cpload should be a in .set noreorder section. */ - if (mips_noreorder == 0) + if (mips_opts.noreorder == 0) as_warn (".cpload not in noreorder section"); ex.X_op = O_symbol; @@ -7267,7 +9510,7 @@ ex.X_add_number = mips_cprestore_offset; macro_build ((char *) NULL, &icnt, &ex, - mips_isa < 3 ? "sw" : "sd", + mips_opts.isa < 3 ? "sw" : "sd", "t,o(b)", GP, (int) BFD_RELOC_LO16, SP); demand_empty_rest_of_line (); @@ -7291,11 +9534,11 @@ return; } - label = insn_label; - mips_emit_delays (); + label = insn_labels != NULL ? insn_labels->label : NULL; + mips_emit_delays (true); if (auto_align) mips_align (2, 0, label); - insn_label = NULL; + mips_clear_insn_labels (); expression (&ex); @@ -7333,12 +9576,47 @@ /* Add $gp to the register named as an argument. */ reg = tc_get_register (0); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - mips_isa < 3 ? "addu" : "daddu", + mips_opts.isa < 3 ? "addu" : "daddu", "d,v,t", reg, reg, GP); demand_empty_rest_of_line (); } +/* Handle the .insn pseudo-op. This marks instruction labels in + mips16 mode. This permits the linker to handle them specially, + such as generating jalx instructions when needed. We also make + them odd for the duration of the assembly, in order to generate the + right sort of code. We will make them even in the adjust_symtab + routine, while leaving them marked. This is convenient for the + debugger and the disassembler. The linker knows to make them odd + again. */ + +static void +s_insn (ignore) + int ignore; +{ + if (mips_opts.mips16) + mips16_mark_labels (); + + demand_empty_rest_of_line (); +} + +/* Handle a .stabn directive. We need these in order to mark a label + as being a mips16 text label correctly. Sometimes the compiler + will emit a label, followed by a .stabn, and then switch sections. + If the label and .stabn are in mips16 mode, then the label is + really a mips16 text label. */ + +static void +s_mips_stab (type) + int type; +{ + if (type == 'n' && mips_opts.mips16) + mips16_mark_labels (); + + s_stab (type); +} + /* Parse a register string into a number. Called from the ECOFF code to parse .frame. The argument is non-zero if this is the frame register, so that we can record it in mips_frame_reg. */ @@ -7393,6 +9671,17 @@ { int align = bfd_get_section_alignment (stdoutput, seg); +#ifdef OBJ_ELF + /* We don't need to align ELF sections to the full alignment. + However, Irix 5 may prefer that we align them at least to a 16 + byte boundary. We don't bother to align the sections if we are + targeted for an embedded system. */ + if (strcmp (TARGET_OS, "elf") == 0) + return addr; + if (align > 4) + align = 4; +#endif + return ((addr + (1 << align) - 1) & (-1 << align)); } @@ -7402,8 +9691,9 @@ undefined earlier.) */ static int -nopic_need_relax (sym) +nopic_need_relax (sym, before_relaxing) symbolS *sym; + int before_relaxing; { if (sym == 0) return 0; @@ -7430,12 +9720,20 @@ || strcmp (symname, "end") == 0 || strcmp (symname, "_gp_disp") == 0)) change = 1; - else if (! S_IS_DEFINED (sym) + else if ((! S_IS_DEFINED (sym) || S_IS_COMMON (sym)) && (0 #ifndef NO_ECOFF_DEBUGGING || (sym->ecoff_extern_size != 0 && sym->ecoff_extern_size <= g_switch_value) #endif + /* We must defer this decision until after the whole + file has been read, since there might be a .extern + after the first use of this symbol. */ + || (before_relaxing +#ifndef NO_ECOFF_DEBUGGING + && sym->ecoff_extern_size == 0 +#endif + && S_GET_VALUE (sym) == 0) || (S_GET_VALUE (sym) != 0 && S_GET_VALUE (sym) <= g_switch_value))) change = 0; @@ -7456,9 +9754,221 @@ return 1; } -/* Estimate the size of a frag before relaxing. We are not really - relaxing here, and the final size is encoded in the subtype - information. */ +/* Given a mips16 variant frag FRAGP, return non-zero if it needs an + extended opcode. SEC is the section the frag is in. */ + +static int +mips16_extended_frag (fragp, sec, stretch) + fragS *fragp; + asection *sec; + long stretch; +{ + int type; + register const struct mips16_immed_operand *op; + offsetT val; + int mintiny, maxtiny; + segT symsec; + + if (RELAX_MIPS16_USER_SMALL (fragp->fr_subtype)) + return 0; + if (RELAX_MIPS16_USER_EXT (fragp->fr_subtype)) + return 1; + + type = RELAX_MIPS16_TYPE (fragp->fr_subtype); + op = mips16_immed_operands; + while (op->type != type) + { + ++op; + assert (op < mips16_immed_operands + MIPS16_NUM_IMMED); + } + + if (op->unsp) + { + if (type == '<' || type == '>' || type == '[' || type == ']') + { + mintiny = 1; + maxtiny = 1 << op->nbits; + } + else + { + mintiny = 0; + maxtiny = (1 << op->nbits) - 1; + } + } + else + { + mintiny = - (1 << (op->nbits - 1)); + maxtiny = (1 << (op->nbits - 1)) - 1; + } + + /* We can't call S_GET_VALUE here, because we don't want to lock in + a particular frag address. */ + if (fragp->fr_symbol->sy_value.X_op == O_constant) + { + val = (fragp->fr_symbol->sy_value.X_add_number + + fragp->fr_symbol->sy_frag->fr_address); + symsec = S_GET_SEGMENT (fragp->fr_symbol); + } + else if (fragp->fr_symbol->sy_value.X_op == O_symbol + && (fragp->fr_symbol->sy_value.X_add_symbol->sy_value.X_op + == O_constant)) + { + val = (fragp->fr_symbol->sy_value.X_add_symbol->sy_value.X_add_number + + fragp->fr_symbol->sy_value.X_add_symbol->sy_frag->fr_address + + fragp->fr_symbol->sy_value.X_add_number + + fragp->fr_symbol->sy_frag->fr_address); + symsec = S_GET_SEGMENT (fragp->fr_symbol->sy_value.X_add_symbol); + } + else + return 1; + + if (op->pcrel) + { + addressT addr; + + /* We won't have the section when we are called from + mips_relax_frag. However, we will always have been called + from md_estimate_size_before_relax first. If this is a + branch to a different section, we mark it as such. If SEC is + NULL, and the frag is not marked, then it must be a branch to + the same section. */ + if (sec == NULL) + { + if (RELAX_MIPS16_LONG_BRANCH (fragp->fr_subtype)) + return 1; + } + else + { + if (symsec != sec) + { + fragp->fr_subtype = + RELAX_MIPS16_MARK_LONG_BRANCH (fragp->fr_subtype); + + /* FIXME: We should support this, and let the linker + catch branches and loads that are out of range. */ + as_bad_where (fragp->fr_file, fragp->fr_line, + "unsupported PC relative reference to different section"); + + return 1; + } + } + + /* In this case, we know for sure that the symbol fragment is in + the same section. If the fr_address of the symbol fragment + is greater then the address of this fragment we want to add + in STRETCH in order to get a better estimate of the address. + This particularly matters because of the shift bits. */ + if (stretch != 0 + && fragp->fr_symbol->sy_frag->fr_address >= fragp->fr_address) + { + fragS *f; + + /* Adjust stretch for any alignment frag. Note that if have + been expanding the earlier code, the symbol may be + defined in what appears to be an earlier frag. FIXME: + This doesn't handle the fr_subtype field, which specifies + a maximum number of bytes to skip when doing an + alignment. */ + for (f = fragp; + f != NULL && f != fragp->fr_symbol->sy_frag; + f = f->fr_next) + { + if (f->fr_type == rs_align || f->fr_type == rs_align_code) + { + if (stretch < 0) + stretch = - ((- stretch) + & ~ ((1 << (int) f->fr_offset) - 1)); + else + stretch &= ~ ((1 << (int) f->fr_offset) - 1); + if (stretch == 0) + break; + } + } + if (f != NULL) + val += stretch; + } + + addr = fragp->fr_address + fragp->fr_fix; + + /* The base address rules are complicated. The base address of + a branch is the following instruction. The base address of a + PC relative load or add is the instruction itself, but if it + is in a delay slot (in which case it can not be extended) use + the address of the instruction whose delay slot it is in. */ + if (type == 'p' || type == 'q') + { + addr += 2; + + /* If we are currently assuming that this frag should be + extended, then, the current address is two bytes + higher. */ + if (RELAX_MIPS16_EXTENDED (fragp->fr_subtype)) + addr += 2; + + /* Ignore the low bit in the target, since it will be set + for a text label. */ + if ((val & 1) != 0) + --val; + } + else if (RELAX_MIPS16_JAL_DSLOT (fragp->fr_subtype)) + addr -= 4; + else if (RELAX_MIPS16_DSLOT (fragp->fr_subtype)) + addr -= 2; + + val -= addr & ~ ((1 << op->shift) - 1); + + /* Branch offsets have an implicit 0 in the lowest bit. */ + if (type == 'p' || type == 'q') + val /= 2; + + /* If any of the shifted bits are set, we must use an extended + opcode. If the address depends on the size of this + instruction, this can lead to a loop, so we arrange to always + use an extended opcode. We only check this when we are in + the main relaxation loop, when SEC is NULL. */ + if ((val & ((1 << op->shift) - 1)) != 0 && sec == NULL) + { + fragp->fr_subtype = + RELAX_MIPS16_MARK_LONG_BRANCH (fragp->fr_subtype); + return 1; + } + + /* If we are about to mark a frag as extended because the value + is precisely maxtiny + 1, then there is a chance of an + infinite loop as in the following code: + la $4,foo + .skip 1020 + .align 2 + foo: + In this case when the la is extended, foo is 0x3fc bytes + away, so the la can be shrunk, but then foo is 0x400 away, so + the la must be extended. To avoid this loop, we mark the + frag as extended if it was small, and is about to become + extended with a value of maxtiny + 1. */ + if (val == ((maxtiny + 1) << op->shift) + && ! RELAX_MIPS16_EXTENDED (fragp->fr_subtype) + && sec == NULL) + { + fragp->fr_subtype = + RELAX_MIPS16_MARK_LONG_BRANCH (fragp->fr_subtype); + return 1; + } + } + else if (symsec != absolute_section && sec != NULL) + as_bad_where (fragp->fr_file, fragp->fr_line, "unsupported relocation"); + + if ((val & ((1 << op->shift) - 1)) != 0 + || val < (mintiny << op->shift) + || val > (maxtiny << op->shift)) + return 1; + else + return 0; +} + +/* Estimate the size of a frag before relaxing. Unless this is the + mips16, we are not really relaxing here, and the final size is + encoded in the subtype information. For the mips16, we have to + decide whether we are using an extended opcode or not. */ /*ARGSUSED*/ int @@ -7468,13 +9978,46 @@ { int change; + if (RELAX_MIPS16_P (fragp->fr_subtype)) + { + if (mips16_extended_frag (fragp, segtype, 0)) + { + fragp->fr_subtype = RELAX_MIPS16_MARK_EXTENDED (fragp->fr_subtype); + return 4; + } + else + { + fragp->fr_subtype = RELAX_MIPS16_CLEAR_EXTENDED (fragp->fr_subtype); + return 2; + } + } + if (mips_pic == NO_PIC) { - change = nopic_need_relax (fragp->fr_symbol); + change = nopic_need_relax (fragp->fr_symbol, 0); } else if (mips_pic == SVR4_PIC) { - asection *symsec = fragp->fr_symbol->bsym->section; + symbolS *sym; + asection *symsec; + + sym = fragp->fr_symbol; + + /* Handle the case of a symbol equated to another symbol. */ + while (sym->sy_value.X_op == O_symbol + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) + { + symbolS *n; + + /* It's possible to get a loop here in a badly written + program. */ + n = sym->sy_value.X_add_symbol; + if (n == sym) + break; + sym = n; + } + + symsec = S_GET_SEGMENT (sym); /* This must duplicate the test in adjust_reloc_syms. */ change = (symsec != &bfd_und_section @@ -7504,6 +10047,30 @@ return RELAX_NEW (fragp->fr_subtype) - RELAX_OLD (fragp->fr_subtype); } +/* This is called to see whether a reloc against a defined symbol + should be converted into a reloc against a section. Don't adjust + MIPS16 jump relocations, so we don't have to worry about the format + of the offset in the .o file. Don't adjust relocations against + mips16 symbols, so that the linker can find them if it needs to set + up a stub. */ + +int +mips_fix_adjustable (fixp) + fixS *fixp; +{ + if (fixp->fx_r_type == BFD_RELOC_MIPS16_JMP) + return 0; + if (fixp->fx_addsy == NULL) + return 1; +#ifdef OBJ_ELF + if (OUTPUT_FLAVOR == bfd_target_elf_flavour + && S_GET_OTHER (fixp->fx_addsy) == STO_MIPS16 + && fixp->fx_subsy == NULL) + return 0; +#endif + return 1; +} + /* Translate internal representation of relocation info to BFD target format. */ @@ -7514,6 +10081,7 @@ { static arelent *retval[4]; arelent *reloc; + bfd_reloc_code_real_type code; reloc = retval[0] = (arelent *) xmalloc (sizeof (arelent)); retval[1] = NULL; @@ -7581,6 +10149,8 @@ { arelent *reloc2; + assert (! RELAX_MIPS16_P (fixp->fx_frag->fr_subtype)); + /* If this is not the last reloc in this frag, then we have two GPREL relocs, or a GOT_HI16/GOT_LO16 pair, or a CALL_HI16/CALL_LO16, both of which are being replaced. Let @@ -7646,26 +10216,92 @@ abort (); } + /* Since DIFF_EXPR_OK is defined in tc-mips.h, it is possible that + fixup_segment converted a non-PC relative reloc into a PC + relative reloc. In such a case, we need to convert the reloc + code. */ + code = fixp->fx_r_type; + if (fixp->fx_pcrel) + { + switch (code) + { + case BFD_RELOC_8: + code = BFD_RELOC_8_PCREL; + break; + case BFD_RELOC_16: + code = BFD_RELOC_16_PCREL; + break; + case BFD_RELOC_32: + code = BFD_RELOC_32_PCREL; + break; + case BFD_RELOC_64: + code = BFD_RELOC_64_PCREL; + break; + case BFD_RELOC_8_PCREL: + case BFD_RELOC_16_PCREL: + case BFD_RELOC_32_PCREL: + case BFD_RELOC_64_PCREL: + case BFD_RELOC_16_PCREL_S2: + case BFD_RELOC_PCREL_HI16_S: + case BFD_RELOC_PCREL_LO16: + break; + default: + as_bad_where (fixp->fx_file, fixp->fx_line, + "Cannot make %s relocation PC relative", + bfd_get_reloc_code_name (code)); + } + } + /* To support a PC relative reloc when generating embedded PIC code for ECOFF, we use a Cygnus extension. We check for that here to make sure that we don't let such a reloc escape normally. */ if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour - && fixp->fx_r_type == BFD_RELOC_16_PCREL_S2 + && code == BFD_RELOC_16_PCREL_S2 && mips_pic != EMBEDDED_PIC) reloc->howto = NULL; else - reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); + reloc->howto = bfd_reloc_type_lookup (stdoutput, code); if (reloc->howto == NULL) { as_bad_where (fixp->fx_file, fixp->fx_line, - "Can not represent relocation in this object file format"); + "Can not represent %s relocation in this object file format", + bfd_get_reloc_code_name (code)); retval[0] = NULL; } return retval; } +/* Relax a machine dependent frag. This returns the amount by which + the current size of the frag should change. */ + +int +mips_relax_frag (fragp, stretch) + fragS *fragp; + long stretch; +{ + if (! RELAX_MIPS16_P (fragp->fr_subtype)) + return 0; + + if (mips16_extended_frag (fragp, (asection *) NULL, stretch)) + { + if (RELAX_MIPS16_EXTENDED (fragp->fr_subtype)) + return 0; + fragp->fr_subtype = RELAX_MIPS16_MARK_EXTENDED (fragp->fr_subtype); + return 2; + } + else + { + if (! RELAX_MIPS16_EXTENDED (fragp->fr_subtype)) + return 0; + fragp->fr_subtype = RELAX_MIPS16_CLEAR_EXTENDED (fragp->fr_subtype); + return -2; + } + + return 0; +} + /* Convert a machine dependent frag. */ void @@ -7677,19 +10313,144 @@ int old, new; char *fixptr; - if (fragp->fr_opcode == NULL) - return; + if (RELAX_MIPS16_P (fragp->fr_subtype)) + { + int type; + register const struct mips16_immed_operand *op; + boolean small, ext; + offsetT val; + bfd_byte *buf; + unsigned long insn; + boolean use_extend; + unsigned short extend; + + type = RELAX_MIPS16_TYPE (fragp->fr_subtype); + op = mips16_immed_operands; + while (op->type != type) + ++op; + + if (RELAX_MIPS16_EXTENDED (fragp->fr_subtype)) + { + small = false; + ext = true; + } + else + { + small = true; + ext = false; + } + + resolve_symbol_value (fragp->fr_symbol); + val = S_GET_VALUE (fragp->fr_symbol); + if (op->pcrel) + { + addressT addr; + + addr = fragp->fr_address + fragp->fr_fix; + + /* The rules for the base address of a PC relative reloc are + complicated; see mips16_extended_frag. */ + if (type == 'p' || type == 'q') + { + addr += 2; + if (ext) + addr += 2; + /* Ignore the low bit in the target, since it will be + set for a text label. */ + if ((val & 1) != 0) + --val; + } + else if (RELAX_MIPS16_JAL_DSLOT (fragp->fr_subtype)) + addr -= 4; + else if (RELAX_MIPS16_DSLOT (fragp->fr_subtype)) + addr -= 2; + + addr &= ~ (addressT) ((1 << op->shift) - 1); + val -= addr; + + /* Make sure the section winds up with the alignment we have + assumed. */ + if (op->shift > 0) + record_alignment (asec, op->shift); + } + + if (ext + && (RELAX_MIPS16_JAL_DSLOT (fragp->fr_subtype) + || RELAX_MIPS16_DSLOT (fragp->fr_subtype))) + as_warn_where (fragp->fr_file, fragp->fr_line, + "extended instruction in delay slot"); + + buf = (bfd_byte *) (fragp->fr_literal + fragp->fr_fix); + + if (target_big_endian) + insn = bfd_getb16 (buf); + else + insn = bfd_getl16 (buf); + + mips16_immed (fragp->fr_file, fragp->fr_line, type, val, + RELAX_MIPS16_USER_EXT (fragp->fr_subtype), + small, ext, &insn, &use_extend, &extend); + + if (use_extend) + { + md_number_to_chars (buf, 0xf000 | extend, 2); + fragp->fr_fix += 2; + buf += 2; + } + + md_number_to_chars (buf, insn, 2); + fragp->fr_fix += 2; + buf += 2; + } + else + { + if (fragp->fr_opcode == NULL) + return; + + old = RELAX_OLD (fragp->fr_subtype); + new = RELAX_NEW (fragp->fr_subtype); + fixptr = fragp->fr_literal + fragp->fr_fix; + + if (new > 0) + memcpy (fixptr - old, fixptr, new); + + fragp->fr_fix += new - old; + } +} + +#ifdef OBJ_ELF + +/* This function is called after the relocs have been generated. + We've been storing mips16 text labels as odd. Here we convert them + back to even for the convenience of the debugger. */ - old = RELAX_OLD (fragp->fr_subtype); - new = RELAX_NEW (fragp->fr_subtype); - fixptr = fragp->fr_literal + fragp->fr_fix; +void +mips_frob_file_after_relocs () +{ + asymbol **syms; + unsigned int count, i; - if (new > 0) - memcpy (fixptr - old, fixptr, new); + if (OUTPUT_FLAVOR != bfd_target_elf_flavour) + return; - fragp->fr_fix += new - old; + syms = bfd_get_outsymbols (stdoutput); + count = bfd_get_symcount (stdoutput); + for (i = 0; i < count; i++, syms++) + { + if (elf_symbol (*syms)->internal_elf_sym.st_other == STO_MIPS16 + && ((*syms)->value & 1) != 0) + { + (*syms)->value &= ~1; + /* If the symbol has an odd size, it was probably computed + incorrectly, so adjust that as well. */ + if ((elf_symbol (*syms)->internal_elf_sym.st_size & 1) != 0) + ++elf_symbol (*syms)->internal_elf_sym.st_size; + } + } } +#endif + /* This function is called whenever a label is defined. It is used when handling branch delays; if a branch has a label, we assume we can not move it. */ @@ -7698,34 +10459,19 @@ mips_define_label (sym) symbolS *sym; { - insn_label = sym; -} + struct insn_label_list *l; -/* Decide whether a label is local. This is called by LOCAL_LABEL. - In order to work with gcc when using mips-tfile, we must keep all - local labels. However, in other cases, we want to discard them, - since they are useless. */ - -int -mips_local_label (name) - const char *name; -{ -#ifndef NO_ECOFF_DEBUGGING - if (ECOFF_DEBUGGING - && mips_debug != 0 - && ! ecoff_debugging_seen) + if (free_insn_labels == NULL) + l = (struct insn_label_list *) xmalloc (sizeof *l); + else { - /* We were called with -g, but we didn't see any debugging - information. That may mean that gcc is smuggling debugging - information through to mips-tfile, in which case we must - generate all local labels. */ - return 0; + l = free_insn_labels; + free_insn_labels = l->next; } -#endif - - /* Here it's OK to discard local labels. */ - return name[0] == '$'; + l->label = sym; + l->next = insn_labels; + insn_labels = l; } #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) diff -urN binutils-2.7/gas/config/tc-mips.h binutils-2.8/gas/config/tc-mips.h --- binutils-2.7/gas/config/tc-mips.h Thu Jul 4 12:14:24 1996 +++ binutils-2.8/gas/config/tc-mips.h Wed Apr 30 12:53:20 1997 @@ -1,5 +1,5 @@ -/* tc-mips.c -- header file for tc-mips.c. - Copyright (C) 1993 Free Software Foundation, Inc. +/* tc-mips.h -- header file for tc-mips.c. + Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Contributed by the OSF and Ralph Campbell. Written by Keith Knowles and Ralph Campbell, working independently. Modified for ECOFF support by Ian Lance Taylor of Cygnus Support. @@ -17,13 +17,24 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #ifndef TC_MIPS #define TC_MIPS +#ifdef ANSI_PROTOTYPES +struct frag; +struct expressionS; +#endif + +/* Default to big endian. */ +#ifndef TARGET_BYTES_BIG_ENDIAN +#define TARGET_BYTES_BIG_ENDIAN 1 +#endif + #define TARGET_ARCH bfd_arch_mips #define ONLY_STANDARD_ESCAPES @@ -34,14 +45,18 @@ #define MAX_RELOC_EXPANSION 3 #define LOCAL_LABELS_FB 1 +/* We don't want to define LOCAL_LABELS_DOLLAR, because $0 is really a + reference to a register, not a label. */ +#undef LOCAL_LABELS_DOLLAR +#define LOCAL_LABELS_DOLLAR 0 + /* Maximum symbol offset that can be encoded in a BFD_RELOC_MIPS_GPREL relocation: */ #define MAX_GPREL_OFFSET (0x7FF4) -#define LOCAL_LABEL(name) mips_local_label (name) -extern int mips_local_label PARAMS ((const char *)); +#define md_relax_frag(fragp, stretch) mips_relax_frag(fragp, stretch) +extern int mips_relax_frag PARAMS ((struct frag *, long)); -#define md_relax_frag(fragp, stretch) (0) #define md_undefined_symbol(name) (0) #define md_operand(x) @@ -49,49 +64,56 @@ embedded PIC code. */ #define DIFF_EXPR_OK -#define LITTLE_ENDIAN 1234 -#define BIG_ENDIAN 4321 - -/* Default to big endian. */ -#ifndef TARGET_BYTES_LITTLE_ENDIAN -#undef TARGET_BYTES_BIG_ENDIAN -#define TARGET_BYTES_BIG_ENDIAN 1 -#endif - -#if TARGET_BYTES_BIG_ENDIAN -#define BYTE_ORDER BIG_ENDIAN -#else -#define BYTE_ORDER LITTLE_ENDIAN -#endif +/* Tell assembler that we have an itbl_mips.h header file to include. */ +#define HAVE_ITBL_CPU /* The endianness of the target format may change based on command line arguments. */ #define TARGET_FORMAT mips_target_format() -extern const char *mips_target_format (); +extern const char *mips_target_format PARAMS ((void)); -struct mips_cl_insn { - unsigned long insn_opcode; - const struct mips_opcode *insn_mo; +struct mips_cl_insn +{ + unsigned long insn_opcode; + const struct mips_opcode *insn_mo; + /* The next two fields are used when generating mips16 code. */ + boolean use_extend; + unsigned short extend; }; extern int tc_get_register PARAMS ((int frame)); +#define tc_init_after_args() mips_init_after_args() +extern void mips_init_after_args PARAMS ((void)); + #define md_parse_long_option(arg) mips_parse_long_option (arg) extern int mips_parse_long_option PARAMS ((const char *)); #define tc_frob_label(sym) mips_define_label (sym) extern void mips_define_label PARAMS ((struct symbol *)); +#define tc_frob_file_before_adjust() mips_frob_file_before_adjust () +extern void mips_frob_file_before_adjust PARAMS ((void)); + #define tc_frob_file() mips_frob_file () extern void mips_frob_file PARAMS ((void)); +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) +#define tc_frob_file_after_relocs mips_frob_file_after_relocs +extern void mips_frob_file_after_relocs PARAMS ((void)); +#endif + #define TC_CONS_FIX_NEW cons_fix_new_mips -extern void cons_fix_new_mips (); +extern void cons_fix_new_mips + PARAMS ((struct frag *, int, unsigned int, struct expressionS *)); + +#define tc_fix_adjustable(fixp) mips_fix_adjustable (fixp) +extern int mips_fix_adjustable PARAMS ((struct fix *)); /* When generating embedded PIC code we must keep PC relative relocations. */ #define TC_FORCE_RELOCATION(fixp) mips_force_relocation (fixp) -extern int mips_force_relocation (); +extern int mips_force_relocation PARAMS ((struct fix *)); /* md_apply_fix sets fx_done correctly. */ #define TC_HANDLE_FX_DONE 1 @@ -101,7 +123,7 @@ extern unsigned long mips_gprmask; extern unsigned long mips_cprmask[4]; -#ifdef OBJ_ELF +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) #define elf_tc_final_processing mips_elf_final_processing extern void mips_elf_final_processing PARAMS ((void)); @@ -132,8 +154,5 @@ extern void mips_enable_auto_align PARAMS ((void)); #define md_elf_section_change_hook() mips_enable_auto_align() - -extern void mips_init_after_args PARAMS ((void)); -#define tc_init_after_args mips_init_after_args #endif /* TC_MIPS */ diff -urN binutils-2.7/gas/config/tc-mn10200.c binutils-2.8/gas/config/tc-mn10200.c --- binutils-2.7/gas/config/tc-mn10200.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/tc-mn10200.c Wed Apr 30 12:53:21 1997 @@ -0,0 +1,1387 @@ +/* tc-mn10200.c -- Assembler code for the Matsushita 10200 + + Copyright (C) 1996, 1997 Free Software Foundation. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include "as.h" +#include "subsegs.h" +#include "opcode/mn10200.h" + +/* Structure to hold information about predefined registers. */ +struct reg_name +{ + const char *name; + int value; +}; + +/* Generic assembler global variables which must be defined by all targets. */ + +/* Characters which always start a comment. */ +const char comment_chars[] = "#"; + +/* Characters which start a comment at the beginning of a line. */ +const char line_comment_chars[] = ";#"; + +/* Characters which may be used to separate multiple commands on a + single line. */ +const char line_separator_chars[] = ";"; + +/* Characters which are used to indicate an exponent in a floating + point number. */ +const char EXP_CHARS[] = "eE"; + +/* Characters which mean that a number is a floating point constant, + as in 0d1.0. */ +const char FLT_CHARS[] = "dD"; + + +const relax_typeS md_relax_table[] = { + /* bCC relaxing */ + {0x7f, -0x80, 2, 1}, + {0x7fff, -0x8000, 5, 2}, + {0x7fffff, -0x800000, 7, 0}, + /* bCCx relaxing */ + {0x7f, -0x80, 3, 4}, + {0x7fff, -0x8000, 6, 5}, + {0x7fffff, -0x800000, 8, 0}, + /* jsr relaxing */ + {0x7fff, -0x8000, 3, 7}, + {0x7fffff, -0x8000000, 5, 0}, + /* jmp relaxing */ + {0x7f, -0x80, 2, 9}, + {0x7fff, -0x8000, 3, 10}, + {0x7fffff, -0x8000000, 5, 0}, + +}; +/* local functions */ +static void mn10200_insert_operand PARAMS ((unsigned long *, unsigned long *, + const struct mn10200_operand *, + offsetT, char *, unsigned, + unsigned)); +static unsigned long check_operand PARAMS ((unsigned long, + const struct mn10200_operand *, + offsetT)); +static int reg_name_search PARAMS ((const struct reg_name *, int, const char *)); +static boolean data_register_name PARAMS ((expressionS *expressionP)); +static boolean address_register_name PARAMS ((expressionS *expressionP)); +static boolean other_register_name PARAMS ((expressionS *expressionP)); + + +/* fixups */ +#define MAX_INSN_FIXUPS (5) +struct mn10200_fixup +{ + expressionS exp; + int opindex; + bfd_reloc_code_real_type reloc; +}; +struct mn10200_fixup fixups[MAX_INSN_FIXUPS]; +static int fc; + +const char *md_shortopts = ""; +struct option md_longopts[] = { + {NULL, no_argument, NULL, 0} +}; +size_t md_longopts_size = sizeof(md_longopts); + +/* The target specific pseudo-ops which we support. */ +const pseudo_typeS md_pseudo_table[] = +{ + { NULL, NULL, 0 } +}; + +/* Opcode hash table. */ +static struct hash_control *mn10200_hash; + +/* This table is sorted. Suitable for searching by a binary search. */ +static const struct reg_name data_registers[] = +{ + { "d0", 0 }, + { "d1", 1 }, + { "d2", 2 }, + { "d3", 3 }, +}; +#define DATA_REG_NAME_CNT (sizeof(data_registers) / sizeof(struct reg_name)) + +static const struct reg_name address_registers[] = +{ + { "a0", 0 }, + { "a1", 1 }, + { "a2", 2 }, + { "a3", 3 }, +}; +#define ADDRESS_REG_NAME_CNT (sizeof(address_registers) / sizeof(struct reg_name)) + +static const struct reg_name other_registers[] = +{ + { "mdr", 0 }, + { "psw", 0 }, +}; +#define OTHER_REG_NAME_CNT (sizeof(other_registers) / sizeof(struct reg_name)) + +/* reg_name_search does a binary search of the given register table + to see if "name" is a valid regiter name. Returns the register + number from the array on success, or -1 on failure. */ + +static int +reg_name_search (regs, regcount, name) + const struct reg_name *regs; + int regcount; + const char *name; +{ + int middle, low, high; + int cmp; + + low = 0; + high = regcount - 1; + + do + { + middle = (low + high) / 2; + cmp = strcasecmp (name, regs[middle].name); + if (cmp < 0) + high = middle - 1; + else if (cmp > 0) + low = middle + 1; + else + return regs[middle].value; + } + while (low <= high); + return -1; +} + + +/* Summary of register_name(). + * + * in: Input_line_pointer points to 1st char of operand. + * + * out: A expressionS. + * The operand may have been a register: in this case, X_op == O_register, + * X_add_number is set to the register number, and truth is returned. + * Input_line_pointer->(next non-blank) char after operand, or is in + * its original state. + */ +static boolean +data_register_name (expressionP) + expressionS *expressionP; +{ + int reg_number; + char *name; + char *start; + char c; + + /* Find the spelling of the operand */ + start = name = input_line_pointer; + + c = get_symbol_end (); + reg_number = reg_name_search (data_registers, DATA_REG_NAME_CNT, name); + + /* look to see if it's in the register table */ + if (reg_number >= 0) + { + expressionP->X_op = O_register; + expressionP->X_add_number = reg_number; + + /* make the rest nice */ + expressionP->X_add_symbol = NULL; + expressionP->X_op_symbol = NULL; + *input_line_pointer = c; /* put back the delimiting char */ + return true; + } + else + { + /* reset the line as if we had not done anything */ + *input_line_pointer = c; /* put back the delimiting char */ + input_line_pointer = start; /* reset input_line pointer */ + return false; + } +} + +/* Summary of register_name(). + * + * in: Input_line_pointer points to 1st char of operand. + * + * out: A expressionS. + * The operand may have been a register: in this case, X_op == O_register, + * X_add_number is set to the register number, and truth is returned. + * Input_line_pointer->(next non-blank) char after operand, or is in + * its original state. + */ +static boolean +address_register_name (expressionP) + expressionS *expressionP; +{ + int reg_number; + char *name; + char *start; + char c; + + /* Find the spelling of the operand */ + start = name = input_line_pointer; + + c = get_symbol_end (); + reg_number = reg_name_search (address_registers, ADDRESS_REG_NAME_CNT, name); + + /* look to see if it's in the register table */ + if (reg_number >= 0) + { + expressionP->X_op = O_register; + expressionP->X_add_number = reg_number; + + /* make the rest nice */ + expressionP->X_add_symbol = NULL; + expressionP->X_op_symbol = NULL; + *input_line_pointer = c; /* put back the delimiting char */ + return true; + } + else + { + /* reset the line as if we had not done anything */ + *input_line_pointer = c; /* put back the delimiting char */ + input_line_pointer = start; /* reset input_line pointer */ + return false; + } +} + +/* Summary of register_name(). + * + * in: Input_line_pointer points to 1st char of operand. + * + * out: A expressionS. + * The operand may have been a register: in this case, X_op == O_register, + * X_add_number is set to the register number, and truth is returned. + * Input_line_pointer->(next non-blank) char after operand, or is in + * its original state. + */ +static boolean +other_register_name (expressionP) + expressionS *expressionP; +{ + int reg_number; + char *name; + char *start; + char c; + + /* Find the spelling of the operand */ + start = name = input_line_pointer; + + c = get_symbol_end (); + reg_number = reg_name_search (other_registers, OTHER_REG_NAME_CNT, name); + + /* look to see if it's in the register table */ + if (reg_number >= 0) + { + expressionP->X_op = O_register; + expressionP->X_add_number = reg_number; + + /* make the rest nice */ + expressionP->X_add_symbol = NULL; + expressionP->X_op_symbol = NULL; + *input_line_pointer = c; /* put back the delimiting char */ + return true; + } + else + { + /* reset the line as if we had not done anything */ + *input_line_pointer = c; /* put back the delimiting char */ + input_line_pointer = start; /* reset input_line pointer */ + return false; + } +} + +void +md_show_usage (stream) + FILE *stream; +{ + fprintf(stream, "MN10200 options:\n\ +none yet\n"); +} + +int +md_parse_option (c, arg) + int c; + char *arg; +{ + return 0; +} + +symbolS * +md_undefined_symbol (name) + char *name; +{ + return 0; +} + +char * +md_atof (type, litp, sizep) + int type; + char *litp; + int *sizep; +{ + int prec; + LITTLENUM_TYPE words[4]; + char *t; + int i; + + switch (type) + { + case 'f': + prec = 2; + break; + + case 'd': + prec = 4; + break; + + default: + *sizep = 0; + return "bad call to md_atof"; + } + + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + + *sizep = prec * 2; + + for (i = prec - 1; i >= 0; i--) + { + md_number_to_chars (litp, (valueT) words[i], 2); + litp += 2; + } + + return NULL; +} + + +void +md_convert_frag (abfd, sec, fragP) + bfd *abfd; + asection *sec; + fragS *fragP; +{ + static unsigned long label_count = 0; + char buf[40]; + + subseg_change (sec, 0); + if (fragP->fr_subtype == 0) + { + fix_new (fragP, fragP->fr_fix + 1, 1, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 2; + } + else if (fragP->fr_subtype == 1) + { + /* Reverse the condition of the first branch. */ + int offset = fragP->fr_fix; + int opcode = fragP->fr_literal[offset] & 0xff; + + switch (opcode) + { + case 0xe8: + opcode = 0xe9; + break; + case 0xe9: + opcode = 0xe8; + break; + case 0xe0: + opcode = 0xe2; + break; + case 0xe2: + opcode = 0xe0; + break; + case 0xe3: + opcode = 0xe1; + break; + case 0xe1: + opcode = 0xe3; + break; + case 0xe4: + opcode = 0xe6; + break; + case 0xe6: + opcode = 0xe4; + break; + case 0xe7: + opcode = 0xe5; + break; + case 0xe5: + opcode = 0xe7; + break; + default: + abort (); + } + fragP->fr_literal[offset] = opcode; + + /* Create a fixup for the reversed conditional branch. */ + sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++); + fix_new (fragP, fragP->fr_fix + 1, 1, + symbol_new (buf, sec, 0, fragP->fr_next), + fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL); + + /* Now create the unconditional branch + fixup to the + final target. */ + fragP->fr_literal[offset + 2] = 0xfc; + fix_new (fragP, fragP->fr_fix + 3, 2, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 5; + } + else if (fragP->fr_subtype == 2) + { + /* Reverse the condition of the first branch. */ + int offset = fragP->fr_fix; + int opcode = fragP->fr_literal[offset] & 0xff; + + switch (opcode) + { + case 0xe8: + opcode = 0xe9; + break; + case 0xe9: + opcode = 0xe8; + break; + case 0xe0: + opcode = 0xe2; + break; + case 0xe2: + opcode = 0xe0; + break; + case 0xe3: + opcode = 0xe1; + break; + case 0xe1: + opcode = 0xe3; + break; + case 0xe4: + opcode = 0xe6; + break; + case 0xe6: + opcode = 0xe4; + break; + case 0xe7: + opcode = 0xe5; + break; + case 0xe5: + opcode = 0xe7; + break; + default: + abort (); + } + fragP->fr_literal[offset] = opcode; + + /* Create a fixup for the reversed conditional branch. */ + sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++); + fix_new (fragP, fragP->fr_fix + 1, 1, + symbol_new (buf, sec, 0, fragP->fr_next), + fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL); + + /* Now create the unconditional branch + fixup to the + final target. */ + fragP->fr_literal[offset + 2] = 0xf4; + fragP->fr_literal[offset + 3] = 0xe0; + fix_new (fragP, fragP->fr_fix + 4, 4, fragP->fr_symbol, + fragP->fr_offset + 2, 1, BFD_RELOC_24_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 7; + } + else if (fragP->fr_subtype == 3) + { + fix_new (fragP, fragP->fr_fix + 2, 1, fragP->fr_symbol, + fragP->fr_offset + 2, 1, BFD_RELOC_8_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 3; + } + else if (fragP->fr_subtype == 4) + { + /* Reverse the condition of the first branch. */ + int offset = fragP->fr_fix; + int opcode = fragP->fr_literal[offset + 1] & 0xff; + + switch (opcode) + { + case 0xfc: + opcode = 0xfd; + break; + case 0xfd: + opcode = 0xfc; + break; + case 0xfe: + opcode = 0xff; + break; + case 0xff: + opcode = 0xfe; + case 0xe8: + opcode = 0xe9; + break; + case 0xe9: + opcode = 0xe8; + break; + case 0xe0: + opcode = 0xe2; + break; + case 0xe2: + opcode = 0xe0; + break; + case 0xe3: + opcode = 0xe1; + break; + case 0xe1: + opcode = 0xe3; + break; + case 0xe4: + opcode = 0xe6; + break; + case 0xe6: + opcode = 0xe4; + break; + case 0xe7: + opcode = 0xe5; + break; + case 0xe5: + opcode = 0xe7; + break; + case 0xec: + opcode = 0xed; + break; + case 0xed: + opcode = 0xec; + break; + case 0xee: + opcode = 0xef; + break; + case 0xef: + opcode = 0xee; + break; + default: + abort (); + } + fragP->fr_literal[offset + 1] = opcode; + + /* Create a fixup for the reversed conditional branch. */ + sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++); + fix_new (fragP, fragP->fr_fix + 2, 1, + symbol_new (buf, sec, 0, fragP->fr_next), + fragP->fr_offset + 2, 1, BFD_RELOC_8_PCREL); + + /* Now create the unconditional branch + fixup to the + final target. */ + fragP->fr_literal[offset + 3] = 0xfc; + fix_new (fragP, fragP->fr_fix + 4, 2, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 6; + } + else if (fragP->fr_subtype == 5) + { + /* Reverse the condition of the first branch. */ + int offset = fragP->fr_fix; + int opcode = fragP->fr_literal[offset + 1] & 0xff; + + switch (opcode) + { + case 0xfc: + opcode = 0xfd; + break; + case 0xfd: + opcode = 0xfc; + break; + case 0xfe: + opcode = 0xff; + break; + case 0xff: + opcode = 0xfe; + case 0xe8: + opcode = 0xe9; + break; + case 0xe9: + opcode = 0xe8; + break; + case 0xe0: + opcode = 0xe2; + break; + case 0xe2: + opcode = 0xe0; + break; + case 0xe3: + opcode = 0xe1; + break; + case 0xe1: + opcode = 0xe3; + break; + case 0xe4: + opcode = 0xe6; + break; + case 0xe6: + opcode = 0xe4; + break; + case 0xe7: + opcode = 0xe5; + break; + case 0xe5: + opcode = 0xe7; + break; + case 0xec: + opcode = 0xed; + break; + case 0xed: + opcode = 0xec; + break; + case 0xee: + opcode = 0xef; + break; + case 0xef: + opcode = 0xee; + break; + default: + abort (); + } + fragP->fr_literal[offset + 1] = opcode; + + /* Create a fixup for the reversed conditional branch. */ + sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++); + fix_new (fragP, fragP->fr_fix + 2, 1, + symbol_new (buf, sec, 0, fragP->fr_next), + fragP->fr_offset + 2, 1, BFD_RELOC_8_PCREL); + + /* Now create the unconditional branch + fixup to the + final target. */ + fragP->fr_literal[offset + 3] = 0xf4; + fragP->fr_literal[offset + 4] = 0xe0; + fix_new (fragP, fragP->fr_fix + 5, 4, fragP->fr_symbol, + fragP->fr_offset + 2, 1, BFD_RELOC_24_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 8; + } + else if (fragP->fr_subtype == 6) + { + fix_new (fragP, fragP->fr_fix + 1, 2, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 3; + } + else if (fragP->fr_subtype == 7) + { + int offset = fragP->fr_fix; + fragP->fr_literal[offset] = 0xf4; + fragP->fr_literal[offset + 1] = 0xe1; + + fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol, + fragP->fr_offset + 2, 1, BFD_RELOC_24_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 5; + } + else if (fragP->fr_subtype == 8) + { + fragP->fr_literal[fragP->fr_fix] = 0xea; + fix_new (fragP, fragP->fr_fix + 1, 1, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 2; + } + else if (fragP->fr_subtype == 9) + { + int offset = fragP->fr_fix; + fragP->fr_literal[offset] = 0xfc; + + fix_new (fragP, fragP->fr_fix + 1, 4, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 3; + } + else if (fragP->fr_subtype == 10) + { + int offset = fragP->fr_fix; + fragP->fr_literal[offset] = 0xf4; + fragP->fr_literal[offset + 1] = 0xe0; + + fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol, + fragP->fr_offset + 2, 1, BFD_RELOC_24_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 5; + } + else + abort (); +} + +valueT +md_section_align (seg, addr) + asection *seg; + valueT addr; +{ + int align = bfd_get_section_alignment (stdoutput, seg); + return ((addr + (1 << align) - 1) & (-1 << align)); +} + +void +md_begin () +{ + char *prev_name = ""; + register const struct mn10200_opcode *op; + + mn10200_hash = hash_new(); + + /* Insert unique names into hash table. The MN10200 instruction set + has many identical opcode names that have different opcodes based + on the operands. This hash table then provides a quick index to + the first opcode with a particular name in the opcode table. */ + + op = mn10200_opcodes; + while (op->name) + { + if (strcmp (prev_name, op->name)) + { + prev_name = (char *) op->name; + hash_insert (mn10200_hash, op->name, (char *) op); + } + op++; + } + + /* This is both a simplification (we don't have to write md_apply_fix) + and support for future optimizations (branch shortening and similar + stuff in the linker. */ + linkrelax = 1; +} + +void +md_assemble (str) + char *str; +{ + char *s; + struct mn10200_opcode *opcode; + struct mn10200_opcode *next_opcode; + const unsigned char *opindex_ptr; + int next_opindex, relaxable; + unsigned long insn, extension, size = 0; + char *f; + int i; + int match; + + /* Get the opcode. */ + for (s = str; *s != '\0' && ! isspace (*s); s++) + ; + if (*s != '\0') + *s++ = '\0'; + + /* find the first opcode with the proper name */ + opcode = (struct mn10200_opcode *)hash_find (mn10200_hash, str); + if (opcode == NULL) + { + as_bad ("Unrecognized opcode: `%s'", str); + return; + } + + str = s; + while (isspace (*str)) + ++str; + + input_line_pointer = str; + + for(;;) + { + const char *errmsg = NULL; + int op_idx; + char *hold; + int extra_shift = 0; + + relaxable = 0; + fc = 0; + match = 0; + next_opindex = 0; + insn = opcode->opcode; + extension = 0; + for (op_idx = 1, opindex_ptr = opcode->operands; + *opindex_ptr != 0; + opindex_ptr++, op_idx++) + { + const struct mn10200_operand *operand; + expressionS ex; + + if (next_opindex == 0) + { + operand = &mn10200_operands[*opindex_ptr]; + } + else + { + operand = &mn10200_operands[next_opindex]; + next_opindex = 0; + } + + errmsg = NULL; + + while (*str == ' ' || *str == ',') + ++str; + + if (operand->flags & MN10200_OPERAND_RELAX) + relaxable = 1; + + /* Gather the operand. */ + hold = input_line_pointer; + input_line_pointer = str; + + if (operand->flags & MN10200_OPERAND_PAREN) + { + if (*input_line_pointer != ')' && *input_line_pointer != '(') + { + input_line_pointer = hold; + str = hold; + goto error; + } + input_line_pointer++; + goto keep_going; + } + /* See if we can match the operands. */ + else if (operand->flags & MN10200_OPERAND_DREG) + { + if (!data_register_name (&ex)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + } + else if (operand->flags & MN10200_OPERAND_AREG) + { + if (!address_register_name (&ex)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + } + else if (operand->flags & MN10200_OPERAND_PSW) + { + char *start = input_line_pointer; + char c = get_symbol_end (); + + if (strcmp (start, "psw") != 0) + { + *input_line_pointer = c; + input_line_pointer = hold; + str = hold; + goto error; + } + *input_line_pointer = c; + goto keep_going; + } + else if (operand->flags & MN10200_OPERAND_MDR) + { + char *start = input_line_pointer; + char c = get_symbol_end (); + + if (strcmp (start, "mdr") != 0) + { + *input_line_pointer = c; + input_line_pointer = hold; + str = hold; + goto error; + } + *input_line_pointer = c; + goto keep_going; + } + else if (data_register_name (&ex)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + else if (address_register_name (&ex)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + else if (other_register_name (&ex)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + else if (*str == ')' || *str == '(') + { + input_line_pointer = hold; + str = hold; + goto error; + } + else + { + expression (&ex); + } + + switch (ex.X_op) + { + case O_illegal: + errmsg = "illegal operand"; + goto error; + case O_absent: + errmsg = "missing operand"; + goto error; + case O_register: + if ((operand->flags + & (MN10200_OPERAND_DREG | MN10200_OPERAND_AREG)) == 0) + { + input_line_pointer = hold; + str = hold; + goto error; + } + + if (opcode->format == FMT_2 || opcode->format == FMT_5) + extra_shift = 8; + else if (opcode->format == FMT_3 || opcode->format == FMT_6 + || opcode->format == FMT_7) + extra_shift = 16; + else + extra_shift = 0; + + mn10200_insert_operand (&insn, &extension, operand, + ex.X_add_number, (char *) NULL, + 0, extra_shift); + + break; + + case O_constant: + /* If this operand can be promoted, and it doesn't + fit into the allocated bitfield for this insn, + then promote it (ie this opcode does not match). */ + if (operand->flags + & (MN10200_OPERAND_PROMOTE | MN10200_OPERAND_RELAX) + && ! check_operand (insn, operand, ex.X_add_number)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + + mn10200_insert_operand (&insn, &extension, operand, + ex.X_add_number, (char *) NULL, + 0, 0); + break; + + default: + /* If this operand can be promoted, then this opcode didn't + match since we can't know if it needed promotion! */ + if (operand->flags & MN10200_OPERAND_PROMOTE) + { + input_line_pointer = hold; + str = hold; + goto error; + } + + /* We need to generate a fixup for this expression. */ + if (fc >= MAX_INSN_FIXUPS) + as_fatal ("too many fixups"); + fixups[fc].exp = ex; + fixups[fc].opindex = *opindex_ptr; + fixups[fc].reloc = BFD_RELOC_UNUSED; + ++fc; + break; + } + +keep_going: + str = input_line_pointer; + input_line_pointer = hold; + + while (*str == ' ' || *str == ',') + ++str; + + } + + /* Make sure we used all the operands! */ + if (*str != ',') + match = 1; + + error: + if (match == 0) + { + next_opcode = opcode + 1; + if (!strcmp(next_opcode->name, opcode->name)) + { + opcode = next_opcode; + continue; + } + + as_bad ("%s", errmsg); + return; + } + break; + } + + while (isspace (*str)) + ++str; + + if (*str != '\0') + as_bad ("junk at end of line: `%s'", str); + + input_line_pointer = str; + + if (opcode->format == FMT_1) + size = 1; + else if (opcode->format == FMT_2 || opcode->format == FMT_4) + size = 2; + else if (opcode->format == FMT_3 || opcode->format == FMT_5) + size = 3; + else if (opcode->format == FMT_6) + size = 4; + else if (opcode->format == FMT_7) + size = 5; + else + abort (); + + /* Write out the instruction. */ + + if (relaxable && fc > 0) + { + int type; + + /* bCC */ + if (size == 2 && opcode->opcode != 0xfc0000) + type = 0; + /* jsr */ + else if (size == 3 && opcode->opcode == 0xfd0000) + type = 6; + /* jmp */ + else if (size == 3 && opcode->opcode == 0xfc0000) + type = 8; + /* bCCx */ + else + type = 3; + + f = frag_var (rs_machine_dependent, 8, 8 - size, type, + fixups[0].exp.X_add_symbol, + fixups[0].exp.X_add_number, + (char *)fixups[0].opindex); + number_to_chars_bigendian (f, insn, size); + if (8 - size > 4) + { + number_to_chars_bigendian (f + size, 0, 4); + number_to_chars_bigendian (f + size + 4, 0, 8 - size - 4); + } + else + number_to_chars_bigendian (f + size, 0, 8 - size); + } + + else + { + f = frag_more (size); + + /* Oh, what a mess. The instruction is in big endian format, but + 16 and 24bit immediates are little endian! */ + if (opcode->format == FMT_3) + { + number_to_chars_bigendian (f, (insn >> 16) & 0xff, 1); + number_to_chars_littleendian (f + 1, insn & 0xffff, 2); + } + else if (opcode->format == FMT_6) + { + number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2); + number_to_chars_littleendian (f + 2, insn & 0xffff, 2); + } + else if (opcode->format == FMT_7) + { + number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2); + number_to_chars_littleendian (f + 2, insn & 0xffff, 2); + number_to_chars_littleendian (f + 4, extension & 0xff, 1); + } + else + { + number_to_chars_bigendian (f, insn, size > 4 ? 4 : size); + } + + /* Create any fixups. */ + for (i = 0; i < fc; i++) + { + const struct mn10200_operand *operand; + + operand = &mn10200_operands[fixups[i].opindex]; + if (fixups[i].reloc != BFD_RELOC_UNUSED) + { + reloc_howto_type *reloc_howto; + int size; + int offset; + fixS *fixP; + + reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc); + + if (!reloc_howto) + abort(); + + size = bfd_get_reloc_size (reloc_howto); + + if (size < 1 || size > 4) + abort(); + + offset = 4 - size; + fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset, + size, + &fixups[i].exp, + reloc_howto->pc_relative, + fixups[i].reloc); + } + else + { + int reloc, pcrel, reloc_size, offset; + fixS *fixP; + + reloc = BFD_RELOC_NONE; + /* How big is the reloc? Remember SPLIT relocs are + implicitly 32bits. */ + reloc_size = operand->bits; + + offset = size - reloc_size / 8; + + /* Is the reloc pc-relative? */ + pcrel = (operand->flags & MN10200_OPERAND_PCREL) != 0; + + + /* Choose a proper BFD relocation type. */ + if (pcrel) + { + if (reloc_size == 8) + reloc = BFD_RELOC_8_PCREL; + else if (reloc_size == 24) + reloc = BFD_RELOC_24_PCREL; + else + abort (); + } + else + { + if (reloc_size == 32) + reloc = BFD_RELOC_32; + else if (reloc_size == 16) + reloc = BFD_RELOC_16; + else if (reloc_size == 8) + reloc = BFD_RELOC_8; + else if (reloc_size == 24) + reloc = BFD_RELOC_24; + else + abort (); + } + + /* Convert the size of the reloc into what fix_new_exp wants. */ + reloc_size = reloc_size / 8; + if (reloc_size == 8) + reloc_size = 0; + else if (reloc_size == 16) + reloc_size = 1; + else if (reloc_size == 32 || reloc_size == 24) + reloc_size = 2; + + fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset, + reloc_size, &fixups[i].exp, pcrel, + ((bfd_reloc_code_real_type) reloc)); + if (pcrel) + fixP->fx_offset += offset; + } + } + } +} + + +/* if while processing a fixup, a reloc really needs to be created */ +/* then it is done here */ + +arelent * +tc_gen_reloc (seg, fixp) + asection *seg; + fixS *fixp; +{ + arelent *reloc; + reloc = (arelent *) xmalloc (sizeof (arelent)); + + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); + if (reloc->howto == (reloc_howto_type *) NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + "reloc %d not supported by object file format", + (int)fixp->fx_r_type); + return NULL; + } + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; + + if (fixp->fx_addsy && fixp->fx_subsy) + { + reloc->sym_ptr_ptr = &bfd_abs_symbol; + reloc->addend = (S_GET_VALUE (fixp->fx_addsy) + - S_GET_VALUE (fixp->fx_subsy) + fixp->fx_offset); + } + else + { + reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym; + reloc->addend = fixp->fx_offset; + } + return reloc; +} + +int +md_estimate_size_before_relax (fragp, seg) + fragS *fragp; + asection *seg; +{ + if (fragp->fr_subtype == 0) + return 2; + if (fragp->fr_subtype == 3) + return 3; + if (fragp->fr_subtype == 6) + { + if (!S_IS_DEFINED (fragp->fr_symbol) + || seg != S_GET_SEGMENT (fragp->fr_symbol)) + { + fragp->fr_subtype = 7; + return 5; + } + return 3; + } + if (fragp->fr_subtype == 8) + { + if (!S_IS_DEFINED (fragp->fr_symbol)) + { + fragp->fr_subtype = 10; + return 5; + } + return 2; + } +} + +long +md_pcrel_from (fixp) + fixS *fixp; +{ + return fixp->fx_frag->fr_address; +#if 0 + if (fixp->fx_addsy != (symbolS *) NULL && ! S_IS_DEFINED (fixp->fx_addsy)) + { + /* The symbol is undefined. Let the linker figure it out. */ + return 0; + } + return fixp->fx_frag->fr_address + fixp->fx_where; +#endif +} + +int +md_apply_fix3 (fixp, valuep, seg) + fixS *fixp; + valueT *valuep; + segT seg; +{ + /* We shouldn't ever get here because linkrelax is nonzero. */ + abort (); + fixp->fx_done = 1; + return 0; +} + +/* Insert an operand value into an instruction. */ + +static void +mn10200_insert_operand (insnp, extensionp, operand, val, file, line, shift) + unsigned long *insnp; + unsigned long *extensionp; + const struct mn10200_operand *operand; + offsetT val; + char *file; + unsigned int line; + unsigned int shift; +{ + /* No need to check 24 or 32bit operands for a bit. */ + if (operand->bits < 24 + && (operand->flags & MN10200_OPERAND_NOCHECK) == 0) + { + long min, max; + offsetT test; + + if ((operand->flags & MN10200_OPERAND_SIGNED) != 0) + { + max = (1 << (operand->bits - 1)) - 1; + min = - (1 << (operand->bits - 1)); + } + else + { + max = (1 << operand->bits) - 1; + min = 0; + } + + test = val; + + + if (test < (offsetT) min || test > (offsetT) max) + { + const char *err = + "operand out of range (%s not between %ld and %ld)"; + char buf[100]; + + sprint_value (buf, test); + if (file == (char *) NULL) + as_warn (err, buf, min, max); + else + as_warn_where (file, line, err, buf, min, max); + } + } + + if ((operand->flags & MN10200_OPERAND_EXTENDED) == 0) + { + *insnp |= (((long) val & ((1 << operand->bits) - 1)) + << (operand->shift + shift)); + + if ((operand->flags & MN10200_OPERAND_REPEATED) != 0) + *insnp |= (((long) val & ((1 << operand->bits) - 1)) + << (operand->shift + shift + 2)); + } + else + { + *extensionp |= (val >> 16) & 0xff; + *insnp |= val & 0xffff; + } +} + +static unsigned long +check_operand (insn, operand, val) + unsigned long insn; + const struct mn10200_operand *operand; + offsetT val; +{ + /* No need to check 24bit or 32bit operands for a bit. */ + if (operand->bits < 24 + && (operand->flags & MN10200_OPERAND_NOCHECK) == 0) + { + long min, max; + offsetT test; + + if ((operand->flags & MN10200_OPERAND_SIGNED) != 0) + { + max = (1 << (operand->bits - 1)) - 1; + min = - (1 << (operand->bits - 1)); + } + else + { + max = (1 << operand->bits) - 1; + min = 0; + } + + test = val; + + + if (test < (offsetT) min || test > (offsetT) max) + return 0; + else + return 1; + } + return 1; +} diff -urN binutils-2.7/gas/config/tc-mn10200.h binutils-2.8/gas/config/tc-mn10200.h --- binutils-2.7/gas/config/tc-mn10200.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/tc-mn10200.h Wed Apr 30 12:53:21 1997 @@ -0,0 +1,51 @@ +/* tc-mn10200.h -- Header file for tc-mn10200.c. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#define TC_MN10200 + +#define TARGET_BYTES_BIG_ENDIAN 0 + +#ifndef BFD_ASSEMBLER + #error MN10200 support requires BFD_ASSEMBLER +#endif + +/* The target BFD architecture. */ +#define TARGET_ARCH bfd_arch_mn10200 + +#define TARGET_FORMAT "elf32-mn10200" + +#define MD_APPLY_FIX3 +#define md_operand(x) + +/* Permit temporary numeric labels. */ +#define LOCAL_LABELS_FB 1 + +/* We don't need to handle .word strangely. */ +#define WORKING_DOT_WORD + +#define md_number_to_chars number_to_chars_littleendian + +/* Don't bother to adjust relocs. */ +#define tc_fix_adjustable(FIX) 0 + +/* We do relaxing in the assembler as well as the linker. */ +extern const struct relax_type md_relax_table[]; +#define TC_GENERIC_RELAX_TABLE md_relax_table + diff -urN binutils-2.7/gas/config/tc-mn10300.c binutils-2.8/gas/config/tc-mn10300.c --- binutils-2.7/gas/config/tc-mn10300.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/tc-mn10300.c Wed Apr 30 12:53:21 1997 @@ -0,0 +1,1546 @@ +/* tc-mn10300.c -- Assembler code for the Matsushita 10300 + + Copyright (C) 1996, 1997 Free Software Foundation. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include "as.h" +#include "subsegs.h" +#include "opcode/mn10300.h" + +/* Structure to hold information about predefined registers. */ +struct reg_name +{ + const char *name; + int value; +}; + +/* Generic assembler global variables which must be defined by all targets. */ + +/* Characters which always start a comment. */ +const char comment_chars[] = "#"; + +/* Characters which start a comment at the beginning of a line. */ +const char line_comment_chars[] = ";#"; + +/* Characters which may be used to separate multiple commands on a + single line. */ +const char line_separator_chars[] = ";"; + +/* Characters which are used to indicate an exponent in a floating + point number. */ +const char EXP_CHARS[] = "eE"; + +/* Characters which mean that a number is a floating point constant, + as in 0d1.0. */ +const char FLT_CHARS[] = "dD"; + + +const relax_typeS md_relax_table[] = { + /* bCC relaxing */ + {0x7f, -0x80, 2, 1}, + {0x7fff, -0x8000, 5, 2}, + {0x7fffffff, -0x80000000, 7, 0}, + + /* bCC relaxing (uncommon cases) */ + {0x7f, -0x80, 3, 4}, + {0x7fff, -0x8000, 6, 5}, + {0x7fffffff, -0x80000000, 8, 0}, + + /* call relaxing */ + {0x7fff, -0x8000, 5, 7}, + {0x7fffffff, -0x80000000, 7, 0}, + + /* calls relaxing */ + {0x7fff, -0x8000, 4, 9}, + {0x7fffffff, -0x80000000, 6, 0}, + + /* jmp relaxing */ + {0x7f, -0x80, 2, 11}, + {0x7fff, -0x8000, 3, 12}, + {0x7fffffff, -0x80000000, 5, 0}, + +}; + +/* local functions */ +static void mn10300_insert_operand PARAMS ((unsigned long *, unsigned long *, + const struct mn10300_operand *, + offsetT, char *, unsigned, + unsigned)); +static unsigned long check_operand PARAMS ((unsigned long, + const struct mn10300_operand *, + offsetT)); +static int reg_name_search PARAMS ((const struct reg_name *, int, const char *)); +static boolean data_register_name PARAMS ((expressionS *expressionP)); +static boolean address_register_name PARAMS ((expressionS *expressionP)); +static boolean other_register_name PARAMS ((expressionS *expressionP)); + + +/* fixups */ +#define MAX_INSN_FIXUPS (5) +struct mn10300_fixup +{ + expressionS exp; + int opindex; + bfd_reloc_code_real_type reloc; +}; +struct mn10300_fixup fixups[MAX_INSN_FIXUPS]; +static int fc; + +const char *md_shortopts = ""; +struct option md_longopts[] = { + {NULL, no_argument, NULL, 0} +}; +size_t md_longopts_size = sizeof(md_longopts); + +/* The target specific pseudo-ops which we support. */ +const pseudo_typeS md_pseudo_table[] = +{ + { NULL, NULL, 0 } +}; + +/* Opcode hash table. */ +static struct hash_control *mn10300_hash; + +/* This table is sorted. Suitable for searching by a binary search. */ +static const struct reg_name data_registers[] = +{ + { "d0", 0 }, + { "d1", 1 }, + { "d2", 2 }, + { "d3", 3 }, +}; +#define DATA_REG_NAME_CNT (sizeof(data_registers) / sizeof(struct reg_name)) + +static const struct reg_name address_registers[] = +{ + { "a0", 0 }, + { "a1", 1 }, + { "a2", 2 }, + { "a3", 3 }, +}; +#define ADDRESS_REG_NAME_CNT (sizeof(address_registers) / sizeof(struct reg_name)) + +static const struct reg_name other_registers[] = +{ + { "mdr", 0 }, + { "psw", 0 }, + { "sp", 0 }, +}; +#define OTHER_REG_NAME_CNT (sizeof(other_registers) / sizeof(struct reg_name)) + +/* reg_name_search does a binary search of the given register table + to see if "name" is a valid regiter name. Returns the register + number from the array on success, or -1 on failure. */ + +static int +reg_name_search (regs, regcount, name) + const struct reg_name *regs; + int regcount; + const char *name; +{ + int middle, low, high; + int cmp; + + low = 0; + high = regcount - 1; + + do + { + middle = (low + high) / 2; + cmp = strcasecmp (name, regs[middle].name); + if (cmp < 0) + high = middle - 1; + else if (cmp > 0) + low = middle + 1; + else + return regs[middle].value; + } + while (low <= high); + return -1; +} + + +/* Summary of register_name(). + * + * in: Input_line_pointer points to 1st char of operand. + * + * out: A expressionS. + * The operand may have been a register: in this case, X_op == O_register, + * X_add_number is set to the register number, and truth is returned. + * Input_line_pointer->(next non-blank) char after operand, or is in + * its original state. + */ +static boolean +data_register_name (expressionP) + expressionS *expressionP; +{ + int reg_number; + char *name; + char *start; + char c; + + /* Find the spelling of the operand */ + start = name = input_line_pointer; + + c = get_symbol_end (); + reg_number = reg_name_search (data_registers, DATA_REG_NAME_CNT, name); + + /* look to see if it's in the register table */ + if (reg_number >= 0) + { + expressionP->X_op = O_register; + expressionP->X_add_number = reg_number; + + /* make the rest nice */ + expressionP->X_add_symbol = NULL; + expressionP->X_op_symbol = NULL; + *input_line_pointer = c; /* put back the delimiting char */ + return true; + } + else + { + /* reset the line as if we had not done anything */ + *input_line_pointer = c; /* put back the delimiting char */ + input_line_pointer = start; /* reset input_line pointer */ + return false; + } +} + +/* Summary of register_name(). + * + * in: Input_line_pointer points to 1st char of operand. + * + * out: A expressionS. + * The operand may have been a register: in this case, X_op == O_register, + * X_add_number is set to the register number, and truth is returned. + * Input_line_pointer->(next non-blank) char after operand, or is in + * its original state. + */ +static boolean +address_register_name (expressionP) + expressionS *expressionP; +{ + int reg_number; + char *name; + char *start; + char c; + + /* Find the spelling of the operand */ + start = name = input_line_pointer; + + c = get_symbol_end (); + reg_number = reg_name_search (address_registers, ADDRESS_REG_NAME_CNT, name); + + /* look to see if it's in the register table */ + if (reg_number >= 0) + { + expressionP->X_op = O_register; + expressionP->X_add_number = reg_number; + + /* make the rest nice */ + expressionP->X_add_symbol = NULL; + expressionP->X_op_symbol = NULL; + *input_line_pointer = c; /* put back the delimiting char */ + return true; + } + else + { + /* reset the line as if we had not done anything */ + *input_line_pointer = c; /* put back the delimiting char */ + input_line_pointer = start; /* reset input_line pointer */ + return false; + } +} + +/* Summary of register_name(). + * + * in: Input_line_pointer points to 1st char of operand. + * + * out: A expressionS. + * The operand may have been a register: in this case, X_op == O_register, + * X_add_number is set to the register number, and truth is returned. + * Input_line_pointer->(next non-blank) char after operand, or is in + * its original state. + */ +static boolean +other_register_name (expressionP) + expressionS *expressionP; +{ + int reg_number; + char *name; + char *start; + char c; + + /* Find the spelling of the operand */ + start = name = input_line_pointer; + + c = get_symbol_end (); + reg_number = reg_name_search (other_registers, OTHER_REG_NAME_CNT, name); + + /* look to see if it's in the register table */ + if (reg_number >= 0) + { + expressionP->X_op = O_register; + expressionP->X_add_number = reg_number; + + /* make the rest nice */ + expressionP->X_add_symbol = NULL; + expressionP->X_op_symbol = NULL; + *input_line_pointer = c; /* put back the delimiting char */ + return true; + } + else + { + /* reset the line as if we had not done anything */ + *input_line_pointer = c; /* put back the delimiting char */ + input_line_pointer = start; /* reset input_line pointer */ + return false; + } +} + +void +md_show_usage (stream) + FILE *stream; +{ + fprintf(stream, "MN10300 options:\n\ +none yet\n"); +} + +int +md_parse_option (c, arg) + int c; + char *arg; +{ + return 0; +} + +symbolS * +md_undefined_symbol (name) + char *name; +{ + return 0; +} + +char * +md_atof (type, litp, sizep) + int type; + char *litp; + int *sizep; +{ + int prec; + LITTLENUM_TYPE words[4]; + char *t; + int i; + + switch (type) + { + case 'f': + prec = 2; + break; + + case 'd': + prec = 4; + break; + + default: + *sizep = 0; + return "bad call to md_atof"; + } + + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + + *sizep = prec * 2; + + for (i = prec - 1; i >= 0; i--) + { + md_number_to_chars (litp, (valueT) words[i], 2); + litp += 2; + } + + return NULL; +} + + +void +md_convert_frag (abfd, sec, fragP) + bfd *abfd; + asection *sec; + fragS *fragP; +{ + static unsigned long label_count = 0; + char buf[40]; + + subseg_change (sec, 0); + if (fragP->fr_subtype == 0) + { + fix_new (fragP, fragP->fr_fix + 1, 1, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 2; + } + else if (fragP->fr_subtype == 1) + { + /* Reverse the condition of the first branch. */ + int offset = fragP->fr_fix; + int opcode = fragP->fr_literal[offset] & 0xff; + + switch (opcode) + { + case 0xc8: + opcode = 0xc9; + break; + case 0xc9: + opcode = 0xc8; + break; + case 0xc0: + opcode = 0xc2; + break; + case 0xc2: + opcode = 0xc0; + break; + case 0xc3: + opcode = 0xc1; + break; + case 0xc1: + opcode = 0xc3; + break; + case 0xc4: + opcode = 0xc6; + break; + case 0xc6: + opcode = 0xc4; + break; + case 0xc7: + opcode = 0xc5; + break; + case 0xc5: + opcode = 0xc7; + break; + default: + abort (); + } + fragP->fr_literal[offset] = opcode; + + /* Create a fixup for the reversed conditional branch. */ + sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++); + fix_new (fragP, fragP->fr_fix + 1, 1, + symbol_new (buf, sec, 0, fragP->fr_next), + fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL); + + /* Now create the unconditional branch + fixup to the + final target. */ + fragP->fr_literal[offset + 2] = 0xcc; + fix_new (fragP, fragP->fr_fix + 3, 2, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 5; + } + else if (fragP->fr_subtype == 2) + { + /* Reverse the condition of the first branch. */ + int offset = fragP->fr_fix; + int opcode = fragP->fr_literal[offset] & 0xff; + + switch (opcode) + { + case 0xc8: + opcode = 0xc9; + break; + case 0xc9: + opcode = 0xc8; + break; + case 0xc0: + opcode = 0xc2; + break; + case 0xc2: + opcode = 0xc0; + break; + case 0xc3: + opcode = 0xc1; + break; + case 0xc1: + opcode = 0xc3; + break; + case 0xc4: + opcode = 0xc6; + break; + case 0xc6: + opcode = 0xc4; + break; + case 0xc7: + opcode = 0xc5; + break; + case 0xc5: + opcode = 0xc7; + break; + default: + abort (); + } + fragP->fr_literal[offset] = opcode; + + /* Create a fixup for the reversed conditional branch. */ + sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++); + fix_new (fragP, fragP->fr_fix + 1, 1, + symbol_new (buf, sec, 0, fragP->fr_next), + fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL); + + /* Now create the unconditional branch + fixup to the + final target. */ + fragP->fr_literal[offset + 2] = 0xdc; + fix_new (fragP, fragP->fr_fix + 3, 4, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_32_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 7; + } + else if (fragP->fr_subtype == 3) + { + fix_new (fragP, fragP->fr_fix + 2, 1, fragP->fr_symbol, + fragP->fr_offset + 2, 1, BFD_RELOC_8_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 3; + } + else if (fragP->fr_subtype == 4) + { + /* Reverse the condition of the first branch. */ + int offset = fragP->fr_fix; + int opcode = fragP->fr_literal[offset + 1] & 0xff; + + switch (opcode) + { + case 0xe8: + opcode = 0xe9; + break; + case 0xe9: + opcode = 0xe8; + break; + case 0xea: + opcode = 0xeb; + break; + case 0xeb: + opcode = 0xea; + break; + default: + abort (); + } + fragP->fr_literal[offset + 1] = opcode; + + /* Create a fixup for the reversed conditional branch. */ + sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++); + fix_new (fragP, fragP->fr_fix + 2, 1, + symbol_new (buf, sec, 0, fragP->fr_next), + fragP->fr_offset + 2, 1, BFD_RELOC_8_PCREL); + + /* Now create the unconditional branch + fixup to the + final target. */ + fragP->fr_literal[offset + 3] = 0xcc; + fix_new (fragP, fragP->fr_fix + 4, 2, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 6; + } + else if (fragP->fr_subtype == 5) + { + /* Reverse the condition of the first branch. */ + int offset = fragP->fr_fix; + int opcode = fragP->fr_literal[offset + 1] & 0xff; + + switch (opcode) + { + case 0xe8: + opcode = 0xe9; + break; + case 0xea: + opcode = 0xeb; + break; + case 0xeb: + opcode = 0xea; + break; + default: + abort (); + } + fragP->fr_literal[offset + 1] = opcode; + + /* Create a fixup for the reversed conditional branch. */ + sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++); + fix_new (fragP, fragP->fr_fix + 2, 1, + symbol_new (buf, sec, 0, fragP->fr_next), + fragP->fr_offset + 2, 1, BFD_RELOC_8_PCREL); + + /* Now create the unconditional branch + fixup to the + final target. */ + fragP->fr_literal[offset + 3] = 0xdc; + fix_new (fragP, fragP->fr_fix + 4, 4, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_32_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 8; + } + else if (fragP->fr_subtype == 6) + { + int offset = fragP->fr_fix; + fragP->fr_literal[offset] = 0xcd; + fix_new (fragP, fragP->fr_fix + 1, 2, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 5; + } + else if (fragP->fr_subtype == 7) + { + int offset = fragP->fr_fix; + fragP->fr_literal[offset] = 0xdd; + fragP->fr_literal[offset + 5] = fragP->fr_literal[offset + 3]; + fragP->fr_literal[offset + 6] = fragP->fr_literal[offset + 4]; + + fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol, + fragP->fr_offset + 2, 1, BFD_RELOC_32_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 7; + } + else if (fragP->fr_subtype == 8) + { + int offset = fragP->fr_fix; + fragP->fr_literal[offset] = 0xfa; + fragP->fr_literal[offset + 1] = 0xff; + fix_new (fragP, fragP->fr_fix + 2, 2, fragP->fr_symbol, + fragP->fr_offset + 2, 1, BFD_RELOC_16_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 4; + } + else if (fragP->fr_subtype == 9) + { + int offset = fragP->fr_fix; + fragP->fr_literal[offset] = 0xfc; + fragP->fr_literal[offset + 1] = 0xff; + + fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol, + fragP->fr_offset + 2, 1, BFD_RELOC_32_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 6; + } + else if (fragP->fr_subtype == 10) + { + fragP->fr_literal[fragP->fr_fix] = 0xca; + fix_new (fragP, fragP->fr_fix + 1, 1, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 2; + } + else if (fragP->fr_subtype == 11) + { + int offset = fragP->fr_fix; + fragP->fr_literal[offset] = 0xcc; + + fix_new (fragP, fragP->fr_fix + 1, 4, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 3; + } + else if (fragP->fr_subtype == 12) + { + int offset = fragP->fr_fix; + fragP->fr_literal[offset] = 0xdc; + + fix_new (fragP, fragP->fr_fix + 1, 4, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_32_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 5; + } + else + abort (); +} + +valueT +md_section_align (seg, addr) + asection *seg; + valueT addr; +{ + int align = bfd_get_section_alignment (stdoutput, seg); + return ((addr + (1 << align) - 1) & (-1 << align)); +} + +void +md_begin () +{ + char *prev_name = ""; + register const struct mn10300_opcode *op; + + mn10300_hash = hash_new(); + + /* Insert unique names into hash table. The MN10300 instruction set + has many identical opcode names that have different opcodes based + on the operands. This hash table then provides a quick index to + the first opcode with a particular name in the opcode table. */ + + op = mn10300_opcodes; + while (op->name) + { + if (strcmp (prev_name, op->name)) + { + prev_name = (char *) op->name; + hash_insert (mn10300_hash, op->name, (char *) op); + } + op++; + } + + /* This is both a simplification (we don't have to write md_apply_fix) + and support for future optimizations (branch shortening and similar + stuff in the linker. */ + linkrelax = 1; +} + +void +md_assemble (str) + char *str; +{ + char *s; + struct mn10300_opcode *opcode; + struct mn10300_opcode *next_opcode; + const unsigned char *opindex_ptr; + int next_opindex, relaxable; + unsigned long insn, extension, size = 0; + char *f; + int i; + int match; + + /* Get the opcode. */ + for (s = str; *s != '\0' && ! isspace (*s); s++) + ; + if (*s != '\0') + *s++ = '\0'; + + /* find the first opcode with the proper name */ + opcode = (struct mn10300_opcode *)hash_find (mn10300_hash, str); + if (opcode == NULL) + { + as_bad ("Unrecognized opcode: `%s'", str); + return; + } + + str = s; + while (isspace (*str)) + ++str; + + input_line_pointer = str; + + for(;;) + { + const char *errmsg = NULL; + int op_idx; + char *hold; + int extra_shift = 0; + + relaxable = 0; + fc = 0; + match = 0; + next_opindex = 0; + insn = opcode->opcode; + extension = 0; + for (op_idx = 1, opindex_ptr = opcode->operands; + *opindex_ptr != 0; + opindex_ptr++, op_idx++) + { + const struct mn10300_operand *operand; + expressionS ex; + + if (next_opindex == 0) + { + operand = &mn10300_operands[*opindex_ptr]; + } + else + { + operand = &mn10300_operands[next_opindex]; + next_opindex = 0; + } + + errmsg = NULL; + + while (*str == ' ' || *str == ',') + ++str; + + if (operand->flags & MN10300_OPERAND_RELAX) + relaxable = 1; + + /* Gather the operand. */ + hold = input_line_pointer; + input_line_pointer = str; + + if (operand->flags & MN10300_OPERAND_PAREN) + { + if (*input_line_pointer != ')' && *input_line_pointer != '(') + { + input_line_pointer = hold; + str = hold; + goto error; + } + input_line_pointer++; + goto keep_going; + } + /* See if we can match the operands. */ + else if (operand->flags & MN10300_OPERAND_DREG) + { + if (!data_register_name (&ex)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + } + else if (operand->flags & MN10300_OPERAND_AREG) + { + if (!address_register_name (&ex)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + } + else if (operand->flags & MN10300_OPERAND_SP) + { + char *start = input_line_pointer; + char c = get_symbol_end (); + + if (strcmp (start, "sp") != 0) + { + *input_line_pointer = c; + input_line_pointer = hold; + str = hold; + goto error; + } + *input_line_pointer = c; + goto keep_going; + } + else if (operand->flags & MN10300_OPERAND_PSW) + { + char *start = input_line_pointer; + char c = get_symbol_end (); + + if (strcmp (start, "psw") != 0) + { + *input_line_pointer = c; + input_line_pointer = hold; + str = hold; + goto error; + } + *input_line_pointer = c; + goto keep_going; + } + else if (operand->flags & MN10300_OPERAND_MDR) + { + char *start = input_line_pointer; + char c = get_symbol_end (); + + if (strcmp (start, "mdr") != 0) + { + *input_line_pointer = c; + input_line_pointer = hold; + str = hold; + goto error; + } + *input_line_pointer = c; + goto keep_going; + } + else if (operand->flags & MN10300_OPERAND_REG_LIST) + { + unsigned int value = 0; + if (*input_line_pointer != '[') + { + input_line_pointer = hold; + str = hold; + goto error; + } + + /* Eat the '['. */ + input_line_pointer++; + + /* A null register list can not be specified. */ + if (*input_line_pointer == ']') + { + input_line_pointer = hold; + str = hold; + goto error; + } + + while (*input_line_pointer != ']') + { + char *start; + char c; + + if (*input_line_pointer == ',') + input_line_pointer++; + + start = input_line_pointer; + c = get_symbol_end (); + + if (strcmp (start, "d2") == 0) + { + value |= 0x80; + *input_line_pointer = c; + } + else if (strcmp (start, "d3") == 0) + { + value |= 0x40; + *input_line_pointer = c; + } + else if (strcmp (start, "a2") == 0) + { + value |= 0x20; + *input_line_pointer = c; + } + else if (strcmp (start, "a3") == 0) + { + value |= 0x10; + *input_line_pointer = c; + } + else if (strcmp (start, "other") == 0) + { + value |= 0x08; + *input_line_pointer = c; + } + else + { + input_line_pointer = hold; + str = hold; + goto error; + } + } + input_line_pointer++; + mn10300_insert_operand (&insn, &extension, operand, + value, (char *) NULL, 0, 0); + goto keep_going; + + } + else if (data_register_name (&ex)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + else if (address_register_name (&ex)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + else if (other_register_name (&ex)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + else if (*str == ')' || *str == '(') + { + input_line_pointer = hold; + str = hold; + goto error; + } + else + { + expression (&ex); + } + + switch (ex.X_op) + { + case O_illegal: + errmsg = "illegal operand"; + goto error; + case O_absent: + errmsg = "missing operand"; + goto error; + case O_register: + if ((operand->flags + & (MN10300_OPERAND_DREG | MN10300_OPERAND_AREG)) == 0) + { + input_line_pointer = hold; + str = hold; + goto error; + } + + if (opcode->format == FMT_D1 || opcode->format == FMT_S1) + extra_shift = 8; + else if (opcode->format == FMT_D2 || opcode->format == FMT_D4 + || opcode->format == FMT_S2 || opcode->format == FMT_S4 + || opcode->format == FMT_S6 || opcode->format == FMT_D5) + extra_shift = 16; + else + extra_shift = 0; + + mn10300_insert_operand (&insn, &extension, operand, + ex.X_add_number, (char *) NULL, + 0, extra_shift); + + break; + + case O_constant: + /* If this operand can be promoted, and it doesn't + fit into the allocated bitfield for this insn, + then promote it (ie this opcode does not match). */ + if (operand->flags + & (MN10300_OPERAND_PROMOTE | MN10300_OPERAND_RELAX) + && ! check_operand (insn, operand, ex.X_add_number)) + { + input_line_pointer = hold; + str = hold; + goto error; + } + + mn10300_insert_operand (&insn, &extension, operand, + ex.X_add_number, (char *) NULL, + 0, 0); + break; + + default: + /* If this operand can be promoted, then this opcode didn't + match since we can't know if it needed promotion! */ + if (operand->flags & MN10300_OPERAND_PROMOTE) + { + input_line_pointer = hold; + str = hold; + goto error; + } + + /* We need to generate a fixup for this expression. */ + if (fc >= MAX_INSN_FIXUPS) + as_fatal ("too many fixups"); + fixups[fc].exp = ex; + fixups[fc].opindex = *opindex_ptr; + fixups[fc].reloc = BFD_RELOC_UNUSED; + ++fc; + break; + } + +keep_going: + str = input_line_pointer; + input_line_pointer = hold; + + while (*str == ' ' || *str == ',') + ++str; + + } + + /* Make sure we used all the operands! */ + if (*str != ',') + match = 1; + + error: + if (match == 0) + { + next_opcode = opcode + 1; + if (!strcmp(next_opcode->name, opcode->name)) + { + opcode = next_opcode; + continue; + } + + as_bad ("%s", errmsg); + return; + } + break; + } + + while (isspace (*str)) + ++str; + + if (*str != '\0') + as_bad ("junk at end of line: `%s'", str); + + input_line_pointer = str; + + /* Determine the size of the instruction. */ + if (opcode->format == FMT_S0) + size = 1; + + if (opcode->format == FMT_S1 || opcode->format == FMT_D0) + size = 2; + + if (opcode->format == FMT_S2 || opcode->format == FMT_D1) + size = 3; + + if (opcode->format == FMT_S4) + size = 5; + + if (opcode->format == FMT_S6 || opcode->format == FMT_D5) + size = 7; + + if (opcode->format == FMT_D2) + size = 4; + + if (opcode->format == FMT_D4) + size = 6; + + if (relaxable && fc > 0) + { + int type; + + /* bCC */ + if (size == 2) + type = 0; + /* call */ + else if (size == 5) + type = 6; + /* calls */ + else if (size == 4) + type = 8; + /* jmp */ + else if (size == 3 && opcode->opcode == 0xcc0000) + type = 10; + /* bCC (uncommon cases) */ + else + type = 3; + + f = frag_var (rs_machine_dependent, 8, 8 - size, type, + fixups[0].exp.X_add_symbol, + fixups[0].exp.X_add_number, + (char *)fixups[0].opindex); + + /* This is pretty hokey. We basically just care about the + opcode, so we have to write out the first word big endian. + + The exception is "call", which has two operands that we + care about. + + The first operand (the register list) happens to be in the + first instruction word, and will be in the right place if + we output the first word in big endian mode. + + The second operand (stack size) is in the extension word, + and we want it to appear as the first character in the extension + word (as it appears in memory). Luckily, writing the extension + word in big endian format will do what we want. */ + number_to_chars_bigendian (f, insn, size > 4 ? 4 : size); + if (size > 8) + { + number_to_chars_bigendian (f + 4, extension, 4); + number_to_chars_bigendian (f + 8, 0, size - 8); + } + else if (size > 4) + number_to_chars_bigendian (f + 4, extension, size - 4); + } + else + { + /* Allocate space for the instruction. */ + f = frag_more (size); + + /* Fill in bytes for the instruction. Note that opcode fields + are written big-endian, 16 & 32bit immediates are written + little endian. Egad. */ + if (opcode->format == FMT_S0 + || opcode->format == FMT_S1 + || opcode->format == FMT_D0 + || opcode->format == FMT_D1) + { + number_to_chars_bigendian (f, insn, size); + } + else if (opcode->format == FMT_S2 + && opcode->opcode != 0xdf0000 + && opcode->opcode != 0xde0000) + { + /* A format S2 instruction that is _not_ "ret" and "retf". */ + number_to_chars_bigendian (f, (insn >> 16) & 0xff, 1); + number_to_chars_littleendian (f + 1, insn & 0xffff, 2); + } + else if (opcode->format == FMT_S2) + { + /* This must be a ret or retf, which is written entirely in + big-endian format. */ + number_to_chars_bigendian (f, insn, 3); + } + else if (opcode->format == FMT_S4 + && opcode->opcode != 0xdc000000) + { + /* This must be a format S4 "call" instruction. What a pain. */ + unsigned long temp = (insn >> 8) & 0xffff; + number_to_chars_bigendian (f, (insn >> 24) & 0xff, 1); + number_to_chars_littleendian (f + 1, temp, 2); + number_to_chars_bigendian (f + 3, insn & 0xff, 1); + number_to_chars_bigendian (f + 4, extension & 0xff, 1); + } + else if (opcode->format == FMT_S4) + { + /* This must be a format S4 "jmp" instruction. */ + unsigned long temp = ((insn & 0xffffff) << 8) | (extension & 0xff); + number_to_chars_bigendian (f, (insn >> 24) & 0xff, 1); + number_to_chars_littleendian (f + 1, temp, 4); + } + else if (opcode->format == FMT_S6) + { + unsigned long temp = ((insn & 0xffffff) << 8) + | ((extension >> 16) & 0xff); + number_to_chars_bigendian (f, (insn >> 24) & 0xff, 1); + number_to_chars_littleendian (f + 1, temp, 4); + number_to_chars_bigendian (f + 5, (extension >> 8) & 0xff, 1); + number_to_chars_bigendian (f + 6, extension & 0xff, 1); + } + else if (opcode->format == FMT_D2 + && opcode->opcode != 0xfaf80000 + && opcode->opcode != 0xfaf00000 + && opcode->opcode != 0xfaf40000) + { + /* A format D2 instruction where the 16bit immediate is + really a single 16bit value, not two 8bit values. */ + number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2); + number_to_chars_littleendian (f + 2, insn & 0xffff, 2); + } + else if (opcode->format == FMT_D2) + { + /* A format D2 instruction where the 16bit immediate + is really two 8bit immediates. */ + number_to_chars_bigendian (f, insn, 4); + } + else if (opcode->format == FMT_D4) + { + unsigned long temp = ((insn & 0xffff) << 16) | (extension & 0xffff); + number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2); + number_to_chars_littleendian (f + 2, temp, 4); + } + else if (opcode->format == FMT_D5) + { + unsigned long temp = ((insn & 0xffff) << 16) + | ((extension >> 8) & 0xffff); + number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2); + number_to_chars_littleendian (f + 2, temp, 4); + number_to_chars_bigendian (f + 6, extension & 0xff, 1); + } + + /* Create any fixups. */ + for (i = 0; i < fc; i++) + { + const struct mn10300_operand *operand; + + operand = &mn10300_operands[fixups[i].opindex]; + if (fixups[i].reloc != BFD_RELOC_UNUSED) + { + reloc_howto_type *reloc_howto; + int size; + int offset; + fixS *fixP; + + reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc); + + if (!reloc_howto) + abort(); + + size = bfd_get_reloc_size (reloc_howto); + + if (size < 1 || size > 4) + abort(); + + offset = 4 - size; + fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset, + size, &fixups[i].exp, + reloc_howto->pc_relative, + fixups[i].reloc); + } + else + { + int reloc, pcrel, reloc_size, offset; + fixS *fixP; + + reloc = BFD_RELOC_NONE; + /* How big is the reloc? Remember SPLIT relocs are + implicitly 32bits. */ + if ((operand->flags & MN10300_OPERAND_SPLIT) != 0) + reloc_size = 32; + else + reloc_size = operand->bits; + + /* Is the reloc pc-relative? */ + pcrel = (operand->flags & MN10300_OPERAND_PCREL) != 0; + + /* Gross. This disgusting hack is to make sure we + get the right offset for the 16/32 bit reloc in + "call" instructions. Basically they're a pain + because the reloc isn't at the end of the instruction. */ + if ((size == 5 || size == 7) + && (((insn >> 24) & 0xff) == 0xcd + || ((insn >> 24) & 0xff) == 0xdd)) + size -= 2; + + /* Similarly for certain bit instructions which don't + hav their 32bit reloc at the tail of the instruction. */ + if (size == 7 + && (((insn >> 16) & 0xffff) == 0xfe00 + || ((insn >> 16) & 0xffff) == 0xfe01 + || ((insn >> 16) & 0xffff) == 0xfe02)) + size -= 1; + + offset = size - reloc_size / 8; + + /* Choose a proper BFD relocation type. */ + if (pcrel) + { + if (reloc_size == 32) + reloc = BFD_RELOC_32_PCREL; + else if (reloc_size == 16) + reloc = BFD_RELOC_16_PCREL; + else if (reloc_size == 8) + reloc = BFD_RELOC_8_PCREL; + else + abort (); + } + else + { + if (reloc_size == 32) + reloc = BFD_RELOC_32; + else if (reloc_size == 16) + reloc = BFD_RELOC_16; + else if (reloc_size == 8) + reloc = BFD_RELOC_8; + else + abort (); + } + + /* Convert the size of the reloc into what fix_new_exp wants. */ + reloc_size = reloc_size / 8; + if (reloc_size == 8) + reloc_size = 0; + else if (reloc_size == 16) + reloc_size = 1; + else if (reloc_size == 32) + reloc_size = 2; + + fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset, + reloc_size, &fixups[i].exp, pcrel, + ((bfd_reloc_code_real_type) reloc)); + + if (pcrel) + fixP->fx_offset += offset; + } + } + } +} + + +/* if while processing a fixup, a reloc really needs to be created */ +/* then it is done here */ + +arelent * +tc_gen_reloc (seg, fixp) + asection *seg; + fixS *fixp; +{ + arelent *reloc; + reloc = (arelent *) xmalloc (sizeof (arelent)); + + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); + if (reloc->howto == (reloc_howto_type *) NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + "reloc %d not supported by object file format", + (int)fixp->fx_r_type); + return NULL; + } + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; + + if (fixp->fx_addsy && fixp->fx_subsy) + { + reloc->sym_ptr_ptr = &bfd_abs_symbol; + reloc->addend = (S_GET_VALUE (fixp->fx_addsy) + - S_GET_VALUE (fixp->fx_subsy) + fixp->fx_offset); + } + else + { + reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym; + reloc->addend = fixp->fx_offset; + } + return reloc; +} + +int +md_estimate_size_before_relax (fragp, seg) + fragS *fragp; + asection *seg; +{ + if (fragp->fr_subtype == 0) + return 2; + if (fragp->fr_subtype == 3) + return 3; + if (fragp->fr_subtype == 6) + { + if (!S_IS_DEFINED (fragp->fr_symbol) + || seg != S_GET_SEGMENT (fragp->fr_symbol)) + { + fragp->fr_subtype = 7; + return 7; + } + else + return 5; + } + if (fragp->fr_subtype == 8) + { + if (!S_IS_DEFINED (fragp->fr_symbol) + || seg != S_GET_SEGMENT (fragp->fr_symbol)) + { + fragp->fr_subtype = 9; + return 6; + } + else + return 4; + } + if (fragp->fr_subtype == 10) + { + if (!S_IS_DEFINED (fragp->fr_symbol) + || seg != S_GET_SEGMENT (fragp->fr_symbol)) + { + fragp->fr_subtype = 12; + return 5; + } + else + return 2; + } +} + +long +md_pcrel_from (fixp) + fixS *fixp; +{ + return fixp->fx_frag->fr_address; +#if 0 + if (fixp->fx_addsy != (symbolS *) NULL && ! S_IS_DEFINED (fixp->fx_addsy)) + { + /* The symbol is undefined. Let the linker figure it out. */ + return 0; + } + return fixp->fx_frag->fr_address + fixp->fx_where; +#endif +} + +int +md_apply_fix3 (fixp, valuep, seg) + fixS *fixp; + valueT *valuep; + segT seg; +{ + /* We shouldn't ever get here because linkrelax is nonzero. */ + abort (); + fixp->fx_done = 1; + return 0; +} + +/* Insert an operand value into an instruction. */ + +static void +mn10300_insert_operand (insnp, extensionp, operand, val, file, line, shift) + unsigned long *insnp; + unsigned long *extensionp; + const struct mn10300_operand *operand; + offsetT val; + char *file; + unsigned int line; + unsigned int shift; +{ + /* No need to check 32bit operands for a bit. Note that + MN10300_OPERAND_SPLIT is an implicit 32bit operand. */ + if (operand->bits != 32 + && (operand->flags & MN10300_OPERAND_SPLIT) == 0) + { + long min, max; + offsetT test; + + if ((operand->flags & MN10300_OPERAND_SIGNED) != 0) + { + max = (1 << (operand->bits - 1)) - 1; + min = - (1 << (operand->bits - 1)); + } + else + { + max = (1 << operand->bits) - 1; + min = 0; + } + + test = val; + + + if (test < (offsetT) min || test > (offsetT) max) + { + const char *err = + "operand out of range (%s not between %ld and %ld)"; + char buf[100]; + + sprint_value (buf, test); + if (file == (char *) NULL) + as_warn (err, buf, min, max); + else + as_warn_where (file, line, err, buf, min, max); + } + } + + if ((operand->flags & MN10300_OPERAND_SPLIT) != 0) + { + *insnp |= (val >> (32 - operand->bits)) & ((1 << operand->bits) - 1); + *extensionp |= ((val & ((1 << (32 - operand->bits)) - 1)) + << operand->shift); + } + else if ((operand->flags & MN10300_OPERAND_EXTENDED) == 0) + { + *insnp |= (((long) val & ((1 << operand->bits) - 1)) + << (operand->shift + shift)); + + if ((operand->flags & MN10300_OPERAND_REPEATED) != 0) + *insnp |= (((long) val & ((1 << operand->bits) - 1)) + << (operand->shift + shift + 2)); + } + else + { + *extensionp |= (((long) val & ((1 << operand->bits) - 1)) + << (operand->shift + shift)); + + if ((operand->flags & MN10300_OPERAND_REPEATED) != 0) + *extensionp |= (((long) val & ((1 << operand->bits) - 1)) + << (operand->shift + shift + 2)); + } +} + +static unsigned long +check_operand (insn, operand, val) + unsigned long insn; + const struct mn10300_operand *operand; + offsetT val; +{ + /* No need to check 32bit operands for a bit. Note that + MN10300_OPERAND_SPLIT is an implicit 32bit operand. */ + if (operand->bits != 32 + && (operand->flags & MN10300_OPERAND_SPLIT) == 0) + { + long min, max; + offsetT test; + + if ((operand->flags & MN10300_OPERAND_SIGNED) != 0) + { + max = (1 << (operand->bits - 1)) - 1; + min = - (1 << (operand->bits - 1)); + } + else + { + max = (1 << operand->bits) - 1; + min = 0; + } + + test = val; + + + if (test < (offsetT) min || test > (offsetT) max) + return 0; + else + return 1; + } + return 1; +} diff -urN binutils-2.7/gas/config/tc-mn10300.h binutils-2.8/gas/config/tc-mn10300.h --- binutils-2.7/gas/config/tc-mn10300.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/tc-mn10300.h Wed Apr 30 12:53:21 1997 @@ -0,0 +1,50 @@ +/* tc-mn10300.h -- Header file for tc-mn10300.c. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#define TC_MN10300 + +#define TARGET_BYTES_BIG_ENDIAN 0 + +#ifndef BFD_ASSEMBLER + #error MN10300 support requires BFD_ASSEMBLER +#endif + +/* The target BFD architecture. */ +#define TARGET_ARCH bfd_arch_mn10300 + +#define TARGET_FORMAT "elf32-mn10300" + +#define MD_APPLY_FIX3 +#define md_operand(x) + +/* Permit temporary numeric labels. */ +#define LOCAL_LABELS_FB 1 + +/* We don't need to handle .word strangely. */ +#define WORKING_DOT_WORD + +#define md_number_to_chars number_to_chars_littleendian + +/* Don't bother to adjust relocs. */ +#define tc_fix_adjustable(FIX) 0 + +/* We do relaxing in the assembler as well as the linker. */ +extern const struct relax_type md_relax_table[]; +#define TC_GENERIC_RELAX_TABLE md_relax_table diff -urN binutils-2.7/gas/config/tc-ns32k.c binutils-2.8/gas/config/tc-ns32k.c --- binutils-2.7/gas/config/tc-ns32k.c Thu Jul 4 12:14:26 1996 +++ binutils-2.8/gas/config/tc-ns32k.c Wed Apr 30 12:53:21 1997 @@ -1,5 +1,5 @@ /* ns32k.c -- Assemble on the National Semiconductor 32k series - Copyright (C) 1987, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1987, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -1421,8 +1421,8 @@ ? inst_opcode : (char *) opcode_location)); if (first) - old_frag->fr_pcrel_adjust = (char) size_so_far; - old_frag->fr_bsr = iif.iifP[i].bsr; + old_frag->fr_targ.ns32k.pcrel_adjust = (char) size_so_far; + old_frag->fr_targ.ns32k.bsr = iif.iifP[i].bsr; } if (first) { @@ -1896,7 +1896,7 @@ int ret; int st = fragP->fr_subtype; unsigned int opcode_address; - if ((st >> 2) == BRANCH && fragP->fr_pcrel_adjust == 0) { + if ((st >> 2) == BRANCH && fragP->fr_targ.ns32k.pcrel_adjust == 0) { unsigned int offset; opcode_frag = ((struct opcode_location *) fragP->fr_opcode)->fragP; offset = ((struct opcode_location *) fragP->fr_opcode)->offset; @@ -1904,7 +1904,7 @@ ret = fragP->fr_address - opcode_address; } else - ret = fragP->fr_pcrel_adjust; + ret = fragP->fr_targ.ns32k.pcrel_adjust; return ret; } @@ -2068,10 +2068,10 @@ fragP->fr_symbol, fragP->fr_offset, 1, - fragP->fr_pcrel_adjust, + fragP->fr_targ.ns32k.pcrel_adjust, 1, 0, - fragP->fr_bsr); /*sequent hack */ + fragP->fr_targ.ns32k.bsr); /*sequent hack */ fragP->fr_fix += 4; /* fragP->fr_opcode[1]=0xff; */ frag_wane (fragP); @@ -2297,7 +2297,7 @@ long res; res = fixP->fx_where + fixP->fx_frag->fr_address; #ifdef SEQUENT_COMPATABILITY - if (fixP->fx_frag->fr_bsr) + if (fixP->fx_frag->fr_targ.ns32k.bsr) res += 0x12 /* FOO Kludge alert! */ #endif return res; @@ -2315,8 +2315,7 @@ code = reloc(fixp->fx_size, fixp->fx_pcrel, fixp->fx_im_disp); - rel = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent)); - assert (rel != 0); + rel = (arelent *) xmalloc (sizeof (arelent)); rel->sym_ptr_ptr = &fixp->fx_addsy->bsym; rel->address = fixp->fx_frag->fr_address + fixp->fx_where; if (fixp->fx_pcrel) diff -urN binutils-2.7/gas/config/tc-ns32k.h binutils-2.8/gas/config/tc-ns32k.h --- binutils-2.7/gas/config/tc-ns32k.h Thu Jul 4 12:14:26 1996 +++ binutils-2.8/gas/config/tc-ns32k.h Wed Apr 30 12:53:21 1997 @@ -1,5 +1,5 @@ /* tc-ns32k.h -- Opcode table for National Semi 32k processor - Copyright (C) 1987, 1992 Free Software Foundation, Inc. + Copyright (C) 1987, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,18 +14,20 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #define TC_NS32K +#define TARGET_BYTES_BIG_ENDIAN 0 + #define TC_PCREL_ADJUST(F) md_pcrel_adjust(F) #ifdef BFD_ASSEMBLER #define NO_RELOC BFD_RELOC_NONE #define TARGET_ARCH bfd_arch_ns32k -#define TARGET_BYTES_BIG_ENDIAN 0 #ifndef TARGET_FORMAT #define TARGET_FORMAT "a.out-pc532-mach" diff -urN binutils-2.7/gas/config/tc-ppc.c binutils-2.8/gas/config/tc-ppc.c --- binutils-2.7/gas/config/tc-ppc.c Mon Jul 15 14:02:49 1996 +++ binutils-2.8/gas/config/tc-ppc.c Wed Apr 30 12:53:21 1997 @@ -1,5 +1,5 @@ /* tc-ppc.c -- Assemble for the PowerPC or POWER (RS/6000) - Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #include #include @@ -52,6 +53,7 @@ static boolean reg_names_p = TARGET_REG_NAMES_P; +static boolean register_name PARAMS ((expressionS *)); static void ppc_set_cpu PARAMS ((void)); static unsigned long ppc_insert_operand PARAMS ((unsigned long insn, const struct powerpc_operand *operand, @@ -81,10 +83,11 @@ static void ppc_stabx PARAMS ((int)); static void ppc_rename PARAMS ((int)); static void ppc_toc PARAMS ((int)); +static void ppc_xcoff_cons PARAMS ((int)); #endif #ifdef OBJ_ELF -static bfd_reloc_code_real_type ppc_elf_suffix PARAMS ((char **)); +static bfd_reloc_code_real_type ppc_elf_suffix PARAMS ((char **, expressionS *)); static void ppc_elf_cons PARAMS ((int)); static void ppc_elf_rdata PARAMS ((int)); static void ppc_elf_lcomm PARAMS ((int)); @@ -109,9 +112,19 @@ /* Generic assembler global variables which must be defined by all targets. */ -/* Characters which always start a comment. */ +#ifdef OBJ_ELF +/* This string holds the chars that always start a comment. If the + pre-processor is disabled, these aren't very useful. The macro + tc_comment_chars points to this. We use this, rather than the + usual comment_chars, so that we can switch for Solaris conventions. */ +static const char ppc_solaris_comment_chars[] = "#!"; +static const char ppc_eabi_comment_chars[] = "#"; + #ifdef TARGET_SOLARIS_COMMENT -const char comment_chars[] = "#!"; +const char *ppc_comment_chars = ppc_solaris_comment_chars; +#else +const char *ppc_comment_chars = ppc_eabi_comment_chars; +#endif #else const char comment_chars[] = "#"; #endif @@ -164,6 +177,9 @@ { "stabx", ppc_stabx, 0 }, { "text", ppc_section, 't' }, { "toc", ppc_toc, 0 }, + { "long", ppc_xcoff_cons, 2 }, + { "word", ppc_xcoff_cons, 1 }, + { "short", ppc_xcoff_cons, 1 }, #endif #ifdef OBJ_ELF @@ -427,28 +443,31 @@ /* Given NAME, find the register number associated with that name, return the integer value associated with the given name or -1 on failure. */ -static int reg_name_search PARAMS ( (char * name) ); +static int reg_name_search + PARAMS ((const struct pd_reg *, int, const char * name)); static int -reg_name_search (name) - char *name; +reg_name_search (regs, regcount, name) + const struct pd_reg *regs; + int regcount; + const char *name; { int middle, low, high; int cmp; low = 0; - high = REG_NAME_CNT - 1; + high = regcount - 1; do { middle = (low + high) / 2; - cmp = strcasecmp (name, pre_defined_registers[middle].name); + cmp = strcasecmp (name, regs[middle].name); if (cmp < 0) high = middle - 1; else if (cmp > 0) low = middle + 1; else - return pre_defined_registers[middle].value; + return regs[middle].value; } while (low <= high); @@ -485,7 +504,7 @@ return false; c = get_symbol_end (); - reg_number = reg_name_search (name); + reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name); /* look to see if it's in the register table */ if (reg_number >= 0) @@ -507,7 +526,55 @@ return false; } } + +/* This function is called for each symbol seen in an expression. It + handles the special parsing which PowerPC assemblers are supposed + to use for condition codes. */ + +/* Whether to do the special parsing. */ +static boolean cr_operand; + +/* Names to recognize in a condition code. This table is sorted. */ +static const struct pd_reg cr_names[] = +{ + { "cr0", 0 }, + { "cr1", 1 }, + { "cr2", 2 }, + { "cr3", 3 }, + { "cr4", 4 }, + { "cr5", 5 }, + { "cr6", 6 }, + { "cr7", 7 }, + { "eq", 2 }, + { "gt", 1 }, + { "lt", 0 }, + { "so", 3 }, + { "un", 3 } +}; + +/* Parsing function. This returns non-zero if it recognized an + expression. */ + +int +ppc_parse_name (name, expr) + const char *name; + expressionS *expr; +{ + int val; + + if (! cr_operand) + return 0; + + val = reg_name_search (cr_names, sizeof cr_names / sizeof cr_names[0], + name); + if (val < 0) + return 0; + + expr->X_op = O_constant; + expr->X_add_number = val; + return 1; +} /* Local variables. */ @@ -526,12 +593,20 @@ static struct hash_control *ppc_macro_hash; #ifdef OBJ_ELF -/* Whether to warn about non PC relative relocations that aren't - in the .got2 section. */ -static boolean mrelocatable = false; +/* What type of shared library support to use */ +static enum { SHLIB_NONE, SHLIB_PIC, SHILB_MRELOCATABLE } shlib = SHLIB_NONE; /* Flags to set in the elf header */ static flagword ppc_flags = 0; + +/* Whether this is Solaris or not. */ +#ifdef TARGET_SOLARIS_COMMENT +#define SOLARIS_P true +#else +#define SOLARIS_P false +#endif + +static boolean msolaris = SOLARIS_P; #endif #ifdef OBJ_XCOFF @@ -654,9 +729,9 @@ case 'K': /* Recognize -K PIC */ - if (strcmp (arg, "PIC") == 0) + if (strcmp (arg, "PIC") == 0 || strcmp (arg, "pic") == 0) { - mrelocatable = true; + shlib = SHLIB_PIC; ppc_flags |= EF_PPC_RELOCATABLE_LIB; } else @@ -711,13 +786,13 @@ /* -mrelocatable/-mrelocatable-lib -- warn about initializations that require relocation */ else if (strcmp (arg, "relocatable") == 0) { - mrelocatable = true; + shlib = SHILB_MRELOCATABLE; ppc_flags |= EF_PPC_RELOCATABLE; } else if (strcmp (arg, "relocatable-lib") == 0) { - mrelocatable = true; + shlib = SHILB_MRELOCATABLE; ppc_flags |= EF_PPC_RELOCATABLE_LIB; } @@ -737,6 +812,18 @@ target_big_endian = 1; set_target_endian = 1; } + + else if (strcmp (arg, "solaris") == 0) + { + msolaris = true; + ppc_comment_chars = ppc_solaris_comment_chars; + } + + else if (strcmp (arg, "no-solaris") == 0) + { + msolaris = false; + ppc_comment_chars = ppc_eabi_comment_chars; + } #endif else { @@ -798,6 +885,8 @@ -mlittle, -mlittle-endian\n\ generate code for a little endian machine\n\ -mbig, -mbig-endian generate code for a big endian machine\n\ +-msolaris generate code for Solaris\n\ +-mno-solaris do not generate code for Solaris\n\ -V print assembler version number\n\ -Qy, -Qn ignored\n"); #endif @@ -870,7 +959,7 @@ #ifdef OBJ_ELF /* Set the ELF flags if desired. */ - if (ppc_flags) + if (ppc_flags && !msolaris) bfd_set_private_flags (stdoutput, ppc_flags); #endif @@ -994,9 +1083,9 @@ sprint_value (buf, test); if (file == (char *) NULL) - as_warn (err, buf, min, max); + as_bad (err, buf, min, max); else - as_warn_where (file, line, err, buf, min, max); + as_bad_where (file, line, err, buf, min, max); } } @@ -1007,7 +1096,7 @@ errmsg = NULL; insn = (*operand->insert) (insn, (long) val, &errmsg); if (errmsg != (const char *) NULL) - as_warn (errmsg); + as_bad (errmsg); } else insn |= (((long) val & ((1 << operand->bits) - 1)) @@ -1020,8 +1109,9 @@ #ifdef OBJ_ELF /* Parse @got, etc. and return the desired relocation. */ static bfd_reloc_code_real_type -ppc_elf_suffix (str_p) +ppc_elf_suffix (str_p, exp_p) char **str_p; + expressionS *exp_p; { struct map_bfd { char *string; @@ -1049,11 +1139,12 @@ MAP ("got@h", BFD_RELOC_HI16_GOTOFF), MAP ("got@ha", BFD_RELOC_HI16_S_GOTOFF), MAP ("fixup", BFD_RELOC_CTOR), /* warnings with -mrelocatable */ + MAP ("plt", BFD_RELOC_24_PLT_PCREL), MAP ("pltrel24", BFD_RELOC_24_PLT_PCREL), MAP ("copy", BFD_RELOC_PPC_COPY), MAP ("globdat", BFD_RELOC_PPC_GLOB_DAT), MAP ("local24pc", BFD_RELOC_PPC_LOCAL24PC), - MAP ("plt", BFD_RELOC_32_PLTOFF), + MAP ("local", BFD_RELOC_PPC_LOCAL24PC), MAP ("pltrel", BFD_RELOC_32_PLT_PCREL), MAP ("plt@l", BFD_RELOC_LO16_PLTOFF), MAP ("plt@h", BFD_RELOC_HI16_PLTOFF), @@ -1102,6 +1193,24 @@ for (ptr = &mapping[0]; ptr->length > 0; ptr++) if (ch == ptr->string[0] && len == ptr->length && memcmp (ident, ptr->string, ptr->length) == 0) { + /* Now check for identifier@suffix+constant */ + if (*str == '-' || *str == '+') + { + char *orig_line = input_line_pointer; + expressionS new_exp; + + input_line_pointer = str; + expression (&new_exp); + if (new_exp.X_op == O_constant) + { + exp_p->X_add_number += new_exp.X_add_number; + str = input_line_pointer; + } + + if (&input_line_pointer != str_p) + input_line_pointer = orig_line; + } + *str_p = str; return ptr->reloc; } @@ -1130,7 +1239,7 @@ expression (&exp); if (exp.X_op == O_symbol && *input_line_pointer == '@' - && (reloc = ppc_elf_suffix (&input_line_pointer)) != BFD_RELOC_UNUSED) + && (reloc = ppc_elf_suffix (&input_line_pointer, &exp)) != BFD_RELOC_UNUSED) { reloc_howto_type *reloc_howto = bfd_reloc_type_lookup (stdoutput, reloc); int size = bfd_get_reloc_size (reloc_howto); @@ -1210,7 +1319,7 @@ /* The third argument to .lcomm is the alignment. */ if (*input_line_pointer != ',') - align = 3; + align = 8; else { ++input_line_pointer; @@ -1218,7 +1327,7 @@ if (align <= 0) { as_warn ("ignoring bad alignment"); - align = 3; + align = 8; } } @@ -1226,7 +1335,7 @@ symbolP = symbol_find_or_make (name); *p = c; - if (S_IS_DEFINED (symbolP)) + if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) { as_bad ("Ignoring attempt to re-define symbol `%s'.", S_GET_NAME (symbolP)); @@ -1265,7 +1374,7 @@ record_alignment (bss_section, align2); subseg_set (bss_section, 0); if (align2) - frag_align (align2, 0); + frag_align (align2, 0, 0); if (S_GET_SEGMENT (symbolP) == bss_section) symbolP->sy_frag->fr_symbol = 0; symbolP->sy_frag = frag_now; @@ -1274,7 +1383,6 @@ *pfrag = 0; S_SET_SIZE (symbolP, size); S_SET_SEGMENT (symbolP, bss_section); - S_CLEAR_EXTERNAL (symbolP); subseg_set (old_sec, old_subsec); demand_empty_rest_of_line (); } @@ -1287,32 +1395,41 @@ fixS *fixp; segT seg; { - if (mrelocatable - && !fixp->fx_done - && !fixp->fx_pcrel - && fixp->fx_r_type <= BFD_RELOC_UNUSED - && fixp->fx_r_type != BFD_RELOC_16_GOTOFF - && fixp->fx_r_type != BFD_RELOC_HI16_GOTOFF - && fixp->fx_r_type != BFD_RELOC_LO16_GOTOFF - && fixp->fx_r_type != BFD_RELOC_HI16_S_GOTOFF - && fixp->fx_r_type != BFD_RELOC_32_BASEREL - && fixp->fx_r_type != BFD_RELOC_LO16_BASEREL - && fixp->fx_r_type != BFD_RELOC_HI16_BASEREL - && fixp->fx_r_type != BFD_RELOC_HI16_S_BASEREL - && strcmp (segment_name (seg), ".got2") != 0 - && strcmp (segment_name (seg), ".dtors") != 0 - && strcmp (segment_name (seg), ".ctors") != 0 - && strcmp (segment_name (seg), ".fixup") != 0 - && strcmp (segment_name (seg), ".stab") != 0 - && strcmp (segment_name (seg), ".gcc_except_table") != 0 - && strcmp (segment_name (seg), ".ex_shared") != 0) + if (fixp->fx_done || fixp->fx_pcrel) + return; + + switch (shlib) { - if ((seg->flags & (SEC_READONLY | SEC_CODE)) != 0 - || fixp->fx_r_type != BFD_RELOC_CTOR) + case SHLIB_NONE: + case SHLIB_PIC: + return; + + case SHILB_MRELOCATABLE: + if (fixp->fx_r_type <= BFD_RELOC_UNUSED + && fixp->fx_r_type != BFD_RELOC_16_GOTOFF + && fixp->fx_r_type != BFD_RELOC_HI16_GOTOFF + && fixp->fx_r_type != BFD_RELOC_LO16_GOTOFF + && fixp->fx_r_type != BFD_RELOC_HI16_S_GOTOFF + && fixp->fx_r_type != BFD_RELOC_32_BASEREL + && fixp->fx_r_type != BFD_RELOC_LO16_BASEREL + && fixp->fx_r_type != BFD_RELOC_HI16_BASEREL + && fixp->fx_r_type != BFD_RELOC_HI16_S_BASEREL + && strcmp (segment_name (seg), ".got2") != 0 + && strcmp (segment_name (seg), ".dtors") != 0 + && strcmp (segment_name (seg), ".ctors") != 0 + && strcmp (segment_name (seg), ".fixup") != 0 + && strcmp (segment_name (seg), ".stab") != 0 + && strcmp (segment_name (seg), ".gcc_except_table") != 0 + && strcmp (segment_name (seg), ".ex_shared") != 0) { - as_warn_where (fixp->fx_file, fixp->fx_line, - "Relocation cannot be done when using -mrelocatable"); + if ((seg->flags & (SEC_READONLY | SEC_CODE)) != 0 + || fixp->fx_r_type != BFD_RELOC_CTOR) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + "Relocation cannot be done when using -mrelocatable"); + } } + return; } } #endif /* OBJ_ELF */ @@ -1548,7 +1665,7 @@ { insn = (*operand->insert) (insn, 0L, &errmsg); if (errmsg != (const char *) NULL) - as_warn (errmsg); + as_bad (errmsg); continue; } @@ -1561,7 +1678,7 @@ { insn = (*operand->insert) (insn, 0L, &errmsg); if (errmsg != (const char *) NULL) - as_warn (errmsg); + as_bad (errmsg); } if ((operand->flags & PPC_OPERAND_NEXT) != 0) next_opindex = *opindex_ptr + 1; @@ -1638,7 +1755,7 @@ assert (ex.X_add_symbol != NULL); if (ex.X_add_symbol->bsym->section != tocdata_section) { - as_warn("[tocv] symbol is not a toc symbol"); + as_bad("[tocv] symbol is not a toc symbol"); } } @@ -1684,8 +1801,15 @@ else #endif /* TE_PE */ - if (!register_name(&ex)) - expression (&ex); + { + if (! register_name (&ex)) + { + if ((operand->flags & PPC_OPERAND_CR) != 0) + cr_operand = true; + expression (&ex); + cr_operand = false; + } + } str = input_line_pointer; input_line_pointer = hold; @@ -1705,7 +1829,7 @@ /* Allow @HA, @L, @H on constants. */ char *orig_str = str; - if ((reloc = ppc_elf_suffix (&str)) != BFD_RELOC_UNUSED) + if ((reloc = ppc_elf_suffix (&str, &ex)) != BFD_RELOC_UNUSED) switch (reloc) { default: @@ -1735,7 +1859,7 @@ (char *) NULL, 0); } #ifdef OBJ_ELF - else if ((reloc = ppc_elf_suffix (&str)) != BFD_RELOC_UNUSED) + else if ((reloc = ppc_elf_suffix (&str, &ex)) != BFD_RELOC_UNUSED) { /* For the absoulte forms of branchs, convert the PC relative form back into the absolute. */ @@ -2202,7 +2326,7 @@ } subseg_set (bss_section, 1); - frag_align (align, 0); + frag_align (align, 0, 0); def_sym->sy_frag = frag_now; pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, def_sym, @@ -2945,6 +3069,18 @@ demand_empty_rest_of_line (); } +/* The AIX assembler automatically aligns the operands of a .long or + .short pseudo-op, and we want to be compatible. */ + +static void +ppc_xcoff_cons (log_size) + int log_size; +{ + frag_align (log_size, 0, 0); + record_alignment (now_seg, log_size); + cons (1 << log_size); +} + #endif /* OBJ_XCOFF */ /* The .tc pseudo-op. This is used when generating either XCOFF or @@ -2993,7 +3129,7 @@ label = ppc_current_csect->sy_tc.within; if (label->sy_tc.class != XMC_TC0) { - as_warn (".tc with no label"); + as_bad (".tc with no label"); ignore_rest_of_line (); return; } @@ -3028,7 +3164,7 @@ ++input_line_pointer; /* Align to a four byte boundary. */ - frag_align (2, 0); + frag_align (2, 0, 0); record_alignment (now_seg, 2); #endif /* ! defined (OBJ_XCOFF) */ @@ -3347,7 +3483,7 @@ symbolP = symbol_find_or_make (name); *p = c; - if (S_IS_DEFINED (symbolP)) + if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) { as_bad ("Ignoring attempt to re-define symbol `%s'.", S_GET_NAME (symbolP)); @@ -3487,7 +3623,7 @@ { /* Section Contents */ case 'a': /* unknown */ - as_warn ("Unsupported section attribute -- 'a'"); + as_bad ("Unsupported section attribute -- 'a'"); break; case 'c': /* code section */ flags |= SEC_CODE; @@ -3557,8 +3693,8 @@ break; default: - as_warn("unknown section attribute '%c'", - *input_line_pointer); + as_bad("unknown section attribute '%c'", + *input_line_pointer); break; } ++input_line_pointer; @@ -3575,9 +3711,9 @@ if (flags != SEC_NO_FLAGS) { if (! bfd_set_section_flags (stdoutput, sec, flags)) - as_warn ("error setting flags for \"%s\": %s", - bfd_section_name (stdoutput, sec), - bfd_errmsg (bfd_get_error ())); + as_bad ("error setting flags for \"%s\": %s", + bfd_section_name (stdoutput, sec), + bfd_errmsg (bfd_get_error ())); } bfd_set_section_alignment(stdoutput, sec, align); @@ -3850,7 +3986,7 @@ if (SF_GET_FUNCTION (sym)) { if (ppc_last_function != (symbolS *) NULL) - as_warn ("two .function pseudo-ops with no intervening .ef"); + as_bad ("two .function pseudo-ops with no intervening .ef"); ppc_last_function = sym; if (sym->sy_tc.size != (symbolS *) NULL) { @@ -3862,7 +3998,7 @@ && strcmp (S_GET_NAME (sym), ".ef") == 0) { if (ppc_last_function == (symbolS *) NULL) - as_warn (".ef with no preceding .function"); + as_bad (".ef with no preceding .function"); else { set_end = ppc_last_function; @@ -4343,7 +4479,31 @@ return 0; } -#endif +/* A reloc from one csect to another must be kept. The assembler + will, of course, keep relocs between sections, and it will keep + absolute relocs, but we need to force it to keep PC relative relocs + between two csects in the same section. */ + +int +ppc_force_relocation (fix) + fixS *fix; +{ + /* At this point fix->fx_addsy should already have been converted to + a csect symbol. If the csect does not include the fragment, then + we need to force the relocation. */ + if (fix->fx_pcrel + && fix->fx_addsy != NULL + && fix->fx_addsy->sy_tc.subseg != 0 + && (fix->fx_addsy->sy_frag->fr_address > fix->fx_frag->fr_address + || (fix->fx_addsy->sy_tc.next != NULL + && (fix->fx_addsy->sy_tc.next->sy_frag->fr_address + <= fix->fx_frag->fr_address)))) + return 1; + + return 0; +} + +#endif /* OBJ_XCOFF */ /* See whether a symbol is in the TOC section. */ @@ -4378,9 +4538,9 @@ /* FIXME FIXME FIXME: The value we are passed in *valuep includes the symbol values. Since we are using BFD_ASSEMBLER, if we are doing this relocation the code in write.c is going to call - bfd_perform_relocation, which is also going to use the symbol + bfd_install_relocation, which is also going to use the symbol value. That means that if the reloc is fully resolved we want to - use *valuep since bfd_perform_relocation is not being used. + use *valuep since bfd_install_relocation is not being used. However, if the reloc is not fully resolved we do not want to use *valuep, and must use fx_offset instead. However, if the reloc is PC relative, we do want to use *valuep since it includes the @@ -4499,8 +4659,17 @@ } else { - as_bad_where (fixp->fx_file, fixp->fx_line, - "unresolved expression that must be resolved"); + char *sfile; + unsigned int sline; + + /* Use expr_symbol_where to see if this is an expression + symbol. */ + if (expr_symbol_where (fixp->fx_addsy, &sfile, &sline)) + as_bad_where (fixp->fx_file, fixp->fx_line, + "unresolved expression that must be resolved"); + else + as_bad_where (fixp->fx_file, fixp->fx_line, + "unsupported relocation type"); fixp->fx_done = 1; return 1; } @@ -4584,6 +4753,13 @@ value, 1); break; + case BFD_RELOC_24_PLT_PCREL: + case BFD_RELOC_PPC_LOCAL24PC: + if (!fixp->fx_pcrel) + abort (); + + break; + default: fprintf(stderr, "Gas failure, reloc value %d\n", fixp->fx_r_type); @@ -4622,7 +4798,7 @@ { arelent *reloc; - reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent)); + reloc = (arelent *) xmalloc (sizeof (arelent)); reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym; reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; diff -urN binutils-2.7/gas/config/tc-ppc.h binutils-2.8/gas/config/tc-ppc.h --- binutils-2.7/gas/config/tc-ppc.h Thu Jul 4 12:14:31 1996 +++ binutils-2.8/gas/config/tc-ppc.h Wed Apr 30 12:53:21 1997 @@ -1,5 +1,5 @@ /* tc-ppc.h -- Header file for tc-ppc.c. - Copyright (C) 1994 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GAS, the GNU Assembler. @@ -15,11 +15,21 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #define TC_PPC +#ifdef ANSI_PROTOTYPES +struct fix; +#endif + +/* Set the endianness we are using. Default to big endian. */ +#ifndef TARGET_BYTES_BIG_ENDIAN +#define TARGET_BYTES_BIG_ENDIAN 1 +#endif + #ifndef BFD_ASSEMBLER #error PowerPC support requires BFD_ASSEMBLER #endif @@ -73,27 +83,11 @@ #define NO_STRING_ESCAPES #endif -/* When using COFF, we determine whether or not to output a symbol - based on sy_tc.output, not on the name. */ -#ifdef OBJ_XCOFF -#define LOCAL_LABEL(name) 0 -#endif #ifdef OBJ_ELF -/* When using ELF, local labels start with '.'. */ -#define LOCAL_LABEL(name) (name[0] == '.' \ - && (name[1] == 'L' || name[1] == '.')) -#define FAKE_LABEL_NAME ".L0\001" #define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */ #endif -/* Set the endianness we are using. Default to big endian. */ -#ifndef TARGET_BYTES_BIG_ENDIAN -#ifndef TARGET_BYTES_LITTLE_ENDIAN -#define TARGET_BYTES_BIG_ENDIAN 1 -#endif -#endif - -#ifdef TARGET_BYTES_BIG_ENDIAN +#if TARGET_BYTES_BIG_ENDIAN #define PPC_BIG_ENDIAN 1 #else #define PPC_BIG_ENDIAN 0 @@ -174,6 +168,10 @@ #define tc_fix_adjustable(fixp) ppc_fix_adjustable (fixp) extern int ppc_fix_adjustable PARAMS ((struct fix *)); +/* A relocation from one csect to another must be kept. */ +#define TC_FORCE_RELOCATION(FIXP) ppc_force_relocation (FIXP) +extern int ppc_force_relocation PARAMS ((struct fix *)); + /* We need to set the section VMA. */ #define tc_frob_section(sec) ppc_frob_section (sec) extern void ppc_frob_section PARAMS ((asection *)); @@ -230,6 +228,9 @@ { ".PPC.EMB.sdata0", SHT_PROGBITS, SHF_ALLOC }, \ { ".PPC.EMB.sbss0", SHT_PROGBITS, SHF_ALLOC }, +#define tc_comment_chars ppc_comment_chars +extern const char *ppc_comment_chars; + #endif /* OBJ_ELF */ /* call md_apply_fix3 with segment instead of md_apply_fix */ @@ -237,6 +238,10 @@ /* call md_pcrel_from_section, not md_pcrel_from */ #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC) +extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); + +#define md_parse_name(name, exp) ppc_parse_name (name, exp) +extern int ppc_parse_name PARAMS ((const char *, struct expressionS *)); #define md_operand(x) diff -urN binutils-2.7/gas/config/tc-sh.c binutils-2.8/gas/config/tc-sh.c --- binutils-2.7/gas/config/tc-sh.c Thu Jul 4 12:14:36 1996 +++ binutils-2.8/gas/config/tc-sh.c Wed Apr 30 12:53:21 1997 @@ -1,6 +1,5 @@ /* tc-sh.c -- Assemble code for the Hitachi Super-H - - Copyright (C) 1993, 94, 95, 1996 Free Software Foundation. + Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation. This file is part of GAS, the GNU Assembler. @@ -37,6 +36,9 @@ static void s_uses PARAMS ((int)); +static void sh_count_relocs PARAMS ((bfd *, segT, PTR)); +static void sh_frob_section PARAMS ((bfd *, segT, PTR)); + /* This table describes all the machine specific pseudo-ops the assembler has to support. The fields are: pseudo-op name without dot @@ -815,31 +817,31 @@ nbuf[index] = reg_b | 0x08; break; case DISP_4: - insert (output + low_byte, R_SH_IMM4, 0); + insert (output + low_byte, BFD_RELOC_SH_IMM4, 0); break; case IMM_4BY4: - insert (output + low_byte, R_SH_IMM4BY4, 0); + insert (output + low_byte, BFD_RELOC_SH_IMM4BY4, 0); break; case IMM_4BY2: - insert (output + low_byte, R_SH_IMM4BY2, 0); + insert (output + low_byte, BFD_RELOC_SH_IMM4BY2, 0); break; case IMM_4: - insert (output + low_byte, R_SH_IMM4, 0); + insert (output + low_byte, BFD_RELOC_SH_IMM4, 0); break; case IMM_8BY4: - insert (output + low_byte, R_SH_IMM8BY4, 0); + insert (output + low_byte, BFD_RELOC_SH_IMM8BY4, 0); break; case IMM_8BY2: - insert (output + low_byte, R_SH_IMM8BY2, 0); + insert (output + low_byte, BFD_RELOC_SH_IMM8BY2, 0); break; case IMM_8: - insert (output + low_byte, R_SH_IMM8, 0); + insert (output + low_byte, BFD_RELOC_SH_IMM8, 0); break; case PCRELIMM_8BY4: - insert (output, R_SH_PCRELIMM8BY4, 1); + insert (output, BFD_RELOC_SH_PCRELIMM8BY4, 1); break; case PCRELIMM_8BY2: - insert (output, R_SH_PCRELIMM8BY2, 1); + insert (output, BFD_RELOC_SH_PCRELIMM8BY2, 1); break; default: printf ("failed for %d\n", i); @@ -905,7 +907,8 @@ { /* Output a CODE reloc to tell the linker that the following bytes are instructions, not data. */ - fix_new (frag_now, frag_now_fix (), 2, &abs_symbol, 0, 0, R_SH_CODE); + fix_new (frag_now, frag_now_fix (), 2, &abs_symbol, 0, 0, + BFD_RELOC_SH_CODE); seg_info (now_seg)->tc_segment_info_data.in_code = 1; } @@ -940,7 +943,7 @@ } /* This routine is called each time a label definition is seen. It - emits a R_SH_LABEL reloc if necessary. */ + emits a BFD_RELOC_SH_LABEL reloc if necessary. */ void sh_frob_label () @@ -957,7 +960,7 @@ if (frag_now != last_label_frag || offset != last_label_offset) { - fix_new (frag_now, offset, 2, &abs_symbol, 0, 0, R_SH_LABEL); + fix_new (frag_now, offset, 2, &abs_symbol, 0, 0, BFD_RELOC_SH_LABEL); last_label_frag = frag_now; last_label_offset = offset; } @@ -965,7 +968,7 @@ } /* This routine is called when the assembler is about to output some - data. It emits a R_SH_DATA reloc if necessary. */ + data. It emits a BFD_RELOC_SH_DATA reloc if necessary. */ void sh_flush_pending_output () @@ -973,18 +976,12 @@ if (sh_relax && seg_info (now_seg)->tc_segment_info_data.in_code) { - fix_new (frag_now, frag_now_fix (), 2, &abs_symbol, 0, 0, R_SH_DATA); + fix_new (frag_now, frag_now_fix (), 2, &abs_symbol, 0, 0, + BFD_RELOC_SH_DATA); seg_info (now_seg)->tc_segment_info_data.in_code = 0; } } -void -DEFUN (tc_crawl_symbol_chain, (headers), - object_headers * headers) -{ - printf ("call to tc_crawl_symbol_chain \n"); -} - symbolS * DEFUN (md_undefined_symbol, (name), char *name) @@ -992,6 +989,15 @@ return 0; } +#ifdef OBJ_COFF + +void +DEFUN (tc_crawl_symbol_chain, (headers), + object_headers * headers) +{ + printf ("call to tc_crawl_symbol_chain \n"); +} + void DEFUN (tc_headers_hook, (headers), object_headers * headers) @@ -999,6 +1005,8 @@ printf ("call to tc_headers_hook \n"); } +#endif + /* Various routines to kill one day */ /* Equal to MAX_PRECISION in atof-ieee.c */ #define MAX_LITTLENUMS 6 @@ -1082,7 +1090,7 @@ return; } - fix_new_exp (frag_now, frag_now_fix (), 2, &ex, 1, R_SH_USES); + fix_new_exp (frag_now, frag_now_fix (), 2, &ex, 1, BFD_RELOC_SH_USES); demand_empty_rest_of_line (); } @@ -1161,128 +1169,199 @@ as_fatal ("failed sanity check."); } -/* This is function is called after the symbol table has been - completed, but before md_convert_frag has been called. If we have - seen any .uses pseudo-ops, they point to an instruction which loads - a register with the address of a function. We look through the - fixups to find where the function address is being loaded from. We - then generate a COUNT reloc giving the number of times that - function address is referred to. The linker uses this information - when doing relaxing, to decide when it can eliminate the stored - function address entirely. */ +/* This struct is used to pass arguments to sh_count_relocs through + bfd_map_over_sections. */ -void -sh_coff_frob_file () +struct sh_count_relocs { - int iseg; + /* Symbol we are looking for. */ + symbolS *sym; + /* Count of relocs found. */ + int count; +}; - if (! sh_relax) +/* Count the number of fixups in a section which refer to a particular + symbol. When using BFD_ASSEMBLER, this is called via + bfd_map_over_sections. */ + +/*ARGSUSED*/ +static void +sh_count_relocs (abfd, sec, data) + bfd *abfd; + segT sec; + PTR data; +{ + struct sh_count_relocs *info = (struct sh_count_relocs *) data; + segment_info_type *seginfo; + symbolS *sym; + fixS *fix; + + seginfo = seg_info (sec); + if (seginfo == NULL) return; - for (iseg = SEG_E0; iseg < SEG_UNKNOWN; iseg++) + sym = info->sym; + for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next) { - fixS *fix; - - for (fix = segment_info[iseg].fix_root; fix != NULL; fix = fix->fx_next) + if (fix->fx_addsy == sym) { - symbolS *sym; - bfd_vma val; - fixS *fscan; - int iscan; - int count; - - if (fix->fx_r_type != R_SH_USES) - continue; - - /* The R_SH_USES reloc should refer to a defined local - symbol in the same section. */ - sym = fix->fx_addsy; - if (sym == NULL - || fix->fx_subsy != NULL - || fix->fx_addnumber != 0 - || S_GET_SEGMENT (sym) != iseg - || S_GET_STORAGE_CLASS (sym) == C_EXT) - { - as_warn_where (fix->fx_file, fix->fx_line, - ".uses does not refer to a local symbol in the same section"); - continue; - } + ++info->count; + fix->fx_tcbit = 1; + } + } +} - /* Look through the fixups again, this time looking for one - at the same location as sym. */ - val = S_GET_VALUE (sym); - for (fscan = segment_info[iseg].fix_root; - fscan != NULL; - fscan = fscan->fx_next) - if (val == fscan->fx_frag->fr_address + fscan->fx_where - && fscan->fx_r_type != R_SH_ALIGN - && fscan->fx_r_type != R_SH_CODE - && fscan->fx_r_type != R_SH_DATA - && fscan->fx_r_type != R_SH_LABEL) - break; - if (fscan == NULL) - { - as_warn_where (fix->fx_file, fix->fx_line, - "can't find fixup pointed to by .uses"); - continue; - } +/* Handle the count relocs for a particular section. When using + BFD_ASSEMBLER, this is called via bfd_map_over_sections. */ - if (fscan->fx_tcbit) - { - /* We've already done this one. */ - continue; - } +/*ARGSUSED*/ +static void +sh_frob_section (abfd, sec, ignore) + bfd *abfd; + segT sec; + PTR ignore; +{ + segment_info_type *seginfo; + fixS *fix; - /* fscan should also be a fixup to a local symbol in the same - section. */ - sym = fscan->fx_addsy; - if (sym == NULL - || fscan->fx_subsy != NULL - || fscan->fx_addnumber != 0 - || S_GET_SEGMENT (sym) != iseg - || S_GET_STORAGE_CLASS (sym) == C_EXT) - { - as_warn_where (fix->fx_file, fix->fx_line, - ".uses target does not refer to a local symbol in the same section"); - continue; - } + seginfo = seg_info (sec); + if (seginfo == NULL) + return; - /* Now we look through all the fixups of all the sections, - counting the number of times we find a reference to sym. */ - count = 0; - for (iscan = SEG_E0; iscan < SEG_UNKNOWN; iscan++) - { - for (fscan = segment_info[iscan].fix_root; - fscan != NULL; - fscan = fscan->fx_next) - { - if (fscan->fx_addsy == sym) - { - ++count; - fscan->fx_tcbit = 1; - } - } - } + for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next) + { + symbolS *sym; + bfd_vma val; + fixS *fscan; + struct sh_count_relocs info; + + if (fix->fx_r_type != BFD_RELOC_SH_USES) + continue; + + /* The BFD_RELOC_SH_USES reloc should refer to a defined local + symbol in the same section. */ + sym = fix->fx_addsy; + if (sym == NULL + || fix->fx_subsy != NULL + || fix->fx_addnumber != 0 + || S_GET_SEGMENT (sym) != sec +#if ! defined (BFD_ASSEMBLER) && defined (OBJ_COFF) + || S_GET_STORAGE_CLASS (sym) == C_EXT +#endif + || S_IS_EXTERNAL (sym)) + { + as_warn_where (fix->fx_file, fix->fx_line, + ".uses does not refer to a local symbol in the same section"); + continue; + } + + /* Look through the fixups again, this time looking for one + at the same location as sym. */ + val = S_GET_VALUE (sym); + for (fscan = seginfo->fix_root; + fscan != NULL; + fscan = fscan->fx_next) + if (val == fscan->fx_frag->fr_address + fscan->fx_where + && fscan->fx_r_type != BFD_RELOC_SH_ALIGN + && fscan->fx_r_type != BFD_RELOC_SH_CODE + && fscan->fx_r_type != BFD_RELOC_SH_DATA + && fscan->fx_r_type != BFD_RELOC_SH_LABEL) + break; + if (fscan == NULL) + { + as_warn_where (fix->fx_file, fix->fx_line, + "can't find fixup pointed to by .uses"); + continue; + } - if (count < 1) - abort (); + if (fscan->fx_tcbit) + { + /* We've already done this one. */ + continue; + } - /* Generate a R_SH_COUNT fixup at the location of sym. We - have already adjusted the value of sym to include the - fragment address, so we undo that adjustment here. */ - subseg_change (iseg, 0); - fix_new (sym->sy_frag, S_GET_VALUE (sym) - sym->sy_frag->fr_address, - 4, &abs_symbol, count, 0, R_SH_COUNT); + /* fscan should also be a fixup to a local symbol in the same + section. */ + sym = fscan->fx_addsy; + if (sym == NULL + || fscan->fx_subsy != NULL + || fscan->fx_addnumber != 0 + || S_GET_SEGMENT (sym) != sec +#if ! defined (BFD_ASSEMBLER) && defined (OBJ_COFF) + || S_GET_STORAGE_CLASS (sym) == C_EXT +#endif + || S_IS_EXTERNAL (sym)) + { + as_warn_where (fix->fx_file, fix->fx_line, + ".uses target does not refer to a local symbol in the same section"); + continue; } + + /* Now we look through all the fixups of all the sections, + counting the number of times we find a reference to sym. */ + info.sym = sym; + info.count = 0; +#ifdef BFD_ASSEMBLER + bfd_map_over_sections (stdoutput, sh_count_relocs, (PTR) &info); +#else + { + int iscan; + + for (iscan = SEG_E0; iscan < SEG_UNKNOWN; iscan++) + sh_count_relocs ((bfd *) NULL, iscan, (PTR) &info); + } +#endif + + if (info.count < 1) + abort (); + + /* Generate a BFD_RELOC_SH_COUNT fixup at the location of sym. + We have already adjusted the value of sym to include the + fragment address, so we undo that adjustment here. */ + subseg_change (sec, 0); + fix_new (sym->sy_frag, S_GET_VALUE (sym) - sym->sy_frag->fr_address, + 4, &abs_symbol, info.count, 0, BFD_RELOC_SH_COUNT); } } +/* This function is called after the symbol table has been completed, + but before the relocs or section contents have been written out. + If we have seen any .uses pseudo-ops, they point to an instruction + which loads a register with the address of a function. We look + through the fixups to find where the function address is being + loaded from. We then generate a COUNT reloc giving the number of + times that function address is referred to. The linker uses this + information when doing relaxing, to decide when it can eliminate + the stored function address entirely. */ + +void +sh_frob_file () +{ + if (! sh_relax) + return; + +#ifdef BFD_ASSEMBLER + bfd_map_over_sections (stdoutput, sh_frob_section, (PTR) NULL); +#else + { + int iseg; + + for (iseg = SEG_E0; iseg < SEG_UNKNOWN; iseg++) + sh_frob_section ((bfd *) NULL, iseg, (PTR) NULL); + } +#endif +} + /* Called after relaxing. Set the correct sizes of the fragments, and create relocs so that md_apply_fix will fill in the correct values. */ void md_convert_frag (headers, seg, fragP) +#ifdef BFD_ASSEMBLER + bfd *headers; +#else object_headers *headers; +#endif segT seg; fragS *fragP; { @@ -1293,7 +1372,7 @@ case C (COND_JUMP, COND8): subseg_change (seg, 0); fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset, - 1, R_SH_PCDISP8BY2); + 1, BFD_RELOC_SH_PCDISP8BY2); fragP->fr_fix += 2; fragP->fr_var = 0; break; @@ -1301,7 +1380,7 @@ case C (UNCOND_JUMP, UNCOND12): subseg_change (seg, 0); fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset, - 1, R_SH_PCDISP); + 1, BFD_RELOC_SH_PCDISP12BY2); fragP->fr_fix += 2; fragP->fr_var = 0; break; @@ -1351,7 +1430,7 @@ fragP->fr_symbol, fragP->fr_offset, 0, - R_SH_IMM32); + BFD_RELOC_32); fragP->fr_fix += UNCOND32_LENGTH; fragP->fr_var = 0; donerelax = 1; @@ -1373,15 +1452,19 @@ /* Build a relocation to six bytes farther on. */ subseg_change (seg, 0); fix_new (fragP, fragP->fr_fix, 2, - segment_info[seg].dot, +#ifdef BFD_ASSEMBLER + section_symbol (seg), +#else + seg_info (seg)->dot, +#endif fragP->fr_address + fragP->fr_fix + 6, - 1, R_SH_PCDISP8BY2); + 1, BFD_RELOC_SH_PCDISP8BY2); /* Set up a jump instruction. */ buffer[highbyte + 2] = 0xa0; buffer[lowbyte + 2] = 0; fix_new (fragP, fragP->fr_fix + 2, 2, fragP->fr_symbol, - fragP->fr_offset, 1, R_SH_PCDISP); + fragP->fr_offset, 1, BFD_RELOC_SH_PCDISP12BY2); /* Fill in a NOP instruction. */ buffer[highbyte + 4] = 0x0; @@ -1439,7 +1522,7 @@ fragP->fr_symbol, fragP->fr_offset, 0, - R_SH_IMM32); + BFD_RELOC_32); fragP->fr_fix += COND32_LENGTH; fragP->fr_var = 0; donerelax = 1; @@ -1452,10 +1535,11 @@ } if (donerelax && !sh_relax) - as_warn ("Offset doesn't fit at 0x%lx, trying to get to %s+0x%lx", - (unsigned long) fragP->fr_address, - fragP->fr_symbol ? S_GET_NAME(fragP->fr_symbol): "", - (unsigned long) fragP->fr_offset); + as_warn_where (fragP->fr_file, fragP->fr_line, + "overflow in branch to %s; converted into longer instruction sequence", + (fragP->fr_symbol != NULL + ? S_GET_NAME (fragP->fr_symbol) + : "")); } valueT @@ -1463,9 +1547,17 @@ segT seg AND valueT size) { +#ifdef BFD_ASSEMBLER +#ifdef OBJ_ELF + return size; +#else /* ! OBJ_ELF */ + return ((size + (1 << bfd_get_section_alignment (stdoutput, seg)) - 1) + & (-1 << bfd_get_section_alignment (stdoutput, seg))); +#endif /* ! OBJ_ELF */ +#else /* ! BFD_ASSEMBLER */ return ((size + (1 << section_alignment[(int) seg]) - 1) & (-1 << section_alignment[(int) seg])); - +#endif /* ! BFD_ASSEMBLER */ } /* When relaxing, we need to output a reloc for any .align directive @@ -1481,7 +1573,7 @@ && frag->fr_offset > 1 && now_seg != bss_section) fix_new (frag, frag->fr_fix, 2, &abs_symbol, frag->fr_offset, 0, - R_SH_ALIGN); + BFD_RELOC_SH_ALIGN); } /* This macro decides whether a particular reloc is an entry in a @@ -1489,16 +1581,23 @@ to know about all such entries so that it can adjust them if necessary. */ +#ifdef BFD_ASSEMBLER +#define SWITCH_TABLE_CONS(fix) (0) +#else +#define SWITCH_TABLE_CONS(fix) \ + ((fix)->fx_r_type == 0 \ + && ((fix)->fx_size == 2 \ + || (fix)->fx_size == 4)) +#endif + #define SWITCH_TABLE(fix) \ ((fix)->fx_addsy != NULL \ && (fix)->fx_subsy != NULL \ && S_GET_SEGMENT ((fix)->fx_addsy) == text_section \ && S_GET_SEGMENT ((fix)->fx_subsy) == text_section \ - && ((fix)->fx_r_type == R_SH_IMM32 \ - || (fix)->fx_r_type == R_SH_IMM16 \ - || ((fix)->fx_r_type == 0 \ - && ((fix)->fx_size == 2 \ - || (fix)->fx_size == 4)))) + && ((fix)->fx_r_type == BFD_RELOC_32 \ + || (fix)->fx_r_type == BFD_RELOC_16 \ + || SWITCH_TABLE_CONS (fix))) /* See whether we need to force a relocation into the output file. This is used to force out switch and PC relative relocations when @@ -1513,63 +1612,76 @@ return (fix->fx_pcrel || SWITCH_TABLE (fix) - || fix->fx_r_type == R_SH_COUNT - || fix->fx_r_type == R_SH_ALIGN - || fix->fx_r_type == R_SH_CODE - || fix->fx_r_type == R_SH_DATA - || fix->fx_r_type == R_SH_LABEL); + || fix->fx_r_type == BFD_RELOC_SH_COUNT + || fix->fx_r_type == BFD_RELOC_SH_ALIGN + || fix->fx_r_type == BFD_RELOC_SH_CODE + || fix->fx_r_type == BFD_RELOC_SH_DATA + || fix->fx_r_type == BFD_RELOC_SH_LABEL); } /* Apply a fixup to the object file. */ +#ifdef BFD_ASSEMBLER +int +md_apply_fix (fixP, valp) + fixS *fixP; + valueT *valp; +#else void md_apply_fix (fixP, val) fixS *fixP; long val; +#endif { char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; int lowbyte = target_big_endian ? 1 : 0; int highbyte = target_big_endian ? 0 : 1; +#ifdef BFD_ASSEMBLER + long val = *valp; +#endif +#ifndef BFD_ASSEMBLER if (fixP->fx_r_type == 0) { if (fixP->fx_size == 2) - fixP->fx_r_type = R_SH_IMM16; + fixP->fx_r_type = BFD_RELOC_16; else if (fixP->fx_size == 4) - fixP->fx_r_type = R_SH_IMM32; + fixP->fx_r_type = BFD_RELOC_32; else if (fixP->fx_size == 1) - fixP->fx_r_type = R_SH_IMM8; + fixP->fx_r_type = BFD_RELOC_SH_IMM8; else abort (); } +#endif switch (fixP->fx_r_type) { - case R_SH_IMM4: + case BFD_RELOC_SH_IMM4: *buf = (*buf & 0xf0) | (val & 0xf); break; - case R_SH_IMM4BY2: + case BFD_RELOC_SH_IMM4BY2: *buf = (*buf & 0xf0) | ((val >> 1) & 0xf); break; - case R_SH_IMM4BY4: + case BFD_RELOC_SH_IMM4BY4: *buf = (*buf & 0xf0) | ((val >> 2) & 0xf); break; - case R_SH_IMM8BY2: + case BFD_RELOC_SH_IMM8BY2: *buf = val >> 1; break; - case R_SH_IMM8BY4: + case BFD_RELOC_SH_IMM8BY4: *buf = val >> 2; break; - case R_SH_IMM8: + case BFD_RELOC_8: + case BFD_RELOC_SH_IMM8: *buf++ = val; break; - case R_SH_PCRELIMM8BY4: + case BFD_RELOC_SH_PCRELIMM8BY4: /* The lower two bits of the PC are cleared before the displacement is added in. We can assume that the destination is on a 4 byte bounday. If this instruction is also on a 4 @@ -1589,21 +1701,21 @@ buf[lowbyte] = val; break; - case R_SH_PCRELIMM8BY2: + case BFD_RELOC_SH_PCRELIMM8BY2: val /= 2; if (val & ~0xff) as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far"); buf[lowbyte] = val; break; - case R_SH_PCDISP8BY2: + case BFD_RELOC_SH_PCDISP8BY2: val /= 2; if (val < -0x80 || val > 0x7f) as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far"); buf[lowbyte] = val; break; - case R_SH_PCDISP: + case BFD_RELOC_SH_PCDISP12BY2: val /= 2; if (val < -0x800 || val >= 0x7ff) as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far"); @@ -1611,7 +1723,7 @@ buf[highbyte] |= (val >> 8) & 0xf; break; - case R_SH_IMM32: + case BFD_RELOC_32: if (! target_big_endian) { *buf++ = val >> 0; @@ -1628,7 +1740,7 @@ } break; - case R_SH_IMM16: + case BFD_RELOC_16: if (! target_big_endian) { *buf++ = val >> 0; @@ -1641,22 +1753,26 @@ } break; - case R_SH_USES: + case BFD_RELOC_SH_USES: /* Pass the value into sh_coff_reloc_mangle. */ fixP->fx_addnumber = val; break; - case R_SH_COUNT: - case R_SH_ALIGN: - case R_SH_CODE: - case R_SH_DATA: - case R_SH_LABEL: + case BFD_RELOC_SH_COUNT: + case BFD_RELOC_SH_ALIGN: + case BFD_RELOC_SH_CODE: + case BFD_RELOC_SH_DATA: + case BFD_RELOC_SH_LABEL: /* Nothing to do here. */ break; default: abort (); } + +#ifdef BFD_ASSEMBLER + return 0; +#endif } int md_long_jump_size; @@ -1743,6 +1859,8 @@ return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address + 2; } +#ifdef OBJ_COFF + int tc_coff_sizemachdep (frag) fragS *frag; @@ -1750,20 +1868,24 @@ return md_relax_table[frag->fr_subtype].rlx_length; } +#endif /* OBJ_COFF */ + /* When we align the .text section, insert the correct NOP pattern. */ int -sh_do_align (n, fill, len) +sh_do_align (n, fill, len, max) int n; const char *fill; int len; + int max; { - if ((fill == NULL || (*fill == 0 && len == 1)) - && (now_seg == text_section + if (fill == NULL #ifdef BFD_ASSEMBLER - || (now_seg->flags & SEC_CODE) != 0 + && (now_seg->flags & SEC_CODE) != 0 +#else + && now_seg != data_section + && now_seg != bss_section #endif - || strcmp (obj_segment_name (now_seg), ".init") == 0) && n > 1) { static const unsigned char big_nop_pattern[] = { 0x00, 0x09 }; @@ -1771,19 +1893,55 @@ /* First align to a 2 byte boundary, in case there is an odd .byte. */ - frag_align (1, 0); + frag_align (1, 0, 0); if (target_big_endian) - frag_align_pattern (n, big_nop_pattern, sizeof big_nop_pattern); + frag_align_pattern (n, big_nop_pattern, sizeof big_nop_pattern, max); else - frag_align_pattern (n, little_nop_pattern, sizeof little_nop_pattern); + frag_align_pattern (n, little_nop_pattern, sizeof little_nop_pattern, + max); return 1; } return 0; } +#ifndef BFD_ASSEMBLER #ifdef OBJ_COFF +/* Map BFD relocs to SH COFF relocs. */ + +struct reloc_map +{ + bfd_reloc_code_real_type bfd_reloc; + int sh_reloc; +}; + +static const struct reloc_map coff_reloc_map[] = +{ + { BFD_RELOC_32, R_SH_IMM32 }, + { BFD_RELOC_16, R_SH_IMM16 }, + { BFD_RELOC_8, R_SH_IMM8 }, + { BFD_RELOC_SH_PCDISP8BY2, R_SH_PCDISP8BY2 }, + { BFD_RELOC_SH_PCDISP12BY2, R_SH_PCDISP }, + { BFD_RELOC_SH_IMM4, R_SH_IMM4 }, + { BFD_RELOC_SH_IMM4BY2, R_SH_IMM4BY2 }, + { BFD_RELOC_SH_IMM4BY4, R_SH_IMM4BY4 }, + { BFD_RELOC_SH_IMM8, R_SH_IMM8 }, + { BFD_RELOC_SH_IMM8BY2, R_SH_IMM8BY2 }, + { BFD_RELOC_SH_IMM8BY4, R_SH_IMM8BY4 }, + { BFD_RELOC_SH_PCRELIMM8BY2, R_SH_PCRELIMM8BY2 }, + { BFD_RELOC_SH_PCRELIMM8BY4, R_SH_PCRELIMM8BY4 }, + { BFD_RELOC_SH_SWITCH16, R_SH_SWITCH16 }, + { BFD_RELOC_SH_SWITCH32, R_SH_SWITCH32 }, + { BFD_RELOC_SH_USES, R_SH_USES }, + { BFD_RELOC_SH_COUNT, R_SH_COUNT }, + { BFD_RELOC_SH_ALIGN, R_SH_ALIGN }, + { BFD_RELOC_SH_CODE, R_SH_CODE }, + { BFD_RELOC_SH_DATA, R_SH_DATA }, + { BFD_RELOC_SH_LABEL, R_SH_LABEL }, + { BFD_RELOC_UNUSED, 0 } +}; + /* Adjust a reloc for the SH. This is similar to the generic code, but does some minor tweaking. */ @@ -1801,16 +1959,25 @@ if (! SWITCH_TABLE (fix)) { - intr->r_type = fix->fx_r_type; + const struct reloc_map *rm; + + for (rm = coff_reloc_map; rm->bfd_reloc != BFD_RELOC_UNUSED; rm++) + if (rm->bfd_reloc == (bfd_reloc_code_real_type) fix->fx_r_type) + break; + if (rm->bfd_reloc == BFD_RELOC_UNUSED) + as_bad_where (fix->fx_file, fix->fx_line, + "Can not represent %s relocation in this object file format", + bfd_get_reloc_code_name (fix->fx_r_type)); + intr->r_type = rm->sh_reloc; intr->r_offset = 0; } else { know (sh_relax); - if (fix->fx_r_type == R_SH_IMM16) + if (fix->fx_r_type == BFD_RELOC_16) intr->r_type = R_SH_SWITCH16; - else if (fix->fx_r_type == R_SH_IMM32) + else if (fix->fx_r_type == BFD_RELOC_32) intr->r_type = R_SH_SWITCH32; else abort (); @@ -1827,11 +1994,11 @@ { switch (fix->fx_r_type) { - case R_SH_PCRELIMM8BY2: - case R_SH_PCRELIMM8BY4: - case R_SH_PCDISP8BY2: - case R_SH_PCDISP: - case R_SH_USES: + case BFD_RELOC_SH_PCRELIMM8BY2: + case BFD_RELOC_SH_PCRELIMM8BY4: + case BFD_RELOC_SH_PCDISP8BY2: + case BFD_RELOC_SH_PCDISP12BY2: + case BFD_RELOC_SH_USES: symbol_ptr = seg->dot; break; default: @@ -1839,14 +2006,14 @@ } } - if (fix->fx_r_type == R_SH_USES) + if (fix->fx_r_type == BFD_RELOC_SH_USES) { /* We can't store the offset in the object file, since this reloc does not take up any space, so we store it in r_offset. The fx_addnumber field was set in md_apply_fix. */ intr->r_offset = fix->fx_addnumber; } - else if (fix->fx_r_type == R_SH_COUNT) + else if (fix->fx_r_type == BFD_RELOC_SH_COUNT) { /* We can't store the count in the object file, since this reloc does not take up any space, so we store it in r_offset. The @@ -1856,16 +2023,16 @@ /* This reloc is always absolute. */ symbol_ptr = NULL; } - else if (fix->fx_r_type == R_SH_ALIGN) + else if (fix->fx_r_type == BFD_RELOC_SH_ALIGN) { /* Store the alignment in the r_offset field. */ intr->r_offset = fix->fx_offset; /* This reloc is always absolute. */ symbol_ptr = NULL; } - else if (fix->fx_r_type == R_SH_CODE - || fix->fx_r_type == R_SH_DATA - || fix->fx_r_type == R_SH_LABEL) + else if (fix->fx_r_type == BFD_RELOC_SH_CODE + || fix->fx_r_type == BFD_RELOC_SH_DATA + || fix->fx_r_type == BFD_RELOC_SH_LABEL) { /* These relocs are always absolute. */ symbol_ptr = NULL; @@ -1884,4 +2051,60 @@ intr->r_symndx = -1; } -#endif +#endif /* OBJ_COFF */ +#endif /* ! BFD_ASSEMBLER */ + +#ifdef BFD_ASSEMBLER + +/* Create a reloc. */ + +arelent * +tc_gen_reloc (section, fixp) + asection *section; + fixS *fixp; +{ + arelent *rel; + bfd_reloc_code_real_type r_type; + + rel = (arelent *) xmalloc (sizeof (arelent)); + rel->sym_ptr_ptr = &fixp->fx_addsy->bsym; + rel->address = fixp->fx_frag->fr_address + fixp->fx_where; + + r_type = fixp->fx_r_type; + + if (SWITCH_TABLE (fixp)) + { + rel->addend = rel->address - S_GET_VALUE (fixp->fx_subsy); + if (r_type == BFD_RELOC_16) + r_type = BFD_RELOC_SH_SWITCH16; + else if (r_type == BFD_RELOC_32) + r_type = BFD_RELOC_SH_SWITCH32; + else + abort (); + } + else if (r_type == BFD_RELOC_SH_USES) + rel->addend = fixp->fx_addnumber; + else if (r_type == BFD_RELOC_SH_COUNT) + rel->addend = fixp->fx_offset; + else if (r_type == BFD_RELOC_SH_ALIGN) + rel->addend = fixp->fx_offset; + else if (fixp->fx_pcrel) + rel->addend = fixp->fx_addnumber; + else + rel->addend = 0; + + rel->howto = bfd_reloc_type_lookup (stdoutput, r_type); + if (rel->howto == NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + "Cannot represent relocation type %s", + bfd_get_reloc_code_name (r_type)); + /* Set howto to a garbage value so that we can keep going. */ + rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32); + assert (rel->howto != NULL); + } + + return rel; +} + +#endif /* BFD_ASSEMBLER */ diff -urN binutils-2.7/gas/config/tc-sh.h binutils-2.8/gas/config/tc-sh.h --- binutils-2.7/gas/config/tc-sh.h Thu Jul 4 12:14:36 1996 +++ binutils-2.8/gas/config/tc-sh.h Wed Apr 30 12:53:21 1997 @@ -1,6 +1,5 @@ /* This file is tc-sh.h - - Copyright (C) 1993, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -21,18 +20,19 @@ #define TC_SH -/* This macro translates between an internal fix and an coff reloc type */ -#define TC_COFF_FIX2RTYPE(fix) ((fix)->fx_r_type) +#define TARGET_BYTES_BIG_ENDIAN 0 -#define BFD_ARCH bfd_arch_sh +#define TARGET_ARCH bfd_arch_sh +/* Whether in little endian mode. */ extern int shl; -#define COFF_MAGIC (shl ? SH_ARCH_MAGIC_LITTLE : SH_ARCH_MAGIC_BIG) - /* Whether -relax was used. */ extern int sh_relax; +/* Don't try to break words. */ +#define WORKING_DOT_WORD + /* When relaxing, we need to generate relocations for alignment directives. */ #define HANDLE_ALIGN(frag) sh_handle_align (frag) @@ -42,50 +42,19 @@ #define TC_FORCE_RELOCATION(fix) sh_force_relocation (fix) extern int sh_force_relocation (); -/* We need to write out relocs which have not been completed. */ -#define TC_COUNT_RELOC(fix) ((fix)->fx_addsy != NULL) - -#define TC_RELOC_MANGLE(seg, fix, int, paddr) \ - sh_coff_reloc_mangle ((seg), (fix), (int), (paddr)) -extern void sh_coff_reloc_mangle (); - #define IGNORE_NONSTANDARD_ESCAPES -#define tc_coff_symbol_emit_hook(a) ; /* not used */ - -#define DO_NOT_STRIP 0 -#define DO_STRIP 0 #define LISTING_HEADER (shl ? "Hitachi Super-H GAS Little Endian" : "Hitachi Super-H GAS Big Endian") -#define NEED_FX_R_TYPE 1 -#define RELOC_32 1234 - -#define TC_KEEP_FX_OFFSET 1 - -#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag) -extern int tc_coff_sizemachdep PARAMS ((fragS *)); #define md_operand(x) extern const struct relax_type md_relax_table[]; #define TC_GENERIC_RELAX_TABLE md_relax_table -#define tc_frob_file sh_coff_frob_file -extern void sh_coff_frob_file PARAMS (()); - -/* We align most sections to a 16 byte boundary. */ -#define SUB_SEGMENT_ALIGN(SEG) \ - (strncmp (obj_segment_name (SEG), ".stabstr", 8) == 0 \ - ? 0 \ - : ((strncmp (obj_segment_name (SEG), ".stab", 5) == 0 \ - || strcmp (obj_segment_name (SEG), ".ctors") == 0 \ - || strcmp (obj_segment_name (SEG), ".dtors") == 0) \ - ? 2 \ - : 4)) - /* We use a special alignment function to insert the correct nop pattern. */ -extern int sh_do_align PARAMS ((int, const char *, int)); -#define md_do_align(n,fill,len,l) if (sh_do_align (n,fill,len)) goto l +extern int sh_do_align PARAMS ((int, const char *, int, int)); +#define md_do_align(n,fill,len,max,l) if (sh_do_align (n,fill,len,max)) goto l /* We record, for each section, whether we have most recently output a CODE reloc or a DATA reloc. */ @@ -104,5 +73,62 @@ reloc when required. */ extern void sh_flush_pending_output PARAMS ((void)); #define md_flush_pending_output() sh_flush_pending_output () + +#ifdef BFD_ASSEMBLER +#define tc_frob_file_before_adjust sh_frob_file +#else +#define tc_frob_file sh_frob_file +#endif +extern void sh_frob_file PARAMS ((void)); + +#ifdef OBJ_COFF +/* COFF specific definitions. */ + +#define DO_NOT_STRIP 0 + +/* This macro translates between an internal fix and an coff reloc type */ +#define TC_COFF_FIX2RTYPE(fix) ((fix)->fx_r_type) + +#define BFD_ARCH TARGET_ARCH + +#define COFF_MAGIC (shl ? SH_ARCH_MAGIC_LITTLE : SH_ARCH_MAGIC_BIG) + +/* We need to write out relocs which have not been completed. */ +#define TC_COUNT_RELOC(fix) ((fix)->fx_addsy != NULL) + +#define TC_RELOC_MANGLE(seg, fix, int, paddr) \ + sh_coff_reloc_mangle ((seg), (fix), (int), (paddr)) +extern void sh_coff_reloc_mangle (); + +#define tc_coff_symbol_emit_hook(a) ; /* not used */ + +#define NEED_FX_R_TYPE 1 + +#define TC_KEEP_FX_OFFSET 1 + +#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag) +extern int tc_coff_sizemachdep PARAMS ((fragS *)); + +/* We align most sections to a 16 byte boundary. */ +#define SUB_SEGMENT_ALIGN(SEG) \ + (strncmp (obj_segment_name (SEG), ".stabstr", 8) == 0 \ + ? 0 \ + : ((strncmp (obj_segment_name (SEG), ".stab", 5) == 0 \ + || strcmp (obj_segment_name (SEG), ".ctors") == 0 \ + || strcmp (obj_segment_name (SEG), ".dtors") == 0) \ + ? 2 \ + : 4)) + +#endif /* OBJ_COFF */ + +#ifdef OBJ_ELF +/* ELF specific definitions. */ + +/* Whether or not the target is big endian */ +extern int target_big_endian; + +#define TARGET_FORMAT (shl ? "elf32-shl" : "elf32-sh") + +#endif /* OBJ_ELF */ /* end of tc-sh.h */ diff -urN binutils-2.7/gas/config/tc-sparc.c binutils-2.8/gas/config/tc-sparc.c --- binutils-2.7/gas/config/tc-sparc.c Thu Jul 4 12:14:39 1996 +++ binutils-2.8/gas/config/tc-sparc.c Wed Apr 30 12:53:22 1997 @@ -1,5 +1,5 @@ /* tc-sparc.c -- Assemble for the SPARC - Copyright (C) 1989, 90-95, 1996 Free Software Foundation, Inc. + Copyright (C) 1989, 90-96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -28,13 +28,20 @@ #include "opcode/sparc.h" static void sparc_ip PARAMS ((char *, const struct sparc_opcode **)); +static int in_signed_range PARAMS ((bfd_signed_vma, bfd_signed_vma)); +static int in_bitfield_range PARAMS ((bfd_signed_vma, bfd_signed_vma)); +static int sparc_ffs PARAMS ((unsigned int)); +static bfd_vma BSR PARAMS ((bfd_vma, int)); +static int cmp_reg_entry PARAMS ((const PTR, const PTR)); +static int parse_keyword_arg PARAMS ((int (*) (const char *), char **, int *)); +static int parse_const_expr_arg PARAMS ((char **, int *)); /* Current architecture. We don't bump up unless necessary. */ static enum sparc_opcode_arch_val current_architecture = SPARC_OPCODE_ARCH_V6; /* The maximum architecture level we can bump up to. In a 32 bit environment, don't allow bumping up to v9 by default. - The native assembler works this way. The user is required to pass + The native assembler works this way. The user is required to pass an explicit argument before we'll create v9 object files. However, if we don't see any v9 insns, a v9 object file is not created. */ #ifdef SPARC_ARCH64 @@ -56,8 +63,18 @@ /* Non-zero if we are generating PIC code. */ int sparc_pic_code; +/* Non-zero if we should give an error when misaligned data is seen. */ +static int enforce_aligned_data; + extern int target_big_endian; +/* V9 has big and little endian data, but instructions are always big endian. + The sparclet has bi-endian support but both data and insns have the same + endianness. Global `target_big_endian' is used for data. The following + macro is used for instructions. */ +#define INSN_BIG_ENDIAN (target_big_endian \ + || SPARC_OPCODE_ARCH_V9_P (max_architecture)) + /* handle of the OPCODE hash table */ static struct hash_control *op_hash; @@ -67,6 +84,7 @@ static void s_reserve PARAMS ((int)); static void s_common PARAMS ((int)); static void s_empty PARAMS ((int)); +static void s_uacons PARAMS ((int)); const pseudo_typeS md_pseudo_table[] = { @@ -82,15 +100,16 @@ {"skip", s_space, 0}, {"word", cons, 4}, {"xword", cons, 8}, -#ifdef OBJ_ELF - {"uaxword", cons, 8}, -#endif + {"uahalf", s_uacons, 2}, + {"uaword", s_uacons, 4}, + {"uaxword", s_uacons, 8}, #ifdef OBJ_ELF /* these are specific to sparc/svr4 */ {"pushsection", obj_elf_section, 0}, {"popsection", obj_elf_previous, 0}, - {"uaword", cons, 4}, - {"uahalf", cons, 2}, + {"2byte", s_uacons, 2}, + {"4byte", s_uacons, 4}, + {"8byte", s_uacons, 8}, #endif {NULL, 0, 0}, }; @@ -141,6 +160,9 @@ struct sparc_it the_insn, set_insn; +static void output_insn + PARAMS ((const struct sparc_opcode *, struct sparc_it *)); + /* Return non-zero if VAL is in the range -(MAX+1) to MAX. */ static INLINE int @@ -186,6 +208,17 @@ return i; } +/* Implement big shift right. */ +static bfd_vma +BSR (val, amount) + bfd_vma val; + int amount; +{ + if (sizeof (bfd_vma) <= 4 && amount >= 32) + as_fatal ("Support for 64-bit arithmetic not compiled in."); + return val >> amount; +} + #if 0 static void print_insn PARAMS ((struct sparc_it *insn)); #endif @@ -199,7 +232,18 @@ * 4 bytes. */ #define SPECIAL_CASE_SET 1 -#define SPECIAL_CASE_FDIV 2 +#define SPECIAL_CASE_SETSW 2 +#define SPECIAL_CASE_SETX 3 +/* FIXME: sparc-opc.c doesn't have necessary "S" trigger to enable this. */ +#define SPECIAL_CASE_FDIV 4 + +/* Bit masks of various insns. */ +#define NOP_INSN 0x01000000 +#define OR_INSN 0x80100000 +#define FMOVS_INSN 0x81A00020 +#define SETHI_INSN 0x01000000 +#define SLLX_INSN 0x81281000 +#define SRA_INSN 0x81380000 /* The last instruction to be assembled. */ static const struct sparc_opcode *last_insn; @@ -321,7 +365,7 @@ subseg_set (bss_section, 1); /* switch to bss */ if (align) - frag_align (align, 0); /* do alignment */ + frag_align (align, 0, 0); /* do alignment */ /* detach from old frag */ if (S_GET_SEGMENT(symbolP) == bss_section) @@ -329,7 +373,7 @@ symbolP->sy_frag = frag_now; pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP, - size, (char *)0); + (offsetT) size, (char *)0); *pfrag = 0; S_SET_SEGMENT (symbolP, bss_section); @@ -379,7 +423,7 @@ *p = 0; symbolP = symbol_find_or_make (name); *p = c; - if (S_IS_DEFINED (symbolP)) + if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) { as_bad ("Ignoring attempt to re-define symbol"); ignore_rest_of_line (); @@ -432,19 +476,18 @@ char *p; int align; - allocate_bss: old_sec = now_seg; old_subsec = now_subseg; align = temp; record_alignment (bss_section, align); subseg_set (bss_section, 0); if (align) - frag_align (align, 0); + frag_align (align, 0, 0); if (S_GET_SEGMENT (symbolP) == bss_section) symbolP->sy_frag->fr_symbol = 0; symbolP->sy_frag = frag_now; - p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size, - (char *) 0); + p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, + (offsetT) size, (char *) 0); *p = 0; S_SET_SEGMENT (symbolP, bss_section); S_CLEAR_EXTERNAL (symbolP); @@ -459,8 +502,7 @@ S_SET_ALIGN (symbolP, temp); #endif S_SET_EXTERNAL (symbolP); - /* should be common, but this is how gas does it for now */ - S_SET_SEGMENT (symbolP, bfd_und_section_ptr); + S_SET_SEGMENT (symbolP, bfd_com_section_ptr); } } else @@ -482,6 +524,11 @@ ; goto allocate_common; } + +#ifdef BFD_ASSEMBLER + symbolP->bsym->flags |= BSF_OBJECT; +#endif + demand_empty_rest_of_line (); return; @@ -566,9 +613,34 @@ ++input_line_pointer; } -/* We require .word, et. al., to be aligned correctly. We do it by - setting up an rs_align_code frag, and checking in HANDLE_ALIGN to - make sure that no unexpected alignment was introduced. */ +/* This static variable is set by s_uacons to tell sparc_cons_align + that the expession does not need to be aligned. */ + +static int sparc_no_align_cons = 0; + +/* This handles the unaligned space allocation pseudo-ops, such as + .uaword. .uaword is just like .word, but the value does not need + to be aligned. */ + +static void +s_uacons (bytes) + int bytes; +{ + /* Tell sparc_cons_align not to align this value. */ + sparc_no_align_cons = 1; + cons (bytes); +} + +/* If the --enforce-aligned-data option is used, we require .word, + et. al., to be aligned correctly. We do it by setting up an + rs_align_code frag, and checking in HANDLE_ALIGN to make sure that + no unexpected alignment was introduced. + + The SunOS and Solaris native assemblers enforce aligned data by + default. We don't want to do that, because gcc can deliberately + generate misaligned data if the packed attribute is used. Instead, + we permit misaligned data by default, and permit the user to set an + option to check for it. */ void sparc_cons_align (nbytes) @@ -577,6 +649,17 @@ int nalign; char *p; + /* Only do this if we are enforcing aligned data. */ + if (! enforce_aligned_data) + return; + + if (sparc_no_align_cons) + { + /* This is an unaligned pseudo-op. */ + sparc_no_align_cons = 0; + return; + } + nalign = 0; while ((nbytes & 1) == 0) { @@ -595,7 +678,7 @@ } p = frag_var (rs_align_code, 1, 1, (relax_substateT) 0, - (symbolS *) NULL, (long) nalign, (char *) NULL); + (symbolS *) NULL, (offsetT) nalign, (char *) NULL); record_alignment (now_seg, nalign); } @@ -642,9 +725,13 @@ }; static int -cmp_reg_entry (p, q) - struct priv_reg_entry *p, *q; +cmp_reg_entry (parg, qarg) + const PTR parg; + const PTR qarg; { + const struct priv_reg_entry *p = (const struct priv_reg_entry *) parg; + const struct priv_reg_entry *q = (const struct priv_reg_entry *) qarg; + return strcmp (q->name, p->name); } @@ -699,8 +786,6 @@ qsort (priv_reg_table, sizeof (priv_reg_table) / sizeof (priv_reg_table[0]), sizeof (priv_reg_table[0]), cmp_reg_entry); - target_big_endian = 1; - /* If -bump, record the architecture level at which we start issuing warnings. The behaviour is different depending upon whether an architecture was explicitly specified. If it wasn't, we issue warnings @@ -753,19 +838,46 @@ #endif } +/* Utility to output one insn. */ + +static void +output_insn (insn, the_insn) + const struct sparc_opcode *insn; + struct sparc_it *the_insn; +{ + char *toP = frag_more (4); + + /* put out the opcode */ + if (INSN_BIG_ENDIAN) + number_to_chars_bigendian (toP, (valueT) the_insn->opcode, 4); + else + number_to_chars_littleendian (toP, (valueT) the_insn->opcode, 4); + + /* put out the symbol-dependent stuff */ + if (the_insn->reloc != BFD_RELOC_NONE) + { + fix_new_exp (frag_now, /* which frag */ + (toP - frag_now->fr_literal), /* where */ + 4, /* size */ + &the_insn->exp, + the_insn->pcrel, + the_insn->reloc); + } + + last_insn = insn; +} + void md_assemble (str) char *str; { const struct sparc_opcode *insn; - char *toP; - int rsd; know (str); + special_case = 0; sparc_ip (str, &insn); - /* We warn about attempts to put a floating point branch in a delay - slot. */ + /* We warn about attempts to put a floating point branch in a delay slot. */ if (insn != NULL && last_insn != NULL && (insn->flags & F_FBR) != 0 @@ -781,97 +893,233 @@ && (insn->flags & F_FBR) != 0 && (last_insn->flags & F_FLOAT) != 0) { + struct sparc_it nop_insn; + + nop_insn.opcode = NOP_INSN; + nop_insn.reloc = BFD_RELOC_NONE; + output_insn (insn, &nop_insn); as_warn ("FP branch preceded by FP instruction; NOP inserted"); - toP = frag_more (4); - md_number_to_chars (toP, (valueT) 0x01000000, 4); } - /* See if "set" operand is absolute and small; skip sethi if so. */ - if (special_case == SPECIAL_CASE_SET - && the_insn.exp.X_op == O_constant) - { - if (the_insn.exp.X_add_number >= -(1 << 12) - && the_insn.exp.X_add_number < (1 << 12)) - { - the_insn.opcode = 0x80102000 /* or %g0,imm,... */ - | (the_insn.opcode & 0x3E000000) /* dest reg */ - | (the_insn.exp.X_add_number & 0x1FFF); /* imm */ - special_case = 0; /* No longer special */ - the_insn.reloc = BFD_RELOC_NONE; /* No longer relocated */ - } - } + switch (special_case) + { + case 0: + /* normal insn */ + output_insn (insn, &the_insn); + break; - toP = frag_more (4); - /* put out the opcode */ - md_number_to_chars (toP, (valueT) the_insn.opcode, 4); + case SPECIAL_CASE_SET: + { + int need_hi22_p = 0; - /* put out the symbol-dependent stuff */ - if (the_insn.reloc != BFD_RELOC_NONE) - { - fix_new_exp (frag_now, /* which frag */ - (toP - frag_now->fr_literal), /* where */ - 4, /* size */ - &the_insn.exp, - the_insn.pcrel, - the_insn.reloc); - } + /* "set" is not defined for negative numbers in v9: it doesn't yield + what you expect it to. */ + if (SPARC_OPCODE_ARCH_V9_P (max_architecture) + && the_insn.exp.X_op == O_constant) + { + if (the_insn.exp.X_add_number < 0) + as_warn ("set: used with negative number"); + else if (the_insn.exp.X_add_number > 0xffffffff) + as_warn ("set: number larger than 4294967295"); + } - last_insn = insn; + /* See if operand is absolute and small; skip sethi if so. */ + if (the_insn.exp.X_op != O_constant + || the_insn.exp.X_add_number >= (1 << 12) + || the_insn.exp.X_add_number < -(1 << 12)) + { + output_insn (insn, &the_insn); + need_hi22_p = 1; + } + /* See if operand has no low-order bits; skip OR if so. */ + if (the_insn.exp.X_op != O_constant + || (need_hi22_p && (the_insn.exp.X_add_number & 0x3FF) != 0) + || ! need_hi22_p) + { + int rd = (the_insn.opcode & RD (~0)) >> 25; + the_insn.opcode = (OR_INSN | (need_hi22_p ? RS1 (rd) : 0) + | RD (rd) + | IMMED + | (the_insn.exp.X_add_number + & (need_hi22_p ? 0x3ff : 0x1fff))); + the_insn.reloc = (the_insn.exp.X_op != O_constant + ? BFD_RELOC_LO10 + : BFD_RELOC_NONE); + output_insn (insn, &the_insn); + } + break; + } - switch (special_case) - { - case SPECIAL_CASE_SET: - special_case = 0; - assert (the_insn.reloc == BFD_RELOC_HI22); - /* See if "set" operand has no low-order bits; skip OR if so. */ - if (the_insn.exp.X_op == O_constant - && ((the_insn.exp.X_add_number & 0x3FF) == 0)) - return; - toP = frag_more (4); - rsd = (the_insn.opcode >> 25) & 0x1f; - the_insn.opcode = 0x80102000 | (rsd << 25) | (rsd << 14); - md_number_to_chars (toP, (valueT) the_insn.opcode, 4); - fix_new_exp (frag_now, /* which frag */ - (toP - frag_now->fr_literal), /* where */ - 4, /* size */ - &the_insn.exp, - the_insn.pcrel, - BFD_RELOC_LO10); - return; + case SPECIAL_CASE_SETSW: + { + /* FIXME: Not finished. */ + break; + } + + case SPECIAL_CASE_SETX: + { +#define SIGNEXT32(x) ((((x) & 0xffffffff) ^ 0x80000000) - 0x80000000) + int upper32 = SIGNEXT32 (BSR (the_insn.exp.X_add_number, 32)); + int lower32 = SIGNEXT32 (the_insn.exp.X_add_number); +#undef SIGNEXT32 + int tmpreg = (the_insn.opcode & RS1 (~0)) >> 14; + int dstreg = (the_insn.opcode & RD (~0)) >> 25; + /* Output directly to dst reg if lower 32 bits are all zero. */ + int upper_dstreg = (the_insn.exp.X_op == O_constant + && lower32 == 0) ? dstreg : tmpreg; + int need_hh22_p = 0, need_hm10_p = 0, need_hi22_p = 0, need_lo10_p = 0; + + /* The tmp reg should not be the dst reg. */ + if (tmpreg == dstreg) + as_warn ("setx: temporary register same as destination register"); + + /* Reset X_add_number, we've extracted it as upper32/lower32. + Otherwise fixup_segment will complain about not being able to + write an 8 byte number in a 4 byte field. */ + the_insn.exp.X_add_number = 0; + + /* ??? Obviously there are other optimizations we can do + (e.g. sethi+shift for 0x1f0000000) and perhaps we shouldn't be + doing some of these. Later. If you do change things, try to + change all of this to be table driven as well. */ + + /* What to output depends on the number if it's constant. + Compute that first, then output what we've decided upon. */ + if (the_insn.exp.X_op != O_constant) + need_hh22_p = need_hm10_p = need_hi22_p = need_lo10_p = 1; + else + { + /* Only need hh22 if `or' insn can't handle constant. */ + if (upper32 < -(1 << 12) || upper32 >= (1 << 12)) + need_hh22_p = 1; + + /* Does bottom part (after sethi) have bits? */ + if ((need_hh22_p && (upper32 & 0x3ff) != 0) + /* No hh22, but does upper32 still have bits we can't set + from lower32? */ + || (! need_hh22_p + && upper32 != 0 + && (upper32 != -1 || lower32 >= 0))) + need_hm10_p = 1; + + /* If the lower half is all zero, we build the upper half directly + into the dst reg. */ + if (lower32 != 0 + /* Need lower half if number is zero. */ + || (! need_hh22_p && ! need_hm10_p)) + { + /* No need for sethi if `or' insn can handle constant. */ + if (lower32 < -(1 << 12) || lower32 >= (1 << 12) + /* Note that we can't use a negative constant in the `or' + insn unless the upper 32 bits are all ones. */ + || (lower32 < 0 && upper32 != -1)) + need_hi22_p = 1; + + /* Does bottom part (after sethi) have bits? */ + if ((need_hi22_p && (lower32 & 0x3ff) != 0) + /* No sethi. */ + || (! need_hi22_p && (lower32 & 0x1fff) != 0) + /* Need `or' if we didn't set anything else. */ + || (! need_hi22_p && ! need_hh22_p && ! need_hm10_p)) + need_lo10_p = 1; + } + } + + if (need_hh22_p) + { + the_insn.opcode = (SETHI_INSN | RD (upper_dstreg) + | ((upper32 >> 10) & 0x3fffff)); + the_insn.reloc = (the_insn.exp.X_op != O_constant + ? BFD_RELOC_SPARC_HH22 : BFD_RELOC_NONE); + output_insn (insn, &the_insn); + } + + if (need_hm10_p) + { + the_insn.opcode = (OR_INSN + | (need_hh22_p ? RS1 (upper_dstreg) : 0) + | RD (upper_dstreg) + | IMMED + | (upper32 + & (need_hh22_p ? 0x3ff : 0x1fff))); + the_insn.reloc = (the_insn.exp.X_op != O_constant + ? BFD_RELOC_SPARC_HM10 : BFD_RELOC_NONE); + output_insn (insn, &the_insn); + } + + if (need_hi22_p) + { + the_insn.opcode = (SETHI_INSN | RD (dstreg) + | ((lower32 >> 10) & 0x3fffff)); + the_insn.reloc = BFD_RELOC_HI22; + output_insn (insn, &the_insn); + } + + if (need_lo10_p) + { + /* FIXME: One nice optimization to do here is to OR the low part + with the highpart if hi22 isn't needed and the low part is + positive. */ + the_insn.opcode = (OR_INSN | (need_hi22_p ? RS1 (dstreg) : 0) + | RD (dstreg) + | IMMED + | (lower32 + & (need_hi22_p ? 0x3ff : 0x1fff))); + the_insn.reloc = BFD_RELOC_LO10; + output_insn (insn, &the_insn); + } + + /* If we needed to build the upper part, shift it into place. */ + if (need_hh22_p || need_hm10_p) + { + the_insn.opcode = (SLLX_INSN | RS1 (upper_dstreg) | RD (upper_dstreg) + | IMMED | 32); + the_insn.reloc = BFD_RELOC_NONE; + output_insn (insn, &the_insn); + } + + /* If we needed to build both upper and lower parts, OR them together. */ + if ((need_hh22_p || need_hm10_p) + && (need_hi22_p || need_lo10_p)) + { + the_insn.opcode = (OR_INSN | RS1 (dstreg) | RS2 (upper_dstreg) + | RD (dstreg)); + the_insn.reloc = BFD_RELOC_NONE; + output_insn (insn, &the_insn); + } + /* We didn't need both regs, but we may have to sign extend lower32. */ + else if (need_hi22_p && upper32 == -1) + { + the_insn.opcode = (SRA_INSN | RS1 (dstreg) | RD (dstreg) + | IMMED | 0); + the_insn.reloc = BFD_RELOC_NONE; + output_insn (insn, &the_insn); + } + break; + } case SPECIAL_CASE_FDIV: - /* According to information leaked from Sun, the "fdiv" instructions - on early SPARC machines would produce incorrect results sometimes. - The workaround is to add an fmovs of the destination register to - itself just after the instruction. This was true on machines - with Weitek 1165 float chips, such as the Sun-4/260 and /280. */ - special_case = 0; - assert (the_insn.reloc == BFD_RELOC_NONE); - toP = frag_more (4); - rsd = (the_insn.opcode >> 25) & 0x1f; - the_insn.opcode = 0x81A00020 | (rsd << 25) | rsd; /* fmovs dest,dest */ - md_number_to_chars (toP, (valueT) the_insn.opcode, 4); - return; + { + int rd = (the_insn.opcode >> 25) & 0x1f; - case 0: - return; + output_insn (insn, &the_insn); + + /* According to information leaked from Sun, the "fdiv" instructions + on early SPARC machines would produce incorrect results sometimes. + The workaround is to add an fmovs of the destination register to + itself just after the instruction. This was true on machines + with Weitek 1165 float chips, such as the Sun-4/260 and /280. */ + assert (the_insn.reloc == BFD_RELOC_NONE); + the_insn.opcode = FMOVS_INSN | rd | RD (rd); + output_insn (insn, &the_insn); + break; + } default: - as_fatal ("failed sanity check."); + as_fatal ("failed special case insn sanity check"); } } -/* Implement big shift right. */ -static bfd_vma -BSR (val, amount) - bfd_vma val; - int amount; -{ - if (sizeof (bfd_vma) <= 4 && amount >= 32) - as_fatal ("Support for 64-bit arithmetic not compiled in."); - return val >> amount; -} - /* Parse an argument that can be expressed as a keyword. (eg: #StoreStore or %ccfr). The result is a boolean indicating success. @@ -879,7 +1127,7 @@ static int parse_keyword_arg (lookup_fn, input_pointerP, valueP) - int (*lookup_fn) (); + int (*lookup_fn) PARAMS ((const char *)); char **input_pointerP; int *valueP; { @@ -1598,6 +1846,10 @@ } break; + case '0': /* 64 bit immediate (setx insn) */ + the_insn.reloc = BFD_RELOC_NONE; /* reloc handled elsewhere */ + goto immediate; + case 'h': /* high 22 bits */ the_insn.reloc = BFD_RELOC_HI22; goto immediate; @@ -1668,7 +1920,7 @@ char *s1; - for (s1 = s; *s1 && *s1 != ',' && *s1 != ']'; s1++);; + for (s1 = s; *s1 && *s1 != ',' && *s1 != ']'; s1++) ; if (s1 != s && isdigit (s1[-1])) { @@ -1825,11 +2077,22 @@ break; case 'S': - if (strcmp (str, "set") == 0) + if (strcmp (str, "set") == 0 + || strcmp (str, "setuw") == 0) { special_case = SPECIAL_CASE_SET; continue; } + else if (strcmp (str, "setsw") == 0) + { + special_case = SPECIAL_CASE_SETSW; + continue; + } + else if (strcmp (str, "setx") == 0) + { + special_case = SPECIAL_CASE_SETX; + continue; + } else if (strncmp (str, "fdiv", 4) == 0) { special_case = SPECIAL_CASE_FDIV; @@ -2055,15 +2318,12 @@ char *litP; int *sizeP; { - int prec; + int i,prec; LITTLENUM_TYPE words[MAX_LITTLENUMS]; - LITTLENUM_TYPE *wordP; char *t; - char *atof_ieee (); switch (type) { - case 'f': case 'F': case 's': @@ -2092,40 +2352,59 @@ *sizeP = 0; return "Bad call to MD_ATOF()"; } + t = atof_ieee (input_line_pointer, type, words); if (t) input_line_pointer = t; *sizeP = prec * sizeof (LITTLENUM_TYPE); - for (wordP = words; prec--;) + + if (target_big_endian) + { + for (i = 0; i < prec; i++) + { + md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + } + else { - md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE)); - litP += sizeof (LITTLENUM_TYPE); + for (i = prec - 1; i >= 0; i--) + { + md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } } + return 0; } -/* - * Write out big-endian. - */ +/* Write a value out to the object file, using the appropriate + endianness. */ + void md_number_to_chars (buf, val, n) char *buf; valueT val; int n; { - number_to_chars_bigendian (buf, val, n); + if (target_big_endian) + number_to_chars_bigendian (buf, val, n); + else + number_to_chars_littleendian (buf, val, n); } /* Apply a fixS to the frags, now that we know the value it ought to hold. */ int -md_apply_fix (fixP, value) +md_apply_fix3 (fixP, value, segment) fixS *fixP; valueT *value; + segT segment; { char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; offsetT val; + long insn; val = *value; @@ -2136,14 +2415,22 @@ #ifdef OBJ_ELF /* FIXME: SPARC ELF relocations don't use an addend in the data field itself. This whole approach should be somehow combined - with the calls to bfd_perform_relocation. Also, the value passed + with the calls to bfd_install_relocation. Also, the value passed in by fixup_segment includes the value of a defined symbol. We don't want to include the value of an externally visible symbol. */ if (fixP->fx_addsy != NULL) { - if ((S_IS_EXTERNAL (fixP->fx_addsy) - || S_IS_WEAK (fixP->fx_addsy) - || (sparc_pic_code && ! fixP->fx_pcrel)) + if (fixP->fx_addsy->sy_used_in_reloc + && (S_IS_EXTERNAL (fixP->fx_addsy) + || S_IS_WEAK (fixP->fx_addsy) + || (sparc_pic_code && ! fixP->fx_pcrel) + || (S_GET_SEGMENT (fixP->fx_addsy) != segment + && ((bfd_get_section_flags (stdoutput, + S_GET_SEGMENT (fixP->fx_addsy)) + & SEC_LINK_ONCE) != 0 + || strncmp (segment_name (S_GET_SEGMENT (fixP->fx_addsy)), + ".gnu.linkonce", + sizeof ".gnu.linkonce" - 1) == 0))) && S_GET_SEGMENT (fixP->fx_addsy) != absolute_section && S_GET_SEGMENT (fixP->fx_addsy) != undefined_section && ! bfd_is_com_section (S_GET_SEGMENT (fixP->fx_addsy))) @@ -2182,172 +2469,148 @@ fixP->fx_addnumber -= 2 * S_GET_VALUE (fixP->fx_addsy); #endif - switch (fixP->fx_r_type) - { - case BFD_RELOC_16: - buf[0] = val >> 8; - buf[1] = val; - break; - - case BFD_RELOC_32: - buf[0] = val >> 24; - buf[1] = val >> 16; - buf[2] = val >> 8; - buf[3] = val; - break; + /* If this is a data relocation, just output VAL. */ - case BFD_RELOC_32_PCREL_S2: - val = val >> 2; - /* FIXME: This increment-by-one deserves a comment of why it's - being done! */ - if (! sparc_pic_code - || fixP->fx_addsy == NULL - || (fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) != 0) - ++val; - buf[0] |= (val >> 24) & 0x3f; - buf[1] = val >> 16; - buf[2] = val >> 8; - buf[3] = val; - break; + if (fixP->fx_r_type == BFD_RELOC_16) + { + md_number_to_chars (buf, val, 2); + } + else if (fixP->fx_r_type == BFD_RELOC_32) + { + md_number_to_chars (buf, val, 4); + } + else if (fixP->fx_r_type == BFD_RELOC_64) + { + md_number_to_chars (buf, val, 8); + } + else + { + /* It's a relocation against an instruction. */ - case BFD_RELOC_64: - { - bfd_vma valh = BSR (val, 32); - buf[0] = valh >> 24; - buf[1] = valh >> 16; - buf[2] = valh >> 8; - buf[3] = valh; - buf[4] = val >> 24; - buf[5] = val >> 16; - buf[6] = val >> 8; - buf[7] = val; - } - break; + if (INSN_BIG_ENDIAN) + insn = bfd_getb32 ((unsigned char *) buf); + else + insn = bfd_getl32 ((unsigned char *) buf); + + switch (fixP->fx_r_type) + { + case BFD_RELOC_32_PCREL_S2: + val = val >> 2; + /* FIXME: This increment-by-one deserves a comment of why it's + being done! */ + if (! sparc_pic_code + || fixP->fx_addsy == NULL + || (fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) != 0) + ++val; + insn |= val & 0x3fffffff; + break; - case BFD_RELOC_SPARC_11: - if (! in_signed_range (val, 0x7ff)) - as_bad ("relocation overflow."); + case BFD_RELOC_SPARC_11: + if (! in_signed_range (val, 0x7ff)) + as_bad ("relocation overflow."); + insn |= val & 0x7ff; + break; - buf[2] |= (val >> 8) & 0x7; - buf[3] = val; - break; + case BFD_RELOC_SPARC_10: + if (! in_signed_range (val, 0x3ff)) + as_bad ("relocation overflow."); + insn |= val & 0x3ff; + break; - case BFD_RELOC_SPARC_10: - if (! in_signed_range (val, 0x3ff)) - as_bad ("relocation overflow."); + case BFD_RELOC_SPARC_6: + if (! in_bitfield_range (val, 0x3f)) + as_bad ("relocation overflow."); + insn |= val & 0x3f; + break; - buf[2] |= (val >> 8) & 0x3; - buf[3] = val; - break; + case BFD_RELOC_SPARC_5: + if (! in_bitfield_range (val, 0x1f)) + as_bad ("relocation overflow."); + insn |= val & 0x1f; + break; - case BFD_RELOC_SPARC_6: - if (! in_bitfield_range (val, 0x3f)) - as_bad ("relocation overflow."); + case BFD_RELOC_SPARC_WDISP16: + /* FIXME: simplify */ + if (((val > 0) && (val & ~0x3fffc)) + || ((val < 0) && (~(val - 1) & ~0x3fffc))) + as_bad ("relocation overflow."); + /* FIXME: The +1 deserves a comment. */ + val = (val >> 2) + 1; + insn |= ((val & 0xc000) << 6) | (val & 0x3fff); + break; - buf[3] |= val & 0x3f; - break; + case BFD_RELOC_SPARC_WDISP19: + /* FIXME: simplify */ + if (((val > 0) && (val & ~0x1ffffc)) + || ((val < 0) && (~(val - 1) & ~0x1ffffc))) + as_bad ("relocation overflow."); + /* FIXME: The +1 deserves a comment. */ + val = (val >> 2) + 1; + insn |= val & 0x7ffff; + break; - case BFD_RELOC_SPARC_5: - if (! in_bitfield_range (val, 0x1f)) - as_bad ("relocation overflow."); + case BFD_RELOC_SPARC_HH22: + val = BSR (val, 32); + /* intentional fallthrough */ - buf[3] |= val & 0x1f; - break; + case BFD_RELOC_SPARC_LM22: + case BFD_RELOC_HI22: + if (!fixP->fx_addsy) + { + insn |= (val >> 10) & 0x3fffff; + } + else + { + /* FIXME: Need comment explaining why we do this. */ + insn &= ~0xffff; + } + break; - case BFD_RELOC_SPARC_WDISP16: - /* FIXME: simplify */ - if (((val > 0) && (val & ~0x3fffc)) - || ((val < 0) && (~(val - 1) & ~0x3fffc))) - { - as_bad ("relocation overflow."); - } + case BFD_RELOC_SPARC22: + if (val & ~0x003fffff) + as_bad ("relocation overflow"); + insn |= (val & 0x3fffff); + break; - /* FIXME: The +1 deserves a comment. */ - val = (val >> 2) + 1; - buf[1] |= ((val >> 14) & 0x3) << 4; - buf[2] |= (val >> 8) & 0x3f; - buf[3] = val; - break; + case BFD_RELOC_SPARC_HM10: + val = BSR (val, 32); + /* intentional fallthrough */ - case BFD_RELOC_SPARC_WDISP19: - /* FIXME: simplify */ - if (((val > 0) && (val & ~0x1ffffc)) - || ((val < 0) && (~(val - 1) & ~0x1ffffc))) - { - as_bad ("relocation overflow."); - } + case BFD_RELOC_LO10: + if (!fixP->fx_addsy) + { + insn |= val & 0x3ff; + } + else + { + /* FIXME: Need comment explaining why we do this. */ + insn &= ~0xff; + } + break; - /* FIXME: The +1 deserves a comment. */ - val = (val >> 2) + 1; - buf[1] |= (val >> 16) & 0x7; - buf[2] = (val >> 8) & 0xff; - buf[3] = val; - break; + case BFD_RELOC_SPARC13: + if (! in_signed_range (val, 0x1fff)) + as_bad ("relocation overflow"); + insn |= val & 0x1fff; + break; - case BFD_RELOC_SPARC_HH22: - val = BSR (val, 32); - /* intentional fallthrough */ + case BFD_RELOC_SPARC_WDISP22: + val = (val >> 2) + 1; + /* FALLTHROUGH */ + case BFD_RELOC_SPARC_BASE22: + insn |= val & 0x3fffff; + break; - case BFD_RELOC_SPARC_LM22: - case BFD_RELOC_HI22: - if (!fixP->fx_addsy) - { - buf[1] |= (val >> 26) & 0x3f; - buf[2] = val >> 18; - buf[3] = val >> 10; - } - else - { - buf[2] = 0; - buf[3] = 0; + case BFD_RELOC_NONE: + default: + as_bad ("bad or unhandled relocation type: 0x%02x", fixP->fx_r_type); + break; } - break; - - case BFD_RELOC_SPARC22: - if (val & ~0x003fffff) - { - as_bad ("relocation overflow"); - } /* on overflow */ - buf[1] |= (val >> 16) & 0x3f; - buf[2] = val >> 8; - buf[3] = val; - break; - - case BFD_RELOC_SPARC_HM10: - val = BSR (val, 32); - /* intentional fallthrough */ - case BFD_RELOC_LO10: - if (!fixP->fx_addsy) - { - buf[2] |= (val >> 8) & 0x03; - buf[3] = val; - } + if (INSN_BIG_ENDIAN) + bfd_putb32 (insn, (unsigned char *) buf); else - buf[3] = 0; - break; - - case BFD_RELOC_SPARC13: - if (! in_signed_range (val, 0x1fff)) - as_bad ("relocation overflow"); - - buf[2] |= (val >> 8) & 0x1f; - buf[3] = val; - break; - - case BFD_RELOC_SPARC_WDISP22: - val = (val >> 2) + 1; - /* FALLTHROUGH */ - case BFD_RELOC_SPARC_BASE22: - buf[1] |= (val >> 16) & 0x3f; - buf[2] = val >> 8; - buf[3] = val; - break; - - case BFD_RELOC_NONE: - default: - as_bad ("bad or unhandled relocation type: 0x%02x", fixP->fx_r_type); - break; + bfd_putl32 (insn, (unsigned char *) buf); } /* Are we finished with this relocation now? */ @@ -2367,8 +2630,7 @@ arelent *reloc; bfd_reloc_code_real_type code; - reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent)); - assert (reloc != 0); + reloc = (arelent *) xmalloc (sizeof (arelent)); reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym; reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; @@ -2418,6 +2680,7 @@ { case BFD_RELOC_32_PCREL_S2: if (! S_IS_DEFINED (fixp->fx_addsy) + || S_IS_COMMON (fixp->fx_addsy) || S_IS_EXTERNAL (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy)) code = BFD_RELOC_SPARC_WPLT30; @@ -2595,6 +2858,14 @@ {"sparc", no_argument, NULL, OPTION_SPARC}, #define OPTION_XARCH (OPTION_MD_BASE + 2) {"xarch", required_argument, NULL, OPTION_XARCH}, +#ifdef SPARC_BIENDIAN +#define OPTION_LITTLE_ENDIAN (OPTION_MD_BASE + 3) + {"EL", no_argument, NULL, OPTION_LITTLE_ENDIAN}, +#define OPTION_BIG_ENDIAN (OPTION_MD_BASE + 4) + {"EB", no_argument, NULL, OPTION_BIG_ENDIAN}, +#endif +#define OPTION_ENFORCE_ALIGNED_DATA (OPTION_MD_BASE + 5) + {"enforce-aligned-data", no_argument, NULL, OPTION_ENFORCE_ALIGNED_DATA}, {NULL, no_argument, NULL, 0} }; size_t md_longopts_size = sizeof(md_longopts); @@ -2649,6 +2920,19 @@ /* Ignore -sparc, used by SunOS make default .s.o rule. */ break; + case OPTION_ENFORCE_ALIGNED_DATA: + enforce_aligned_data = 1; + break; + +#ifdef SPARC_BIENDIAN + case OPTION_LITTLE_ENDIAN: + target_big_endian = 0; + break; + case OPTION_BIG_ENDIAN: + target_big_endian = 1; + break; +#endif + #ifdef OBJ_AOUT case 'k': sparc_pic_code = 1; @@ -2705,7 +2989,8 @@ fprintf (stream, "\ specify variant of SPARC architecture\n\ -bump warn when assembler switches architectures\n\ --sparc ignored\n"); +-sparc ignored\n\ +--enforce-aligned-data force .long, etc., to be aligned correctly\n"); #ifdef OBJ_AOUT fprintf (stream, "\ -k generate PIC\n"); @@ -2717,6 +3002,11 @@ -q ignored\n\ -Qy, -Qn ignored\n\ -s ignored\n"); +#endif +#ifdef SPARC_BIENDIAN + fprintf (stream, "\ +-EL generate code for a little endian machine\n\ +-EB generate code for a big endian machine\n"); #endif } diff -urN binutils-2.7/gas/config/tc-sparc.h binutils-2.8/gas/config/tc-sparc.h --- binutils-2.7/gas/config/tc-sparc.h Thu Jul 4 12:14:39 1996 +++ binutils-2.8/gas/config/tc-sparc.h Wed Apr 30 12:53:22 1997 @@ -1,5 +1,5 @@ /* tc-sparc.h - Macros and type defines for the sparc. - Copyright (C) 1989, 90-95, 1996 Free Software Foundation, Inc. + Copyright (C) 1989, 90-96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -18,18 +18,35 @@ to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef TC_SPARC #define TC_SPARC 1 +#ifdef ANSI_PROTOTYPES +struct frag; +#endif + +/* This is used to set the default value for `target_big_endian'. */ +#define TARGET_BYTES_BIG_ENDIAN 1 + #define LOCAL_LABELS_FB 1 #define TARGET_ARCH bfd_arch_sparc + #ifdef OBJ_AOUT #ifdef TE_NetBSD #define TARGET_FORMAT "a.out-sparc-netbsd" #else +#ifdef TE_SPARCAOUT +extern int target_big_endian; +#define TARGET_FORMAT (target_big_endian ? "a.out-sunos-big" : "a.out-sparc-little") +/* Bi-endian support may eventually be unconditional, but until things are + working well it's only provided for targets that need it. */ +#define SPARC_BIENDIAN +#else #define TARGET_FORMAT "a.out-sunos-big" #endif #endif +#endif #ifdef OBJ_BOUT #define TARGET_FORMAT "b.out.big" #endif @@ -39,7 +56,6 @@ #else #define TARGET_FORMAT "elf32-sparc" #endif -#define LOCAL_LABEL(name) (((name)[0] == '.' && (name)[1] == 'L') || !strncmp ((name), "_.L_", 4)) #endif #define WORKING_DOT_WORD @@ -48,7 +64,6 @@ #define md_create_short_jump(p,f,t,fr,s) as_fatal("sparc_create_short_jump") #define md_estimate_size_before_relax(f,s) \ (as_fatal("estimate_size_before_relax called"),1) -void tc_aout_pre_write_hook (); #define LISTING_HEADER "SPARC GAS " @@ -58,7 +73,7 @@ #define md_cons_align(nbytes) sparc_cons_align (nbytes) extern void sparc_cons_align PARAMS ((int)); #define HANDLE_ALIGN(fragp) sparc_handle_align (fragp) -extern void sparc_handle_align (); +extern void sparc_handle_align PARAMS ((struct frag *)); #if defined (OBJ_ELF) || defined (OBJ_AOUT) @@ -96,6 +111,7 @@ #define RELOC_REQUIRES_SYMBOL #endif +#define MD_APPLY_FIX3 #define TC_HANDLES_FX_DONE #ifdef OBJ_ELF @@ -103,10 +119,14 @@ relocations against sections. This is required for the dynamic linker to operate properly. When generating PIC, we need to keep any non PC relative reloc. */ -#define tc_fix_adjustable(FIX) \ - (! S_IS_EXTERNAL ((FIX)->fx_addsy) \ - && ! S_IS_WEAK ((FIX)->fx_addsy) \ - && (! sparc_pic_code || (FIX)->fx_pcrel)) +#define tc_fix_adjustable(FIX) \ + (! S_IS_EXTERNAL ((FIX)->fx_addsy) \ + && ! S_IS_WEAK ((FIX)->fx_addsy) \ + && (! sparc_pic_code \ + || (FIX)->fx_pcrel \ + || ((FIX)->fx_subsy != NULL \ + && (S_GET_SEGMENT ((FIX)->fx_subsy) \ + == S_GET_SEGMENT ((FIX)->fx_addsy))))) #endif #ifdef OBJ_AOUT @@ -123,5 +143,7 @@ extern void sparc_md_end PARAMS ((void)); #define md_end() sparc_md_end () + +#endif /* end of tc-sparc.h */ diff -urN binutils-2.7/gas/config/tc-vax.h binutils-2.8/gas/config/tc-vax.h --- binutils-2.7/gas/config/tc-vax.h Thu Jul 4 12:14:48 1996 +++ binutils-2.8/gas/config/tc-vax.h Wed Apr 30 12:53:22 1997 @@ -1,8 +1,26 @@ -/* - * This file is tc-vax.h. - */ +/* tc-vax.h -- Header file for tc-vax.c. + Copyright (C) 1987, 91, 92, 93, 95, 96, 1997 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #define TC_VAX 1 + +#define TARGET_BYTES_BIG_ENDIAN 0 #define NO_RELOC 0 #define NOP_OPCODE 0x01 diff -urN binutils-2.7/gas/config/tc-w65.h binutils-2.8/gas/config/tc-w65.h --- binutils-2.7/gas/config/tc-w65.h Thu Jul 4 12:14:48 1996 +++ binutils-2.8/gas/config/tc-w65.h Wed Apr 30 12:53:22 1997 @@ -1,6 +1,5 @@ /* This file is tc-w65.h - - Copyright (C) 1995 Free Software Foundation, Inc. + Copyright (C) 1995, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,12 +14,15 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #define TC_W65 +#define TARGET_BYTES_BIG_ENDIAN 0 + /* This macro translates between an internal fix and an coff reloc type */ #define TC_COFF_FIX2RTYPE(fixP) tc_coff_fix2rtype(fixP) @@ -32,7 +34,6 @@ #define TC_RELOC_MANGLE(s,a,b,c) tc_reloc_mangle(a,b,c) #define DO_NOT_STRIP 0 -#define DO_STRIP 0 #define LISTING_HEADER "W65816 GAS " #define NEED_FX_R_TYPE 1 #define RELOC_32 1234 diff -urN binutils-2.7/gas/config/tc-z8k.c binutils-2.8/gas/config/tc-z8k.c --- binutils-2.7/gas/config/tc-z8k.c Thu Jul 4 12:14:49 1996 +++ binutils-2.8/gas/config/tc-z8k.c Wed Apr 30 12:53:22 1997 @@ -1,5 +1,5 @@ /* tc-z8k.c -- Assemble code for the Zilog Z800n - Copyright (C) 1992 Free Software Foundation. + Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation. This file is part of GAS, the GNU Assembler. @@ -14,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* Written By Steve Chamberlain @@ -71,7 +72,7 @@ void even () { - frag_align (1, 0); + frag_align (1, 0, 0); record_alignment (now_seg, 1); } diff -urN binutils-2.7/gas/config/tc-z8k.h binutils-2.8/gas/config/tc-z8k.h --- binutils-2.7/gas/config/tc-z8k.h Thu Jul 4 12:14:49 1996 +++ binutils-2.8/gas/config/tc-z8k.h Wed Apr 30 12:53:22 1997 @@ -1,6 +1,5 @@ /* This file is tc-z8k.h - - Copyright (C) 1987-1992 Free Software Foundation, Inc. + Copyright (C) 1987-1992, 93, 95, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,13 +14,18 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #define TC_Z8K #define TARGET_BYTES_BIG_ENDIAN 1 + +#ifndef BFD_ASSEMBLER #define LOCAL_LABEL(x) 0 +#endif + /* This macro translates between an internal fix and an coff reloc type */ #define TC_COFF_FIX2RTYPE(fixP) abort(); @@ -33,7 +37,6 @@ #define TC_RELOC_MANGLE(s,a,b,c) tc_reloc_mangle(a,b,c) #define DO_NOT_STRIP 0 -#define DO_STRIP 0 #define LISTING_HEADER "Zilog Z8000 GAS " #define NEED_FX_R_TYPE 1 #define RELOC_32 1234 diff -urN binutils-2.7/gas/config/te-delta.h binutils-2.8/gas/config/te-delta.h --- binutils-2.7/gas/config/te-delta.h Thu Jul 4 12:14:50 1996 +++ binutils-2.8/gas/config/te-delta.h Wed Apr 30 12:53:23 1997 @@ -3,6 +3,7 @@ #include "obj-format.h" #define COFF_NOLOAD_PROBLEM 1 +#define COFF_COMMON_ADDEND 1 /* Added these, because if we don't know what we're targetting we may need an assembler version of libgcc, and that will use local diff -urN binutils-2.7/gas/config/te-dynix.h binutils-2.8/gas/config/te-dynix.h --- binutils-2.7/gas/config/te-dynix.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/te-dynix.h Wed Apr 30 12:53:23 1997 @@ -0,0 +1,7 @@ +/* This is for i386-sequent-bsd. The assembler probably does not + actually work, as the support in BFD is not complete as of this + writing. See bfd/i386-dynix.c. */ + +#define TE_DYNIX 1 + +#include "obj-format.h" diff -urN binutils-2.7/gas/config/te-ic960.h binutils-2.8/gas/config/te-ic960.h --- binutils-2.7/gas/config/te-ic960.h Thu Jul 4 12:14:50 1996 +++ binutils-2.8/gas/config/te-ic960.h Wed Apr 30 12:53:23 1997 @@ -1,6 +1,5 @@ -/* This file is twe-ic960.h - - Copyright (C) 1987-1992 Free Software Foundation, Inc. +/* This file is te-ic960.h + Copyright (C) 1987-1992, 94, 95, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* * This file is te-ic960.h and is intended to define ic960 environment @@ -24,11 +24,15 @@ */ #define OBJ_COFF_OMIT_OPTIONAL_HEADER + +#ifndef BFD_ASSEMBLER #define LOCAL_LABEL(name) ((name[0] =='L') \ || (name[0] =='.' \ && (name[1]=='C' \ || name[1]=='I' \ || name[1]=='.'))) +#endif + #include "obj-format.h" /* end of te-ic960.h */ diff -urN binutils-2.7/gas/config/te-lnews.h binutils-2.8/gas/config/te-lnews.h --- binutils-2.7/gas/config/te-lnews.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/te-lnews.h Wed Apr 30 12:53:24 1997 @@ -0,0 +1,5 @@ +/* te-lnews.h -- little-endian NEWS emulation. */ + +#define ECOFF_LITTLE_FORMAT "ecoff-biglittlemips" + +#include "obj-format.h" diff -urN binutils-2.7/gas/config/te-sco386.h binutils-2.8/gas/config/te-sco386.h --- binutils-2.7/gas/config/te-sco386.h Thu Jul 4 12:14:51 1996 +++ binutils-2.8/gas/config/te-sco386.h Wed Dec 31 19:00:00 1969 @@ -1,10 +0,0 @@ -/* Machine specific defines for the SCO Unix V.3.2 ODT */ - -/* Local labels start with a period. */ -#define LOCAL_LABEL(name) (name[0] == '.' \ - && (name[1] == 'L' || name[1] == '.')) -#define FAKE_LABEL_NAME ".L0\001" - -#include "obj-format.h" - -/* end of te-sco386.h */ diff -urN binutils-2.7/gas/config/te-sparcaout.h binutils-2.8/gas/config/te-sparcaout.h --- binutils-2.7/gas/config/te-sparcaout.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/te-sparcaout.h Wed Apr 30 12:53:25 1997 @@ -0,0 +1,21 @@ +/* te-sparcaout.h -- embedded sparc-aout target environment declarations. + Copyright (C) 1996 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#define TE_SPARCAOUT 1 +#include "obj-format.h" diff -urN binutils-2.7/gas/config/te-svr4.h binutils-2.8/gas/config/te-svr4.h --- binutils-2.7/gas/config/te-svr4.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/te-svr4.h Wed Apr 30 12:53:25 1997 @@ -0,0 +1,4 @@ +#define TE_SVR4 +#define LOCAL_LABELS_FB 1 + +#include "obj-format.h" diff -urN binutils-2.7/gas/config/vms-a-conf.h binutils-2.8/gas/config/vms-a-conf.h --- binutils-2.7/gas/config/vms-a-conf.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/config/vms-a-conf.h Wed Apr 30 12:53:25 1997 @@ -0,0 +1,129 @@ +/* vms-alpha-conf.h. Generated manually from conf.in, + and used by config-gas-alpha.com when constructing config.h. */ + +/* Define if using alloca.c. */ +#ifdef __GNUC__ +#undef C_ALLOCA +#else +#define C_ALLOCA +#endif + +/* 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 and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define as __inline if that's what the C compiler calls it. */ +#ifdef __GNUC__ +#undef inline +#else +#define inline +#endif + +/* 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 + */ +#define STACK_DIRECTION (-1) + +/* Should gas use high-level BFD interfaces? */ +#define BFD_ASSEMBLER + +/* Some assert/preprocessor combinations are incapable of handling + certain kinds of constructs in the argument of assert. For example, + quoted strings (if requoting isn't done right) or newlines. */ +#ifdef __GNUC__ +#undef BROKEN_ASSERT +#else +#define BROKEN_ASSERT +#endif + +/* If we aren't doing cross-assembling, some operations can be optimized, + since byte orders and value sizes don't need to be adjusted. */ +#undef CROSS_COMPILE + +/* Some gas code wants to know these parameters. */ +#define TARGET_ALIAS "alpha-vms" +#define TARGET_CPU "alpha" +#define TARGET_CANONICAL "alpha-dec-vms" +#define TARGET_OS "openVMS/Alpha" +#define TARGET_VENDOR "dec" + +/* Sometimes the system header files don't declare malloc and realloc. */ +#undef NEED_DECLARATION_MALLOC + +/* Sometimes the system header files don't declare free. */ +#undef NEED_DECLARATION_FREE + +/* Sometimes errno.h doesn't declare errno itself. */ +#undef NEED_DECLARATION_ERRNO + +#undef MANY_SEGMENTS + +/* Needed only for sparc configuration */ +#undef sparcv9 + +/* Define if you have the remove function. */ +#define HAVE_REMOVE + +/* Define if you have the unlink function. */ +#undef HAVE_UNLINK + +/* Define if you have the header file. */ +#define HAVE_ERRNO_H + +/* Define if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define if you have the header file. */ +#define HAVE_STDARG_H + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H + +/* Define if you have the header file. */ +#define HAVE_STRING_H + +/* Define if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the header file. */ +#ifdef __GNUC__ +#define HAVE_SYS_TYPES_H +#else +#undef HAVE_SYS_TYPES_H +#endif + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H /* config-gas.com will make one if necessary */ + +/* Define if you have the header file. */ +#undef HAVE_VARARGS_H + +/* VMS-specific: we need to set up EXIT_xxx here because the default + values in as.h are inappropriate for VMS, but we also want to prevent + as.h's inclusion of from triggering redefinition warnings. + guards itself against multiple inclusion, so including it + here turns as.h's later #include into a no-op. (We can't simply use + #ifndef HAVE_STDLIB_H here, because the in several older + gcc-vms distributions neglects to define these two required macros.) */ +#ifdef HAVE_STDLIB_H +#include +#endif +#if __DECC +#undef EXIT_SUCCESS +#undef EXIT_FAILURE +#define EXIT_SUCCESS 1 /* SS$_NORMAL, STS$K_SUCCESS */ +#define EXIT_FAILURE 0x10000002 /* (STS$K_ERROR | STS$M_INHIB_MSG) */ +#endif + +#include +#if __DECC +extern int strcasecmp (); +extern int strncasecmp (); +#endif diff -urN binutils-2.7/gas/config-gas.com binutils-2.8/gas/config-gas.com --- binutils-2.7/gas/config-gas.com Thu Jul 4 12:12:47 1996 +++ binutils-2.8/gas/config-gas.com Wed Apr 30 12:53:31 1997 @@ -3,15 +3,23 @@ $! files for a VMS system. We do not use the configure script, since we $! do not have /bin/sh to execute it. $! -$! If you are running this file, then obviously the host is vax-dec-vms. -$! [That's no longer obvious, but there's not much we can do about alpha yet.] $! $gas_host="vms" $! +$arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2 +$arch = f$element(arch_indx,"|","|VAX|Alpha|") +$if arch .eqs. "VAX" +$then $cpu_type="vax" -$emulation="generic" $obj_format="vms" $atof="vax" +$else +$ cpu_type="alpha" +$ obj_format="evax" +$ atof="ieee" +$endif +$ +$emulation="generic" $! $ DELETE = "delete/noConfirm" $ ECHO = "write sys$output" @@ -60,7 +68,12 @@ $write ifile$ "#define GAS_VERSION """,line,"""" $write ifile$ "#endif" $write ifile$ "/*--*/" +$if arch .eqs. "VAX" +$then $append [.config]vms-conf.h ifile$: +$else +$ append [.config]vms-a-conf.h ifile$: +$endif $close ifile$ $ECHO "Created config.h." $! @@ -155,9 +168,10 @@ $! Done $! $ if f$search("config.status") .nes. "" then DELETE config.status;* -$ create config.status -Links are now set up for use with a vax running VMS. -$ type config.status +$ open/write cfile []config.status +$ write cfile "Links are now set up for use with a "+arch+" running VMS." +$ close cfile +$ type []config.status $exit $! $! diff -urN binutils-2.7/gas/configure binutils-2.8/gas/configure --- binutils-2.7/gas/configure Thu Jul 4 12:34:32 1996 +++ binutils-2.8/gas/configure Wed Apr 30 12:53:32 1997 @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.10 +# Generated automatically using autoconf version 2.12 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -17,6 +17,8 @@ targets alternative target configurations besides the primary" ac_help="$ac_help --enable-shared build shared BFD library" +ac_help="$ac_help + --enable-commonbfdlib build shared BFD/opcodes/libiberty library" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -55,6 +57,8 @@ # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 ac_prev= for ac_option @@ -336,7 +340,7 @@ verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.10" + echo "configure generated by autoconf version 2.12" exit 0 ;; -with-* | --with-*) @@ -438,11 +442,14 @@ done # NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# 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 @@ -504,6 +511,7 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. @@ -550,6 +558,15 @@ *) shared=false ;; esac fi +# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. +if test "${enable_commonbfdlib+set}" = set; then + enableval="$enable_commonbfdlib" + case "${enableval}" in + yes) commonbfdlib=true ;; + no) commonbfdlib=false ;; + *) { echo "configure: error: bad value ${enableval} for BFD commonbfdlib option" 1>&2; exit 1; } ;; +esac +fi # Generate a header file -- gets more post-processing by Makefile later. @@ -601,6 +618,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:622: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -615,12 +633,13 @@ esac host=`$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/'` +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:643: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -632,12 +651,13 @@ esac target=`$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/'` +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:661: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -649,9 +669,9 @@ esac build=`$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/'` +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" && @@ -684,7 +704,7 @@ canon_targets="" if test -n "$enable_targets" ; then for t in `echo $enable_targets | sed 's/,/ /g'`; do - result=`$ac_config_sub $t 2>/dev/null` + result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $t 2>/dev/null` if test -n "$result" ; then canon_targets="$canon_targets $result" # else @@ -711,7 +731,7 @@ for this_target in $target $canon_targets ; do - eval `echo $this_target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'` + eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'` # check for architecture variants case ${cpu} in @@ -723,7 +743,7 @@ m68008) cpu_type=m68k ;; m683??) cpu_type=m68k ;; m8*) cpu_type=m88k ;; - mips*el) cpu_type=mips endian=little;; + mips*el) cpu_type=mips endian=little ;; mips*) cpu_type=mips endian=big ;; powerpcle*) cpu_type=ppc endian=little ;; powerpc*) cpu_type=ppc endian=big ;; @@ -753,7 +773,9 @@ a29k-nyu-sym1) fmt=coff targ=ebmon29k ;; a29k-*-vxworks*) fmt=coff ;; + alpha-*-*vms*) fmt=evax ;; alpha-*-netware*) fmt=ecoff ;; + alpha-*-openbsd*) fmt=ecoff ;; alpha-*-osf*) fmt=ecoff ;; alpha-*-linuxecoff*) fmt=ecoff ;; alpha-*-linux*) fmt=elf em=linux ;; @@ -770,9 +792,12 @@ arm-*-riscix*) fmt=aout ;; arm-*-pe) fmt=coff targ=armcoff em=pe ;; + d10v-*-*) fmt=elf bfd_gas=yes ;; + hppa-*-*elf*) fmt=elf em=hppa ;; hppa-*-lites*) fmt=elf em=hppa ;; hppa-*-osf*) fmt=som em=hppa ;; + hppa-*-rtems*) fmt=elf em=hppa ;; hppa-*-hpux*) fmt=som em=hppa ;; hppa-*-bsd*) fmt=som em=hppa ;; hppa-*-hiux*) fmt=som em=hppa ;; @@ -781,9 +806,11 @@ i386-ibm-aix*) fmt=coff targ=i386coff em=i386aix ;; + i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;; i386-*-bsd*) fmt=aout em=386bsd ;; i386-*-netbsd0.8) fmt=aout em=386bsd ;; i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;; + i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;; i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;; i386-*-linux*coff*) fmt=coff em=linux targ=i386coff ;; @@ -815,13 +842,16 @@ i960-*-vxworks5.*) fmt=coff em=ic960 targ=ic960coff ;; i960-*-vxworks*) fmt=bout ;; + m32r-*-*) fmt=elf bfd_gas=yes ;; + m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*) fmt=aout em=sun3 ;; m68k-motorola-sysv*) fmt=coff targ=m68kcoff em=delta ;; m68k-bull-sysv3*) fmt=coff targ=m68kcoff em=dpx2 ;; m68k-apollo-*) fmt=coff targ=apollo em=apollo ;; - m68k-*-sysv4 | m68k-*-elf) # must be before -sysv* - fmt=elf ;; + m68k-*-sysv4*) # must be before -sysv* + fmt=elf em=svr4 ;; + m68k-*-elf*) fmt=elf ;; m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*) fmt=coff targ=m68kcoff ;; m68k-*-hpux*) fmt=hp300 em=hp300 ;; @@ -830,6 +860,7 @@ m68k-*-lynxos*) fmt=coff targ=m68kcoff em=lynx ;; m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; + m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; m68k-apple-aux*) fmt=coff targ=m68kcoff em=aux ;; m68k-*-psos*) fmt=elf em=psos;; @@ -838,6 +869,7 @@ # don't change em like *-*-bsd does mips-dec-netbsd*) fmt=elf targ=mips-lit endian=little ;; + mips-dec-openbsd*) fmt=elf targ=mips-lit endian=little ;; mips-dec-bsd*) fmt=aout targ=mips-lit ;; mips-sony-bsd*) fmt=ecoff targ=mips-big ;; mips-*-bsd*) { echo "configure: error: Unknown vendor for mips-bsd configuration." 1>&2; exit 1; } ;; @@ -850,22 +882,21 @@ esac ;; mips-*-ecoff*) fmt=ecoff targ=mips-big ;; - mips-*-gnu*) fmt=aout - case "$endian" in - big) targ=mips-big ;; - *) targ=mips-lit ;; - esac - ;; + mips-*-irix6*) fmt=elf targ=mips-big ;; mips-*-irix5*) fmt=elf targ=mips-big ;; mips-*-irix*) fmt=ecoff targ=mips-big ;; + mips-*-lnews*) fmt=ecoff targ=mips-lit em=lnews ;; mips-*-riscos*) fmt=ecoff targ=mips-big ;; mips-*-sysv*) fmt=ecoff targ=mips-big ;; - mips-*-elf*) fmt=elf + mips-*-elf* | mips-*-rtems* | mips-*-linux* | mips-*-gnu* | mips-*-openbsd*) + fmt=elf case "$endian" in big) targ=mips-big ;; *) targ=mips-lit ;; esac ;; + mn10200-*-*) fmt=elf bfd_gas=yes ;; + mn10300-*-*) fmt=elf bfd_gas=yes ;; ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*) fmt=coff em=pe case "$endian" in @@ -874,7 +905,8 @@ esac ;; ppc-*-aix*) fmt=coff ;; - ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*) + ppc-*-beos*) fmt=coff ;; + ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*) fmt=elf case "$endian" in big) targ=ppc-big ;; @@ -904,21 +936,26 @@ fmt=coff em=macos ;; ppc-*-netware*) fmt=elf em=ppcnw ;; - sh-*-coff) fmt=coff ;; + sh-*-elf*) fmt=elf ;; + sh-*-coff*) fmt=coff ;; ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;; ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;; + ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;; sparc-*-rtems*) fmt=aout ;; sparc-*-sunos4*) fmt=aout em=sun3 ;; sparc-*-aout | sparc*-*-vxworks*) - fmt=aout ;; + fmt=aout em=sparcaout ;; sparc-*-coff) fmt=coff ;; + sparc-*-linux*aout*) fmt=aout em=linux ;; + sparc-*-linux*) fmt=elf em=linux ;; sparc-*-lynxos*) fmt=coff em=lynx ;; sparc-fujitsu-none) fmt=aout ;; - sparc-*-elf | sparc-*-solaris*) + sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*) fmt=elf ;; sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; + sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; vax-*-bsd* | vax-*-ultrix*) fmt=aout ;; @@ -988,12 +1025,44 @@ esac case ${cpu_type} in + m32r) + case ${extra_objects} in + *cgen.o*) ;; + *) extra_objects="$extra_objects cgen.o" + cat >> confdefs.h <<\EOF +#define USING_CGEN 1 +EOF + + ;; + esac + ;; + m68k) case ${extra_objects} in *m68k-parse.o*) ;; *) extra_objects="$extra_objects m68k-parse.o" ;; esac ;; + + mips) + echo ${extra_objects} | grep -s "itbl-parse.o" + if test $? -ne 0 ; then + extra_objects="$extra_objects itbl-parse.o" + fi + + echo ${extra_objects} | grep -s "itbl-lex.o" + if test $? -ne 0 ; then + extra_objects="$extra_objects itbl-lex.o" + fi + + echo ${extra_objects} | grep -s "itbl-ops.o" + if test $? -ne 0 ; then + extra_objects="$extra_objects itbl-ops.o" + fi + ;; + + *) + ;; esac # See if we really can support this configuration with the emulation code. @@ -1017,6 +1086,11 @@ case ${generic_target}-${fmt} in mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; + mips-*-linux*-*) case "$endian" in + big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; + *) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;; + esac ;; + mips-*-lnews*-ecoff) ;; mips-*-*-ecoff) case "$endian" in big) emulation="mipsbecoff mipslecoff mipsecoff" ;; *) emulation="mipslecoff mipsbecoff mipsecoff" ;; @@ -1024,6 +1098,10 @@ mips-*-*-elf) case "$endian" in big) emulation="mipsbelf mipslelf mipself" ;; *) emulation="mipslelf mipsbelf mipself" ;; + # Uncommenting the next line will turn on support for i386 COFF + # in any i386 ELF configuration. This probably doesn't work + # correctly. + # i386-*-*-elf) emulation="i386coff i386elf" ;; esac ;; esac @@ -1136,6 +1214,10 @@ fmt=elf file=mipself ;; mipsbecoff | mipslecoff) fmt=ecoff file=mipsecoff ;; + i386coff) + fmt=coff file=i386coff ;; + i386elf) + fmt=elf file=i386elf ;; esac formats="$formats $fmt" emfiles="$emfiles e-$file.o" @@ -1234,13 +1316,6 @@ EOF -files="config/tc-${target_cpu_type}.c config/tc-${target_cpu_type}.h \ - config/obj-${obj_format}.h config/obj-${obj_format}.c \ - config/te-${te_file}.h config/atof-${atof}.c \ - $extra_files" -links="targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c \ - $extra_links" - case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in yes-*-coff) need_bfd=yes ;; no-*-coff) need_bfd=yes @@ -1263,7 +1338,6 @@ - case "${primary_bfd_gas}" in yes) cat >> confdefs.h <<\EOF #define BFD_ASSEMBLER 1 @@ -1303,8 +1377,6 @@ ;; esac - - case "${need_bfd}" in yes) BFDDEP=../bfd/libbfd.a @@ -1333,12 +1405,22 @@ fi ;; esac + + if test "${commonbfdlib}" = "true"; then + # when a shared libbfd is built with --enable-commonbfdlib, + # all of libopcodes is available in libbfd.so + OPCODES_LIB= + fi ;; esac + + + + cat >> confdefs.h <&6 +echo "configure:1449: 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 @@ -1391,6 +1474,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1478: 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 @@ -1437,7 +1521,47 @@ 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:1526: 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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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* + +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:1560: 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:1565: 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 @@ -1446,7 +1570,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1453: \"$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:1574: \"$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 @@ -1454,29 +1578,34 @@ fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + if test $ac_cv_prog_gcc = yes; then GCC=yes - if test "${CFLAGS+set}" != set; then - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + 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:1589: 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_gcc_g=yes + ac_cv_prog_cc_g=yes else - ac_cv_prog_gcc_g=no + ac_cv_prog_cc_g=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 - if test $ac_cv_prog_gcc_g = yes; then - CFLAGS="-g -O" - else - CFLAGS="-O" - 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 + CFLAGS="-g -O2" + else + CFLAGS="-O2" fi else GCC= @@ -1494,11 +1623,12 @@ # 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:1627: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in @@ -1521,7 +1651,7 @@ ;; esac done - IFS="$ac_save_ifs" + IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then @@ -1544,6 +1674,7 @@ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1678: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1558,33 +1689,37 @@ # 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:1571: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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:1586: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1716: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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 @@ -1601,24 +1736,27 @@ for ac_hdr in string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h do -ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1742: 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:1619: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1752: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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 @@ -1626,7 +1764,7 @@ 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 | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 +echo "configure:1782: checking whether compiling a cross-assembler" >&5 if test "${host}" = "${target}"; then cross_gas=no else @@ -1651,56 +1790,31 @@ fi echo "$ac_t""$cross_gas" 1>&6 -# If we cannot run a trivial program, we must be cross compiling. -echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_c_cross=yes -else -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } -if test -s conftest && (./conftest; exit) 2>/dev/null; then - ac_cv_c_cross=no -else - ac_cv_c_cross=yes -fi -fi -rm -fr conftest* -fi - -echo "$ac_t""$ac_cv_c_cross" 1>&6 -cross_compiling=$ac_cv_c_cross - # 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:1797: 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() { return 0; } -int t() { +int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 @@ -1712,11 +1826,12 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_func_alloca'+set}'`\" = set"; then +echo "configure:1830: 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; }; then +if { (eval echo configure:1858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - ac_cv_func_alloca=yes + 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=no + ac_cv_func_alloca_works=no fi rm -f conftest* - fi -echo "$ac_t""$ac_cv_func_alloca" 1>&6 -if test $ac_cv_func_alloca = yes; then +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 = no; then +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, @@ -1771,11 +1886,12 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:1890: 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 +echo "configure:1920: 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; }; then +if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 +echo "configure:1975: 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 < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } -if test -s conftest && (./conftest; exit) 2>/dev/null; then +if { (eval echo configure:2002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./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 -fi rm -fr conftest* fi +fi + echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 cat >> confdefs.h <&6 +echo "configure:2024: 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:2038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* - done fi @@ -1939,11 +2064,12 @@ for ac_func in unlink remove do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2068: 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; }; then +if { (eval echo configure:2096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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'` @@ -1994,11 +2121,12 @@ for ac_func in sbrk do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2125: 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; }; then +if { (eval echo configure:2153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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'` @@ -2049,16 +2178,16 @@ # enough, but on some of those systems, the assert macro relies on requoting # working properly! echo $ac_n "checking for working assert macro""... $ac_c" 1>&6 +echo "configure:2182: checking for working assert macro" >&5 if eval "test \"`echo '$''{'gas_cv_assert_ok'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include -int main() { return 0; } -int t() { +int main() { /* check for requoting problems */ static int a, b, c, d; @@ -2070,15 +2199,16 @@ ; return 0; } EOF -if { (eval echo configure:2077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* gas_cv_assert_ok=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* gas_cv_assert_ok=no fi rm -f conftest* - fi echo "$ac_t""$gas_cv_assert_ok" 1>&6 test $gas_cv_assert_ok = yes || cat >> confdefs.h <<\EOF @@ -2096,6 +2226,10 @@ #endif #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include +#endif #endif #ifdef HAVE_STDLIB_H #include @@ -2105,16 +2239,53 @@ #endif " +echo $ac_n "checking whether declaration is required for strstr""... $ac_c" 1>&6 +echo "configure:2244: checking whether declaration is required for strstr" >&5 +if eval "test \"`echo '$''{'gas_cv_decl_needed_strstr'+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; then + rm -rf conftest* + gas_cv_decl_needed_strstr=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gas_cv_decl_needed_strstr=yes +fi +rm -f conftest* +fi +echo "$ac_t""$gas_cv_decl_needed_strstr" 1>&6 +test $gas_cv_decl_needed_strstr = no || { + cat >> confdefs.h <<\EOF +#define NEED_DECLARATION_STRSTR 1 +EOF + +} + + echo $ac_n "checking whether declaration is required for malloc""... $ac_c" 1>&6 +echo "configure:2281: checking whether declaration is required for malloc" >&5 if eval "test \"`echo '$''{'gas_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* gas_cv_decl_needed_malloc=no else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* gas_cv_decl_needed_malloc=yes fi rm -f conftest* - fi echo "$ac_t""$gas_cv_decl_needed_malloc" 1>&6 test $gas_cv_decl_needed_malloc = no || { @@ -2142,15 +2314,15 @@ echo $ac_n "checking whether declaration is required for free""... $ac_c" 1>&6 +echo "configure:2318: checking whether declaration is required for free" >&5 if eval "test \"`echo '$''{'gas_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* gas_cv_decl_needed_free=no else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* gas_cv_decl_needed_free=yes fi rm -f conftest* - fi echo "$ac_t""$gas_cv_decl_needed_free" 1>&6 test $gas_cv_decl_needed_free = no || { @@ -2177,23 +2350,60 @@ } +echo $ac_n "checking whether declaration is required for sbrk""... $ac_c" 1>&6 +echo "configure:2355: checking whether declaration is required for sbrk" >&5 +if eval "test \"`echo '$''{'gas_cv_decl_needed_sbrk'+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; then + rm -rf conftest* + gas_cv_decl_needed_sbrk=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gas_cv_decl_needed_sbrk=yes +fi +rm -f conftest* +fi +echo "$ac_t""$gas_cv_decl_needed_sbrk" 1>&6 +test $gas_cv_decl_needed_sbrk = no || { + cat >> confdefs.h <<\EOF +#define NEED_DECLARATION_SBRK 1 +EOF + +} + + # Does errno.h declare errno, or do we have to add a separate declaration # for it? echo $ac_n "checking whether declaration is required for errno""... $ac_c" 1>&6 +echo "configure:2395: checking whether declaration is required for errno" >&5 if eval "test \"`echo '$''{'gas_cv_decl_needed_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #endif -int main() { return 0; } -int t() { +int main() { typedef int f; f x; @@ -2201,15 +2411,16 @@ ; return 0; } EOF -if { (eval echo configure:2208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* gas_cv_decl_needed_errno=no else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* gas_cv_decl_needed_errno=yes fi rm -f conftest* - fi echo "$ac_t""$gas_cv_decl_needed_errno" 1>&6 test $gas_cv_decl_needed_errno = no || { @@ -2221,6 +2432,7 @@ HLDFLAGS= +HLDENV= RPATH_ENVVAR=LD_LIBRARY_PATH # If we have shared libraries, try to set rpath reasonably. if test "${shared}" = "true"; then @@ -2229,7 +2441,7 @@ HLDFLAGS='-Wl,+s,+b,$(libdir)' RPATH_ENVVAR=SHLIB_PATH ;; - *-*-irix5*) + *-*-irix5* | *-*-irix6*) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; *-*-linux*aout*) @@ -2237,9 +2449,12 @@ *-*-linux*) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; - *-*-sysv4* | *-*-solaris*) + *-*-solaris*) HLDFLAGS='-R $(libdir)' ;; + *-*-sysv4*) + HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;' + ;; esac fi @@ -2267,6 +2482,9 @@ + + + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -2284,11 +2502,25 @@ # --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 | - sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ - >> confcache + case `(ac_space=' '; set) 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 @@ -2343,7 +2575,7 @@ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.10" + echo "$CONFIG_STATUS generated by autoconf version 2.12" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -2404,11 +2636,12 @@ s%@extra_objects@%$extra_objects%g s%@target_cpu_type@%$target_cpu_type%g s%@obj_format@%$obj_format%g +s%@te_file@%$te_file%g s%@atof@%$atof%g -s%@OPCODES_DEP@%$OPCODES_DEP%g -s%@OPCODES_LIB@%$OPCODES_LIB%g s%@BFDDEP@%$BFDDEP%g s%@BFDLIB@%$BFDLIB%g +s%@OPCODES_DEP@%$OPCODES_DEP%g +s%@OPCODES_LIB@%$OPCODES_LIB%g s%@ALL_OBJ_DEPS@%$ALL_OBJ_DEPS%g s%@CC@%$CC%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g @@ -2416,24 +2649,61 @@ s%@CPP@%$CPP%g s%@ALLOCA@%$ALLOCA%g s%@HLDFLAGS@%$HLDFLAGS%g +s%@HLDENV@%$HLDENV%g s%@RPATH_ENVVAR@%$RPATH_ENVVAR%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]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac - # Adjust relative srcdir, etc. for subdirectories. + # 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%/[^/][^/]*$%%'` @@ -2461,6 +2731,7 @@ [/$]*) 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." @@ -2469,14 +2740,16 @@ # $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 -" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done -rm -f conftest.subs +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. @@ -2497,11 +2770,17 @@ ac_eC=' ' ac_eD='%g' -CONFIG_HEADERS=${CONFIG_HEADERS-"conf"} +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]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac @@ -2509,7 +2788,8 @@ echo creating $ac_file rm -f conftest.frag conftest.in conftest.out - cp $ac_given_srcdir/$ac_file_in conftest.in + 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 @@ -2537,8 +2817,6 @@ # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. -# Maximum number of lines to put in a single here document. -ac_max_here_lines=12 rm -f conftest.tail while : @@ -2581,52 +2859,20 @@ 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 - - +rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h + echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h + echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h + echo '#include "te-'"${te_file}"'.h"' > targ-env.h + echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h + case ${target_cpu_type} in + m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;; + esac exit 0 EOF chmod +x $CONFIG_STATUS diff -urN binutils-2.7/gas/configure.in binutils-2.8/gas/configure.in --- binutils-2.7/gas/configure.in Thu Jul 4 12:34:31 1996 +++ binutils-2.8/gas/configure.in Wed Apr 30 12:53:32 1997 @@ -34,6 +34,13 @@ *opcodes*) shared=true shared_opcodes=true ;; *) shared=false ;; esac])dnl +AC_ARG_ENABLE(commonbfdlib, +[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library], +[case "${enableval}" in + yes) commonbfdlib=true ;; + no) commonbfdlib=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; +esac])dnl # Generate a header file -- gets more post-processing by Makefile later. AC_CONFIG_HEADER(conf) @@ -48,7 +55,7 @@ canon_targets="" if test -n "$enable_targets" ; then for t in `echo $enable_targets | sed 's/,/ /g'`; do - result=`$ac_config_sub $t 2>/dev/null` + result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $t 2>/dev/null` if test -n "$result" ; then canon_targets="$canon_targets $result" # else @@ -63,7 +70,9 @@ for this_target in $target $canon_targets ; do - eval `echo $this_target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'` +changequote(,)dnl + eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'` +changequote([,])dnl # check for architecture variants case ${cpu} in @@ -77,7 +86,7 @@ m683??) cpu_type=m68k ;; changequote([,])dnl m8*) cpu_type=m88k ;; - mips*el) cpu_type=mips endian=little;; + mips*el) cpu_type=mips endian=little ;; mips*) cpu_type=mips endian=big ;; powerpcle*) cpu_type=ppc endian=little ;; powerpc*) cpu_type=ppc endian=big ;; @@ -107,7 +116,9 @@ a29k-nyu-sym1) fmt=coff targ=ebmon29k ;; a29k-*-vxworks*) fmt=coff ;; + alpha-*-*vms*) fmt=evax ;; alpha-*-netware*) fmt=ecoff ;; + alpha-*-openbsd*) fmt=ecoff ;; alpha-*-osf*) fmt=ecoff ;; alpha-*-linuxecoff*) fmt=ecoff ;; alpha-*-linux*) fmt=elf em=linux ;; @@ -124,9 +135,12 @@ arm-*-riscix*) fmt=aout ;; arm-*-pe) fmt=coff targ=armcoff em=pe ;; + d10v-*-*) fmt=elf bfd_gas=yes ;; + hppa-*-*elf*) fmt=elf em=hppa ;; hppa-*-lites*) fmt=elf em=hppa ;; hppa-*-osf*) fmt=som em=hppa ;; + hppa-*-rtems*) fmt=elf em=hppa ;; hppa-*-hpux*) fmt=som em=hppa ;; hppa-*-bsd*) fmt=som em=hppa ;; hppa-*-hiux*) fmt=som em=hppa ;; @@ -135,9 +149,11 @@ i386-ibm-aix*) fmt=coff targ=i386coff em=i386aix ;; + i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;; i386-*-bsd*) fmt=aout em=386bsd ;; i386-*-netbsd0.8) fmt=aout em=386bsd ;; i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;; + i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;; i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;; i386-*-linux*coff*) fmt=coff em=linux targ=i386coff ;; @@ -169,13 +185,16 @@ i960-*-vxworks5.*) fmt=coff em=ic960 targ=ic960coff ;; i960-*-vxworks*) fmt=bout ;; + m32r-*-*) fmt=elf bfd_gas=yes ;; + m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*) fmt=aout em=sun3 ;; m68k-motorola-sysv*) fmt=coff targ=m68kcoff em=delta ;; m68k-bull-sysv3*) fmt=coff targ=m68kcoff em=dpx2 ;; m68k-apollo-*) fmt=coff targ=apollo em=apollo ;; - m68k-*-sysv4 | m68k-*-elf) # must be before -sysv* - fmt=elf ;; + m68k-*-sysv4*) # must be before -sysv* + fmt=elf em=svr4 ;; + m68k-*-elf*) fmt=elf ;; m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*) fmt=coff targ=m68kcoff ;; m68k-*-hpux*) fmt=hp300 em=hp300 ;; @@ -184,6 +203,7 @@ m68k-*-lynxos*) fmt=coff targ=m68kcoff em=lynx ;; m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; + m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; m68k-apple-aux*) fmt=coff targ=m68kcoff em=aux ;; m68k-*-psos*) fmt=elf em=psos;; @@ -192,6 +212,7 @@ # don't change em like *-*-bsd does mips-dec-netbsd*) fmt=elf targ=mips-lit endian=little ;; + mips-dec-openbsd*) fmt=elf targ=mips-lit endian=little ;; mips-dec-bsd*) fmt=aout targ=mips-lit ;; mips-sony-bsd*) fmt=ecoff targ=mips-big ;; mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;; @@ -204,22 +225,21 @@ esac ;; mips-*-ecoff*) fmt=ecoff targ=mips-big ;; - mips-*-gnu*) fmt=aout - case "$endian" in - big) targ=mips-big ;; - *) targ=mips-lit ;; - esac - ;; + mips-*-irix6*) fmt=elf targ=mips-big ;; mips-*-irix5*) fmt=elf targ=mips-big ;; mips-*-irix*) fmt=ecoff targ=mips-big ;; + mips-*-lnews*) fmt=ecoff targ=mips-lit em=lnews ;; mips-*-riscos*) fmt=ecoff targ=mips-big ;; mips-*-sysv*) fmt=ecoff targ=mips-big ;; - mips-*-elf*) fmt=elf + mips-*-elf* | mips-*-rtems* | mips-*-linux* | mips-*-gnu* | mips-*-openbsd*) + fmt=elf case "$endian" in big) targ=mips-big ;; *) targ=mips-lit ;; esac ;; + mn10200-*-*) fmt=elf bfd_gas=yes ;; + mn10300-*-*) fmt=elf bfd_gas=yes ;; ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*) fmt=coff em=pe case "$endian" in @@ -228,7 +248,8 @@ esac ;; ppc-*-aix*) fmt=coff ;; - ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*) + ppc-*-beos*) fmt=coff ;; + ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*) fmt=elf case "$endian" in big) targ=ppc-big ;; @@ -258,21 +279,26 @@ fmt=coff em=macos ;; ppc-*-netware*) fmt=elf em=ppcnw ;; - sh-*-coff) fmt=coff ;; + sh-*-elf*) fmt=elf ;; + sh-*-coff*) fmt=coff ;; ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;; ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;; + ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;; sparc-*-rtems*) fmt=aout ;; sparc-*-sunos4*) fmt=aout em=sun3 ;; sparc-*-aout | sparc*-*-vxworks*) - fmt=aout ;; + fmt=aout em=sparcaout ;; sparc-*-coff) fmt=coff ;; + sparc-*-linux*aout*) fmt=aout em=linux ;; + sparc-*-linux*) fmt=elf em=linux ;; sparc-*-lynxos*) fmt=coff em=lynx ;; sparc-fujitsu-none) fmt=aout ;; - sparc-*-elf | sparc-*-solaris*) + sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*) fmt=elf ;; sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; + sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; vax-*-bsd* | vax-*-ultrix*) fmt=aout ;; @@ -336,12 +362,41 @@ esac case ${cpu_type} in + m32r) + case ${extra_objects} in + *cgen.o*) ;; + *) extra_objects="$extra_objects cgen.o" + AC_DEFINE(USING_CGEN) + ;; + esac + ;; + m68k) case ${extra_objects} in *m68k-parse.o*) ;; *) extra_objects="$extra_objects m68k-parse.o" ;; esac ;; + + mips) + echo ${extra_objects} | grep -s "itbl-parse.o" + if test $? -ne 0 ; then + extra_objects="$extra_objects itbl-parse.o" + fi + + echo ${extra_objects} | grep -s "itbl-lex.o" + if test $? -ne 0 ; then + extra_objects="$extra_objects itbl-lex.o" + fi + + echo ${extra_objects} | grep -s "itbl-ops.o" + if test $? -ne 0 ; then + extra_objects="$extra_objects itbl-ops.o" + fi + ;; + + *) + ;; esac # See if we really can support this configuration with the emulation code. @@ -365,6 +420,11 @@ case ${generic_target}-${fmt} in mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; + mips-*-linux*-*) case "$endian" in + big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; + *) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;; + esac ;; + mips-*-lnews*-ecoff) ;; mips-*-*-ecoff) case "$endian" in big) emulation="mipsbecoff mipslecoff mipsecoff" ;; *) emulation="mipslecoff mipsbecoff mipsecoff" ;; @@ -372,6 +432,10 @@ mips-*-*-elf) case "$endian" in big) emulation="mipsbelf mipslelf mipself" ;; *) emulation="mipslelf mipsbelf mipself" ;; + # Uncommenting the next line will turn on support for i386 COFF + # in any i386 ELF configuration. This probably doesn't work + # correctly. + # i386-*-*-elf) emulation="i386coff i386elf" ;; esac ;; esac @@ -466,6 +530,10 @@ fmt=elf file=mipself ;; mipsbecoff | mipslecoff) fmt=ecoff file=mipsecoff ;; + i386coff) + fmt=coff file=i386coff ;; + i386elf) + fmt=elf file=i386elf ;; esac formats="$formats $fmt" emfiles="$emfiles e-$file.o" @@ -501,13 +569,6 @@ AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS) AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION") -files="config/tc-${target_cpu_type}.c config/tc-${target_cpu_type}.h \ - config/obj-${obj_format}.h config/obj-${obj_format}.c \ - config/te-${te_file}.h config/atof-${atof}.c \ - $extra_files" -links="targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c \ - $extra_links" - case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in yes-*-coff) need_bfd=yes ;; no-*-coff) need_bfd=yes @@ -524,11 +585,10 @@ AC_SUBST(target_cpu_type) AC_SUBST(obj_format) +AC_SUBST(te_file) AC_SUBST(atof) dnl AC_SUBST(emulation) -AC_LINK_FILES($files, $links) - case "${primary_bfd_gas}" in yes) AC_DEFINE(BFD_ASSEMBLER) need_bfd=yes ;; @@ -564,8 +624,6 @@ esac ;; esac -AC_SUBST(OPCODES_DEP) -AC_SUBST(OPCODES_LIB) case "${need_bfd}" in yes) @@ -595,10 +653,20 @@ fi ;; esac + + if test "${commonbfdlib}" = "true"; then + # when a shared libbfd is built with --enable-commonbfdlib, + # all of libopcodes is available in libbfd.so + OPCODES_LIB= + fi ;; esac + AC_SUBST(BFDDEP) AC_SUBST(BFDLIB) +AC_SUBST(OPCODES_DEP) +AC_SUBST(OPCODES_LIB) + AC_SUBST(ALL_OBJ_DEPS) AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}") @@ -648,6 +716,10 @@ #endif #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include +#endif #endif #ifdef HAVE_STDLIB_H #include @@ -656,8 +728,10 @@ #include #endif " +GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers) GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers) GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers) +GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers) # Does errno.h declare errno, or do we have to add a separate declaration # for it? @@ -668,6 +742,7 @@ ]) HLDFLAGS= +HLDENV= RPATH_ENVVAR=LD_LIBRARY_PATH # If we have shared libraries, try to set rpath reasonably. if test "${shared}" = "true"; then @@ -676,7 +751,7 @@ HLDFLAGS='-Wl,+s,+b,$(libdir)' RPATH_ENVVAR=SHLIB_PATH ;; - *-*-irix5*) + *-*-irix5* | *-*-irix6*) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; *-*-linux*aout*) @@ -684,9 +759,12 @@ *-*-linux*) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; - *-*-sysv4* | *-*-solaris*) + *-*-solaris*) HLDFLAGS='-R $(libdir)' ;; + *-*-sysv4*) + HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;' + ;; esac fi @@ -712,7 +790,26 @@ ;; esac AC_SUBST(HLDFLAGS) +AC_SUBST(HLDENV) AC_SUBST(RPATH_ENVVAR) dnl This must come last. -AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in) + +dnl We used to make symlinks to files in the source directory, but now +dnl we just use the right name for .c files, and create .h files in +dnl the build directory which include the right .h file. Make sure +dnl the old symlinks don't exist, so that a reconfigure in an existing +dnl directory behaves reasonably. + +AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in, +[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h + echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h + echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h + echo '#include "te-'"${te_file}"'.h"' > targ-env.h + echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h + case ${target_cpu_type} in + m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;; + esac], +[target_cpu_type=${target_cpu_type} + obj_format=${obj_format} + te_file=${te_file}]) diff -urN binutils-2.7/gas/dep-in.sed binutils-2.8/gas/dep-in.sed --- binutils-2.7/gas/dep-in.sed Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/dep-in.sed Wed Apr 30 12:53:32 1997 @@ -0,0 +1,44 @@ +:loop +/\\$/N +/\\$/b loop + +s! ../config.h!!g +s! ../../bfd/bfd.h!!g +s! ../itbl-parse.h!!g +s!@INCDIR@!$(INCDIR)!g +s!@BFDDIR@!$(BFDDIR)!g +s!@SRCDIR@/config!$(srcdir)/config!g +s!@SRCDIR@/../opcodes!$(srcdir)/../opcodes!g +s!@SRCDIR@/!!g +s! config.h!!g +s! as.h!!g +s! targ-env.h!!g +s! obj-format.h!!g +s! targ-cpu.h!!g +s! flonum.h!!g +s! expr.h!!g +s! struc-symbol.h!!g +s! write.h!!g +s! frags.h!!g +s! hash.h!!g +s! read.h!!g +s! symbols.h!!g +s! tc.h!!g +s! obj.h!!g +s! listing.h!!g +s! bignum.h!!g +s! bit_fix.h!!g +s! itbl-cpu.h!!g +s! \$(srcdir)/config/te-generic.h!!g +s! \$(INCDIR)/libiberty.h!!g +s! \$(INCDIR)/ansidecl.h!!g +s! \$(INCDIR)/fopen-same.h!!g + +s/\\\n */ /g + +s/ *$// +s/ */ /g +/:$/d + +s/\(.\{50\}[^ ]*\) /\1 \\\ + /g diff -urN binutils-2.7/gas/doc/Makefile.in binutils-2.8/gas/doc/Makefile.in --- binutils-2.7/gas/doc/Makefile.in Thu Jul 4 12:14:53 1996 +++ binutils-2.8/gas/doc/Makefile.in Wed Apr 30 12:53:26 1997 @@ -58,7 +58,8 @@ AR_FLAGS = qv BISON = bison MAKEINFO = makeinfo -TEXI2DVI = TEXINPUTS=$(srcdir):$(TEXIDIR):$$TEXINPUTS texi2dvi +TEXI2DVI = texi2dvi +DVIPS = dvips RANLIB = ranlib # What version of the manual you want; "all" includes everything @@ -75,6 +76,7 @@ info: as.info gasp.info dvi: as.dvi gasp.dvi +ps: as.ps gasp.ps asconfig.texi: $(CONFIG).texi rm -f asconfig.texi @@ -109,18 +111,33 @@ done as.dvi: $(srcdir)/as.texinfo asconfig.texi + TEXINPUTS=$(srcdir):$(TEXIDIR):$$TEXINPUTS MAKEINFO='$(MAKEINFO) -I$(srcdir)' \ $(TEXI2DVI) $(srcdir)/as.texinfo +as.ps: as.dvi + $(DVIPS) -o $@ $? + gasp.dvi: $(srcdir)/gasp.texi + TEXINPUTS=$(srcdir):$(TEXIDIR):$$TEXINPUTS MAKEINFO='$(MAKEINFO) -I$(srcdir)' \ $(TEXI2DVI) $(srcdir)/gasp.texi +gasp.ps: gasp.dvi + $(DVIPS) -o $@ $? + # This one isn't ready for prime time yet. Not even a little bit. + +internals.info: $(srcdir)/internals.texi + $(MAKEINFO) -o $@ $? + internals.dvi: $(srcdir)/internals.texi + TEXINPUTS=$(srcdir):$(TEXIDIR):$$TEXINPUTS MAKEINFO='$(MAKEINFO) -I$(srcdir)' \ $(TEXI2DVI) $(srcdir)/internals.texi + internals.ps: internals.dvi - dvips internals.dvi -o internals.ps + $(DVIPS) -o $@ $? + internals.ps4: internals.ps - psnup -4 < internals.ps > internals.ps4 + psnup -4 <$? >$@ # ROFF doc targets as.ms, as.mm, as.me # (we don't use a variable because we don't trust all makes to handle @@ -154,15 +171,16 @@ texi2roff -me >as.me clean mostlyclean: clean-dvi clean-info - rm -f asconfig.texi + rm -f asconfig.texi core *~ distclean: rm -f Makefile config.status asconfig.texi \ as.?? as.??s as.aux as.log as.toc \ + internals.?? internals.??s internals.aux internals.log internals.toc \ gasp.?? gasp.??s gasp.aux gasp.log gasp.toc clean-dvi: - rm -f as.?? as.??? gasp.?? gasp.??? + rm -f as.?? as.??? gasp.?? gasp.??? internals.?? internals.??? clean-info: rm -f as.info* gasp.info* diff -urN binutils-2.7/gas/doc/all.texi binutils-2.8/gas/doc/all.texi --- binutils-2.7/gas/doc/all.texi Thu Jul 4 12:32:20 1996 +++ binutils-2.8/gas/doc/all.texi Wed Apr 30 12:53:26 1997 @@ -26,6 +26,7 @@ @c CPUs of interest @c ================ @set A29K +@set D10V @set H8/300 @set H8/500 @set SH diff -urN binutils-2.7/gas/doc/as.info binutils-2.8/gas/doc/as.info --- binutils-2.7/gas/doc/as.info Mon Jul 15 12:23:05 1996 +++ binutils-2.8/gas/doc/as.info Wed Apr 30 13:15:00 1997 @@ -1,4 +1,4 @@ -This is Info file as.info, produced by Makeinfo-1.55 from the input +This is Info file as.info, produced by Makeinfo-1.64 from the input file ./as.texinfo. START-INFO-DIR-ENTRY @@ -7,8 +7,8 @@ This file documents the GNU Assembler "as". - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, -Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -25,241 +25,262 @@  Indirect: -as.info-1: 870 -as.info-2: 49517 -as.info-3: 99291 -as.info-4: 148523 -as.info-5: 196041 -as.info-6: 231248 +as.info-1: 874 +as.info-2: 50097 +as.info-3: 99928 +as.info-4: 148596 +as.info-5: 196183 +as.info-6: 246121 +as.info-7: 258809  Tag Table: (Indirect) -Node: Top870 -Node: Overview1496 -Node: Manual9419 -Node: GNU Assembler10358 -Node: Object Formats11533 -Node: Command Line11980 -Node: Input Files13062 -Node: Object14966 -Node: Errors15913 -Node: Invoking17110 -Node: a18698 -Node: D19787 -Node: f20007 -Node: I20510 -Node: K21049 -Node: L21348 -Node: M22174 -Node: o26471 -Node: R26918 -Node: statistics27934 -Node: v28317 -Node: W28577 -Node: Z29159 -Node: Syntax29674 -Node: Preprocessing30264 -Node: Whitespace31824 -Node: Comments32214 -Node: Symbol Intro34031 -Node: Statements34714 -Node: Constants36960 -Node: Characters37586 -Node: Strings38079 -Node: Chars40232 -Node: Numbers40973 -Node: Integers41504 -Node: Bignums42147 -Node: Flonums42490 -Node: Sections44128 -Node: Secs Background44491 -Node: Ld Sections49517 -Node: As Sections51903 -Node: Sub-Sections52794 -Node: bss55792 -Node: Symbols56376 -Node: Labels57023 -Node: Setting Symbols57749 -Node: Symbol Names58115 -Node: Dot61071 -Node: Symbol Attributes61513 -Node: Symbol Value62245 -Node: Symbol Type63281 -Node: a.out Symbols63660 -Node: Symbol Desc63910 -Node: Symbol Other64192 -Node: COFF Symbols64348 -Node: SOM Symbols64977 -Node: Expressions65410 -Node: Empty Exprs66158 -Node: Integer Exprs66500 -Node: Arguments66890 -Node: Operators67987 -Node: Prefix Ops68313 -Node: Infix Ops68632 -Node: Pseudo Ops70124 -Node: Abort73806 -Node: ABORT74207 -Node: Align74469 -Node: App-File76077 -Node: Ascii76614 -Node: Asciz76919 -Node: Balign77159 -Node: Byte78326 -Node: Comm78559 -Node: Data79228 -Node: Def79538 -Node: Desc79906 -Node: Dim80400 -Node: Double80791 -Node: Eject81122 -Node: Else81290 -Node: Endef81579 -Node: Endif81901 -Node: Equ82152 -Node: Extern82456 -Node: File82708 -Node: Fill83359 -Node: Float84316 -Node: Global84652 -Node: hword85395 -Node: Ident85716 -Node: If86016 -Node: Include86872 -Node: Int87412 -Node: Irp87781 -Node: Irpc88575 -Node: Lcomm89394 -Node: Lflags89987 -Node: Line90174 -Node: Linkonce91197 -Node: Ln92417 -Node: MRI92565 -Node: List92892 -Node: Long93495 -Node: Macro93665 -Node: Nolist96049 -Node: Octa96465 -Node: Org96791 -Node: P2align98066 -Node: Psize99291 -Node: Quad99964 -Node: Rept100404 -Node: Sbttl100810 -Node: Scl101168 -Node: Section101664 -Node: Set102285 -Node: Short102838 -Node: Single103152 -Node: Size103489 -Node: Skip103884 -Node: Space104197 -Node: Stab105079 -Node: String107075 -Node: Tag107491 -Node: Text107999 -Node: Title108311 -Node: Type108683 -Node: Val109059 -Node: Word109414 -Node: Deprecated111247 -Node: Machine Dependencies111481 -Node: AMD29K-Dependent112953 -Node: AMD29K Options113337 -Node: AMD29K Syntax113511 -Node: AMD29K-Macros113775 -Node: AMD29K-Chars114026 -Node: AMD29K-Regs114289 -Node: AMD29K Floating Point115553 -Node: AMD29K Directives115759 -Node: AMD29K Opcodes117167 -Node: H8/300-Dependent117503 -Node: H8/300 Options117909 -Node: H8/300 Syntax118090 -Node: H8/300-Chars118377 -Node: H8/300-Regs118661 -Node: H8/300-Addressing119565 -Node: H8/300 Floating Point120591 -Node: H8/300 Directives120907 -Node: H8/300 Opcodes121427 -Node: H8/500-Dependent129780 -Node: H8/500 Options130184 -Node: H8/500 Syntax130365 -Node: H8/500-Chars130652 -Node: H8/500-Regs130943 -Node: H8/500-Addressing131699 -Node: H8/500 Floating Point132316 -Node: H8/500 Directives132632 -Node: H8/500 Opcodes132951 -Node: HPPA-Dependent138064 -Node: HPPA Notes138486 -Node: HPPA Options139233 -Node: HPPA Syntax139417 -Node: HPPA Floating Point140676 -Node: HPPA Directives140871 -Node: HPPA Opcodes147462 -Node: i386-Dependent147710 -Node: i386-Options148379 -Node: i386-Syntax148523 -Node: i386-Opcodes150473 -Node: i386-Regs152592 -Node: i386-prefixes153733 -Node: i386-Memory155402 -Node: i386-jumps157676 -Node: i386-Float158746 -Node: i386-16bit160736 -Node: i386-Notes163128 -Node: i960-Dependent163969 -Node: Options-i960164361 -Node: Floating Point-i960168242 -Node: Directives-i960168499 -Node: Opcodes for i960170519 -Node: callj-i960171125 -Node: Compare-and-branch-i960171600 -Node: M68K-Dependent173489 -Node: M68K-Opts173943 -Node: M68K-Syntax177614 -Node: M68K-Moto-Syntax179442 -Node: M68K-Float182020 -Node: M68K-Directives182529 -Node: M68K-opcodes183124 -Node: M68K-Branch183336 -Node: M68K-Chars186151 -Node: MIPS-Dependent186549 -Node: MIPS Opts187220 -Node: MIPS Object189801 -Node: MIPS Stabs191356 -Node: MIPS ISA192067 -Node: SH-Dependent192961 -Node: SH Options193344 -Node: SH Syntax193509 -Node: SH-Chars193768 -Node: SH-Regs194047 -Node: SH-Addressing194646 -Node: SH Floating Point195540 -Node: SH Directives195836 -Node: SH Opcodes196041 -Node: Sparc-Dependent200288 -Node: Sparc-Opts200606 -Node: Sparc-Float202276 -Node: Sparc-Directives202458 -Node: Z8000-Dependent203676 -Node: Z8000 Options204636 -Node: Z8000 Syntax204811 -Node: Z8000-Chars205087 -Node: Z8000-Regs205305 -Node: Z8000-Addressing206077 -Node: Z8000 Directives207020 -Node: Z8000 Opcodes208618 -Node: Vax-Dependent218554 -Node: VAX-Opts219061 -Node: VAX-float221351 -Node: VAX-directives221972 -Node: VAX-opcodes222821 -Node: VAX-branch223199 -Node: VAX-operands225694 -Node: VAX-no226446 -Node: Acknowledgements226672 -Node: Index231248 +Node: Top874 +Node: Overview1533 +Node: Manual9662 +Node: GNU Assembler10601 +Node: Object Formats11776 +Node: Command Line12223 +Node: Input Files13305 +Node: Object15209 +Node: Errors16156 +Node: Invoking17353 +Node: a18942 +Node: D20276 +Node: f20496 +Node: I20999 +Node: K21538 +Node: L21837 +Node: M22663 +Node: o27051 +Node: R27498 +Node: statistics28514 +Node: v28897 +Node: W29157 +Node: Z29739 +Node: Syntax30254 +Node: Preprocessing30844 +Node: Whitespace32404 +Node: Comments32794 +Node: Symbol Intro34611 +Node: Statements35294 +Node: Constants37540 +Node: Characters38166 +Node: Strings38659 +Node: Chars40812 +Node: Numbers41553 +Node: Integers42084 +Node: Bignums42727 +Node: Flonums43070 +Node: Sections44708 +Node: Secs Background45071 +Node: Ld Sections50097 +Node: As Sections52483 +Node: Sub-Sections53374 +Node: bss56372 +Node: Symbols57317 +Node: Labels57964 +Node: Setting Symbols58690 +Node: Symbol Names59056 +Node: Dot62024 +Node: Symbol Attributes62466 +Node: Symbol Value63198 +Node: Symbol Type64234 +Node: a.out Symbols64613 +Node: Symbol Desc64863 +Node: Symbol Other65145 +Node: COFF Symbols65301 +Node: SOM Symbols65930 +Node: Expressions66363 +Node: Empty Exprs67111 +Node: Integer Exprs67453 +Node: Arguments67843 +Node: Operators68940 +Node: Prefix Ops69266 +Node: Infix Ops69585 +Node: Pseudo Ops71077 +Node: Abort74900 +Node: ABORT75301 +Node: Align75563 +Node: App-File77728 +Node: Ascii78265 +Node: Asciz78570 +Node: Balign78810 +Node: Byte80668 +Node: Comm80901 +Node: Data82260 +Node: Def82570 +Node: Desc82938 +Node: Dim83432 +Node: Double83823 +Node: Eject84154 +Node: Else84322 +Node: Endef84611 +Node: Endif84933 +Node: Equ85184 +Node: Equiv85487 +Node: Err85883 +Node: Extern86187 +Node: File86439 +Node: Fill87090 +Node: Float88047 +Node: Global88383 +Node: hword89126 +Node: Ident89447 +Node: If89747 +Node: Include90603 +Node: Int91143 +Node: Irp91512 +Node: Irpc92306 +Node: Lcomm93125 +Node: Lflags93866 +Node: Line94053 +Node: Linkonce95076 +Node: Ln96296 +Node: MRI96444 +Node: List96771 +Node: Long97374 +Node: Macro97544 +Node: Nolist99928 +Node: Octa100344 +Node: Org100670 +Node: P2align101945 +Node: Psize103861 +Node: Quad104534 +Node: Rept104974 +Node: Sbttl105380 +Node: Scl105738 +Node: Section106234 +Node: Set108583 +Node: Short109136 +Node: Single109450 +Node: Size109787 +Node: Skip110182 +Node: Space110495 +Node: Stab111377 +Node: String113373 +Node: Symver113792 +Node: Tag115377 +Node: Text115885 +Node: Title116197 +Node: Type116569 +Node: Val116945 +Node: Word117300 +Node: Deprecated119133 +Node: Machine Dependencies119367 +Node: AMD29K-Dependent120894 +Node: AMD29K Options121276 +Node: AMD29K Syntax121450 +Node: AMD29K-Macros121714 +Node: AMD29K-Chars121965 +Node: AMD29K-Regs122228 +Node: AMD29K Floating Point123492 +Node: AMD29K Directives123698 +Node: AMD29K Opcodes125106 +Node: D10V-Dependent125442 +Node: D10V-Opts125789 +Node: D10V-Syntax126178 +Node: D10V-Size126698 +Node: D10V-Subs127658 +Node: D10V-Chars128680 +Node: D10V-Regs130266 +Node: D10V-Addressing131290 +Node: D10V-Word131963 +Node: D10V-Float132464 +Node: D10V-Opcodes132766 +Node: H8/300-Dependent133150 +Node: H8/300 Options133554 +Node: H8/300 Syntax133735 +Node: H8/300-Chars134022 +Node: H8/300-Regs134306 +Node: H8/300-Addressing135210 +Node: H8/300 Floating Point136236 +Node: H8/300 Directives136552 +Node: H8/300 Opcodes137072 +Node: H8/500-Dependent145425 +Node: H8/500 Options145829 +Node: H8/500 Syntax146010 +Node: H8/500-Chars146297 +Node: H8/500-Regs146588 +Node: H8/500-Addressing147344 +Node: H8/500 Floating Point147961 +Node: H8/500 Directives148277 +Node: H8/500 Opcodes148596 +Node: HPPA-Dependent153709 +Node: HPPA Notes154131 +Node: HPPA Options154878 +Node: HPPA Syntax155062 +Node: HPPA Floating Point156321 +Node: HPPA Directives156516 +Node: HPPA Opcodes163107 +Node: i386-Dependent163355 +Node: i386-Options164024 +Node: i386-Syntax164168 +Node: i386-Opcodes166118 +Node: i386-Regs168237 +Node: i386-prefixes169378 +Node: i386-Memory171047 +Node: i386-jumps173321 +Node: i386-Float174391 +Node: i386-16bit176381 +Node: i386-Notes178773 +Node: i960-Dependent179614 +Node: Options-i960180006 +Node: Floating Point-i960183887 +Node: Directives-i960184144 +Node: Opcodes for i960186164 +Node: callj-i960186770 +Node: Compare-and-branch-i960187245 +Node: M68K-Dependent189134 +Node: M68K-Opts189588 +Node: M68K-Syntax194355 +Node: M68K-Moto-Syntax196183 +Node: M68K-Float198761 +Node: M68K-Directives199270 +Node: M68K-opcodes199865 +Node: M68K-Branch200077 +Node: M68K-Chars202892 +Node: MIPS-Dependent203290 +Node: MIPS Opts204100 +Node: MIPS Object206936 +Node: MIPS Stabs208491 +Node: MIPS ISA209202 +Node: MIPS insn210304 +Node: MIPS option stack210783 +Node: SH-Dependent211496 +Node: SH Options211879 +Node: SH Syntax212044 +Node: SH-Chars212303 +Node: SH-Regs212582 +Node: SH-Addressing213181 +Node: SH Floating Point214075 +Node: SH Directives214371 +Node: SH Opcodes214576 +Node: Sparc-Dependent218823 +Node: Sparc-Opts219196 +Node: Sparc-Aligned-Data220873 +Node: Sparc-Float221717 +Node: Sparc-Directives221907 +Node: Z8000-Dependent223125 +Node: Z8000 Options224085 +Node: Z8000 Syntax224260 +Node: Z8000-Chars224536 +Node: Z8000-Regs224754 +Node: Z8000-Addressing225526 +Node: Z8000 Directives226469 +Node: Z8000 Opcodes228067 +Node: Vax-Dependent238003 +Node: VAX-Opts238510 +Node: VAX-float240800 +Node: VAX-directives241421 +Node: VAX-opcodes242270 +Node: VAX-branch242648 +Node: VAX-operands245143 +Node: VAX-no245895 +Node: Reporting Bugs246121 +Node: Bug Criteria246844 +Node: Bug Reporting247604 +Node: Acknowledgements254181 +Node: Index258809  End Tag Table diff -urN binutils-2.7/gas/doc/as.info-1 binutils-2.8/gas/doc/as.info-1 --- binutils-2.7/gas/doc/as.info-1 Mon Jul 15 12:23:05 1996 +++ binutils-2.8/gas/doc/as.info-1 Wed Apr 30 13:14:59 1997 @@ -1,4 +1,4 @@ -This is Info file as.info, produced by Makeinfo-1.55 from the input +This is Info file as.info, produced by Makeinfo-1.64 from the input file ./as.texinfo. START-INFO-DIR-ENTRY @@ -7,8 +7,8 @@ This file documents the GNU Assembler "as". - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, -Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -24,7 +24,7 @@ versions.  -File: as.info, Node: Top, Next: Overview, Prev: (DIR), Up: (DIR) +File: as.info, Node: Top, Next: Overview, Up: (dir) Using as ******** @@ -41,6 +41,7 @@ * Expressions:: Expressions * Pseudo Ops:: Assembler Directives * Machine Dependencies:: Machine Dependent Features +* Reporting Bugs:: Reporting Bugs * Acknowledgements:: Who Did What * Index:: Index @@ -53,11 +54,13 @@ Here is a brief summary of how to invoke `as'. For details, *note Comand-Line Options: Invoking.. - as [ -a[dhlns][=file] ] [ -D ] [ --defsym SYM=VAL ] + as [ -a[cdhlns][=file] ] [ -D ] [ --defsym SYM=VAL ] [ -f ] [ --help ] [ -I DIR ] [ -J ] [ -K ] [ -L ] [ -o OBJFILE ] [ -R ] [ --statistics ] [ -v ] [ -version ] [ --version ] [ -W ] [ -w ] [ -x ] [ -Z ] - [ -Av6 | -Av7 | -Av8 | -Asparclite | -Av9 | -Av9a ] + [ -O ] + + [ -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite | -Av9 | -Av9a ] [ -xarch=v8plus | -xarch=v8plusa ] [ -bump ] [ -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC ] [ -b ] [ -no-relax ] @@ -100,7 +103,7 @@ `--defsym SYM=VALUE' Define the symbol SYM to be VALUE before assembling the input file. - vALUE must be an integer constant. As in C, a leading `0x' + VALUE must be an integer constant. As in C, a leading `0x' indicates a hexadecimal value, and a leading `0' indicates an octal value. @@ -156,6 +159,11 @@ `-- | FILES ...' Standard input, or source files to assemble. + The following options are available when as is configured for a D10V +processor. +`-O' + Optimize output by parallelizing instructions. + The following options are available when as is configured for the Intel 80960 processor. @@ -176,8 +184,8 @@ Shorten references to undefined symbols, to one word instead of two. -`-m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040' -`| -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -mcpu32' +`-m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060' +`| -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -mcpu32 | -m5200' Specify what processor in the 68000 family is the target. The default is normally the 68020, but this can be changed at configuration time. @@ -198,7 +206,7 @@ The following options are available when `as' is configured for the SPARC architecture: -`-Av6 | -Av7 | -Av8 | -Asparclite | -Av9 | -Av9a' +`-Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite | -Av9 | -Av9a' Explicitly select a variant of the SPARC architecture. `-xarch=v8plus | -xarch=v8plusa' @@ -503,7 +511,7 @@ * Menu: -* a:: -a[dhlns] enable listings +* a:: -a[cdhlns] enable listings * D:: -D for compatibility * f:: -f to work faster * I:: -I for .include search path @@ -522,8 +530,8 @@  File: as.info, Node: a, Next: D, Up: Invoking -Enable Listings: `-a[dhlns]' -============================ +Enable Listings: `-a[cdhlns]' +============================= These options enable listing output from the assembler. By itself, `-a' requests high-level, assembly, and symbols listing. You can use @@ -533,6 +541,11 @@ listings require that a compiler debugging option like `-g' be used, and that assembly listings (`-al') be requested also. + Use the `-ac' option to omit false conditionals from a listing. Any +lines which are not assembled because of a false `.if' (or `.ifdef', or +any other conditional), or a true `.if' followed by an `.else', will be +omitted from the listing. + Use the `-ad' option to omit debugging directives from the listing. Once you have specified one of these options, you can further control @@ -625,8 +638,9 @@ with the `ASM68K' or the `ASM960' (depending upon the configured target) assembler from Microtec Research. The exact nature of the MRI syntax will not be documented here; see the MRI manuals for more -information. The purpose of this option is to permit assembling -existing MRI assembler code using `as'. +information. Note in particular that the handling of macros and macro +arguments is somewhat different. The purpose of this option is to +permit assembling existing MRI assembler code using `as'. The MRI compatibility is not complete. Certain operations of the MRI assembler depend upon its object file format, and can not be diff -urN binutils-2.7/gas/doc/as.info-2 binutils-2.8/gas/doc/as.info-2 --- binutils-2.7/gas/doc/as.info-2 Mon Jul 15 12:23:05 1996 +++ binutils-2.8/gas/doc/as.info-2 Wed Apr 30 13:14:59 1997 @@ -1,4 +1,4 @@ -This is Info file as.info, produced by Makeinfo-1.55 from the input +This is Info file as.info, produced by Makeinfo-1.64 from the input file ./as.texinfo. START-INFO-DIR-ENTRY @@ -7,8 +7,8 @@ This file documents the GNU Assembler "as". - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, -Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -178,10 +178,17 @@ to load into it before your program executes. When your program starts running, all the contents of the bss section are zeroed bytes. - Addresses in the bss section are allocated with special directives; -you may not assemble anything directly into the bss section. Hence -there are no bss subsections. *Note `.comm': Comm, *note `.lcomm': -Lcomm.. + The `.lcomm' pseudo-op defines a symbol in the bss section; see +*Note `.lcomm': Lcomm. + + The `.comm' pseudo-op may be used to declare a common symbol, which +is another form of uninitialized symbol; see *Note `.comm': Comm. + + When assembling for a target which supports multiple sections, such +as ELF or COFF, you may switch into the `.bss' section and define +symbols as usual; see *Note `.section': Section. You may only assemble +zero values into the section. Typically the section will only contain +symbol definitions and `.skip' directives (*note `.skip': Skip.).  File: as.info, Node: Symbols, Next: Expressions, Prev: Sections, Up: Top @@ -291,7 +298,7 @@ If the label is written `0:' then the digit is `0'. If the label is written `1:' then the digit is `1'. And so on up through `9:'. -A' +``C-A'' This unusual character is included so you do not accidentally invent a symbol of the same name. The character has ASCII value `\001'. @@ -301,8 +308,8 @@ `0:' gets the number `1'; The 15th `0:' gets the number `15'; *etc.*. Likewise for the other labels `1:' through `9:'. - For instance, the first `1:' is named `LA1', the 44th `3:' is named -`LA44'. + For instance, the first `1:' is named `L1`C-A'1', the 44th `3:' is +named `L3`C-A'44'.  File: as.info, Node: Dot, Next: Symbol Attributes, Prev: Symbol Names, Up: Symbols @@ -646,6 +653,8 @@ * Endif:: `.endif' * Equ:: `.equ SYMBOL, EXPRESSION' +* Equiv:: `.equiv SYMBOL, EXPRESSION' +* Err:: `.err' * Extern:: `.extern' * File:: `.file STRING' @@ -699,6 +708,8 @@ * String:: `.string "STR"' +* Symver:: `.symver NAME,NAME2@NODENAME' + * Tag:: `.tag STRUCTNAME' * Text:: `.text SUBSECTION' @@ -737,16 +748,27 @@  File: as.info, Node: Align, Next: App-File, Prev: ABORT, Up: Pseudo Ops -`.align ABS-EXPR , ABS-EXPR' -============================ +`.align ABS-EXPR, ABS-EXPR, ABS-EXPR' +===================================== Pad the location counter (in the current subsection) to a particular storage boundary. The first expression (which must be absolute) is the -alignment required, as described below. The second expression (also -absolute) gives the value to be stored in the padding bytes. It (and -the comma) may be omitted. If it is omitted, the padding bytes are -zero. For the alpha, if the section is marked as containing code and -the padding expression is omitted, then the space is filled with no-ops. +alignment required, as described below. + + The second expression (also absolute) gives the fill value to be +stored in the padding bytes. It (and the comma) may be omitted. If it +is omitted, the padding bytes are normally zero. However, on some +systems, if the section is marked as containing code and the fill value +is omitted, the space is filled with no-op instructions. + + The third expression is also absolute, and is also optional. If it +is present, it is the maximum number of bytes that should be skipped by +this alignment directive. If doing the alignment would require +skipping more bytes than the specified maximum, then the alignment is +not done at all. You can omit the fill value (the second argument) +entirely by simply using two commas after the required alignment; this +can be useful if you want the alignment to be filled with no-op +instructions when appropriate. The way the required alignment is specified varies from system to system. For the a29k, hppa, m68k, m88k, w65, sparc, and Hitachi SH, @@ -802,8 +824,8 @@  File: as.info, Node: Balign, Next: Byte, Prev: Asciz, Up: Pseudo Ops -`.balign[wl] ABS-EXPR , ABS-EXPR' -================================= +`.balign[wl] ABS-EXPR, ABS-EXPR, ABS-EXPR' +========================================== Pad the location counter (in the current subsection) to a particular storage boundary. The first expression (which must be absolute) is the @@ -811,9 +833,20 @@ location counter until it is a multiple of 8. If the location counter is already a multiple of 8, no change is needed. - The second expression (also absolute) gives the value to be stored in -the padding bytes. It (and the comma) may be omitted. If it is -omitted, the padding bytes are zero. + The second expression (also absolute) gives the fill value to be +stored in the padding bytes. It (and the comma) may be omitted. If it +is omitted, the padding bytes are normally zero. However, on some +systems, if the section is marked as containing code and the fill value +is omitted, the space is filled with no-op instructions. + + The third expression is also absolute, and is also optional. If it +is present, it is the maximum number of bytes that should be skipped by +this alignment directive. If doing the alignment would require +skipping more bytes than the specified maximum, then the alignment is +not done at all. You can omit the fill value (the second argument) +entirely by simply using two commas after the required alignment; this +can be useful if you want the alignment to be filled with no-op +instructions when appropriate. The `.balignw' and `.balignl' directives are variants of the `.balign' directive. The `.balignw' directive treats the fill pattern @@ -839,13 +872,24 @@ `.comm SYMBOL , LENGTH ' ======================== - `.comm' declares a named common area in the bss section. Normally -`ld' reserves memory addresses for it during linking, so no partial -program defines the location of the symbol. Use `.comm' to tell `ld' -that it must be at least LENGTH bytes long. `ld' allocates space for -each `.comm' symbol that is at least as long as the longest `.comm' -request in any of the partial programs linked. LENGTH is an absolute -expression. + `.comm' declares a common symbol named SYMBOL. When linking, a +common symbol in one object file may be merged with a defined or common +symbol of the same name in another object file. If `ld' does not see a +definition for the symbol-just one or more common symbols-then it will +allocate LENGTH bytes of uninitialized memory. LENGTH must be an +absolute expression. If `ld' sees multiple common symbols with the +same name, and they do not all have the same size, it will allocate +space using the largest size. + + When using ELF, the `.comm' directive takes an optional third +argument. This is the desired alignment of the symbol, specified as a +byte boundary (for example, an alignment of 16 means that the least +significant 4 bits of the address should be zero). The alignment must +be an absolute expression, and it must be a power of two. If `ld' +allocates uninitialized memory for the common symbol, it will use the +alignment when placing the symbol. If no alignment is specified, `as' +will set the alignment to the largest power of two less than or equal +to the size of the symbol, up to a maximum of 16. The syntax for `.comm' differs slightly on the HPPA. The syntax is `SYMBOL .comm, LENGTH'; SYMBOL is optional. @@ -953,7 +997,7 @@ *Note `.if': If.  -File: as.info, Node: Equ, Next: Extern, Prev: Endif, Up: Pseudo Ops +File: as.info, Node: Equ, Next: Equiv, Prev: Endif, Up: Pseudo Ops `.equ SYMBOL, EXPRESSION' ========================= @@ -964,7 +1008,33 @@ The syntax for `equ' on the HPPA is `SYMBOL .equ EXPRESSION'.  -File: as.info, Node: Extern, Next: File, Prev: Equ, Up: Pseudo Ops +File: as.info, Node: Equiv, Next: Err, Prev: Equ, Up: Pseudo Ops + +`.equiv SYMBOL, EXPRESSION' +=========================== + + The `.equiv' directive is like `.equ' and `.set', except that the +assembler will signal an error if SYMBOL is already defined. + + Except for the contents of the error message, this is roughly +equivalent to + .ifdef SYM + .err + .endif + .equ SYM,VAL + + +File: as.info, Node: Err, Next: Extern, Prev: Equiv, Up: Pseudo Ops + +`.err' +====== + + If `as' assembles a `.err' directive, it will print an error message +and, unless the `-Z' option was used, it will not generate an object +file. This can be used to signal error an conditionally compiled code. + + +File: as.info, Node: Extern, Next: File, Prev: Err, Up: Pseudo Ops `.extern' ========= @@ -1173,6 +1243,10 @@ that at run-time the bytes start off zeroed. SYMBOL is not declared global (*note `.global': Global.), so is normally not visible to `ld'. + Some targets permit a third argument to be used with `.lcomm'. This +argument specifies the desired alignment of the symbol in the bss +section. + The syntax for `.lcomm' differs slightly on the HPPA. The syntax is `SYMBOL .lcomm, LENGTH'; SYMBOL is optional. @@ -1354,83 +1428,4 @@ `as' maintains a counter of how many macros it has executed in this pseudo-variable; you can copy that number to your output with `\@', but *only within a macro definition*. - - -File: as.info, Node: Nolist, Next: Octa, Prev: MRI, Up: Pseudo Ops - -`.nolist' -========= - - Control (in conjunction with the `.list' directive) whether or not -assembly listings are generated. These two directives maintain an -internal counter (which is zero initially). `.list' increments the -counter, and `.nolist' decrements it. Assembly listings are generated -whenever the counter is greater than zero. - - -File: as.info, Node: Octa, Next: Org, Prev: Nolist, Up: Pseudo Ops - -`.octa BIGNUMS' -=============== - - This directive expects zero or more bignums, separated by commas. -For each bignum, it emits a 16-byte integer. - - The term "octa" comes from contexts in which a "word" is two bytes; -hence *octa*-word for 16 bytes. - - -File: as.info, Node: Org, Next: P2align, Prev: Octa, Up: Pseudo Ops - -`.org NEW-LC , FILL' -==================== - - Advance the location counter of the current section to NEW-LC. -nEW-LC is either an absolute expression or an expression with the same -section as the current subsection. That is, you can't use `.org' to -cross sections: if NEW-LC has the wrong section, the `.org' directive -is ignored. To be compatible with former assemblers, if the section of -NEW-LC is absolute, `as' issues a warning, then pretends the section of -NEW-LC is the same as the current subsection. - - `.org' may only increase the location counter, or leave it -unchanged; you cannot use `.org' to move the location counter backwards. - - Because `as' tries to assemble programs in one pass, NEW-LC may not -be undefined. If you really detest this restriction we eagerly await a -chance to share your improved assembler. - - Beware that the origin is relative to the start of the section, not -to the start of the subsection. This is compatible with other people's -assemblers. - - When the location counter (of the current subsection) is advanced, -the intervening bytes are filled with FILL which should be an absolute -expression. If the comma and FILL are omitted, FILL defaults to zero. - - -File: as.info, Node: P2align, Next: Psize, Prev: Org, Up: Pseudo Ops - -`.p2align[wl] ABS-EXPR , ABS-EXPR' -================================== - - Pad the location counter (in the current subsection) to a particular -storage boundary. The first expression (which must be absolute) is the -number of low-order zero bits the location counter must have after -advancement. For example `.p2align 3' advances the location counter -until it a multiple of 8. If the location counter is already a -multiple of 8, no change is needed. - - The second expression (also absolute) gives the value to be stored in -the padding bytes. It (and the comma) may be omitted. If it is -omitted, the padding bytes are zero. - - The `.p2alignw' and `.p2alignl' directives are variants of the -`.p2align' directive. The `.p2alignw' directive treats the fill -pattern as a two byte word value. The `.p2alignl' directives treats the -fill pattern as a four byte longword value. For example, `.p2alignw -2,0x368d' will align to a multiple of 4. If it skips two bytes, they -will be filled in with the value 0x368d (the exact placement of the -bytes depends upon the endianness of the processor). If it skips 1 or -3 bytes, the fill value is undefined. diff -urN binutils-2.7/gas/doc/as.info-3 binutils-2.8/gas/doc/as.info-3 --- binutils-2.7/gas/doc/as.info-3 Mon Jul 15 12:23:05 1996 +++ binutils-2.8/gas/doc/as.info-3 Wed Apr 30 13:14:59 1997 @@ -1,4 +1,4 @@ -This is Info file as.info, produced by Makeinfo-1.55 from the input +This is Info file as.info, produced by Makeinfo-1.64 from the input file ./as.texinfo. START-INFO-DIR-ENTRY @@ -7,8 +7,8 @@ This file documents the GNU Assembler "as". - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, -Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -24,6 +24,96 @@ versions.  +File: as.info, Node: Nolist, Next: Octa, Prev: MRI, Up: Pseudo Ops + +`.nolist' +========= + + Control (in conjunction with the `.list' directive) whether or not +assembly listings are generated. These two directives maintain an +internal counter (which is zero initially). `.list' increments the +counter, and `.nolist' decrements it. Assembly listings are generated +whenever the counter is greater than zero. + + +File: as.info, Node: Octa, Next: Org, Prev: Nolist, Up: Pseudo Ops + +`.octa BIGNUMS' +=============== + + This directive expects zero or more bignums, separated by commas. +For each bignum, it emits a 16-byte integer. + + The term "octa" comes from contexts in which a "word" is two bytes; +hence *octa*-word for 16 bytes. + + +File: as.info, Node: Org, Next: P2align, Prev: Octa, Up: Pseudo Ops + +`.org NEW-LC , FILL' +==================== + + Advance the location counter of the current section to NEW-LC. +NEW-LC is either an absolute expression or an expression with the same +section as the current subsection. That is, you can't use `.org' to +cross sections: if NEW-LC has the wrong section, the `.org' directive +is ignored. To be compatible with former assemblers, if the section of +NEW-LC is absolute, `as' issues a warning, then pretends the section of +NEW-LC is the same as the current subsection. + + `.org' may only increase the location counter, or leave it +unchanged; you cannot use `.org' to move the location counter backwards. + + Because `as' tries to assemble programs in one pass, NEW-LC may not +be undefined. If you really detest this restriction we eagerly await a +chance to share your improved assembler. + + Beware that the origin is relative to the start of the section, not +to the start of the subsection. This is compatible with other people's +assemblers. + + When the location counter (of the current subsection) is advanced, +the intervening bytes are filled with FILL which should be an absolute +expression. If the comma and FILL are omitted, FILL defaults to zero. + + +File: as.info, Node: P2align, Next: Psize, Prev: Org, Up: Pseudo Ops + +`.p2align[wl] ABS-EXPR, ABS-EXPR, ABS-EXPR' +=========================================== + + Pad the location counter (in the current subsection) to a particular +storage boundary. The first expression (which must be absolute) is the +number of low-order zero bits the location counter must have after +advancement. For example `.p2align 3' advances the location counter +until it a multiple of 8. If the location counter is already a +multiple of 8, no change is needed. + + The second expression (also absolute) gives the fill value to be +stored in the padding bytes. It (and the comma) may be omitted. If it +is omitted, the padding bytes are normally zero. However, on some +systems, if the section is marked as containing code and the fill value +is omitted, the space is filled with no-op instructions. + + The third expression is also absolute, and is also optional. If it +is present, it is the maximum number of bytes that should be skipped by +this alignment directive. If doing the alignment would require +skipping more bytes than the specified maximum, then the alignment is +not done at all. You can omit the fill value (the second argument) +entirely by simply using two commas after the required alignment; this +can be useful if you want the alignment to be filled with no-op +instructions when appropriate. + + The `.p2alignw' and `.p2alignl' directives are variants of the +`.p2align' directive. The `.p2alignw' directive treats the fill +pattern as a two byte word value. The `.p2alignl' directives treats the +fill pattern as a four byte longword value. For example, `.p2alignw +2,0x368d' will align to a multiple of 4. If it skips two bytes, they +will be filled in with the value 0x368d (the exact placement of the +bytes depends upon the endianness of the processor). If it skips 1 or +3 bytes, the fill value is undefined. + + File: as.info, Node: Psize, Next: Quad, Prev: P2align, Up: Pseudo Ops `.psize LINES , COLUMNS' @@ -107,17 +197,88 @@  File: as.info, Node: Section, Next: Set, Prev: Scl, Up: Pseudo Ops -`.section NAME, SUBSECTION' -=========================== +`.section NAME' +=============== + + Use the `.section' directive to assemble the following code into a +section named NAME. + + This directive is only supported for targets that actually support +arbitrarily named sections; on `a.out' targets, for example, it is not +accepted, even with a standard `a.out' section name. + + For COFF targets, the `.section' directive is used in one of the +following ways: + .section NAME[, "FLAGS"] + .section NAME[, SUBSEGMENT] + + If the optional argument is quoted, it is taken as flags to use for +the section. Each flag is a single character. The following flags are +recognized: +`b' + bss section (uninitialized data) + +`n' + section is not loaded + +`w' + writable section + +`d' + data section + +`r' + read-only section + +`x' + executable section + + If no flags are specified, the default flags depend upon the section +name. If the section name is not recognized, the default will be for +the section to be loaded and writable. + + If the optional argument to the `.section' directive is not quoted, +it is taken as a subsegment number (*note Sub-Sections::.). + + For ELF targets, the `.section' directive is used like this: + .section NAME[, "FLAGS"[, @TYPE]] + The optional FLAGS argument is a quoted string which may contain any +combintion of the following characters: +`a' + section is allocatable + +`w' + section is writable + +`x' + section is executable + + The optional TYPE argument may contain one of the following +constants: +`@progbits' + section contains data + +`@nobits' + section does not contain data (i.e., section only occupies space) + + If no flags are specified, the default flags depend upon the section +name. If the section name is not recognized, the default will be for +the section to have none of the above flags: it will not be allocated +in memory, nor writable, nor executable. The section will contain data. + + For ELF targets, the assembler supports another type of `.section' +directive for compatibility with the Solaris assembler: + .section "NAME"[, FLAGS...] + Note that the section name is quoted. There may be a sequence of +comma separated flags: +`#alloc' + section is allocatable - Assemble the following code into end of subsection numbered -SUBSECTION in the COFF named section NAME. If you omit SUBSECTION, -`as' uses subsection number zero. `.section .text' is equivalent to -the `.text' directive; `.section .data' is equivalent to the `.data' -directive. This directive is only supported for targets that actually -support arbitrarily named sections; on `a.out' targets, for example, it -is not accepted, even with a standard `a.out' section name as its -parameter. +`#write' + section is writable + +`#execinstr' + section is executable  File: as.info, Node: Set, Next: Short, Prev: Section, Up: Pseudo Ops @@ -127,7 +288,7 @@ Set the value of SYMBOL to EXPRESSION. This changes SYMBOL's value and type to conform to EXPRESSION. If SYMBOL was flagged as external, -it remains flagged. (*Note Symbol Attributes::.) +it remains flagged (*note Symbol Attributes::.). You may `.set' a symbol many times in the same assembly. @@ -258,7 +419,7 @@ All five fields are specified.  -File: as.info, Node: String, Next: Tag, Prev: Stab, Up: Pseudo Ops +File: as.info, Node: String, Next: Symver, Prev: Stab, Up: Pseudo Ops `.string' "STR" =============== @@ -270,7 +431,38 @@ described in *Note Strings: Strings.  -File: as.info, Node: Tag, Next: Text, Prev: String, Up: Pseudo Ops +File: as.info, Node: Symver, Next: Tag, Prev: String, Up: Pseudo Ops + +`.symver' +========= + + Use the `.symver' directive to bind symbols to specific version nodes +within a source file. This is only supported on ELF platforms, and is +typically used when assembling files to be linked into a shared library. +There are cases where it may make sense to use this in objects to be +bound into an application itself so as to override a versioned symbol +from a shared library. + + For ELF targets, the `.symver' directive is used like this: + .symver NAME, NAME2@NODENAME + In this case, the symbol NAME must exist and be defined within the +file being assembled. The `.versym' directive effectively creates a +symbol alias with the name NAME2@NODENAME, and in fact the main reason +that we just don't try and create a regular alias is that the @ +character isn't permitted in symbol names. The NAME2 part of the name +is the actual name of the symbol by which it will be externally +referenced. The name NAME itself is merely a name of convenience that +is used so that it is possible to have definitions for multiple +versions of a function within a single source file, and so that the +compiler can unambiguously know which version of a function is being +mentioned. The NODENAME portion of the alias should be the name of a +node specified in the version script supplied to the linker when +building a shared library. If you are attempting to override a +versioned symbol from a shared library, then NODENAME should correspond +to the nodename of the symbol you are trying to override. + + +File: as.info, Node: Tag, Next: Text, Prev: Symver, Up: Pseudo Ops `.tag STRUCTNAME' ================= @@ -381,7 +573,7 @@ .app-file .line  -File: as.info, Node: Machine Dependencies, Next: Acknowledgements, Prev: Pseudo Ops, Up: Top +File: as.info, Node: Machine Dependencies, Next: Reporting Bugs, Prev: Pseudo Ops, Up: Top Machine Dependent Features ************************** @@ -402,6 +594,8 @@ * AMD29K-Dependent:: AMD 29K Dependent Features +* D10V-Dependent:: D10V Dependent Features + * H8/300-Dependent:: Hitachi H8/300 Dependent Features * H8/500-Dependent:: Hitachi H8/500 Dependent Features @@ -425,7 +619,7 @@ * Vax-Dependent:: VAX Dependent Features  -File: as.info, Node: AMD29K-Dependent, Next: H8/300-Dependent, Up: Machine Dependencies +File: as.info, Node: AMD29K-Dependent, Next: D10V-Dependent, Up: Machine Dependencies AMD 29K Dependent Features ========================== @@ -578,7 +772,272 @@ User's Manual', Advanced Micro Devices, Inc.  -File: as.info, Node: H8/300-Dependent, Next: H8/500-Dependent, Prev: AMD29K-Dependent, Up: Machine Dependencies +File: as.info, Node: D10V-Dependent, Next: H8/300-Dependent, Prev: AMD29K-Dependent, Up: Machine Dependencies + +D10V Dependent Features +======================= + +* Menu: + +* D10V-Opts:: D10V Options +* D10V-Syntax:: Syntax +* D10V-Float:: Floating Point +* D10V-Opcodes:: Opcodes + + +File: as.info, Node: D10V-Opts, Next: D10V-Syntax, Up: D10V-Dependent + +D10V Options +------------ + + The Mitsubishi D10V version of `as' has a few machine dependent +options. + +`-O' + The D10V can often execute two sub-instructions in parallel. When + this option is used, `as' will attempt to optimize its output by + detecting when instructions can be executed in parallel. + + +File: as.info, Node: D10V-Syntax, Next: D10V-Float, Prev: D10V-Opts, Up: D10V-Dependent + +Syntax +------ + + The D10V syntax is based on the syntax in Mitsubishi's D10V +architecture manual. The differences are detailed below. + +* Menu: + +* D10V-Size:: Size Modifiers +* D10V-Subs:: Sub-Instructions +* D10V-Chars:: Special Characters +* D10V-Regs:: Register Names +* D10V-Addressing:: Addressing Modes +* D10V-Word:: @WORD Modifier + + +File: as.info, Node: D10V-Size, Next: D10V-Subs, Up: D10V-Syntax + +Size Modifiers +.............. + + The D10V version of `as' uses the instruction names in the D10V +Architecture Manual. However, the names in the manual are sometimes +ambiguous. There are instruction names that can assemble to a short or +long form opcode. How does the assembler pick the correct form? `as' +will always pick the smallest form if it can. When dealing with a +symbol that is not defined yet when a line is being assembled, it will +always use the long form. If you need to force the assembler to use +either the short or long form of the instruction, you can append either +`.s' (short) or `.l' (long) to it. For example, if you are writing an +assembly program and you want to do a branch to a symbol that is +defined later in your program, you can write `bra.s foo'. Objdump +and GDB will always append `.s' or `.l' to instructions which have both +short and long forms. + + +File: as.info, Node: D10V-Subs, Next: D10V-Chars, Prev: D10V-Size, Up: D10V-Syntax + +Sub-Instructions +................ + + The D10V assembler takes as input a series of instructions, either +one-per-line, or in the special two-per-line format described in the +next section. Some of these instructions will be short-form or +sub-instructions. These sub-instructions can be packed into a single +instruction. The assembler will do this automatically. It will also +detect when it should not pack instructions. For example, when a label +is defined, the next instruction will never be packaged with the +previous one. Whenever a branch and link instruction is called, it +will not be packaged with the next instruction so the return address +will be valid. Nops are automatically inserted when necessary. + + If you do not want the assembler automatically making these +decisions, you can control the packaging and execution type (parallel +or sequential) with the special execution symbols described in the next +section. + + +File: as.info, Node: D10V-Chars, Next: D10V-Regs, Prev: D10V-Subs, Up: D10V-Syntax + +Special Characters +.................. + + `;' and `#' are the line comment characters. Sub-instructions may +be executed in order, in reverse-order, or in parallel. Instructions +listed in the standard one-per-line format will be executed +sequentially. To specify the executing order, use the following +symbols: +`->' + Sequential with instruction on the left first. + +`<-' + Sequential with instruction on the right first. + +`||' + Parallel The D10V syntax allows either one instruction per line, +one instruction per line with the execution symbol, or two instructions +per line. For example +`abs a1 -> abs r0' + Execute these sequentially. The instruction on the right is in + the right container and is executed second. + +`abs r0 <- abs a1' + Execute these reverse-sequentially. The instruction on the right + is in the right container, and is executed first. + +`ld2w r2,@r8+ || mac a0,r0,r7' + Execute these in parallel. + +`ld2w r2,@r8+ ||' +`mac a0,r0,r7' + Two-line format. Execute these in parallel. + +`ld2w r2,@r8+' +`mac a0,r0,r7' + Two-line format. Execute these sequentially. Assembler will put + them in the proper containers. + +`ld2w r2,@r8+ ->' +`mac a0,r0,r7' + Two-line format. Execute these sequentially. Same as above but + second instruction will always go into right container. Since `$' +has no special meaning, you may use it in symbol names. + + +File: as.info, Node: D10V-Regs, Next: D10V-Addressing, Prev: D10V-Chars, Up: D10V-Syntax + +Register Names +.............. + + You can use the predefined symbols `r0' through `r15' to refer to +the D10V registers. You can also use `sp' as an alias for `r15'. The +accumulators are `a0' and `a1'. There are special register-pair names +that may optionally be used in opcodes that require even-numbered +registers. Register names are not case sensitive. + + Register Pairs +`r0-r1' +`r2-r3' +`r4-r5' +`r6-r7' +`r8-r9' +`r10-r11' +`r12-r13' +`r14-r15' + The D10V also has predefined symbols for these control registers and +status bits: +`psw' + Processor Status Word + +`bpsw' + Backup Processor Status Word + +`pc' + Program Counter + +`bpc' + Backup Program Counter + +`rpt_c' + Repeat Count + +`rpt_s' + Repeat Start address + +`rpt_e' + Repeat End address + +`mod_s' + Modulo Start address + +`mod_e' + Modulo End address + +`iba' + Instruction Break Address + +`f0' + Flag 0 + +`f1' + Flag 1 + +`c' + Carry flag + + +File: as.info, Node: D10V-Addressing, Next: D10V-Word, Prev: D10V-Regs, Up: D10V-Syntax + +Addressing Modes +................ + + `as' understands the following addressing modes for the D10V. `RN' +in the following refers to any of the numbered registers, but *not* the +control registers. +`RN' + Register direct + +`@RN' + Register indirect + +`@RN+' + Register indirect with post-increment + +`@RN-' + Register indirect with post-decrement + +`@-SP' + Register indirect with pre-decrement + +`@(DISP, RN)' + Register indirect with displacement + +`ADDR' + PC relative address (for branch or rep). + +`#IMM' + Immediate data (the `#' is optional and ignored) + + +File: as.info, Node: D10V-Word, Prev: D10V-Addressing, Up: D10V-Syntax + +@WORD Modifier +.............. + + Any symbol followed by `@word' will be replaced by the symbol's value +shifted right by 2. This is used in situations such as loading a +register with the address of a function (or any other code fragment). +For example, if you want to load a register with the location of the +function `main' then jump to that function, you could do it as follws: + ldi r2, main@word + jmp r2 + + +File: as.info, Node: D10V-Float, Next: D10V-Opcodes, Prev: D10V-Syntax, Up: D10V-Dependent + +Floating Point +-------------- + + The D10V has no hardware floating point, but the `.float' and +`.double' directives generates IEEE floating-point numbers for +compatibility with other development tools. + + +File: as.info, Node: D10V-Opcodes, Prev: D10V-Float, Up: D10V-Dependent + +Opcodes +------- + + For detailed information on the D10V machine instruction set, see +`D10V Architecture: A VLIW Microprocessor for Multimedia Applications' +(Mitsubishi Electric Corp.). `as' implements all the standard D10V +opcodes. The only changes are those described in the section on size +modifiers + + +File: as.info, Node: H8/300-Dependent, Next: H8/500-Dependent, Prev: D10V-Dependent, Up: Machine Dependencies H8/300 Dependent Features ========================= @@ -1035,416 +1494,4 @@ `as' has no machine-dependent directives for the H8/500. However, on this platform the `.int' and `.word' directives generate 16-bit numbers. - - -File: as.info, Node: H8/500 Opcodes, Prev: H8/500 Directives, Up: H8/500-Dependent - -Opcodes -------- - - For detailed information on the H8/500 machine instruction set, see -`H8/500 Series Programming Manual' (Hitachi M21T001). - - `as' implements all the standard H8/500 opcodes. No additional -pseudo-instructions are needed on this family. - - The following table summarizes H8/500 opcodes and their operands: - - Legend: - abs8 8-bit absolute address - abs16 16-bit absolute address - abs24 24-bit absolute address - crb `ccr', `br', `ep', `dp', `tp', `dp' - disp8 8-bit displacement - ea `rn', `@rn', `@(d:8, rn)', `@(d:16, rn)', - `@-rn', `@rn+', `@aa:8', `@aa:16', - `#xx:8', `#xx:16' - ea_mem `@rn', `@(d:8, rn)', `@(d:16, rn)', - `@-rn', `@rn+', `@aa:8', `@aa:16' - ea_noimm `rn', `@rn', `@(d:8, rn)', `@(d:16, rn)', - `@-rn', `@rn+', `@aa:8', `@aa:16' - fp r6 - imm4 4-bit immediate data - imm8 8-bit immediate data - imm16 16-bit immediate data - pcrel8 8-bit offset from program counter - pcrel16 16-bit offset from program counter - qim `-2', `-1', `1', `2' - rd any register - rs a register distinct from rd - rlist comma-separated list of registers in parentheses; - register ranges `rd-rs' are allowed - sp stack pointer (`r7') - sr status register - sz size; `.b' or `.w'. If omitted, default `.w' - - ldc[.b] ea,crb bcc[.w] pcrel16 - ldc[.w] ea,sr bcc[.b] pcrel8 - add[:q] sz qim,ea_noimm bhs[.w] pcrel16 - add[:g] sz ea,rd bhs[.b] pcrel8 - adds sz ea,rd bcs[.w] pcrel16 - addx sz ea,rd bcs[.b] pcrel8 - and sz ea,rd blo[.w] pcrel16 - andc[.b] imm8,crb blo[.b] pcrel8 - andc[.w] imm16,sr bne[.w] pcrel16 - bpt bne[.b] pcrel8 - bra[.w] pcrel16 beq[.w] pcrel16 - bra[.b] pcrel8 beq[.b] pcrel8 - bt[.w] pcrel16 bvc[.w] pcrel16 - bt[.b] pcrel8 bvc[.b] pcrel8 - brn[.w] pcrel16 bvs[.w] pcrel16 - brn[.b] pcrel8 bvs[.b] pcrel8 - bf[.w] pcrel16 bpl[.w] pcrel16 - bf[.b] pcrel8 bpl[.b] pcrel8 - bhi[.w] pcrel16 bmi[.w] pcrel16 - bhi[.b] pcrel8 bmi[.b] pcrel8 - bls[.w] pcrel16 bge[.w] pcrel16 - bls[.b] pcrel8 bge[.b] pcrel8 - - blt[.w] pcrel16 mov[:g][.b] imm8,ea_mem - blt[.b] pcrel8 mov[:g][.w] imm16,ea_mem - bgt[.w] pcrel16 movfpe[.b] ea,rd - bgt[.b] pcrel8 movtpe[.b] rs,ea_noimm - ble[.w] pcrel16 mulxu sz ea,rd - ble[.b] pcrel8 neg sz ea - bclr sz imm4,ea_noimm nop - bclr sz rs,ea_noimm not sz ea - bnot sz imm4,ea_noimm or sz ea,rd - bnot sz rs,ea_noimm orc[.b] imm8,crb - bset sz imm4,ea_noimm orc[.w] imm16,sr - bset sz rs,ea_noimm pjmp abs24 - bsr[.b] pcrel8 pjmp @rd - bsr[.w] pcrel16 pjsr abs24 - btst sz imm4,ea_noimm pjsr @rd - btst sz rs,ea_noimm prtd imm8 - clr sz ea prtd imm16 - cmp[:e][.b] imm8,rd prts - cmp[:i][.w] imm16,rd rotl sz ea - cmp[:g].b imm8,ea_noimm rotr sz ea - cmp[:g][.w] imm16,ea_noimm rotxl sz ea - Cmp[:g] sz ea,rd rotxr sz ea - dadd rs,rd rtd imm8 - divxu sz ea,rd rtd imm16 - dsub rs,rd rts - exts[.b] rd scb/f rs,pcrel8 - extu[.b] rd scb/ne rs,pcrel8 - jmp @rd scb/eq rs,pcrel8 - jmp @(imm8,rd) shal sz ea - jmp @(imm16,rd) shar sz ea - jmp abs16 shll sz ea - jsr @rd shlr sz ea - jsr @(imm8,rd) sleep - jsr @(imm16,rd) stc[.b] crb,ea_noimm - jsr abs16 stc[.w] sr,ea_noimm - ldm @sp+,(rlist) stm (rlist),@-sp - link fp,imm8 sub sz ea,rd - link fp,imm16 subs sz ea,rd - mov[:e][.b] imm8,rd subx sz ea,rd - mov[:i][.w] imm16,rd swap[.b] rd - mov[:l][.w] abs8,rd tas[.b] ea - mov[:l].b abs8,rd trapa imm4 - mov[:s][.w] rs,abs8 trap/vs - mov[:s].b rs,abs8 tst sz ea - mov[:f][.w] @(disp8,fp),rd unlk fp - mov[:f][.w] rs,@(disp8,fp) xch[.w] rs,rd - mov[:f].b @(disp8,fp),rd xor sz ea,rd - mov[:f].b rs,@(disp8,fp) xorc.b imm8,crb - mov[:g] sz rs,ea_mem xorc.w imm16,sr - mov[:g] sz ea,rd - - -File: as.info, Node: HPPA-Dependent, Next: i386-Dependent, Prev: H8/500-Dependent, Up: Machine Dependencies - -HPPA Dependent Features -======================= - -* Menu: - -* HPPA Notes:: Notes -* HPPA Options:: Options -* HPPA Syntax:: Syntax -* HPPA Floating Point:: Floating Point -* HPPA Directives:: HPPA Machine Directives -* HPPA Opcodes:: Opcodes - - -File: as.info, Node: HPPA Notes, Next: HPPA Options, Up: HPPA-Dependent - -Notes ------ - - As a back end for GNU CC `as' has been throughly tested and should -work extremely well. We have tested it only minimally on hand written -assembly code and no one has tested it much on the assembly output from -the HP compilers. - - The format of the debugging sections has changed since the original -`as' port (version 1.3X) was released; therefore, you must rebuild all -HPPA objects and libraries with the new assembler so that you can debug -the final executable. - - The HPPA `as' port generates a small subset of the relocations -available in the SOM and ELF object file formats. Additional relocation -support will be added as it becomes necessary. - - -File: as.info, Node: HPPA Options, Next: HPPA Syntax, Prev: HPPA Notes, Up: HPPA-Dependent - -Options -------- - - `as' has no machine-dependent command-line options for the HPPA. - - -File: as.info, Node: HPPA Syntax, Next: HPPA Floating Point, Prev: HPPA Options, Up: HPPA-Dependent - -Syntax ------- - - The assembler syntax closely follows the HPPA instruction set -reference manual; assembler directives and general syntax closely -follow the HPPA assembly language reference manual, with a few -noteworthy differences. - - First, a colon may immediately follow a label definition. This is -simply for compatibility with how most assembly language programmers -write code. - - Some obscure expression parsing problems may affect hand written -code which uses the `spop' instructions, or code which makes significant -use of the `!' line separator. - - `as' is much less forgiving about missing arguments and other -similar oversights than the HP assembler. `as' notifies you of missing -arguments as syntax errors; this is regarded as a feature, not a bug. - - Finally, `as' allows you to use an external symbol without -explicitly importing the symbol. *Warning:* in the future this will be -an error for HPPA targets. - - Special characters for HPPA targets include: - - `;' is the line comment character. - - `!' can be used instead of a newline to separate statements. - - Since `$' has no special meaning, you may use it in symbol names. - - -File: as.info, Node: HPPA Floating Point, Next: HPPA Directives, Prev: HPPA Syntax, Up: HPPA-Dependent - -Floating Point --------------- - - The HPPA family uses IEEE floating-point numbers. - - -File: as.info, Node: HPPA Directives, Next: HPPA Opcodes, Prev: HPPA Floating Point, Up: HPPA-Dependent - -HPPA Assembler Directives -------------------------- - - `as' for the HPPA supports many additional directives for -compatibility with the native assembler. This section describes them -only briefly. For detailed information on HPPA-specific assembler -directives, see `HP9000 Series 800 Assembly Language Reference Manual' -(HP 92432-90001). - - `as' does *not* support the following assembler directives described -in the HP manual: - - .endm .liston - .enter .locct - .leave .macro - .listoff - - Beyond those implemented for compatibility, `as' supports one -additional assembler directive for the HPPA: `.param'. It conveys -register argument locations for static functions. Its syntax closely -follows the `.export' directive. - - These are the additional directives in `as' for the HPPA: - -`.block N' -`.blockz N' - Reserve N bytes of storage, and initialize them to zero. - -`.call' - Mark the beginning of a procedure call. Only the special case - with *no arguments* is allowed. - -`.callinfo [ PARAM=VALUE, ... ] [ FLAG, ... ]' - Specify a number of parameters and flags that define the - environment for a procedure. - - PARAM may be any of `frame' (frame size), `entry_gr' (end of - general register range), `entry_fr' (end of float register range), - `entry_sr' (end of space register range). - - The values for FLAG are `calls' or `caller' (proc has - subroutines), `no_calls' (proc does not call subroutines), - `save_rp' (preserve return pointer), `save_sp' (proc preserves - stack pointer), `no_unwind' (do not unwind this proc), `hpux_int' - (proc is interrupt routine). - -`.code' - Assemble into the standard section called `$TEXT$', subsection - `$CODE$'. - -`.copyright "STRING"' - In the SOM object format, insert STRING into the object code, - marked as a copyright string. - -`.copyright "STRING"' - In the ELF object format, insert STRING into the object code, - marked as a version string. - -`.enter' - Not yet supported; the assembler rejects programs containing this - directive. - -`.entry' - Mark the beginning of a procedure. - -`.exit' - Mark the end of a procedure. - -`.export NAME [ ,TYP ] [ ,PARAM=R ]' - Make a procedure NAME available to callers. TYP, if present, must - be one of `absolute', `code' (ELF only, not SOM), `data', `entry', - `data', `entry', `millicode', `plabel', `pri_prog', or `sec_prog'. - - PARAM, if present, provides either relocation information for the - procedure arguments and result, or a privilege level. PARAM may be - `argwN' (where N ranges from `0' to `3', and indicates one of four - one-word arguments); `rtnval' (the procedure's result); or - `priv_lev' (privilege level). For arguments or the result, R - specifies how to relocate, and must be one of `no' (not - relocatable), `gr' (argument is in general register), `fr' (in - floating point register), or `fu' (upper half of float register). - For `priv_lev', R is an integer. - -`.half N' - Define a two-byte integer constant N; synonym for the portable - `as' directive `.short'. - -`.import NAME [ ,TYP ]' - Converse of `.export'; make a procedure available to call. The - arguments use the same conventions as the first two arguments for - `.export'. - -`.label NAME' - Define NAME as a label for the current assembly location. - -`.leave' - Not yet supported; the assembler rejects programs containing this - directive. - -`.origin LC' - Advance location counter to LC. Synonym for the `{No Value For - "as"}' portable directive `.org'. - -`.param NAME [ ,TYP ] [ ,PARAM=R ]' - Similar to `.export', but used for static procedures. - -`.proc' - Use preceding the first statement of a procedure. - -`.procend' - Use following the last statement of a procedure. - -`LABEL .reg EXPR' - Synonym for `.equ'; define LABEL with the absolute expression EXPR - as its value. - -`.space SECNAME [ ,PARAMS ]' - Switch to section SECNAME, creating a new section by that name if - necessary. You may only use PARAMS when creating a new section, - not when switching to an existing one. SECNAME may identify a - section by number rather than by name. - - If specified, the list PARAMS declares attributes of the section, - identified by keywords. The keywords recognized are `spnum=EXP' - (identify this section by the number EXP, an absolute expression), - `sort=EXP' (order sections according to this sort key when linking; - EXP is an absolute expression), `unloadable' (section contains no - loadable data), `notdefined' (this section defined elsewhere), and - `private' (data in this section not available to other programs). - -`.spnum SECNAM' - Allocate four bytes of storage, and initialize them with the - section number of the section named SECNAM. (You can define the - section number with the HPPA `.space' directive.) - -`.string "STR"' - Copy the characters in the string STR to the object file. *Note - Strings: Strings, for information on escape sequences you can use - in `as' strings. - - *Warning!* The HPPA version of `.string' differs from the usual - `as' definition: it does *not* write a zero byte after copying STR. - -`.stringz "STR"' - Like `.string', but appends a zero byte after copying STR to object - file. - -`.subspa NAME [ ,PARAMS ]' -`.nsubspa NAME [ ,PARAMS ]' - Similar to `.space', but selects a subsection NAME within the - current section. You may only specify PARAMS when you create a - subsection (in the first instance of `.subspa' for this NAME). - - If specified, the list PARAMS declares attributes of the - subsection, identified by keywords. The keywords recognized are - `quad=EXPR' ("quadrant" for this subsection), `align=EXPR' - (alignment for beginning of this subsection; a power of two), - `access=EXPR' (value for "access rights" field), `sort=EXPR' - (sorting order for this subspace in link), `code_only' (subsection - contains only code), `unloadable' (subsection cannot be loaded - into memory), `common' (subsection is common block), `dup_comm' - (initialized data may have duplicate names), or `zero' (subsection - is all zeros, do not write in object file). - - `.nsubspa' always creates a new subspace with the given name, even - if one with the same name already exists. - -`.version "STR"' - Write STR as version identifier in object code. - - -File: as.info, Node: HPPA Opcodes, Prev: HPPA Directives, Up: HPPA-Dependent - -Opcodes -------- - - For detailed information on the HPPA machine instruction set, see -`PA-RISC Architecture and Instruction Set Reference Manual' (HP -09740-90039). - - -File: as.info, Node: i386-Dependent, Next: i960-Dependent, Prev: HPPA-Dependent, Up: Machine Dependencies - -80386 Dependent Features -======================== - -* Menu: - -* i386-Options:: Options -* i386-Syntax:: AT&T Syntax versus Intel Syntax -* i386-Opcodes:: Opcode Naming -* i386-Regs:: Register Naming -* i386-prefixes:: Opcode Prefixes -* i386-Memory:: Memory References -* i386-jumps:: Handling of Jump Instructions -* i386-Float:: Floating Point -* i386-16bit:: Writing 16-bit Code -* i386-Notes:: Notes - - -File: as.info, Node: i386-Options, Next: i386-Syntax, Up: i386-Dependent - -Options -------- - - The 80386 has no machine dependent options. diff -urN binutils-2.7/gas/doc/as.info-4 binutils-2.8/gas/doc/as.info-4 --- binutils-2.7/gas/doc/as.info-4 Mon Jul 15 12:23:05 1996 +++ binutils-2.8/gas/doc/as.info-4 Wed Apr 30 13:14:59 1997 @@ -1,4 +1,4 @@ -This is Info file as.info, produced by Makeinfo-1.55 from the input +This is Info file as.info, produced by Makeinfo-1.64 from the input file ./as.texinfo. START-INFO-DIR-ENTRY @@ -7,8 +7,8 @@ This file documents the GNU Assembler "as". - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, -Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -24,6 +24,418 @@ versions.  +File: as.info, Node: H8/500 Opcodes, Prev: H8/500 Directives, Up: H8/500-Dependent + +Opcodes +------- + + For detailed information on the H8/500 machine instruction set, see +`H8/500 Series Programming Manual' (Hitachi M21T001). + + `as' implements all the standard H8/500 opcodes. No additional +pseudo-instructions are needed on this family. + + The following table summarizes H8/500 opcodes and their operands: + + Legend: + abs8 8-bit absolute address + abs16 16-bit absolute address + abs24 24-bit absolute address + crb `ccr', `br', `ep', `dp', `tp', `dp' + disp8 8-bit displacement + ea `rn', `@rn', `@(d:8, rn)', `@(d:16, rn)', + `@-rn', `@rn+', `@aa:8', `@aa:16', + `#xx:8', `#xx:16' + ea_mem `@rn', `@(d:8, rn)', `@(d:16, rn)', + `@-rn', `@rn+', `@aa:8', `@aa:16' + ea_noimm `rn', `@rn', `@(d:8, rn)', `@(d:16, rn)', + `@-rn', `@rn+', `@aa:8', `@aa:16' + fp r6 + imm4 4-bit immediate data + imm8 8-bit immediate data + imm16 16-bit immediate data + pcrel8 8-bit offset from program counter + pcrel16 16-bit offset from program counter + qim `-2', `-1', `1', `2' + rd any register + rs a register distinct from rd + rlist comma-separated list of registers in parentheses; + register ranges `rd-rs' are allowed + sp stack pointer (`r7') + sr status register + sz size; `.b' or `.w'. If omitted, default `.w' + + ldc[.b] ea,crb bcc[.w] pcrel16 + ldc[.w] ea,sr bcc[.b] pcrel8 + add[:q] sz qim,ea_noimm bhs[.w] pcrel16 + add[:g] sz ea,rd bhs[.b] pcrel8 + adds sz ea,rd bcs[.w] pcrel16 + addx sz ea,rd bcs[.b] pcrel8 + and sz ea,rd blo[.w] pcrel16 + andc[.b] imm8,crb blo[.b] pcrel8 + andc[.w] imm16,sr bne[.w] pcrel16 + bpt bne[.b] pcrel8 + bra[.w] pcrel16 beq[.w] pcrel16 + bra[.b] pcrel8 beq[.b] pcrel8 + bt[.w] pcrel16 bvc[.w] pcrel16 + bt[.b] pcrel8 bvc[.b] pcrel8 + brn[.w] pcrel16 bvs[.w] pcrel16 + brn[.b] pcrel8 bvs[.b] pcrel8 + bf[.w] pcrel16 bpl[.w] pcrel16 + bf[.b] pcrel8 bpl[.b] pcrel8 + bhi[.w] pcrel16 bmi[.w] pcrel16 + bhi[.b] pcrel8 bmi[.b] pcrel8 + bls[.w] pcrel16 bge[.w] pcrel16 + bls[.b] pcrel8 bge[.b] pcrel8 + + blt[.w] pcrel16 mov[:g][.b] imm8,ea_mem + blt[.b] pcrel8 mov[:g][.w] imm16,ea_mem + bgt[.w] pcrel16 movfpe[.b] ea,rd + bgt[.b] pcrel8 movtpe[.b] rs,ea_noimm + ble[.w] pcrel16 mulxu sz ea,rd + ble[.b] pcrel8 neg sz ea + bclr sz imm4,ea_noimm nop + bclr sz rs,ea_noimm not sz ea + bnot sz imm4,ea_noimm or sz ea,rd + bnot sz rs,ea_noimm orc[.b] imm8,crb + bset sz imm4,ea_noimm orc[.w] imm16,sr + bset sz rs,ea_noimm pjmp abs24 + bsr[.b] pcrel8 pjmp @rd + bsr[.w] pcrel16 pjsr abs24 + btst sz imm4,ea_noimm pjsr @rd + btst sz rs,ea_noimm prtd imm8 + clr sz ea prtd imm16 + cmp[:e][.b] imm8,rd prts + cmp[:i][.w] imm16,rd rotl sz ea + cmp[:g].b imm8,ea_noimm rotr sz ea + cmp[:g][.w] imm16,ea_noimm rotxl sz ea + Cmp[:g] sz ea,rd rotxr sz ea + dadd rs,rd rtd imm8 + divxu sz ea,rd rtd imm16 + dsub rs,rd rts + exts[.b] rd scb/f rs,pcrel8 + extu[.b] rd scb/ne rs,pcrel8 + jmp @rd scb/eq rs,pcrel8 + jmp @(imm8,rd) shal sz ea + jmp @(imm16,rd) shar sz ea + jmp abs16 shll sz ea + jsr @rd shlr sz ea + jsr @(imm8,rd) sleep + jsr @(imm16,rd) stc[.b] crb,ea_noimm + jsr abs16 stc[.w] sr,ea_noimm + ldm @sp+,(rlist) stm (rlist),@-sp + link fp,imm8 sub sz ea,rd + link fp,imm16 subs sz ea,rd + mov[:e][.b] imm8,rd subx sz ea,rd + mov[:i][.w] imm16,rd swap[.b] rd + mov[:l][.w] abs8,rd tas[.b] ea + mov[:l].b abs8,rd trapa imm4 + mov[:s][.w] rs,abs8 trap/vs + mov[:s].b rs,abs8 tst sz ea + mov[:f][.w] @(disp8,fp),rd unlk fp + mov[:f][.w] rs,@(disp8,fp) xch[.w] rs,rd + mov[:f].b @(disp8,fp),rd xor sz ea,rd + mov[:f].b rs,@(disp8,fp) xorc.b imm8,crb + mov[:g] sz rs,ea_mem xorc.w imm16,sr + mov[:g] sz ea,rd + + +File: as.info, Node: HPPA-Dependent, Next: i386-Dependent, Prev: H8/500-Dependent, Up: Machine Dependencies + +HPPA Dependent Features +======================= + +* Menu: + +* HPPA Notes:: Notes +* HPPA Options:: Options +* HPPA Syntax:: Syntax +* HPPA Floating Point:: Floating Point +* HPPA Directives:: HPPA Machine Directives +* HPPA Opcodes:: Opcodes + + +File: as.info, Node: HPPA Notes, Next: HPPA Options, Up: HPPA-Dependent + +Notes +----- + + As a back end for GNU CC `as' has been throughly tested and should +work extremely well. We have tested it only minimally on hand written +assembly code and no one has tested it much on the assembly output from +the HP compilers. + + The format of the debugging sections has changed since the original +`as' port (version 1.3X) was released; therefore, you must rebuild all +HPPA objects and libraries with the new assembler so that you can debug +the final executable. + + The HPPA `as' port generates a small subset of the relocations +available in the SOM and ELF object file formats. Additional relocation +support will be added as it becomes necessary. + + +File: as.info, Node: HPPA Options, Next: HPPA Syntax, Prev: HPPA Notes, Up: HPPA-Dependent + +Options +------- + + `as' has no machine-dependent command-line options for the HPPA. + + +File: as.info, Node: HPPA Syntax, Next: HPPA Floating Point, Prev: HPPA Options, Up: HPPA-Dependent + +Syntax +------ + + The assembler syntax closely follows the HPPA instruction set +reference manual; assembler directives and general syntax closely +follow the HPPA assembly language reference manual, with a few +noteworthy differences. + + First, a colon may immediately follow a label definition. This is +simply for compatibility with how most assembly language programmers +write code. + + Some obscure expression parsing problems may affect hand written +code which uses the `spop' instructions, or code which makes significant +use of the `!' line separator. + + `as' is much less forgiving about missing arguments and other +similar oversights than the HP assembler. `as' notifies you of missing +arguments as syntax errors; this is regarded as a feature, not a bug. + + Finally, `as' allows you to use an external symbol without +explicitly importing the symbol. *Warning:* in the future this will be +an error for HPPA targets. + + Special characters for HPPA targets include: + + `;' is the line comment character. + + `!' can be used instead of a newline to separate statements. + + Since `$' has no special meaning, you may use it in symbol names. + + +File: as.info, Node: HPPA Floating Point, Next: HPPA Directives, Prev: HPPA Syntax, Up: HPPA-Dependent + +Floating Point +-------------- + + The HPPA family uses IEEE floating-point numbers. + + +File: as.info, Node: HPPA Directives, Next: HPPA Opcodes, Prev: HPPA Floating Point, Up: HPPA-Dependent + +HPPA Assembler Directives +------------------------- + + `as' for the HPPA supports many additional directives for +compatibility with the native assembler. This section describes them +only briefly. For detailed information on HPPA-specific assembler +directives, see `HP9000 Series 800 Assembly Language Reference Manual' +(HP 92432-90001). + + `as' does *not* support the following assembler directives described +in the HP manual: + + .endm .liston + .enter .locct + .leave .macro + .listoff + + Beyond those implemented for compatibility, `as' supports one +additional assembler directive for the HPPA: `.param'. It conveys +register argument locations for static functions. Its syntax closely +follows the `.export' directive. + + These are the additional directives in `as' for the HPPA: + +`.block N' +`.blockz N' + Reserve N bytes of storage, and initialize them to zero. + +`.call' + Mark the beginning of a procedure call. Only the special case + with *no arguments* is allowed. + +`.callinfo [ PARAM=VALUE, ... ] [ FLAG, ... ]' + Specify a number of parameters and flags that define the + environment for a procedure. + + PARAM may be any of `frame' (frame size), `entry_gr' (end of + general register range), `entry_fr' (end of float register range), + `entry_sr' (end of space register range). + + The values for FLAG are `calls' or `caller' (proc has + subroutines), `no_calls' (proc does not call subroutines), + `save_rp' (preserve return pointer), `save_sp' (proc preserves + stack pointer), `no_unwind' (do not unwind this proc), `hpux_int' + (proc is interrupt routine). + +`.code' + Assemble into the standard section called `$TEXT$', subsection + `$CODE$'. + +`.copyright "STRING"' + In the SOM object format, insert STRING into the object code, + marked as a copyright string. + +`.copyright "STRING"' + In the ELF object format, insert STRING into the object code, + marked as a version string. + +`.enter' + Not yet supported; the assembler rejects programs containing this + directive. + +`.entry' + Mark the beginning of a procedure. + +`.exit' + Mark the end of a procedure. + +`.export NAME [ ,TYP ] [ ,PARAM=R ]' + Make a procedure NAME available to callers. TYP, if present, must + be one of `absolute', `code' (ELF only, not SOM), `data', `entry', + `data', `entry', `millicode', `plabel', `pri_prog', or `sec_prog'. + + PARAM, if present, provides either relocation information for the + procedure arguments and result, or a privilege level. PARAM may be + `argwN' (where N ranges from `0' to `3', and indicates one of four + one-word arguments); `rtnval' (the procedure's result); or + `priv_lev' (privilege level). For arguments or the result, R + specifies how to relocate, and must be one of `no' (not + relocatable), `gr' (argument is in general register), `fr' (in + floating point register), or `fu' (upper half of float register). + For `priv_lev', R is an integer. + +`.half N' + Define a two-byte integer constant N; synonym for the portable + `as' directive `.short'. + +`.import NAME [ ,TYP ]' + Converse of `.export'; make a procedure available to call. The + arguments use the same conventions as the first two arguments for + `.export'. + +`.label NAME' + Define NAME as a label for the current assembly location. + +`.leave' + Not yet supported; the assembler rejects programs containing this + directive. + +`.origin LC' + Advance location counter to LC. Synonym for the `{No Value For + "as"}' portable directive `.org'. + +`.param NAME [ ,TYP ] [ ,PARAM=R ]' + Similar to `.export', but used for static procedures. + +`.proc' + Use preceding the first statement of a procedure. + +`.procend' + Use following the last statement of a procedure. + +`LABEL .reg EXPR' + Synonym for `.equ'; define LABEL with the absolute expression EXPR + as its value. + +`.space SECNAME [ ,PARAMS ]' + Switch to section SECNAME, creating a new section by that name if + necessary. You may only use PARAMS when creating a new section, + not when switching to an existing one. SECNAME may identify a + section by number rather than by name. + + If specified, the list PARAMS declares attributes of the section, + identified by keywords. The keywords recognized are `spnum=EXP' + (identify this section by the number EXP, an absolute expression), + `sort=EXP' (order sections according to this sort key when linking; + EXP is an absolute expression), `unloadable' (section contains no + loadable data), `notdefined' (this section defined elsewhere), and + `private' (data in this section not available to other programs). + +`.spnum SECNAM' + Allocate four bytes of storage, and initialize them with the + section number of the section named SECNAM. (You can define the + section number with the HPPA `.space' directive.) + +`.string "STR"' + Copy the characters in the string STR to the object file. *Note + Strings: Strings, for information on escape sequences you can use + in `as' strings. + + *Warning!* The HPPA version of `.string' differs from the usual + `as' definition: it does *not* write a zero byte after copying STR. + +`.stringz "STR"' + Like `.string', but appends a zero byte after copying STR to object + file. + +`.subspa NAME [ ,PARAMS ]' +`.nsubspa NAME [ ,PARAMS ]' + Similar to `.space', but selects a subsection NAME within the + current section. You may only specify PARAMS when you create a + subsection (in the first instance of `.subspa' for this NAME). + + If specified, the list PARAMS declares attributes of the + subsection, identified by keywords. The keywords recognized are + `quad=EXPR' ("quadrant" for this subsection), `align=EXPR' + (alignment for beginning of this subsection; a power of two), + `access=EXPR' (value for "access rights" field), `sort=EXPR' + (sorting order for this subspace in link), `code_only' (subsection + contains only code), `unloadable' (subsection cannot be loaded + into memory), `common' (subsection is common block), `dup_comm' + (initialized data may have duplicate names), or `zero' (subsection + is all zeros, do not write in object file). + + `.nsubspa' always creates a new subspace with the given name, even + if one with the same name already exists. + +`.version "STR"' + Write STR as version identifier in object code. + + +File: as.info, Node: HPPA Opcodes, Prev: HPPA Directives, Up: HPPA-Dependent + +Opcodes +------- + + For detailed information on the HPPA machine instruction set, see +`PA-RISC Architecture and Instruction Set Reference Manual' (HP +09740-90039). + + +File: as.info, Node: i386-Dependent, Next: i960-Dependent, Prev: HPPA-Dependent, Up: Machine Dependencies + +80386 Dependent Features +======================== + +* Menu: + +* i386-Options:: Options +* i386-Syntax:: AT&T Syntax versus Intel Syntax +* i386-Opcodes:: Opcode Naming +* i386-Regs:: Register Naming +* i386-prefixes:: Opcode Prefixes +* i386-Memory:: Memory References +* i386-jumps:: Handling of Jump Instructions +* i386-Float:: Floating Point +* i386-16bit:: Writing 16-bit Code +* i386-Notes:: Notes + + +File: as.info, Node: i386-Options, Next: i386-Syntax, Up: i386-Dependent + +Options +------- + + The 80386 has no machine dependent options. + + File: as.info, Node: i386-Syntax, Next: i386-Opcodes, Prev: i386-Options, Up: i386-Dependent AT&T Syntax versus Intel Syntax @@ -645,6 +1057,24 @@ either use C style comments, or start comments with a `#' character at the beginning of a line. + If you use an addressing mode with a base register without specifying +the size, `as' will normally use the full 32 bit value. For example, +the addressing mode `%a0@(%d0)' is equivalent to `%a0@(%d0:l)'. You +may use the `--base-size-default-16' option to tell `as' to default to +using the 16 bit value. In this case, `%a0@(%d0)' is equivalent to +`%a0@(%d0:w)'. You may use the `--base-size-default-32' option to +restore the default behaviour. + + If you use an addressing mode with a displacement, and the value of +the displacement is not known, `as' will normally assume that the value +is 32 bits. For example, if the symbol `disp' has not been defined, +`as' will assemble the addressing mode `%a0@(disp,%d0)' as though +`disp' is a 32 bit value. You may use the `--disp-size-default-16' +option to tell `as' to instead assume that the displacement is 16 bits. +In this case, `as' will assemble `%a0@(disp,%d0)' as though `disp' is +a 16 bit value. You may use the `--disp-size-default-32' option to +restore the default behaviour. + `as' can assemble code for several different members of the Motorola 680x0 family. The default depends upon how `as' was configured when it was built; normally, the default is to assemble code for the 68020 @@ -683,6 +1113,9 @@ `-m68360' Assemble for the CPU32 family of chips. +`-m5200' + Assemble for the ColdFire family of chips. + `-m68881' `-m68882' Assemble 68881 floating point instructions. This is the default @@ -768,511 +1201,4 @@ "Absolute" `SYMBOL', or `DIGITS', optionally followed by `:b', `:w', or `:l'. - - -File: as.info, Node: M68K-Moto-Syntax, Next: M68K-Float, Prev: M68K-Syntax, Up: M68K-Dependent - -Motorola Syntax ---------------- - - The standard Motorola syntax for this chip differs from the syntax -already discussed (*note Syntax: M68K-Syntax.). `as' can accept -Motorola syntax for operands, even if MIT syntax is used for other -operands in the same instruction. The two kinds of syntax are fully -compatible. - - In the following table APC stands for any of the address registers -(`%a0' through `%a7'), the program counter (`%pc'), the zero-address -relative to the program counter (`%zpc'), or a suppressed address -register (`%za0' through `%za7'). The use of SIZE means one of `w' or -`l', and it may always be omitted along with the leading dot. The use -of SCALE means one of `1', `2', `4', or `8', and it may always be -omitted along with the leading asterisk. - - The following additional addressing modes are understood: - -"Address Register Indirect" - `(%a0)' through `(%a7)' - `%a7' is also known as `%sp', i.e. the Stack Pointer. `%a6' is - also known as `%fp', the Frame Pointer. - -"Address Register Postincrement" - `(%a0)+' through `(%a7)+' - -"Address Register Predecrement" - `-(%a0)' through `-(%a7)' - -"Indirect Plus Offset" - `NUMBER(%A0)' through `NUMBER(%A7)', or `NUMBER(%PC)'. - - The NUMBER may also appear within the parentheses, as in - `(NUMBER,%A0)'. When used with the PC, the NUMBER may be omitted - (with an address register, omitting the NUMBER produces Address - Register Indirect mode). - -"Index" - `NUMBER(APC,REGISTER.SIZE*SCALE)' - - The NUMBER may be omitted, or it may appear within the - parentheses. The APC may be omitted. The REGISTER and the APC - may appear in either order. If both APC and REGISTER are address - registers, and the SIZE and SCALE are omitted, then the first - register is taken as the base register, and the second as the - index register. - -"Postindex" - `([NUMBER,APC],REGISTER.SIZE*SCALE,ONUMBER)' - - The ONUMBER, or the REGISTER, or both, may be omitted. Either the - NUMBER or the APC may be omitted, but not both. - -"Preindex" - `([NUMBER,APC,REGISTER.SIZE*SCALE],ONUMBER)' - - The NUMBER, or the APC, or the REGISTER, or any two of them, may - be omitted. The ONUMBER may be omitted. The REGISTER and the APC - may appear in either order. If both APC and REGISTER are address - registers, and the SIZE and SCALE are omitted, then the first - register is taken as the base register, and the second as the - index register. - - -File: as.info, Node: M68K-Float, Next: M68K-Directives, Prev: M68K-Moto-Syntax, Up: M68K-Dependent - -Floating Point --------------- - - Packed decimal (P) format floating literals are not supported. Feel -free to add the code! - - The floating point formats generated by directives are these. - -`.float' - `Single' precision floating point constants. - -`.double' - `Double' precision floating point constants. - -`.extend' -`.ldouble' - `Extended' precision (`long double') floating point constants. - - -File: as.info, Node: M68K-Directives, Next: M68K-opcodes, Prev: M68K-Float, Up: M68K-Dependent - -680x0 Machine Directives ------------------------- - - In order to be compatible with the Sun assembler the 680x0 assembler -understands the following directives. - -`.data1' - This directive is identical to a `.data 1' directive. - -`.data2' - This directive is identical to a `.data 2' directive. - -`.even' - This directive is a special case of the `.align' directive; it - aligns the output to an even byte boundary. - -`.skip' - This directive is identical to a `.space' directive. - - -File: as.info, Node: M68K-opcodes, Prev: M68K-Directives, Up: M68K-Dependent - -Opcodes -------- - -* Menu: - -* M68K-Branch:: Branch Improvement -* M68K-Chars:: Special Characters - - -File: as.info, Node: M68K-Branch, Next: M68K-Chars, Up: M68K-opcodes - -Branch Improvement -.................. - - Certain pseudo opcodes are permitted for branch instructions. They -expand to the shortest branch instruction that reach the target. -Generally these mnemonics are made by substituting `j' for `b' at the -start of a Motorola mnemonic. - - The following table summarizes the pseudo-operations. A `*' flags -cases that are more fully described after the table: - - Displacement - +------------------------------------------------- - | 68020 68000/10 - Pseudo-Op |BYTE WORD LONG LONG non-PC relative - +------------------------------------------------- - jbsr |bsrs bsr bsrl jsr jsr - jra |bras bra bral jmp jmp - * jXX |bXXs bXX bXXl bNXs;jmpl bNXs;jmp - * dbXX |dbXX dbXX dbXX; bra; jmpl - * fjXX |fbXXw fbXXw fbXXl fbNXw;jmp - - XX: condition - NX: negative of condition XX - - `*'--see full description below - -`jbsr' -`jra' - These are the simplest jump pseudo-operations; they always map to - one particular machine instruction, depending on the displacement - to the branch target. - -`jXX' - Here, `jXX' stands for an entire family of pseudo-operations, - where XX is a conditional branch or condition-code test. The full - list of pseudo-ops in this family is: - jhi jls jcc jcs jne jeq jvc - jvs jpl jmi jge jlt jgt jle - - For the cases of non-PC relative displacements and long - displacements on the 68000 or 68010, `as' issues a longer code - fragment in terms of NX, the opposite condition to XX. For - example, for the non-PC relative case: - jXX foo - gives - bNXs oof - jmp foo - oof: - -`dbXX' - The full family of pseudo-operations covered here is - dbhi dbls dbcc dbcs dbne dbeq dbvc - dbvs dbpl dbmi dbge dblt dbgt dble - dbf dbra dbt - - Other than for word and byte displacements, when the source reads - `dbXX foo', `as' emits - dbXX oo1 - bra oo2 - oo1:jmpl foo - oo2: - -`fjXX' - This family includes - fjne fjeq fjge fjlt fjgt fjle fjf - fjt fjgl fjgle fjnge fjngl fjngle fjngt - fjnle fjnlt fjoge fjogl fjogt fjole fjolt - fjor fjseq fjsf fjsne fjst fjueq fjuge - fjugt fjule fjult fjun - - For branch targets that are not PC relative, `as' emits - fbNX oof - jmp foo - oof: - when it encounters `fjXX foo'. - - -File: as.info, Node: M68K-Chars, Prev: M68K-Branch, Up: M68K-opcodes - -Special Characters -.................. - - The immediate character is `#' for Sun compatibility. The -line-comment character is `|' (unless the `--bitwise-or' option is -used). If a `#' appears at the beginning of a line, it is treated as a -comment unless it looks like `# line file', in which case it is treated -normally. - - -File: as.info, Node: MIPS-Dependent, Next: SH-Dependent, Prev: M68K-Dependent, Up: Machine Dependencies - -MIPS Dependent Features -======================= - - GNU `as' for MIPS architectures supports the MIPS R2000, R3000, -R4000 and R6000 processors. For information about the MIPS instruction -set, see `MIPS RISC Architecture', by Kane and Heindrich -(Prentice-Hall). For an overview of MIPS assembly conventions, see -"Appendix D: Assembly Language Programming" in the same work. - -* Menu: - -* MIPS Opts:: Assembler options -* MIPS Object:: ECOFF object code -* MIPS Stabs:: Directives for debugging information -* MIPS ISA:: Directives to override the ISA level - - -File: as.info, Node: MIPS Opts, Next: MIPS Object, Up: MIPS-Dependent - -Assembler options ------------------ - - The MIPS configurations of GNU `as' support these special options: - -`-G NUM' - This option sets the largest size of an object that can be - referenced implicitly with the `gp' register. It is only accepted - for targets that use ECOFF format. The default value is 8. - -`-EB' -`-EL' - Any MIPS configuration of `as' can select big-endian or - little-endian output at run time (unlike the other GNU development - tools, which must be configured for one or the other). Use `-EB' - to select big-endian output, and `-EL' for little-endian. - -`-mips1' -`-mips2' -`-mips3' - Generate code for a particular MIPS Instruction Set Architecture - level. `-mips1' corresponds to the R2000 and R3000 processors, - `-mips2' to the R6000 processor, and `-mips3' to the R4000 - processor. You can also switch instruction sets during the - assembly; see *Note Directives to override the ISA level: MIPS ISA. - -`-m4650' -`-no-m4650' - Generate code for the MIPS R4650 chip. This tells the assembler - to accept the `mad' and `madu' instruction, and to not schedule - `nop' instructions around accesses to the `HI' and `LO' registers. - `-no-m4650' turns off this option. - -`-m4010' -`-no-m4010' - Generate code for the LSI R4010 chip. This tells the assembler to - accept the R4010 specific instructions (`addciu', `ffc', etc.), - and to not schedule `nop' instructions around accesses to the `HI' - and `LO' registers. `-no-m4010' turns off this option. - -`-mcpu=CPU' - Generate code for a particular MIPS cpu. This has little effect - on the assembler, but it is passed by `gcc'. - -`-nocpp' - This option is ignored. It is accepted for command-line - compatibility with other assemblers, which use it to turn off C - style preprocessing. With GNU `as', there is no need for - `-nocpp', because the GNU assembler itself never runs the C - preprocessor. - -`--trap' -`--no-break' - `as' automatically macro expands certain division and - multiplication instructions to check for overflow and division by - zero. This option causes `as' to generate code to take a trap - exception rather than a break exception when an error is detected. - The trap instructions are only supported at Instruction Set - Architecture level 2 and higher. - -`--break' -`--no-trap' - Generate code to take a break exception rather than a trap - exception when an error is detected. This is the default. - - -File: as.info, Node: MIPS Object, Next: MIPS Stabs, Prev: MIPS Opts, Up: MIPS-Dependent - -MIPS ECOFF object code ----------------------- - - Assembling for a MIPS ECOFF target supports some additional sections -besides the usual `.text', `.data' and `.bss'. The additional sections -are `.rdata', used for read-only data, `.sdata', used for small data, -and `.sbss', used for small common objects. - - When assembling for ECOFF, the assembler uses the `$gp' (`$28') -register to form the address of a "small object". Any object in the -`.sdata' or `.sbss' sections is considered "small" in this sense. For -external objects, or for objects in the `.bss' section, you can use the -`gcc' `-G' option to control the size of objects addressed via `$gp'; -the default value is 8, meaning that a reference to any object eight -bytes or smaller uses `$gp'. Passing `-G 0' to `as' prevents it from -using the `$gp' register on the basis of object size (but the assembler -uses `$gp' for objects in `.sdata' or `sbss' in any case). The size of -an object in the `.bss' section is set by the `.comm' or `.lcomm' -directive that defines it. The size of an external object may be set -with the `.extern' directive. For example, `.extern sym,4' declares -that the object at `sym' is 4 bytes in length, whie leaving `sym' -otherwise undefined. - - Using small ECOFF objects requires linker support, and assumes that -the `$gp' register is correctly initialized (normally done -automatically by the startup code). MIPS ECOFF assembly code must not -modify the `$gp' register. - - -File: as.info, Node: MIPS Stabs, Next: MIPS ISA, Prev: MIPS Object, Up: MIPS-Dependent - -Directives for debugging information ------------------------------------- - - MIPS ECOFF `as' supports several directives used for generating -debugging information which are not support by traditional MIPS -assemblers. These are `.def', `.endef', `.dim', `.file', `.scl', -`.size', `.tag', `.type', `.val', `.stabd', `.stabn', and `.stabs'. -The debugging information generated by the three `.stab' directives can -only be read by GDB, not by traditional MIPS debuggers (this -enhancement is required to fully support C++ debugging). These -directives are primarily used by compilers, not assembly language -programmers! - - -File: as.info, Node: MIPS ISA, Prev: MIPS Stabs, Up: MIPS-Dependent - -Directives to override the ISA level ------------------------------------- - - GNU `as' supports an additional directive to change the MIPS -Instruction Set Architecture level on the fly: `.set mipsN'. N should -be a number from 0 to 3. A value from 1 to 3 makes the assembler -accept instructions for the corresponding ISA level, from that point on -in the assembly. `.set mipsN' affects not only which instructions are -permitted, but also how certain macros are expanded. `.set mips0' -restores the ISA level to its original level: either the level you -selected with command line options, or the default for your -configuration. You can use this feature to permit specific R4000 -instructions while assembling in 32 bit mode. Use this directive with -care! - - Traditional MIPS assemblers do not support this directive. - - -File: as.info, Node: SH-Dependent, Next: Sparc-Dependent, Prev: MIPS-Dependent, Up: Machine Dependencies - -Hitachi SH Dependent Features -============================= - -* Menu: - -* SH Options:: Options -* SH Syntax:: Syntax -* SH Floating Point:: Floating Point -* SH Directives:: SH Machine Directives -* SH Opcodes:: Opcodes - - -File: as.info, Node: SH Options, Next: SH Syntax, Up: SH-Dependent - -Options -------- - - `as' has no additional command-line options for the Hitachi SH -family. - - -File: as.info, Node: SH Syntax, Next: SH Floating Point, Prev: SH Options, Up: SH-Dependent - -Syntax ------- - -* Menu: - -* SH-Chars:: Special Characters -* SH-Regs:: Register Names -* SH-Addressing:: Addressing Modes - - -File: as.info, Node: SH-Chars, Next: SH-Regs, Up: SH Syntax - -Special Characters -.................. - - `!' is the line comment character. - - You can use `;' instead of a newline to separate statements. - - Since `$' has no special meaning, you may use it in symbol names. - - -File: as.info, Node: SH-Regs, Next: SH-Addressing, Prev: SH-Chars, Up: SH Syntax - -Register Names -.............. - - You can use the predefined symbols `r0', `r1', `r2', `r3', `r4', -`r5', `r6', `r7', `r8', `r9', `r10', `r11', `r12', `r13', `r14', and -`r15' to refer to the SH registers. - - The SH also has these control registers: - -`pr' - procedure register (holds return address) - -`pc' - program counter - -`mach' -`macl' - high and low multiply accumulator registers - -`sr' - status register - -`gbr' - global base register - -`vbr' - vector base register (for interrupt vectors) - - -File: as.info, Node: SH-Addressing, Prev: SH-Regs, Up: SH Syntax - -Addressing Modes -................ - - `as' understands the following addressing modes for the SH. `RN' in -the following refers to any of the numbered registers, but *not* the -control registers. - -`RN' - Register direct - -`@RN' - Register indirect - -`@-RN' - Register indirect with pre-decrement - -`@RN+' - Register indirect with post-increment - -`@(DISP, RN)' - Register indirect with displacement - -`@(R0, RN)' - Register indexed - -`@(DISP, GBR)' - `GBR' offset - -`@(R0, GBR)' - GBR indexed - -`ADDR' -`@(DISP, PC)' - PC relative address (for branch or for addressing memory). The - `as' implementation allows you to use the simpler form ADDR - anywhere a PC relative address is called for; the alternate form - is supported for compatibility with other assemblers. - -`#IMM' - Immediate data - - -File: as.info, Node: SH Floating Point, Next: SH Directives, Prev: SH Syntax, Up: SH-Dependent - -Floating Point --------------- - - The SH family has no hardware floating point, but the `.float' -directive generates IEEE floating-point numbers for compatibility with -other development tools. - - -File: as.info, Node: SH Directives, Next: SH Opcodes, Prev: SH Floating Point, Up: SH-Dependent - -SH Machine Directives ---------------------- - - `as' has no machine-dependent directives for the SH. diff -urN binutils-2.7/gas/doc/as.info-5 binutils-2.8/gas/doc/as.info-5 --- binutils-2.7/gas/doc/as.info-5 Mon Jul 15 12:23:05 1996 +++ binutils-2.8/gas/doc/as.info-5 Wed Apr 30 13:14:59 1997 @@ -1,4 +1,4 @@ -This is Info file as.info, produced by Makeinfo-1.55 from the input +This is Info file as.info, produced by Makeinfo-1.64 from the input file ./as.texinfo. START-INFO-DIR-ENTRY @@ -7,8 +7,8 @@ This file documents the GNU Assembler "as". - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, -Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -24,6 +24,558 @@ versions.  +File: as.info, Node: M68K-Moto-Syntax, Next: M68K-Float, Prev: M68K-Syntax, Up: M68K-Dependent + +Motorola Syntax +--------------- + + The standard Motorola syntax for this chip differs from the syntax +already discussed (*note Syntax: M68K-Syntax.). `as' can accept +Motorola syntax for operands, even if MIT syntax is used for other +operands in the same instruction. The two kinds of syntax are fully +compatible. + + In the following table APC stands for any of the address registers +(`%a0' through `%a7'), the program counter (`%pc'), the zero-address +relative to the program counter (`%zpc'), or a suppressed address +register (`%za0' through `%za7'). The use of SIZE means one of `w' or +`l', and it may always be omitted along with the leading dot. The use +of SCALE means one of `1', `2', `4', or `8', and it may always be +omitted along with the leading asterisk. + + The following additional addressing modes are understood: + +"Address Register Indirect" + `(%a0)' through `(%a7)' + `%a7' is also known as `%sp', i.e. the Stack Pointer. `%a6' is + also known as `%fp', the Frame Pointer. + +"Address Register Postincrement" + `(%a0)+' through `(%a7)+' + +"Address Register Predecrement" + `-(%a0)' through `-(%a7)' + +"Indirect Plus Offset" + `NUMBER(%A0)' through `NUMBER(%A7)', or `NUMBER(%PC)'. + + The NUMBER may also appear within the parentheses, as in + `(NUMBER,%A0)'. When used with the PC, the NUMBER may be omitted + (with an address register, omitting the NUMBER produces Address + Register Indirect mode). + +"Index" + `NUMBER(APC,REGISTER.SIZE*SCALE)' + + The NUMBER may be omitted, or it may appear within the + parentheses. The APC may be omitted. The REGISTER and the APC + may appear in either order. If both APC and REGISTER are address + registers, and the SIZE and SCALE are omitted, then the first + register is taken as the base register, and the second as the + index register. + +"Postindex" + `([NUMBER,APC],REGISTER.SIZE*SCALE,ONUMBER)' + + The ONUMBER, or the REGISTER, or both, may be omitted. Either the + NUMBER or the APC may be omitted, but not both. + +"Preindex" + `([NUMBER,APC,REGISTER.SIZE*SCALE],ONUMBER)' + + The NUMBER, or the APC, or the REGISTER, or any two of them, may + be omitted. The ONUMBER may be omitted. The REGISTER and the APC + may appear in either order. If both APC and REGISTER are address + registers, and the SIZE and SCALE are omitted, then the first + register is taken as the base register, and the second as the + index register. + + +File: as.info, Node: M68K-Float, Next: M68K-Directives, Prev: M68K-Moto-Syntax, Up: M68K-Dependent + +Floating Point +-------------- + + Packed decimal (P) format floating literals are not supported. Feel +free to add the code! + + The floating point formats generated by directives are these. + +`.float' + `Single' precision floating point constants. + +`.double' + `Double' precision floating point constants. + +`.extend' +`.ldouble' + `Extended' precision (`long double') floating point constants. + + +File: as.info, Node: M68K-Directives, Next: M68K-opcodes, Prev: M68K-Float, Up: M68K-Dependent + +680x0 Machine Directives +------------------------ + + In order to be compatible with the Sun assembler the 680x0 assembler +understands the following directives. + +`.data1' + This directive is identical to a `.data 1' directive. + +`.data2' + This directive is identical to a `.data 2' directive. + +`.even' + This directive is a special case of the `.align' directive; it + aligns the output to an even byte boundary. + +`.skip' + This directive is identical to a `.space' directive. + + +File: as.info, Node: M68K-opcodes, Prev: M68K-Directives, Up: M68K-Dependent + +Opcodes +------- + +* Menu: + +* M68K-Branch:: Branch Improvement +* M68K-Chars:: Special Characters + + +File: as.info, Node: M68K-Branch, Next: M68K-Chars, Up: M68K-opcodes + +Branch Improvement +.................. + + Certain pseudo opcodes are permitted for branch instructions. They +expand to the shortest branch instruction that reach the target. +Generally these mnemonics are made by substituting `j' for `b' at the +start of a Motorola mnemonic. + + The following table summarizes the pseudo-operations. A `*' flags +cases that are more fully described after the table: + + Displacement + +------------------------------------------------- + | 68020 68000/10 + Pseudo-Op |BYTE WORD LONG LONG non-PC relative + +------------------------------------------------- + jbsr |bsrs bsr bsrl jsr jsr + jra |bras bra bral jmp jmp + * jXX |bXXs bXX bXXl bNXs;jmpl bNXs;jmp + * dbXX |dbXX dbXX dbXX; bra; jmpl + * fjXX |fbXXw fbXXw fbXXl fbNXw;jmp + + XX: condition + NX: negative of condition XX + + `*'--see full description below + +`jbsr' +`jra' + These are the simplest jump pseudo-operations; they always map to + one particular machine instruction, depending on the displacement + to the branch target. + +`jXX' + Here, `jXX' stands for an entire family of pseudo-operations, + where XX is a conditional branch or condition-code test. The full + list of pseudo-ops in this family is: + jhi jls jcc jcs jne jeq jvc + jvs jpl jmi jge jlt jgt jle + + For the cases of non-PC relative displacements and long + displacements on the 68000 or 68010, `as' issues a longer code + fragment in terms of NX, the opposite condition to XX. For + example, for the non-PC relative case: + jXX foo + gives + bNXs oof + jmp foo + oof: + +`dbXX' + The full family of pseudo-operations covered here is + dbhi dbls dbcc dbcs dbne dbeq dbvc + dbvs dbpl dbmi dbge dblt dbgt dble + dbf dbra dbt + + Other than for word and byte displacements, when the source reads + `dbXX foo', `as' emits + dbXX oo1 + bra oo2 + oo1:jmpl foo + oo2: + +`fjXX' + This family includes + fjne fjeq fjge fjlt fjgt fjle fjf + fjt fjgl fjgle fjnge fjngl fjngle fjngt + fjnle fjnlt fjoge fjogl fjogt fjole fjolt + fjor fjseq fjsf fjsne fjst fjueq fjuge + fjugt fjule fjult fjun + + For branch targets that are not PC relative, `as' emits + fbNX oof + jmp foo + oof: + when it encounters `fjXX foo'. + + +File: as.info, Node: M68K-Chars, Prev: M68K-Branch, Up: M68K-opcodes + +Special Characters +.................. + + The immediate character is `#' for Sun compatibility. The +line-comment character is `|' (unless the `--bitwise-or' option is +used). If a `#' appears at the beginning of a line, it is treated as a +comment unless it looks like `# line file', in which case it is treated +normally. + + +File: as.info, Node: MIPS-Dependent, Next: SH-Dependent, Prev: M68K-Dependent, Up: Machine Dependencies + +MIPS Dependent Features +======================= + + GNU `as' for MIPS architectures supports several different MIPS +processors, and MIPS ISA levels I through IV. For information about +the MIPS instruction set, see `MIPS RISC Architecture', by Kane and +Heindrich (Prentice-Hall). For an overview of MIPS assembly +conventions, see "Appendix D: Assembly Language Programming" in the +same work. + +* Menu: + +* MIPS Opts:: Assembler options +* MIPS Object:: ECOFF object code +* MIPS Stabs:: Directives for debugging information +* MIPS ISA:: Directives to override the ISA level +* MIPS insn:: Directive to mark data as an instruction +* MIPS option stack:: Directives to save and restore options + + +File: as.info, Node: MIPS Opts, Next: MIPS Object, Up: MIPS-Dependent + +Assembler options +----------------- + + The MIPS configurations of GNU `as' support these special options: + +`-G NUM' + This option sets the largest size of an object that can be + referenced implicitly with the `gp' register. It is only accepted + for targets that use ECOFF format. The default value is 8. + +`-EB' +`-EL' + Any MIPS configuration of `as' can select big-endian or + little-endian output at run time (unlike the other GNU development + tools, which must be configured for one or the other). Use `-EB' + to select big-endian output, and `-EL' for little-endian. + +`-mips1' +`-mips2' +`-mips3' +`-mips4' + Generate code for a particular MIPS Instruction Set Architecture + level. `-mips1' corresponds to the R2000 and R3000 processors, + `-mips2' to the R6000 processor, `-mips3' to the R4000 processor, + and `-mips4' to the R8000 and R10000 processors. You can also + switch instruction sets during the assembly; see *Note Directives + to override the ISA level: MIPS ISA. + +`-mips16' +`-no-mips16' + Generate code for the MIPS 16 processor. This is equivalent to + putting `.set mips16' at the start of the assembly file. + `-no-mips16' turns off this option. + +`-m4650' +`-no-m4650' + Generate code for the MIPS R4650 chip. This tells the assembler + to accept the `mad' and `madu' instruction, and to not schedule + `nop' instructions around accesses to the `HI' and `LO' registers. + `-no-m4650' turns off this option. + +`-m4010' +`-no-m4010' + Generate code for the LSI R4010 chip. This tells the assembler to + accept the R4010 specific instructions (`addciu', `ffc', etc.), + and to not schedule `nop' instructions around accesses to the `HI' + and `LO' registers. `-no-m4010' turns off this option. + +`-mcpu=CPU' + Generate code for a particular MIPS cpu. This has little effect + on the assembler, but it is passed by `gcc'. + +`-nocpp' + This option is ignored. It is accepted for command-line + compatibility with other assemblers, which use it to turn off C + style preprocessing. With GNU `as', there is no need for + `-nocpp', because the GNU assembler itself never runs the C + preprocessor. + +`--trap' +`--no-break' + `as' automatically macro expands certain division and + multiplication instructions to check for overflow and division by + zero. This option causes `as' to generate code to take a trap + exception rather than a break exception when an error is detected. + The trap instructions are only supported at Instruction Set + Architecture level 2 and higher. + +`--break' +`--no-trap' + Generate code to take a break exception rather than a trap + exception when an error is detected. This is the default. + + +File: as.info, Node: MIPS Object, Next: MIPS Stabs, Prev: MIPS Opts, Up: MIPS-Dependent + +MIPS ECOFF object code +---------------------- + + Assembling for a MIPS ECOFF target supports some additional sections +besides the usual `.text', `.data' and `.bss'. The additional sections +are `.rdata', used for read-only data, `.sdata', used for small data, +and `.sbss', used for small common objects. + + When assembling for ECOFF, the assembler uses the `$gp' (`$28') +register to form the address of a "small object". Any object in the +`.sdata' or `.sbss' sections is considered "small" in this sense. For +external objects, or for objects in the `.bss' section, you can use the +`gcc' `-G' option to control the size of objects addressed via `$gp'; +the default value is 8, meaning that a reference to any object eight +bytes or smaller uses `$gp'. Passing `-G 0' to `as' prevents it from +using the `$gp' register on the basis of object size (but the assembler +uses `$gp' for objects in `.sdata' or `sbss' in any case). The size of +an object in the `.bss' section is set by the `.comm' or `.lcomm' +directive that defines it. The size of an external object may be set +with the `.extern' directive. For example, `.extern sym,4' declares +that the object at `sym' is 4 bytes in length, whie leaving `sym' +otherwise undefined. + + Using small ECOFF objects requires linker support, and assumes that +the `$gp' register is correctly initialized (normally done +automatically by the startup code). MIPS ECOFF assembly code must not +modify the `$gp' register. + + +File: as.info, Node: MIPS Stabs, Next: MIPS ISA, Prev: MIPS Object, Up: MIPS-Dependent + +Directives for debugging information +------------------------------------ + + MIPS ECOFF `as' supports several directives used for generating +debugging information which are not support by traditional MIPS +assemblers. These are `.def', `.endef', `.dim', `.file', `.scl', +`.size', `.tag', `.type', `.val', `.stabd', `.stabn', and `.stabs'. +The debugging information generated by the three `.stab' directives can +only be read by GDB, not by traditional MIPS debuggers (this +enhancement is required to fully support C++ debugging). These +directives are primarily used by compilers, not assembly language +programmers! + + +File: as.info, Node: MIPS ISA, Next: MIPS insn, Prev: MIPS Stabs, Up: MIPS-Dependent + +Directives to override the ISA level +------------------------------------ + + GNU `as' supports an additional directive to change the MIPS +Instruction Set Architecture level on the fly: `.set mipsN'. N should +be a number from 0 to 4. A value from 1 to 4 makes the assembler +accept instructions for the corresponding ISA level, from that point on +in the assembly. `.set mipsN' affects not only which instructions are +permitted, but also how certain macros are expanded. `.set mips0' +restores the ISA level to its original level: either the level you +selected with command line options, or the default for your +configuration. You can use this feature to permit specific R4000 +instructions while assembling in 32 bit mode. Use this directive with +care! + + The directive `.set mips16' puts the assembler into MIPS 16 mode, in +which it will assemble instructions for the MIPS 16 processor. Use +`.set nomips16' to return to normal 32 bit mode. + + Traditional MIPS assemblers do not support this directive. + + +File: as.info, Node: MIPS insn, Next: MIPS option stack, Prev: MIPS ISA, Up: MIPS-Dependent + +Directive to mark data as an instruction +---------------------------------------- + + The `.insn' directive tells `as' that the following data is actually +instructions. This makes a difference in MIPS 16 mode: when loading +the address of a label which precedes instructions, `as' automatically +adds 1 to the value, so that jumping to the loaded address will do the +right thing. + + +File: as.info, Node: MIPS option stack, Prev: MIPS insn, Up: MIPS-Dependent + +Directives to save and restore options +-------------------------------------- + + The directives `.set push' and `.set pop' may be used to save and +restore the current settings for all the options which are controlled +by `.set'. The `.set push' directive saves the current settings on a +stack. The `.set pop' directive pops the stack and restores the +settings. + + These directives can be useful inside an macro which must change an +option such as the ISA level or instruction reordering but does not want +to change the state of the code which invoked the macro. + + Traditional MIPS assemblers do not support these directives. + + +File: as.info, Node: SH-Dependent, Next: Sparc-Dependent, Prev: MIPS-Dependent, Up: Machine Dependencies + +Hitachi SH Dependent Features +============================= + +* Menu: + +* SH Options:: Options +* SH Syntax:: Syntax +* SH Floating Point:: Floating Point +* SH Directives:: SH Machine Directives +* SH Opcodes:: Opcodes + + +File: as.info, Node: SH Options, Next: SH Syntax, Up: SH-Dependent + +Options +------- + + `as' has no additional command-line options for the Hitachi SH +family. + + +File: as.info, Node: SH Syntax, Next: SH Floating Point, Prev: SH Options, Up: SH-Dependent + +Syntax +------ + +* Menu: + +* SH-Chars:: Special Characters +* SH-Regs:: Register Names +* SH-Addressing:: Addressing Modes + + +File: as.info, Node: SH-Chars, Next: SH-Regs, Up: SH Syntax + +Special Characters +.................. + + `!' is the line comment character. + + You can use `;' instead of a newline to separate statements. + + Since `$' has no special meaning, you may use it in symbol names. + + +File: as.info, Node: SH-Regs, Next: SH-Addressing, Prev: SH-Chars, Up: SH Syntax + +Register Names +.............. + + You can use the predefined symbols `r0', `r1', `r2', `r3', `r4', +`r5', `r6', `r7', `r8', `r9', `r10', `r11', `r12', `r13', `r14', and +`r15' to refer to the SH registers. + + The SH also has these control registers: + +`pr' + procedure register (holds return address) + +`pc' + program counter + +`mach' +`macl' + high and low multiply accumulator registers + +`sr' + status register + +`gbr' + global base register + +`vbr' + vector base register (for interrupt vectors) + + +File: as.info, Node: SH-Addressing, Prev: SH-Regs, Up: SH Syntax + +Addressing Modes +................ + + `as' understands the following addressing modes for the SH. `RN' in +the following refers to any of the numbered registers, but *not* the +control registers. + +`RN' + Register direct + +`@RN' + Register indirect + +`@-RN' + Register indirect with pre-decrement + +`@RN+' + Register indirect with post-increment + +`@(DISP, RN)' + Register indirect with displacement + +`@(R0, RN)' + Register indexed + +`@(DISP, GBR)' + `GBR' offset + +`@(R0, GBR)' + GBR indexed + +`ADDR' +`@(DISP, PC)' + PC relative address (for branch or for addressing memory). The + `as' implementation allows you to use the simpler form ADDR + anywhere a PC relative address is called for; the alternate form + is supported for compatibility with other assemblers. + +`#IMM' + Immediate data + + +File: as.info, Node: SH Floating Point, Next: SH Directives, Prev: SH Syntax, Up: SH-Dependent + +Floating Point +-------------- + + The SH family has no hardware floating point, but the `.float' +directive generates IEEE floating-point numbers for compatibility with +other development tools. + + +File: as.info, Node: SH Directives, Next: SH Opcodes, Prev: SH Floating Point, Up: SH-Dependent + +SH Machine Directives +--------------------- + + `as' has no machine-dependent directives for the SH. + + File: as.info, Node: SH Opcodes, Prev: SH Directives, Up: SH-Dependent Opcodes @@ -132,11 +684,12 @@ * Menu: * Sparc-Opts:: Options +* Sparc-Aligned-Data:: Option to enforce aligned data * Sparc-Float:: Floating Point * Sparc-Directives:: Sparc Machine Directives  -File: as.info, Node: Sparc-Opts, Next: Sparc-Float, Up: Sparc-Dependent +File: as.info, Node: Sparc-Opts, Next: Sparc-Aligned-Data, Up: Sparc-Dependent Options ------- @@ -177,7 +730,28 @@ as required (except between incompatible levels).  -File: as.info, Node: Sparc-Float, Next: Sparc-Directives, Prev: Sparc-Opts, Up: Sparc-Dependent +File: as.info, Node: Sparc-Aligned-Data, Next: Sparc-Float, Prev: Sparc-Opts, Up: Sparc-Dependent + +Enforcing aligned data +---------------------- + + SPARC GAS normally permits data to be misaligned. For example, it +permits the `.long' pseudo-op to be used on a byte boundary. However, +the native SunOS and Solaris assemblers issue an error when they see +misaligned data. + + You can use the `--enforce-aligned-data' option to make SPARC GAS +also issue an error about misaligned data, just as the SunOS and Solaris +assemblers do. + + The `--enforce-aligned-data' option is not the default because gcc +issues misaligned data pseudo-ops when it initializes certain packed +data structures (structures defined using the `packed' attribute). You +may have to assemble with GAS in order to initialize packed data +structures in your own code. + + +File: as.info, Node: Sparc-Float, Next: Sparc-Directives, Prev: Sparc-Aligned-Data, Up: Sparc-Dependent Floating Point -------------- @@ -822,103 +1396,4 @@ Vax bit fields can not be assembled with `as'. Someone can add the required code if they really need it. - - -File: as.info, Node: Acknowledgements, Next: Index, Prev: Machine Dependencies, Up: Top - -Acknowledgements -**************** - - If you have contributed to `as' and your name isn't listed here, it -is not meant as a slight. We just don't know about it. Send mail to -the maintainer, and we'll correct the situation. Currently the -maintainer is Ken Raeburn (email address `raeburn@cygnus.com'). - - Dean Elsner wrote the original GNU assembler for the VAX.(1) - - Jay Fenlason maintained GAS for a while, adding support for -GDB-specific debug information and the 68k series machines, most of the -preprocessing pass, and extensive changes in `messages.c', -`input-file.c', `write.c'. - - K. Richard Pixley maintained GAS for a while, adding various -enhancements and many bug fixes, including merging support for several -processors, breaking GAS up to handle multiple object file format back -ends (including heavy rewrite, testing, an integration of the coff and -b.out back ends), adding configuration including heavy testing and -verification of cross assemblers and file splits and renaming, -converted GAS to strictly ANSI C including full prototypes, added -support for m680[34]0 and cpu32, did considerable work on i960 -including a COFF port (including considerable amounts of reverse -engineering), a SPARC opcode file rewrite, DECstation, rs6000, and -hp300hpux host ports, updated "know" assertions and made them work, -much other reorganization, cleanup, and lint. - - Ken Raeburn wrote the high-level BFD interface code to replace most -of the code in format-specific I/O modules. - - The original VMS support was contributed by David L. Kashtan. Eric -Youngdale has done much work with it since. - - The Intel 80386 machine description was written by Eliot Dresselhaus. - - Minh Tran-Le at IntelliCorp contributed some AIX 386 support. - - The Motorola 88k machine description was contributed by Devon Bowen -of Buffalo University and Torbjorn Granlund of the Swedish Institute of -Computer Science. - - Keith Knowles at the Open Software Foundation wrote the original -MIPS back end (`tc-mips.c', `tc-mips.h'), and contributed Rose format -support (which hasn't been merged in yet). Ralph Campbell worked with -the MIPS code to support a.out format. - - Support for the Zilog Z8k and Hitachi H8/300 and H8/500 processors -(tc-z8k, tc-h8300, tc-h8500), and IEEE 695 object file format -(obj-ieee), was written by Steve Chamberlain of Cygnus Support. Steve -also modified the COFF back end to use BFD for some low-level -operations, for use with the H8/300 and AMD 29k targets. - - John Gilmore built the AMD 29000 support, added `.include' support, -and simplified the configuration of which versions accept which -directives. He updated the 68k machine description so that Motorola's -opcodes always produced fixed-size instructions (e.g. `jsr'), while -synthetic instructions remained shrinkable (`jbsr'). John fixed many -bugs, including true tested cross-compilation support, and one bug in -relaxation that took a week and required the proverbial one-bit fix. - - Ian Lance Taylor of Cygnus Support merged the Motorola and MIT -syntax for the 68k, completed support for some COFF targets (68k, i386 -SVR3, and SCO Unix), added support for MIPS ECOFF and ELF targets, -wrote the initial RS/6000 and PowerPC assembler, and made a few other -minor patches. - - Steve Chamberlain made `as' able to generate listings. - - Hewlett-Packard contributed support for the HP9000/300. - - Jeff Law wrote GAS and BFD support for the native HPPA object format -(SOM) along with a fairly extensive HPPA testsuite (for both SOM and -ELF object formats). This work was supported by both the Center for -Software Science at the University of Utah and Cygnus Support. - - Support for ELF format files has been worked on by Mark Eichin of -Cygnus Support (original, incomplete implementation for SPARC), Pete -Hoogenboom and Jeff Law at the University of Utah (HPPA mainly), -Michael Meissner of the Open Software Foundation (i386 mainly), and Ken -Raeburn of Cygnus Support (sparc, and some initial 64-bit support). - - Richard Henderson rewrote the Alpha assembler. - - Several engineers at Cygnus Support have also provided many small -bug fixes and configuration enhancements. - - Many others have contributed large or small bugfixes and -enhancements. If you have contributed significant work and are not -mentioned on this list, and want to be, let us know. Some of the -history has been lost; we are not intentionally leaving anyone out. - - ---------- Footnotes ---------- - - (1) Any more details? diff -urN binutils-2.7/gas/doc/as.info-6 binutils-2.8/gas/doc/as.info-6 --- binutils-2.7/gas/doc/as.info-6 Mon Jul 15 12:23:05 1996 +++ binutils-2.8/gas/doc/as.info-6 Wed Apr 30 13:14:59 1997 @@ -1,4 +1,4 @@ -This is Info file as.info, produced by Makeinfo-1.55 from the input +This is Info file as.info, produced by Makeinfo-1.64 from the input file ./as.texinfo. START-INFO-DIR-ENTRY @@ -7,8 +7,8 @@ This file documents the GNU Assembler "as". - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, -Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -24,769 +24,290 @@ versions.  -File: as.info, Node: Index, Prev: Acknowledgements, Up: Top +File: as.info, Node: Reporting Bugs, Next: Acknowledgements, Prev: Machine Dependencies, Up: Top -Index -***** +Reporting Bugs +************** + + Your bug reports play an essential role in making `as' reliable. + + Reporting a bug may help you by bringing a solution to your problem, +or it may not. But in any case the principal function of a bug report +is to help the entire community by making the next version of `as' work +better. Bug reports are your contribution to the maintenance of `as'. + + In order for a bug report to serve its purpose, you must include the +information that enables us to fix the bug. * Menu: -* #: Comments. -* #APP: Preprocessing. -* #NO_APP: Preprocessing. -* -: Command Line. -* -statistics: statistics. -* -a: a. -* -ad: a. -* -ah: a. -* -al: a. -* -an: a. -* -as: a. -* -Asparclet: Sparc-Opts. -* -Asparclite: Sparc-Opts. -* -Av6: Sparc-Opts. -* -Av8: Sparc-Opts. -* -Av9: Sparc-Opts. -* -Av9a: Sparc-Opts. -* -D: D. -* -f: f. -* -I PATH: I. -* -K: K. -* -L: L. -* -M: M. -* -o: o. -* -R: R. -* -v: v. -* -version: v. -* -W: W. -* .o: Object. -* 16-bit code, i386: i386-16bit. -* 29K support: AMD29K-Dependent. -* $ in symbol names: H8/500-Chars. -* $ in symbol names: SH-Chars. -* -+ option, VAX/VMS: VAX-Opts. -* -A options, i960: Options-i960. -* -b option, i960: Options-i960. -* -D, ignored on VAX: VAX-Opts. -* -d, VAX option: VAX-Opts. -* -EB option (MIPS): MIPS Opts. -* -EL option (MIPS): MIPS Opts. -* -G option (MIPS): MIPS Opts. -* -h option, VAX/VMS: VAX-Opts. -* -J, ignored on VAX: VAX-Opts. -* -no-relax option, i960: Options-i960. -* -nocpp ignored (MIPS): MIPS Opts. -* -S, ignored on VAX: VAX-Opts. -* -t, ignored on VAX: VAX-Opts. -* -T, ignored on VAX: VAX-Opts. -* -V, redundant on VAX: VAX-Opts. -* .param on HPPA: HPPA Directives. -* .set mipsN: MIPS ISA. -* . (symbol): Dot. -* : (label): Statements. -* as version: v. -* a.out symbol attributes: a.out Symbols. -* ABORT directive: ABORT. -* abort directive: Abort. -* align directive: Align. -* align directive, SPARC: Sparc-Directives. -* app-file directive: App-File. -* ascii directive: Ascii. -* asciz directive: Asciz. -* balignl directive: Balign. -* balignw directive: Balign. -* balign directive: Balign. -* block directive, AMD 29K: AMD29K Directives. -* bss directive, i960: Directives-i960. -* byte directive: Byte. -* callj, i960 pseudo-opcode: callj-i960. -* code16 directive, i386: i386-16bit. -* code32 directive, i386: i386-16bit. -* common directive, SPARC: Sparc-Directives. -* comm directive: Comm. -* cputype directive, AMD 29K: AMD29K Directives. -* data1 directive, M680x0: M68K-Directives. -* data2 directive, M680x0: M68K-Directives. -* data directive: Data. -* def directive: Def. -* desc directive: Desc. -* dfloat directive, VAX: VAX-directives. -* dim directive: Dim. -* double directive: Double. -* double directive, i386: i386-Float. -* double directive, M680x0: M68K-Float. -* double directive, VAX: VAX-float. -* eject directive: Eject. -* else directive: Else. -* endef directive: Endef. -* endif directive: Endif. -* endm directive: Macro. -* equ directive: Equ. -* even directive, M680x0: M68K-Directives. -* exitm directive: Macro. -* extended directive, i960: Directives-i960. -* extend directive M680x0: M68K-Float. -* extern directive: Extern. -* ffloat directive, VAX: VAX-directives. -* file directive: File. -* file directive, AMD 29K: AMD29K Directives. -* fill directive: Fill. -* float directive: Float. -* float directive, i386: i386-Float. -* float directive, M680x0: M68K-Float. -* float directive, VAX: VAX-float. -* fwait instruction, i386: i386-Float. -* gbr960, i960 postprocessor: Options-i960. -* gfloat directive, VAX: VAX-directives. -* global directive: Global. -* gp register, MIPS: MIPS Object. -* half directive, SPARC: Sparc-Directives. -* hfloat directive, VAX: VAX-directives. -* hword directive: hword. -* ident directive: Ident. -* ifdef directive: If. -* ifndef directive: If. -* ifnotdef directive: If. -* if directive: If. -* imul instruction, i386: i386-Notes. -* include directive: Include. -* include directive search path: I. -* int directive: Int. -* int directive, H8/300: H8/300 Directives. -* int directive, H8/500: H8/500 Directives. -* int directive, i386: i386-Float. -* int directive, SH: SH Directives. -* irpc directive: Irpc. -* irp directive: Irp. -* lcomm directive: Lcomm. -* ldouble directive M680x0: M68K-Float. -* leafproc directive, i960: Directives-i960. -* lflags directive (ignored): Lflags. -* line directive: Line. -* line directive, AMD 29K: AMD29K Directives. -* linkonce directive: Linkonce. -* list directive: List. -* ln directive: Ln. -* long directive: Long. -* long directive, i386: i386-Float. -* macro directive: Macro. -* mri directive: MRI. -* mul instruction, i386: i386-Notes. -* nolist directive: Nolist. -* octa directive: Octa. -* org directive: Org. -* p2alignl directive: P2align. -* p2alignw directive: P2align. -* p2align directive: P2align. -* proc directive, SPARC: Sparc-Directives. -* psize directive: Psize. -* quad directive: Quad. -* quad directive, i386: i386-Float. -* rept directive: Rept. -* reserve directive, SPARC: Sparc-Directives. -* sbttl directive: Sbttl. -* scl directive: Scl. -* section directive: Section. -* sect directive, AMD 29K: AMD29K Directives. -* seg directive, SPARC: Sparc-Directives. -* set directive: Set. -* short directive: Short. -* single directive: Single. -* single directive, i386: i386-Float. -* size directive: Size. -* skip directive: Skip. -* skip directive, M680x0: M68K-Directives. -* skip directive, SPARC: Sparc-Directives. -* space directive: Space. -* stabX directives: Stab. -* stabd directive: Stab. -* stabn directive: Stab. -* stabs directive: Stab. -* string directive: String. -* string directive on HPPA: HPPA Directives. -* sysproc directive, i960: Directives-i960. -* tag directive: Tag. -* text directive: Text. -* tfloat directive, i386: i386-Float. -* title directive: Title. -* type directive: Type. -* use directive, AMD 29K: AMD29K Directives. -* val directive: Val. -* word directive: Word. -* word directive, H8/300: H8/300 Directives. -* word directive, H8/500: H8/500 Directives. -* word directive, i386: i386-Float. -* word directive, SH: SH Directives. -* word directive, SPARC: Sparc-Directives. -* xword directive, SPARC: Sparc-Directives. -* \" (doublequote character): Strings. -* \DDD (octal character code): Strings. -* \XD... (hex character code): Strings. -* \b (backspace character): Strings. -* \f (formfeed character): Strings. -* \n (newline character): Strings. -* \r (carriage return character): Strings. -* \t (tab): Strings. -* \\ (\ character): Strings. -* -bitwise-or option, M680x0: M68K-Opts. -* -register-prefix-optional option, M680x0: M68K-Opts. -* -l option, M680x0: M68K-Opts. -* -m68000 and related options: M68K-Opts. -* MIT: M68K-Syntax. -* a.out: Object. -* absolute section: Ld Sections. -* addition, permitted arguments: Infix Ops. -* addresses: Expressions. -* addresses, format of: Secs Background. -* addressing modes, H8/300: H8/300-Addressing. -* addressing modes, H8/500: H8/500-Addressing. -* addressing modes, M680x0: M68K-Syntax. -* addressing modes, SH: SH-Addressing. -* addressing modes, Z8000: Z8000-Addressing. -* advancing location counter: Org. -* altered difference tables: Word. -* alternate syntax for the 680x0: M68K-Moto-Syntax. -* AMD 29K floating point (IEEE): AMD29K Floating Point. -* AMD 29K identifiers: AMD29K-Chars. -* AMD 29K line comment character: AMD29K-Chars. -* AMD 29K machine directives: AMD29K Directives. -* AMD 29K macros: AMD29K-Macros. -* AMD 29K opcodes: AMD29K Opcodes. -* AMD 29K options (none): AMD29K Options. -* AMD 29K protected registers: AMD29K-Regs. -* AMD 29K register names: AMD29K-Regs. -* AMD 29K special purpose registers: AMD29K-Regs. -* AMD 29K support: AMD29K-Dependent. -* architecture options, i960: Options-i960. -* architecture options, M680x0: M68K-Opts. -* architectures, SPARC: Sparc-Opts. -* arguments for addition: Infix Ops. -* arguments for subtraction: Infix Ops. -* arguments in expressions: Arguments. -* arithmetic functions: Operators. -* arithmetic operands: Arguments. -* assembler internal logic error: As Sections. -* assembler, and linker: Secs Background. -* assembly listings, enabling: a. -* assigning values to symbols: Equ. -* assigning values to symbols: Setting Symbols. -* attributes, symbol: Symbol Attributes. -* auxiliary attributes, COFF symbols: COFF Symbols. -* auxiliary symbol information, COFF: Dim. -* Av7: Sparc-Opts. -* backslash (\\): Strings. -* backspace (\b): Strings. -* big endian output, MIPS: Overview. -* big-endian output, MIPS: MIPS Opts. -* bignums: Bignums. -* binary integers: Integers. -* bitfields, not supported on VAX: VAX-no. -* block: Z8000 Directives. -* branch improvement, M680x0: M68K-Branch. -* branch improvement, VAX: VAX-branch. -* branch recording, i960: Options-i960. -* branch statistics table, i960: Options-i960. -* bss section: bss. -* bss section: Ld Sections. -* bus lock prefixes, i386: i386-prefixes. -* bval: Z8000 Directives. -* call instructions, i386: i386-Opcodes. -* carriage return (\r): Strings. -* character constants: Characters. -* character escape codes: Strings. -* character, single: Chars. -* characters used in symbols: Symbol Intro. -* COFF auxiliary symbol information: Dim. -* COFF named section: Section. -* COFF structure debugging: Tag. -* COFF symbol attributes: COFF Symbols. -* COFF symbol descriptor: Desc. -* COFF symbol storage class: Scl. -* COFF symbol type: Type. -* COFF symbols, debugging: Def. -* COFF value attribute: Val. -* COMDAT: Linkonce. -* command line conventions: Command Line. -* command-line options ignored, VAX: VAX-Opts. -* comments: Comments. -* comments, M680x0: M68K-Chars. -* comments, removed by preprocessor: Preprocessing. -* common sections: Linkonce. -* common variable storage: bss. -* compare and jump expansions, i960: Compare-and-branch-i960. -* compare/branch instructions, i960: Compare-and-branch-i960. -* conditional assembly: If. -* constant, single character: Chars. -* constants: Constants. -* constants, bignum: Bignums. -* constants, character: Characters. -* constants, converted by preprocessor: Preprocessing. -* constants, floating point: Flonums. -* constants, integer: Integers. -* constants, number: Numbers. -* constants, string: Strings. -* continuing statements: Statements. -* conversion instructions, i386: i386-Opcodes. -* coprocessor wait, i386: i386-prefixes. -* current address: Dot. -* current address, advancing: Org. -* data and text sections, joining: R. -* data section: Ld Sections. -* debuggers, and symbol order: Symbols. -* debugging COFF symbols: Def. -* decimal integers: Integers. -* deprecated directives: Deprecated. -* descriptor, of a.out symbol: Symbol Desc. -* difference tables altered: Word. -* difference tables, warning: K. -* directives and instructions: Statements. -* directives, M680x0: M68K-Directives. -* directives, machine independent: Pseudo Ops. -* directives, Z8000: Z8000 Directives. -* displacement sizing character, VAX: VAX-operands. -* dot (symbol): Dot. -* doublequote (\"): Strings. -* ECOFF sections: MIPS Object. -* eight-byte integer: Quad. -* empty expressions: Empty Exprs. -* emulation: Overview. -* endianness, MIPS: Overview. -* EOF, newline must precede: Statements. -* error messsages: Errors. -* errors, continuing after: Z. -* escape codes, character: Strings. -* even: Z8000 Directives. -* expr (internal section): As Sections. -* expression arguments: Arguments. -* expressions: Expressions. -* expressions, empty: Empty Exprs. -* expressions, integer: Integer Exprs. -* faster processing (-f): f. -* file name, logical: File. -* file name, logical: App-File. -* files, including: Include. -* files, input: Input Files. -* filling memory: Skip. -* filling memory: Space. -* floating point numbers: Flonums. -* floating point numbers (double): Double. -* floating point numbers (single): Single. -* floating point numbers (single): Float. -* floating point, AMD 29K (IEEE): AMD29K Floating Point. -* floating point, H8/300 (IEEE): H8/300 Floating Point. -* floating point, H8/500 (IEEE): H8/500 Floating Point. -* floating point, HPPA (IEEE): HPPA Floating Point. -* floating point, i386: i386-Float. -* floating point, i960 (IEEE): Floating Point-i960. -* floating point, M680x0: M68K-Float. -* floating point, SH (IEEE): SH Floating Point. -* floating point, SPARC (IEEE): Sparc-Float. -* floating point, VAX: VAX-float. -* flonums: Flonums. -* format of error messages: Errors. -* format of warning messages: Errors. -* formfeed (\f): Strings. -* functions, in expressions: Operators. -* global: Z8000 Directives. -* grouping data: Sub-Sections. -* H8/300 addressing modes: H8/300-Addressing. -* H8/300 floating point (IEEE): H8/300 Floating Point. -* H8/300 line comment character: H8/300-Chars. -* H8/300 line separator: H8/300-Chars. -* H8/300 machine directives (none): H8/300 Directives. -* H8/300 opcode summary: H8/300 Opcodes. -* H8/300 options (none): H8/300 Options. -* H8/300 registers: H8/300-Regs. -* H8/300 size suffixes: H8/300 Opcodes. -* H8/300 support: H8/300-Dependent. -* H8/300H, assembling for: H8/300 Directives. -* H8/500 addressing modes: H8/500-Addressing. -* H8/500 floating point (IEEE): H8/500 Floating Point. -* H8/500 line comment character: H8/500-Chars. -* H8/500 line separator: H8/500-Chars. -* H8/500 machine directives (none): H8/500 Directives. -* H8/500 opcode summary: H8/500 Opcodes. -* H8/500 options (none): H8/500 Options. -* H8/500 registers: H8/500-Regs. -* H8/500 support: H8/500-Dependent. -* hex character code (\XD...): Strings. -* hexadecimal integers: Integers. -* HPPA directives not supported: HPPA Directives. -* HPPA floating point (IEEE): HPPA Floating Point. -* HPPA Syntax: HPPA Options. -* HPPA-only directives: HPPA Directives. -* i386 16-bit code: i386-16bit. -* i386 fwait instruction: i386-Float. -* i386 mul, imul instructions: i386-Notes. -* i386 conversion instructions: i386-Opcodes. -* i386 floating point: i386-Float. -* i386 immediate operands: i386-Syntax. -* i386 jump optimization: i386-jumps. -* i386 jump, call, return: i386-Syntax. -* i386 jump/call operands: i386-Syntax. -* i386 memory references: i386-Memory. -* i386 opcode naming: i386-Opcodes. -* i386 opcode prefixes: i386-prefixes. -* i386 options (none): i386-Options. -* i386 register operands: i386-Syntax. -* i386 registers: i386-Regs. -* i386 sections: i386-Syntax. -* i386 size suffixes: i386-Syntax. -* i386 source, destination operands: i386-Syntax. -* i386 support: i386-Dependent. -* i386 syntax compatibility: i386-Syntax. -* i80306 support: i386-Dependent. -* i960 callj pseudo-opcode: callj-i960. -* i960 architecture options: Options-i960. -* i960 branch recording: Options-i960. -* i960 compare and jump expansions: Compare-and-branch-i960. -* i960 compare/branch instructions: Compare-and-branch-i960. -* i960 floating point (IEEE): Floating Point-i960. -* i960 machine directives: Directives-i960. -* i960 opcodes: Opcodes for i960. -* i960 options: Options-i960. -* i960 support: i960-Dependent. -* identifiers, AMD 29K: AMD29K-Chars. -* immediate character, M680x0: M68K-Chars. -* immediate character, VAX: VAX-operands. -* immediate operands, i386: i386-Syntax. -* indirect character, VAX: VAX-operands. -* infix operators: Infix Ops. -* inhibiting interrupts, i386: i386-prefixes. -* input: Input Files. -* input file linenumbers: Input Files. -* instruction set, M680x0: M68K-opcodes. -* instruction summary, H8/300: H8/300 Opcodes. -* instruction summary, H8/500: H8/500 Opcodes. -* instruction summary, SH: SH Opcodes. -* instruction summary, Z8000: Z8000 Opcodes. -* instructions and directives: Statements. -* integer expressions: Integer Exprs. -* integer, 16-byte: Octa. -* integer, 8-byte: Quad. -* integers: Integers. -* integers, 16-bit: hword. -* integers, 32-bit: Int. -* integers, binary: Integers. -* integers, decimal: Integers. -* integers, hexadecimal: Integers. -* integers, octal: Integers. -* integers, one byte: Byte. -* internal as sections: As Sections. -* invocation summary: Overview. -* joining text and data sections: R. -* jump instructions, i386: i386-Opcodes. -* jump optimization, i386: i386-jumps. -* jump/call operands, i386: i386-Syntax. -* label (:): Statements. -* labels: Labels. -* ld: Object. -* length of symbols: Symbol Intro. -* line comment character: Comments. -* line comment character, AMD 29K: AMD29K-Chars. -* line comment character, H8/300: H8/300-Chars. -* line comment character, H8/500: H8/500-Chars. -* line comment character, M680x0: M68K-Chars. -* line comment character, SH: SH-Chars. -* line comment character, Z8000: Z8000-Chars. -* line numbers, in input files: Input Files. -* line numbers, in warnings/errors: Errors. -* line separator character: Statements. -* line separator, H8/300: H8/300-Chars. -* line separator, H8/500: H8/500-Chars. -* line separator, SH: SH-Chars. -* line separator, Z8000: Z8000-Chars. -* lines starting with #: Comments. -* linker: Object. -* linker, and assembler: Secs Background. -* listing control, turning off: Nolist. -* listing control, turning on: List. -* listing control: new page: Eject. -* listing control: paper size: Psize. -* listing control: subtitle: Sbttl. -* listing control: title line: Title. -* listings, enabling: a. -* little endian output, MIPS: Overview. -* little-endian output, MIPS: MIPS Opts. -* local common symbols: Lcomm. -* local labels, retaining in output: L. -* local symbol names: Symbol Names. -* location counter: Dot. -* location counter, advancing: Org. -* logical file name: File. -* logical file name: App-File. -* logical line number: Line. -* logical line numbers: Comments. -* lval: Z8000 Directives. -* M680x0 addressing modes: M68K-Syntax. -* M680x0 architecture options: M68K-Opts. -* M680x0 branch improvement: M68K-Branch. -* M680x0 directives: M68K-Directives. -* M680x0 floating point: M68K-Float. -* M680x0 immediate character: M68K-Chars. -* M680x0 line comment character: M68K-Chars. -* M680x0 opcodes: M68K-opcodes. -* M680x0 options: M68K-Opts. -* M680x0 pseudo-opcodes: M68K-Branch. -* M680x0 size modifiers: M68K-Syntax. -* M680x0 support: M68K-Dependent. -* M680x0 syntax: M68K-Syntax. -* machine dependencies: Machine Dependencies. -* machine directives, AMD 29K: AMD29K Directives. -* machine directives, H8/300 (none): H8/300 Directives. -* machine directives, H8/500 (none): H8/500 Directives. -* machine directives, i960: Directives-i960. -* machine directives, SH (none): SH Directives. -* machine directives, SPARC: Sparc-Directives. -* machine directives, VAX: VAX-directives. -* machine independent directives: Pseudo Ops. -* machine instructions (not covered): Manual. -* machine-independent syntax: Syntax. -* macros: Macro. -* Macros, AMD 29K: AMD29K-Macros. -* macros, count executed: Macro. -* manual, structure and purpose: Manual. -* memory references, i386: i386-Memory. -* merging text and data sections: R. -* messages from as: Errors. -* minus, permitted arguments: Infix Ops. -* MIPS architecture options: MIPS Opts. -* MIPS big-endian output: MIPS Opts. -* MIPS debugging directives: MIPS Stabs. -* MIPS ECOFF sections: MIPS Object. -* MIPS endianness: Overview. -* MIPS ISA: Overview. -* MIPS ISA override: MIPS ISA. -* MIPS little-endian output: MIPS Opts. -* MIPS R2000: MIPS-Dependent. -* MIPS R3000: MIPS-Dependent. -* MIPS R4000: MIPS-Dependent. -* MIPS R6000: MIPS-Dependent. -* mnemonics for opcodes, VAX: VAX-opcodes. -* mnemonics, H8/300: H8/300 Opcodes. -* mnemonics, H8/500: H8/500 Opcodes. -* mnemonics, SH: SH Opcodes. -* mnemonics, Z8000: Z8000 Opcodes. -* Motorola syntax for the 680x0: M68K-Moto-Syntax. -* MRI compatibility mode: M. -* MRI mode, temporarily: MRI. -* multi-line statements: Statements. -* name: Z8000 Directives. -* named section (COFF): Section. -* named sections: Ld Sections. -* names, symbol: Symbol Names. -* naming object file: o. -* new page, in listings: Eject. -* newline (\n): Strings. -* newline, required at file end: Statements. -* null-terminated strings: Asciz. -* number constants: Numbers. -* number of macros executed: Macro. -* numbered subsections: Sub-Sections. -* numbers, 16-bit: hword. -* numeric values: Expressions. -* object file: Object. -* object file format: Object Formats. -* object file name: o. -* object file, after errors: Z. -* obsolescent directives: Deprecated. -* octal character code (\DDD): Strings. -* octal integers: Integers. -* opcode mnemonics, VAX: VAX-opcodes. -* opcode naming, i386: i386-Opcodes. -* opcode prefixes, i386: i386-prefixes. -* opcode suffixes, i386: i386-Syntax. -* opcode summary, H8/300: H8/300 Opcodes. -* opcode summary, H8/500: H8/500 Opcodes. -* opcode summary, SH: SH Opcodes. -* opcode summary, Z8000: Z8000 Opcodes. -* opcodes for AMD 29K: AMD29K Opcodes. -* opcodes, i960: Opcodes for i960. -* opcodes, M680x0: M68K-opcodes. -* operand delimiters, i386: i386-Syntax. -* operand notation, VAX: VAX-operands. -* operands in expressions: Arguments. -* operator precedence: Infix Ops. -* operators, in expressions: Operators. -* operators, permitted arguments: Infix Ops. -* option summary: Overview. -* options for AMD29K (none): AMD29K Options. -* options for i386 (none): i386-Options. -* options for SPARC: Sparc-Opts. -* options for VAX/VMS: VAX-Opts. -* options, all versions of as: Invoking. -* options, command line: Command Line. -* options, H8/300 (none): H8/300 Options. -* options, H8/500 (none): H8/500 Options. -* options, i960: Options-i960. -* options, M680x0: M68K-Opts. -* options, SH (none): SH Options. -* options, Z8000: Z8000 Options. -* other attribute, of a.out symbol: Symbol Other. -* output file: Object. -* padding the location counter: Align. -* padding the location counter given a power of two: P2align. -* padding the location counter given number of bytes: Balign. -* page, in listings: Eject. -* paper size, for listings: Psize. -* paths for .include: I. -* patterns, writing in memory: Fill. -* plus, permitted arguments: Infix Ops. -* precedence of operators: Infix Ops. -* precision, floating point: Flonums. -* prefix operators: Prefix Ops. -* prefixes, i386: i386-prefixes. -* preprocessing: Preprocessing. -* preprocessing, turning on and off: Preprocessing. -* primary attributes, COFF symbols: COFF Symbols. -* protected registers, AMD 29K: AMD29K-Regs. -* pseudo-opcodes, M680x0: M68K-Branch. -* pseudo-ops for branch, VAX: VAX-branch. -* pseudo-ops, machine independent: Pseudo Ops. -* purpose of GNU as: GNU Assembler. -* real-mode code, i386: i386-16bit. -* register names, AMD 29K: AMD29K-Regs. -* register names, H8/300: H8/300-Regs. -* register names, VAX: VAX-operands. -* register operands, i386: i386-Syntax. -* registers, H8/500: H8/500-Regs. -* registers, i386: i386-Regs. -* registers, SH: SH-Regs. -* registers, Z8000: Z8000-Regs. -* relocation: Sections. -* relocation example: Ld Sections. -* repeat prefixes, i386: i386-prefixes. -* return instructions, i386: i386-Syntax. -* rsect: Z8000 Directives. -* search path for .include: I. -* section override prefixes, i386: i386-prefixes. -* section-relative addressing: Secs Background. -* sections: Sections. -* sections in messages, internal: As Sections. -* sections, i386: i386-Syntax. -* sections, named: Ld Sections. -* segm: Z8000 Directives. -* SH addressing modes: SH-Addressing. -* SH floating point (IEEE): SH Floating Point. -* SH line comment character: SH-Chars. -* SH line separator: SH-Chars. -* SH machine directives (none): SH Directives. -* SH opcode summary: SH Opcodes. -* SH options (none): SH Options. -* SH registers: SH-Regs. -* SH support: SH-Dependent. -* single character constant: Chars. -* sixteen bit integers: hword. -* sixteen byte integer: Octa. -* size modifiers, M680x0: M68K-Syntax. -* size prefixes, i386: i386-prefixes. -* size suffixes, H8/300: H8/300 Opcodes. -* sizes operands, i386: i386-Syntax. -* small objects, MIPS ECOFF: MIPS Object. -* SOM symbol attributes: SOM Symbols. -* source program: Input Files. -* source, destination operands; i386: i386-Syntax. -* space used, maximum for assembly: statistics. -* SPARC architectures: Sparc-Opts. -* SPARC floating point (IEEE): Sparc-Float. -* SPARC machine directives: Sparc-Directives. -* SPARC options: Sparc-Opts. -* SPARC support: Sparc-Dependent. -* special characters, M680x0: M68K-Chars. -* special purpose registers, AMD 29K: AMD29K-Regs. -* standard as sections: Secs Background. -* standard input, as input file: Command Line. -* statement on multiple lines: Statements. -* statement separator character: Statements. -* statement separator, H8/300: H8/300-Chars. -* statement separator, H8/500: H8/500-Chars. -* statement separator, SH: SH-Chars. -* statement separator, Z8000: Z8000-Chars. -* statements, structure of: Statements. -* statistics, about assembly: statistics. -* stopping the assembly: Abort. -* string constants: Strings. -* string literals: Ascii. -* string, copying to object file: String. -* structure debugging, COFF: Tag. -* subexpressions: Arguments. -* subtitles for listings: Sbttl. -* subtraction, permitted arguments: Infix Ops. -* summary of options: Overview. -* support: HPPA-Dependent. -* supporting files, including: Include. -* suppressing warnings: W. -* sval: Z8000 Directives. -* symbol attributes: Symbol Attributes. -* symbol attributes, a.out: a.out Symbols. -* symbol attributes, COFF: COFF Symbols. -* symbol attributes, SOM: SOM Symbols. -* symbol descriptor, COFF: Desc. -* symbol names: Symbol Names. -* symbol names, $ in: SH-Chars. -* symbol names, $ in: H8/500-Chars. -* symbol names, local: Symbol Names. -* symbol names, temporary: Symbol Names. -* symbol storage class (COFF): Scl. -* symbol type: Symbol Type. -* symbol type, COFF: Type. -* symbol value: Symbol Value. -* symbol value, setting: Set. -* symbol values, assigning: Setting Symbols. -* symbol, common: Comm. -* symbol, making visible to linker: Global. -* symbolic debuggers, information for: Stab. -* symbols: Symbols. -* symbols with lowercase, VAX/VMS: VAX-Opts. -* symbols, assigning values to: Equ. -* symbols, local common: Lcomm. -* syntax compatibility, i386: i386-Syntax. -* syntax, M680x0: M68K-Syntax. -* syntax, machine-independent: Syntax. -* tab (\t): Strings. -* temporary symbol names: Symbol Names. -* text and data sections, joining: R. -* text section: Ld Sections. -* time, total for assembly: statistics. -* trusted compiler: f. -* turning preprocessing on and off: Preprocessing. -* type of a symbol: Symbol Type. -* undefined section: Ld Sections. -* unsegm: Z8000 Directives. -* value attribute, COFF: Val. -* value of a symbol: Symbol Value. -* VAX bitfields not supported: VAX-no. -* VAX branch improvement: VAX-branch. -* VAX command-line options ignored: VAX-Opts. -* VAX displacement sizing character: VAX-operands. -* VAX floating point: VAX-float. -* VAX immediate character: VAX-operands. -* VAX indirect character: VAX-operands. -* VAX machine directives: VAX-directives. -* VAX opcode mnemonics: VAX-opcodes. -* VAX operand notation: VAX-operands. -* VAX register names: VAX-operands. -* VAX support: Vax-Dependent. -* Vax-11 C compatibility: VAX-Opts. -* VAX/VMS options: VAX-Opts. -* version of as: v. -* VMS (VAX) options: VAX-Opts. -* warning for altered difference tables: K. -* warning messages: Errors. -* warnings, suppressing: W. -* whitespace: Whitespace. -* whitespace, removed by preprocessor: Preprocessing. -* wide floating point directives, VAX: VAX-directives. -* writing patterns in memory: Fill. -* wval: Z8000 Directives. -* Z800 addressing modes: Z8000-Addressing. -* Z8000 directives: Z8000 Directives. -* Z8000 line comment character: Z8000-Chars. -* Z8000 line separator: Z8000-Chars. -* Z8000 opcode summary: Z8000 Opcodes. -* Z8000 options: Z8000 Options. -* Z8000 registers: Z8000-Regs. -* Z8000 support: Z8000-Dependent. -* zero-terminated strings: Asciz. +* Bug Criteria:: Have you found a bug? +* Bug Reporting:: How to report bugs + + +File: as.info, Node: Bug Criteria, Next: Bug Reporting, Up: Reporting Bugs + +Have you found a bug? +===================== + + If you are not sure whether you have found a bug, here are some +guidelines: + + * If the assembler gets a fatal signal, for any input whatever, that + is a `as' bug. Reliable assemblers never crash. + + * If `as' produces an error message for valid input, that is a bug. + + * If `as' does not produce an error message for invalid input, that + is a bug. However, you should note that your idea of "invalid + input" might be our idea of "an extension" or "support for + traditional practice". + + * If you are an experienced user of assemblers, your suggestions for + improvement of `as' are welcome in any case. + + +File: as.info, Node: Bug Reporting, Prev: Bug Criteria, Up: Reporting Bugs + +How to report bugs +================== + + A number of companies and individuals offer support for GNU +products. If you obtained `as' from a support organization, we +recommend you contact that organization first. + + You can find contact information for many support companies and +individuals in the file `etc/SERVICE' in the GNU Emacs distribution. + + In any event, we also recommend that you send bug reports for `as' +to `bug-gnu-utils@prep.ai.mit.edu'. + + The fundamental principle of reporting bugs usefully is this: +*report all the facts*. If you are not sure whether to state a fact or +leave it out, state it! + + Often people omit facts because they think they know what causes the +problem and assume that some details do not matter. Thus, you might +assume that the name of a symbol you use in an example does not matter. +Well, probably it does not, but one cannot be sure. Perhaps the bug +is a stray memory reference which happens to fetch from the location +where that name is stored in memory; perhaps, if the name were +different, the contents of that location would fool the assembler into +doing the right thing despite the bug. Play it safe and give a +specific, complete example. That is the easiest thing for you to do, +and the most helpful. + + Keep in mind that the purpose of a bug report is to enable us to fix +the bug if it is new to us. Therefore, always write your bug reports +on the assumption that the bug has not been reported previously. + + Sometimes people give a few sketchy facts and ask, "Does this ring a +bell?" Those bug reports are useless, and we urge everyone to *refuse +to respond to them* except to chide the sender to report bugs properly. + + To enable us to fix the bug, you should include all these things: + + * The version of `as'. `as' announces it if you start it with the + `--version' argument. + + Without this, we will not know whether there is any point in + looking for the bug in the current version of `as'. + + * Any patches you may have applied to the `as' source. + + * The type of machine you are using, and the operating system name + and version number. + + * What compiler (and its version) was used to compile `as'--e.g. + "`gcc-2.7'". + + * The command arguments you gave the assembler to assemble your + example and observe the bug. To guarantee you will not omit + something important, list them all. A copy of the Makefile (or + the output from make) is sufficient. + + If we were to try to guess the arguments, we would probably guess + wrong and then we might not encounter the bug. + + * A complete input file that will reproduce the bug. If the bug is + observed when the assembler is invoked via a compiler, send the + assembler source, not the high level language source. Most + compilers will produce the assembler source when run with the `-S' + option. If you are using `gcc', use the options `-v + --save-temps'; this will save the assembler source in a file with + an extension of `.s', and also show you exactly how `as' is being + run. + + * A description of what behavior you observe that you believe is + incorrect. For example, "It gets a fatal signal." + + Of course, if the bug is that `as' gets a fatal signal, then we + will certainly notice it. But if the bug is incorrect output, we + might not notice unless it is glaringly wrong. You might as well + not give us a chance to make a mistake. + + Even if the problem you experience is a fatal signal, you should + still say so explicitly. Suppose something strange is going on, + such as, your copy of `as' is out of synch, or you have + encountered a bug in the C library on your system. (This has + happened!) Your copy might crash and ours would not. If you told + us to expect a crash, then when ours fails to crash, we would know + that the bug was not happening for us. If you had not told us to + expect a crash, then we would not be able to draw any conclusion + from our observations. + + * If you wish to suggest changes to the `as' source, send us context + diffs, as generated by `diff' with the `-u', `-c', or `-p' option. + Always send diffs from the old file to the new file. If you even + discuss something in the `as' source, refer to it by context, not + by line number. + + The line numbers in our development sources will not match those + in your sources. Your line numbers would convey no useful + information to us. + + Here are some things that are not necessary: + + * A description of the envelope of the bug. + + Often people who encounter a bug spend a lot of time investigating + which changes to the input file will make the bug go away and which + changes will not affect it. + + This is often time consuming and not very useful, because the way + we will find the bug is by running a single example under the + debugger with breakpoints, not by pure deduction from a series of + examples. We recommend that you save your time for something else. + + Of course, if you can find a simpler example to report *instead* + of the original one, that is a convenience for us. Errors in the + output will be easier to spot, running under the debugger will take + less time, and so on. + + However, simplification is not vital; if you do not want to do + this, report the bug anyway and send us the entire test case you + used. + + * A patch for the bug. + + A patch for the bug does help us if it is a good one. But do not + omit the necessary information, such as the test case, on the + assumption that a patch is all we need. We might see problems + with your patch and decide to fix the problem another way, or we + might not understand it at all. + + Sometimes with a program as complicated as `as' it is very hard to + construct an example that will make the program follow a certain + path through the code. If you do not send us the example, we will + not be able to construct one, so we will not be able to verify + that the bug is fixed. + + And if we cannot understand what bug you are trying to fix, or why + your patch should be an improvement, we will not install it. A + test case will help us to understand. + + * A guess about what the bug is or what it depends on. + + Such guesses are usually wrong. Even we cannot guess right about + such things without first using the debugger to find the facts. + + +File: as.info, Node: Acknowledgements, Next: Index, Prev: Reporting Bugs, Up: Top + +Acknowledgements +**************** + + If you have contributed to `as' and your name isn't listed here, it +is not meant as a slight. We just don't know about it. Send mail to +the maintainer, and we'll correct the situation. Currently the +maintainer is Ken Raeburn (email address `raeburn@cygnus.com'). + + Dean Elsner wrote the original GNU assembler for the VAX.(1) + + Jay Fenlason maintained GAS for a while, adding support for +GDB-specific debug information and the 68k series machines, most of the +preprocessing pass, and extensive changes in `messages.c', +`input-file.c', `write.c'. + + K. Richard Pixley maintained GAS for a while, adding various +enhancements and many bug fixes, including merging support for several +processors, breaking GAS up to handle multiple object file format back +ends (including heavy rewrite, testing, an integration of the coff and +b.out back ends), adding configuration including heavy testing and +verification of cross assemblers and file splits and renaming, +converted GAS to strictly ANSI C including full prototypes, added +support for m680[34]0 and cpu32, did considerable work on i960 +including a COFF port (including considerable amounts of reverse +engineering), a SPARC opcode file rewrite, DECstation, rs6000, and +hp300hpux host ports, updated "know" assertions and made them work, +much other reorganization, cleanup, and lint. + + Ken Raeburn wrote the high-level BFD interface code to replace most +of the code in format-specific I/O modules. + + The original VMS support was contributed by David L. Kashtan. Eric +Youngdale has done much work with it since. + + The Intel 80386 machine description was written by Eliot Dresselhaus. + + Minh Tran-Le at IntelliCorp contributed some AIX 386 support. + + The Motorola 88k machine description was contributed by Devon Bowen +of Buffalo University and Torbjorn Granlund of the Swedish Institute of +Computer Science. + + Keith Knowles at the Open Software Foundation wrote the original +MIPS back end (`tc-mips.c', `tc-mips.h'), and contributed Rose format +support (which hasn't been merged in yet). Ralph Campbell worked with +the MIPS code to support a.out format. + + Support for the Zilog Z8k and Hitachi H8/300 and H8/500 processors +(tc-z8k, tc-h8300, tc-h8500), and IEEE 695 object file format +(obj-ieee), was written by Steve Chamberlain of Cygnus Support. Steve +also modified the COFF back end to use BFD for some low-level +operations, for use with the H8/300 and AMD 29k targets. + + John Gilmore built the AMD 29000 support, added `.include' support, +and simplified the configuration of which versions accept which +directives. He updated the 68k machine description so that Motorola's +opcodes always produced fixed-size instructions (e.g. `jsr'), while +synthetic instructions remained shrinkable (`jbsr'). John fixed many +bugs, including true tested cross-compilation support, and one bug in +relaxation that took a week and required the proverbial one-bit fix. + + Ian Lance Taylor of Cygnus Support merged the Motorola and MIT +syntax for the 68k, completed support for some COFF targets (68k, i386 +SVR3, and SCO Unix), added support for MIPS ECOFF and ELF targets, +wrote the initial RS/6000 and PowerPC assembler, and made a few other +minor patches. + + Steve Chamberlain made `as' able to generate listings. + + Hewlett-Packard contributed support for the HP9000/300. + + Jeff Law wrote GAS and BFD support for the native HPPA object format +(SOM) along with a fairly extensive HPPA testsuite (for both SOM and +ELF object formats). This work was supported by both the Center for +Software Science at the University of Utah and Cygnus Support. + + Support for ELF format files has been worked on by Mark Eichin of +Cygnus Support (original, incomplete implementation for SPARC), Pete +Hoogenboom and Jeff Law at the University of Utah (HPPA mainly), +Michael Meissner of the Open Software Foundation (i386 mainly), and Ken +Raeburn of Cygnus Support (sparc, and some initial 64-bit support). + + Richard Henderson rewrote the Alpha assembler. Klaus Kaempf wrote +GAS and BFD support for openVMS/Alpha. + + Several engineers at Cygnus Support have also provided many small +bug fixes and configuration enhancements. + + Many others have contributed large or small bugfixes and +enhancements. If you have contributed significant work and are not +mentioned on this list, and want to be, let us know. Some of the +history has been lost; we are not intentionally leaving anyone out. + + ---------- Footnotes ---------- + (1) Any more details? diff -urN binutils-2.7/gas/doc/as.info-7 binutils-2.8/gas/doc/as.info-7 --- binutils-2.7/gas/doc/as.info-7 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/doc/as.info-7 Wed Apr 30 13:14:59 1997 @@ -0,0 +1,843 @@ +This is Info file as.info, produced by Makeinfo-1.64 from the input +file ./as.texinfo. + +START-INFO-DIR-ENTRY +* As: (as). The GNU assembler. +END-INFO-DIR-ENTRY + + This file documents the GNU Assembler "as". + + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, provided that +the entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions. + + +File: as.info, Node: Index, Prev: Acknowledgements, Up: Top + +Index +***** + +* Menu: + +* #: Comments. +* #APP: Preprocessing. +* #NO_APP: Preprocessing. +* -: Command Line. +* -enforce-aligned-data: Sparc-Aligned-Data. +* -statistics: statistics. +* -a: a. +* -ac: a. +* -ad: a. +* -ah: a. +* -al: a. +* -an: a. +* -as: a. +* -Asparclet: Sparc-Opts. +* -Asparclite: Sparc-Opts. +* -Av6: Sparc-Opts. +* -Av8: Sparc-Opts. +* -Av9: Sparc-Opts. +* -Av9a: Sparc-Opts. +* -D: D. +* -f: f. +* -I PATH: I. +* -K: K. +* -L: L. +* -M: M. +* -o: o. +* -R: R. +* -v: v. +* -version: v. +* -W: W. +* .o: Object. +* 16-bit code, i386: i386-16bit. +* 29K support: AMD29K-Dependent. +* @word modifier, D10V: D10V-Word. +* $ in symbol names <1>: H8/500-Chars. +* $ in symbol names <2>: SH-Chars. +* $ in symbol names: D10V-Chars. +* -+ option, VAX/VMS: VAX-Opts. +* -A options, i960: Options-i960. +* -b option, i960: Options-i960. +* -D, ignored on VAX: VAX-Opts. +* -d, VAX option: VAX-Opts. +* -EB option (MIPS): MIPS Opts. +* -EL option (MIPS): MIPS Opts. +* -G option (MIPS): MIPS Opts. +* -h option, VAX/VMS: VAX-Opts. +* -J, ignored on VAX: VAX-Opts. +* -no-relax option, i960: Options-i960. +* -nocpp ignored (MIPS): MIPS Opts. +* -S, ignored on VAX: VAX-Opts. +* -T, ignored on VAX: VAX-Opts. +* -V, redundant on VAX: VAX-Opts. +* .insn: MIPS insn. +* .param on HPPA: HPPA Directives. +* .set mipsN: MIPS ISA. +* .set pop: MIPS option stack. +* .set push: MIPS option stack. +* . (symbol): Dot. +* : (label): Statements. +* as bugs, reporting: Bug Reporting. +* as version: v. +* \" (doublequote character): Strings. +* \DDD (octal character code): Strings. +* \XD... (hex character code): Strings. +* \\ (\ character): Strings. +* \b (backspace character): Strings. +* \f (formfeed character): Strings. +* \n (newline character): Strings. +* \r (carriage return character): Strings. +* \t (tab): Strings. +* a.out symbol attributes: a.out Symbols. +* abort directive: Abort. +* ABORT directive: ABORT. +* align directive: Align. +* align directive, SPARC: Sparc-Directives. +* app-file directive: App-File. +* ascii directive: Ascii. +* asciz directive: Asciz. +* balignl directive: Balign. +* balignw directive: Balign. +* balign directive: Balign. +* block directive, AMD 29K: AMD29K Directives. +* bss directive, i960: Directives-i960. +* byte directive: Byte. +* callj, i960 pseudo-opcode: callj-i960. +* code16 directive, i386: i386-16bit. +* code32 directive, i386: i386-16bit. +* common directive, SPARC: Sparc-Directives. +* comm directive: Comm. +* cputype directive, AMD 29K: AMD29K Directives. +* data1 directive, M680x0: M68K-Directives. +* data2 directive, M680x0: M68K-Directives. +* data directive: Data. +* def directive: Def. +* desc directive: Desc. +* dfloat directive, VAX: VAX-directives. +* dim directive: Dim. +* double directive: Double. +* double directive, i386: i386-Float. +* double directive, M680x0: M68K-Float. +* double directive, VAX: VAX-float. +* eject directive: Eject. +* else directive: Else. +* endef directive: Endef. +* endif directive: Endif. +* endm directive: Macro. +* equiv directive: Equiv. +* equ directive: Equ. +* err directive: Err. +* even directive, M680x0: M68K-Directives. +* exitm directive: Macro. +* extended directive, i960: Directives-i960. +* extend directive M680x0: M68K-Float. +* extern directive: Extern. +* ffloat directive, VAX: VAX-directives. +* file directive: File. +* file directive, AMD 29K: AMD29K Directives. +* fill directive: Fill. +* float directive: Float. +* float directive, i386: i386-Float. +* float directive, M680x0: M68K-Float. +* float directive, VAX: VAX-float. +* fwait instruction, i386: i386-Float. +* gbr960, i960 postprocessor: Options-i960. +* gfloat directive, VAX: VAX-directives. +* global directive: Global. +* gp register, MIPS: MIPS Object. +* half directive, SPARC: Sparc-Directives. +* hfloat directive, VAX: VAX-directives. +* hword directive: hword. +* ident directive: Ident. +* ifdef directive: If. +* ifndef directive: If. +* ifnotdef directive: If. +* if directive: If. +* imul instruction, i386: i386-Notes. +* include directive: Include. +* include directive search path: I. +* int directive: Int. +* int directive, H8/300: H8/300 Directives. +* int directive, H8/500: H8/500 Directives. +* int directive, i386: i386-Float. +* int directive, SH: SH Directives. +* irpc directive: Irpc. +* irp directive: Irp. +* lcomm directive: Lcomm. +* ldouble directive M680x0: M68K-Float. +* leafproc directive, i960: Directives-i960. +* lflags directive (ignored): Lflags. +* line directive: Line. +* line directive, AMD 29K: AMD29K Directives. +* linkonce directive: Linkonce. +* list directive: List. +* ln directive: Ln. +* long directive: Long. +* long directive, i386: i386-Float. +* macro directive: Macro. +* mri directive: MRI. +* mul instruction, i386: i386-Notes. +* nolist directive: Nolist. +* octa directive: Octa. +* org directive: Org. +* p2alignl directive: P2align. +* p2alignw directive: P2align. +* p2align directive: P2align. +* proc directive, SPARC: Sparc-Directives. +* psize directive: Psize. +* quad directive: Quad. +* quad directive, i386: i386-Float. +* rept directive: Rept. +* reserve directive, SPARC: Sparc-Directives. +* sbttl directive: Sbttl. +* scl directive: Scl. +* section directive: Section. +* sect directive, AMD 29K: AMD29K Directives. +* seg directive, SPARC: Sparc-Directives. +* set directive: Set. +* short directive: Short. +* single directive: Single. +* single directive, i386: i386-Float. +* size directive: Size. +* skip directive: Skip. +* skip directive, M680x0: M68K-Directives. +* skip directive, SPARC: Sparc-Directives. +* space directive: Space. +* stabX directives: Stab. +* stabd directive: Stab. +* stabn directive: Stab. +* stabs directive: Stab. +* string directive: String. +* string directive on HPPA: HPPA Directives. +* symver directive: Symver. +* sysproc directive, i960: Directives-i960. +* tag directive: Tag. +* text directive: Text. +* tfloat directive, i386: i386-Float. +* title directive: Title. +* type directive: Type. +* use directive, AMD 29K: AMD29K Directives. +* val directive: Val. +* word directive: Word. +* word directive, H8/300: H8/300 Directives. +* word directive, H8/500: H8/500 Directives. +* word directive, i386: i386-Float. +* word directive, SH: SH Directives. +* word directive, SPARC: Sparc-Directives. +* xword directive, SPARC: Sparc-Directives. +* -base-size-default-16: M68K-Opts. +* -base-size-default-32: M68K-Opts. +* -bitwise-or option, M680x0: M68K-Opts. +* -disp-size-default-16: M68K-Opts. +* -disp-size-default-32: M68K-Opts. +* -register-prefix-optional option, M680x0: M68K-Opts. +* -l option, M680x0: M68K-Opts. +* -m68000 and related options: M68K-Opts. +* MIT: M68K-Syntax. +* a.out: Object. +* absolute section: Ld Sections. +* addition, permitted arguments: Infix Ops. +* addresses: Expressions. +* addresses, format of: Secs Background. +* addressing modes, D10V: D10V-Addressing. +* addressing modes, H8/300: H8/300-Addressing. +* addressing modes, H8/500: H8/500-Addressing. +* addressing modes, M680x0: M68K-Syntax. +* addressing modes, SH: SH-Addressing. +* addressing modes, Z8000: Z8000-Addressing. +* advancing location counter: Org. +* altered difference tables: Word. +* alternate syntax for the 680x0: M68K-Moto-Syntax. +* AMD 29K floating point (IEEE): AMD29K Floating Point. +* AMD 29K identifiers: AMD29K-Chars. +* AMD 29K line comment character: AMD29K-Chars. +* AMD 29K machine directives: AMD29K Directives. +* AMD 29K macros: AMD29K-Macros. +* AMD 29K opcodes: AMD29K Opcodes. +* AMD 29K options (none): AMD29K Options. +* AMD 29K protected registers: AMD29K-Regs. +* AMD 29K register names: AMD29K-Regs. +* AMD 29K special purpose registers: AMD29K-Regs. +* AMD 29K support: AMD29K-Dependent. +* architecture options, i960: Options-i960. +* architecture options, M680x0: M68K-Opts. +* architectures, SPARC: Sparc-Opts. +* arguments for addition: Infix Ops. +* arguments for subtraction: Infix Ops. +* arguments in expressions: Arguments. +* arithmetic functions: Operators. +* arithmetic operands: Arguments. +* assembler crash: Bug Criteria. +* assembler internal logic error: As Sections. +* assembler, and linker: Secs Background. +* assembly listings, enabling: a. +* assigning values to symbols <1>: Setting Symbols. +* assigning values to symbols: Equ. +* attributes, symbol: Symbol Attributes. +* auxiliary attributes, COFF symbols: COFF Symbols. +* auxiliary symbol information, COFF: Dim. +* Av7: Sparc-Opts. +* backslash (\\): Strings. +* backspace (\b): Strings. +* big endian output, MIPS: Overview. +* big-endian output, MIPS: MIPS Opts. +* bignums: Bignums. +* binary integers: Integers. +* bitfields, not supported on VAX: VAX-no. +* block: Z8000 Directives. +* branch improvement, M680x0: M68K-Branch. +* branch improvement, VAX: VAX-branch. +* branch recording, i960: Options-i960. +* branch statistics table, i960: Options-i960. +* bss section <1>: bss. +* bss section: Ld Sections. +* bug criteria: Bug Criteria. +* bug reports: Bug Reporting. +* bugs in as: Reporting Bugs. +* bus lock prefixes, i386: i386-prefixes. +* bval: Z8000 Directives. +* call instructions, i386: i386-Opcodes. +* carriage return (\r): Strings. +* character constants: Characters. +* character escape codes: Strings. +* character, single: Chars. +* characters used in symbols: Symbol Intro. +* COFF auxiliary symbol information: Dim. +* COFF structure debugging: Tag. +* COFF symbol attributes: COFF Symbols. +* COFF symbol descriptor: Desc. +* COFF symbol storage class: Scl. +* COFF symbol type: Type. +* COFF symbols, debugging: Def. +* COFF value attribute: Val. +* COMDAT: Linkonce. +* command line conventions: Command Line. +* command-line options ignored, VAX: VAX-Opts. +* comments: Comments. +* comments, M680x0: M68K-Chars. +* comments, removed by preprocessor: Preprocessing. +* common sections: Linkonce. +* common variable storage: bss. +* compare and jump expansions, i960: Compare-and-branch-i960. +* compare/branch instructions, i960: Compare-and-branch-i960. +* conditional assembly: If. +* constant, single character: Chars. +* constants: Constants. +* constants, bignum: Bignums. +* constants, character: Characters. +* constants, converted by preprocessor: Preprocessing. +* constants, floating point: Flonums. +* constants, integer: Integers. +* constants, number: Numbers. +* constants, string: Strings. +* continuing statements: Statements. +* conversion instructions, i386: i386-Opcodes. +* coprocessor wait, i386: i386-prefixes. +* crash of assembler: Bug Criteria. +* current address: Dot. +* current address, advancing: Org. +* D10V @word modifier: D10V-Word. +* D10V addressing modes: D10V-Addressing. +* D10V floating point: D10V-Float. +* D10V line comment character: D10V-Chars. +* D10V opcode summary: D10V-Opcodes. +* D10V optimization: Overview. +* D10V options: D10V-Opts. +* D10V registers: D10V-Regs. +* D10V size modifiers: D10V-Size. +* D10V sub-instruction ordering: D10V-Chars. +* D10V sub-instructions: D10V-Subs. +* D10V support: D10V-Dependent. +* D10V syntax: D10V-Syntax. +* data alignment on SPARC: Sparc-Aligned-Data. +* data and text sections, joining: R. +* data section: Ld Sections. +* debuggers, and symbol order: Symbols. +* debugging COFF symbols: Def. +* decimal integers: Integers. +* deprecated directives: Deprecated. +* descriptor, of a.out symbol: Symbol Desc. +* difference tables altered: Word. +* difference tables, warning: K. +* directives and instructions: Statements. +* directives, M680x0: M68K-Directives. +* directives, machine independent: Pseudo Ops. +* directives, Z8000: Z8000 Directives. +* displacement sizing character, VAX: VAX-operands. +* dot (symbol): Dot. +* doublequote (\"): Strings. +* ECOFF sections: MIPS Object. +* eight-byte integer: Quad. +* empty expressions: Empty Exprs. +* emulation: Overview. +* endianness, MIPS: Overview. +* EOF, newline must precede: Statements. +* error messsages: Errors. +* error on valid input: Bug Criteria. +* errors, continuing after: Z. +* escape codes, character: Strings. +* even: Z8000 Directives. +* expr (internal section): As Sections. +* expression arguments: Arguments. +* expressions: Expressions. +* expressions, empty: Empty Exprs. +* expressions, integer: Integer Exprs. +* faster processing (-f): f. +* fatal signal: Bug Criteria. +* file name, logical <1>: File. +* file name, logical: App-File. +* files, including: Include. +* files, input: Input Files. +* filling memory <1>: Skip. +* filling memory: Space. +* floating point numbers: Flonums. +* floating point numbers (double): Double. +* floating point numbers (single) <1>: Float. +* floating point numbers (single): Single. +* floating point, AMD 29K (IEEE): AMD29K Floating Point. +* floating point, D10V: D10V-Float. +* floating point, H8/300 (IEEE): H8/300 Floating Point. +* floating point, H8/500 (IEEE): H8/500 Floating Point. +* floating point, HPPA (IEEE): HPPA Floating Point. +* floating point, i386: i386-Float. +* floating point, i960 (IEEE): Floating Point-i960. +* floating point, M680x0: M68K-Float. +* floating point, SH (IEEE): SH Floating Point. +* floating point, SPARC (IEEE): Sparc-Float. +* floating point, VAX: VAX-float. +* flonums: Flonums. +* format of error messages: Errors. +* format of warning messages: Errors. +* formfeed (\f): Strings. +* functions, in expressions: Operators. +* global: Z8000 Directives. +* grouping data: Sub-Sections. +* H8/300 addressing modes: H8/300-Addressing. +* H8/300 floating point (IEEE): H8/300 Floating Point. +* H8/300 line comment character: H8/300-Chars. +* H8/300 line separator: H8/300-Chars. +* H8/300 machine directives (none): H8/300 Directives. +* H8/300 opcode summary: H8/300 Opcodes. +* H8/300 options (none): H8/300 Options. +* H8/300 registers: H8/300-Regs. +* H8/300 size suffixes: H8/300 Opcodes. +* H8/300 support: H8/300-Dependent. +* H8/300H, assembling for: H8/300 Directives. +* H8/500 addressing modes: H8/500-Addressing. +* H8/500 floating point (IEEE): H8/500 Floating Point. +* H8/500 line comment character: H8/500-Chars. +* H8/500 line separator: H8/500-Chars. +* H8/500 machine directives (none): H8/500 Directives. +* H8/500 opcode summary: H8/500 Opcodes. +* H8/500 options (none): H8/500 Options. +* H8/500 registers: H8/500-Regs. +* H8/500 support: H8/500-Dependent. +* hex character code (\XD...): Strings. +* hexadecimal integers: Integers. +* HPPA directives not supported: HPPA Directives. +* HPPA floating point (IEEE): HPPA Floating Point. +* HPPA Syntax: HPPA Options. +* HPPA-only directives: HPPA Directives. +* i386 16-bit code: i386-16bit. +* i386 fwait instruction: i386-Float. +* i386 mul, imul instructions: i386-Notes. +* i386 conversion instructions: i386-Opcodes. +* i386 floating point: i386-Float. +* i386 immediate operands: i386-Syntax. +* i386 jump optimization: i386-jumps. +* i386 jump, call, return: i386-Syntax. +* i386 jump/call operands: i386-Syntax. +* i386 memory references: i386-Memory. +* i386 opcode naming: i386-Opcodes. +* i386 opcode prefixes: i386-prefixes. +* i386 options (none): i386-Options. +* i386 register operands: i386-Syntax. +* i386 registers: i386-Regs. +* i386 sections: i386-Syntax. +* i386 size suffixes: i386-Syntax. +* i386 source, destination operands: i386-Syntax. +* i386 support: i386-Dependent. +* i386 syntax compatibility: i386-Syntax. +* i80306 support: i386-Dependent. +* i960 callj pseudo-opcode: callj-i960. +* i960 architecture options: Options-i960. +* i960 branch recording: Options-i960. +* i960 compare and jump expansions: Compare-and-branch-i960. +* i960 compare/branch instructions: Compare-and-branch-i960. +* i960 floating point (IEEE): Floating Point-i960. +* i960 machine directives: Directives-i960. +* i960 opcodes: Opcodes for i960. +* i960 options: Options-i960. +* i960 support: i960-Dependent. +* identifiers, AMD 29K: AMD29K-Chars. +* immediate character, M680x0: M68K-Chars. +* immediate character, VAX: VAX-operands. +* immediate operands, i386: i386-Syntax. +* indirect character, VAX: VAX-operands. +* infix operators: Infix Ops. +* inhibiting interrupts, i386: i386-prefixes. +* input: Input Files. +* input file linenumbers: Input Files. +* instruction set, M680x0: M68K-opcodes. +* instruction summary, D10V: D10V-Opcodes. +* instruction summary, H8/300: H8/300 Opcodes. +* instruction summary, H8/500: H8/500 Opcodes. +* instruction summary, SH: SH Opcodes. +* instruction summary, Z8000: Z8000 Opcodes. +* instructions and directives: Statements. +* integer expressions: Integer Exprs. +* integer, 16-byte: Octa. +* integer, 8-byte: Quad. +* integers: Integers. +* integers, 16-bit: hword. +* integers, 32-bit: Int. +* integers, binary: Integers. +* integers, decimal: Integers. +* integers, hexadecimal: Integers. +* integers, octal: Integers. +* integers, one byte: Byte. +* internal as sections: As Sections. +* invalid input: Bug Criteria. +* invocation summary: Overview. +* joining text and data sections: R. +* jump instructions, i386: i386-Opcodes. +* jump optimization, i386: i386-jumps. +* jump/call operands, i386: i386-Syntax. +* label (:): Statements. +* labels: Labels. +* ld: Object. +* length of symbols: Symbol Intro. +* line comment character: Comments. +* line comment character, AMD 29K: AMD29K-Chars. +* line comment character, D10V: D10V-Chars. +* line comment character, H8/300: H8/300-Chars. +* line comment character, H8/500: H8/500-Chars. +* line comment character, M680x0: M68K-Chars. +* line comment character, SH: SH-Chars. +* line comment character, Z8000: Z8000-Chars. +* line numbers, in input files: Input Files. +* line numbers, in warnings/errors: Errors. +* line separator character: Statements. +* line separator, H8/300: H8/300-Chars. +* line separator, H8/500: H8/500-Chars. +* line separator, SH: SH-Chars. +* line separator, Z8000: Z8000-Chars. +* lines starting with #: Comments. +* linker: Object. +* linker, and assembler: Secs Background. +* listing control, turning off: Nolist. +* listing control, turning on: List. +* listing control: new page: Eject. +* listing control: paper size: Psize. +* listing control: subtitle: Sbttl. +* listing control: title line: Title. +* listings, enabling: a. +* little endian output, MIPS: Overview. +* little-endian output, MIPS: MIPS Opts. +* local common symbols: Lcomm. +* local labels, retaining in output: L. +* local symbol names: Symbol Names. +* location counter: Dot. +* location counter, advancing: Org. +* logical file name <1>: File. +* logical file name: App-File. +* logical line number: Line. +* logical line numbers: Comments. +* lval: Z8000 Directives. +* M680x0 addressing modes: M68K-Syntax. +* M680x0 architecture options: M68K-Opts. +* M680x0 branch improvement: M68K-Branch. +* M680x0 directives: M68K-Directives. +* M680x0 floating point: M68K-Float. +* M680x0 immediate character: M68K-Chars. +* M680x0 line comment character: M68K-Chars. +* M680x0 opcodes: M68K-opcodes. +* M680x0 options: M68K-Opts. +* M680x0 pseudo-opcodes: M68K-Branch. +* M680x0 size modifiers: M68K-Syntax. +* M680x0 support: M68K-Dependent. +* M680x0 syntax: M68K-Syntax. +* machine dependencies: Machine Dependencies. +* machine directives, AMD 29K: AMD29K Directives. +* machine directives, H8/300 (none): H8/300 Directives. +* machine directives, H8/500 (none): H8/500 Directives. +* machine directives, i960: Directives-i960. +* machine directives, SH (none): SH Directives. +* machine directives, SPARC: Sparc-Directives. +* machine directives, VAX: VAX-directives. +* machine independent directives: Pseudo Ops. +* machine instructions (not covered): Manual. +* machine-independent syntax: Syntax. +* macros: Macro. +* Macros, AMD 29K: AMD29K-Macros. +* macros, count executed: Macro. +* manual, structure and purpose: Manual. +* memory references, i386: i386-Memory. +* merging text and data sections: R. +* messages from as: Errors. +* minus, permitted arguments: Infix Ops. +* MIPS architecture options: MIPS Opts. +* MIPS big-endian output: MIPS Opts. +* MIPS debugging directives: MIPS Stabs. +* MIPS ECOFF sections: MIPS Object. +* MIPS endianness: Overview. +* MIPS ISA: Overview. +* MIPS ISA override: MIPS ISA. +* MIPS little-endian output: MIPS Opts. +* MIPS option stack: MIPS option stack. +* MIPS processor: MIPS-Dependent. +* mnemonics for opcodes, VAX: VAX-opcodes. +* mnemonics, D10V: D10V-Opcodes. +* mnemonics, H8/300: H8/300 Opcodes. +* mnemonics, H8/500: H8/500 Opcodes. +* mnemonics, SH: SH Opcodes. +* mnemonics, Z8000: Z8000 Opcodes. +* Motorola syntax for the 680x0: M68K-Moto-Syntax. +* MRI compatibility mode: M. +* MRI mode, temporarily: MRI. +* multi-line statements: Statements. +* name: Z8000 Directives. +* named section: Section. +* named sections: Ld Sections. +* names, symbol: Symbol Names. +* naming object file: o. +* new page, in listings: Eject. +* newline (\n): Strings. +* newline, required at file end: Statements. +* null-terminated strings: Asciz. +* number constants: Numbers. +* number of macros executed: Macro. +* numbered subsections: Sub-Sections. +* numbers, 16-bit: hword. +* numeric values: Expressions. +* object file: Object. +* object file format: Object Formats. +* object file name: o. +* object file, after errors: Z. +* obsolescent directives: Deprecated. +* octal character code (\DDD): Strings. +* octal integers: Integers. +* opcode mnemonics, VAX: VAX-opcodes. +* opcode naming, i386: i386-Opcodes. +* opcode prefixes, i386: i386-prefixes. +* opcode suffixes, i386: i386-Syntax. +* opcode summary, D10V: D10V-Opcodes. +* opcode summary, H8/300: H8/300 Opcodes. +* opcode summary, H8/500: H8/500 Opcodes. +* opcode summary, SH: SH Opcodes. +* opcode summary, Z8000: Z8000 Opcodes. +* opcodes for AMD 29K: AMD29K Opcodes. +* opcodes, i960: Opcodes for i960. +* opcodes, M680x0: M68K-opcodes. +* operand delimiters, i386: i386-Syntax. +* operand notation, VAX: VAX-operands. +* operands in expressions: Arguments. +* operator precedence: Infix Ops. +* operators, in expressions: Operators. +* operators, permitted arguments: Infix Ops. +* optimization, D10V: Overview. +* option summary: Overview. +* options for AMD29K (none): AMD29K Options. +* options for i386 (none): i386-Options. +* options for SPARC: Sparc-Opts. +* options for VAX/VMS: VAX-Opts. +* options, all versions of as: Invoking. +* options, command line: Command Line. +* options, D10V: D10V-Opts. +* options, H8/300 (none): H8/300 Options. +* options, H8/500 (none): H8/500 Options. +* options, i960: Options-i960. +* options, M680x0: M68K-Opts. +* options, SH (none): SH Options. +* options, Z8000: Z8000 Options. +* other attribute, of a.out symbol: Symbol Other. +* output file: Object. +* padding the location counter: Align. +* padding the location counter given a power of two: P2align. +* padding the location counter given number of bytes: Balign. +* page, in listings: Eject. +* paper size, for listings: Psize. +* paths for .include: I. +* patterns, writing in memory: Fill. +* plus, permitted arguments: Infix Ops. +* precedence of operators: Infix Ops. +* precision, floating point: Flonums. +* prefix operators: Prefix Ops. +* prefixes, i386: i386-prefixes. +* preprocessing: Preprocessing. +* preprocessing, turning on and off: Preprocessing. +* primary attributes, COFF symbols: COFF Symbols. +* protected registers, AMD 29K: AMD29K-Regs. +* pseudo-opcodes, M680x0: M68K-Branch. +* pseudo-ops for branch, VAX: VAX-branch. +* pseudo-ops, machine independent: Pseudo Ops. +* purpose of GNU as: GNU Assembler. +* real-mode code, i386: i386-16bit. +* register names, AMD 29K: AMD29K-Regs. +* register names, H8/300: H8/300-Regs. +* register names, VAX: VAX-operands. +* register operands, i386: i386-Syntax. +* registers, D10V: D10V-Regs. +* registers, H8/500: H8/500-Regs. +* registers, i386: i386-Regs. +* registers, SH: SH-Regs. +* registers, Z8000: Z8000-Regs. +* relocation: Sections. +* relocation example: Ld Sections. +* repeat prefixes, i386: i386-prefixes. +* reporting bugs in as: Reporting Bugs. +* return instructions, i386: i386-Syntax. +* rsect: Z8000 Directives. +* search path for .include: I. +* section override prefixes, i386: i386-prefixes. +* section-relative addressing: Secs Background. +* sections: Sections. +* sections in messages, internal: As Sections. +* sections, i386: i386-Syntax. +* sections, named: Ld Sections. +* segm: Z8000 Directives. +* SH addressing modes: SH-Addressing. +* SH floating point (IEEE): SH Floating Point. +* SH line comment character: SH-Chars. +* SH line separator: SH-Chars. +* SH machine directives (none): SH Directives. +* SH opcode summary: SH Opcodes. +* SH options (none): SH Options. +* SH registers: SH-Regs. +* SH support: SH-Dependent. +* single character constant: Chars. +* sixteen bit integers: hword. +* sixteen byte integer: Octa. +* size modifiers, D10V: D10V-Size. +* size modifiers, M680x0: M68K-Syntax. +* size prefixes, i386: i386-prefixes. +* size suffixes, H8/300: H8/300 Opcodes. +* sizes operands, i386: i386-Syntax. +* small objects, MIPS ECOFF: MIPS Object. +* SOM symbol attributes: SOM Symbols. +* source program: Input Files. +* source, destination operands; i386: i386-Syntax. +* space used, maximum for assembly: statistics. +* SPARC architectures: Sparc-Opts. +* SPARC data alignment: Sparc-Aligned-Data. +* SPARC floating point (IEEE): Sparc-Float. +* SPARC machine directives: Sparc-Directives. +* SPARC options: Sparc-Opts. +* SPARC support: Sparc-Dependent. +* special characters, M680x0: M68K-Chars. +* special purpose registers, AMD 29K: AMD29K-Regs. +* standard as sections: Secs Background. +* standard input, as input file: Command Line. +* statement on multiple lines: Statements. +* statement separator character: Statements. +* statement separator, H8/300: H8/300-Chars. +* statement separator, H8/500: H8/500-Chars. +* statement separator, SH: SH-Chars. +* statement separator, Z8000: Z8000-Chars. +* statements, structure of: Statements. +* statistics, about assembly: statistics. +* stopping the assembly: Abort. +* string constants: Strings. +* string literals: Ascii. +* string, copying to object file: String. +* structure debugging, COFF: Tag. +* sub-instruction ordering, D10V: D10V-Chars. +* sub-instructions, D10V: D10V-Subs. +* subexpressions: Arguments. +* subtitles for listings: Sbttl. +* subtraction, permitted arguments: Infix Ops. +* summary of options: Overview. +* support: HPPA-Dependent. +* supporting files, including: Include. +* suppressing warnings: W. +* sval: Z8000 Directives. +* symbol attributes: Symbol Attributes. +* symbol attributes, a.out: a.out Symbols. +* symbol attributes, COFF: COFF Symbols. +* symbol attributes, SOM: SOM Symbols. +* symbol descriptor, COFF: Desc. +* symbol names: Symbol Names. +* symbol names, $ in <1>: SH-Chars. +* symbol names, $ in <2>: D10V-Chars. +* symbol names, $ in: H8/500-Chars. +* symbol names, local: Symbol Names. +* symbol names, temporary: Symbol Names. +* symbol storage class (COFF): Scl. +* symbol type: Symbol Type. +* symbol type, COFF: Type. +* symbol value: Symbol Value. +* symbol value, setting: Set. +* symbol values, assigning: Setting Symbols. +* symbol versioning: Symver. +* symbol, common: Comm. +* symbol, making visible to linker: Global. +* symbolic debuggers, information for: Stab. +* symbols: Symbols. +* symbols with lowercase, VAX/VMS: VAX-Opts. +* symbols, assigning values to: Equ. +* symbols, local common: Lcomm. +* syntax compatibility, i386: i386-Syntax. +* syntax, D10V: D10V-Syntax. +* syntax, M680x0: M68K-Syntax. +* syntax, machine-independent: Syntax. +* tab (\t): Strings. +* temporary symbol names: Symbol Names. +* text and data sections, joining: R. +* text section: Ld Sections. +* time, total for assembly: statistics. +* trusted compiler: f. +* turning preprocessing on and off: Preprocessing. +* type of a symbol: Symbol Type. +* undefined section: Ld Sections. +* unsegm: Z8000 Directives. +* value attribute, COFF: Val. +* value of a symbol: Symbol Value. +* VAX bitfields not supported: VAX-no. +* VAX branch improvement: VAX-branch. +* VAX command-line options ignored: VAX-Opts. +* VAX displacement sizing character: VAX-operands. +* VAX floating point: VAX-float. +* VAX immediate character: VAX-operands. +* VAX indirect character: VAX-operands. +* VAX machine directives: VAX-directives. +* VAX opcode mnemonics: VAX-opcodes. +* VAX operand notation: VAX-operands. +* VAX register names: VAX-operands. +* VAX support: Vax-Dependent. +* Vax-11 C compatibility: VAX-Opts. +* VAX/VMS options: VAX-Opts. +* version of as: v. +* versions of symbols: Symver. +* VMS (VAX) options: VAX-Opts. +* warning for altered difference tables: K. +* warning messages: Errors. +* warnings, suppressing: W. +* whitespace: Whitespace. +* whitespace, removed by preprocessor: Preprocessing. +* wide floating point directives, VAX: VAX-directives. +* writing patterns in memory: Fill. +* wval: Z8000 Directives. +* Z800 addressing modes: Z8000-Addressing. +* Z8000 directives: Z8000 Directives. +* Z8000 line comment character: Z8000-Chars. +* Z8000 line separator: Z8000-Chars. +* Z8000 opcode summary: Z8000 Opcodes. +* Z8000 options: Z8000 Options. +* Z8000 registers: Z8000-Regs. +* Z8000 support: Z8000-Dependent. +* zero-terminated strings: Asciz. + + diff -urN binutils-2.7/gas/doc/as.texinfo binutils-2.8/gas/doc/as.texinfo --- binutils-2.7/gas/doc/as.texinfo Wed Jul 10 12:45:03 1996 +++ binutils-2.8/gas/doc/as.texinfo Wed Apr 30 12:53:27 1997 @@ -1,5 +1,5 @@ \input texinfo @c -*-Texinfo-*- -@c Copyright (c) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +@c Copyright (c) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. @c UPDATE!! On future updates-- @c (1) check for new machine-dep cmdline options in @c md_parse_option definitions in config/tc-*.c @@ -82,7 +82,7 @@ @ifinfo This file documents the GNU Assembler "@value{AS}". -Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -137,7 +137,7 @@ @end tex @vskip 0pt plus 1filll -Copyright @copyright{} 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -170,6 +170,7 @@ * Expressions:: Expressions * Pseudo Ops:: Assembler Directives * Machine Dependencies:: Machine Dependent Features +* Reporting Bugs:: Reporting Bugs * Acknowledgements:: Who Did What * Index:: Index @end menu @@ -194,13 +195,17 @@ @c We don't use deffn and friends for the following because they seem @c to be limited to one line for the header. @smallexample -@value{AS} [ -a[dhlns][=file] ] [ -D ] [ --defsym @var{sym}=@var{val} ] +@value{AS} [ -a[cdhlns][=file] ] [ -D ] [ --defsym @var{sym}=@var{val} ] [ -f ] [ --help ] [ -I @var{dir} ] [ -J ] [ -K ] [ -L ] [ -o @var{objfile} ] [ -R ] [ --statistics ] [ -v ] [ -version ] [ --version ] [ -W ] [ -w ] [ -x ] [ -Z ] @ifset A29K @c am29k has no machine-dependent assembler options @end ifset +@ifset D10V + [ -O ] +@end ifset + @ifset H8 @c Hitachi family chips have no machine-dependent assembler options @end ifset @@ -209,7 +214,7 @@ @end ifset @ifset SPARC @c The order here is important. See c-sparc.texi. - [ -Av6 | -Av7 | -Av8 | -Asparclite | -Av9 | -Av9a ] + [ -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite | -Av9 | -Av9a ] [ -xarch=v8plus | -xarch=v8plusa ] [ -bump ] @end ifset @ifset Z8000 @@ -347,6 +352,17 @@ @end table @end ifset +@ifset D10V +The following options are available when @value{AS} is configured for +a D10V processor. +@table @code +@cindex D10V optimization +@cindex optimization, D10V +@item -O +Optimize output by parallelizing instructions. +@end table +@end ifset + @ifset I960 The following options are available when @value{AS} is configured for the Intel 80960 processor. @@ -374,8 +390,8 @@ @item -l Shorten references to undefined symbols, to one word instead of two. -@item -m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 -@itemx | -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -mcpu32 +@item -m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060 +@itemx | -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -mcpu32 | -m5200 Specify what processor in the 68000 family is the target. The default is normally the 68020, but this can be changed at configuration time. @@ -398,7 +414,7 @@ for the SPARC architecture: @table @code -@item -Av6 | -Av7 | -Av8 | -Asparclite | -Av9 | -Av9a +@item -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite | -Av9 | -Av9a Explicitly select a variant of the SPARC architecture. @item -xarch=v8plus | -xarch=v8plusa @@ -841,7 +857,7 @@ assembler.) @menu -* a:: -a[dhlns] enable listings +* a:: -a[cdhlns] enable listings * D:: -D for compatibility * f:: -f to work faster * I:: -I for .include search path @@ -863,9 +879,10 @@ @end menu @node a -@section Enable Listings: @code{-a[dhlns]} +@section Enable Listings: @code{-a[cdhlns]} @kindex -a +@kindex -ac @kindex -ad @kindex -ah @kindex -al @@ -884,6 +901,11 @@ @samp{-g} be used, and that assembly listings (@samp{-al}) be requested also. +Use the @samp{-ac} option to omit false conditionals from a listing. Any lines +which are not assembled because of a false @code{.if} (or @code{.ifdef}, or any +other conditional), or a true @code{.if} followed by an @code{.else}, will be +omitted from the listing. + Use the @samp{-ad} option to omit debugging directives from the listing. @@ -993,8 +1015,9 @@ compatible with the @code{ASM68K} or the @code{ASM960} (depending upon the configured target) assembler from Microtec Research. The exact nature of the MRI syntax will not be documented here; see the MRI manuals for more -information. The purpose of this option is to permit assembling existing MRI -assembler code using @code{@value{AS}}. +information. Note in particular that the handling of macros and macro +arguments is somewhat different. The purpose of this option is to permit +assembling existing MRI assembler code using @code{@value{AS}}. The MRI compatibility is not complete. Certain operations of the MRI assembler depend upon its object file format, and can not be supported using other object @@ -2283,10 +2306,19 @@ your program starts running, all the contents of the bss section are zeroed bytes. -Addresses in the bss section are allocated with special directives; you -may not assemble anything directly into the bss section. Hence there -are no bss subsections. @xref{Comm,,@code{.comm}}, -@pxref{Lcomm,,@code{.lcomm}}. +The @code{.lcomm} pseudo-op defines a symbol in the bss section; see +@ref{Lcomm,,@code{.lcomm}}. + +The @code{.comm} pseudo-op may be used to declare a common symbol, which is +another form of uninitialized symbol; see @xref{Comm,,@code{.comm}}. + +@ifset GENERIC +When assembling for a target which supports multiple sections, such as ELF or +COFF, you may switch into the @code{.bss} section and define symbols as usual; +see @ref{Section,,@code{.section}}. You may only assemble zero values into the +section. Typically the section will only contain symbol definitions and +@code{.skip} directives (@pxref{Skip,,@code{.skip}}). +@end ifset @node Symbols @chapter Symbols @@ -2415,7 +2447,7 @@ If the label is written @samp{1:} then the digit is @samp{1}. And so on up through @samp{9:}. -@item @ctrl{A} +@item @kbd{C-A} This unusual character is included so you do not accidentally invent a symbol of the same name. The character has ASCII value @samp{\001}. @@ -2427,8 +2459,8 @@ through @samp{9:}. @end table -For instance, the first @code{1:} is named @code{L1@ctrl{A}1}, the 44th -@code{3:} is named @code{L3@ctrl{A}44}. +For instance, the first @code{1:} is named @code{L1@kbd{C-A}1}, the 44th +@code{3:} is named @code{L3@kbd{C-A}44}. @node Dot @section The Special Dot Symbol @@ -2867,6 +2899,8 @@ * Endif:: @code{.endif} * Equ:: @code{.equ @var{symbol}, @var{expression}} +* Equiv:: @code{.equiv @var{symbol}, @var{expression}} +* Err:: @code{.err} * Extern:: @code{.extern} @ifclear no-file-dir * File:: @code{.file @var{string}} @@ -2928,6 +2962,9 @@ @end ifset * String:: @code{.string "@var{str}"} +@ifset ELF +* Symver:: @code{.symver @var{name},@var{name2@@nodename}} +@end ifset @ifset COFF * Tag:: @code{.tag @var{structname}} @end ifset @@ -2969,18 +3006,27 @@ @end ifset @node Align -@section @code{.align @var{abs-expr} , @var{abs-expr}} +@section @code{.align @var{abs-expr}, @var{abs-expr}, @var{abs-expr}} @cindex padding the location counter @cindex @code{align} directive -Pad the location counter (in the current subsection) to a particular -storage boundary. The first expression (which must be absolute) is the -alignment required, as described below. -The second expression (also absolute) gives the value to be stored in -the padding bytes. It (and the comma) may be omitted. If it is -omitted, the padding bytes are zero. -For the alpha, if the section is marked as containing code and the -padding expression is omitted, then the space is filled with no-ops. +Pad the location counter (in the current subsection) to a particular storage +boundary. The first expression (which must be absolute) is the alignment +required, as described below. + +The second expression (also absolute) gives the fill value to be stored in the +padding bytes. It (and the comma) may be omitted. If it is omitted, the +padding bytes are normally zero. However, on some systems, if the section is +marked as containing code and the fill value is omitted, the space is filled +with no-op instructions. + +The third expression is also absolute, and is also optional. If it is present, +it is the maximum number of bytes that should be skipped by this alignment +directive. If doing the alignment would require skipping more bytes than the +specified maximum, then the alignment is not done at all. You can omit the +fill value (the second argument) entirely by simply using two commas after the +required alignment; this can be useful if you want the alignment to be filled +with no-op instructions when appropriate. The way the required alignment is specified varies from system to system. For the a29k, hppa, m68k, m88k, w65, sparc, and Hitachi SH, and i386 using ELF @@ -3039,7 +3085,7 @@ a zero byte. The ``z'' in @samp{.asciz} stands for ``zero''. @node Balign -@section @code{.balign[wl] @var{abs-expr} , @var{abs-expr}} +@section @code{.balign[wl] @var{abs-expr}, @var{abs-expr}, @var{abs-expr}} @cindex padding the location counter given number of bytes @cindex @code{balign} directive @@ -3049,9 +3095,19 @@ the location counter until it is a multiple of 8. If the location counter is already a multiple of 8, no change is needed. -The second expression (also absolute) gives the value to be stored in -the padding bytes. It (and the comma) may be omitted. If it is -omitted, the padding bytes are zero. +The second expression (also absolute) gives the fill value to be stored in the +padding bytes. It (and the comma) may be omitted. If it is omitted, the +padding bytes are normally zero. However, on some systems, if the section is +marked as containing code and the fill value is omitted, the space is filled +with no-op instructions. + +The third expression is also absolute, and is also optional. If it is present, +it is the maximum number of bytes that should be skipped by this alignment +directive. If doing the alignment would require skipping more bytes than the +specified maximum, then the alignment is not done at all. You can omit the +fill value (the second argument) entirely by simply using two commas after the +required alignment; this can be useful if you want the alignment to be filled +with no-op instructions when appropriate. @cindex @code{balignw} directive @cindex @code{balignl} directive @@ -3077,13 +3133,26 @@ @cindex @code{comm} directive @cindex symbol, common -@code{.comm} declares a named common area in the bss section. Normally -@code{@value{LD}} reserves memory addresses for it during linking, so no partial -program defines the location of the symbol. Use @code{.comm} to tell -@code{@value{LD}} that it must be at least @var{length} bytes long. @code{@value{LD}} -allocates space for each @code{.comm} symbol that is at least as -long as the longest @code{.comm} request in any of the partial programs -linked. @var{length} is an absolute expression. +@code{.comm} declares a common symbol named @var{symbol}. When linking, a +common symbol in one object file may be merged with a defined or common symbol +of the same name in another object file. If @code{@value{LD}} does not see a +definition for the symbol--just one or more common symbols--then it will +allocate @var{length} bytes of uninitialized memory. @var{length} must be an +absolute expression. If @code{@value{LD}} sees multiple common symbols with +the same name, and they do not all have the same size, it will allocate space +using the largest size. + +@ifset ELF +When using ELF, the @code{.comm} directive takes an optional third argument. +This is the desired alignment of the symbol, specified as a byte boundary (for +example, an alignment of 16 means that the least significant 4 bits of the +address should be zero). The alignment must be an absolute expression, and it +must be a power of two. If @code{@value{LD}} allocates uninitialized memory +for the common symbol, it will use the alignment when placing the symbol. If +no alignment is specified, @code{@value{AS}} will set the alignment to the +largest power of two less than or equal to the size of the symbol, up to a +maximum of 16. +@end ifset @ifset HPPA The syntax for @code{.comm} differs slightly on the HPPA. The syntax is @@ -3235,6 +3304,27 @@ @samp{@var{symbol} .equ @var{expression}}. @end ifset +@node Equiv +@section @code{.equiv @var{symbol}, @var{expression}} +@cindex @code{equiv} directive +The @code{.equiv} directive is like @code{.equ} and @code{.set}, except that +the assembler will signal an error if @var{symbol} is already defined. + +Except for the contents of the error message, this is roughly equivalent to +@smallexample +.ifdef SYM +.err +.endif +.equ SYM,VAL +@end smallexample + +@node Err +@section @code{.err} +@cindex @code{err} directive +If @code{@value{AS}} assembles a @code{.err} directive, it will print an error +message and, unless the @code{-Z} option was used, it will not generate an +object file. This can be used to signal error an conditionally compiled code. + @node Extern @section @code{.extern} @@ -3496,6 +3586,11 @@ is not declared global (@pxref{Global,,@code{.global}}), so is normally not visible to @code{@value{LD}}. +@ifset GENERIC +Some targets permit a third argument to be used with @code{.lcomm}. This +argument specifies the desired alignment of the symbol in the bss section. +@end ifset + @ifset HPPA The syntax for @code{.lcomm} differs slightly on the HPPA. The syntax is @samp{@var{symbol} .lcomm, @var{length}}; @var{symbol} is optional. @@ -3813,7 +3908,7 @@ @var{fill} defaults to zero. @node P2align -@section @code{.p2align[wl] @var{abs-expr} , @var{abs-expr}} +@section @code{.p2align[wl] @var{abs-expr}, @var{abs-expr}, @var{abs-expr}} @cindex padding the location counter given a power of two @cindex @code{p2align} directive @@ -3824,9 +3919,19 @@ counter until it a multiple of 8. If the location counter is already a multiple of 8, no change is needed. -The second expression (also absolute) gives the value to be stored in -the padding bytes. It (and the comma) may be omitted. If it is -omitted, the padding bytes are zero. +The second expression (also absolute) gives the fill value to be stored in the +padding bytes. It (and the comma) may be omitted. If it is omitted, the +padding bytes are normally zero. However, on some systems, if the section is +marked as containing code and the fill value is omitted, the space is filled +with no-op instructions. + +The third expression is also absolute, and is also optional. If it is present, +it is the maximum number of bytes that should be skipped by this alignment +directive. If doing the alignment would require skipping more bytes than the +specified maximum, then the alignment is not done at all. You can omit the +fill value (the second argument) entirely by simply using two commas after the +required alignment; this can be useful if you want the alignment to be filled +with no-op instructions when appropriate. @cindex @code{p2alignw} directive @cindex @code{p2alignl} directive @@ -3935,23 +4040,95 @@ @end ifset @end ifset -@ifset COFF @node Section -@section @code{.section @var{name}, @var{subsection}} +@section @code{.section @var{name}} @cindex @code{section} directive -@cindex named section (COFF) -@cindex COFF named section -Assemble the following code into end of subsection numbered -@var{subsection} in the COFF named section @var{name}. If you omit -@var{subsection}, @code{@value{AS}} uses subsection number zero. -@samp{.section .text} is equivalent to the @code{.text} directive; -@samp{.section .data} is equivalent to the @code{.data} directive. -@ifset GENERIC +@cindex named section +Use the @code{.section} directive to assemble the following code into a section +named @var{name}. + This directive is only supported for targets that actually support arbitrarily named sections; on @code{a.out} targets, for example, it is not accepted, even -with a standard @code{a.out} section name as its parameter. +with a standard @code{a.out} section name. + +@ifset COFF +For COFF targets, the @code{.section} directive is used in one of the following +ways: +@smallexample +.section @var{name}[, "@var{flags}"] +.section @var{name}[, @var{subsegment}] +@end smallexample + +If the optional argument is quoted, it is taken as flags to use for the +section. Each flag is a single character. The following flags are recognized: +@table @code +@item b +bss section (uninitialized data) +@item n +section is not loaded +@item w +writable section +@item d +data section +@item r +read-only section +@item x +executable section +@end table + +If no flags are specified, the default flags depend upon the section name. If +the section name is not recognized, the default will be for the section to be +loaded and writable. + +If the optional argument to the @code{.section} directive is not quoted, it is +taken as a subsegment number (@pxref{Sub-Sections}). @end ifset + +@ifset ELF +For ELF targets, the @code{.section} directive is used like this: +@smallexample +.section @var{name}[, "@var{flags}"[, @@@var{type}]] +@end smallexample +The optional @var{flags} argument is a quoted string which may contain any +combintion of the following characters: +@table @code +@item a +section is allocatable +@item w +section is writable +@item x +section is executable +@end table + +The optional @var{type} argument may contain one of the following constants: +@table @code +@item @@progbits +section contains data +@item @@nobits +section does not contain data (i.e., section only occupies space) +@end table + +If no flags are specified, the default flags depend upon the section name. If +the section name is not recognized, the default will be for the section to have +none of the above flags: it will not be allocated in memory, nor writable, nor +executable. The section will contain data. + +For ELF targets, the assembler supports another type of @code{.section} +directive for compatibility with the Solaris assembler: +@smallexample +.section "@var{name}"[, @var{flags}...] +@end smallexample +Note that the section name is quoted. There may be a sequence of comma +separated flags: +@table @code +@item #alloc +section is allocatable +@item #write +section is writable +@item #execinstr +section is executable +@end table @end ifset @node Set @@ -3962,7 +4139,7 @@ Set the value of @var{symbol} to @var{expression}. This changes @var{symbol}'s value and type to conform to @var{expression}. If @var{symbol} was flagged as external, it remains -flagged. (@xref{Symbol Attributes}.) +flagged (@pxref{Symbol Attributes}). You may @code{.set} a symbol many times in the same assembly. @@ -4153,6 +4330,39 @@ particular machine, the assembler marks the end of each string with a 0 byte. You can use any of the escape sequences described in @ref{Strings,,Strings}. +@ifset ELF +@node Symver +@section @code{.symver} +@cindex @code{symver} directive +@cindex symbol versioning +@cindex versions of symbols +Use the @code{.symver} directive to bind symbols to specific version nodes +within a source file. This is only supported on ELF platforms, and is +typically used when assembling files to be linked into a shared library. +There are cases where it may make sense to use this in objects to be bound +into an application itself so as to override a versioned symbol from a +shared library. + +For ELF targets, the @code{.symver} directive is used like this: +@smallexample +.symver @var{name}, @var{name2@@nodename} +@end smallexample +In this case, the symbol @var{name} must exist and be defined within the file +being assembled. The @code{.versym} directive effectively creates a symbol +alias with the name @var{name2@@nodename}, and in fact the main reason that we +just don't try and create a regular alias is that the @var{@@} character isn't +permitted in symbol names. The @var{name2} part of the name is the actual name +of the symbol by which it will be externally referenced. The name @var{name} +itself is merely a name of convenience that is used so that it is possible to +have definitions for multiple versions of a function within a single source +file, and so that the compiler can unambiguously know which version of a +function is being mentioned. The @var{nodename} portion of the alias should be +the name of a node specified in the version script supplied to the linker when +building a shared library. If you are attempting to override a versioned +symbol from a shared library, then @var{nodename} should correspond to the +nodename of the symbol you are trying to override. +@end ifset + @ifset COFF @node Tag @section @code{.tag @var{structname}} @@ -4326,6 +4536,9 @@ @ifset A29K * AMD29K-Dependent:: AMD 29K Dependent Features @end ifset +@ifset D10V +* D10V-Dependent:: D10V Dependent Features +@end ifset @ifset H8/300 * H8/300-Dependent:: Hitachi H8/300 Dependent Features @end ifset @@ -4396,6 +4609,10 @@ @end ifclear @end ifset +@ifset D10V +@include c-d10v.texi +@end ifset + @ifset H8/300 @include c-h8300.texi @end ifset @@ -4449,6 +4666,208 @@ @raisesections @end ifset +@node Reporting Bugs +@chapter Reporting Bugs +@cindex bugs in @code{@value{AS}} +@cindex reporting bugs in @code{@value{AS}} + +Your bug reports play an essential role in making @code{@value{AS}} reliable. + +Reporting a bug may help you by bringing a solution to your problem, or it may +not. But in any case the principal function of a bug report is to help the +entire community by making the next version of @code{@value{AS}} work better. +Bug reports are your contribution to the maintenance of @code{@value{AS}}. + +In order for a bug report to serve its purpose, you must include the +information that enables us to fix the bug. + +@menu +* Bug Criteria:: Have you found a bug? +* Bug Reporting:: How to report bugs +@end menu + +@node Bug Criteria +@section Have you found a bug? +@cindex bug criteria + +If you are not sure whether you have found a bug, here are some guidelines: + +@itemize @bullet +@cindex fatal signal +@cindex assembler crash +@cindex crash of assembler +@item +If the assembler gets a fatal signal, for any input whatever, that is a +@code{@value{AS}} bug. Reliable assemblers never crash. + +@cindex error on valid input +@item +If @code{@value{AS}} produces an error message for valid input, that is a bug. + +@cindex invalid input +@item +If @code{@value{AS}} does not produce an error message for invalid input, that +is a bug. However, you should note that your idea of ``invalid input'' might +be our idea of ``an extension'' or ``support for traditional practice''. + +@item +If you are an experienced user of assemblers, your suggestions for improvement +of @code{@value{AS}} are welcome in any case. +@end itemize + +@node Bug Reporting +@section How to report bugs +@cindex bug reports +@cindex @code{@value{AS}} bugs, reporting + +A number of companies and individuals offer support for @sc{gnu} products. If +you obtained @code{@value{AS}} from a support organization, we recommend you +contact that organization first. + +You can find contact information for many support companies and +individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs +distribution. + +In any event, we also recommend that you send bug reports for @code{@value{AS}} +to @samp{bug-gnu-utils@@prep.ai.mit.edu}. + +The fundamental principle of reporting bugs usefully is this: +@strong{report all the facts}. If you are not sure whether to state a +fact or leave it out, state it! + +Often people omit facts because they think they know what causes the problem +and assume that some details do not matter. Thus, you might assume that the +name of a symbol you use in an example does not matter. Well, probably it does +not, but one cannot be sure. Perhaps the bug is a stray memory reference which +happens to fetch from the location where that name is stored in memory; +perhaps, if the name were different, the contents of that location would fool +the assembler into doing the right thing despite the bug. Play it safe and +give a specific, complete example. That is the easiest thing for you to do, +and the most helpful. + +Keep in mind that the purpose of a bug report is to enable us to fix the bug if +it is new to us. Therefore, always write your bug reports on the assumption +that the bug has not been reported previously. + +Sometimes people give a few sketchy facts and ask, ``Does this ring a +bell?'' Those bug reports are useless, and we urge everyone to +@emph{refuse to respond to them} except to chide the sender to report +bugs properly. + +To enable us to fix the bug, you should include all these things: + +@itemize @bullet +@item +The version of @code{@value{AS}}. @code{@value{AS}} announces it if you start +it with the @samp{--version} argument. + +Without this, we will not know whether there is any point in looking for +the bug in the current version of @code{@value{AS}}. + +@item +Any patches you may have applied to the @code{@value{AS}} source. + +@item +The type of machine you are using, and the operating system name and +version number. + +@item +What compiler (and its version) was used to compile @code{@value{AS}}---e.g. +``@code{gcc-2.7}''. + +@item +The command arguments you gave the assembler to assemble your example and +observe the bug. To guarantee you will not omit something important, list them +all. A copy of the Makefile (or the output from make) is sufficient. + +If we were to try to guess the arguments, we would probably guess wrong +and then we might not encounter the bug. + +@item +A complete input file that will reproduce the bug. If the bug is observed when +the assembler is invoked via a compiler, send the assembler source, not the +high level language source. Most compilers will produce the assembler source +when run with the @samp{-S} option. If you are using @code{@value{GCC}}, use +the options @samp{-v --save-temps}; this will save the assembler source in a +file with an extension of @file{.s}, and also show you exactly how +@code{@value{AS}} is being run. + +@item +A description of what behavior you observe that you believe is +incorrect. For example, ``It gets a fatal signal.'' + +Of course, if the bug is that @code{@value{AS}} gets a fatal signal, then we +will certainly notice it. But if the bug is incorrect output, we might not +notice unless it is glaringly wrong. You might as well not give us a chance to +make a mistake. + +Even if the problem you experience is a fatal signal, you should still say so +explicitly. Suppose something strange is going on, such as, your copy of +@code{@value{AS}} is out of synch, or you have encountered a bug in the C +library on your system. (This has happened!) Your copy might crash and ours +would not. If you told us to expect a crash, then when ours fails to crash, we +would know that the bug was not happening for us. If you had not told us to +expect a crash, then we would not be able to draw any conclusion from our +observations. + +@item +If you wish to suggest changes to the @code{@value{AS}} source, send us context +diffs, as generated by @code{diff} with the @samp{-u}, @samp{-c}, or @samp{-p} +option. Always send diffs from the old file to the new file. If you even +discuss something in the @code{@value{AS}} source, refer to it by context, not +by line number. + +The line numbers in our development sources will not match those in your +sources. Your line numbers would convey no useful information to us. +@end itemize + +Here are some things that are not necessary: + +@itemize @bullet +@item +A description of the envelope of the bug. + +Often people who encounter a bug spend a lot of time investigating +which changes to the input file will make the bug go away and which +changes will not affect it. + +This is often time consuming and not very useful, because the way we +will find the bug is by running a single example under the debugger +with breakpoints, not by pure deduction from a series of examples. +We recommend that you save your time for something else. + +Of course, if you can find a simpler example to report @emph{instead} +of the original one, that is a convenience for us. Errors in the +output will be easier to spot, running under the debugger will take +less time, and so on. + +However, simplification is not vital; if you do not want to do this, +report the bug anyway and send us the entire test case you used. + +@item +A patch for the bug. + +A patch for the bug does help us if it is a good one. But do not omit +the necessary information, such as the test case, on the assumption that +a patch is all we need. We might see problems with your patch and decide +to fix the problem another way, or we might not understand it at all. + +Sometimes with a program as complicated as @code{@value{AS}} it is very hard to +construct an example that will make the program follow a certain path through +the code. If you do not send us the example, we will not be able to construct +one, so we will not be able to verify that the bug is fixed. + +And if we cannot understand what bug you are trying to fix, or why your +patch should be an improvement, we will not install it. A test case will +help us to understand. + +@item +A guess about what the bug is or what it depends on. + +Such guesses are usually wrong. Even we cannot guess right about such +things without first using the debugger to find the facts. +@end itemize + @node Acknowledgements @chapter Acknowledgements @@ -4528,7 +4947,8 @@ Software Foundation (i386 mainly), and Ken Raeburn of Cygnus Support (sparc, and some initial 64-bit support). -Richard Henderson rewrote the Alpha assembler. +Richard Henderson rewrote the Alpha assembler. Klaus Kaempf wrote GAS and BFD +support for openVMS/Alpha. Several engineers at Cygnus Support have also provided many small bug fixes and configuration enhancements. diff -urN binutils-2.7/gas/doc/c-d10v.texi binutils-2.8/gas/doc/c-d10v.texi --- binutils-2.7/gas/doc/c-d10v.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/doc/c-d10v.texi Wed Apr 30 12:53:27 1997 @@ -0,0 +1,246 @@ +@c Copyright (C) 1996 Free Software Foundation, Inc. +@c This is part of the GAS manual. +@c For copying conditions, see the file as.texinfo. +@ifset GENERIC +@page +@node D10V-Dependent +@chapter D10V Dependent Features +@end ifset +@ifclear GENERIC +@node Machine Dependencies +@chapter D10V Dependent Features +@end ifclear + +@cindex D10V support +@menu +* D10V-Opts:: D10V Options +* D10V-Syntax:: Syntax +* D10V-Float:: Floating Point +* D10V-Opcodes:: Opcodes +@end menu + +@node D10V-Opts +@section D10V Options +@cindex options, D10V +@cindex D10V options +The Mitsubishi D10V version of @code{@value{AS}} has a few machine +dependent options. + +@table @samp +@item -O +The D10V can often execute two sub-instructions in parallel. When this option +is used, @code{@value{AS}} will attempt to optimize its output by detecting when +instructions can be executed in parallel. +@end table + +@node D10V-Syntax +@section Syntax +@cindex D10V syntax +@cindex syntax, D10V + +The D10V syntax is based on the syntax in Mitsubishi's D10V architecture manual. +The differences are detailed below. + +@menu +* D10V-Size:: Size Modifiers +* D10V-Subs:: Sub-Instructions +* D10V-Chars:: Special Characters +* D10V-Regs:: Register Names +* D10V-Addressing:: Addressing Modes +* D10V-Word:: @@WORD Modifier +@end menu + + +@node D10V-Size +@subsection Size Modifiers +@cindex D10V size modifiers +@cindex size modifiers, D10V +The D10V version of @code{@value{AS}} uses the instruction names in the D10V +Architecture Manual. However, the names in the manual are sometimes ambiguous. +There are instruction names that can assemble to a short or long form opcode. +How does the assembler pick the correct form? @code{@value{AS}} will always pick the +smallest form if it can. When dealing with a symbol that is not defined yet when a +line is being assembled, it will always use the long form. If you need to force the +assembler to use either the short or long form of the instruction, you can append +either @samp{.s} (short) or @samp{.l} (long) to it. For example, if you are writing +an assembly program and you want to do a branch to a symbol that is defined later +in your program, you can write @samp{bra.s foo}. +Objdump and GDB will always append @samp{.s} or @samp{.l} to instructions which +have both short and long forms. + +@node D10V-Subs +@subsection Sub-Instructions +@cindex D10V sub-instructions +@cindex sub-instructions, D10V +The D10V assembler takes as input a series of instructions, either one-per-line, +or in the special two-per-line format described in the next section. Some of these +instructions will be short-form or sub-instructions. These sub-instructions can be packed +into a single instruction. The assembler will do this automatically. It will also detect +when it should not pack instructions. For example, when a label is defined, the next +instruction will never be packaged with the previous one. Whenever a branch and link +instruction is called, it will not be packaged with the next instruction so the return +address will be valid. Nops are automatically inserted when necessary. + +If you do not want the assembler automatically making these decisions, you can control +the packaging and execution type (parallel or sequential) with the special execution +symbols described in the next section. + +@node D10V-Chars +@subsection Special Characters +@cindex line comment character, D10V +@cindex D10V line comment character +@samp{;} and @samp{#} are the line comment characters. +@cindex sub-instruction ordering, D10V +@cindex D10V sub-instruction ordering +Sub-instructions may be executed in order, in reverse-order, or in parallel. +Instructions listed in the standard one-per-line format will be executed sequentially. +To specify the executing order, use the following symbols: +@table @samp +@item -> +Sequential with instruction on the left first. +@item <- +Sequential with instruction on the right first. +@item || +Parallel +@end table +The D10V syntax allows either one instruction per line, one instruction per line with +the execution symbol, or two instructions per line. For example +@table @code +@item abs a1 -> abs r0 +Execute these sequentially. The instruction on the right is in the right +container and is executed second. +@item abs r0 <- abs a1 +Execute these reverse-sequentially. The instruction on the right is in the right +container, and is executed first. +@item ld2w r2,@@r8+ || mac a0,r0,r7 +Execute these in parallel. +@item ld2w r2,@@r8+ || +@itemx mac a0,r0,r7 +Two-line format. Execute these in parallel. +@item ld2w r2,@@r8+ +@itemx mac a0,r0,r7 +Two-line format. Execute these sequentially. Assembler will +put them in the proper containers. +@item ld2w r2,@@r8+ -> +@itemx mac a0,r0,r7 +Two-line format. Execute these sequentially. Same as above but +second instruction will always go into right container. +@end table +@cindex symbol names, @samp{$} in +@cindex @code{$} in symbol names +Since @samp{$} has no special meaning, you may use it in symbol names. + +@node D10V-Regs +@subsection Register Names +@cindex D10V registers +@cindex registers, D10V +You can use the predefined symbols @samp{r0} through @samp{r15} to refer to the D10V +registers. You can also use @samp{sp} as an alias for @samp{r15}. The accumulators +are @samp{a0} and @samp{a1}. There are special register-pair names that may +optionally be used in opcodes that require even-numbered registers. Register names are +not case sensitive. + +Register Pairs +@table @code +@item r0-r1 +@item r2-r3 +@item r4-r5 +@item r6-r7 +@item r8-r9 +@item r10-r11 +@item r12-r13 +@item r14-r15 +@end table + +The D10V also has predefined symbols for these control registers and status bits: +@table @code +@item psw +Processor Status Word +@item bpsw +Backup Processor Status Word +@item pc +Program Counter +@item bpc +Backup Program Counter +@item rpt_c +Repeat Count +@item rpt_s +Repeat Start address +@item rpt_e +Repeat End address +@item mod_s +Modulo Start address +@item mod_e +Modulo End address +@item iba +Instruction Break Address +@item f0 +Flag 0 +@item f1 +Flag 1 +@item c +Carry flag +@end table + +@node D10V-Addressing +@subsection Addressing Modes +@cindex addressing modes, D10V +@cindex D10V addressing modes +@code{@value{AS}} understands the following addressing modes for the D10V. +@code{R@var{n}} in the following refers to any of the numbered +registers, but @emph{not} the control registers. +@table @code +@item R@var{n} +Register direct +@item @@R@var{n} +Register indirect +@item @@R@var{n}+ +Register indirect with post-increment +@item @@R@var{n}- +Register indirect with post-decrement +@item @@-SP +Register indirect with pre-decrement +@item @@(@var{disp}, R@var{n}) +Register indirect with displacement +@item @var{addr} +PC relative address (for branch or rep). +@item #@var{imm} +Immediate data (the @samp{#} is optional and ignored) +@end table + +@node D10V-Word +@subsection @@WORD Modifier +@cindex D10V @@word modifier +@cindex @@word modifier, D10V +Any symbol followed by @code{@@word} will be replaced by the symbol's value +shifted right by 2. This is used in situations such as loading a register +with the address of a function (or any other code fragment). For example, if +you want to load a register with the location of the function @code{main} then +jump to that function, you could do it as follws: +@smallexample +@group +ldi r2, main@@word +jmp r2 +@end group +@end smallexample + +@node D10V-Float +@section Floating Point +@cindex floating point, D10V +@cindex D10V floating point +The D10V has no hardware floating point, but the @code{.float} and @code{.double} +directives generates @sc{ieee} floating-point numbers for compatibility +with other development tools. + +@node D10V-Opcodes +@section Opcodes +@cindex D10V opcode summary +@cindex opcode summary, D10V +@cindex mnemonics, D10V +@cindex instruction summary, D10V +For detailed information on the D10V machine instruction set, see +@cite{D10V Architecture: A VLIW Microprocessor for Multimedia Applications} +(Mitsubishi Electric Corp.). +@code{@value{AS}} implements all the standard D10V opcodes. The only changes are those +described in the section on size modifiers + diff -urN binutils-2.7/gas/doc/c-m68k.texi binutils-2.8/gas/doc/c-m68k.texi --- binutils-2.7/gas/doc/c-m68k.texi Thu Jul 4 12:15:03 1996 +++ binutils-2.8/gas/doc/c-m68k.texi Wed Apr 30 12:53:27 1997 @@ -1,4 +1,4 @@ -@c Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +@c Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. @c This is part of the GAS manual. @c For copying conditions, see the file as.texinfo. @ifset GENERIC @@ -60,6 +60,30 @@ either use C style comments, or start comments with a @samp{#} character at the beginning of a line. +@cindex @samp{--base-size-default-16} +@cindex @samp{--base-size-default-32} +If you use an addressing mode with a base register without specifying +the size, @code{@value{AS}} will normally use the full 32 bit value. +For example, the addressing mode @samp{%a0@@(%d0)} is equivalent to +@samp{%a0@@(%d0:l)}. You may use the @samp{--base-size-default-16} +option to tell @code{@value{AS}} to default to using the 16 bit value. +In this case, @samp{%a0@@(%d0)} is equivalent to @samp{%a0@@(%d0:w)}. +You may use the @samp{--base-size-default-32} option to restore the +default behaviour. + +@cindex @samp{--disp-size-default-16} +@cindex @samp{--disp-size-default-32} +If you use an addressing mode with a displacement, and the value of the +displacement is not known, @code{@value{AS}} will normally assume that +the value is 32 bits. For example, if the symbol @samp{disp} has not +been defined, @code{@value{AS}} will assemble the addressing mode +@samp{%a0@@(disp,%d0)} as though @samp{disp} is a 32 bit value. You may +use the @samp{--disp-size-default-16} option to tell @code{@value{AS}} +to instead assume that the displacement is 16 bits. In this case, +@code{@value{AS}} will assemble @samp{%a0@@(disp,%d0)} as though +@samp{disp} is a 16 bit value. You may use the +@samp{--disp-size-default-32} option to restore the default behaviour. + @cindex @samp{-m68000} and related options @cindex architecture options, M680x0 @cindex M680x0 architecture options @@ -102,6 +126,9 @@ @itemx -m68340 @itemx -m68360 Assemble for the CPU32 family of chips. + +@item -m5200 +Assemble for the ColdFire family of chips. @item -m68881 @itemx -m68882 diff -urN binutils-2.7/gas/doc/c-mips.texi binutils-2.8/gas/doc/c-mips.texi --- binutils-2.7/gas/doc/c-mips.texi Thu Jul 4 12:15:04 1996 +++ binutils-2.8/gas/doc/c-mips.texi Wed Apr 30 12:53:27 1997 @@ -1,4 +1,4 @@ -@c Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +@c Copyright (C) 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. @c This is part of the GAS manual. @c For copying conditions, see the file as.texinfo. @ifset GENERIC @@ -11,22 +11,21 @@ @chapter MIPS Dependent Features @end ifclear -@cindex MIPS R2000 -@cindex MIPS R3000 -@cindex MIPS R4000 -@cindex MIPS R6000 -@sc{gnu} @code{@value{AS}} for @sc{mips} architectures supports the @sc{mips} -@sc{r2000}, @sc{r3000}, @sc{r4000} and @sc{r6000} processors. For information -about the @sc{mips} instruction set, see @cite{MIPS RISC Architecture}, by Kane -and Heindrich (Prentice-Hall). For an overview of @sc{mips} assembly -conventions, see ``Appendix D: Assembly Language Programming'' in the same -work. +@cindex MIPS processor +@sc{gnu} @code{@value{AS}} for @sc{mips} architectures supports several +different @sc{mips} processors, and MIPS ISA levels I through IV. For +information about the @sc{mips} instruction set, see @cite{MIPS RISC +Architecture}, by Kane and Heindrich (Prentice-Hall). For an overview +of @sc{mips} assembly conventions, see ``Appendix D: Assembly Language +Programming'' in the same work. @menu -* MIPS Opts:: Assembler options -* MIPS Object:: ECOFF object code -* MIPS Stabs:: Directives for debugging information -* MIPS ISA:: Directives to override the ISA level +* MIPS Opts:: Assembler options +* MIPS Object:: ECOFF object code +* MIPS Stabs:: Directives for debugging information +* MIPS ISA:: Directives to override the ISA level +* MIPS insn:: Directive to mark data as an instruction +* MIPS option stack:: Directives to save and restore options @end menu @node MIPS Opts @@ -59,21 +58,29 @@ @item -mips1 @itemx -mips2 @itemx -mips3 +@itemx -mips4 Generate code for a particular MIPS Instruction Set Architecture level. @samp{-mips1} corresponds to the @sc{r2000} and @sc{r3000} processors, -@samp{-mips2} to the @sc{r6000} processor, and @samp{-mips3} to the @sc{r4000} -processor. You can also switch instruction sets during the assembly; see -@ref{MIPS ISA,, Directives to override the ISA level}. +@samp{-mips2} to the @sc{r6000} processor, @samp{-mips3} to the +@sc{r4000} processor, and @samp{-mips4} to the @sc{r8000} and +@sc{r10000} processors. You can also switch instruction sets during the +assembly; see @ref{MIPS ISA,, Directives to override the ISA level}. + +@item -mips16 +@itemx -no-mips16 +Generate code for the MIPS 16 processor. This is equivalent to putting +@samp{.set mips16} at the start of the assembly file. @samp{-no-mips16} +turns off this option. @item -m4650 -@item -no-m4650 +@itemx -no-m4650 Generate code for the MIPS @sc{r4650} chip. This tells the assembler to accept the @samp{mad} and @samp{madu} instruction, and to not schedule @samp{nop} instructions around accesses to the @samp{HI} and @samp{LO} registers. @samp{-no-m4650} turns off this option. @item -m4010 -@item -no-m4010 +@itemx -no-m4010 Generate code for the LSI @sc{r4010} chip. This tells the assembler to accept the @sc{r4010} specific instructions (@samp{addciu}, @samp{ffc}, etc.), and to not schedule @samp{nop} instructions around accesses to @@ -159,15 +166,48 @@ @cindex MIPS ISA override @kindex @code{.set mips@var{n}} -@sc{gnu} @code{@value{AS}} supports an additional directive to change the -@sc{mips} Instruction Set Architecture level on the fly: @code{.set -mips@var{n}}. @var{n} should be a number from 0 to 3. A value from 1 to 3 -makes the assembler accept instructions for the corresponding @sc{isa} level, -from that point on in the assembly. @code{.set mips@var{n}} affects not only -which instructions are permitted, but also how certain macros are expanded. -@code{.set mips0} restores the @sc{isa} level to its original level: either the -level you selected with command line options, or the default for your -configuration. You can use this feature to permit specific @sc{r4000} -instructions while assembling in 32 bit mode. Use this directive with care! +@sc{gnu} @code{@value{AS}} supports an additional directive to change +the @sc{mips} Instruction Set Architecture level on the fly: @code{.set +mips@var{n}}. @var{n} should be a number from 0 to 4. A value from 1 +to 4 makes the assembler accept instructions for the corresponding +@sc{isa} level, from that point on in the assembly. @code{.set +mips@var{n}} affects not only which instructions are permitted, but also +how certain macros are expanded. @code{.set mips0} restores the +@sc{isa} level to its original level: either the level you selected with +command line options, or the default for your configuration. You can +use this feature to permit specific @sc{r4000} instructions while +assembling in 32 bit mode. Use this directive with care! + +The directive @samp{.set mips16} puts the assembler into MIPS 16 mode, +in which it will assemble instructions for the MIPS 16 processor. Use +@samp{.set nomips16} to return to normal 32 bit mode. Traditional @sc{mips} assemblers do not support this directive. + +@node MIPS insn +@section Directive to mark data as an instruction + +@kindex @code{.insn} +The @code{.insn} directive tells @code{@value{AS}} that the following +data is actually instructions. This makes a difference in MIPS 16 mode: +when loading the address of a label which precedes instructions, +@code{@value{AS}} automatically adds 1 to the value, so that jumping to +the loaded address will do the right thing. + +@node MIPS option stack +@section Directives to save and restore options + +@cindex MIPS option stack +@kindex @code{.set push} +@kindex @code{.set pop} +The directives @code{.set push} and @code{.set pop} may be used to save +and restore the current settings for all the options which are +controlled by @code{.set}. The @code{.set push} directive saves the +current settings on a stack. The @code{.set pop} directive pops the +stack and restores the settings. + +These directives can be useful inside an macro which must change an +option such as the ISA level or instruction reordering but does not want +to change the state of the code which invoked the macro. + +Traditional @sc{mips} assemblers do not support these directives. diff -urN binutils-2.7/gas/doc/c-sparc.texi binutils-2.8/gas/doc/c-sparc.texi --- binutils-2.7/gas/doc/c-sparc.texi Thu Jul 4 12:15:04 1996 +++ binutils-2.8/gas/doc/c-sparc.texi Wed Apr 30 12:53:27 1997 @@ -14,6 +14,7 @@ @cindex SPARC support @menu * Sparc-Opts:: Options +* Sparc-Aligned-Data:: Option to enforce aligned data * Sparc-Float:: Floating Point * Sparc-Directives:: Sparc Machine Directives @end menu @@ -73,6 +74,27 @@ warnings until that level is reached, and will then bump the level as required (except between incompatible levels). @end table + +@node Sparc-Aligned-Data +@section Enforcing aligned data + +@cindex data alignment on SPARC +@cindex SPARC data alignment +SPARC GAS normally permits data to be misaligned. For example, it +permits the @code{.long} pseudo-op to be used on a byte boundary. +However, the native SunOS and Solaris assemblers issue an error when +they see misaligned data. + +@kindex --enforce-aligned-data +You can use the @code{--enforce-aligned-data} option to make SPARC GAS +also issue an error about misaligned data, just as the SunOS and Solaris +assemblers do. + +The @code{--enforce-aligned-data} option is not the default because gcc +issues misaligned data pseudo-ops when it initializes certain packed +data structures (structures defined using the @code{packed} attribute). +You may have to assemble with GAS in order to initialize packed data +structures in your own code. @ignore @c FIXME: (sparc) Fill in "syntax" section! diff -urN binutils-2.7/gas/doc/gasp.info binutils-2.8/gas/doc/gasp.info --- binutils-2.7/gas/doc/gasp.info Mon Jul 15 12:23:06 1996 +++ binutils-2.8/gas/doc/gasp.info Wed Apr 30 12:53:28 1997 @@ -1,4 +1,4 @@ -This is Info file gasp.info, produced by Makeinfo-1.55 from the input +This is Info file gasp.info, produced by Makeinfo-1.64 from the input file ./gasp.texi. START-INFO-DIR-ENTRY @@ -21,7 +21,7 @@ versions.  -File: gasp.info, Node: Top, Next: Overview, Prev: (DIR), Up: (DIR) +File: gasp.info, Node: Top, Next: Overview, Up: (dir) GASP **** @@ -958,7 +958,6 @@ * .AENDI: Conditionals. * .AENDR: Loops. * .AENDW: Loops. -* .AENDW: Loops. * .AIF "STRA" CMP "STRB": Conditionals. * .AIF EXPRA CMP EXPRB: Conditionals. * .ALIGN SIZE: Other Commands. @@ -1025,6 +1024,7 @@ * PVAR .ASSIGNC "STR": Variables. * PVAR .EQU EXPR: Variables. * PVAR .REG (REGISTER): Variables. +* \@: Macros. * absolute expressions: Expressions. * argument fields: Syntax Details. * avoiding preprocessing: Markers. @@ -1057,31 +1057,30 @@ * symbols, separating from text: Markers. * text, separating from symbols: Markers. * whitespace: Syntax Details. -* \@: Macros.  Tag Table: Node: Top828 -Node: Overview1276 -Node: Invoking GASP2942 -Node: Commands6678 -Node: Conditionals7354 -Node: Loops9646 -Node: Variables11171 -Node: Macros13566 -Node: Data17528 -Node: Initialized17976 -Node: Uninitialized20255 -Node: Listings21266 -Node: Other Commands22462 -Node: Syntax Details24214 -Node: Markers25350 -Node: Constants27598 -Node: Symbols28800 -Node: Expressions29096 -Node: String Builtins30328 -Node: Alternate31109 -Node: Index32727 +Node: Overview1262 +Node: Invoking GASP2928 +Node: Commands6664 +Node: Conditionals7340 +Node: Loops9632 +Node: Variables11157 +Node: Macros13552 +Node: Data17514 +Node: Initialized17962 +Node: Uninitialized20241 +Node: Listings21252 +Node: Other Commands22448 +Node: Syntax Details24200 +Node: Markers25336 +Node: Constants27584 +Node: Symbols28786 +Node: Expressions29082 +Node: String Builtins30314 +Node: Alternate31095 +Node: Index32713  End Tag Table diff -urN binutils-2.7/gas/doc/internals.texi binutils-2.8/gas/doc/internals.texi --- binutils-2.7/gas/doc/internals.texi Thu Jul 4 12:15:08 1996 +++ binutils-2.8/gas/doc/internals.texi Wed Apr 30 12:53:28 1997 @@ -1,52 +1,133 @@ \input texinfo @setfilename internals.info -@node Assembler Internals -@chapter Assembler Internals +@node Top +@top Assembler Internals +@raisesections @cindex internals -This documentation is not ready for prime time yet. Not even close. It's not -so much documentation as random blathering of mine intended to be notes to -myself that may eventually be turned into real documentation. - -I take no responsibility for any negative effect it may have on your -professional, personal, or spiritual life. Read it at your own risk. Caveat -emptor. Delete before reading. Abandon all hope, ye who enter here. +This chapter describes the internals of the assembler. It is incomplete, but +it may help a bit. -However, enhancements will be gratefully accepted. +This chapter was last modified on $Date: 1997/04/25 18:20:48 $. It is not updated regularly, and it +may be out of date. @menu +* GAS versions:: GAS versions * Data types:: Data types +* GAS processing:: What GAS does when it runs +* Porting GAS:: Porting GAS +* Relaxation:: Relaxation +* Broken words:: Broken words +* Internal functions:: Internal functions +* Test suite:: Test suite @end menu -@node foo -@section foo +@node GAS versions +@section GAS versions -BFD_ASSEMBLER -BFD, MANY_SECTIONS, BFD_HEADERS +GAS has acquired layers of code over time. The original GAS only supported the +a.out object file format, with three sections. Support for multiple sections +has been added in two different ways. + +The preferred approach is to use the version of GAS created when the symbol +@code{BFD_ASSEMBLER} is defined. The other versions of GAS are documented for +historical purposes, and to help anybody who has to debug code written for +them. +The type @code{segT} is used to represent a section in code which must work +with all versions of GAS. + +@menu +* Original GAS:: Original GAS version +* MANY_SEGMENTS:: MANY_SEGMENTS gas version +* BFD_ASSEMBLER:: BFD_ASSEMBLER gas version +@end menu + +@node Original GAS +@subsection Original GAS + +The original GAS only supported the a.out object file format with three +sections: @samp{.text}, @samp{.data}, and @samp{.bss}. This is the version of +GAS that is compiled if neither @code{BFD_ASSEMBLER} nor @code{MANY_SEGMENTS} +is defined. This version of GAS is still used for the m68k-aout target, and +perhaps others. + +This version of GAS should not be used for any new development. + +There is still code that is specific to this version of GAS, notably in +@file{write.c}. There is no way for this code to loop through all the +sections; it simply looks at global variables like @code{text_frag_root} and +@code{data_frag_root}. + +The type @code{segT} is an enum. + +@node MANY_SEGMENTS +@subsection MANY_SEGMENTS gas version +@cindex MANY_SEGMENTS + +The @code{MANY_SEGMENTS} version of gas is only used for COFF. It uses the BFD +library, but it writes out all the data itself using @code{bfd_write}. This +version of gas supports up to 40 normal sections. The section names are stored +in the @code{seg_name} array. Other information is stored in the +@code{segment_info} array. + +The type @code{segT} is an enum. Code that wants to examine all the sections +can use a @code{segT} variable as loop index from @code{SEG_E0} up to but not +including @code{SEG_UNKNOWN}. + +Most of the code specific to this version of GAS is in the file +@file{config/obj-coff.c}, in the portion of that file that is compiled when +@code{BFD_ASSEMBLER} is not defined. + +This version of GAS is still used for several COFF targets. + +@node BFD_ASSEMBLER +@subsection BFD_ASSEMBLER gas version +@cindex BFD_ASSEMBLER + +The preferred version of GAS is the @code{BFD_ASSEMBLER} version. In this +version of GAS, the output file is a normal BFD, and the BFD routines are used +to generate the output. + +@code{BFD_ASSEMBLER} will automatically be used for certain targets, including +those that use the ELF, ECOFF, and SOM object file formats, and also all Alpha, +MIPS, PowerPC, and SPARC targets. You can force the use of +@code{BFD_ASSEMBLER} for other targets with the configure option +@samp{--enable-bfd-assembler}; however, it has not been tested for many +targets, and can not be assumed to work. @node Data types @section Data types @cindex internals, data types +This section describes some fundamental GAS data types. + +@menu +* Symbols:: The symbolS structure +* Expressions:: The expressionS structure +* Fixups:: The fixS structure +* Frags:: The fragS structure +@end menu + +@node Symbols @subsection Symbols @cindex internals, symbols @cindex symbols, internal - -... `local' symbols ... flags ... +@cindex symbolS structure The definition for @code{struct symbol}, also known as @code{symbolS}, is -located in @file{struc-symbol.h}. Symbol structures can contain the following +located in @file{struc-symbol.h}. Symbol structures contain the following fields: @table @code @item sy_value This is an @code{expressionS} that describes the value of the symbol. It might -refer to another symbol; if so, its true value may not be known until -@code{foo} is called. +refer to one or more other symbols; if so, its true value may not be known +until @code{resolve_symbol_value} is called in @code{write_object_file}. -More generally, however, ... undefined? ... or an offset from the start of a -frag pointed to by the @code{sy_frag} field. +The expression is often simply a constant. Before @code{resolve_symbol_value} +is called, the value is the offset from the frag (@pxref{Frags}). Afterward, +the frag address has been added in. @item sy_resolved This field is non-zero if the symbol's value has been completely resolved. It @@ -65,24 +146,29 @@ @itemx sy_previous These pointers to other @code{symbolS} structures describe a singly or doubly linked list. (If @code{SYMBOLS_NEED_BACKPOINTERS} is not defined, the -@code{sy_previous} field will be omitted.) These fields should be accessed -with @code{symbol_next} and @code{symbol_previous}. +@code{sy_previous} field will be omitted; @code{SYMBOLS_NEED_BACKPOINTERS} is +always defined if @code{BFD_ASSEMBLER}.) These fields should be accessed with +the @code{symbol_next} and @code{symbol_previous} macros. @item sy_frag -This points to the @code{fragS} that this symbol is attached to. +This points to the frag (@pxref{Frags}) that this symbol is attached to. @item sy_used Whether the symbol is used as an operand or in an expression. Note: Not all of the backends keep this information accurate; backends which use this bit are responsible for setting it when a symbol is used in backend routines. +@item sy_mri_common +Whether the symbol is an MRI common symbol created by the @code{COMMON} +pseudo-op when assembling in MRI mode. + @item bsym -If @code{BFD_ASSEMBLER} is defined, this points to the @code{asymbol} that will -be used in writing the object file. +If @code{BFD_ASSEMBLER} is defined, this points to the BFD @code{asymbol} that +will be used in writing the object file. @item sy_name_offset (Only used if @code{BFD_ASSEMBLER} is not defined.) This is the position of -the symbol's name in the symbol table of the object file. On some formats, +the symbol's name in the string table of the object file. On some formats, this will start at position 4, with position 0 reserved for unnamed symbols. This field is not used until @code{write_object_file} is called. @@ -106,29 +192,239 @@ If this macro is defined, it defines additional fields in the symbol structure. This macro is obsolete, and should be replaced when possible by uses of @code{OBJ_SYMFIELD_TYPE} and @code{TC_SYMFIELD_TYPE}. - @end table -Access with S_SET_SEGMENT, S_SET_VALUE, S_GET_VALUE, S_GET_SEGMENT, etc., etc. +There are a number of access routines used to extract the fields of a +@code{symbolS} structure. When possible, these routines should be used rather +than referring to the fields directly. These routines will work for any GAS +version. + +@table @code +@item S_SET_VALUE +@cindex S_SET_VALUE +Set the symbol's value. + +@item S_GET_VALUE +@cindex S_GET_VALUE +Get the symbol's value. This will cause @code{resolve_symbol_value} to be +called if necessary, so @code{S_GET_VALUE} should only be called when it is +safe to resolve symbols (i.e., after the entire input file has been read and +all symbols have been defined). + +@item S_SET_SEGMENT +@cindex S_SET_SEGMENT +Set the section of the symbol. + +@item S_GET_SEGMENT +@cindex S_GET_SEGMENT +Get the symbol's section. + +@item S_GET_NAME +@cindex S_GET_NAME +Get the name of the symbol. + +@item S_SET_NAME +@cindex S_SET_NAME +Set the name of the symbol. + +@item S_IS_EXTERNAL +@cindex S_IS_EXTERNAL +Return non-zero if the symbol is externally visible. + +@item S_IS_EXTERN +@cindex S_IS_EXTERN +A synonym for @code{S_IS_EXTERNAL}. Don't use it. + +@item S_IS_WEAK +@cindex S_IS_WEAK +Return non-zero if the symbol is weak. + +@item S_IS_COMMON +@cindex S_IS_COMMON +Return non-zero if this is a common symbol. Common symbols are sometimes +represented as undefined symbols with a value, in which case this function will +not be reliable. + +@item S_IS_DEFINED +@cindex S_IS_DEFINED +Return non-zero if this symbol is defined. This function is not reliable when +called on a common symbol. + +@item S_IS_DEBUG +@cindex S_IS_DEBUG +Return non-zero if this is a debugging symbol. + +@item S_IS_LOCAL +@cindex S_IS_LOCAL +Return non-zero if this is a local assembler symbol which should not be +included in the final symbol table. Note that this is not the opposite of +@code{S_IS_EXTERNAL}. The @samp{-L} assembler option affects the return value +of this function. + +@item S_SET_EXTERNAL +@cindex S_SET_EXTERNAL +Mark the symbol as externally visible. + +@item S_CLEAR_EXTERNAL +@cindex S_CLEAR_EXTERNAL +Mark the symbol as not externally visible. + +@item S_SET_WEAK +@cindex S_SET_WEAK +Mark the symbol as weak. + +@item S_GET_TYPE +@item S_GET_DESC +@item S_GET_OTHER +@cindex S_GET_TYPE +@cindex S_GET_DESC +@cindex S_GET_OTHER +Get the @code{type}, @code{desc}, and @code{other} fields of the symbol. These +are only defined for object file formats for which they make sense (primarily +a.out). + +@item S_SET_TYPE +@item S_SET_DESC +@item S_SET_OTHER +@cindex S_SET_TYPE +@cindex S_SET_DESC +@cindex S_SET_OTHER +Set the @code{type}, @code{desc}, and @code{other} fields of the symbol. These +are only defined for object file formats for which they make sense (primarily +a.out). + +@item S_GET_SIZE +@cindex S_GET_SIZE +Get the size of a symbol. This is only defined for object file formats for +which it makes sense (primarily ELF). + +@item S_SET_SIZE +@cindex S_SET_SIZE +Set the size of a symbol. This is only defined for object file formats for +which it makes sense (primarily ELF). +@end table +@node Expressions @subsection Expressions @cindex internals, expressions @cindex expressions, internal +@cindex expressionS structure -Expressions are stored as a combination of operator, symbols, blah. +Expressions are stored in an @code{expressionS} structure. The structure is +defined in @file{expr.h}. +@cindex expression +The macro @code{expression} will create an @code{expressionS} structure based +on the text found at the global variable @code{input_line_pointer}. + +@cindex make_expr_symbol +@cindex expr_symbol_where +A single @code{expressionS} structure can represent a single operation. +Complex expressions are formed by creating @dfn{expression symbols} and +combining them in @code{expressionS} structures. An expression symbol is +created by calling @code{make_expr_symbol}. An expression symbol should +naturally never appear in a symbol table, and the implementation of +@code{S_IS_LOCAL} (@pxref{Symbols}) reflects that. The function +@code{expr_symbol_where} returns non-zero if a symbol is an expression symbol, +and also returns the file and line for the expression which caused it to be +created. + +The @code{expressionS} structure has two symbol fields, a number field, an +operator field, and a field indicating whether the number is unsigned. + +The operator field is of type @code{operatorT}, and describes how to interpret +the other fields; see the definition in @file{expr.h} for the possibilities. + +An @code{operatorT} value of @code{O_big} indicates either a floating point +number, stored in the global variable @code{generic_floating_point_number}, or +an integer to large to store in an @code{offsetT} type, stored in the global +array @code{generic_bignum}. This rather inflexible approach makes it +impossible to use floating point numbers or large expressions in complex +expressions. + +@node Fixups @subsection Fixups @cindex internals, fixups @cindex fixups +@cindex fixS structure + +A @dfn{fixup} is basically anything which can not be resolved in the first +pass. Sometimes a fixup can be resolved by the end of the assembly; if not, +the fixup becomes a relocation entry in the object file. + +@cindex fix_new +@cindex fix_new_exp +A fixup is created by a call to @code{fix_new} or @code{fix_new_exp}. Both +take a frag (@pxref{Frags}), a position within the frag, a size, an indication +of whether the fixup is PC relative, and a type. In a @code{BFD_ASSEMBLER} +GAS, the type is nominally a @code{bfd_reloc_code_real_type}, but several +targets use other type codes to represent fixups that can not be described as +relocations. +The @code{fixS} structure has a number of fields, several of which are obsolete +or are only used by a particular target. The important fields are: + +@table @code +@item fx_frag +The frag (@pxref{Frags}) this fixup is in. + +@item fx_where +The location within the frag where the fixup occurs. + +@item fx_addsy +The symbol this fixup is against. Typically, the value of this symbol is added +into the object contents. This may be NULL. + +@item fx_subsy +The value of this symbol is subtracted from the object contents. This is +normally NULL. + +@item fx_offset +A number which is added into the fixup. + +@item fx_addnumber +Some CPU backends use this field to convey information between +@code{md_apply_fix} and @code{tc_gen_reloc}. The machine independent code does +not use it. + +@item fx_next +The next fixup in the section. + +@item fx_r_type +The type of the fixup. This field is only defined if @code{BFD_ASSEMBLER}, or +if the target defines @code{NEED_FX_R_TYPE}. + +@item fx_size +The size of the fixup. This is mostly used for error checking. + +@item fx_pcrel +Whether the fixup is PC relative. + +@item fx_done +Non-zero if the fixup has been applied, and no relocation entry needs to be +generated. + +@item fx_file +@itemx fx_line +The file and line where the fixup was created. + +@item tc_fix_data +This has the type @code{TC_FIX_TYPE}, and is only defined if the target defines +that macro. +@end table + +@node Frags @subsection Frags @cindex internals, frags @cindex frags +@cindex fragS structure. -The frag is the basic unit for storing section contents. +The @code{fragS} structure is defined in @file{as.h}. Each frag represents a +portion of the final object file. As GAS reads the source file, it creates +frags to hold the data that it reads. At the end of the assembly the frags and +fixups are processed to produce the final contents. @table @code - @item fr_address The address of the frag. This is not set until the assembler rescans the list of all frags after the entire input file is parsed. The function @@ -145,15 +441,13 @@ Variable number of characters we may output, after the initial @code{fr_fix} characters. May be zero. -@item fr_symbol -@itemx fr_offset -Foo. - -@item fr_opcode -Points to the lowest-addressed byte of the opcode, for use in relaxation. +@item fr_offset +The interpretation of this field is controlled by @code{fr_type}. Generally, +if @code{fr_var} is non-zero, this is a repeat count: the @code{fr_var} +characters are output @code{fr_offset} times. @item line -Holds line-number info. +Holds line number info when an assembler listing was requested. @item fr_type Relaxation state. This field indicates the interpretation of @code{fr_offset}, @@ -164,18 +458,16 @@ @item fr_subtype Relaxation substate. If the macro @code{md_relax_frag} isn't defined, this is -assumed to be an index into @code{md_relax_table} for the generic relaxation -code to process. (@xref{Relaxation}.) If @code{md_relax_frag} is defined, -this field is available for any use by the CPU-specific code. - -@item align_mask -@itemx align_offset -These fields are not used yet. They are intended to keep track of the -alignment of the current frag within its section, even if the exact offset -isn't known. In many cases, we should be able to avoid creating extra frags -when @code{.align} directives are given; instead, the number of bytes needed -may be computable when the @code{.align} directive is processed. Hmm. Is this -the right place for these, or should they be in the @code{frchainS} structure? +assumed to be an index into @code{TC_GENERIC_RELAX_TABLE} for the generic +relaxation code to process (@pxref{Relaxation}). If @code{md_relax_frag} is +defined, this field is available for any use by the CPU-specific code. + +@item fr_symbol +This normally indicates the symbol to use when relaxing the frag according to +@code{fr_type}. + +@item fr_opcode +Points to the lowest-addressed byte of the opcode, for use in relaxation. @item fr_pcrel_adjust @itemx fr_bsr @@ -183,10 +475,13 @@ frag} is defined before the CPU-specific header files are included, they must unconditionally be defined. +@item fr_file +@itemx fr_line +The file and line where this frag was last modified. + @item fr_literal Declared as a one-character array, this last field grows arbitrarily large to hold the actual contents of the frag. - @end table These are the possible relaxation states, provided in the enumeration type @@ -194,22 +489,27 @@ fields: @table @code - @item rs_align +@itemx rs_align_code The start of the following frag should be aligned on some boundary. In this frag, @code{fr_offset} is the logarithm (base 2) of the alignment in bytes. (For example, if alignment on an 8-byte boundary were desired, @code{fr_offset} would have a value of 3.) The variable characters indicate the fill pattern to -be used. (More than one?) +be used. The @code{fr_subtype} field holds the maximum number of bytes to skip +when doing this alignment. If more bytes are needed, the alignment is not +done. An @code{fr_subtype} value of 0 means no maximum, which is the normal +case. Target backends can use @code{rs_align_code} to handle certain types of +alignment differently. @item rs_broken_word -This indicates that ``broken word'' processing should be done. @xref{Broken -Words,,Broken Words}. If broken word processing is not necessary on the target -machine, this enumerator value will not be defined. +This indicates that ``broken word'' processing should be done (@pxref{Broken +words}). If broken word processing is not necessary on the target machine, +this enumerator value will not be defined. @item rs_fill The variable characters are to be repeated @code{fr_offset} times. If -@code{fr_offset} is 0, this frag has a length of @code{fr_fix}. +@code{fr_offset} is 0, this frag has a length of @code{fr_fix}. Most frags +have this type. @item rs_machine_dependent Displacement relaxation is to be done on this frag. The target is indicated by @@ -218,24 +518,23 @@ @item rs_org The start of the following frag should be pushed back to some specific offset -within the section. (Some assemblers use the value as an absolute address; the -@sc{gnu} assembler does not handle final absolute addresses, it requires that -the linker set them.) The offset is given by @code{fr_symbol} and -@code{fr_offset}; one character from the variable-length tail is used as the -fill character. - +within the section. (Some assemblers use the value as an absolute address; GAS +does not handle final absolute addresses, but rather requires that the linker +set them.) The offset is given by @code{fr_symbol} and @code{fr_offset}; one +character from the variable-length tail is used as the fill character. @end table +@cindex frchainS structure A chain of frags is built up for each subsection. The data structure describing a chain is called a @code{frchainS}, and contains the following fields: @table @code @item frch_root -Points to the first frag in the chain. May be null if there are no frags in +Points to the first frag in the chain. May be NULL if there are no frags in this chain. @item frch_last -Points to the last frag in the chain, or null if there are none. +Points to the last frag in the chain, or NULL if there are none. @item frch_next Next in the list of @code{frchainS} structures. @item frch_seg @@ -243,11 +542,13 @@ @item frch_subseg Subsection (subsegment) number of this frag chain. @item fix_root, fix_tail -(Defined only if @code{BFD_ASSEMBLER} is defined.) Point to first and last +(Defined only if @code{BFD_ASSEMBLER} is defined). Point to first and last @code{fixS} structures associated with this subsection. @item frch_obstack Not currently used. Intended to be used for frag allocation for this subsection. This should reduce frag generation caused by switching sections. +@item frch_frag_now +The current frag for this subsegment. @end table A @code{frchainS} corresponds to a subsection; each section has a list of @@ -260,116 +561,693 @@ be generated, the frag chains are joined into one per section for further processing. After this point, it is safe to operate on one chain per section. -@node Broken Words -@subsection Broken Words -@cindex internals, broken words -@cindex broken words -@cindex promises, promises +The assembler always has a current frag, named @code{frag_now}. More space is +allocated for the current frag using the @code{frag_more} function; this +returns a pointer to the amount of requested space. Relaxing is done using +variant frags allocated by @code{frag_var} or @code{frag_variant} +(@pxref{Relaxation}). + +@node GAS processing +@section What GAS does when it runs +@cindex internals, overview + +This is a quick look at what an assembler run looks like. + +@itemize @bullet +@item +The assembler initializes itself by calling various init routines. + +@item +For each source file, the @code{read_a_source_file} function reads in the file +and parses it. The global variable @code{input_line_pointer} points to the +current text; it is guaranteed to be correct up to the end of the line, but not +farther. + +@item +For each line, the assembler passes labels to the @code{colon} function, and +isolates the first word. If it looks like a pseudo-op, the word is looked up +in the pseudo-op hash table @code{po_hash} and dispatched to a pseudo-op +routine. Otherwise, the target dependent @code{md_assemble} routine is called +to parse the instruction. + +@item +When pseudo-ops or instructions output data, they add it to a frag, calling +@code{frag_more} to get space to store it in. + +@item +Pseudo-ops and instructions can also output fixups created by @code{fix_new} or +@code{fix_new_exp}. + +@item +For certain targets, instructions can create variant frags which are used to +store relaxation information (@pxref{Relaxation}). + +@item +When the input file is finished, the @code{write_object_file} routine is +called. It assigns addresses to all the frags (@code{relax_segment}), resolves +all the fixups (@code{fixup_segment}), resolves all the symbol values (using +@code{resolve_symbol_value}), and finally writes out the file (in the +@code{BFD_ASSEMBLER} case, this is done by simply calling @code{bfd_close}). +@end itemize + +@node Porting GAS +@section Porting GAS +@cindex porting + +Each GAS target specifies two main things: the CPU file and the object format +file. Two main switches in the @file{configure.in} file handle this. The +first switches on CPU type to set the shell variable @code{cpu_type}. The +second switches on the entire target to set the shell variable @code{fmt}. + +The configure script uses the value of @code{cpu_type} to select two files in +the @file{config} directory: @file{tc-@var{CPU}.c} and @file{tc-@var{CPU}.h}. +The configuration process will create a file named @file{targ-cpu.h} in the +build directory which includes @file{tc-@var{CPU}.h}. + +The configure script also uses the value of @code{fmt} to select two files: +@file{obj-@var{fmt}.c} and @file{obj-@var{fmt}.h}. The configuration process +will create a file named @file{obj-format.h} in the build directory which +includes @file{obj-@var{fmt}.h}. + +You can also set the emulation in the configure script by setting the @code{em} +variable. Normally the default value of @samp{generic} is fine. The +configuration process will create a file named @file{targ-env.h} in the build +directory which includes @file{te-@var{em}.h}. + +Porting GAS to a new CPU requires writing the @file{tc-@var{CPU}} files. +Porting GAS to a new object file format requires writing the +@file{obj-@var{fmt}} files. There is sometimes some interaction between these +two files, but it is normally minimal. + +The best approach is, of course, to copy existing files. The documentation +below assumes that you are looking at existing files to see usage details. + +These interfaces have grown over time, and have never been carefully thought +out or designed. Nothing about the interfaces described here is cast in stone. +It is possible that they will change from one version of the assembler to the +next. Also, new macros are added all the time as they are needed. + +@menu +* CPU backend:: Writing a CPU backend +* Object format backend:: Writing an object format backend +* Emulations:: Writing emulation files +@end menu + +@node CPU backend +@subsection Writing a CPU backend +@cindex CPU backend +@cindex @file{tc-@var{CPU}} + +The CPU backend files are the heart of the assembler. They are the only parts +of the assembler which actually know anything about the instruction set of the +processor. + +You must define a reasonably small list of macros and functions in the CPU +backend files. You may define a large number of additional macros in the CPU +backend files, not all of which are documented here. You must, of course, +define macros in the @file{.h} file, which is included by every assembler +source file. You may define the functions as macros in the @file{.h} file, or +as functions in the @file{.c} file. + +@table @code +@item TC_@var{CPU} +@cindex TC_@var{CPU} +By convention, you should define this macro in the @file{.h} file. For +example, @file{tc-m68k.h} defines @code{TC_M68K}. You might have to use this +if it is necessary to add CPU specific code to the object format file. + +@item TARGET_FORMAT +This macro is the BFD target name to use when creating the output file. This +will normally depend upon the @code{OBJ_@var{FMT}} macro. + +@item TARGET_ARCH +This macro is the BFD architecture to pass to @code{bfd_set_arch_mach}. + +@item TARGET_MACH +This macro is the BFD machine number to pass to @code{bfd_set_arch_mach}. If +it is not defined, GAS will use 0. + +@item TARGET_BYTES_BIG_ENDIAN +You should define this macro to be non-zero if the target is big endian, and +zero if the target is little endian. + +@item md_shortopts +@itemx md_longopts +@itemx md_longopts_size +@itemx md_parse_option +@itemx md_show_usage +@cindex md_shortopts +@cindex md_longopts +@cindex md_longopts_size +@cindex md_parse_option +@cindex md_show_usage +GAS uses these variables and functions during option processing. +@code{md_shortopts} is a @code{const char *} which GAS adds to the machine +independent string passed to @code{getopt}. @code{md_longopts} is a +@code{struct option []} which GAS adds to the machine independent long options +passed to @code{getopt}; you may use @code{OPTION_MD_BASE}, defined in +@file{as.h}, as the start of a set of long option indices, if necessary. +@code{md_longopts_size} is a @code{size_t} holding the size @code{md_longopts}. +GAS will call @code{md_parse_option} whenever @code{getopt} returns an +unrecognized code, presumably indicating a special code value which appears in +@code{md_longopts}. GAS will call @code{md_show_usage} when a usage message is +printed; it should print a description of the machine specific options. + +@item md_begin +@cindex md_begin +GAS will call this function at the start of the assembly, after the command +line arguments have been parsed and all the machine independent initializations +have been completed. + +@item md_cleanup +@cindex md_cleanup +If you define this macro, GAS will call it at the end of each input file. + +@item md_assemble +@cindex md_assemble +GAS will call this function for each input line which does not contain a +pseudo-op. The argument is a null terminated string. The function should +assemble the string as an instruction with operands. Normally +@code{md_assemble} will do this by calling @code{frag_more} and writing out +some bytes (@pxref{Frags}). @code{md_assemble} will call @code{fix_new} to +create fixups as needed (@pxref{Fixups}). Targets which need to do special +purpose relaxation will call @code{frag_var}. + +@item md_pseudo_table +@cindex md_pseudo_table +This is a const array of type @code{pseudo_typeS}. It is a mapping from +pseudo-op names to functions. You should use this table to implement +pseudo-ops which are specific to the CPU. + +@item tc_conditional_pseudoop +@cindex tc_conditional_pseudoop +If this macro is defined, GAS will call it with a @code{pseudo_typeS} argument. +It should return non-zero if the pseudo-op is a conditional which controls +whether code is assembled, such as @samp{.if}. GAS knows about the normal +conditional pseudo-ops,and you should normally not have to define this macro. + +@item comment_chars +@cindex comment_chars +This is a null terminated @code{const char} array of characters which start a +comment. + +@item tc_comment_chars +@cindex tc_comment_chars +If this macro is defined, GAS will use it instead of @code{comment_chars}. + +@item line_comment_chars +@cindex line_comment_chars +This is a null terminated @code{const char} array of characters which start a +comment when they appear at the start of a line. + +@item line_separator_chars +@cindex line_separator_chars +This is a null terminated @code{const char} array of characters which separate +lines (the semicolon is such a character by default, and need not be listed in +this array). + +@item EXP_CHARS +@cindex EXP_CHARS +This is a null terminated @code{const char} array of characters which may be +used as the exponent character in a floating point number. This is normally +@code{"eE"}. + +@item FLT_CHARS +@cindex FLT_CHARS +This is a null terminated @code{const char} array of characters which may be +used to indicate a floating point constant. A zero followed by one of these +characters is assumed to be followed by a floating point number; thus they +operate the way that @code{0x} is used to indicate a hexadecimal constant. +Usually this includes @samp{r} and @samp{f}. + +@item LEX_AT +@cindex LEX_AT +You may define this macro to the lexical type of the @kbd{@}} character. The +default is zero. + +Lexical types are a combination of @code{LEX_NAME} and @code{LEX_BEGIN_NAME}, +both defined in @file{read.h}. @code{LEX_NAME} indicates that the character +may appear in a name. @code{LEX_BEGIN_NAME} indicates that the character may +appear at the beginning of a nem. + +@item LEX_BR +@cindex LEX_BR +You may define this macro to the lexical type of the brace characters @kbd{@{}, +@kbd{@}}, @kbd{[}, and @kbd{]}. The default value is zero. + +@item LEX_PCT +@cindex LEX_PCT +You may define this macro to the lexical type of the @kbd{%} character. The +default value is zero. + +@item LEX_QM +@cindex LEX_QM +You may define this macro to the lexical type of the @kbd{?} character. The +default value it zero. + +@item LEX_DOLLAR +@cindex LEX_DOLLAR +You may define this macro to the lexical type of the @kbd{$} character. The +default value is @code{LEX_NAME | LEX_BEGIN_NAME}. + +@item SINGLE_QUOTE_STRINGS +@cindex SINGLE_QUOTE_STRINGS +If you define this macro, GAS will treat single quotes as string delimiters. +Normally only double quotes are accepted as string delimiters. + +@item NO_STRING_ESCAPES +@cindex NO_STRING_ESCAPES +If you define this macro, GAS will not permit escape sequences in a string. + +@item ONLY_STANDARD_ESCAPES +@cindex ONLY_STANDARD_ESCAPES +If you define this macro, GAS will warn about the use of nonstandard escape +sequences in a string. + +@item md_start_line_hook +@cindex md_start_line_hook +If you define this macro, GAS will call it at the start of each line. + +@item LABELS_WITHOUT_COLONS +@cindex LABELS_WITHOUT_COLONS +If you define this macro, GAS will assume that any text at the start of a line +is a label, even if it does not have a colon. + +@item TC_START_LABEL +@cindex TC_START_LABEL +You may define this macro to control what GAS considers to be a label. The +default definition is to accept any name followed by a colon character. + +@item NO_PSEUDO_DOT +@cindex NO_PSEUDO_DOT +If you define this macro, GAS will not require pseudo-ops to start with a +@kbd{.} character. + +@item TC_EQUAL_IN_INSN +@cindex TC_EQUAL_IN_INSN +If you define this macro, it should return nonzero if the instruction is +permitted to contain an @kbd{=} character. GAS will use this to decide if a +@kbd{=} is an assignment or an instruction. + +@item TC_EOL_IN_INSN +@cindex TC_EOL_IN_INSN +If you define this macro, it should return nonzero if the current input line +pointer should be treated as the end of a line. + +@item md_parse_name +@cindex md_parse_name +If this macro is defined, GAS will call it for any symbol found in an +expression. You can define this to handle special symbols in a special way. +If a symbol always has a certain value, you should normally enter it in the +symbol table, perhaps using @code{reg_section}. + +@item md_undefined_symbol +@cindex md_undefined_symbol +GAS will call this function when a symbol table lookup fails, before it +creates a new symbol. Typically this would be used to supply symbols whose +name or value changes dynamically, possibly in a context sensitive way. +Predefined symbols with fixed values, such as register names or condition +codes, are typically entered directly into the symbol table when @code{md_begin} +is called. + +@item md_operand +@cindex md_operand +GAS will call this function for any expression that can not be recognized. +When the function is called, @code{input_line_pointer} will point to the start +of the expression. + +@item tc_unrecognized_line +@cindex tc_unrecognized_line +If you define this macro, GAS will call it when it finds a line that it can not +parse. + +@item md_do_align +@cindex md_do_align +You may define this macro to handle an alignment directive. GAS will call it +when the directive is seen in the input file. For example, the i386 backend +uses this to generate efficient nop instructions of varying lengths, depending +upon the number of bytes that the alignment will skip. + +@item HANDLE_ALIGN +@cindex HANDLE_ALIGN +You may define this macro to do special handling for an alignment directive. +GAS will call it at the end of the assembly. + +@item md_flush_pending_output +@cindex md_flush_pending_output +If you define this macro, GAS will call it each time it skips any space because of a +space filling or alignment or data allocation pseudo-op. + +@item TC_PARSE_CONS_EXPRESSION +@cindex TC_PARSE_CONS_EXPRESSION +You may define this macro to parse an expression used in a data allocation +pseudo-op such as @code{.word}. You can use this to recognize relocation +directives that may appear in such directives. + +@item BITFIELD_CONS_EXPRESSION +@cindex BITFIELD_CONS_EXPRESSION +If you define this macro, GAS will recognize bitfield instructions in data +allocation pseudo-ops, as used on the i960. + +@item REPEAT_CONS_EXPRESSION +@cindex REPEAT_CONS_EXPRESSION +If you define this macro, GAS will recognize repeat counts in data allocation +pseudo-ops, as used on the MIPS. + +@item md_cons_align +@cindex md_cons_align +You may define this macro to do any special alignment before a data allocation +pseudo-op. + +@item TC_CONS_FIX_NEW +@cindex TC_CONS_FIX_NEW +You may define this macro to generate a fixup for a data allocation pseudo-op. + +@item md_number_to_chars +@cindex md_number_to_chars +This should just call either @code{number_to_chars_bigendian} or +@code{number_to_chars_littleendian}, whichever is appropriate. On targets like +the MIPS which support options to change the endianness, which function to call +is a runtime decision. On other targets, @code{md_number_to_chars} can be a +simple macro. + +@item md_reloc_size +@cindex md_reloc_size +This variable is only used in the original version of gas (not +@code{BFD_ASSEMBLER} and not @code{MANY_SEGMENTS}). It holds the size of a +relocation entry. + +@item WORKING_DOT_WORD +@itemx md_short_jump_size +@itemx md_long_jump_size +@itemx md_create_short_jump +@itemx md_create_long_jump +@cindex WORKING_DOT_WORD +@cindex md_short_jump_size +@cindex md_long_jump_size +@cindex md_create_short_jump +@cindex md_create_long_jump +If @code{WORKING_DOT_WORD} is defined, GAS will not do broken word processing +(@pxref{Broken words}). Otherwise, you should set @code{md_short_jump_size} to +the size of a short jump (a jump that is just long enough to jump around a long +jmp) and @code{md_long_jump_size} to the size of a long jump (a jump that can +go anywhere in the function), You should define @code{md_create_short_jump} to +create a short jump around a long jump, and define @code{md_create_long_jump} +to create a long jump. + +@item md_estimate_size_before_relax +@cindex md_estimate_size_before_relax +This function returns an estimate of the size of a @code{rs_machine_dependent} +frag before any relaxing is done. It may also create any necessary +relocations. + +@item md_relax_frag +@cindex md_relax_frag +This macro may be defined to relax a frag. GAS will call this with the frag +and the change in size of all previous frags; @code{md_relax_frag} should +return the change in size of the frag. @xref{Relaxation}. + +@item TC_GENERIC_RELAX_TABLE +@cindex TC_GENERIC_RELAX_TABLE +If you do not define @code{md_relax_frag}, you may define +@code{TC_GENERIC_RELAX_TABLE} as a table of @code{relax_typeS} structures. The +machine independent code knows how to use such a table to relax PC relative +references. See @file{tc-m68k.c} for an example. @xref{Relaxation}. + +@item md_prepare_relax_scan +@cindex md_prepare_relax_scan +If defined, it is a C statement that is invoked prior to scanning +the relax table. + +@item LINKER_RELAXING_SHRINKS_ONLY +@cindex LINKER_RELAXING_SHRINKS_ONLY +If you define this macro, and the global variable @samp{linkrelax} is set +(because of a command line option, or unconditionally in @code{md_begin}), a +@samp{.align} directive will cause extra space to be allocated. The linker can +then discard this space when relaxing the section. + +@item md_convert_frag +@cindex md_convert_frag +GAS will call this for each rs_machine_dependent fragment. +The instruction is completed using the data from the relaxation pass. +It may also create any necessary relocations. +@xref{Relaxation}. + +@item md_apply_fix +@cindex md_apply_fix +GAS will call this for each fixup. It should store the correct value in the +object file. + +@item TC_HANDLES_FX_DONE +@cindex TC_HANDLES_FX_DONE +If this macro is defined, it means that @code{md_apply_fix} correctly sets the +@code{fx_done} field in the fixup. + +@item tc_gen_reloc +@cindex tc_gen_reloc +A @code{BFD_ASSEMBLER} GAS will call this to generate a reloc. GAS will pass +the resulting reloc to @code{bfd_install_relocation}. This currently works +poorly, as @code{bfd_install_relocation} often does the wrong thing, and +instances of @code{tc_gen_reloc} have been written to work around the problems, +which in turns makes it difficult to fix @code{bfd_install_relocation}. + +@item RELOC_EXPANSION_POSSIBLE +@cindex RELOC_EXPANSION_POSSIBLE +If you define this macro, it means that @code{tc_gen_reloc} may return multiple +relocation entries for a single fixup. In this case, the return value of +@code{tc_gen_reloc} is a pointer to a null terminated array. + +@item MAX_RELOC_EXPANSION +@cindex MAX_RELOC_EXPANSION +You must define this if @code{RELOC_EXPANSION_POSSIBLE} is defined; it +indicates the largest number of relocs which @code{tc_gen_reloc} may return for +a single fixup. + +@item tc_fix_adjustable +@cindex tc_fix_adjustable +You may define this macro to indicate whether a fixup against a locally defined +symbol should be adjusted to be against the section symbol. It should return a +non-zero value if the adjustment is acceptable. + +@item MD_PCREL_FROM_SECTION +@cindex MD_PCREL_FROM_SECTION +If you define this macro, it should return the offset between the address of a +PC relative fixup and the position from which the PC relative adjustment should +be made. On many processors, the base of a PC relative instruction is the next +instruction, so this macro would return the length of an instruction. + +@item md_pcrel_from +@cindex md_pcrel_from +This is the default value of @code{MD_PCREL_FROM_SECTION}. The difference is +that @code{md_pcrel_from} does not take a section argument. + +@item tc_frob_label +@cindex tc_frob_label +If you define this macro, GAS will call it each time a label is defined. + +@item md_section_align +@cindex md_section_align +GAS will call this function for each section at the end of the assembly, to +permit the CPU backend to adjust the alignment of a section. + +@item tc_frob_section +@cindex tc_frob_section +If you define this macro, a @code{BFD_ASSEMBLER} GAS will call it for each +section at the end of the assembly. + +@item tc_frob_file_before_adjust +@cindex tc_frob_file_before_adjust +If you define this macro, GAS will call it after the symbol values are +resolved, but before the fixups have been changed from local symbols to section +symbols. + +@item tc_frob_symbol +@cindex tc_frob_symbol +If you define this macro, GAS will call it for each symbol. You can indicate +that the symbol should not be included in the object file by definining this +macro to set its second argument to a non-zero value. + +@item tc_frob_file +@cindex tc_frob_file +If you define this macro, GAS will call it after the symbol table has been +completed, but before the relocations have been generated. + +@item tc_frob_file_after_relocs +If you define this macro, GAS will call it after the relocs have been +generated. + +@item LISTING_HEADER +A string to use on the header line of a listing. The default value is simply +@code{"GAS LISTING"}. + +@item LISTING_WORD_SIZE +The number of bytes to put into a word in a listing. This affects the way the +bytes are clumped together in the listing. For example, a value of 2 might +print @samp{1234 5678} where a value of 1 would print @samp{12 34 56 78}. The +default value is 4. + +@item LISTING_LHS_WIDTH +The number of words of data to print on the first line of a listing for a +particular source line, where each word is @code{LISTING_WORD_SIZE} bytes. The +default value is 1. + +@item LISTING_LHS_WIDTH_SECOND +Like @code{LISTING_LHS_WIDTH}, but applying to the second and subsequent line +of the data printed for a particular source line. The default value is 1. + +@item LISTING_LHS_CONT_LINES +The maximum number of continuation lines to print in a listing for a particular +source line. The default value is 4. + +@item LISTING_RHS_WIDTH +The maximum number of characters to print from one line of the input file. The +default value is 100. +@end table + +@node Object format backend +@subsection Writing an object format backend +@cindex object format backend +@cindex @file{obj-@var{fmt}} + +As with the CPU backend, the object format backend must define a few things, +and may define some other things. The interface to the object format backend +is generally simpler; most of the support for an object file format consists of +defining a number of pseudo-ops. + +The object format @file{.h} file must include @file{targ-cpu.h}. + +This section will only define the @code{BFD_ASSEMBLER} version of GAS. It is +impossible to support a new object file format using any other version anyhow, +as the original GAS version only supports a.out, and the @code{MANY_SEGMENTS} +GAS version only supports COFF. + +@table @code +@item OBJ_@var{format} +@cindex OBJ_@var{format} +By convention, you should define this macro in the @file{.h} file. For +example, @file{obj-elf.h} defines @code{OBJ_ELF}. You might have to use this +if it is necessary to add object file format specific code to the CPU file. + +@item obj_begin +If you define this macro, GAS will call it at the start of the assembly, after +the command line arguments have been parsed and all the machine independent +initializations have been completed. + +@item obj_app_file +@cindex obj_app_file +If you define this macro, GAS will invoke it when it sees a @code{.file} +pseudo-op or a @samp{#} line as used by the C preprocessor. + +@item OBJ_COPY_SYMBOL_ATTRIBUTES +@cindex OBJ_COPY_SYMBOL_ATTRIBUTES +You should define this macro to copy object format specific information from +one symbol to another. GAS will call it when one symbol is equated to +another. + +@item obj_fix_adjustable +@cindex obj_fix_adjustable +You may define this macro to indicate whether a fixup against a locally defined +symbol should be adjusted to be against the section symbol. It should return a +non-zero value if the adjustment is acceptable. + +@item obj_sec_sym_ok_for_reloc +@cindex obj_sec_sym_ok_for_reloc +You may define this macro to indicate that it is OK to use a section symbol in +a relocateion entry. If it is not, GAS will define a new symbol at the start +of a section. + +@item EMIT_SECTION_SYMBOLS +@cindex EMIT_SECTION_SYMBOLS +You should define this macro with a zero value if you do not want to include +section symbols in the output symbol table. The default value for this macro +is one. + +@item obj_adjust_symtab +@cindex obj_adjust_symtab +If you define this macro, GAS will invoke it just before setting the symbol +table of the output BFD. For example, the COFF support uses this macro to +generate a @code{.file} symbol if none was generated previously. + +@item SEPARATE_STAB_SECTIONS +@cindex SEPARATE_STAB_SECTIONS +You may define this macro to indicate that stabs should be placed in separate +sections, as in ELF. + +@item INIT_STAB_SECTION +@cindex INIT_STAB_SECTION +You may define this macro to initialize the stabs section in the output file. + +@item OBJ_PROCESS_STAB +@cindex OBJ_PROCESS_STAB +You may define this macro to do specific processing on a stabs entry. + +@item obj_frob_section +@cindex obj_frob_section +If you define this macro, GAS will call it for each section at the end of the +assembly. + +@item obj_frob_file_before_adjust +@cindex obj_frob_file_before_adjust +If you define this macro, GAS will call it after the symbol values are +resolved, but before the fixups have been changed from local symbols to section +symbols. + +@item obj_frob_symbol +@cindex obj_frob_symbol +If you define this macro, GAS will call it for each symbol. You can indicate +that the symbol should not be included in the object file by definining this +macro to set its second argument to a non-zero value. + +@item obj_frob_file +@cindex obj_frob_file +If you define this macro, GAS will call it after the symbol table has been +completed, but before the relocations have been generated. + +@item obj_frob_file_after_relocs +If you define this macro, GAS will call it after the relocs have been +generated. +@end table + +@node Emulations +@subsection Writing emulation files -The ``broken word'' idea derives from the fact that some compilers, including -@code{gcc}, will sometimes emit switch tables specifying 16-bit @code{.word} -displacements to branch targets, and branch instructions that load entries from -that table to compute the target address. If this is done on a 32-bit machine, -there is a chance (at least with really large functions) that the displacement -will not fit in 16 bits. Thus the ``broken word'' idea is well named, since -there is an implied promise that the 16-bit field will in fact hold the -specified displacement. - -If the ``broken word'' processing is enabled, and a situation like this is -encountered, the assembler will insert a jump instruction into the instruction -stream, close enough to be reached with the 16-bit displacement. This jump -instruction will transfer to the real desired target address. Thus, as long as -the @code{.word} value really is used as a displacement to compute an address -to jump to, the net effect will be correct (minus a very small efficiency -cost). If @code{.word} directives with label differences for values are used -for other purposes, however, things may not work properly. I think there is a -command-line option to turn on warnings when a broken word is discovered. - -This code is turned off by the @code{WORKING_DOT_WORD} macro. It isn't needed -if @code{.word} emits a value large enough to contain an address (or, more -correctly, any possible difference between two addresses). - -@node What Happens? -@section What Happens? - -Blah blah blah, initialization, argument parsing, file reading, whitespace -munging, opcode parsing and lookup, operand parsing. Now it's time to write -the output file. - -In @code{BFD_ASSEMBLER} mode, processing of relocations and symbols and -creation of the output file is initiated by calling @code{write_object_file}. - -@node Target Dependent Definitions -@section Target Dependent Definitions - -@subsection Format-specific definitions - -@defmac obj_sec_sym_ok_for_reloc (section) -(@code{BFD_ASSEMBLER} only.) -Is it okay to use this section's section-symbol in a relocation entry? If not, -a new internal-linkage symbol is generated and emitted if such a relocation -entry is needed. (Default: Always use a new symbol.) - -@end defmac - -@defmac obj_adjust_symtab -(@code{BFD_ASSEMBLER} only.) -If this macro is defined, it is invoked just before setting the symbol table of -the output BFD. Any finalizing changes needed in the symbol table should be -done here. For example, in the COFF support, if there is no @code{.file} -symbol defined already, one is generated at this point. If no such adjustments -are needed, this macro need not be defined. - -@end defmac - -@defmac EMIT_SECTION_SYMBOLS -(@code{BFD_ASSEMBLER} only.) -Should section symbols be included in the symbol list if they're used in -relocations? Some formats can generate section-relative relocations, and thus -don't need symbols emitted for them. (Default: 1.) -@end defmac - -@defmac obj_app_file (string) -This macro is invoked when a @code{.file} directive is seen, or a -@code{#@var{line}} directive with a file name. Currently it is defined only -for COFF and ELF. (Default: No action.) -@end defmac - -@defmac obj_frob_file -Any final cleanup needed before writing out the BFD may be done here. For -example, ECOFF formats (and MIPS ELF format) may do some work on the MIPS-style -symbol table with its integrated debug information. The symbol table should -not be modified at this time. -@end defmac - -@subsection CPU-specific definitions - -@defmac TARGET_BYTES_BIG_ENDIAN -Define as one or zero, depending on whether the default configuration for this -processor uses big-endian byte order. The variable @var{target_big_endian} is -initialized with this variable, but can be changed while processing -command-line options for processors that can utilize either byte order. -(Default: 0.) - -Currently some CPU support does not examine this value, and therefore does not -bother setting it. Eventually, all CPU backend files should set it. -@end defmac +Normally you do not have to write an emulation file. You can just use +@file{te-generic.h}. + +If you do write your own emulation file, it must include @file{obj-format.h}. + +An emulation file will often define @code{TE_@var{EM}}; this may then be used +in other files to change the output. @node Relaxation -@subsubsection Relaxation -@cindex Relaxation +@section Relaxation +@cindex relaxation + +@dfn{Relaxation} is a generic term used when the size of some instruction or +data depends upon the value of some symbol or other data. -If @code{md_relax_frag} isn't defined, and @code{TC_GENERIC_RELAX_TABLE} is, -the assembler will perform some relaxation on @code{rs_machine_dependent} frags +GAS knows to relax a particular type of PC relative relocation using a table. +You can also define arbitrarily complex forms of relaxation yourself. + +@menu +* Relaxing with a table:: Relaxing with a table +* General relaxing:: General relaxing +@end menu + +@node Relaxing with a table +@subsection Relaxing with a table + +If you do not define @code{md_relax_frag}, and you do define +@code{TC_GENERIC_RELAX_TABLE}, GAS will relax @code{rs_machine_dependent} frags based on the frag subtype and the displacement to some specified target -address. The basic idea is that many machines have different addressing modes -for instructions that can specify different ranges of values, with successive -modes able to access wider ranges, including the entirety of the previous -range. Smaller ranges are assumed to be more desirable (perhaps the +address. The basic idea is that several machines have different addressing +modes for instructions that can specify different ranges of values, with +successive modes able to access wider ranges, including the entirety of the +previous range. Smaller ranges are assumed to be more desirable (perhaps the instruction requires one word instead of two or three); if this is not the case, don't describe the smaller-range, inferior mode. -The @code{fr_subtype} and the field of a frag is an index into a CPU-specific +The @code{fr_subtype} field of a frag is an index into a CPU-specific relaxation table. That table entry indicates the range of values that can be stored, the number of bytes that will have to be added to the frag to accomodate the addressing mode, and the index of the next entry to examine if @@ -383,24 +1261,16 @@ The value fitted by the relaxation code is always assumed to be a displacement from the current frag. (More specifically, from @code{fr_fix} bytes into the -frag.) This seems kinda silly. What about fitting small absolute values? I -suppose @code{md_assemble} is supposed to take care of that, but if the operand -is a difference between symbols, it might not be able to, if the difference was -not computable yet. +frag.) +@ignore +This seems kinda silly. What about fitting small absolute values? I suppose +@code{md_assemble} is supposed to take care of that, but if the operand is a +difference between symbols, it might not be able to, if the difference was not +computable yet. +@end ignore The end of the relaxation sequence is indicated by a ``next'' value of 0. This -is kinda silly too, since it means that the first entry in the table can't be -used. I think -1 would make a more logical sentinel value. - -The table @code{md_relax_table} from @file{targ-cpu.c} describes the relaxation -modes available. Currently this must always be provided, even on machines for -which this type of relaxation isn't possible or practical. Probably fewer than -half the machines gas supports used it; it ought to be made conditional on some -CPU-specific macro. Currently, also that table must be declared ``const;'' on -some machines, though, it might make sense to keep it writeable, so it can be -modified depending on which CPU of a family is specified. For example, in the -m68k family, the 68020 has some addressing modes that are not available on the -68000. +means that the first entry in the table can't be used. For some configurations, the linker can do relaxing within a section of an object file. If call instructions of various sizes exist, the linker can @@ -418,7 +1288,7 @@ For the H8/300, I think the linker expands calls that can't reach, and doesn't worry about alignment issues; the cpu probably never needs any significant -alignment beyond the instruction size. But I'm not sure; check with Steve. +alignment beyond the instruction size. The relaxation table type contains these fields: @@ -430,8 +1300,7 @@ @item rlx_length Length in bytes of this addressing mode. @item rlx_more -Index of the next-longer relax state, or zero if there is no ``next'' -relax state. +Index of the next-longer relax state, or zero if there is no next relax state. @end table The relaxation is done in @code{relax_segment} in @file{write.c}. The @@ -448,16 +1317,11 @@ frag_var as the second argument.) If relocation records are needed, they should be emitted by -@code{md_estimate_size_before_relax}. - -These are the machine-specific definitions associated with the relaxation -mechanism: - -@deftypefun int md_estimate_size_before_relax (fragS *@var{frag}, segT @var{sec}) -This function should examine the target symbol of the supplied frag and correct -the @code{fr_subtype} of the frag if needed. When this function is called, if -the symbol has not yet been defined, it will not become defined later; however, -its value may still change if the section it is in gets relaxed. +@code{md_estimate_size_before_relax}. This function should examine the target +symbol of the supplied frag and correct the @code{fr_subtype} of the frag if +needed. When this function is called, if the symbol has not yet been defined, +it will not become defined later; however, its value may still change if the +section it is in gets relaxed. Usually, if the symbol is in the same section as the frag (given by the @var{sec} argument), the narrowest likely relaxation mode is stored in @@ -476,242 +1340,88 @@ called. I'm not sure, but I think this is to keep @code{fr_fix} referring to an earlier byte, and @code{fr_subtype} set to @code{rs_machine_dependent} so that @code{md_convert_frag} will get called. -@end deftypefun -@defmac TC_GENERIC_RELAX_TABLE -This macro should return a value appropriate for assignment to a variable of -type @code{const struct relax_type *}. Typically, it will simply expand to -@code{md_relax_table}, declared in @file{targ-cpu.h} as an array of -(@code{const} or non-@code{const}) @code{struct relax_type} elements. -@end defmac - -@defmac md_relax_frag (@var{frag}) -This macro, if defined, overrides all of the processing described above. It's -only defined for the MIPS target CPU, and there it doesn't do anything; it's -used solely to disable the relaxing code and free up the @code{fr_subtype} -field for use by the CPU-specific code. -@end defmac +@node General relaxing +@subsection General relaxing -@defmac LINKER_RELAXING_SHRINKS_ONLY -If this macro is defined, and the @samp{linkrelax} flag is turned on, a -@samp{.align} directive will cause extra space to be allocated. The linker can -then discard this space when relaxing the section. -@end defmac - -@defmac WORKING_DOT_WORD -This may be defined in the target cpu header file if @code{.word} directives -will never need the ``broken word'' processing performed. - -It is also defined by @file{obj-coff.h} if @code{BFD_ASSEMBLER} is not defined, -but I'm not sure why. -@end defmac - -@defmac tc_frob_file -Like @code{obj_frob_file}, this macro handles miscellaneous last-minute -cleanup. Currently only used on PowerPC/POWER support, for setting up a -@code{.debug} section. This macro should not cause the symbol table to be -modified. - -@end defmac +If using a simple table is not suitable, you may implement arbitrarily complex +relaxation semantics yourself. For example, the MIPS backend uses this to emit +different instruction sequences depending upon the size of the symbol being +accessed. + +When you assemble an instruction that may need relaxation, you should allocate +a frag using @code{frag_var} or @code{frag_variant} with a type of +@code{rs_machine_dependent}. You should store some sort of information in the +@code{fr_subtype} field so that you can figure out what to do with the frag +later. + +When GAS reaches the end of the input file, it will look through the frags and +work out their final sizes. + +GAS will first call @code{md_estimate_size_before_relax} on each +@code{rs_machine_dependent} frag. This function must return an estimated size +for the frag. + +GAS will then loop over the frags, calling @code{md_relax_frag} on each +@code{rs_machine_dependent} frag. This function should return the change in +size of the frag. GAS will keep looping over the frags until none of the frags +changes size. @node Broken words -@subsubsection Broken words +@section Broken words +@cindex internals, broken words @cindex broken words -@cindex words, broken - -If @code{WORKING_DOT_WORD} is not defined, this code is enabled. - -It makes use of at least two target-specific variables: - -@deftypevar int md_short_jump_size -@deftypevarx int md_long_jump_size -These variables indicate, oh, something or other. If @code{WORKING_DOT_WORD} -is not defined, they do not need to be defined. -@end deftypevar - -@node Source File Summary -@section Source File Summary - -@subsection File Format Descriptions - -@subheading a.out - -The @code{a.out} format is described by @file{obj-aout.*}. - -@subheading b.out - -The @code{b.out} format, described by @file{obj-bout.*}, is similar to -@code{a.out} format, except for a few additional fields in the file header -describing section alignment and address. - -@subheading COFF - -Originally, @file{obj-coff} was a purely non-BFD version, and -@file{obj-coffbfd} was created to use BFD for low-level byte-swapping. When -the @code{BFD_ASSEMBLER} conversion started, the first COFF target to be -converted was using @file{obj-coff}, and the two files had diverged somewhat, -and I didn't feel like first converting the support of that target over to use -the low-level BFD interface. - -So @file{obj-coff} got converted, and to simplify certain things, -@file{obj-coffbfd} got ``merged'' in with a brute-force approach. -Specifically, preprocessor conditionals testing for @code{BFD_ASSEMBLER} -effectively split the @file{obj-coff} files into the two separate versions. It -isn't pretty. They will be merged more thoroughly, and eventually only the -higher-level interface will be used. - -@subheading ECOFF - -All ECOFF configurations use BFD for writing object files. - -@subheading ELF - -ELF is a fairly reasonable format, without many of the deficiencies the other -object file formats have. (It's got some of its own, but not as bad as the -others.) All ELF configurations use BFD for writing object files. - -@subheading EVAX - -This is the format used on VMS. Yes, someone has actually written BFD support -for it. The code hasn't been integrated yet though. - -@subheading HP300? - -@subheading IEEE? - -@subheading SOM - -@subheading XCOFF - -The XCOFF configuration is based on the COFF cofiguration (using the -higher-level BFD interface). In fact, it uses the same files in the assembler. - -@subheading VMS - -This is the old Vax VMS support. It doesn't use BFD. - -@subsection Processor Descriptions - -Foo: a29k, alpha, h8300, h8500, hppa, i386, i860, i960, m68k, m88k, mips, -ns32k, ppc, sh, sparc, tahoe, vax, z8k. - -@node M68k -@subsubsection M68k -The operand syntax handling is atrocious. There is no clear specification of -the operand syntax. I'm looking into using a Bison grammar to replace much of -it. +Some compilers, including GCC, will sometimes emit switch tables specifying +16-bit @code{.word} displacements to branch targets, and branch instructions +that load entries from that table to compute the target address. If this is +done on a 32-bit machine, there is a chance (at least with really large +functions) that the displacement will not fit in 16 bits. The assembler +handles this using a concept called @dfn{broken words}. This idea is well +named, since there is an implied promise that the 16-bit field will in fact +hold the specified displacement. + +If broken word processing is enabled, and a situation like this is encountered, +the assembler will insert a jump instruction into the instruction stream, close +enough to be reached with the 16-bit displacement. This jump instruction will +transfer to the real desired target address. Thus, as long as the @code{.word} +value really is used as a displacement to compute an address to jump to, the +net effect will be correct (minus a very small efficiency cost). If +@code{.word} directives with label differences for values are used for other +purposes, however, things may not work properly. For targets which use broken +words, the @samp{-K} option will warn when a broken word is discovered. + +The broken word code is turned off by the @code{WORKING_DOT_WORD} macro. It +isn't needed if @code{.word} emits a value large enough to contain an address +(or, more correctly, any possible difference between two addresses). -Operands on the 68k series processors can have two displacement values -specified, plus a base register and a (possibly scaled) index register of which -only some bits might be used. Thus a single 68k operand requires up to two -expressions, two register numbers, and size and scale factors. The -@code{struct m68k_op} type also includes a field indicating the mode of the -operand, and an @code{error} field indicating a problem encountered while -parsing the operand. +@node Internal functions +@section Internal functions -An instruction on the 68k may have up to 6 operands, although most of them have -to be simple register operands. Up to 11 (16-bit) words may be required to -express the instruction. +This section describes basic internal functions used by GAS. -A @code{struct m68k_exp} expression contains an @code{expressionS}, pointers to -the first and last characters of the input that produced the expression, an -indication of the section to which the expression belongs, and a size field. -I'm not sure what the size field describes. - -@subsubheading M68k addressing modes - -Many instructions used the low six bits of the first instruction word to -describe the location of the operand, or how to compute the location. The six -bits are typically split into three for a ``mode'' and three for a ``register'' -value. The interpretation of these values is as follows: - -@example -Mode Register Operand addressing mode -0 Dn data register -1 An address register -2 An indirect -3 An indirect, post-increment -4 An indirect, pre-decrement -5 An indirect with displacement -6 An indirect with optional displacement and index; - may involve multiple indirections and two - displacements -7 0 16-bit address follows -7 1 32-bit address follows -7 2 PC indirect with displacement -7 3 PC indirect with optional displacements and index -7 4 immediate 16- or 32-bit -7 5,6,7 Reserved -@end example - -On the 68000 and 68010, support for modes 6 and 7.3 are incomplete; the -displacement must fit in 8 bits, and no scaling or index suppression is -permitted. - -@subsubheading M68k relaxation modes - -The relaxation modes used on the 68k are: - -@table @code -@item ABRANCH -Case @samp{g} except when @code{BCC68000} is applicable. -@item FBRANCH -Coprocessor branches. -@item PCREL -Mode 7.2 -- program counter indirect with 16-bit displacement. This is -available on all processors. Widens to 32-bit absolute. Used only if the -original code used @code{ABSL} mode, and the CPU is not a 68000 or 68010. -(Why? Those processors support mode 7.2.) -@item BCC68000 -A conditional branch instruction, on the 68000 or 68010. These instructions -support only 16-bit displacements on these processors. If a larger -displacement is needed, the condition is negated and turned into a short branch -around a jump instruction to the specified target. This jump will have an -long absolute addressing mode. -@item DBCC -Like @code{BCC68000}, but for @code{dbCC} (decrement and branch on condition) -instructions. -@item PCLEA -Not currently used?? Short form is mode 7.2 (program counter indirect, 16-bit -displacement); long form is 7.3/0x0170 (program counter indirect, suppressed -index register, 32-bit displacement). Used in progressive-930331 for mode -@code{AOFF} with a PC-relative addressing mode and a displacement that won't -fit in 16 bits, or which is variable and is not specified to have a size other -than long. -@item PCINDEX -Newly added. PC indirect with index. An 8-bit displacement is supported on -the 68000 and 68010, wider displacements on later processors. -@end table - -@subsection ``Emulation'' Descriptions - -These are the @file{te-*.h} files. - -@node Foo -@section Foo - -@subsection Warning and Error Messages +@menu +* Warning and error messages:: Warning and error messages +* Hash tables:: Hash tables +@end menu -@deftypefun int had_warnings (void) -@deftypefunx int had_errors (void) +@node Warning and error messages +@subsection Warning and error messages +@deftypefun @{@} int had_warnings (void) +@deftypefunx @{@} int had_errors (void) Returns non-zero if any warnings or errors, respectively, have been printed during this invocation. - @end deftypefun -@deftypefun void as_perror (const char *@var{gripe}, const char *@var{filename}) - +@deftypefun @{@} void as_perror (const char *@var{gripe}, const char *@var{filename}) Displays a BFD or system error, then clears the error status. - @end deftypefun -@deftypefun void as_tsktsk (const char *@var{format}, ...) -@deftypefunx void as_warn (const char *@var{format}, ...) -@deftypefunx void as_bad (const char *@var{format}, ...) -@deftypefunx void as_fatal (const char *@var{format}, ...) - +@deftypefun @{@} void as_tsktsk (const char *@var{format}, ...) +@deftypefunx @{@} void as_warn (const char *@var{format}, ...) +@deftypefunx @{@} void as_bad (const char *@var{format}, ...) +@deftypefunx @{@} void as_fatal (const char *@var{format}, ...) These functions display messages about something amiss with the input file, or internal problems in the assembler itself. The current file name and line number are printed, followed by the supplied message, formatted using @@ -720,73 +1430,54 @@ An error indicated by @code{as_bad} will result in a non-zero exit status when the assembler has finished. Calling @code{as_fatal} will result in immediate termination of the assembler process. - @end deftypefun -@deftypefun void as_warn_where (char *@var{file}, unsigned int @var{line}, const char *@var{format}, ...) -@deftypefunx void as_bad_where (char *@var{file}, unsigned int @var{line}, const char *@var{format}, ...) - +@deftypefun @{@} void as_warn_where (char *@var{file}, unsigned int @var{line}, const char *@var{format}, ...) +@deftypefunx @{@} void as_bad_where (char *@var{file}, unsigned int @var{line}, const char *@var{format}, ...) These variants permit specification of the file name and line number, and are used when problems are detected when reprocessing information saved away when processing some earlier part of the file. For example, fixups are processed after all input has been read, but messages about fixups should refer to the original filename and line number that they are applicable to. - @end deftypefun -@deftypefun void fprint_value (FILE *@var{file}, valueT @var{val}) -@deftypefunx void sprint_value (char *@var{buf}, valueT @var{val}) - +@deftypefun @{@} void fprint_value (FILE *@var{file}, valueT @var{val}) +@deftypefunx @{@} void sprint_value (char *@var{buf}, valueT @var{val}) These functions are helpful for converting a @code{valueT} value into printable format, in case it's wider than modes that @code{*printf} can handle. If the type is narrow enough, a decimal number will be produced; otherwise, it will be -in hexadecimal (FIXME: currently without `0x' prefix). The value itself is not -examined to make this determination. - +in hexadecimal. The value itself is not examined to make this determination. @end deftypefun @node Hash tables -@section Hash tables +@subsection Hash tables @cindex hash tables -@deftypefun {struct hash_control *} hash_new (void) - +@deftypefun @{@} @{struct hash_control *@} hash_new (void) Creates the hash table control structure. - @end deftypefun -@deftypefun void hash_die (struct hash_control *) - +@deftypefun @{@} void hash_die (struct hash_control *) +Destroy a hash table. @end deftypefun -@deftypefun PTR hash_delete (struct hash_control *, const char *) - +@deftypefun @{@} PTR hash_delete (struct hash_control *, const char *) Deletes entry from the hash table, returns the value it had. - @end deftypefun -@deftypefun PTR hash_replace (struct hash_control *, const char *, PTR) - +@deftypefun @{@} PTR hash_replace (struct hash_control *, const char *, PTR) Updates the value for an entry already in the table, returning the old value. If no entry was found, just returns NULL. - @end deftypefun -@deftypefun {const char *} hash_insert (struct hash_control *, const char *, PTR) - +@deftypefun @{@} @{const char *@} hash_insert (struct hash_control *, const char *, PTR) Inserting a value already in the table is an error. Returns an error message or NULL. - @end deftypefun -@deftypefun {const char *} hash_jam (struct hash_control *, const char *, PTR) - +@deftypefun @{@} @{const char *@} hash_jam (struct hash_control *, const char *, PTR) Inserts if the value isn't already present, updates it if it is. - @end deftypefun - -@node Writing a new target -@section Writing a new target @node Test suite @section Test suite diff -urN binutils-2.7/gas/ecoff.c binutils-2.8/gas/ecoff.c --- binutils-2.7/gas/ecoff.c Thu Jul 4 12:12:54 1996 +++ binutils-2.8/gas/ecoff.c Wed Apr 30 12:53:32 1997 @@ -975,13 +975,9 @@ 0, /* rfdBase: index into the file indirect table */ 0, /* crfd: count file indirect entries */ langC, /* lang: language for this file */ - 0, /* fMerge: whether this file can be merged */ + 1, /* fMerge: whether this file can be merged */ 0, /* fReadin: true if read in (not just created) */ -#ifdef TARGET_BYTES_BIG_ENDIAN - 1, /* fBigendian: if 1, compiled on big endian machine */ -#else - 0, /* fBigendian: if 1, compiled on big endian machine */ -#endif + TARGET_BYTES_BIG_ENDIAN, /* fBigendian: if 1, compiled on big endian machine */ GLEVEL_2, /* glevel: level this file was compiled with */ 0, /* reserved: reserved for future use */ 0, /* cbLineOffset: byte offset from header for this file ln's */ @@ -2246,26 +2242,27 @@ first_ch = *file_name; - /* ??? This is ifdefed out, because it results in incorrect line number - debugging info when multiple .file pseudo-ops are merged into one file - descriptor. See for instance ecoff_build_lineno, which will - end up setting all file->fdr.* fields multiple times, resulting in - incorrect debug info. In order to make this work right, all line number - and symbol info for the same source file has to be adjacent in the object - file, so that a single file descriptor can be used to point to them. - This would require maintaining file specific lists of line numbers and - symbols for each file, so that they can be merged together (or output - together) when two .file pseudo-ops are merged into one file - descriptor. */ + /* FIXME: We can't safely merge files which have line number + information (fMerge will be zero in this case). Otherwise, we + get incorrect line number debugging info. See for instance + ecoff_build_lineno, which will end up setting all file->fdr.* + fields multiple times, resulting in incorrect debug info. In + order to make this work right, all line number and symbol info + for the same source file has to be adjacent in the object file, + so that a single file descriptor can be used to point to them. + This would require maintaining file specific lists of line + numbers and symbols for each file, so that they can be merged + together (or output together) when two .file pseudo-ops are + merged into one file descriptor. */ -#if 0 /* See if the file has already been created. */ for (fil_ptr = first_file; fil_ptr != (efdr_t *) NULL; fil_ptr = fil_ptr->next_file) { if (first_ch == fil_ptr->name[0] - && strcmp (file_name, fil_ptr->name) == 0) + && strcmp (file_name, fil_ptr->name) == 0 + && fil_ptr->fdr.fMerge) { cur_file_ptr = fil_ptr; if (! fake) @@ -2273,9 +2270,6 @@ break; } } -#else - fil_ptr = (efdr_t *) NULL; -#endif /* If this is a new file, create it. */ if (fil_ptr == (efdr_t *) NULL) @@ -2344,6 +2338,20 @@ #endif } } + +/* This function is called when the assembler notices a preprocessor + directive switching to a new file. This will not happen in + compiler output, only in hand coded assembler. */ + +void +ecoff_new_file (name) + const char *name; +{ + if (cur_file_ptr != NULL && strcmp (cur_file_ptr->name, name) == 0) + return; + add_file (name, 0, 0); + generate_asm_lineno = 1; +} #ifdef ECOFF_DEBUG @@ -2886,8 +2894,10 @@ coff_type.num_sizes = i + 1; for (i--; i >= 0; i--) - coff_type.sizes[i] = (coff_type.sizes[i + 1] - / coff_type.dimensions[i + 1]); + coff_type.sizes[i] = (coff_type.dimensions[i + 1] == 0 + ? 0 + : (coff_type.sizes[i + 1] + / coff_type.dimensions[i + 1])); } } else if (coff_symbol_typ == st_Member @@ -3332,6 +3342,9 @@ list->paddr = frag_now_fix (); list->lineno = lineno; + /* We don't want to merge files which have line numbers. */ + cur_file_ptr->fdr.fMerge = 0; + /* A .loc directive will sometimes appear before a .ent directive, which means that cur_proc_ptr will be NULL here. Arrange to patch this up. */ @@ -3595,8 +3608,7 @@ } else { - as_bad (".stabs expression too complex"); - sym = NULL; + sym = make_expr_symbol (&exp); value = 0; addend = 0; } @@ -4148,6 +4160,11 @@ && ! ECOFF_IS_STAB (&sym_ptr->ecoff_sym.asym)) local = 0; + /* This is just an external symbol if it is a + common symbol. */ + if (S_IS_COMMON (as_sym)) + local = 0; + /* If an st_end symbol has an associated gas symbol, then it is a local label created for a .bend or .end directive. Stabs line @@ -4214,6 +4231,12 @@ sym_ptr->ecoff_sym.asym.value = (S_GET_VALUE (as_sym) - S_GET_VALUE (begin_ptr->as_sym)); + + /* If the size is odd, this is probably a + mips16 function; force it to be even. */ + if ((sym_ptr->ecoff_sym.asym.value & 1) != 0) + ++sym_ptr->ecoff_sym.asym.value; + #ifdef S_SET_SIZE S_SET_SIZE (begin_ptr->as_sym, sym_ptr->ecoff_sym.asym.value); @@ -5351,6 +5374,9 @@ list->frag = frag_now; list->paddr = frag_now_fix (); list->lineno = lineno; + + /* We don't want to merge files which have line numbers. */ + cur_file_ptr->fdr.fMerge = 0; /* A .loc directive will sometimes appear before a .ent directive, which means that cur_proc_ptr will be NULL here. Arrange to diff -urN binutils-2.7/gas/ecoff.h binutils-2.8/gas/ecoff.h --- binutils-2.7/gas/ecoff.h Thu Jul 4 12:12:54 1996 +++ binutils-2.8/gas/ecoff.h Wed Apr 30 12:53:33 1997 @@ -35,6 +35,10 @@ obj_read_begin_hook. */ extern void ecoff_read_begin_hook PARAMS ((void)); +/* This function should be called when the assembler switches to a new + file. */ +extern void ecoff_new_file PARAMS ((const char *)); + /* This function should be called when a new symbol is created, by obj_symbol_new_hook. */ extern void ecoff_symbol_new_hook PARAMS ((struct symbol *)); diff -urN binutils-2.7/gas/emul.h binutils-2.8/gas/emul.h --- binutils-2.7/gas/emul.h Thu Jul 4 12:12:54 1996 +++ binutils-2.8/gas/emul.h Wed Apr 30 12:53:33 1997 @@ -4,8 +4,8 @@ struct emulation { void (*match) PARAMS ((const char *)); const char *name; - void (*init) (); - const char *(*bfd_name) (); + void (*init) PARAMS ((void)); + const char *(*bfd_name) PARAMS ((void)); unsigned local_labels_fb : 1; unsigned local_labels_dollar : 1; unsigned leading_underscore : 2; @@ -17,7 +17,7 @@ COMMON struct emulation *this_emulation; -extern const char *default_emul_bfd_name (); -extern void common_emul_init (); +extern const char *default_emul_bfd_name PARAMS ((void)); +extern void common_emul_init PARAMS ((void)); #endif diff -urN binutils-2.7/gas/expr.c binutils-2.8/gas/expr.c --- binutils-2.7/gas/expr.c Thu Jul 4 12:12:55 1996 +++ binutils-2.8/gas/expr.c Wed Apr 30 12:53:33 1997 @@ -1,5 +1,5 @@ /* expr.c -operands, expressions- - Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* * This is really a branch office of as-read.c. I split it out to clearly @@ -29,7 +30,6 @@ #include #include "as.h" -#include "libiberty.h" #include "obstack.h" static void floating_constant PARAMS ((expressionS * expressionP)); @@ -37,6 +37,8 @@ static void mri_char_constant PARAMS ((expressionS *)); static void current_location PARAMS ((expressionS *)); static void clean_up_expression PARAMS ((expressionS * expressionP)); +static segT operand PARAMS ((expressionS *)); +static operatorT operator PARAMS ((void)); extern const char EXP_CHARS[], FLT_CHARS[]; @@ -69,8 +71,6 @@ && expressionP->X_add_number == 0) return expressionP->X_add_symbol; - /* FIXME: This should be something which decode_local_label_name - will handle. */ fake = FAKE_LABEL_NAME; /* Putting constant symbols in absolute_section rather than @@ -673,40 +673,24 @@ case 'b': if (LOCAL_LABELS_FB && ! flag_m68k_mri) { - switch (input_line_pointer[1]) + /* This code used to check for '+' and '-' here, and, in + some conditions, fall through to call + integer_constant. However, that didn't make sense, + as integer_constant only accepts digits. */ + /* Some of our code elsewhere does permit digits greater + than the expected base; for consistency, do the same + here. */ + if (input_line_pointer[1] < '0' + || input_line_pointer[1] > '9') { - case '+': - case '-': - /* If unambiguously a difference expression, treat - it as one by indicating a label; otherwise, it's - always a binary number. */ - { - char *cp = input_line_pointer + 1; - while (strchr ("0123456789", *++cp)) - ; - if (*cp == 'b' || *cp == 'f') - goto is_0b_label; - } - goto is_0b_binary; - case '0': case '1': - /* Some of our code elsewhere does permit digits - greater than the expected base; for consistency, - do the same here. */ - case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - goto is_0b_binary; - case 0: - goto is_0b_label; - default: - goto is_0b_label; + /* Parse this as a back reference to label 0. */ + input_line_pointer--; + integer_constant (10, expressionP); + break; } - is_0b_label: - input_line_pointer--; - integer_constant (10, expressionP); - break; - is_0b_binary: - ; + /* Otherwise, parse this as a binary number. */ } + /* Fall through. */ case 'B': input_line_pointer++; if (flag_m68k_mri) @@ -846,8 +830,11 @@ if (! flag_m68k_mri) goto de_fault; /* Fall through. */ - case '!': case '~': + /* ~ is permitted to start a label on the Delta. */ + if (is_name_beginner (c)) + goto isname; + case '!': case '-': { operand (expressionP); @@ -1011,10 +998,22 @@ name = --input_line_pointer; c = get_symbol_end (); +#ifdef md_parse_name + /* This is a hook for the backend to parse certain names + specially in certain contexts. If a name always has a + specific value, it can often be handled by simply + entering it in the symbol table. */ + if (md_parse_name (name, expressionP)) + { + *input_line_pointer = c; + break; + } +#endif + #ifdef TC_I960 /* The MRI i960 assembler permits lda sizeof code,g13 - */ + FIXME: This should use md_parse_name. */ if (flag_mri && (strcasecmp (name, "sizeof") == 0 || strcasecmp (name, "startof") == 0)) @@ -1506,7 +1505,12 @@ case O_divide: resultP->X_add_number /= v; break; case O_modulus: resultP->X_add_number %= v; break; case O_left_shift: resultP->X_add_number <<= v; break; - case O_right_shift: resultP->X_add_number >>= v; break; + case O_right_shift: + /* We always use unsigned shifts, to avoid relying on + characteristics of the compiler used to compile gas. */ + resultP->X_add_number = + (offsetT) ((valueT) resultP->X_add_number >> (valueT) v); + break; case O_bit_inclusive_or: resultP->X_add_number |= v; break; case O_bit_or_not: resultP->X_add_number |= ~v; break; case O_bit_exclusive_or: resultP->X_add_number ^= v; break; @@ -1602,9 +1606,10 @@ /* We accept \001 in a name in case this is being called with a constructed string. */ - while (is_part_of_name (c = *input_line_pointer++) - || c == '\001') - ; + if (is_name_beginner (c = *input_line_pointer++) || c == '\001') + while (is_part_of_name (c = *input_line_pointer++) + || c == '\001') + ; *--input_line_pointer = 0; return (c); } diff -urN binutils-2.7/gas/expr.h binutils-2.8/gas/expr.h --- binutils-2.7/gas/expr.h Thu Jul 4 12:12:55 1996 +++ binutils-2.8/gas/expr.h Wed Apr 30 12:53:33 1997 @@ -1,5 +1,5 @@ /* expr.h -> header file for expr.c - Copyright (C) 1987, 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 1987, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* * By popular demand, we define a struct to represent an expression. @@ -113,8 +114,14 @@ struct symbol *X_op_symbol; /* A number to add. */ offsetT X_add_number; - /* The type of the expression. */ + /* The type of the expression. We can't assume that an arbitrary + compiler can handle a bitfield of enum type. FIXME: We could + check this using autoconf. */ +#ifdef __GNUC__ + operatorT X_op : 5; +#else unsigned X_op : 5; +#endif /* Non-zero if X_add_number should be regarded as unsigned. This is only valid for O_constant expressions. It is only used when an O_constant must be extended into a bignum (i.e., it is not used diff -urN binutils-2.7/gas/flonum.h binutils-2.8/gas/flonum.h --- binutils-2.7/gas/flonum.h Mon Jul 8 17:58:58 1996 +++ binutils-2.8/gas/flonum.h Wed Apr 30 12:53:34 1997 @@ -15,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /***********************************************************************\ * * diff -urN binutils-2.7/gas/frags.c binutils-2.8/gas/frags.c --- binutils-2.7/gas/frags.c Thu Jul 4 12:12:56 1996 +++ binutils-2.8/gas/frags.c Wed Apr 30 12:53:34 1997 @@ -1,5 +1,5 @@ /* frags.c - manage frags - - Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #include "as.h" #include "subsegs.h" @@ -203,7 +204,7 @@ int var; relax_substateT subtype; symbolS *symbol; - long offset; + offsetT offset; char *opcode; { register char *retval; @@ -217,9 +218,10 @@ frag_now->fr_symbol = symbol; frag_now->fr_offset = offset; frag_now->fr_opcode = opcode; - /* default these to zero. */ - frag_now->fr_pcrel_adjust = 0; - frag_now->fr_bsr = 0; + /* Default these to zero. Only the ns32k uses these but they can't be + conditionally included in `struct frag'. See as.h. */ + frag_now->fr_targ.ns32k.pcrel_adjust = 0; + frag_now->fr_targ.ns32k.bsr = 0; as_where (&frag_now->fr_file, &frag_now->fr_line); frag_new (max_chars); return (retval); @@ -231,7 +233,6 @@ * OVE: This variant of frag_var assumes that space for the tail has been * allocated by caller. * No call to frag_grow is done. - * Two new arguments have been added. */ char * @@ -241,7 +242,7 @@ int var; relax_substateT subtype; symbolS *symbol; - long offset; + offsetT offset; char *opcode; { register char *retval; @@ -253,9 +254,10 @@ frag_now->fr_symbol = symbol; frag_now->fr_offset = offset; frag_now->fr_opcode = opcode; - /* default these to zero. */ - frag_now->fr_pcrel_adjust = 0; - frag_now->fr_bsr = 0; + /* Default these to zero. Only the ns32k uses these but they can't be + conditionally included in `struct frag'. See as.h. */ + frag_now->fr_targ.ns32k.pcrel_adjust = 0; + frag_now->fr_targ.ns32k.bsr = 0; as_where (&frag_now->fr_file, &frag_now->fr_line); frag_new (max_chars); return (retval); @@ -278,22 +280,31 @@ /* Make an alignment frag. The size of this frag will be adjusted to force the next frag to have the appropriate alignment. ALIGNMENT is the power of two to which to align. FILL_CHARACTER is the - character to use to fill in any bytes which are skipped. */ + character to use to fill in any bytes which are skipped. MAX is + the maximum number of characters to skip when doing the alignment, + or 0 if there is no maximum. */ void -frag_align (alignment, fill_character) +frag_align (alignment, fill_character, max) int alignment; int fill_character; + int max; { if (now_seg == absolute_section) - abs_section_offset = ((abs_section_offset + alignment - 1) - &~ ((1 << alignment) - 1)); + { + addressT new_off; + + new_off = ((abs_section_offset + alignment - 1) + &~ ((1 << alignment) - 1)); + if (max == 0 || new_off - abs_section_offset <= max) + abs_section_offset = new_off; + } else { char *p; - p = frag_var (rs_align, 1, 1, (relax_substateT) 0, - (symbolS *) 0, (long) alignment, (char *) 0); + p = frag_var (rs_align, 1, 1, (relax_substateT) max, + (symbolS *) 0, (offsetT) alignment, (char *) 0); *p = fill_character; } } @@ -302,17 +313,20 @@ pattern rather than a single byte. ALIGNMENT is the power of two to which to align. FILL_PATTERN is the fill pattern to repeat in the bytes which are skipped. N_FILL is the number of bytes in - FILL_PATTERN. */ + FILL_PATTERN. MAX is the maximum number of characters to skip when + doing the alignment, or 0 if there is no maximum. */ void -frag_align_pattern (alignment, fill_pattern, n_fill) +frag_align_pattern (alignment, fill_pattern, n_fill, max) int alignment; const char *fill_pattern; int n_fill; + int max; { char *p; - p = frag_var (rs_align, n_fill, n_fill, (relax_substateT) 0, - (symbolS *) 0, (long) alignment, (char *) 0); + + p = frag_var (rs_align, n_fill, n_fill, (relax_substateT) max, + (symbolS *) 0, (offsetT) alignment, (char *) 0); memcpy (p, fill_pattern, n_fill); } diff -urN binutils-2.7/gas/frags.h binutils-2.8/gas/frags.h --- binutils-2.7/gas/frags.h Thu Jul 4 12:12:56 1996 +++ binutils-2.8/gas/frags.h Wed Apr 30 12:53:34 1997 @@ -1,6 +1,5 @@ /* frags.h - Header file for the frag concept. - - Copyright (C) 1987, 1992 Free Software Foundation, Inc. + Copyright (C) 1987, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +14,13 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifdef ANSI_PROTOTYPES +struct obstack; +#endif #if 0 /* @@ -39,12 +43,14 @@ void frag_init PARAMS ((void)); +fragS *frag_alloc PARAMS ((struct obstack *)); void frag_grow PARAMS ((unsigned int nchars)); char *frag_more PARAMS ((int nchars)); -void frag_align PARAMS ((int alignment, int fill_character)); +void frag_align PARAMS ((int alignment, int fill_character, int max)); void frag_align_pattern PARAMS ((int alignment, const char *fill_pattern, - int n_fill)); + int n_fill, + int max)); void frag_new PARAMS ((int old_frags_var_max_size)); void frag_wane PARAMS ((fragS * fragP)); @@ -53,7 +59,7 @@ int var, relax_substateT subtype, symbolS * symbol, - long offset, + offsetT offset, char *opcode)); char *frag_var PARAMS ((relax_stateT type, @@ -61,7 +67,7 @@ int var, relax_substateT subtype, symbolS * symbol, - long offset, + offsetT offset, char *opcode)); /* end of frags.h */ diff -urN binutils-2.7/gas/gasp.c binutils-2.8/gas/gasp.c --- binutils-2.7/gas/gasp.c Thu Jul 4 12:13:00 1996 +++ binutils-2.8/gas/gasp.c Wed Apr 30 12:53:34 1997 @@ -1,5 +1,5 @@ /* gasp.c - Gnu assembler preprocessor main program. - Copyright (C) 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1994, 95, 96, 1997 Free Software Foundation, Inc. Written by Steve and Judy Chamberlain of Cygnus Support, sac@cygnus.com @@ -70,6 +70,11 @@ char *program_version = "1.2"; +/* This is normally declared in as.h, but we don't include that. We + need the function because other files linked with gasp.c might call + it. */ +extern void as_abort PARAMS ((const char *, int, const char *)); + #define MAX_INCLUDES 30 /* Maximum include depth */ #define MAX_REASONABLE 1000 /* Maximum number of expansions */ @@ -470,7 +475,7 @@ if (ptr->value.s.len) { if (!again) - ERROR ((stderr, "redefintion not allowed")); + ERROR ((stderr, "redefinition not allowed\n")); } ptr->type = hash_string; @@ -1917,19 +1922,43 @@ { l = grab_label (&line, &label_in); sb_reset (&label); - if (label_in.len) - { - /* Munge any label */ - - - process_assigns (0, &label_in, &label); - } if (line.ptr[l] == ':') l++; while (ISWHITE (line.ptr[l]) && l < line.len) l++; + if (label_in.len) + { + int do_assigns; + + /* Munge the label, unless this is EQU or ASSIGN. */ + do_assigns = 1; + if (l < line.len + && (line.ptr[l] == '.' || alternate || mri)) + { + int lx = l; + + if (line.ptr[lx] == '.') + ++lx; + if (lx + 3 <= line.len + && strncasecmp ("EQU", line.ptr + lx, 3) == 0 + && (lx + 3 == line.len + || ! ISFIRSTCHAR (line.ptr[lx + 3]))) + do_assigns = 0; + else if (lx + 6 <= line.len + && strncasecmp ("ASSIGN", line.ptr + lx, 6) == 0 + && (lx + 6 == line.len + || ! ISFIRSTCHAR (line.ptr[lx + 6]))) + do_assigns = 0; + } + + if (do_assigns) + process_assigns (0, &label_in, &label); + else + sb_add_sb (&label, &label_in); + } + if (l < line.len) { if (process_pseudo_op (l, &line, &acc)) @@ -2638,7 +2667,7 @@ const char *err; int line = linecount (); - err = define_macro (idx, in, &label, get_line); + err = define_macro (idx, in, &label, get_line, (const char **) NULL); if (err != NULL) ERROR ((stderr, "macro at line %d: %s\n", line - 1, err)); } @@ -3308,7 +3337,7 @@ do_sdata (idx, line, 'z'); return 1; case K_ASSIGN: - do_assign (1, 0, line); + do_assign (0, 0, line); return 1; case K_AIF: do_aif (idx, line); @@ -3326,7 +3355,7 @@ do_aendr (); return 1; case K_EQU: - do_assign (0, idx, line); + do_assign (1, idx, line); return 1; case K_ALIGN: do_align (idx, line); @@ -3549,6 +3578,8 @@ [-Dname=value] create preprocessor variable called name, with value\n\ [-Ipath] add to include path list\n\ [in-file]\n"); + if (status == 0) + printf ("\nReport bugs to bug-gnu-utils@prep.ai.mit.edu\n"); exit (status); } @@ -3634,7 +3665,12 @@ show_help (); /*NOTREACHED*/ case 'v': - printf ("GNU %s version %s\n", program_name, program_version); + /* This output is intended to follow the GNU standards document. */ + printf ("GNU assembler pre-processor %s\n", program_version); + printf ("Copyright 1996 Free Software Foundation, Inc.\n"); + printf ("\ +This program is free software; you may redistribute it under the terms of\n\ +the GNU General Public License. This program has absolutely no warranty.\n"); exit (0); /*NOTREACHED*/ case 0: diff -urN binutils-2.7/gas/input-scrub.c binutils-2.8/gas/input-scrub.c --- binutils-2.7/gas/input-scrub.c Thu Jul 4 12:13:04 1996 +++ binutils-2.8/gas/input-scrub.c Wed Apr 30 12:53:35 1997 @@ -1,5 +1,6 @@ /* input_scrub.c - Break up input buffers into whole numbers of lines. - Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #include /* Need this to make errno declaration right */ #include "as.h" @@ -320,12 +322,37 @@ { register char *p; /* Find last newline. */ - for (p = limit; *--p != '\n';);; + for (p = limit - 1; *p != '\n'; --p) + ; ++p; - if (p <= buffer_start + BEFORE_SIZE) + + while (p <= buffer_start + BEFORE_SIZE) { - as_fatal ("Source line too long. Please change file %s then rebuild assembler.", __FILE__); + int limoff; + + limoff = limit - buffer_start; + buffer_length += input_file_buffer_size (); + buffer_start = xrealloc (buffer_start, + (BEFORE_SIZE + + 2 * buffer_length + + AFTER_SIZE)); + *bufp = buffer_start + BEFORE_SIZE; + limit = input_file_give_next_buffer (buffer_start + limoff); + + if (limit == NULL) + { + as_warn ("partial line at end of file ignored"); + partial_where = NULL; + if (next_saved_file) + *bufp = input_scrub_pop (next_saved_file); + return NULL; + } + + for (p = limit - 1; *p != '\n'; --p) + ; + ++p; } + partial_where = p; partial_size = limit - p; memcpy (save_source, partial_where, (int) AFTER_SIZE); diff -urN binutils-2.7/gas/itbl-lex.c binutils-2.8/gas/itbl-lex.c --- binutils-2.7/gas/itbl-lex.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/itbl-lex.c Wed Apr 30 12:53:35 1997 @@ -0,0 +1,1660 @@ +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.85 95/04/24 10:48:47 vern Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include +#include + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 15 +#define YY_END_OF_BUFFER 16 +static yyconst short int yy_accept[60] = + { 0, + 0, 0, 16, 14, 13, 12, 11, 8, 8, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 8, 0, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 7, 9, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 5, 1, 2, 3, 10, 6, 10, 4, 0 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 1, 1, 5, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 6, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 1, 8, 1, + 1, 1, 1, 1, 9, 10, 11, 12, 13, 10, + 14, 15, 16, 15, 15, 15, 17, 18, 15, 15, + 15, 19, 20, 15, 15, 15, 15, 15, 15, 15, + 1, 1, 1, 1, 15, 1, 21, 10, 22, 23, + + 24, 10, 25, 15, 26, 15, 15, 15, 27, 28, + 15, 29, 15, 30, 31, 15, 15, 15, 15, 32, + 15, 15, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst int yy_meta[33] = + { 0, + 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, + 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, + 3, 3 + } ; + +static yyconst short int yy_base[62] = + { 0, + 0, 0, 83, 84, 84, 84, 84, 27, 29, 70, + 0, 62, 61, 60, 20, 55, 47, 46, 45, 12, + 35, 37, 0, 0, 62, 60, 59, 58, 53, 49, + 45, 43, 42, 41, 37, 32, 0, 0, 43, 44, + 43, 42, 42, 36, 23, 27, 26, 25, 25, 20, + 0, 0, 0, 0, 35, 0, 23, 0, 84, 58, + 43 + } ; + +static yyconst short int yy_def[62] = + { 0, + 59, 1, 59, 59, 59, 59, 59, 59, 59, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 59, 61, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 61, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 0, 59, + 59 + } ; + +static yyconst short int yy_nxt[117] = + { 0, + 4, 5, 6, 5, 7, 8, 9, 7, 10, 11, + 12, 13, 11, 14, 11, 15, 11, 11, 11, 11, + 16, 17, 18, 11, 19, 20, 11, 11, 21, 11, + 11, 11, 22, 22, 22, 22, 29, 30, 35, 36, + 37, 37, 22, 22, 38, 58, 58, 56, 57, 54, + 53, 52, 51, 56, 55, 54, 53, 52, 23, 24, + 24, 51, 50, 49, 48, 47, 46, 45, 44, 43, + 42, 41, 40, 39, 34, 33, 32, 31, 28, 27, + 26, 25, 59, 3, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59 + } ; + +static yyconst short int yy_chk[117] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 8, 8, 9, 9, 15, 15, 20, 20, + 21, 21, 22, 22, 61, 57, 55, 50, 49, 48, + 47, 46, 45, 44, 43, 42, 41, 40, 8, 60, + 60, 39, 36, 35, 34, 33, 32, 31, 30, 29, + 28, 27, 26, 25, 19, 18, 17, 16, 14, 13, + 12, 10, 3, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +char *yytext; +#line 1 "./itbl-lex.l" +#define INITIAL 0 +/* itbl-lex.l + Copyright (C) 1997 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ +#line 22 "./itbl-lex.l" +#include +#include +#include +#include +#include "itbl-parse.h" + +#ifdef DEBUG +#define DBG(x) printf x +#define MDBG(x) printf x +#else +#define DBG(x) +#define MDBG(x) +#endif + +int insntbl_line = 1; +#line 440 "lex.yy.c" + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 44 "./itbl-lex.l" + + +#line 590 "lex.yy.c" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 60 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 84 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 46 "./itbl-lex.l" +{ + return CREG; + } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 49 "./itbl-lex.l" +{ + return DREG; + } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 52 "./itbl-lex.l" +{ + return GREG; + } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 55 "./itbl-lex.l" +{ + return IMMED; + } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 58 "./itbl-lex.l" +{ + return ADDR; + } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 61 "./itbl-lex.l" +{ + return INSN; + } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 64 "./itbl-lex.l" +{ + yytext[yyleng] = 0; + yylval.processor = strtoul (yytext+1, 0, 0); + return PNUM; + } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 69 "./itbl-lex.l" +{ + yytext[yyleng] = 0; + yylval.num = strtoul (yytext, 0, 0); + return NUM; + } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 74 "./itbl-lex.l" +{ + yytext[yyleng] = 0; + yylval.num = strtoul (yytext, 0, 0); + return NUM; + } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 79 "./itbl-lex.l" +{ + yytext[yyleng] = 0; + yylval.str = strdup (yytext); + return ID; + } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 84 "./itbl-lex.l" +{ + int c; + while ((c = input ()) != EOF) + { + if (c == '\n') + { + unput (c); + break; + } + } + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 95 "./itbl-lex.l" +{ + insntbl_line++; + MDBG (("in lex, NL = %d (x%x)\n", NL, NL)); + return NL; + } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 100 "./itbl-lex.l" +{ + } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 102 "./itbl-lex.l" +{ + MDBG (("char = %x, %d\n", yytext[0], yytext[0])); + return yytext[0]; + } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 106 "./itbl-lex.l" +ECHO; + YY_BREAK +#line 794 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 60 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 60 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 59); + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + yytext_ptr = yy_c_buf_p; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = + yytext_ptr + YY_MORE_ADJ; + return EOF; + } + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + break; + + case EOB_ACT_LAST_MATCH: +#ifdef __cplusplus + YY_FATAL_ERROR( + "unexpected last match in yyinput()" ); +#else + YY_FATAL_ERROR( + "unexpected last match in input()" ); +#endif + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *str ) +#else +YY_BUFFER_STATE yy_scan_string( str ) +yyconst char *str; +#endif + { + int len; + for ( len = 0; str[len]; ++len ) + ; + + return yy_scan_bytes( str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 106 "./itbl-lex.l" + + +int +yywrap () + { + return 1; + } diff -urN binutils-2.7/gas/itbl-lex.l binutils-2.8/gas/itbl-lex.l --- binutils-2.7/gas/itbl-lex.l Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/itbl-lex.l Wed Apr 30 12:53:35 1997 @@ -0,0 +1,112 @@ +/* itbl-lex.l + Copyright (C) 1997 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +%{ +#include +#include +#include +#include +#include "itbl-parse.h" + +#ifdef DEBUG +#define DBG(x) printf x +#define MDBG(x) printf x +#else +#define DBG(x) +#define MDBG(x) +#endif + +int insntbl_line = 1; +%} + +ALNUM [A-Za-z0-9_] +DIGIT [0-9] +ALPHA [A-Za-z_] +HEX [0-9A-Fa-f] + +%% + +"creg"|"CREG" { + return CREG; + } +"dreg"|"DREG" { + return DREG; + } +"greg"|"GREG" { + return GREG; + } +"immed"|"IMMED" { + return IMMED; + } +"addr"|"ADDR" { + return ADDR; + } +"insn"|"INSN" { + return INSN; + } +"p"{DIGIT} { + yytext[yyleng] = 0; + yylval.processor = strtoul (yytext+1, 0, 0); + return PNUM; + } +{DIGIT}+ { + yytext[yyleng] = 0; + yylval.num = strtoul (yytext, 0, 0); + return NUM; + } +"0x"{HEX}+ { + yytext[yyleng] = 0; + yylval.num = strtoul (yytext, 0, 0); + return NUM; + } +{ALPHA}{ALNUM}* { + yytext[yyleng] = 0; + yylval.str = strdup (yytext); + return ID; + } +";"|"#" { + int c; + while ((c = input ()) != EOF) + { + if (c == '\n') + { + unput (c); + break; + } + } + } +"\n" { + insntbl_line++; + MDBG (("in lex, NL = %d (x%x)\n", NL, NL)); + return NL; + } +" "|"\t" { + } +. { + MDBG (("char = %x, %d\n", yytext[0], yytext[0])); + return yytext[0]; + } +%% + +int +yywrap () + { + return 1; + } diff -urN binutils-2.7/gas/itbl-ops.c binutils-2.8/gas/itbl-ops.c --- binutils-2.7/gas/itbl-ops.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/itbl-ops.c Wed Apr 30 12:53:35 1997 @@ -0,0 +1,921 @@ +/* itbl-ops.c + Copyright (C) 1997 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/*======================================================================*/ +/* + * Herein lies the support for dynamic specification of processor + * instructions and registers. Mnemonics, values, and formats for each + * instruction and register are specified in an ascii file consisting of + * table entries. The grammar for the table is defined in the document + * "Processor instruction table specification". + * + * Instructions use the gnu assembler syntax, with the addition of + * allowing mnemonics for register. + * Eg. "func $2,reg3,0x100,symbol ; comment" + * func - opcode name + * $n - register n + * reg3 - mnemonic for processor's register defined in table + * 0xddd..d - immediate value + * symbol - address of label or external symbol + * + * First, itbl_parse reads in the table of register and instruction + * names and formats, and builds a list of entries for each + * processor/type combination. lex and yacc are used to parse + * the entries in the table and call functions defined here to + * add each entry to our list. + * + * Then, when assembling or disassembling, these functions are called to + * 1) get information on a processor's registers and + * 2) assemble/disassemble an instruction. + * To assemble(disassemble) an instruction, the function + * itbl_assemble(itbl_disassemble) is called to search the list of + * instruction entries, and if a match is found, uses the format + * described in the instruction entry structure to complete the action. + * + * Eg. Suppose we have a Mips coprocessor "cop3" with data register "d2" + * and we want to define function "pig" which takes two operands. + * + * Given the table entries: + * "p3 insn pig 0x1:24-21 dreg:20-16 immed:15-0" + * "p3 dreg d2 0x2" + * and that the instruction encoding for coprocessor pz has encoding: + * #define MIPS_ENCODE_COP_NUM(z) ((0x21|(z<<1))<<25) + * #define ITBL_ENCODE_PNUM(pnum) MIPS_ENCODE_COP_NUM(pnum) + * + * a structure to describe the instruction might look something like: + * struct itbl_entry = { + * e_processor processor = e_p3 + * e_type type = e_insn + * char *name = "pig" + * uint value = 0x1 + * uint flags = 0 + * struct itbl_range range = 24-21 + * struct itbl_field *field = { + * e_type type = e_dreg + * struct itbl_range range = 20-16 + * struct itbl_field *next = { + * e_type type = e_immed + * struct itbl_range range = 15-0 + * struct itbl_field *next = 0 + * }; + * }; + * struct itbl_entry *next = 0 + * }; + * + * And the assembler instructions: + * "pig d2,0x100" + * "pig $2,0x100" + * + * would both assemble to the hex value: + * "0x4e220100" + * + */ + +#include +#include +#include +#include "itbl-ops.h" +#include "itbl-parse.h" + +/* #define DEBUG */ + +#ifdef DEBUG +#include +#define ASSERT(x) assert(x) +#define DBG(x) printf x +#else +#define ASSERT(x) +#define DBG(x) +#endif + +#ifndef min +#define min(a,b) (arange.sbit = sbit; + e->range.ebit = ebit; + e->flags = flags; + itbl_num_opcodes++; + } + return e; +} + +/* Add an operand to an instruction entry */ + +struct itbl_field * +itbl_add_operand (struct itbl_entry *e, int yytype, int sbit, + int ebit, unsigned long flags) +{ + struct itbl_field *f, **last_f; + if (!e) + return 0; + /* Add to end of fields' list. */ + f = alloc_field (get_type (yytype), sbit, ebit, flags); + if (f) + { + last_f = &e->fields; + while (*last_f) + last_f = &(*last_f)->next; + *last_f = f; + f->next = 0; + } + return f; +} + + +/*======================================================================*/ +/* Interfaces for assembler and disassembler */ + +#ifndef STAND_ALONE +#include "as.h" +#include "symbols.h" +static void append_insns_as_macros (void); + +/* initialize for gas */ +void +itbl_init (void) +{ + struct itbl_entry *e, **es; + e_processor procn; + e_type type; + + if (!itbl_have_entries) + return; + + /* Since register names don't have a prefix, put them in the symbol table so + they can't be used as symbols. This simplifies argument parsing as + we can let gas parse registers for us. */ + /* Use symbol_create instead of symbol_new so we don't try to + output registers into the object file's symbol table. */ + + for (type = e_regtype0; type < e_nregtypes; type++) + for (procn = e_p0; procn < e_nprocs; procn++) + { + es = get_entries (procn, type); + for (e = *es; e; e = e->next) + { + symbol_table_insert (symbol_create (e->name, reg_section, + e->value, &zero_address_frag)); + } + } + append_insns_as_macros (); +} + + +/* Append insns to opcodes table and increase number of opcodes + * Structure of opcodes table: + * struct itbl_opcode + * { + * const char *name; + * const char *args; - string describing the arguments. + * unsigned long match; - opcode, or ISA level if pinfo=INSN_MACRO + * unsigned long mask; - opcode mask, or macro id if pinfo=INSN_MACRO + * unsigned long pinfo; - insn flags, or INSN_MACRO + * }; + * examples: + * {"li", "t,i", 0x34000000, 0xffe00000, WR_t }, + * {"li", "t,I", 0, (int) M_LI, INSN_MACRO }, + */ + +static char *form_args (struct itbl_entry *e); +static void +append_insns_as_macros (void) +{ + struct ITBL_OPCODE_STRUCT *new_opcodes, *o; + struct itbl_entry *e, **es; + int n, id, size, new_size, new_num_opcodes; + + if (!itbl_have_entries) + return; + + if (!itbl_num_opcodes) /* no new instructions to add! */ + { + return; + } + DBG (("previous num_opcodes=%d\n", ITBL_NUM_OPCODES)); + + new_num_opcodes = ITBL_NUM_OPCODES + itbl_num_opcodes; + ASSERT (new_num_opcodes >= itbl_num_opcodes); + + size = sizeof (struct ITBL_OPCODE_STRUCT) * ITBL_NUM_OPCODES; + ASSERT (size >= 0); + DBG (("I get=%d\n", size / sizeof (ITBL_OPCODES[0]))); + + new_size = sizeof (struct ITBL_OPCODE_STRUCT) * new_num_opcodes; + ASSERT (new_size > size); + + /* FIXME since ITBL_OPCODES culd be a static table, + we can't realloc or delete the old memory. */ + new_opcodes = (struct ITBL_OPCODE_STRUCT *) malloc (new_size); + if (!new_opcodes) + { + printf ("Unable to allocate memory for new instructions\n"); + return; + } + if (size) /* copy prexisting opcodes table */ + memcpy (new_opcodes, ITBL_OPCODES, size); + + /* FIXME! some NUMOPCODES are calculated expressions. + These need to be changed before itbls can be supported. */ + + id = ITBL_NUM_MACROS; /* begin the next macro id after the last */ + o = &new_opcodes[ITBL_NUM_OPCODES]; /* append macro to opcodes list */ + for (n = e_p0; n < e_nprocs; n++) + { + es = get_entries (n, e_insn); + for (e = *es; e; e = e->next) + { + /* name, args, mask, match, pinfo + * {"li", "t,i", 0x34000000, 0xffe00000, WR_t }, + * {"li", "t,I", 0, (int) M_LI, INSN_MACRO }, + * Construct args from itbl_fields. + */ + o->name = e->name; + o->args = strdup (form_args (e)); + o->mask = apply_range (e->value, e->range); + /* FIXME how to catch durring assembly? */ + /* mask to identify this insn */ + o->match = apply_range (e->value, e->range); + o->pinfo = 0; + +#ifdef USE_MACROS + o->mask = id++; /* FIXME how to catch durring assembly? */ + o->match = 0; /* for macros, the insn_isa number */ + o->pinfo = INSN_MACRO; +#endif + + /* Don't add instructions which caused an error */ + if (o->args) + o++; + else + new_num_opcodes--; + } + } + ITBL_OPCODES = new_opcodes; + ITBL_NUM_OPCODES = new_num_opcodes; + + /* FIXME + At this point, we can free the entries, as they should have + been added to the assembler's tables. + Don't free name though, since name is being used by the new + opcodes table. + + Eventually, we should also free the new opcodes table itself + on exit. + */ +} + +static char * +form_args (struct itbl_entry *e) +{ + static char s[31]; + char c = 0, *p = s; + struct itbl_field *f; + + ASSERT (e); + for (f = e->fields; f; f = f->next) + { + switch (f->type) + { + case e_dreg: + c = 'd'; + break; + case e_creg: + c = 't'; + break; + case e_greg: + c = 's'; + break; + case e_immed: + c = 'i'; + break; + case e_addr: + c = 'a'; + break; + default: + c = 0; /* ignore; unknown field type */ + } + if (c) + { + if (p != s) + *p++ = ','; + *p++ = c; + } + } + *p = 0; + return s; +} +#endif /* !STAND_ALONE */ + + +/* Get processor's register name from val */ + +unsigned long +itbl_get_reg_val (char *name) +{ + e_type t; + e_processor p; + int r = 0; + for (p = e_p0; p < e_nprocs; p++) + for (t = e_regtype0; t < e_nregtypes; t++) + { + if (r = itbl_get_val (p, t, name), r) + return r; + } + return 0; +} + +char * +itbl_get_name (e_processor processor, e_type type, unsigned long val) +{ + struct itbl_entry *r; + /* type depends on instruction passed */ + r = find_entry_byval (processor, type, val, 0); + if (r) + return r->name; + else + return 0; /* error; invalid operand */ +} + +/* Get processor's register value from name */ + +unsigned long +itbl_get_val (e_processor processor, e_type type, char *name) +{ + struct itbl_entry *r; + /* type depends on instruction passed */ + r = find_entry_byname (processor, type, name); + if (r) + return r->value; + else + return 0; /* error; invalid operand */ +} + + +/* Assemble instruction "name" with operands "s". + * name - name of instruction + * s - operands + * returns - long word for assembled instruction */ + +unsigned long +itbl_assemble (char *name, char *s) +{ + unsigned long opcode; + struct itbl_entry *e; + struct itbl_field *f; + char *n; + int processor; + + if (!name || !*name) + return 0; /* error! must have a opcode name/expr */ + + /* find entry in list of instructions for all processors */ + for (processor = 0; processor < e_nprocs; processor++) + { + e = find_entry_byname (processor, e_insn, name); + if (e) + break; + } + if (!e) + return 0; /* opcode not in table; invalid instrustion */ + opcode = build_opcode (e); + + /* parse opcode's args (if any) */ + for (f = e->fields; f; f = f->next) /* for each arg, ... */ + { + struct itbl_entry *r; + unsigned long value; + if (!s || !*s) + return 0; /* error - not enough operands */ + n = itbl_get_field (&s); + /* n should be in form $n or 0xhhh (are symbol names valid?? */ + switch (f->type) + { + case e_dreg: + case e_creg: + case e_greg: + /* Accept either a string name + * or '$' followed by the register number */ + if (*n == '$') + { + n++; + value = strtol (n, 0, 10); + /* FIXME! could have "0l"... then what?? */ + if (value == 0 && *n != '0') + return 0; /* error; invalid operand */ + } + else + { + r = find_entry_byname (e->processor, f->type, n); + if (r) + value = r->value; + else + return 0; /* error; invalid operand */ + } + break; + case e_addr: + /* use assembler's symbol table to find symbol */ + /* FIXME!! Do we need this? + if so, what about relocs?? + my_getExpression (&imm_expr, s); + return 0; /-* error; invalid operand *-/ + break; + */ + /* If not a symbol, fall thru to IMMED */ + case e_immed: + if (*n == '0' && *(n + 1) == 'x') /* hex begins 0x... */ + { + n += 2; + value = strtol (n, 0, 16); + /* FIXME! could have "0xl"... then what?? */ + } + else + { + value = strtol (n, 0, 10); + /* FIXME! could have "0l"... then what?? */ + if (value == 0 && *n != '0') + return 0; /* error; invalid operand */ + } + break; + default: + return 0; /* error; invalid field spec */ + } + opcode |= apply_range (value, f->range); + } + if (s && *s) + return 0; /* error - too many operands */ + return opcode; /* done! */ +} + +/* Disassemble instruction "insn". + * insn - instruction + * s - buffer to hold disassembled instruction + * returns - 1 if succeeded; 0 if failed + */ + +int +itbl_disassemble (char *s, unsigned long insn) +{ + e_processor processor; + struct itbl_entry *e; + struct itbl_field *f; + + if (!ITBL_IS_INSN (insn)) + return 0; /* error*/ + processor = get_processor (ITBL_DECODE_PNUM (insn)); + + /* find entry in list */ + e = find_entry_byval (processor, e_insn, insn, 0); + if (!e) + return 0; /* opcode not in table; invalid instrustion */ + strcpy (s, e->name); + + /* parse insn's args (if any) */ + for (f = e->fields; f; f = f->next) /* for each arg, ... */ + { + struct itbl_entry *r; + unsigned long value; + + if (f == e->fields) /* first operand is preceeded by tab */ + strcat (s, "\t"); + else /* ','s separate following operands */ + strcat (s, ","); + value = extract_range (insn, f->range); + /* n should be in form $n or 0xhhh (are symbol names valid?? */ + switch (f->type) + { + case e_dreg: + case e_creg: + case e_greg: + /* Accept either a string name + * or '$' followed by the register number */ + r = find_entry_byval (e->processor, f->type, value, &f->range); + if (r) + strcat (s, r->name); + else + sprintf (s, "%s$%d", s, value); + break; + case e_addr: + /* use assembler's symbol table to find symbol */ + /* FIXME!! Do we need this? + * if so, what about relocs?? + */ + /* If not a symbol, fall thru to IMMED */ + case e_immed: + sprintf (s, "%s0x%x", s, value); + break; + default: + return 0; /* error; invalid field spec */ + } + } + return 1; /* done! */ +} + +/*======================================================================*/ +/* + * Local functions for manipulating private structures containing + * the names and format for the new instructions and registers + * for each processor. + */ + +/* Calculate instruction's opcode and function values from entry */ + +static unsigned long +build_opcode (struct itbl_entry *e) +{ + unsigned long opcode; + + opcode = apply_range (e->value, e->range); + opcode |= ITBL_ENCODE_PNUM (e->processor); + return opcode; +} + +/* Calculate absolute value given the relative value and bit position range + * within the instruction. + * The range is inclusive where 0 is least significant bit. + * A range of { 24, 20 } will have a mask of + * bit 3 2 1 + * pos: 1098 7654 3210 9876 5432 1098 7654 3210 + * bin: 0000 0001 1111 0000 0000 0000 0000 0000 + * hex: 0 1 f 0 0 0 0 0 + * mask: 0x01f00000. + */ + +static unsigned long +apply_range (unsigned long rval, struct itbl_range r) +{ + unsigned long mask; + unsigned long aval; + int len = MAX_BITPOS - r.sbit; + + ASSERT (r.sbit >= r.ebit); + ASSERT (MAX_BITPOS >= r.sbit); + ASSERT (r.ebit >= 0); + + /* create mask by truncating 1s by shifting */ + mask = 0xffffffff << len; + mask = mask >> len; + mask = mask >> r.ebit; + mask = mask << r.ebit; + + aval = (rval << r.ebit) & mask; + return aval; +} + +/* Calculate relative value given the absolute value and bit position range + * within the instruction. */ + +static unsigned long +extract_range (unsigned long aval, struct itbl_range r) +{ + unsigned long mask; + unsigned long rval; + int len = MAX_BITPOS - r.sbit; + + /* create mask by truncating 1s by shifting */ + mask = 0xffffffff << len; + mask = mask >> len; + mask = mask >> r.ebit; + mask = mask << r.ebit; + + rval = (aval & mask) >> r.ebit; + return rval; +} + +/* Extract processor's assembly instruction field name from s; + * forms are "n args" "n,args" or "n" */ +/* Return next argument from string pointer "s" and advance s. + * delimiters are " ,\0" */ + +char * +itbl_get_field (char **S) +{ + static char n[128]; + char *p, *ps, *s; + int len; + + s = *S; + if (!s || !*s) + return 0; + p = s + strlen (s); + if (ps = strchr (s, ','), ps) + p = ps; + if (ps = strchr (s, ' '), ps) + p = min (p, ps); + if (ps = strchr (s, '\0'), ps) + p = min (p, ps); + if (p == 0) + return 0; /* error! */ + len = p - s; + ASSERT (128 > len + 1); + strncpy (n, s, len); + n[len] = 0; + if (s[len] == '\0') + s = 0; /* no more args */ + else + s += len + 1; /* advance to next arg */ + + *S = s; + return n; +} + +/* Search entries for a given processor and type + * to find one matching the name "n". + * Return a pointer to the entry */ + +static struct itbl_entry * +find_entry_byname (e_processor processor, + e_type type, char *n) +{ + struct itbl_entry *e, **es; + + es = get_entries (processor, type); + for (e = *es; e; e = e->next) /* for each entry, ... */ + { + if (!strcmp (e->name, n)) + return e; + } + return 0; +} + +/* Search entries for a given processor and type + * to find one matching the value "val" for the range "r". + * Return a pointer to the entry. + * This function is used for disassembling fields of an instruction. + */ + +static struct itbl_entry * +find_entry_byval (e_processor processor, e_type type, + unsigned long val, struct itbl_range *r) +{ + struct itbl_entry *e, **es; + unsigned long eval; + + es = get_entries (processor, type); + for (e = *es; e; e = e->next) /* for each entry, ... */ + { + if (processor != e->processor) + continue; + /* For insns, we might not know the range of the opcode, + * so a range of 0 will allow this routine to match against + * the range of the entry to be compared with. + * This could cause ambiguities. + * For operands, we get an extracted value and a range. + */ + /* if range is 0, mask val against the range of the compared entry. */ + if (r == 0) /* if no range passed, must be whole 32-bits + * so create 32-bit value from entry's range */ + { + eval = apply_range (e->value, e->range); + val &= apply_range (0xffffffff, e->range); + } + else if (r->sbit == e->range.sbit && r->ebit == e->range.ebit + || e->range.sbit == 0 && e->range.ebit == 0) + { + eval = apply_range (e->value, *r); + val = apply_range (val, *r); + } + else + continue; + if (val == eval) + return e; + } + return 0; +} + +/* Return a pointer to the list of entries for a given processor and type. */ + +static struct itbl_entry ** +get_entries (e_processor processor, e_type type) +{ + return &entries[processor][type]; +} + +/* Return an integral value for the processor passed from yyparse. */ + +static e_processor +get_processor (int yyproc) +{ + /* translate from yacc's processor to enum */ + if (yyproc >= e_p0 && yyproc < e_nprocs) + return (e_processor) yyproc; + return e_invproc; /* error; invalid processor */ +} + +/* Return an integral value for the entry type passed from yyparse. */ + +static e_type +get_type (int yytype) +{ + switch (yytype) + { + /* translate from yacc's type to enum */ + case INSN: + return e_insn; + case DREG: + return e_dreg; + case CREG: + return e_creg; + case GREG: + return e_greg; + case ADDR: + return e_addr; + case IMMED: + return e_immed; + default: + return e_invtype; /* error; invalid type */ + } +} + + +/* Allocate and initialize an entry */ + +static struct itbl_entry * +alloc_entry (e_processor processor, e_type type, + char *name, unsigned long value) +{ + struct itbl_entry *e, **es; + if (!name) + return 0; + e = (struct itbl_entry *) malloc (sizeof (struct itbl_entry)); + if (e) + { + memset (e, 0, sizeof (struct itbl_entry)); + e->name = (char *) malloc (sizeof (strlen (name)) + 1); + if (e->name) + strcpy (e->name, name); + e->processor = processor; + e->type = type; + e->value = value; + es = get_entries (e->processor, e->type); + e->next = *es; + *es = e; + } + return e; +} + +/* Allocate and initialize an entry's field */ + +static struct itbl_field * +alloc_field (e_type type, int sbit, int ebit, + unsigned long flags) +{ + struct itbl_field *f; + f = (struct itbl_field *) malloc (sizeof (struct itbl_field)); + if (f) + { + memset (f, 0, sizeof (struct itbl_field)); + f->type = type; + f->range.sbit = sbit; + f->range.ebit = ebit; + f->flags = flags; + } + return f; +} diff -urN binutils-2.7/gas/itbl-ops.h binutils-2.8/gas/itbl-ops.h --- binutils-2.7/gas/itbl-ops.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/itbl-ops.h Wed Apr 30 12:53:36 1997 @@ -0,0 +1,109 @@ +/* itbl-ops.h + Copyright (C) 1997 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* External functions, constants and defines for itbl support */ + +#include "ansidecl.h" + +/* Include file notes: "expr.h" needed before targ-*.h, + * "targ-env.h" includes the chain of target dependant headers, + * "targ-cpu.h" has the HAVE_ITBL_CPU define, and + * as.h includes them all */ +#include "as.h" + +#ifdef HAVE_ITBL_CPU +#include "itbl-cpu.h" +#endif + +/* Defaults for definitions required by generic code */ +#ifndef ITBL_NUMBER_OF_PROCESSORS +#define ITBL_NUMBER_OF_PROCESSORS 1 +#endif + +#ifndef ITBL_MAX_BITPOS +#define ITBL_MAX_BITPOS 31 +#endif + +#ifndef ITBL_TYPE +#define ITBL_TYPE unsigned long +#endif + +#ifndef ITBL_IS_INSN +#define ITBL_IS_INSN(insn) 1 +#endif + +#ifndef ITBL_DECODE_PNUM +#define ITBL_DECODE_PNUM(insn) 0 +#endif + +#ifndef ITBL_ENCODE_PNUM +#define ITBL_ENCODE_PNUM(pnum) 0 +#endif + +typedef ITBL_TYPE t_insn; + +/* types of entries */ +typedef enum + { + e_insn, + e_dreg, + e_regtype0 = e_dreg, + e_creg, + e_greg, + e_addr, + e_nregtypes = e_greg + 1, + e_immed, + e_ntypes, + e_invtype /* invalid type */ + } e_type; + +typedef enum + { + e_p0, + e_nprocs = NUMBER_OF_PROCESSORS, + e_invproc /* invalid processor */ + } e_processor; + +/* 0 means an instruction table was not specified. */ +extern int itbl_have_entries; + +/* These routines are visible to the main part of the assembler */ + +int itbl_parse PARAMS ((char *insntbl)); +void itbl_init PARAMS ((void)); +char *itbl_get_field PARAMS ((char **s)); +unsigned long itbl_assemble PARAMS ((char *name, char *operands)); +int itbl_disassemble PARAMS ((char *str, unsigned long insn)); +int itbl_parse PARAMS ((char *tbl)); /* parses insn tbl */ +unsigned long itbl_get_reg_val PARAMS ((char *name)); +unsigned long itbl_get_val PARAMS ((e_processor processor, e_type type, + char *name)); +char *itbl_get_name PARAMS ((e_processor processor, e_type type, + unsigned long val)); + +/* These routines are called by the table parser used to build the + dynamic list of new processor instructions and registers. */ + +struct itbl_entry *itbl_add_reg PARAMS ((int yyproc, int yytype, + char *regname, int regnum)); +struct itbl_entry *itbl_add_insn PARAMS ((int yyproc, char *name, + unsigned long value, int sbit, int ebit, unsigned long flags)); +struct itbl_field *itbl_add_operand PARAMS ((struct itbl_entry * e, int yytype, + int sbit, int ebit, unsigned long flags)); diff -urN binutils-2.7/gas/itbl-parse.c binutils-2.8/gas/itbl-parse.c --- binutils-2.7/gas/itbl-parse.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/itbl-parse.c Wed Apr 30 12:53:36 1997 @@ -0,0 +1,1284 @@ + +/* A Bison parser, made from ./itbl-parse.y with Bison version GNU Bison version 1.24 + */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define DREG 258 +#define CREG 259 +#define GREG 260 +#define IMMED 261 +#define ADDR 262 +#define INSN 263 +#define NUM 264 +#define ID 265 +#define NL 266 +#define PNUM 267 + +#line 21 "./itbl-parse.y" + + +/* + +Yacc grammar for instruction table entries. + +======================================================================= +Original Instruction table specification document: + + MIPS Coprocessor Table Specification + ==================================== + +This document describes the format of the MIPS coprocessor table. The +table specifies a list of valid functions, data registers and control +registers that can be used in coprocessor instructions. This list, +together with the coprocessor instruction classes listed below, +specifies the complete list of coprocessor instructions that will +be recognized and assembled by the GNU assembler. In effect, +this makes the GNU assembler table-driven, where the table is +specified by the programmer. + +The table is an ordinary text file that the GNU assembler reads when +it starts. Using the information in the table, the assembler +generates an internal list of valid coprocessor registers and +functions. The assembler uses this internal list in addition to the +standard MIPS registers and instructions which are built-in to the +assembler during code generation. + +To specify the coprocessor table when invoking the GNU assembler, use +the command line option "--itbl file", where file is the +complete name of the table, including path and extension. + +Examples: + + gas -t cop.tbl test.s -o test.o + gas -t /usr/local/lib/cop.tbl test.s -o test.o + gas --itbl d:\gnu\data\cop.tbl test.s -o test.o + +Only one table may be supplied during a single invocation of +the assembler. + + +Instruction classes +=================== + +Below is a list of the valid coprocessor instruction classes for +any given coprocessor "z". These instructions are already recognized +by the assembler, and are listed here only for reference. + +Class format instructions +------------------------------------------------- +Class1: + op base rt offset + LWCz rt,offset (base) + SWCz rt,offset (base) +Class2: + COPz sub rt rd 0 + MTCz rt,rd + MFCz rt,rd + CTCz rt,rd + CFCz rt,rd +Class3: + COPz CO cofun + COPz cofun +Class4: + COPz BC br offset + BCzT offset + BCzF offset +Class5: + COPz sub rt rd 0 + DMFCz rt,rd + DMTCz rt,rd +Class6: + op base rt offset + LDCz rt,offset (base) + SDCz rt,offset (base) +Class7: + COPz BC br offset + BCzTL offset + BCzFL offset + +The coprocessor table defines coprocessor-specific registers that can +be used with all of the above classes of instructions, where +appropriate. It also defines additional coprocessor-specific +functions for Class3 (COPz cofun) instructions, Thus, the table allows +the programmer to use convenient mnemonics and operands for these +functions, instead of the COPz mmenmonic and cofun operand. + +The names of the MIPS general registers and their aliases are defined +by the assembler and will be recognized as valid register names by the +assembler when used (where allowed) in coprocessor instructions. +However, the names and values of all coprocessor data and control +register mnemonics must be specified in the coprocessor table. + + +Table Grammar +============= + +Here is the grammar for the coprocessor table: + + table -> entry* + + entry -> [z entrydef] [comment] '\n' + + entrydef -> type name val + entrydef -> 'insn' name val funcdef ; type of entry (instruction) + + z -> 'p'['0'..'3'] ; processor number + type -> ['dreg' | 'creg' | 'greg' ] ; type of entry (register) + ; 'dreg', 'creg' or 'greg' specifies a data, control, or general + ; register mnemonic, respectively + name -> [ltr|dec]* ; mnemonic of register/function + val -> [dec|hex] ; register/function number (integer constant) + + funcdef -> frange flags fields + ; bitfield range for opcode + ; list of fields' formats + fields -> field* + field -> [','] ftype frange flags + flags -> ['*' flagexpr] + flagexpr -> '[' flagexpr ']' + flagexpr -> val '|' flagexpr + ftype -> [ type | 'immed' | 'addr' ] + ; 'immed' specifies an immediate value; see grammar for "val" above + ; 'addr' specifies a C identifier; name of symbol to be resolved at + ; link time + frange -> ':' val '-' val ; starting to ending bit positions, where + ; where 0 is least significant bit + frange -> (null) ; default range of 31-0 will be assumed + + comment -> [';'|'#'] [char]* + char -> any printable character + ltr -> ['a'..'z'|'A'..'Z'] + dec -> ['0'..'9']* ; value in decimal + hex -> '0x'['0'..'9' | 'a'..'f' | 'A'..'F']* ; value in hexidecimal + + +Examples +======== + +Example 1: + +The table: + + p1 dreg d1 1 ; data register "d1" for COP1 has value 1 + p1 creg c3 3 ; ctrl register "c3" for COP1 has value 3 + p3 func fill 0x1f:24-20 ; function "fill" for COP3 has value 31 and + ; no fields + +will allow the assembler to accept the following coprocessor instructions: + + LWC1 d1,0x100 ($2) + fill + +Here, the general purpose register "$2", and instruction "LWC1", are standard +mnemonics built-in to the MIPS assembler. + + +Example 2: + +The table: + + p3 dreg d3 3 ; data register "d3" for COP3 has value 3 + p3 creg c2 22 ; control register "c2" for COP3 has value 22 + p3 func fee 0x1f:24-20 dreg:17-13 creg:12-8 immed:7-0 + ; function "fee" for COP3 has value 31, and 3 fields + ; consisting of a data register, a control register, + ; and an immediate value. + +will allow the assembler to accept the following coprocessor instruction: + + fee d3,c2,0x1 + +and will emit the object code: + + 31-26 25 24-20 19-18 17-13 12-8 7-0 + COPz CO fun dreg creg immed + 010011 1 11111 00 00011 10110 00000001 + + 0x4ff07601 + + +Example 3: + +The table: + + p3 dreg d3 3 ; data register "d3" for COP3 has value 3 + p3 creg c2 22 ; control register "c2" for COP3 has value 22 + p3 func fuu 0x01f00001 dreg:17-13 creg:12-8 + +will allow the assembler to accept the following coprocessor +instruction: + + fuu d3,c2 + +and will emit the object code: + + 31-26 25 24-20 19-18 17-13 12-8 7-0 + COPz CO fun dreg creg + 010011 1 11111 00 00011 10110 00000001 + + 0x4ff07601 + +In this way, the programmer can force arbitrary bits of an instruction +to have predefined values. + +======================================================================= +Additional notes: + +Encoding of ranges: +To handle more than one bit position range within an instruction, +use 0s to mask out the ranges which don't apply. +May decide to modify the syntax to allow commas separate multiple +ranges within an instruction (range','range). + +Changes in grammar: + The number of parms argument to the function entry +was deleted from the original format such that we now count the fields. + +---- +FIXME! should really change lexical analyzer +to recognize 'dreg' etc. in context sensative way. +Currently function names or mnemonics may be incorrectly parsed as keywords + +FIXME! hex is ambiguous with any digit + +*/ + +#include +#include "itbl-ops.h" + +/* #define DEBUG */ + +#ifdef DEBUG +#ifndef DBG_LVL +#define DBG_LVL 1 +#endif +#else +#define DBG_LVL 0 +#endif + +#if DBG_LVL >= 1 +#define DBG(x) printf x +#else +#define DBG(x) +#endif + +#if DBG_LVL >= 2 +#define DBGL2(x) printf x +#else +#define DBGL2(x) +#endif + +static int sbit, ebit; +static struct itbl_entry *insn=0; +extern int insntbl_line; +int yyparse PARAMS ((void)); +int yylex PARAMS ((void)); +static int yyerror PARAMS ((const char *)); + + +#line 283 "./itbl-parse.y" +typedef union + { + char *str; + int num; + int processor; + unsigned long val; + } YYSTYPE; + +#ifndef YYLTYPE +typedef + struct yyltype + { + int timestamp; + int first_line; + int first_column; + int last_line; + int last_column; + char *text; + } + yyltype; + +#define YYLTYPE yyltype +#endif + +#include + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 51 +#define YYFLAG -32768 +#define YYNTBASE 20 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 267 ? yytranslate[x] : 34) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 17, 2, 13, 19, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 18, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 15, 2, 16, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 14, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 5, 6, 12, 13, 23, 25, 28, 32, + 35, 36, 38, 40, 42, 46, 50, 54, 56, 59, + 60, 65, 66, 68, 70, 72, 74, 76, 78 +}; + +static const short yyrhs[] = { 21, + 0, 22, 21, 0, 0, 30, 31, 32, 33, 11, + 0, 0, 30, 8, 32, 33, 29, 28, 23, 24, + 11, 0, 11, 0, 1, 11, 0, 13, 26, 24, + 0, 26, 24, 0, 0, 31, 0, 7, 0, 6, + 0, 25, 29, 28, 0, 9, 14, 27, 0, 15, + 27, 16, 0, 9, 0, 17, 27, 0, 0, 18, + 9, 19, 9, 0, 0, 12, 0, 3, 0, 4, + 0, 5, 0, 10, 0, 9, 0, 9, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 300, 304, 306, 309, 316, 323, 324, 325, 328, 330, + 331, 334, 340, 345, 352, 361, 366, 370, 376, 382, + 388, 395, 402, 410, 416, 421, 428, 436, 444 +}; + +static const char * const yytname[] = { "$","error","$undefined.","DREG","CREG", +"GREG","IMMED","ADDR","INSN","NUM","ID","NL","PNUM","','","'|'","'['","']'", +"'*'","':'","'-'","insntbl","entrys","entry","@1","fieldspecs","ftype","fieldspec", +"flagexpr","flags","range","pnum","regtype","name","value","value" +}; +#endif + +static const short yyr1[] = { 0, + 20, 21, 21, 22, 23, 22, 22, 22, 24, 24, + 24, 25, 25, 25, 26, 27, 27, 27, 28, 28, + 29, 29, 30, 31, 31, 31, 32, -1, 33 +}; + +static const short yyr2[] = { 0, + 1, 2, 0, 5, 0, 9, 1, 2, 3, 2, + 0, 1, 1, 1, 3, 3, 3, 1, 2, 0, + 4, 0, 1, 1, 1, 1, 1, 1, 1 +}; + +static const short yydefact[] = { 0, + 0, 7, 23, 1, 0, 0, 8, 2, 24, 25, + 26, 0, 0, 27, 0, 0, 29, 22, 0, 0, + 20, 4, 0, 0, 5, 0, 18, 0, 19, 11, + 21, 0, 0, 14, 13, 0, 0, 22, 11, 12, + 16, 17, 11, 6, 20, 10, 9, 15, 0, 0, + 0 +}; + +static const short yydefgoto[] = { 49, + 4, 5, 30, 37, 38, 39, 29, 25, 21, 6, + 40, 15, 18 +}; + +static const short yypact[] = { 0, + -9,-32768,-32768,-32768, 0, 12,-32768,-32768,-32768,-32768, +-32768, 3, 3,-32768, 9, 9,-32768, -8, 8, 19, + 15,-32768, 10, -6,-32768, 24, 20, -6,-32768, 1, +-32768, -6, 21,-32768,-32768, 18, 25, -8, 1,-32768, +-32768,-32768, 1,-32768, 15,-32768,-32768,-32768, 35, 38, +-32768 +}; + +static const short yypgoto[] = {-32768, + 34,-32768,-32768, -13,-32768, 4, -1, -4, 5,-32768, + 36, 31, 29 +}; + + +#define YYLAST 45 + + +static const short yytable[] = { -3, + 1, 7, 27, 9, 10, 11, 34, 35, 28, 20, + 2, 3, 14, 36, 9, 10, 11, 17, 22, 12, + 9, 10, 11, 34, 35, 46, 33, 23, 26, 47, + 41, 24, 31, 32, 50, 44, 42, 51, 8, 43, + 48, 13, 45, 16, 19 +}; + +static const short yycheck[] = { 0, + 1, 11, 9, 3, 4, 5, 6, 7, 15, 18, + 11, 12, 10, 13, 3, 4, 5, 9, 11, 8, + 3, 4, 5, 6, 7, 39, 28, 9, 19, 43, + 32, 17, 9, 14, 0, 11, 16, 0, 5, 36, + 45, 6, 38, 13, 16 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/unsupported/share/bison.simple" + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +#ifndef alloca +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) +#include +#else /* not sparc */ +#if defined (MSDOS) && !defined (__TURBOC__) +#include +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +#include + #pragma alloca +#else /* not MSDOS, __TURBOC__, or _AIX */ +#ifdef __hpux +#ifdef __cplusplus +extern "C" { +void *alloca (unsigned int); +}; +#else /* not __cplusplus */ +void *alloca (); +#endif /* not __cplusplus */ +#endif /* __hpux */ +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc. */ +#endif /* not GNU C. */ +#endif /* alloca not defined. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +int yyparse (void); +#endif + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (from, to, count) + char *from; + char *to; + int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *from, char *to, int count) +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +#line 192 "/usr/unsupported/share/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#else +#define YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#endif + +int +yyparse(YYPARSE_PARAM) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); + yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 4: +#line 311 "./itbl-parse.y" +{ + DBG (("line %d: entry pnum=%d type=%d name=%s value=x%x\n", + insntbl_line, yyvsp[-4].num, yyvsp[-3].num, yyvsp[-2].str, yyvsp[-1].val)); + itbl_add_reg (yyvsp[-4].num, yyvsp[-3].num, yyvsp[-2].str, yyvsp[-1].val); + ; + break;} +case 5: +#line 317 "./itbl-parse.y" +{ + DBG (("line %d: entry pnum=%d type=INSN name=%s value=x%x", + insntbl_line, yyvsp[-5].num, yyvsp[-3].str, yyvsp[-2].val)); + DBG ((" sbit=%d ebit=%d flags=0x%x\n", sbit, ebit, yyvsp[0].val)); + insn=itbl_add_insn (yyvsp[-5].num, yyvsp[-3].str, yyvsp[-2].val, sbit, ebit, yyvsp[0].val); + ; + break;} +case 12: +#line 336 "./itbl-parse.y" +{ + DBGL2 (("ftype\n")); + yyval.num = yyvsp[0].num; + ; + break;} +case 13: +#line 341 "./itbl-parse.y" +{ + DBGL2 (("addr\n")); + yyval.num = ADDR; + ; + break;} +case 14: +#line 346 "./itbl-parse.y" +{ + DBGL2 (("immed\n")); + yyval.num = IMMED; + ; + break;} +case 15: +#line 354 "./itbl-parse.y" +{ + DBG (("line %d: field type=%d sbit=%d ebit=%d, flags=0x%x\n", + insntbl_line, yyvsp[-2].num, sbit, ebit, yyvsp[0].val)); + itbl_add_operand (insn, yyvsp[-2].num, sbit, ebit, yyvsp[0].val); + ; + break;} +case 16: +#line 363 "./itbl-parse.y" +{ + yyval.val = yyvsp[-2].num | yyvsp[0].val; + ; + break;} +case 17: +#line 367 "./itbl-parse.y" +{ + yyval.val = yyvsp[-1].val; + ; + break;} +case 18: +#line 371 "./itbl-parse.y" +{ + yyval.val = yyvsp[0].num; + ; + break;} +case 19: +#line 378 "./itbl-parse.y" +{ + DBGL2 (("flags=%d\n", yyvsp[0].val)); + yyval.val = yyvsp[0].val; + ; + break;} +case 20: +#line 383 "./itbl-parse.y" +{ + yyval.val = 0; + ; + break;} +case 21: +#line 390 "./itbl-parse.y" +{ + DBGL2 (("range %d %d\n", yyvsp[-2].num, yyvsp[0].num)); + sbit = yyvsp[-2].num; + ebit = yyvsp[0].num; + ; + break;} +case 22: +#line 396 "./itbl-parse.y" +{ + sbit = 31; + ebit = 0; + ; + break;} +case 23: +#line 404 "./itbl-parse.y" +{ + DBGL2 (("pnum=%d\n",yyvsp[0].num)); + yyval.num = yyvsp[0].num; + ; + break;} +case 24: +#line 412 "./itbl-parse.y" +{ + DBGL2 (("dreg\n")); + yyval.num = DREG; + ; + break;} +case 25: +#line 417 "./itbl-parse.y" +{ + DBGL2 (("creg\n")); + yyval.num = CREG; + ; + break;} +case 26: +#line 422 "./itbl-parse.y" +{ + DBGL2 (("greg\n")); + yyval.num = GREG; + ; + break;} +case 27: +#line 430 "./itbl-parse.y" +{ + DBGL2 (("name=%s\n",yyvsp[0].str)); + yyval.str = yyvsp[0].str; + ; + break;} +case 28: +#line 438 "./itbl-parse.y" +{ + DBGL2 (("num=%d\n",yyvsp[0].num)); + yyval.num = yyvsp[0].num; + ; + break;} +case 29: +#line 446 "./itbl-parse.y" +{ + DBGL2 (("val=x%x\n",yyvsp[0].num)); + yyval.val = yyvsp[0].num; + ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 487 "/usr/unsupported/share/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; +} +#line 451 "./itbl-parse.y" + + +static int +yyerror (msg) + const char *msg; +{ + printf ("line %d: %s\n", insntbl_line, msg); + return 0; +} diff -urN binutils-2.7/gas/itbl-parse.h binutils-2.8/gas/itbl-parse.h --- binutils-2.7/gas/itbl-parse.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/itbl-parse.h Wed Apr 30 12:53:36 1997 @@ -0,0 +1,20 @@ +typedef union + { + char *str; + int num; + int processor; + unsigned long val; + } YYSTYPE; +#define DREG 258 +#define CREG 259 +#define GREG 260 +#define IMMED 261 +#define ADDR 262 +#define INSN 263 +#define NUM 264 +#define ID 265 +#define NL 266 +#define PNUM 267 + + +extern YYSTYPE yylval; diff -urN binutils-2.7/gas/itbl-parse.y binutils-2.8/gas/itbl-parse.y --- binutils-2.7/gas/itbl-parse.y Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/itbl-parse.y Wed Apr 30 12:53:36 1997 @@ -0,0 +1,459 @@ +/* itbl-parse.y + Copyright (C) 1997 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +%{ + +/* + +Yacc grammar for instruction table entries. + +======================================================================= +Original Instruction table specification document: + + MIPS Coprocessor Table Specification + ==================================== + +This document describes the format of the MIPS coprocessor table. The +table specifies a list of valid functions, data registers and control +registers that can be used in coprocessor instructions. This list, +together with the coprocessor instruction classes listed below, +specifies the complete list of coprocessor instructions that will +be recognized and assembled by the GNU assembler. In effect, +this makes the GNU assembler table-driven, where the table is +specified by the programmer. + +The table is an ordinary text file that the GNU assembler reads when +it starts. Using the information in the table, the assembler +generates an internal list of valid coprocessor registers and +functions. The assembler uses this internal list in addition to the +standard MIPS registers and instructions which are built-in to the +assembler during code generation. + +To specify the coprocessor table when invoking the GNU assembler, use +the command line option "--itbl file", where file is the +complete name of the table, including path and extension. + +Examples: + + gas -t cop.tbl test.s -o test.o + gas -t /usr/local/lib/cop.tbl test.s -o test.o + gas --itbl d:\gnu\data\cop.tbl test.s -o test.o + +Only one table may be supplied during a single invocation of +the assembler. + + +Instruction classes +=================== + +Below is a list of the valid coprocessor instruction classes for +any given coprocessor "z". These instructions are already recognized +by the assembler, and are listed here only for reference. + +Class format instructions +------------------------------------------------- +Class1: + op base rt offset + LWCz rt,offset (base) + SWCz rt,offset (base) +Class2: + COPz sub rt rd 0 + MTCz rt,rd + MFCz rt,rd + CTCz rt,rd + CFCz rt,rd +Class3: + COPz CO cofun + COPz cofun +Class4: + COPz BC br offset + BCzT offset + BCzF offset +Class5: + COPz sub rt rd 0 + DMFCz rt,rd + DMTCz rt,rd +Class6: + op base rt offset + LDCz rt,offset (base) + SDCz rt,offset (base) +Class7: + COPz BC br offset + BCzTL offset + BCzFL offset + +The coprocessor table defines coprocessor-specific registers that can +be used with all of the above classes of instructions, where +appropriate. It also defines additional coprocessor-specific +functions for Class3 (COPz cofun) instructions, Thus, the table allows +the programmer to use convenient mnemonics and operands for these +functions, instead of the COPz mmenmonic and cofun operand. + +The names of the MIPS general registers and their aliases are defined +by the assembler and will be recognized as valid register names by the +assembler when used (where allowed) in coprocessor instructions. +However, the names and values of all coprocessor data and control +register mnemonics must be specified in the coprocessor table. + + +Table Grammar +============= + +Here is the grammar for the coprocessor table: + + table -> entry* + + entry -> [z entrydef] [comment] '\n' + + entrydef -> type name val + entrydef -> 'insn' name val funcdef ; type of entry (instruction) + + z -> 'p'['0'..'3'] ; processor number + type -> ['dreg' | 'creg' | 'greg' ] ; type of entry (register) + ; 'dreg', 'creg' or 'greg' specifies a data, control, or general + ; register mnemonic, respectively + name -> [ltr|dec]* ; mnemonic of register/function + val -> [dec|hex] ; register/function number (integer constant) + + funcdef -> frange flags fields + ; bitfield range for opcode + ; list of fields' formats + fields -> field* + field -> [','] ftype frange flags + flags -> ['*' flagexpr] + flagexpr -> '[' flagexpr ']' + flagexpr -> val '|' flagexpr + ftype -> [ type | 'immed' | 'addr' ] + ; 'immed' specifies an immediate value; see grammar for "val" above + ; 'addr' specifies a C identifier; name of symbol to be resolved at + ; link time + frange -> ':' val '-' val ; starting to ending bit positions, where + ; where 0 is least significant bit + frange -> (null) ; default range of 31-0 will be assumed + + comment -> [';'|'#'] [char]* + char -> any printable character + ltr -> ['a'..'z'|'A'..'Z'] + dec -> ['0'..'9']* ; value in decimal + hex -> '0x'['0'..'9' | 'a'..'f' | 'A'..'F']* ; value in hexidecimal + + +Examples +======== + +Example 1: + +The table: + + p1 dreg d1 1 ; data register "d1" for COP1 has value 1 + p1 creg c3 3 ; ctrl register "c3" for COP1 has value 3 + p3 func fill 0x1f:24-20 ; function "fill" for COP3 has value 31 and + ; no fields + +will allow the assembler to accept the following coprocessor instructions: + + LWC1 d1,0x100 ($2) + fill + +Here, the general purpose register "$2", and instruction "LWC1", are standard +mnemonics built-in to the MIPS assembler. + + +Example 2: + +The table: + + p3 dreg d3 3 ; data register "d3" for COP3 has value 3 + p3 creg c2 22 ; control register "c2" for COP3 has value 22 + p3 func fee 0x1f:24-20 dreg:17-13 creg:12-8 immed:7-0 + ; function "fee" for COP3 has value 31, and 3 fields + ; consisting of a data register, a control register, + ; and an immediate value. + +will allow the assembler to accept the following coprocessor instruction: + + fee d3,c2,0x1 + +and will emit the object code: + + 31-26 25 24-20 19-18 17-13 12-8 7-0 + COPz CO fun dreg creg immed + 010011 1 11111 00 00011 10110 00000001 + + 0x4ff07601 + + +Example 3: + +The table: + + p3 dreg d3 3 ; data register "d3" for COP3 has value 3 + p3 creg c2 22 ; control register "c2" for COP3 has value 22 + p3 func fuu 0x01f00001 dreg:17-13 creg:12-8 + +will allow the assembler to accept the following coprocessor +instruction: + + fuu d3,c2 + +and will emit the object code: + + 31-26 25 24-20 19-18 17-13 12-8 7-0 + COPz CO fun dreg creg + 010011 1 11111 00 00011 10110 00000001 + + 0x4ff07601 + +In this way, the programmer can force arbitrary bits of an instruction +to have predefined values. + +======================================================================= +Additional notes: + +Encoding of ranges: +To handle more than one bit position range within an instruction, +use 0s to mask out the ranges which don't apply. +May decide to modify the syntax to allow commas separate multiple +ranges within an instruction (range','range). + +Changes in grammar: + The number of parms argument to the function entry +was deleted from the original format such that we now count the fields. + +---- +FIXME! should really change lexical analyzer +to recognize 'dreg' etc. in context sensative way. +Currently function names or mnemonics may be incorrectly parsed as keywords + +FIXME! hex is ambiguous with any digit + +*/ + +#include +#include "itbl-ops.h" + +/* #define DEBUG */ + +#ifdef DEBUG +#ifndef DBG_LVL +#define DBG_LVL 1 +#endif +#else +#define DBG_LVL 0 +#endif + +#if DBG_LVL >= 1 +#define DBG(x) printf x +#else +#define DBG(x) +#endif + +#if DBG_LVL >= 2 +#define DBGL2(x) printf x +#else +#define DBGL2(x) +#endif + +static int sbit, ebit; +static struct itbl_entry *insn=0; +extern int insntbl_line; +int yyparse PARAMS ((void)); +int yylex PARAMS ((void)); +static int yyerror PARAMS ((const char *)); + +%} + +%union + { + char *str; + int num; + int processor; + unsigned long val; + } + +%token DREG CREG GREG IMMED ADDR INSN NUM ID NL PNUM +%type value flags flagexpr +%type number NUM ftype regtype pnum PNUM +%type ID name + +%start insntbl + +%% + +insntbl: + entrys + ; + +entrys: + entry entrys + | + ; + +entry: + pnum regtype name value NL + { + DBG (("line %d: entry pnum=%d type=%d name=%s value=x%x\n", + insntbl_line, $1, $2, $3, $4)); + itbl_add_reg ($1, $2, $3, $4); + } + | pnum INSN name value range flags + { + DBG (("line %d: entry pnum=%d type=INSN name=%s value=x%x", + insntbl_line, $1, $3, $4)); + DBG ((" sbit=%d ebit=%d flags=0x%x\n", sbit, ebit, $6)); + insn=itbl_add_insn ($1, $3, $4, sbit, ebit, $6); + } + fieldspecs NL + | NL + | error NL + ; + +fieldspecs: + ',' fieldspec fieldspecs + | fieldspec fieldspecs + | + ; + +ftype: + regtype + { + DBGL2 (("ftype\n")); + $$ = $1; + } + | ADDR + { + DBGL2 (("addr\n")); + $$ = ADDR; + } + | IMMED + { + DBGL2 (("immed\n")); + $$ = IMMED; + } + ; + +fieldspec: + ftype range flags + { + DBG (("line %d: field type=%d sbit=%d ebit=%d, flags=0x%x\n", + insntbl_line, $1, sbit, ebit, $3)); + itbl_add_operand (insn, $1, sbit, ebit, $3); + } + ; + +flagexpr: + NUM '|' flagexpr + { + $$ = $1 | $3; + } + | '[' flagexpr ']' + { + $$ = $2; + } + | NUM + { + $$ = $1; + } + ; + +flags: + '*' flagexpr + { + DBGL2 (("flags=%d\n", $2)); + $$ = $2; + } + | + { + $$ = 0; + } + ; + +range: + ':' NUM '-' NUM + { + DBGL2 (("range %d %d\n", $2, $4)); + sbit = $2; + ebit = $4; + } + | + { + sbit = 31; + ebit = 0; + } + ; + +pnum: + PNUM + { + DBGL2 (("pnum=%d\n",$1)); + $$ = $1; + } + ; + +regtype: + DREG + { + DBGL2 (("dreg\n")); + $$ = DREG; + } + | CREG + { + DBGL2 (("creg\n")); + $$ = CREG; + } + | GREG + { + DBGL2 (("greg\n")); + $$ = GREG; + } + ; + +name: + ID + { + DBGL2 (("name=%s\n",$1)); + $$ = $1; + } + ; + +number: + NUM + { + DBGL2 (("num=%d\n",$1)); + $$ = $1; + } + ; + +value: + NUM + { + DBGL2 (("val=x%x\n",$1)); + $$ = $1; + } + ; +%% + +static int +yyerror (msg) + const char *msg; +{ + printf ("line %d: %s\n", insntbl_line, msg); + return 0; +} diff -urN binutils-2.7/gas/listing.c binutils-2.8/gas/listing.c --- binutils-2.7/gas/listing.c Thu Jul 4 12:13:05 1996 +++ binutils-2.8/gas/listing.c Wed Apr 30 12:53:37 1997 @@ -1,5 +1,5 @@ /* listing.c - mainting assembly listings - Copyright (C) 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GAS; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +along with GAS; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ /* Contributed by Steve Chamberlain @@ -168,6 +169,7 @@ EDICT_TITLE, EDICT_NOLIST, EDICT_LIST, + EDICT_NOLIST_NEXT, EDICT_EJECT } edict; char *edict_arg; @@ -205,9 +207,8 @@ char *line, unsigned int size)); static void listing_page PARAMS ((list_info_type *list)); static unsigned int calc_hex PARAMS ((list_info_type *list)); -static void print_lines PARAMS ((list_info_type *list, - char *string, - unsigned int address)); +static void print_lines PARAMS ((list_info_type *, unsigned int, + char *, unsigned int)); static void list_symbol_table PARAMS ((void)); static void print_source PARAMS ((file_info_type *current_file, list_info_type *list, @@ -555,8 +556,9 @@ static void -print_lines (list, string, address) +print_lines (list, lineno, string, address) list_info_type *list; + unsigned int lineno; char *string; unsigned int address; { @@ -572,7 +574,7 @@ /* Print the hex for the first line */ if (address == ~0) { - fprintf (list_file, "% 4d ", list->line); + fprintf (list_file, "% 4d ", lineno); for (idx = 0; idx < nchars; idx++) fprintf (list_file, " "); @@ -585,11 +587,11 @@ { if (had_errors ()) { - fprintf (list_file, "% 4d ???? ", list->line); + fprintf (list_file, "% 4d ???? ", lineno); } else { - fprintf (list_file, "% 4d %04x ", list->line, address); + fprintf (list_file, "% 4d %04x ", lineno, address); } /* And the data to go along with it */ @@ -630,7 +632,7 @@ nchars = ((LISTING_WORD_SIZE * 2) + 1) * LISTING_LHS_WIDTH_SECOND - 1; idx = 0; /* Print any more lines of data, but more compactly */ - fprintf (list_file, "% 4d ", list->line); + fprintf (list_file, "% 4d ", lineno); while (*src && idx < nchars) { @@ -688,12 +690,7 @@ } #if defined (BFD64) else if (sizeof (val) > 4) - { - char buf1[30]; - sprintf_vma (buf1, val); - strcpy (buf, "00000000"); - strcpy (buf + 8 - strlen (buf1), buf1); - } + sprintf_vma (buf, val); #endif else abort (); @@ -865,6 +862,8 @@ case EDICT_NOLIST: show_listing--; break; + case EDICT_NOLIST_NEXT: + break; case EDICT_EJECT: break; case EDICT_NONE: @@ -899,12 +898,17 @@ && list->file->linenum < list->line && !list->file->at_end) { + unsigned int address; + p = buffer_line (list->file, buffer, width); + if (list->file->linenum < list->line) + address = ~ (unsigned int) 0; + else + address = calc_hex (list); + if (!((listing & LISTING_NODEBUG) && debugging_pseudo (p))) - { - print_lines (list, p, calc_hex (list)); - } + print_lines (list, list->file->linenum, p, address); } if (list->edict == EDICT_EJECT) @@ -920,6 +924,9 @@ p = buffer_line (list->file, buffer, width); } + if (list->edict == EDICT_NOLIST_NEXT) + --show_listing; + list = list->next; } free (buffer); @@ -1009,12 +1016,39 @@ } +/* Turn listing on or off. An argument of 0 means to turn off + listing. An argument of 1 means to turn on listing. An argument + of 2 means to turn off listing, but as of the next line; that is, + the current line should be listed, but the next line should not. */ + void listing_list (on) int on; { if (listing) - listing_tail->edict = on ? EDICT_LIST : EDICT_NOLIST; + { + switch (on) + { + case 0: + if (listing_tail->edict == EDICT_LIST) + listing_tail->edict = EDICT_NONE; + else + listing_tail->edict = EDICT_NOLIST; + break; + case 1: + if (listing_tail->edict == EDICT_NOLIST + || listing_tail->edict == EDICT_NOLIST_NEXT) + listing_tail->edict = EDICT_NONE; + else + listing_tail->edict = EDICT_LIST; + break; + case 2: + listing_tail->edict = EDICT_NOLIST_NEXT; + break; + default: + abort (); + } + } } diff -urN binutils-2.7/gas/listing.h binutils-2.8/gas/listing.h --- binutils-2.7/gas/listing.h Thu Jul 4 12:13:05 1996 +++ binutils-2.8/gas/listing.h Wed Apr 30 12:53:37 1997 @@ -1,5 +1,6 @@ /* This file is listing.h - Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1997 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,9 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #ifndef __listing_h__ #define __listing_h__ @@ -26,6 +27,7 @@ #define LISTING_NOFORM 4 #define LISTING_HLL 8 #define LISTING_NODEBUG 16 +#define LISTING_NOCOND 32 #define LISTING_DEFAULT (LISTING_LISTING | LISTING_HLL | LISTING_SYMBOLS) @@ -34,6 +36,8 @@ #else #define LISTING_NEWLINE() {;} #endif + +#define LISTING_SKIP_COND() ((listing & LISTING_NOCOND) != 0) void listing_eject PARAMS ((int)); void listing_error PARAMS ((const char *message)); diff -urN binutils-2.7/gas/m68k-parse.c binutils-2.8/gas/m68k-parse.c --- binutils-2.7/gas/m68k-parse.c Mon Jul 15 12:22:57 1996 +++ binutils-2.8/gas/m68k-parse.c Wed Apr 30 12:53:37 1997 @@ -75,7 +75,7 @@ /* Internal functions. */ static enum m68k_register m68k_reg_parse PARAMS ((char **)); -static int yylex PARAMS (()); +static int yylex PARAMS ((void)); static void yyerror PARAMS ((const char *)); /* The parser sets fields pointed to by this global variable. */ @@ -118,7 +118,7 @@ -#define YYFINAL 170 +#define YYFINAL 173 #define YYFLAG -32768 #define YYNTBASE 25 @@ -158,13 +158,13 @@ static const short yyprhs[] = { 0, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 21, 24, 26, 30, 35, 40, 46, 52, 57, 61, - 65, 69, 77, 85, 92, 99, 105, 112, 118, 124, - 129, 139, 147, 156, 163, 174, 183, 194, 203, 212, - 215, 219, 223, 229, 236, 247, 257, 268, 270, 272, - 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, - 294, 296, 297, 299, 301, 303, 304, 307, 308, 311, - 312, 315, 317, 321, 325, 327, 329, 333, 337, 341, - 343, 345, 347 + 65, 69, 77, 85, 92, 98, 105, 111, 118, 124, + 130, 135, 145, 153, 162, 169, 180, 189, 200, 209, + 218, 221, 225, 229, 235, 242, 253, 263, 274, 276, + 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, + 298, 300, 302, 303, 305, 307, 309, 310, 313, 314, + 317, 318, 321, 323, 327, 331, 333, 335, 339, 343, + 347, 349, 351, 353 }; static const short yyrhs[] = { 26, @@ -177,32 +177,33 @@ 16, 8, 17, 0, 16, 10, 17, 0, 16, 13, 20, 34, 20, 29, 17, 0, 16, 13, 20, 34, 20, 36, 17, 0, 16, 13, 20, 30, 37, 17, - 0, 13, 16, 34, 20, 29, 17, 0, 16, 34, - 20, 29, 17, 0, 13, 16, 34, 20, 36, 17, - 0, 16, 34, 20, 36, 17, 0, 13, 16, 30, - 37, 17, 0, 16, 30, 37, 17, 0, 16, 21, - 13, 37, 22, 20, 29, 38, 17, 0, 16, 21, - 13, 37, 22, 38, 17, 0, 16, 21, 34, 22, - 20, 29, 38, 17, 0, 16, 21, 34, 22, 38, - 17, 0, 16, 21, 13, 20, 34, 20, 29, 22, - 38, 17, 0, 16, 21, 34, 20, 29, 22, 38, - 17, 0, 16, 21, 13, 20, 34, 20, 36, 22, - 38, 17, 0, 16, 21, 34, 20, 36, 22, 38, - 17, 0, 16, 21, 39, 30, 37, 22, 38, 17, - 0, 35, 23, 0, 35, 23, 18, 0, 35, 23, - 19, 0, 35, 23, 16, 13, 17, 0, 35, 23, - 16, 39, 29, 17, 0, 35, 23, 16, 13, 17, - 23, 16, 39, 29, 17, 0, 35, 23, 16, 13, - 17, 23, 16, 13, 17, 0, 35, 23, 16, 39, - 29, 17, 23, 16, 13, 17, 0, 12, 0, 31, - 0, 12, 0, 32, 0, 32, 0, 4, 0, 8, - 0, 3, 0, 9, 0, 4, 0, 7, 0, 33, - 0, 10, 0, 8, 0, 0, 34, 0, 7, 0, - 10, 0, 0, 20, 34, 0, 0, 20, 13, 0, - 0, 13, 20, 0, 42, 0, 42, 24, 41, 0, - 43, 24, 41, 0, 43, 0, 42, 0, 42, 24, - 41, 0, 43, 24, 41, 0, 43, 19, 43, 0, - 3, 0, 4, 0, 5, 0, 6, 0 + 0, 16, 30, 20, 13, 17, 0, 13, 16, 34, + 20, 29, 17, 0, 16, 34, 20, 29, 17, 0, + 13, 16, 34, 20, 36, 17, 0, 16, 34, 20, + 36, 17, 0, 13, 16, 30, 37, 17, 0, 16, + 30, 37, 17, 0, 16, 21, 13, 37, 22, 20, + 29, 38, 17, 0, 16, 21, 13, 37, 22, 38, + 17, 0, 16, 21, 34, 22, 20, 29, 38, 17, + 0, 16, 21, 34, 22, 38, 17, 0, 16, 21, + 13, 20, 34, 20, 29, 22, 38, 17, 0, 16, + 21, 34, 20, 29, 22, 38, 17, 0, 16, 21, + 13, 20, 34, 20, 36, 22, 38, 17, 0, 16, + 21, 34, 20, 36, 22, 38, 17, 0, 16, 21, + 39, 30, 37, 22, 38, 17, 0, 35, 23, 0, + 35, 23, 18, 0, 35, 23, 19, 0, 35, 23, + 16, 13, 17, 0, 35, 23, 16, 39, 29, 17, + 0, 35, 23, 16, 13, 17, 23, 16, 39, 29, + 17, 0, 35, 23, 16, 13, 17, 23, 16, 13, + 17, 0, 35, 23, 16, 39, 29, 17, 23, 16, + 13, 17, 0, 12, 0, 31, 0, 12, 0, 32, + 0, 32, 0, 4, 0, 8, 0, 3, 0, 9, + 0, 4, 0, 7, 0, 33, 0, 10, 0, 8, + 0, 0, 34, 0, 7, 0, 10, 0, 0, 20, + 34, 0, 0, 20, 13, 0, 0, 13, 20, 0, + 42, 0, 42, 24, 41, 0, 43, 24, 41, 0, + 43, 0, 42, 0, 42, 24, 41, 0, 43, 24, + 41, 0, 43, 19, 43, 0, 3, 0, 4, 0, + 5, 0, 6, 0 }; #endif @@ -211,13 +212,13 @@ static const short yyrline[] = { 0, 116, 118, 119, 124, 130, 135, 140, 145, 150, 155, 160, 165, 177, 183, 188, 193, 203, 213, 223, 228, - 233, 238, 245, 256, 263, 270, 276, 287, 297, 304, - 310, 318, 325, 332, 338, 346, 353, 365, 376, 388, - 397, 405, 413, 423, 430, 438, 445, 458, 460, 472, - 474, 485, 487, 488, 493, 495, 500, 502, 508, 510, - 511, 516, 521, 526, 528, 533, 538, 546, 552, 560, - 566, 574, 576, 580, 591, 596, 597, 601, 607, 614, - 619, 623, 627 + 233, 238, 245, 256, 263, 269, 276, 282, 293, 303, + 310, 316, 324, 331, 338, 344, 352, 359, 371, 382, + 394, 403, 411, 419, 429, 436, 444, 451, 464, 466, + 478, 480, 491, 493, 494, 499, 501, 506, 508, 514, + 516, 517, 522, 527, 532, 534, 539, 544, 552, 558, + 566, 572, 580, 582, 586, 597, 602, 603, 607, 613, + 620, 625, 629, 633 }; static const char * const yytname[] = { "$","error","$undefined.","DR","AR", @@ -233,124 +234,128 @@ 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, - 28, 28, 28, 28, 28, 28, 28, 29, 29, 30, - 30, 31, 31, 31, 32, 32, 33, 33, 34, 34, - 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, - 39, 40, 40, 40, 41, 41, 41, 41, 42, 43, - 43, 43, 43 + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, + 30, 30, 31, 31, 31, 32, 32, 33, 33, 34, + 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, + 39, 39, 40, 40, 40, 41, 41, 41, 41, 42, + 43, 43, 43, 43 }; static const short yyr2[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 3, 4, 4, 5, 5, 4, 3, 3, - 3, 7, 7, 6, 6, 5, 6, 5, 5, 4, - 9, 7, 8, 6, 10, 8, 10, 8, 8, 2, - 3, 3, 5, 6, 10, 9, 10, 1, 1, 1, + 3, 7, 7, 6, 5, 6, 5, 6, 5, 5, + 4, 9, 7, 8, 6, 10, 8, 10, 8, 8, + 2, 3, 3, 5, 6, 10, 9, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 0, 2, 0, 2, 0, - 2, 1, 3, 3, 1, 1, 3, 3, 3, 1, - 1, 1, 1 + 1, 1, 0, 1, 1, 1, 0, 2, 0, 2, + 0, 2, 1, 3, 3, 1, 1, 3, 3, 3, + 1, 1, 1, 1 }; -static const short yydefact[] = { 62, - 80, 81, 82, 83, 58, 61, 60, 8, 9, 0, - 0, 0, 0, 1, 2, 3, 59, 63, 0, 12, - 72, 0, 0, 10, 11, 55, 57, 58, 61, 56, - 60, 50, 0, 70, 66, 51, 0, 0, 40, 0, - 0, 0, 57, 66, 0, 13, 19, 20, 21, 0, - 66, 0, 0, 0, 0, 0, 0, 70, 41, 42, - 80, 81, 82, 83, 73, 76, 75, 79, 74, 0, - 18, 0, 14, 66, 0, 71, 0, 0, 68, 66, - 67, 30, 53, 64, 54, 65, 48, 0, 0, 49, - 52, 0, 15, 0, 0, 0, 0, 29, 0, 0, - 0, 16, 0, 67, 68, 0, 0, 0, 0, 0, - 17, 26, 28, 43, 71, 0, 77, 78, 25, 27, - 24, 0, 0, 0, 0, 0, 68, 68, 69, 68, - 34, 68, 0, 44, 22, 23, 0, 0, 68, 32, - 0, 0, 0, 0, 0, 70, 0, 68, 68, 0, - 36, 38, 33, 39, 0, 0, 0, 0, 0, 31, - 46, 0, 0, 35, 37, 45, 47, 0, 0, 0 +static const short yydefact[] = { 63, + 81, 82, 83, 84, 59, 62, 61, 8, 9, 0, + 0, 0, 0, 1, 2, 3, 60, 64, 0, 12, + 73, 0, 0, 10, 11, 56, 58, 59, 62, 57, + 61, 51, 0, 71, 67, 52, 0, 0, 41, 0, + 0, 0, 58, 67, 0, 13, 19, 20, 21, 0, + 67, 0, 0, 0, 0, 0, 0, 71, 42, 43, + 81, 82, 83, 84, 74, 77, 76, 80, 75, 0, + 0, 18, 0, 14, 67, 0, 72, 0, 0, 69, + 67, 0, 68, 31, 54, 65, 55, 66, 49, 0, + 0, 50, 53, 0, 15, 0, 0, 0, 0, 30, + 0, 0, 0, 16, 0, 68, 69, 0, 0, 0, + 0, 0, 25, 17, 27, 29, 44, 72, 0, 78, + 79, 26, 28, 24, 0, 0, 0, 0, 0, 69, + 69, 70, 69, 35, 69, 0, 45, 22, 23, 0, + 0, 69, 33, 0, 0, 0, 0, 0, 71, 0, + 69, 69, 0, 37, 39, 34, 40, 0, 0, 0, + 0, 0, 32, 47, 0, 0, 36, 38, 46, 48, + 0, 0, 0 }; -static const short yydefgoto[] = { 168, - 14, 15, 16, 89, 35, 90, 91, 17, 18, 19, - 92, 55, 109, 53, 20, 65, 66, 67 +static const short yydefgoto[] = { 171, + 14, 15, 16, 91, 35, 92, 93, 17, 83, 19, + 94, 55, 111, 53, 20, 65, 66, 67 }; -static const short yypact[] = { 68, - 19, 10, 34, 39,-32768,-32768,-32768,-32768, -5, 31, - 38, 56, 46,-32768,-32768,-32768,-32768,-32768, 47,-32768, - 62, -2, 104,-32768,-32768,-32768, 63, 74, 75,-32768, - 80,-32768, 82, 121, 83,-32768, 84, 111, 131, 140, - 140, 140,-32768, 83, 3, 101,-32768,-32768,-32768, 104, - 100, 30, 9, 132, 118, 86, 136, 143,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 124, 11,-32768,-32768, 141, --32768, 114,-32768, 83, 110, 132, 137, 114, 142, 83, --32768,-32768,-32768,-32768,-32768,-32768,-32768, 144, 146,-32768, --32768, 147,-32768, 134, 129, 140, 140,-32768, 148, 149, - 150,-32768, 114, 151, 152, 138, 153, 97, 156, 154, --32768,-32768,-32768, 145,-32768, 157,-32768,-32768,-32768,-32768, --32768, 160, 161, 114, 97, 162, 163, 163,-32768, 163, --32768, 163, 164, 158,-32768,-32768, 165, 166, 163,-32768, - 169, 167, 168, 172, 173, 178, 170, 163, 163, 175, --32768,-32768,-32768,-32768, 135, 129, 180, 177, 179,-32768, --32768, 181, 182,-32768,-32768,-32768,-32768, 195, 197,-32768 +static const short yypact[] = { 89, + 10, 11, 19, 23,-32768,-32768,-32768,-32768, 13, -4, + 22, 57, 36,-32768,-32768,-32768,-32768,-32768, 18,-32768, + 33, -2, 114,-32768,-32768,-32768, 46, 62, 66,-32768, + 67,-32768, 68, 131, 69,-32768, 70, 105, 147, 156, + 156, 156,-32768, 94, 25, 101,-32768,-32768,-32768, 114, + 100, 53, 9, 138, 108, 103, 112, 117,-32768,-32768, +-32768,-32768,-32768,-32768,-32768, 119, 12,-32768,-32768, 64, + 130,-32768, 124,-32768, 94, 81, 64, 135, 124, 132, + 94, 150,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 151, + 152,-32768,-32768, 153,-32768, 120, 146, 156, 156,-32768, + 154, 155, 157,-32768, 124, 144, 158, 159, 160, 73, + 162, 161,-32768,-32768,-32768,-32768, 163,-32768, 167,-32768, +-32768,-32768,-32768,-32768, 168, 170, 124, 73, 171, 169, + 169,-32768, 169,-32768, 169, 164, 172,-32768,-32768, 174, + 175, 169,-32768, 177, 176, 181, 182, 183, 178, 185, + 169, 169, 186,-32768,-32768,-32768,-32768, 136, 146, 179, + 187, 188,-32768,-32768, 189, 190,-32768,-32768,-32768,-32768, + 173, 194,-32768 }; static const short yypgoto[] = {-32768, --32768,-32768,-32768, -71, 5,-32768, -7,-32768, -9,-32768, - -63, -38, -101, -58,-32768, -40, 200, 8 +-32768,-32768,-32768, -72, 1,-32768, -7,-32768, 3,-32768, + -65, -31, -103, -58,-32768, -40, 202, 6 }; -#define YYLAST 200 +#define YYLAST 207 -static const short yytable[] = { 95, - 99, 69, 37, 126, 36, 70, 106, 22, 100, -5, - 23, 26, 77, 45, 107, 36, 41, 30, -4, 71, - 32, 42, 72, 116, 52, 142, 143, 44, 144, 41, - 145, 122, -57, -6, 97, 101, 130, 150, -7, 123, - 75, 110, 36, 24, 81, 36, 158, 159, 68, 78, - 25, 79, 137, 139, 74, 117, 118, 80, 26, 27, - 138, 38, 28, 29, 30, 31, 104, 32, 33, 39, - 1, 2, 3, 4, 5, 6, 34, 7, 8, 46, - 9, 10, 11, 12, 162, 40, 13, 156, 26, 83, - 47, 48, 84, 85, 30, 86, 49, 87, 88, 26, - 83, 50, 54, 56, 85, 30, 26, 43, 87, 129, - 5, 6, 30, 7, 57, 32, 26, 83, 73, 76, - 84, 85, 30, 86, 43, 87, 102, 5, 6, 103, - 7, 26, 83, 51, 82, 43, 85, 30, 5, 6, - 87, 7, 61, 62, 63, 64, 58, 96, 59, 60, - 114, 161, 93, 115, 115, 94, 0, 98, 105, 127, - 111, 108, 112, 113, 119, 120, 121, 133, 0, 0, - 124, 125, 131, 134, 128, 132, 135, 136, 140, 146, - 147, 129, 141, 151, 152, 157, 148, 149, 153, 154, - 155, 160, 163, 164, 169, 165, 170, 166, 167, 21 +static const short yytable[] = { 97, + 101, 69, 18, 129, 36, 22, 108, 102, 24, -4, + -5, 26, 71, 109, 37, 36, 41, 30, -6, 78, + 32, 42, -7, 44, 119, 45, 145, 146, 23, 147, + 41, 148, 125, -58, 25, 99, 52, 133, 153, 126, + 39, 72, 36, 103, 73, 36, 68, 161, 162, 112, + 75, 38, 76, 81, 140, 142, 40, 120, 121, 26, + 27, 141, 46, 28, 29, 30, 31, 43, 32, 33, + 5, 6, 79, 7, 80, 26, 85, 34, 47, 106, + 87, 30, 48, 49, 89, 132, 165, 50, 54, 56, + 159, 1, 2, 3, 4, 5, 6, 104, 7, 8, + 105, 9, 10, 11, 12, 26, 85, 13, 57, 86, + 87, 30, 88, 70, 89, 90, 26, 43, 74, 77, + 5, 6, 30, 7, 84, 32, 26, 85, 95, 96, + 86, 87, 30, 88, 43, 89, 117, 5, 6, 118, + 7, 43, 98, 51, 5, 6, 100, 7, 26, 85, + 82, 110, 164, 87, 30, 118, 107, 89, 61, 62, + 63, 64, 58, 127, 59, 60, 113, 114, 115, 116, + 122, 123, 172, 124, 0, 0, 0, 128, 134, 149, + 130, 131, 135, 137, 138, 136, 139, 143, 144, 132, + 158, 166, 154, 173, 150, 151, 152, 155, 156, 157, + 160, 21, 163, 167, 168, 169, 170 }; static const short yycheck[] = { 58, - 72, 42, 12, 105, 12, 44, 78, 0, 72, 0, - 16, 3, 51, 23, 78, 23, 19, 9, 0, 17, - 12, 24, 20, 95, 34, 127, 128, 23, 130, 19, - 132, 103, 23, 0, 24, 74, 108, 139, 0, 103, - 50, 80, 50, 13, 54, 53, 148, 149, 41, 20, - 13, 22, 124, 125, 50, 96, 97, 53, 3, 4, - 124, 16, 7, 8, 9, 10, 76, 12, 13, 23, - 3, 4, 5, 6, 7, 8, 21, 10, 11, 17, - 13, 14, 15, 16, 156, 24, 19, 146, 3, 4, - 17, 17, 7, 8, 9, 10, 17, 12, 13, 3, - 4, 20, 20, 20, 8, 9, 3, 4, 12, 13, - 7, 8, 9, 10, 4, 12, 3, 4, 18, 20, + 73, 42, 0, 107, 12, 0, 79, 73, 13, 0, + 0, 3, 44, 79, 12, 23, 19, 9, 0, 51, + 12, 24, 0, 23, 97, 23, 130, 131, 16, 133, + 19, 135, 105, 23, 13, 24, 34, 110, 142, 105, + 23, 17, 50, 75, 20, 53, 41, 151, 152, 81, + 50, 16, 50, 53, 127, 128, 24, 98, 99, 3, + 4, 127, 17, 7, 8, 9, 10, 4, 12, 13, + 7, 8, 20, 10, 22, 3, 4, 21, 17, 77, + 8, 9, 17, 17, 12, 13, 159, 20, 20, 20, + 149, 3, 4, 5, 6, 7, 8, 17, 10, 11, + 20, 13, 14, 15, 16, 3, 4, 19, 4, 7, + 8, 9, 10, 20, 12, 13, 3, 4, 18, 20, + 7, 8, 9, 10, 17, 12, 3, 4, 17, 13, 7, 8, 9, 10, 4, 12, 17, 7, 8, 20, - 10, 3, 4, 13, 17, 4, 8, 9, 7, 8, - 12, 10, 3, 4, 5, 6, 16, 24, 18, 19, - 17, 17, 17, 20, 20, 13, -1, 17, 22, 22, - 17, 20, 17, 17, 17, 17, 17, 23, -1, -1, - 20, 20, 17, 17, 22, 22, 17, 17, 17, 16, - 23, 13, 20, 17, 17, 16, 22, 22, 17, 17, - 13, 17, 13, 17, 0, 17, 0, 17, 17, 0 + 10, 4, 24, 13, 7, 8, 17, 10, 3, 4, + 13, 20, 17, 8, 9, 20, 22, 12, 3, 4, + 5, 6, 16, 20, 18, 19, 17, 17, 17, 17, + 17, 17, 0, 17, -1, -1, -1, 20, 17, 16, + 22, 22, 22, 17, 17, 23, 17, 17, 20, 13, + 13, 13, 17, 0, 23, 22, 22, 17, 17, 17, + 16, 0, 17, 17, 17, 17, 17 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/unsupported/share/bison.simple" @@ -1020,22 +1025,30 @@ #line 264 "./config/m68k-parse.y" { op->mode = BASE; - op->reg = yyvsp[-3].reg; - op->disp = yyvsp[-5].exp; - op->index = yyvsp[-1].indexreg; + op->disp = yyvsp[-1].exp; + op->index = yyvsp[-3].indexreg; ; break;} case 26: -#line 271 "./config/m68k-parse.y" +#line 270 "./config/m68k-parse.y" { op->mode = BASE; op->reg = yyvsp[-3].reg; + op->disp = yyvsp[-5].exp; op->index = yyvsp[-1].indexreg; ; break;} case 27: #line 277 "./config/m68k-parse.y" { + op->mode = BASE; + op->reg = yyvsp[-3].reg; + op->index = yyvsp[-1].indexreg; + ; + break;} +case 28: +#line 283 "./config/m68k-parse.y" +{ if (yyvsp[-3].reg == PC || yyvsp[-3].reg == ZPC) yyerror ("syntax error"); op->mode = BASE; @@ -1046,8 +1059,8 @@ op->index.scale = 1; ; break;} -case 28: -#line 288 "./config/m68k-parse.y" +case 29: +#line 294 "./config/m68k-parse.y" { if (yyvsp[-3].reg == PC || yyvsp[-3].reg == ZPC) yyerror ("syntax error"); @@ -1058,8 +1071,8 @@ op->index.scale = 1; ; break;} -case 29: -#line 298 "./config/m68k-parse.y" +case 30: +#line 304 "./config/m68k-parse.y" { op->mode = BASE; op->reg = yyvsp[-1].reg; @@ -1067,16 +1080,16 @@ op->index = yyvsp[-2].indexreg; ; break;} -case 30: -#line 305 "./config/m68k-parse.y" +case 31: +#line 311 "./config/m68k-parse.y" { op->mode = BASE; op->reg = yyvsp[-1].reg; op->index = yyvsp[-2].indexreg; ; break;} -case 31: -#line 311 "./config/m68k-parse.y" +case 32: +#line 317 "./config/m68k-parse.y" { op->mode = POST; op->reg = yyvsp[-5].reg; @@ -1085,8 +1098,8 @@ op->odisp = yyvsp[-1].exp; ; break;} -case 32: -#line 319 "./config/m68k-parse.y" +case 33: +#line 325 "./config/m68k-parse.y" { op->mode = POST; op->reg = yyvsp[-3].reg; @@ -1094,8 +1107,8 @@ op->odisp = yyvsp[-1].exp; ; break;} -case 33: -#line 326 "./config/m68k-parse.y" +case 34: +#line 332 "./config/m68k-parse.y" { op->mode = POST; op->reg = yyvsp[-5].reg; @@ -1103,16 +1116,16 @@ op->odisp = yyvsp[-1].exp; ; break;} -case 34: -#line 333 "./config/m68k-parse.y" +case 35: +#line 339 "./config/m68k-parse.y" { op->mode = POST; op->reg = yyvsp[-3].reg; op->odisp = yyvsp[-1].exp; ; break;} -case 35: -#line 339 "./config/m68k-parse.y" +case 36: +#line 345 "./config/m68k-parse.y" { op->mode = PRE; op->reg = yyvsp[-5].reg; @@ -1121,8 +1134,8 @@ op->odisp = yyvsp[-1].exp; ; break;} -case 36: -#line 347 "./config/m68k-parse.y" +case 37: +#line 353 "./config/m68k-parse.y" { op->mode = PRE; op->reg = yyvsp[-5].reg; @@ -1130,8 +1143,8 @@ op->odisp = yyvsp[-1].exp; ; break;} -case 37: -#line 354 "./config/m68k-parse.y" +case 38: +#line 360 "./config/m68k-parse.y" { if (yyvsp[-5].reg == PC || yyvsp[-5].reg == ZPC) yyerror ("syntax error"); @@ -1144,8 +1157,8 @@ op->odisp = yyvsp[-1].exp; ; break;} -case 38: -#line 366 "./config/m68k-parse.y" +case 39: +#line 372 "./config/m68k-parse.y" { if (yyvsp[-5].reg == PC || yyvsp[-5].reg == ZPC) yyerror ("syntax error"); @@ -1157,8 +1170,8 @@ op->odisp = yyvsp[-1].exp; ; break;} -case 39: -#line 377 "./config/m68k-parse.y" +case 40: +#line 383 "./config/m68k-parse.y" { op->mode = PRE; op->reg = yyvsp[-3].reg; @@ -1167,8 +1180,8 @@ op->odisp = yyvsp[-1].exp; ; break;} -case 40: -#line 390 "./config/m68k-parse.y" +case 41: +#line 396 "./config/m68k-parse.y" { /* We use optzapc to avoid a shift/reduce conflict. */ if (yyvsp[-1].reg < ADDR0 || yyvsp[-1].reg > ADDR7) @@ -1177,8 +1190,8 @@ op->reg = yyvsp[-1].reg; ; break;} -case 41: -#line 398 "./config/m68k-parse.y" +case 42: +#line 404 "./config/m68k-parse.y" { /* We use optzapc to avoid a shift/reduce conflict. */ if (yyvsp[-2].reg < ADDR0 || yyvsp[-2].reg > ADDR7) @@ -1187,8 +1200,8 @@ op->reg = yyvsp[-2].reg; ; break;} -case 42: -#line 406 "./config/m68k-parse.y" +case 43: +#line 412 "./config/m68k-parse.y" { /* We use optzapc to avoid a shift/reduce conflict. */ if (yyvsp[-2].reg < ADDR0 || yyvsp[-2].reg > ADDR7) @@ -1197,8 +1210,8 @@ op->reg = yyvsp[-2].reg; ; break;} -case 43: -#line 414 "./config/m68k-parse.y" +case 44: +#line 420 "./config/m68k-parse.y" { op->reg = yyvsp[-4].reg; op->disp = yyvsp[-1].exp; @@ -1209,8 +1222,8 @@ op->mode = DISP; ; break;} -case 44: -#line 424 "./config/m68k-parse.y" +case 45: +#line 430 "./config/m68k-parse.y" { op->mode = BASE; op->reg = yyvsp[-5].reg; @@ -1218,8 +1231,8 @@ op->index = yyvsp[-1].indexreg; ; break;} -case 45: -#line 431 "./config/m68k-parse.y" +case 46: +#line 437 "./config/m68k-parse.y" { op->mode = POST; op->reg = yyvsp[-9].reg; @@ -1228,8 +1241,8 @@ op->odisp = yyvsp[-2].exp; ; break;} -case 46: -#line 439 "./config/m68k-parse.y" +case 47: +#line 445 "./config/m68k-parse.y" { op->mode = POST; op->reg = yyvsp[-8].reg; @@ -1237,8 +1250,8 @@ op->odisp = yyvsp[-1].exp; ; break;} -case 47: -#line 446 "./config/m68k-parse.y" +case 48: +#line 452 "./config/m68k-parse.y" { op->mode = PRE; op->reg = yyvsp[-9].reg; @@ -1247,122 +1260,122 @@ op->odisp = yyvsp[-1].exp; ; break;} -case 49: -#line 461 "./config/m68k-parse.y" +case 50: +#line 467 "./config/m68k-parse.y" { yyval.indexreg.reg = yyvsp[0].reg; yyval.indexreg.size = SIZE_UNSPEC; yyval.indexreg.scale = 1; ; break;} -case 51: -#line 475 "./config/m68k-parse.y" +case 52: +#line 481 "./config/m68k-parse.y" { yyval.indexreg.reg = yyvsp[0].reg; yyval.indexreg.size = SIZE_UNSPEC; yyval.indexreg.scale = 1; ; break;} -case 62: -#line 518 "./config/m68k-parse.y" +case 63: +#line 524 "./config/m68k-parse.y" { yyval.reg = ZADDR0; ; break;} -case 66: -#line 535 "./config/m68k-parse.y" +case 67: +#line 541 "./config/m68k-parse.y" { yyval.reg = ZADDR0; ; break;} -case 67: -#line 539 "./config/m68k-parse.y" +case 68: +#line 545 "./config/m68k-parse.y" { yyval.reg = yyvsp[0].reg; ; break;} -case 68: -#line 548 "./config/m68k-parse.y" +case 69: +#line 554 "./config/m68k-parse.y" { yyval.exp.exp.X_op = O_absent; yyval.exp.size = SIZE_UNSPEC; ; break;} -case 69: -#line 553 "./config/m68k-parse.y" +case 70: +#line 559 "./config/m68k-parse.y" { yyval.exp = yyvsp[0].exp; ; break;} -case 70: -#line 562 "./config/m68k-parse.y" +case 71: +#line 568 "./config/m68k-parse.y" { yyval.exp.exp.X_op = O_absent; yyval.exp.size = SIZE_UNSPEC; ; break;} -case 71: -#line 567 "./config/m68k-parse.y" +case 72: +#line 573 "./config/m68k-parse.y" { yyval.exp = yyvsp[-1].exp; ; break;} -case 73: -#line 577 "./config/m68k-parse.y" +case 74: +#line 583 "./config/m68k-parse.y" { yyval.mask = yyvsp[-2].mask | yyvsp[0].mask; ; break;} -case 74: -#line 581 "./config/m68k-parse.y" +case 75: +#line 587 "./config/m68k-parse.y" { yyval.mask = (1 << yyvsp[-2].onereg) | yyvsp[0].mask; ; break;} -case 75: -#line 593 "./config/m68k-parse.y" +case 76: +#line 599 "./config/m68k-parse.y" { yyval.mask = 1 << yyvsp[0].onereg; ; break;} -case 77: -#line 598 "./config/m68k-parse.y" +case 78: +#line 604 "./config/m68k-parse.y" { yyval.mask = yyvsp[-2].mask | yyvsp[0].mask; ; break;} -case 78: -#line 602 "./config/m68k-parse.y" +case 79: +#line 608 "./config/m68k-parse.y" { yyval.mask = (1 << yyvsp[-2].onereg) | yyvsp[0].mask; ; break;} -case 79: -#line 609 "./config/m68k-parse.y" +case 80: +#line 615 "./config/m68k-parse.y" { yyval.mask = (1 << (yyvsp[0].onereg + 1)) - 1 - ((1 << yyvsp[-2].onereg) - 1); ; break;} -case 80: -#line 616 "./config/m68k-parse.y" +case 81: +#line 622 "./config/m68k-parse.y" { yyval.onereg = yyvsp[0].reg - DATA0; ; break;} -case 81: -#line 620 "./config/m68k-parse.y" +case 82: +#line 626 "./config/m68k-parse.y" { yyval.onereg = yyvsp[0].reg - ADDR0 + 8; ; break;} -case 82: -#line 624 "./config/m68k-parse.y" +case 83: +#line 630 "./config/m68k-parse.y" { yyval.onereg = yyvsp[0].reg - FP0 + 16; ; break;} -case 83: -#line 628 "./config/m68k-parse.y" +case 84: +#line 634 "./config/m68k-parse.y" { if (yyvsp[0].reg == FPI) yyval.onereg = 24; @@ -1570,7 +1583,7 @@ yystate = yyn; goto yynewstate; } -#line 638 "./config/m68k-parse.y" +#line 644 "./config/m68k-parse.y" /* The string to parse is stored here, and modified by yylex. */ diff -urN binutils-2.7/gas/macro.c binutils-2.8/gas/macro.c --- binutils-2.7/gas/macro.c Thu Jul 4 12:13:06 1996 +++ binutils-2.8/gas/macro.c Wed Apr 30 12:53:37 1997 @@ -1,5 +1,5 @@ /* macro.c - macro support for gas and gasp - Copyright (C) 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1994, 95, 96, 1997 Free Software Foundation, Inc. Written by Steve and Judy Chamberlain of Cygnus Support, sac@cygnus.com @@ -513,17 +513,20 @@ } /* Define a new macro. Returns NULL on success, otherwise returns an - error message. */ + error message. If NAMEP is not NULL, *NAMEP is set to the name of + the macro which was defined. */ const char * -define_macro (idx, in, label, get_line) +define_macro (idx, in, label, get_line, namep) int idx; sb *in; sb *label; int (*get_line) PARAMS ((sb *)); + const char **namep; { macro_entry *macro; sb name; + const char *namestr; macro = (macro_entry *) xmalloc (sizeof (macro_entry)); sb_new (¯o->sub); @@ -562,10 +565,14 @@ for (idx = 0; idx < name.len; idx++) if (isupper (name.ptr[idx])) name.ptr[idx] = tolower (name.ptr[idx]); - hash_jam (macro_hash, sb_terminate (&name), (PTR) macro); + namestr = sb_terminate (&name); + hash_jam (macro_hash, namestr, (PTR) macro); macro_defined = 1; + if (namep != NULL) + *namep = namestr; + return NULL; } @@ -657,12 +664,17 @@ if (in->ptr[src] == '&') { sb_reset (&t); - if (macro_mri && src + 1 < in->len && in->ptr[src + 1] == '&') + if (macro_mri) { - src = sub_actual (src + 2, in, &t, formal_hash, '\'', out, 1); + if (src + 1 < in->len && in->ptr[src + 1] == '&') + src = sub_actual (src + 2, in, &t, formal_hash, '\'', out, 1); + else + sb_add_char (out, in->ptr[src++]); } else { + /* FIXME: Why do we do this? It prevents people from + using the & operator in a macro. */ src = sub_actual (src + 1, in, &t, formal_hash, '&', out, 0); } } diff -urN binutils-2.7/gas/macro.h binutils-2.8/gas/macro.h --- binutils-2.7/gas/macro.h Thu Jul 4 12:13:06 1996 +++ binutils-2.8/gas/macro.h Wed Apr 30 12:53:38 1997 @@ -38,7 +38,8 @@ PARAMS ((int alternate, int mri, int strip_at, int (*) PARAMS ((const char *, int, sb *, int *)))); extern const char *define_macro - PARAMS ((int idx, sb *in, sb *label, int (*get_line) PARAMS ((sb *)))); + PARAMS ((int idx, sb *in, sb *label, int (*get_line) PARAMS ((sb *)), + const char **namep)); extern int check_macro PARAMS ((const char *, sb *, int, const char **)); extern void delete_macro PARAMS ((const char *)); extern const char *expand_irp diff -urN binutils-2.7/gas/make-gas.com binutils-2.8/gas/make-gas.com --- binutils-2.7/gas/make-gas.com Mon Jul 15 12:22:56 1996 +++ binutils-2.8/gas/make-gas.com Wed Apr 30 12:53:38 1997 @@ -55,9 +55,9 @@ $! $ set verify $! -$ gcc 'c_flags'/Define=('C_DEFS') targ-cpu.c -$ gcc 'c_flags'/Define=('C_DEFS') obj-format.c -$ gcc 'c_flags'/Define=('C_DEFS') atof-targ.c +$ gcc 'c_flags'/Define=('C_DEFS') tc-sparc.c +$ gcc 'c_flags'/Define=('C_DEFS') obj-aout.c +$ gcc 'c_flags'/Define=('C_DEFS') atof-ieee.c $ gcc 'c_flags'/Define=('C_DEFS') app.c $ gcc 'c_flags'/Define=('C_DEFS') as.c $ gcc 'c_flags'/Define=('C_DEFS') atof-generic.c @@ -90,9 +90,9 @@ ! ! Linker options file for GNU assembler ! -targ-cpu.obj,- -obj-format.obj,- -atof-targ.obj,- +tc-sparc.obj,- +obj-aout.obj,- +atof-ieee.obj,- app.obj,- as.obj,- atof-generic.obj,- diff -urN binutils-2.7/gas/makefile.vms binutils-2.8/gas/makefile.vms --- binutils-2.7/gas/makefile.vms Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/makefile.vms Wed Apr 30 12:53:38 1997 @@ -0,0 +1,75 @@ +# +# makefile for gas +# +# Created by Klaus K"ampf, kkaempf@progis.de +# + +ifeq ($(CC),gcc) +DEFS= +CFLAGS=/include=([],[-.bfd],[.config],[-.include],[-])$(DEFS) +LFLAGS= +LIBS=,GNU:[000000]libgcc/lib,sys$$library:vaxcrtl.olb/lib,GNU:[000000]crt0.obj +else +DEFS=/define=("table_size_of_flonum_powers_of_ten"="tabsiz_flonum_powers_of_ten",\ +"_bfd_generic_get_section_contents_in_window"="_bfd_generic_get_win_section_cont",\ +"_elf_section_from_bfd_section"="_bfd_elf_sec_from_bfd_sec","const=") +CFLAGS=/noopt/debug/include=([],[-.bfd],[.config],[-.include],[-])$(DEFS)\ +/warnings=disable=(missingreturn,implicitfunc,ptrmismatch,undefescap,longextern,duptypespec) +LFLAGS= +LIBS= +endif + +OBJS=targ-cpu.obj,obj-format.obj,atof-targ.obj,app.obj,as.obj,atof-generic.obj,\ + bignum-copy.obj,cond.obj,expr.obj,flonum-konst.obj,flonum-copy.obj,\ + flonum-mult.obj,frags.obj,hash.obj,input-file.obj,input-scrub.obj,\ + literal.obj,messages.obj,output-file.obj,read.obj,subsegs.obj,symbols.obj,\ + write.obj,listing.obj,ecoff.obj,stabs.obj,sb.obj,macro.obj + +GASPOBJS = gasp.obj,macro.obj,sb.obj,hash.obj + +LIBIBERTY = [-.libiberty]libiberty.olb +LIBBFD = [-.bfd]libbfd.olb +LIBOPCODES = [-.opcodes]libopcodes.olb + +all: config.status [-.bfd]bfd.h as.exe gasp.exe + +as.exe: $(OBJS) $(LIBOPCODES) $(LIBBFD) $(LIBIBERTY) + link$(LFLAGS)/exe=$@ $(OBJS),$(LIBOPCODES)/lib,$(LIBBFD)/lib,$(LIBIBERTY)/lib$(LIBS) + +gasp.exe: $(GASPOBJS) $(LIBBFD) $(LIBIBERTY) + link$(LFLAGS)/exe=$@ $(GASPOBJS),$(LIBBFD)/lib,$(LIBIBERTY)/lib$(LIBS) + +config.status: + $$ @config-gas + +targ-cpu.c: [.config]tc-alpha.c + copy $< $@ +targ-cpu.h: [.config]tc-alpha.h + copy $< $@ +targ-env.h: [.config]te-generic.h + copy $< $@ +obj-format.h: [.config]obj-evax.h + copy $< $@ +obj-format.c: [.config]obj-evax.c + copy $< $@ +atof-targ.c: [.config]atof-ieee.c + copy $< $@ + +targ-cpu.obj: targ-cpu.c targ-cpu.h [.config]atof-vax.c + +[-.bfd]bfd.h: + $(CD) [-.bfd] + gmake -f makefile.vms + $(CD) [-.gas] + +clean: + $$ purge + $(RM) *.obj; + $(RM) *.exe; + $(RM) atof-targ.c; + $(RM) obj-format.c; + $(RM) obj-format.h; + $(RM) targ-env.h; + $(RM) targ-cpu.h; + $(RM) targ-cpu.c; + $(RM) config.status; diff -urN binutils-2.7/gas/messages.c binutils-2.8/gas/messages.c --- binutils-2.7/gas/messages.c Thu Jul 4 12:13:07 1996 +++ binutils-2.8/gas/messages.c Wed Apr 30 12:53:38 1997 @@ -1,6 +1,6 @@ /* messages.c - error reporter - - Copyright (C) 1987, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - + Copyright (C) 1987, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. GAS is free software; you can redistribute it and/or modify @@ -19,7 +19,6 @@ 02111-1307, USA. */ #include "as.h" -#include "libiberty.h" #include #ifdef HAVE_ERRNO_H @@ -43,8 +42,7 @@ #define va_end(ARGS) #endif -extern char *xstrerror PARAMS ((int)); /* from libiberty */ - +static void identify PARAMS ((char *)); static void as_show_where PARAMS ((void)); static void as_warn_internal PARAMS ((char *, unsigned int, char *)); static void as_bad_internal PARAMS ((char *, unsigned int, char *)); diff -urN binutils-2.7/gas/mpw-config.in binutils-2.8/gas/mpw-config.in --- binutils-2.7/gas/mpw-config.in Thu Jul 4 12:34:43 1996 +++ binutils-2.8/gas/mpw-config.in Wed Apr 30 12:53:38 1997 @@ -34,19 +34,25 @@ Set bfd_gas yes Set em macos -Else If "{target_canonical}" =~ /i386-unknown-go32/ +Else If "{target_canonical}" =~ /i386-\Option-x-go32/ Set obj_format "coff" Set TDEFINES '-d I386COFF' -Else If "{target_canonical}" =~ /m68k-unknown-coff/ +Else If "{target_canonical}" =~ /m68k-\Option-x-coff/ Set TDEFINES '-d M68KCOFF' Else If "{target_canonical}" =~ /mips-idt-ecoff/ Set bfd_gas yes - Set TDEFINES '-d TARGET_BYTES_BIG_ENDIAN' + Set TDEFINES '-d TARGET_BYTES_BIG_ENDIAN=1' +Else If "{target_canonical}" =~ /mips-\Option-x-\Option-x/ + # Assume other OSes etc use ELF + Set obj_format "elf" + Set bfd_gas yes + Set TDEFINES '-d TARGET_BYTES_BIG_ENDIAN=1' + forward-include "{srcroot}"bfd:elf-bfd.h 'bfd/elf-bfd.h' -Else If "{target_canonical}" =~ /sh-hitachi-hms/ +Else If "{target_canonical}" =~ /sh-\Option-x-hms/ Set obj_format "coff" forward-include "{srcroot}"opcodes:sh-opc.h 'opcodes/sh-opc.h' End If diff -urN binutils-2.7/gas/mpw-make.sed binutils-2.8/gas/mpw-make.sed --- binutils-2.7/gas/mpw-make.sed Thu Jul 4 12:13:07 1996 +++ binutils-2.8/gas/mpw-make.sed Wed Apr 30 12:53:38 1997 @@ -88,13 +88,7 @@ install \\Option-f all install-only\ \ install-only \\Option-f\ - If "`Exists "{prefix}"`" == ""\ - Echo "{prefix}" does not exist, cannot install anything\ - Exit 1\ - End If\ - If "`Exists "{bindir}"`" == ""\ - NewFolder "{bindir}"\ - End If\ + NewFolderRecursive "{bindir}"\ Duplicate -y :as.new "{bindir}"as\ Duplicate -y :gasp.new "{bindir}"gasp\ diff -urN binutils-2.7/gas/obj.h binutils-2.8/gas/obj.h --- binutils-2.7/gas/obj.h Thu Jul 4 12:13:07 1996 +++ binutils-2.8/gas/obj.h Wed Apr 30 12:53:38 1997 @@ -50,6 +50,7 @@ unsigned emit_section_symbols : 1; void (*frob_symbol) PARAMS ((symbolS *, int *)); void (*frob_file) PARAMS ((void)); + void (*frob_file_after_relocs) PARAMS ((void)); bfd_vma (*s_get_size) PARAMS ((symbolS *)); void (*s_set_size) PARAMS ((symbolS *, bfd_vma)); bfd_vma (*s_get_align) PARAMS ((symbolS *)); @@ -68,6 +69,7 @@ extern const struct format_ops elf_format_ops; extern const struct format_ops ecoff_format_ops; +extern const struct format_ops coff_format_ops; #ifndef this_format COMMON const struct format_ops *this_format; diff -urN binutils-2.7/gas/read.c binutils-2.8/gas/read.c --- binutils-2.7/gas/read.c Thu Jul 4 12:13:09 1996 +++ binutils-2.8/gas/read.c Wed Apr 30 12:53:39 1997 @@ -1,5 +1,5 @@ /* read.c - read a source file - - Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GAS; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +along with GAS; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ #if 0 #define MASK_CHAR (0xFF) /* If your chars aren't 8 bits, you will @@ -44,7 +45,6 @@ #include "subsegs.h" #include "sb.h" #include "macro.h" -#include "libiberty.h" #include "obstack.h" #include "listing.h" #include "ecoff.h" @@ -96,6 +96,11 @@ #define LEX_DOLLAR 3 #endif +#ifndef LEX_TILDE +/* The Delta 68k assembler permits ~ at start of label names. */ +#define LEX_TILDE 0 +#endif + /* used by is_... macros. our ctype[] */ char lex_type[256] = { @@ -106,7 +111,7 @@ LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 3, /* PQRSTUVWXYZ[\]^_ */ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 0, /* pqrstuvwxyz{|}~. */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, LEX_TILDE, 0, /* pqrstuvwxyz{|}~. */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -154,17 +159,9 @@ static char *buffer; /* 1st char of each buffer of lines is here. */ static char *buffer_limit; /*->1 + last char in buffer. */ -#ifdef TARGET_BYTES_BIG_ENDIAN -/* Hack to deal with tc-*.h defining TARGET_BYTES_BIG_ENDIAN to empty - instead of to 0 or 1. */ -#if 5 - TARGET_BYTES_BIG_ENDIAN - 5 == 10 -#undef TARGET_BYTES_BIG_ENDIAN -#define TARGET_BYTES_BIG_ENDIAN 1 -#endif +/* TARGET_BYTES_BIG_ENDIAN is required to be defined to either 0 or 1 in the + tc-.h file. See the "Porting GAS" section of the internals manual. */ int target_big_endian = TARGET_BYTES_BIG_ENDIAN; -#else -int target_big_endian /* = 0 */; -#endif static char *old_buffer; /* JF a hack */ static char *old_input; @@ -202,8 +199,10 @@ may be needed. */ static int mri_pending_align; +static void cons_worker PARAMS ((int, int)); static int scrub_from_string PARAMS ((char **)); -static void do_align PARAMS ((int, char *, int)); +static void do_align PARAMS ((int, char *, int, int)); +static void s_align PARAMS ((int, int)); static int hex_float PARAMS ((int, char *)); static void do_org PARAMS ((segT, expressionS *, int)); char *demand_copy_string PARAMS ((int *lenP)); @@ -291,6 +290,7 @@ {"endif", s_endif, 0}, /* endef */ {"equ", s_set, 0}, + {"equiv", s_set, 1}, {"err", s_err, 0}, {"exitm", s_mexit, 0}, /* extend */ @@ -527,13 +527,16 @@ { char *line_start = input_line_pointer; char c; + int mri_line_macro; + LISTING_NEWLINE (); HANDLE_CONDITIONAL_ASSEMBLY (); c = get_symbol_end (); - /* In MRI mode, the EQU pseudoop must be - handled specially. */ + /* In MRI mode, the EQU and MACRO pseudoops must + be handled specially. */ + mri_line_macro = 0; if (flag_m68k_mri) { char *rest = input_line_pointer + 1; @@ -547,12 +550,27 @@ && (rest[3] == ' ' || rest[3] == '\t')) { input_line_pointer = rest + 3; - equals (line_start); + equals (line_start, + strncasecmp (rest, "SET", 3) == 0); continue; } + if (strncasecmp (rest, "MACRO", 5) == 0 + && (rest[5] == ' ' + || rest[5] == '\t' + || is_end_of_line[(unsigned char) rest[5]])) + mri_line_macro = 1; } - line_label = colon (line_start); + /* In MRI mode, we need to handle the MACRO + pseudo-op specially: we don't want to put the + symbol in the symbol table. */ + if (! mri_line_macro) + line_label = colon (line_start); + else + line_label = symbol_create (line_start, + absolute_section, + (valueT) 0, + &zero_address_frag); *input_line_pointer = c; if (c == ':') @@ -619,7 +637,7 @@ && (rest[3] == ' ' || rest[3] == '\t')) { input_line_pointer = rest + 3; - equals (s); + equals (s, 1); continue; } } @@ -632,13 +650,14 @@ } else if (c == '=' - || (input_line_pointer[1] == '=' + || ((c == ' ' || c == '\t') + && input_line_pointer[1] == '=' #ifdef TC_EQUAL_IN_INSN && ! TC_EQUAL_IN_INSN (c, input_line_pointer) #endif )) { - equals (s); + equals (s, 1); demand_empty_rest_of_line (); } else @@ -693,10 +712,26 @@ || ! ((pop->poc_handler == cons && pop->poc_val == 1) || (pop->poc_handler == s_space - && pop->poc_val == 1)))) + && pop->poc_val == 1) +#ifdef tc_conditional_pseudoop + || tc_conditional_pseudoop (pop) +#endif + || pop->poc_handler == s_if + || pop->poc_handler == s_ifdef + || pop->poc_handler == s_ifc + || pop->poc_handler == s_ifeqs + || pop->poc_handler == s_else + || pop->poc_handler == s_endif + || pop->poc_handler == s_globl + || pop->poc_handler == s_ignore))) { - do_align (1, (char *) NULL, 0); + do_align (1, (char *) NULL, 0, 0); mri_pending_align = 0; + if (line_label != NULL) + { + line_label->sy_frag = frag_now; + S_SET_VALUE (line_label, frag_now_fix ()); + } } /* Print the error msg now, while we still can */ @@ -727,15 +762,9 @@ goto quit; } else - { /* machine instruction */ + { int inquote = 0; - if (mri_pending_align) - { - do_align (1, (char *) NULL, 0); - mri_pending_align = 0; - } - /* WARNING: c has char, which may be end-of-line. */ /* Also: input_line_pointer->`\0` where c was. */ *input_line_pointer = c; @@ -789,6 +818,17 @@ } } + if (mri_pending_align) + { + do_align (1, (char *) NULL, 0, 0); + mri_pending_align = 0; + if (line_label != NULL) + { + line_label->sy_frag = frag_now; + S_SET_VALUE (line_label, frag_now_fix ()); + } + } + md_assemble (s); /* Assemble 1 instruction. */ *input_line_pointer++ = c; @@ -975,6 +1015,10 @@ } /* while (more buffers to scan) */ quit: + +#ifdef md_cleanup + md_cleanup(); +#endif input_scrub_close (); /* Close the input file */ } @@ -1045,40 +1089,43 @@ as_fatal (".abort detected. Abandoning ship."); } -/* Guts of .align directive. */ +/* Guts of .align directive. N is the power of two to which to align. + FILL may be NULL, or it may point to the bytes of the fill pattern. + LEN is the length of whatever FILL points to, if anything. MAX is + the maximum number of characters to skip when doing the alignment, + or 0 if there is no maximum. */ + static void -do_align (n, fill, len) +do_align (n, fill, len, max) int n; char *fill; int len; + int max; { + char default_fill; + #ifdef md_do_align - md_do_align (n, fill, len, just_record_alignment); + md_do_align (n, fill, len, max, just_record_alignment); #endif - if (!fill) - { - /* @@ Fix this right for BFD! */ - static char zero; - static char nop_opcode = NOP_OPCODE; + if (fill == NULL) + { + /* FIXME: Fix this right for BFD! */ if (now_seg != data_section && now_seg != bss_section) - { - fill = &nop_opcode; - } + default_fill = NOP_OPCODE; else - { - fill = &zero; - } + default_fill = 0; + fill = &default_fill; len = 1; } /* Only make a frag if we HAVE to. . . */ - if (n && !need_pass_2) + if (n != 0 && !need_pass_2) { if (len <= 1) - frag_align (n, *fill); + frag_align (n, *fill, max); else - frag_align_pattern (n, fill, len); + frag_align_pattern (n, fill, len, max); } #ifdef md_do_align @@ -1088,17 +1135,22 @@ record_alignment (now_seg, n); } -/* For machines where ".align 4" means align to a 4 byte boundary. */ -void -s_align_bytes (arg) +/* Handle the .align pseudo-op. A positive ARG is a default alignment + (in bytes). A negative ARG is the negative of the length of the + fill pattern. BYTES_P is non-zero if the alignment value should be + interpreted as the byte boundary, rather than the power of 2. */ + +static void +s_align (arg, bytes_p) int arg; + int bytes_p; { - register unsigned int temp; - char temp_fill; - unsigned int i = 0; - unsigned long max_alignment = 1 << 15; + register unsigned int align; char *stop = NULL; char stopc; + offsetT fill = 0; + int max; + int fill_p; if (flag_mri) stop = mri_comment_field (&stopc); @@ -1106,122 +1158,94 @@ if (is_end_of_line[(unsigned char) *input_line_pointer]) { if (arg < 0) - temp = 0; + align = 0; else - temp = arg; /* Default value from pseudo-op table */ + align = arg; /* Default value from pseudo-op table */ } else - temp = get_absolute_expression (); - - if (temp > max_alignment) { - as_bad ("Alignment too large: %d. assumed.", temp = max_alignment); + align = get_absolute_expression (); + SKIP_WHITESPACE (); } - /* For the sparc, `.align (1<>= 1, ++i) - ; + /* Convert to a power of 2. */ + if (align != 0) + { + unsigned int i; + + for (i = 0; (align & 1) == 0; align >>= 1, ++i) + ; + if (align != 1) + as_bad ("Alignment not a power of 2"); + align = i; + } } - if (temp != 1) - as_bad ("Alignment not a power of 2"); - temp = i; - if (*input_line_pointer == ',') + if (align > 15) { - offsetT fillval; - int len; + align = 15; + as_bad ("Alignment too large: %u assumed", align); + } - input_line_pointer++; - fillval = get_absolute_expression (); - if (arg >= 0) - len = 1; + if (*input_line_pointer != ',') + { + fill_p = 0; + max = 0; + } + else + { + ++input_line_pointer; + if (*input_line_pointer == ',') + fill_p = 0; else - len = - arg; - if (len <= 1) { - temp_fill = fillval; - do_align (temp, &temp_fill, len); + fill = get_absolute_expression (); + SKIP_WHITESPACE (); + fill_p = 1; } + + if (*input_line_pointer != ',') + max = 0; else { - char ab[16]; - - if (len > sizeof ab) - abort (); - md_number_to_chars (ab, fillval, len); - do_align (temp, ab, len); + ++input_line_pointer; + max = get_absolute_expression (); } } - else + + if (! fill_p) { if (arg < 0) as_warn ("expected fill pattern missing"); - do_align (temp, (char *) NULL, 0); + do_align (align, (char *) NULL, 0, max); } - - if (flag_mri) - mri_comment_end (stop, stopc); - - demand_empty_rest_of_line (); -} - -/* For machines where ".align 4" means align to 2**4 boundary. */ -void -s_align_ptwo (arg) - int arg; -{ - register int temp; - char temp_fill; - long max_alignment = 15; - char *stop = NULL; - char stopc; - - if (flag_mri) - stop = mri_comment_field (&stopc); - - temp = get_absolute_expression (); - if (temp > max_alignment) - as_bad ("Alignment too large: %d. assumed.", temp = max_alignment); - else if (temp < 0) - { - as_bad ("Alignment negative. 0 assumed."); - temp = 0; - } - if (*input_line_pointer == ',') + else { - offsetT fillval; - int len; + int fill_len; - input_line_pointer++; - fillval = get_absolute_expression (); if (arg >= 0) - len = 1; + fill_len = 1; else - len = - arg; - if (len <= 1) + fill_len = - arg; + if (fill_len <= 1) { - temp_fill = fillval; - do_align (temp, &temp_fill, len); + char fill_char; + + fill_char = fill; + do_align (align, &fill_char, fill_len, max); } else { char ab[16]; - if (len > sizeof ab) + if (fill_len > sizeof ab) abort (); - md_number_to_chars (ab, fillval, len); - do_align (temp, ab, len); + md_number_to_chars (ab, fill, fill_len); + do_align (align, ab, fill_len, max); } } - else - { - if (arg < 0) - as_warn ("expected fill pattern missing"); - do_align (temp, (char *) NULL, 0); - } if (flag_mri) mri_comment_end (stop, stopc); @@ -1229,6 +1253,26 @@ demand_empty_rest_of_line (); } +/* Handle the .align pseudo-op on machines where ".align 4" means + align to a 4 byte boundary. */ + +void +s_align_bytes (arg) + int arg; +{ + s_align (arg, 1); +} + +/* Handle the .align pseud-op on machines where ".align 4" means align + to a 2**4 boundary. */ + +void +s_align_ptwo (arg) + int arg; +{ + s_align (arg, 0); +} + void s_comm (ignore) int ignore; @@ -1270,7 +1314,7 @@ *p = 0; symbolP = symbol_find_or_make (name); *p = c; - if (S_IS_DEFINED (symbolP)) + if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) { as_bad ("Ignoring attempt to re-define symbol `%s'.", S_GET_NAME (symbolP)); @@ -1369,17 +1413,12 @@ align = get_absolute_expression (); } - if (S_IS_DEFINED (sym)) + if (S_IS_DEFINED (sym) && ! S_IS_COMMON (sym)) { -#if defined (S_IS_COMMON) || defined (BFD_ASSEMBLER) - if (! S_IS_COMMON (sym)) -#endif - { - as_bad ("attempt to re-define symbol `%s'", S_GET_NAME (sym)); - mri_comment_end (stop, stopc); - ignore_rest_of_line (); - return; - } + as_bad ("attempt to re-define symbol `%s'", S_GET_NAME (sym)); + mri_comment_end (stop, stopc); + ignore_rest_of_line (); + return; } S_SET_EXTERNAL (sym); @@ -1604,7 +1643,9 @@ if (temp_size && !need_pass_2) { - p = frag_var (rs_fill, (int) temp_size, (int) temp_size, (relax_substateT) 0, (symbolS *) 0, temp_repeat, (char *) 0); + p = frag_var (rs_fill, (int) temp_size, (int) temp_size, + (relax_substateT) 0, (symbolS *) 0, (offsetT) temp_repeat, + (char *) 0); memset (p, 0, (unsigned int) temp_size); /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX * flavoured AS. The following bizzare behaviour is to be @@ -1842,6 +1883,11 @@ else align = 0; +#ifdef OBJ_EVAX + /* FIXME: This needs to be done in a more general fashion. */ + align = 3; +#endif + record_alignment(bss_seg, align); } @@ -1878,7 +1924,7 @@ else { /* Assume some objects may require alignment on some systems. */ -#ifdef TC_ALPHA +#if defined (TC_ALPHA) && ! defined (VMS) if (temp > 1) { align = ffs (temp) - 1; @@ -1905,14 +1951,14 @@ subseg_set (bss_seg, 1); if (align) - frag_align (align, 0); + frag_align (align, 0, 0); /* detach from old frag */ if (S_GET_SEGMENT (symbolP) == bss_seg) symbolP->sy_frag->fr_symbol = NULL; symbolP->sy_frag = frag_now; pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP, - temp, (char *)0); + (offsetT) temp, (char *) 0); *pfrag = 0; S_SET_SEGMENT (symbolP, bss_seg); @@ -2008,6 +2054,8 @@ get_line_sb (line) sb *line; { + char quote1, quote2, inquote; + if (input_line_pointer[-1] == '\n') bump_line_counters (); @@ -2018,10 +2066,36 @@ return 0; } - while (! is_end_of_line[(unsigned char) *input_line_pointer]) - sb_add_char (line, *input_line_pointer++); - while (input_line_pointer < buffer_limit - && is_end_of_line[(unsigned char) *input_line_pointer]) + /* If app.c sets any other characters to LEX_IS_STRINGQUOTE, this + code needs to be changed. */ + if (! flag_m68k_mri) + quote1 = '"'; + else + quote1 = '\0'; + + quote2 = '\0'; + if (flag_m68k_mri) + quote2 = '\''; +#ifdef LEX_IS_STRINGQUOTE + quote2 = '\''; +#endif + + inquote = '\0'; + while (! is_end_of_line[(unsigned char) *input_line_pointer] + || (inquote != '\0' && *input_line_pointer != '\n')) + { + if (inquote == *input_line_pointer) + inquote = '\0'; + else if (inquote == '\0') + { + if (*input_line_pointer == quote1) + inquote = quote1; + else if (*input_line_pointer == quote2) + inquote = quote2; + } + sb_add_char (line, *input_line_pointer++); + } + while (input_line_pointer < buffer_limit && *input_line_pointer == '\n') { if (input_line_pointer[-1] == '\n') bump_line_counters (); @@ -2042,6 +2116,7 @@ sb s; sb label; const char *err; + const char *name; as_where (&file, &line); @@ -2053,7 +2128,7 @@ if (line_label != NULL) sb_add_string (&label, S_GET_NAME (line_label)); - err = define_macro (0, &s, &label, get_line_sb); + err = define_macro (0, &s, &label, get_line_sb, &name); if (err != NULL) as_bad_where (file, line, "%s", err); else @@ -2064,6 +2139,18 @@ S_SET_VALUE (line_label, 0); line_label->sy_frag = &zero_address_frag; } + + if (((flag_m68k_mri +#ifdef NO_PSEUDO_DOT + || 1 +#endif + ) + && hash_find (po_hash, name) != NULL) + || (! flag_m68k_mri + && *name == '.' + && hash_find (po_hash, name + 1) != NULL)) + as_warn ("attempt to redefine pseudo-op `%s' ignored", + name); } sb_kill (&s); @@ -2430,9 +2517,13 @@ buffer_limit = input_scrub_next_buffer (&input_line_pointer); } +/* Handle the .equ, .equiv and .set directives. If EQUIV is 1, then + this is .equiv, and it is an error if the symbol is already + defined. */ + void -s_set (ignore) - int ignore; +s_set (equiv) + int equiv; { register char *name; register char delim; @@ -2491,6 +2582,12 @@ symbol_table_insert (symbolP); *end_name = delim; + + if (equiv + && S_IS_DEFINED (symbolP) + && S_GET_SEGMENT (symbolP) != reg_section) + as_bad ("symbol `%s' already defined", S_GET_NAME (symbolP)); + pseudo_set (symbolP); demand_empty_rest_of_line (); } /* s_set() */ @@ -2504,6 +2601,7 @@ char *p = 0; char *stop = NULL; char stopc; + int bytes; #ifdef md_flush_pending_output md_flush_pending_output (); @@ -2512,6 +2610,45 @@ if (flag_mri) stop = mri_comment_field (&stopc); + /* In m68k MRI mode, we need to align to a word boundary, unless + this is ds.b. */ + if (flag_m68k_mri && mult > 1) + { + if (now_seg == absolute_section) + { + abs_section_offset += abs_section_offset & 1; + if (line_label != NULL) + S_SET_VALUE (line_label, abs_section_offset); + } + else if (mri_common_symbol != NULL) + { + valueT val; + + val = S_GET_VALUE (mri_common_symbol); + if ((val & 1) != 0) + { + S_SET_VALUE (mri_common_symbol, val + 1); + if (line_label != NULL) + { + know (line_label->sy_value.X_op == O_symbol); + know (line_label->sy_value.X_add_symbol == mri_common_symbol); + line_label->sy_value.X_add_number += 1; + } + } + } + else + { + do_align (1, (char *) NULL, 0, 0); + if (line_label != NULL) + { + line_label->sy_frag = frag_now; + S_SET_VALUE (line_label, frag_now_fix ()); + } + } + } + + bytes = mult; + expression (&exp); SKIP_WHITESPACE (); @@ -2539,6 +2676,7 @@ if (mult == 0) mult = 1; + bytes = mult * exp.X_add_number; for (i = 0; i < exp.X_add_number; i++) emit_expr (&val, mult); } @@ -2552,6 +2690,7 @@ repeat = exp.X_add_number; if (mult) repeat *= mult; + bytes = repeat; if (repeat <= 0) { if (! flag_mri || repeat < 0) @@ -2579,7 +2718,7 @@ if (!need_pass_2) p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0, - repeat, (char *) 0); + (offsetT) repeat, (char *) 0); } else { @@ -2595,7 +2734,7 @@ } if (!need_pass_2) p = frag_var (rs_space, 1, 1, (relax_substateT) 0, - make_expr_symbol (&exp), 0L, (char *) 0); + make_expr_symbol (&exp), (offsetT) 0, (char *) 0); } if (p) @@ -2603,6 +2742,13 @@ } getout: + + /* In MRI mode, after an odd number of bytes, we must align to an + even word boundary, unless the next instruction is a dc.b, ds.b + or dcb.b. */ + if (flag_mri && (bytes & 1) != 0) + mri_pending_align = 1; + if (flag_mri) mri_comment_end (stop, stopc); @@ -3114,14 +3260,25 @@ register valueT get; register valueT use; register valueT mask; + valueT hibit; register valueT unmask; /* JF << of >= number of bits in the object is undefined. In particular SPARC (Sun 4) has problems */ if (nbytes >= sizeof (valueT)) - mask = 0; + { + mask = 0; + if (nbytes > sizeof (valueT)) + hibit = 0; + else + hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1); + } else - mask = ~(valueT) 0 << (BITS_PER_CHAR * nbytes); /* Don't store these bits. */ + { + /* Don't store these bits. */ + mask = ~(valueT) 0 << (BITS_PER_CHAR * nbytes); + hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1); + } unmask = ~mask; /* Do store these bits. */ @@ -3132,7 +3289,9 @@ get = exp->X_add_number; use = get & unmask; - if ((get & mask) != 0 && (get & mask) != mask) + if ((get & mask) != 0 + && ((get & mask) != mask + || (get & hibit) == 0)) { /* Leading bits contain both 0s & 1s. */ as_warn ("Value 0x%lx truncated to 0x%lx.", (unsigned long) get, (unsigned long) use); @@ -3209,11 +3368,31 @@ #ifdef TC_CONS_FIX_NEW TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp); #else - fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0, - /* @@ Should look at CPU word size. */ - nbytes == 2 ? BFD_RELOC_16 - : nbytes == 8 ? BFD_RELOC_64 - : BFD_RELOC_32); + { + bfd_reloc_code_real_type r; + + switch (nbytes) + { + case 1: + r = BFD_RELOC_8; + break; + case 2: + r = BFD_RELOC_16; + break; + case 4: + r = BFD_RELOC_32; + break; + case 8: + r = BFD_RELOC_64; + break; + default: + as_bad ("unsupported BFD relocation size %u", nbytes); + r = BFD_RELOC_32; + break; + } + fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, + 0, r); + } #endif #else #ifdef TC_CONS_FIX_NEW @@ -3594,6 +3773,10 @@ return; } +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + do { /* input_line_pointer->1st char of a flonum (we hope!). */ @@ -4022,8 +4205,9 @@ } /* is_it_end_of_statement() */ void -equals (sym_name) +equals (sym_name, reassign) char *sym_name; + int reassign; { register symbolS *symbolP; /* symbol we are working with */ char *stop; @@ -4052,6 +4236,11 @@ else { symbolP = symbol_find_or_make (sym_name); + /* Permit register names to be redefined. */ + if (! reassign + && S_IS_DEFINED (symbolP) + && S_GET_SEGMENT (symbolP) != reg_section) + as_bad ("symbol `%s' already defined", S_GET_NAME (symbolP)); pseudo_set (symbolP); } diff -urN binutils-2.7/gas/read.h binutils-2.8/gas/read.h --- binutils-2.7/gas/read.h Thu Jul 4 12:13:09 1996 +++ binutils-2.8/gas/read.h Wed Apr 30 12:53:39 1997 @@ -95,7 +95,7 @@ extern void cons PARAMS ((int nbytes)); extern void demand_empty_rest_of_line PARAMS ((void)); extern void emit_expr PARAMS ((expressionS *exp, unsigned int nbytes)); -extern void equals PARAMS ((char *sym_name)); +extern void equals PARAMS ((char *sym_name, int reassign)); extern void float_cons PARAMS ((int float_type)); extern void ignore_rest_of_line PARAMS ((void)); extern void pseudo_set PARAMS ((symbolS * symbolP)); diff -urN binutils-2.7/gas/stabs.c binutils-2.8/gas/stabs.c --- binutils-2.7/gas/stabs.c Thu Jul 4 12:13:12 1996 +++ binutils-2.8/gas/stabs.c Wed Apr 30 12:53:40 1997 @@ -1,5 +1,6 @@ /* Generic stabs parsing for gas. - Copyright (C) 1989, 90, 91, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1989, 90, 91, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -19,7 +20,6 @@ 02111-1307, USA. */ #include "as.h" -#include "libiberty.h" #include "obstack.h" #include "subsegs.h" #include "ecoff.h" @@ -29,6 +29,8 @@ #include "aout/stab_gnu.h" +static void s_stab_generic PARAMS ((int, char *, char *)); + /* Allow backends to override the names used for the stab sections. */ #ifndef STAB_SECTION_NAME #define STAB_SECTION_NAME ".stab" @@ -117,6 +119,8 @@ #ifndef OBJ_PROCESS_STAB #define OBJ_PROCESS_STAB(SEG,W,S,T,O,D) aout_process_stab(W,S,T,O,D) #endif + +static void aout_process_stab PARAMS ((int, const char *, int, int, int)); static void aout_process_stab (what, string, type, other, desc) diff -urN binutils-2.7/gas/subsegs.c binutils-2.8/gas/subsegs.c --- binutils-2.7/gas/subsegs.c Thu Jul 4 12:13:15 1996 +++ binutils-2.8/gas/subsegs.c Wed Apr 30 12:53:40 1997 @@ -1,5 +1,5 @@ /* subsegs.c - subsegments - - Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -280,7 +280,6 @@ /* * This should be the only code that creates a frchainS. */ - extern fragS *frag_alloc (); newP = (frchainS *) obstack_alloc (&frchains, sizeof (frchainS)); newP->frch_subseg = subseg; newP->frch_seg = seg; diff -urN binutils-2.7/gas/symbols.c binutils-2.8/gas/symbols.c --- binutils-2.7/gas/symbols.c Fri Jul 5 11:24:24 1996 +++ binutils-2.8/gas/symbols.c Wed Apr 30 12:53:40 1997 @@ -1,5 +1,5 @@ /* symbols.c -symbol table- - Copyright (C) 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996 + Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* #define DEBUG_SYMS / * to debug symbol list maintenance */ @@ -52,6 +53,8 @@ struct obstack notes; static void fb_label_init PARAMS ((void)); +static long dollar_label_instance PARAMS ((long)); +static long fb_label_instance PARAMS ((long)); /* symbol_new() @@ -84,7 +87,6 @@ } #endif symbol_append (symbolP, symbol_lastP, &symbol_rootP, &symbol_lastP); - debug_verify_symchain (symbol_rootP, symbol_lastP); return symbolP; } @@ -173,8 +175,19 @@ /* Sun local labels go out of scope whenever a non-local symbol is defined. */ - if (LOCAL_LABELS_DOLLAR && ! LOCAL_LABEL (sym_name)) - dollar_label_clear (); + if (LOCAL_LABELS_DOLLAR) + { + int local; + +#ifdef BFD_ASSEMBLER + local = bfd_is_local_label_name (stdoutput, sym_name); +#else + local = LOCAL_LABEL (sym_name); +#endif + + if (! local) + dollar_label_clear (); + } #ifndef WORKING_DOT_WORD if (new_broken_words) @@ -195,7 +208,7 @@ possible_bytes, (relax_substateT) 0, (symbolS *) broken_words, - 0L, + (offsetT) 0, NULL); /* We want to store the pointer to where to insert the jump table in the @@ -223,7 +236,7 @@ /* * Now check for undefined symbols */ - if (!S_IS_DEFINED (symbolP)) + if (!S_IS_DEFINED (symbolP) || S_IS_COMMON (symbolP)) { if (S_GET_VALUE (symbolP) == 0) { @@ -252,7 +265,7 @@ */ if (((!S_IS_DEBUG (symbolP) - && !S_IS_DEFINED (symbolP) + && (!S_IS_DEFINED (symbolP) || S_IS_COMMON (symbolP)) && S_IS_EXTERNAL (symbolP)) || S_GET_SEGMENT (symbolP) == bss_section) && (now_seg == data_section @@ -340,6 +353,9 @@ #ifdef tc_frob_label tc_frob_label (symbolP); #endif +#ifdef obj_frob_label + obj_frob_label (symbolP); +#endif return symbolP; } @@ -479,6 +495,10 @@ { know (*rootPP == NULL); know (*lastPP == NULL); + addme->sy_next = NULL; +#ifdef SYMBOLS_NEED_BACKPOINTERS + addme->sy_previous = NULL; +#endif *rootPP = addme; *lastPP = addme; return; @@ -502,6 +522,8 @@ #ifdef SYMBOLS_NEED_BACKPOINTERS addme->sy_previous = target; #endif /* SYMBOLS_NEED_BACKPOINTERS */ + + debug_verify_symchain (symbol_rootP, symbol_lastP); } /* Set the chain pointers of SYMBOL to null. */ @@ -586,7 +608,7 @@ for (; symbol_next (symbolP) != NULL; symbolP = symbol_next (symbolP)) { #ifdef SYMBOLS_NEED_BACKPOINTERS - know (symbolP->sy_next->sy_previous == symbolP); + assert (symbolP->sy_next->sy_previous == symbolP); #else /* Walk the list anyways, to make sure pointers are still good. */ ; @@ -639,7 +661,35 @@ symp->sy_resolving = 1; - reduce: + /* Simplify addition or subtraction of a constant by folding the + constant into X_add_number. */ + if (symp->sy_value.X_op == O_add + || symp->sy_value.X_op == O_subtract) + { + resolve_symbol_value (symp->sy_value.X_add_symbol); + resolve_symbol_value (symp->sy_value.X_op_symbol); + if (S_GET_SEGMENT (symp->sy_value.X_op_symbol) == absolute_section) + { + right = S_GET_VALUE (symp->sy_value.X_op_symbol); + if (symp->sy_value.X_op == O_add) + symp->sy_value.X_add_number += right; + else + symp->sy_value.X_add_number -= right; + symp->sy_value.X_op = O_symbol; + symp->sy_value.X_op_symbol = NULL; + } + else if ((S_GET_SEGMENT (symp->sy_value.X_add_symbol) + == absolute_section) + && symp->sy_value.X_op == O_add) + { + left = S_GET_VALUE (symp->sy_value.X_add_symbol); + symp->sy_value.X_add_symbol = symp->sy_value.X_op_symbol; + symp->sy_value.X_add_number += left; + symp->sy_value.X_op = O_symbol; + symp->sy_value.X_op_symbol = NULL; + } + } + switch (symp->sy_value.X_op) { case O_absent: @@ -668,22 +718,30 @@ if (symp->sy_value.X_add_number == 0) copy_symbol_attributes (symp, symp->sy_value.X_add_symbol); - S_SET_VALUE (symp, - (symp->sy_value.X_add_number - + symp->sy_frag->fr_address - + S_GET_VALUE (symp->sy_value.X_add_symbol))); - if (S_GET_SEGMENT (symp) == expr_section - || S_GET_SEGMENT (symp) == undefined_section) - S_SET_SEGMENT (symp, - S_GET_SEGMENT (symp->sy_value.X_add_symbol)); - /* If we have equated this symbol to an undefined symbol, we - keep X_op set to O_symbol. This permits the routine - which writes out relocation to detect this case, and - convert the relocation to be against the symbol to which - this symbol is equated. */ - if (! S_IS_DEFINED (symp) || S_IS_COMMON (symp)) - symp->sy_value.X_op = O_symbol; + keep X_op set to O_symbol, and we don't change + X_add_number. This permits the routine which writes out + relocation to detect this case, and convert the + relocation to be against the symbol to which this symbol + is equated. */ + if (! S_IS_DEFINED (symp->sy_value.X_add_symbol) + || S_IS_COMMON (symp->sy_value.X_add_symbol)) + { + symp->sy_value.X_op = O_symbol; + S_SET_SEGMENT (symp, + S_GET_SEGMENT (symp->sy_value.X_add_symbol)); + } + else + { + S_SET_VALUE (symp, + (symp->sy_value.X_add_number + + symp->sy_frag->fr_address + + S_GET_VALUE (symp->sy_value.X_add_symbol))); + if (S_GET_SEGMENT (symp) == expr_section + || S_GET_SEGMENT (symp) == undefined_section) + S_SET_SEGMENT (symp, + S_GET_SEGMENT (symp->sy_value.X_add_symbol)); + } resolved = symp->sy_value.X_add_symbol->sy_resolved; break; @@ -708,39 +766,6 @@ resolved = symp->sy_value.X_add_symbol->sy_resolved; break; - case O_add: - resolve_symbol_value (symp->sy_value.X_add_symbol); - resolve_symbol_value (symp->sy_value.X_op_symbol); - seg_left = S_GET_SEGMENT (symp->sy_value.X_add_symbol); - seg_right = S_GET_SEGMENT (symp->sy_value.X_op_symbol); - /* This case comes up with PIC support. */ - { - symbolS *s_left = symp->sy_value.X_add_symbol; - symbolS *s_right = symp->sy_value.X_op_symbol; - - if (seg_left == absolute_section) - { - symbolS *t; - segT ts; - t = s_left; - s_left = s_right; - s_right = t; - ts = seg_left; - seg_left = seg_right; - seg_right = ts; - } - if (seg_right == absolute_section - && s_right->sy_resolved) - { - symp->sy_value.X_add_number += S_GET_VALUE (s_right); - symp->sy_value.X_op_symbol = 0; - symp->sy_value.X_add_symbol = s_left; - symp->sy_value.X_op = O_symbol; - goto reduce; - } - } - /* fall through */ - case O_multiply: case O_divide: case O_modulus: @@ -750,6 +775,7 @@ case O_bit_or_not: case O_bit_exclusive_or: case O_bit_and: + case O_add: case O_subtract: case O_eq: case O_ne: @@ -763,38 +789,54 @@ resolve_symbol_value (symp->sy_value.X_op_symbol); seg_left = S_GET_SEGMENT (symp->sy_value.X_add_symbol); seg_right = S_GET_SEGMENT (symp->sy_value.X_op_symbol); - if (seg_left != seg_right - && seg_left != undefined_section - && seg_right != undefined_section) - { - char *file; - unsigned int line; + left = S_GET_VALUE (symp->sy_value.X_add_symbol); + right = S_GET_VALUE (symp->sy_value.X_op_symbol); - if (expr_symbol_where (symp, &file, &line)) - as_bad_where - (file, line, - "illegal operation on symbols in different sections"); - else - as_bad - ("%s set to illegal operation on symbols in different sections", - S_GET_NAME (symp)); - } - if ((S_GET_SEGMENT (symp->sy_value.X_add_symbol) - != absolute_section) - && symp->sy_value.X_op != O_subtract) + /* Subtraction is permitted if both operands are in the same + section. Otherwise, both operands must be absolute. We + already handled the case of addition or subtraction of a + constant above. This will probably need to be changed + for an object file format which supports arbitrary + expressions, such as IEEE-695. */ + if ((seg_left != absolute_section + || seg_right != absolute_section) + && (symp->sy_value.X_op != O_subtract + || seg_left != seg_right)) { char *file; unsigned int line; if (expr_symbol_where (symp, &file, &line)) - as_bad_where (file, line, - "illegal operation on non-absolute symbols"); + { + if (seg_left == undefined_section) + as_bad_where (file, line, + "undefined symbol %s in operation", + S_GET_NAME (symp->sy_value.X_add_symbol)); + if (seg_right == undefined_section) + as_bad_where (file, line, + "undefined symbol %s in operation", + S_GET_NAME (symp->sy_value.X_op_symbol)); + if (seg_left != undefined_section + && seg_right != undefined_section) + as_bad_where (file, line, "invalid section for operation"); + } else - as_bad ("%s set to illegal operation on non-absolute symbols", - S_GET_NAME (symp)); + { + if (seg_left == undefined_section) + as_bad ("undefined symbol %s in operation setting %s", + S_GET_NAME (symp->sy_value.X_add_symbol), + S_GET_NAME (symp)); + if (seg_right == undefined_section) + as_bad ("undefined symbol %s in operation setting %s", + S_GET_NAME (symp->sy_value.X_op_symbol), + S_GET_NAME (symp)); + if (seg_left != undefined_section + && seg_right != undefined_section) + as_bad ("invalid section for operation setting %s", + S_GET_NAME (symp)); + } } - left = S_GET_VALUE (symp->sy_value.X_add_symbol); - right = S_GET_VALUE (symp->sy_value.X_op_symbol); + switch (symp->sy_value.X_op) { case O_multiply: val = left * right; break; @@ -880,7 +922,7 @@ return 0; } /* dollar_label_defined() */ -static int +static long dollar_label_instance (label) long label; { @@ -1331,7 +1373,7 @@ && (strchr (name, '\001') || strchr (name, '\002') || (! flag_keep_locals - && (LOCAL_LABEL (name) + && (bfd_is_local_label (stdoutput, s->bsym) || (flag_mri && name[0] == '?' && name[1] == '?'))))); @@ -1379,7 +1421,7 @@ { if ((s->bsym->flags & BSF_WEAK) != 0) { - as_bad ("%s already declared as weak", S_GET_NAME (s)); + /* Let .weak override .global. */ return; } s->bsym->flags |= BSF_GLOBAL; @@ -1392,7 +1434,7 @@ { if ((s->bsym->flags & BSF_WEAK) != 0) { - as_bad ("%s already declared as weak", S_GET_NAME (s)); + /* Let .weak override. */ return; } s->bsym->flags |= BSF_LOCAL; @@ -1403,11 +1445,6 @@ S_SET_WEAK (s) symbolS *s; { - if ((s->bsym->flags & BSF_GLOBAL) != 0) - { - as_bad ("%s already declared as global", S_GET_NAME (s)); - return; - } s->bsym->flags |= BSF_WEAK; s->bsym->flags &= ~(BSF_GLOBAL|BSF_LOCAL); } @@ -1456,9 +1493,6 @@ } #endif - -void print_expr_1 PARAMS ((FILE *, expressionS *)); -void print_symbol_value_1 PARAMS ((FILE *, symbolS *)); void print_symbol_value_1 (file, sym) diff -urN binutils-2.7/gas/symbols.h binutils-2.8/gas/symbols.h --- binutils-2.7/gas/symbols.h Thu Jul 4 12:13:18 1996 +++ binutils-2.8/gas/symbols.h Wed Apr 30 12:53:40 1997 @@ -1,5 +1,5 @@ /* symbols.h - - Copyright (C) 1987, 1990, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1987, 90, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ extern struct obstack notes; /* eg FixS live here. */ @@ -48,6 +49,11 @@ void symbol_print_statistics PARAMS ((FILE *)); void symbol_table_insert PARAMS ((symbolS * symbolP)); void resolve_symbol_value PARAMS ((symbolS *)); + +void print_symbol_value PARAMS ((symbolS *)); +void print_expr PARAMS ((expressionS *)); +void print_expr_1 PARAMS ((FILE *, expressionS *)); +void print_symbol_value_1 PARAMS ((FILE *, symbolS *)); int dollar_label_defined PARAMS ((long l)); void dollar_label_clear PARAMS ((void)); diff -urN binutils-2.7/gas/testsuite/ChangeLog binutils-2.8/gas/testsuite/ChangeLog --- binutils-2.7/gas/testsuite/ChangeLog Thu Jul 4 14:29:00 1996 +++ binutils-2.8/gas/testsuite/ChangeLog Wed Apr 30 12:53:44 1997 @@ -1,10 +1,397 @@ +Sat Apr 19 23:16:35 1997 Niklas Hallqvist + + * gas/mips/mips.exp: Handle OpenBSD like NetBSD. + +Mon Apr 7 12:57:45 1997 Doug Evans + + * gas/m32r/allinsn.d: Update to new objdump output style. + +Fri Apr 4 18:16:44 1997 Doug Evans + + * gas/m32r/allinsn.{exp,d,s}: New files. + +Fri Apr 4 13:19:39 1997 Ian Lance Taylor + + * gas/all/float.s: Put a tab before .text, to keep the PA happy. + + * gas/arm/arm.exp: Only run inst and arm7t on targets which can + handle -EL. Add setup_xfail for thumb. + + * gas/h8300/ffxx1.d: Don't fail if BFD is 64 bits. + +Sat Mar 15 17:21:46 1997 Ian Lance Taylor + + * gas/arm/inst.d: Update for disassembler changes. + * gas/arm/arm7t.d: Likewise. + +Tue Mar 11 13:31:56 1997 Andreas Schwab + + * gas/m68k/op68000.d: Update for recent assembler bug fix. + +Wed Mar 5 13:01:24 1997 Jeffrey A Law (law@cygnus.com) + + * gas/all/gas.exp: xfail a couple tests for the mn10300. + +Tue Feb 25 13:45:55 1997 Ian Lance Taylor + + * gas/macros/semi.s: Force the final alignment to use a fill value + of 0. + + * gas/all/cond.s, gas/all/cond.d: New test. + * gas/all/gas.exp: Run it. + +Mon Feb 24 10:52:12 1997 Bob Manson + + * lib/gas-defs.exp(gas_init): Added new parameter for script + name. + +Sun Feb 23 17:54:00 1997 Dawn Perchik + + * gas/all/itbl-test.c(main): Update function calls. + Remove parameters from itbl_get_reg_val and + change itbl_get_insn_name to itbl_get_field. + +Sun Feb 23 17:22:00 1997 Dawn Perchik + + * gas/mips/itbl: Add comments. + * gas/mips/itbl.s: Add comments. Prefix register names with $. + * gas/all/itbl: Generic table for testing for itbl support. + * gas/all/itbl.s: Generic assembly for testing for itbl support. + * gas/mips/itbl-test.c: Moved to gas/all. + * gas/all/itbl-test.c: Moved from gas/mips. + +Wed Feb 19 00:55:29 1997 Ian Lance Taylor + + * gas/macros/semi.s, gas/macros/semi.d: New test. + * gas/macros/macros.exp: Run it. + * gas/mri/semi.s, gas/mri/semi.d: New test. + * gas/mri/mri.exp: Run it. + +Tue Feb 18 13:37:06 1997 Jeffrey A Law (law@cygnus.com) + + * gas/hppa/unsorted/unsorted.exp (align4 tests): Tweak expected + output. + +Fri Feb 14 17:56:27 1997 Ian Lance Taylor + + * gas/all/align.d, gas/all/align.s: New test. + * gas/all/gas.exp: Run it. + +Thu Feb 13 14:44:05 1997 Ian Lance Taylor + + * gas/mips/mips16.d: Correct PC relative instruction bytes. + +Wed Feb 12 12:33:08 1997 Ian Lance Taylor + + * gas/mips/lif-svr4pic.d: Pass -EB when running the assembler. + * gas/mips/lif-xgot.d: Likewise. + * gas/mips/ulh-svr4pic.d: Likewise. + * gas/mips/ulh-xgot.d: Likewise. + + * gas/mips/mips16.d: Update for yet another change in disassembly + output (this one is spacing only). + +Tue Feb 11 15:46:27 1997 Ian Lance Taylor + + * gas/mips/mips16.d: Update for change in disassembly output. + +Mon Feb 10 22:24:00 1997 Dawn Perchik + + * gas/mips/itbl-test.c: Add copyright message and fix indentation. + +Mon Feb 10 17:54:00 1997 Dawn Perchik + + * gas/mips/itbl-test.c: New file. Stand-alone assembler and + dissassembler for itbl support. + +Mon Feb 10 17:20:00 1997 Dawn Perchik + + * gas/mips/itbl: New file. Instruction Spec for testing --itbl + option. + * gas/mips/itbl.s: New file. Assembly with ne2w instructions + specified in itbl. + +Fri Feb 7 16:42:53 1997 Bob Manson + + * gasp/gasp.exp: Use prune_warnings instead of prune_system_crud. + * lib/gas-defs.exp: Ditto. + +Mon Feb 3 15:46:05 1997 Ian Lance Taylor + + * gas/arm/inst.d, gas/arm/arm7t.d: Pass --prefix-addresses to + objdump. Update for current relocation printing style. + +Thu Jan 30 11:57:33 1997 Ian Lance Taylor + + * gas/mips/mips16.d: Update for disassembler changes. + +Thu Jan 23 03:15:06 1997 Angela Marie Thomas (angela@cygnus.com) + + * gas/mips/mips.exp: set ilocks for all 4100/4300 + +Thu Jan 2 16:49:17 1997 Ian Lance Taylor + + * gas/mips/mips16.s, gas/mips/mips16.d: New test. + * gas/mips/mips.exp: Run mips16 test. + + * gas/mips/mips.exp: Run dli test unconditionally. + * gas/mips/dli.s: Add text symbol. Add nops to round to 16 byte + boundary. + * gas/mips/dli.d: Corresponding changes. + +Tue Dec 31 13:03:16 1996 Ian Lance Taylor + + * gas/sparc/synth.d: Use --prefix-addresses for objdump. + * gas/sparc/synth64.d: Likewise. + +Tue Dec 24 16:30:58 1996 Angela Marie Thomas (angela@cygnus.com) + + * gas/mips/*-ilocks.d: Fix regexps to resemble disassembled output. + +Fri Dec 13 13:05:33 1996 Ian Lance Taylor + + * gas/mips/*.[sd]: Add explicit nops, sometimes controlled by + .ifdef, to accomodate change to avoid default alignment on + embedded systems. + +Wed Dec 11 09:26:01 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10200/basic.exp (do_movb): Fix bit pattern for + "movb dm,(an)". + +Tue Dec 10 13:01:05 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/basic.exp: Update after endianness changes to + the assembler. + + * gas/mn10200/{mov1.s,mov2.s,mov3.s,mov4.s,movx.s}: New tests. + * gas/mn10200/{movb.s, movbu.s}: Likewise. + * gas/mn10200/basic.exp: Run them. + +Mon Dec 9 17:08:38 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10200/*.s: New tests for the mn10200 assembler. + * gas/mn10200/basic.exp: Run them. + +Fri Dec 6 15:35:04 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/*.s: Remove '$' register prefixing. + +Mon Nov 25 16:35:33 1996 Doug Evans + + * gas/sparc-solaris/addend.exp: Fix patterns, you can't assume + \r will be present. + +Mon Nov 25 13:45:02 1996 Ian Lance Taylor + + * gas/m68k/*.d: Update for disassembler changes. + * gas/mri/*.d: Likewise. + +Mon Nov 25 11:38:37 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/*.s: Use '$' as register prefix for + all register operands. + +Thu Nov 21 11:52:54 1996 Jeffrey A Law (law@cygnus.com) + + * gas/all/gas.exp: xfail a couple tests for the mn10300. + +Wed Nov 20 11:31:41 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/other.s: Update for correct syntax on a + few instructions (those with register lists). + * gas/mn10300/basic.exp: Corresponding changes. + +Tue Nov 19 13:36:57 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/movm.s: Update for correct syntax. + * gas/mn10300/basic.exp: Update expected movm bit patterns. + +Fri Nov 15 13:57:42 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/other.s: Put parens around register + argument in calls and jmp instructions. + +Wed Nov 13 13:16:04 1996 Jeffrey A Law (law@cygnus.com) + + * gas/h8300/ffxx1.d: Update for recent disassembler changes. + +Mon Nov 11 16:03:24 1996 Jeffrey A Law (law@cygnus.com) + + * gas/hppa/reloc/reloc.exp: Pass "--prefix-addresses" to objdump + as needed. + * gas/hppa/unsorted/unsorted.exp: Likewise. + +Thu Nov 7 00:27:52 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/basic.exp: Check opcode insertion for + extended instructions. + * gas/mn10300/extend.s: Tweak constants for better + testsuite coverage. + +Wed Nov 6 13:50:07 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/basic.exp: Test insertion of operands + into call and jmp instructions with 32bit offsets. + Fix typo in bit test patterns. + * gas/mn10300/other.s: Tweak constants to improve + testsuite coverage. + + * gas/mn10300/basic.exp: Test insertion of 32bit operand + in calls, btst, bclr & bset instructions. + + * gas/mn10300/*.s: Tweak constants in 32bit insns for + better testing coverage. + * gas/mn10300/basic.exp: Test insertion of most 32bit + operands. + +Tue Nov 5 13:33:12 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/basic.exp: Check bit patterns for indexed mov, + movbu, movhu instructions. Check bit patterns for more bit + operations. Check bit patterns for various 16bit call, retf + and ret instructions. + * gas/mn10300/other.s: Update operands for better test coverage. + +Mon Nov 4 12:55:11 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/basic.exp: Check bit patterns for a couple more + mov and cmp instructions. + +Tue Oct 29 17:05:43 1996 Ian Lance Taylor + + * gas/mips/*.d: Update for disassembler changes. + +Mon Oct 14 13:52:55 1996 Ian Lance Taylor + + * gas/mips: Add symbols to several testsuites, since the ELF + assembler now always builds a symbol table, which means that + objdump will no longer report `No symbols in FILE'. Change the + expected output accordingly. + +Thu Oct 10 13:11:48 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/basic.exp: Check bit patterns for instructions + with a single 8bit or 16bit immediate operand. + + * gas/mn10300/basic.exp: Check bit patterns for many + instructions. Add missing test in do_mov1. + * gas/mn10300/mov1.s: Add missing test. + +Wed Oct 9 14:15:18 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10300/{add.s, bcc.s, bit.s, cmp.s, ext.s}: New tests. + * gas/mn10300/{extend.s logical.s, loop.s, mov1.s}: Likewise. + * gas/mn10300/{mov2.s, mov3.s, mov4.s, movbu.s}: Likewise. + * gas/mn10300/{movhu.s, movm.s, muldiv.s, other.s}: Likewise. + * gas/mn10300/{shift.s, sub.s}: Likewise. + * gas/mn10300/basic.exp: Run them. + +Thu Oct 3 09:57:03 1996 Jeffrey A Law (law@cygnus.com) + + * gas/mn10200, gas/mn10300: New directories for Matsushita + mn10200 and mn10300 tests. + +Tue Oct 1 15:38:28 1996 Ian Lance Taylor + + * lib/gas-defs.exp (gas_version): Fix for current version + printing. + +Sun Sep 29 07:55:58 1996 Doug Evans + + * gas/sparc/splet.d: Fix typo in cpusha result. + +Mon Sep 23 12:33:31 1996 Ian Lance Taylor + + * gas/m68k/fmoveml.s, gas/m68k/fmoveml.d: Add tests for fmovemx. + +Wed Sep 18 12:14:06 1996 Ian Lance Taylor + + * gas/all/cofftag.s: Use .p2align rather than .align. + +Fri Sep 13 15:28:04 1996 Jeffrey A Law (law@cygnus.com) + + * gas/h8300/macs.s: Add "stmac" instructions. + * gas/h8300/basic.exp: Test them. + +Thu Sep 12 10:28:44 1996 James G. Smith + + * gas/arm/thumb.s (back): Check assembly of Thumb BL. + +Mon Sep 9 14:37:00 1996 Ian Lance Taylor + + * gas/mips/mips4.s, gas/mips/mips4.d: Use $fccN for condition code + registers. + +Fri Sep 6 18:23:54 1996 James G. Smith + + * gas/mips/dli.{s,d}: More test cases added. + +Wed Sep 4 11:47:29 1996 James G. Smith + + * gas/mips/mips.exp: Add check for dli macro instruction. + * gas/mips/dli.{s,d}: Added. + +Thu Aug 29 11:32:23 1996 James G. Smith + + * gas/arm/arm7t.d: Explicitly force little-endian assembly. + +Fri Aug 16 00:19:10 1996 Jeffrey A Law (law@cygnus.com) + + * gas/hppa/basic/purge.s: Use "%sr4" on pitlb, pitlbe + fic and fice instructions to test 3bit space identifiers. + * gas/hppa/basic/system.s: Similarly for iitlba and + iitlbp. + * gas/hppa/basic/basic.exp: Corresponding changes. + +Thu Aug 15 16:25:05 1996 James G. Smith + + * gas/arm/arm.exp: Change inst.s test to check objdump. + * gas/arm/inst.d: Added. + +Thu Aug 15 16:06:02 1996 James G. Smith + + * gas/arm/thumb.s: Added. + * gas/arm/immed.s: Added. + * gas/arm/arch4t.s: Added. + * gas/arm/arm.exp: Updated to run the new tests. + +Tue Aug 6 11:06:29 1996 Jeffrey A Law (law@cygnus.com) + + * gas/h8300/misch.s: Reenable "eepmov.w" test. + * gas/h8300/miscs.s: Likewise. + * gas/h8300/h8300.exp: Check for correct assembly of "eepmov.w" + on the H8/300H and H8/S. Don't expect it to fail. + +Wed Jul 31 10:57:44 1996 Doug Evans + + * gas/sparc/asi.s: Update ASI_AS_IF_USER_{PRIMARY,SECONDARY}_LITTLE. + +Wed Jul 31 15:55:12 1996 James G. Smith + + * gas/arm/arm7t.s: Added. + * gas/arm/arm7t.d: Added. + * gas/arm/arm.exp: Updated to run the new test. + +Mon Jul 8 14:27:39 1996 Ian Lance Taylor + + * gas/m68k/pcrel.d: Rename from schwab.d. + * gas/m68k/pcrel.s: Rename from schwab.s. + +Mon Jul 8 14:23:26 1996 Andreas Schwab + + * gas/m68k/schwab.d: Correct for ELF format. + * gas/m68k/all.exp: Run "schwab" test for all targets. + Thu Jul 4 14:23:36 1996 Ian Lance Taylor Avoid DOS file naming problems: * gas/h8300/branch.s: Rename from branches.s. * gas/h8300/branchh.s: Rename from branchesh.s. + * gas/h8300/branchs.s: Rename from branchess.s. * gas/h8300/rotsh.s: Rename from rotshift.s. * gas/h8300/rotshh.s: Rename from rotshifth.s. + * gas/h8300/rotshs.s: Rename from rotshifts.s. * gas/h8300/h8300.exp: Corresponding changes. Thu Jul 4 14:01:46 1996 James G. Smith @@ -31,6 +418,15 @@ * gas/h8300/cbranchh.s: Switch into h8300h mode. * gas/h8300/h8300.exp (H8/300H misc tests): Fix test names. + + * gas/h8300/{addsubs.s,bitops1s.s,bitops2s.s}: New tests for the + H8/S. + * gas/h8300/{bitops3.s,bitops4.s,cbranchs.s,logicals.s}: Likewise. + * gas/h8300/{branchess.s,compares.s,macs.s,decimals.s}: Likewise. + * gas/h8300/{incdecs.s,divmuls.s,miscs.s,multiples.s}: Likewise. + * gas/h8300/{movbs.s,movws.s,movls.s,pushpops.s}: Likewise. + * gas/h8300/{rotshifts.s,extends.s}: Likewise. + * gas/h8300/h8300.exp: Run them. Mon Jun 10 14:14:40 1996 Ian Lance Taylor diff -urN binutils-2.7/gas/testsuite/gas/all/align.d binutils-2.8/gas/testsuite/gas/all/align.d --- binutils-2.7/gas/testsuite/gas/all/align.d Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/all/align.d Wed Apr 30 12:53:47 1997 @@ -0,0 +1,12 @@ +#objdump: -s -j .text +#name: align + +# Test the alignment pseudo-op. + +.*: .* + +Contents of section .text: + 0000 ff00ff01 ff020202 ffff0303 04040404 ................ + 0010 ffffffff 05050505 ff090a0a 0a0a0a0a ................ + 0020 ff00ff01 ff020202 ffff0303 04040404 ................ + 0030 ffffffff 05050505 ff090a0a 0a0a0a0a ................ diff -urN binutils-2.7/gas/testsuite/gas/all/align.s binutils-2.8/gas/testsuite/gas/all/align.s --- binutils-2.7/gas/testsuite/gas/all/align.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/all/align.s Wed Apr 30 12:53:47 1997 @@ -0,0 +1,61 @@ +/* Test the alignment pseudo-ops. */ + .text + + .byte 0xff + .p2align 1,0 + + .byte 0xff + .p2align 1,1 + + .byte 0xff + .p2align 2,2 + + .byte 0xff + .byte 0xff + .p2alignw 2,0x0303 + + .p2align 3,4 + .byte 0xff + .byte 0xff + .byte 0xff + .byte 0xff + .p2alignl 3,0x05050505 + + .p2align 1,6 + .p2align 1,7 + + .byte 0xff + .p2align 3,8,5 + .byte 9 + .p2align 3,0xa + + .byte 0xff + .balign 2,0 + + .byte 0xff + .balign 2,1 + + .byte 0xff + .balign 4,2 + + .byte 0xff + .byte 0xff + .balignw 4,0x0303 + + .balign 8,4 + .byte 0xff + .byte 0xff + .byte 0xff + .byte 0xff + .balignl 8,0x05050505 + + .balign 2,6 + .balign 2,7 + + .byte 0xff + .balign 8,8,5 + .byte 9 + .balign 8,0xa + + .p2align 5 + .balign 32 diff -urN binutils-2.7/gas/testsuite/gas/all/cofftag.s binutils-2.8/gas/testsuite/gas/all/cofftag.s --- binutils-2.7/gas/testsuite/gas/all/cofftag.s Thu Jul 4 12:15:12 1996 +++ binutils-2.8/gas/testsuite/gas/all/cofftag.s Wed Apr 30 12:53:48 1997 @@ -39,7 +39,7 @@ .endef .globl _what .data - .align 2 + .p2align 2 _what: .long 0 .text diff -urN binutils-2.7/gas/testsuite/gas/all/cond.d binutils-2.8/gas/testsuite/gas/all/cond.d --- binutils-2.7/gas/testsuite/gas/all/cond.d Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/all/cond.d Wed Apr 30 12:53:48 1997 @@ -0,0 +1,20 @@ +# This should match the output of gas -alc cond.s. + +.*cond.s.* + + + 1[ ]+.if 0 + 8[ ]+.else + 9[ ]+.if 1 + 10[ ]+.endc + 11 0000 0[02]00 ?000[02][ ]+.long[ ]+2 + 12[ ]+.if 0 + 14[ ]+.else + 15 0004 0[04]00 ?000[04][ ]+.long[ ]+4 + 16[ ]+.endc + 17[ ]+.endc + 18 0008 0000 ?0000[ ]+.p2align 5,0 + 18[ ]+0000 ?0000 + 18[ ]+0000 ?0000 + 18[ ]+0000 ?0000 + 18[ ]+0000 ?0000 diff -urN binutils-2.7/gas/testsuite/gas/all/cond.s binutils-2.8/gas/testsuite/gas/all/cond.s --- binutils-2.7/gas/testsuite/gas/all/cond.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/all/cond.s Wed Apr 30 12:53:48 1997 @@ -0,0 +1,18 @@ + .if 0 + .if 1 + .endc + .long 0 + .if 0 + .long 1 + .endc + .else + .if 1 + .endc + .long 2 + .if 0 + .long 3 + .else + .long 4 + .endc + .endc + .p2align 5,0 diff -urN binutils-2.7/gas/testsuite/gas/all/float.s binutils-2.8/gas/testsuite/gas/all/float.s --- binutils-2.7/gas/testsuite/gas/all/float.s Thu Jul 4 12:15:12 1996 +++ binutils-2.8/gas/testsuite/gas/all/float.s Wed Apr 30 12:53:49 1997 @@ -1,4 +1,4 @@ -.text + .text foo: .single 0r1.2345e+06 .single 0f3.14159 .double 0r2.718282 diff -urN binutils-2.7/gas/testsuite/gas/all/gas.exp binutils-2.8/gas/testsuite/gas/all/gas.exp --- binutils-2.7/gas/testsuite/gas/all/gas.exp Thu Jul 4 12:15:12 1996 +++ binutils-2.8/gas/testsuite/gas/all/gas.exp Wed Apr 30 12:53:49 1997 @@ -23,6 +23,8 @@ # This test is meaningless for the PA; the difference of two undefined # symbols is something that is (and must be) supported on the PA. if ![istarget hppa*-*-*] then { + setup_xfail "mn10300*-*-*" + setup_xfail "mn10200*-*-*" gas_test_error "diff1.s" "" "difference of two undefined symbols" } @@ -83,11 +85,14 @@ # the vax fails because VMS can apparently actually handle this # case in relocs, so gas doesn't handle it itself. setup_xfail "vax*-*-vms*" + setup_xfail "mn10300*-*-*" + setup_xfail "mn10200*-*-*" do_930509a } if ![istarget hppa*-*-*] then { run_dump_test struct + run_dump_test align } # This test is for any COFF target. @@ -106,6 +111,28 @@ || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } { run_dump_test cofftag } + +# Test omitting conditionals from listings. +proc test_cond {} { + global comp_output + global srcdir + global subdir + + set testname "conditional listings" + gas_run cond.s -alc ">dump.out" + if ![string match "" $comp_output] { + send_log "$comp_output\n" + fail $testname + } else { + if { [regexp_diff dump.out $srcdir/$subdir/cond.d] } { + fail $testname + } else { + pass $testname + } + } +} + +test_cond # FIXME: this is here cause of a bug in DejaGnu 1.1.1. When it is no longer # in use, then this can be removed. diff -urN binutils-2.7/gas/testsuite/gas/all/itbl binutils-2.8/gas/testsuite/gas/all/itbl --- binutils-2.7/gas/testsuite/gas/all/itbl Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/all/itbl Wed Apr 30 12:53:49 1997 @@ -0,0 +1,20 @@ + + ; Test case for assembler option "itbl". + ; Run as "as --itbl itbl itbl.s" + ; or with stand-alone test case "itbl-test itbl itbl.s". + ; The "p" represent processors of a multi-processor system. + + p1 dreg d1 1 ; data register "d1" for COP1 has value 1 + p1 creg c3 3 ; ctrl register "c3" for COP1 has value 3 + p3 insn fie 0x1e:24-20 ; function "fill" for COP3 has value 31 + p3 dreg d3 3 ; data register "d3" for COP3 has value 3 + p3 creg c2 22 ; control register "c2" for COP3 has value 22 + p3 insn fee 0x1e:24-20,dreg:17-13,creg:12-8,immed:7-0 + + p3 dreg d3 3 ; data register "d3" for COP3 has value 3 + p3 creg c2 22 ; control register "c2" for COP3 has value 22 + p3 insn fum 0x01e00001 dreg:17-13 creg:12-8 + p3 insn foh 0xf:24-21 dreg:20-16 immed:15-0 + + p3 insn pig 0x1:24-21*[0x100|0x2], dreg:20-16, immed:15-0*0x10000 + diff -urN binutils-2.7/gas/testsuite/gas/all/itbl-test.c binutils-2.8/gas/testsuite/gas/all/itbl-test.c --- binutils-2.7/gas/testsuite/gas/all/itbl-test.c Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/all/itbl-test.c Wed Apr 30 12:53:47 1997 @@ -0,0 +1,129 @@ + + +/* itbl-test.c + + Copyright (C) 1997 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* Stand-alone test for instruction specification table support. + Run using "itbl-test " + where is the name of the instruction table, + and is the name of the assembler fie. */ + + +#include +#include +#include +#include "itbl-ops.h" + +static int test_reg (e_processor processor, e_type type, char *name, + unsigned long val); + +int +main (int argc, char **argv) +{ + unsigned int insn; + FILE *fas; + int aline = 0; + char s[81], *name; + + if (argc < 3) + { + printf ("usage: %s itbl asm.s\n", argv[0]); + exit (0); + } + if (itbl_parse (argv[1]) != 0) + { + printf ("failed to parse itbl\n"); + exit (0); + } + + fas = fopen (argv[2], "r"); + if (fas == 0) + { + printf ("failed to open asm file %s\n", argv[2]); + exit (0); + } + while (fgets (s, 80, fas)) + { + char *p; + aline++; + + if (p = strchr (s, ';'), p) /* strip comments */ + *p = 0; + if (p = strchr (s, '#'), p) /* strip comments */ + *p = 0; + p = s + strlen (s) - 1; + while (p >= s && (*p == ' ' || *p == '\t' || *p == '\n')) /* strip trailing spaces */ + p--; + *(p + 1) = 0; + p = s; + while (*p && (*p == ' ' || *p == '\t' || *p == '\n')) /* strip leading spaces */ + p++; + if (!*p) + continue; + + name = itbl_get_field (&p); + insn = itbl_assemble (name, p); + if (insn == 0) + printf ("line %d: Invalid instruction (%s)\n", aline, s); + else + { + char buf[128]; + printf ("line %d: insn(%s) = 0x%x)\n", aline, s, insn); + if (!itbl_disassemble (buf, insn)) + printf ("line %d: Can't disassemble instruction " + "(0x%x)\n", aline, insn); + else + printf ("line %d: disasm(0x%x) = %s)\n", aline, insn, buf); + } + } + + test_reg (1, e_dreg, "d1", 1); + test_reg (3, e_creg, "c2", 22); + test_reg (3, e_dreg, "d3", 3); + + return 0; +} + +static int +test_reg (e_processor processor, e_type type, char *name, + unsigned long val) +{ + char *n; + unsigned long v; + + n = itbl_get_name (processor, type, val); + if (!n || strcmp (n, name)) + printf ("Error - reg name not found for proessor=%d, type=%d, val=%d\n", + processor, type, val); + else + printf ("name=%s found for processor=%d, type=%d, val=%d\n", + n, processor, type, val); + + /* We require that names be unique amoung processors and types. */ + v = itbl_get_reg_val (name); + if (!v || v != val) + printf ("Error - reg val not found for processor=%d, type=%d, name=%s\n", + processor, type, name); + else + printf ("val=0x%x found for processor=%d, type=%d, name=%s\n", + v, processor, type, name); + return 0; +} diff -urN binutils-2.7/gas/testsuite/gas/all/itbl.s binutils-2.8/gas/testsuite/gas/all/itbl.s --- binutils-2.7/gas/testsuite/gas/all/itbl.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/all/itbl.s Wed Apr 30 12:53:49 1997 @@ -0,0 +1,13 @@ + + ; Test case for assembler option "itbl". + ; Run as "as --itbl itbl itbl.s" + ; or with stand-alone test case "itbl-test itbl itbl.s". + + ; Assemble processor instructions as defined in "itbl". + + fee $d3,$c2,0x1 ; 0x4ff07601 + fie ; 0x4ff00000 + foh $2,0x100 + fum $d3,$c2 ; 0x4ff07601 + pig $2,0x100 + diff -urN binutils-2.7/gas/testsuite/gas/arm/arch4t.s binutils-2.8/gas/testsuite/gas/arm/arch4t.s --- binutils-2.7/gas/testsuite/gas/arm/arch4t.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/arm/arch4t.s Wed Apr 30 12:53:56 1997 @@ -0,0 +1,21 @@ +.text +.align 0 + + bx r0 + bxeq r1 + +foo: + ldrh r3, foo + ldrsh r4, [r5] + ldrsb r4, [r1, r3] + ldrsh r1, [r4, r4]! + ldreqsb r1, [r5, -r3] + ldrneh r2, [r6], r7 + ldrccsh r2, [r7], +r8 + ldrsb r2, [r3, #255] + ldrsh r1, [r4, #-250] + ldrsb r1, [r5, #+240] + + strh r2, bar + strneh r3, [r3] +bar: diff -urN binutils-2.7/gas/testsuite/gas/arm/arm.exp binutils-2.8/gas/testsuite/gas/arm/arm.exp --- binutils-2.7/gas/testsuite/gas/arm/arm.exp Thu Jul 4 12:15:17 1996 +++ binutils-2.8/gas/testsuite/gas/arm/arm.exp Wed Apr 30 12:53:56 1997 @@ -1,24 +1,34 @@ # # Some ARM tests # -if [istarget arm-*-*] then { - gas_test "inst.s" "" $stdoptlist "Basic instruction set" - +if [istarget arm*-*-*] then { gas_test "arm3.s" "" $stdoptlist "Arm 3 instructions" gas_test "arm6.s" "" $stdoptlist "Arm 6 instructions" gas_test "arm7dm.s" "" $stdoptlist "Arm 7DM instructions" + # This test currently fails with a branch out of range error. + setup_xfail "*-*-*" + gas_test "thumb.s" "" "" "Thumb instructions" + + gas_test "arch4t.s" "" $stdoptlist "Arm architecture 4t instructions" + gas_test "copro.s" "" $stdoptlist "Co processor instructions" + gas_test "immed.s" "" $stdoptlist "immediate expressions" + gas_test "float.s" "" $stdoptlist "Core floating point instructions" } -# Not all arm targets are bi-endian, so only run this test on ones -# we know that are. FIXME: We should probably also key off armeb/armel. +# Not all arm targets are bi-endian, so only run these tests on ones +# we know that are. + +if { [istarget arm*-*-pe*] || [istarget arm*-*-coff*] } { + run_dump_test "inst" + + run_dump_test "arm7t" -if [istarget arm-*-pe] { run_dump_test "le-fpconst" # Since big-endian numbers have the normal format, this doesn't exist. diff -urN binutils-2.7/gas/testsuite/gas/arm/arm7t.d binutils-2.8/gas/testsuite/gas/arm/arm7t.d --- binutils-2.7/gas/testsuite/gas/arm/arm7t.d Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/arm/arm7t.d Wed Apr 30 12:53:56 1997 @@ -0,0 +1,68 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: ARM arm7t +#as: -marm7t -EL + +# Test the halfword and signextend memory transfers: + +.*: +file format .*arm.*little + +Disassembly of section .text: +00000000 <[^>]*> e1d100b0 ? ldrh r0, \[r1\] +00000004 <[^>]*> e1f100b0 ? ldrh r0, \[r1\]! +00000008 <[^>]*> e19100b2 ? ldrh r0, \[r1, r2\] +0000000c <[^>]*> e1b100b2 ? ldrh r0, \[r1, r2\]! +00000010 <[^>]*> e1d100bc ? ldrh r0, \[r1, #c\] +00000014 <[^>]*> e1f100bc ? ldrh r0, \[r1, #c\]! +00000018 <[^>]*> e15100bc ? ldrh r0, \[r1, -#c\] +0000001c <[^>]*> e09100b2 ? ldrh r0, \[r1\], r2 +00000020 <[^>]*> e3a00cff ? mov r0, #ff00 +00000024 <[^>]*> e1df0bb4 ? ldrh r0, 000000e0 <\$\$lit_1> +00000028 <[^>]*> e1df0abc ? ldrh r0, 000000dc <.L2> +0000002c <[^>]*> e1c100b0 ? strh r0, \[r1\] +00000030 <[^>]*> e1e100b0 ? strh r0, \[r1\]! +00000034 <[^>]*> e18100b2 ? strh r0, \[r1, r2\] +00000038 <[^>]*> e1a100b2 ? strh r0, \[r1, r2\]! +0000003c <[^>]*> e1c100bc ? strh r0, \[r1, #c\] +00000040 <[^>]*> e1e100bc ? strh r0, \[r1, #c\]! +00000044 <[^>]*> e14100bc ? strh r0, \[r1, -#c\] +00000048 <[^>]*> e08100b2 ? strh r0, \[r1\], r2 +0000004c <[^>]*> e1cf08b8 ? strh r0, 000000dc <.L2> +00000050 <[^>]*> e1d100d0 ? ldrsb r0, \[r1\] +00000054 <[^>]*> e1f100d0 ? ldrsb r0, \[r1\]! +00000058 <[^>]*> e19100d2 ? ldrsb r0, \[r1, r2\] +0000005c <[^>]*> e1b100d2 ? ldrsb r0, \[r1, r2\]! +00000060 <[^>]*> e1d100dc ? ldrsb r0, \[r1, #c\] +00000064 <[^>]*> e1f100dc ? ldrsb r0, \[r1, #c\]! +00000068 <[^>]*> e15100dc ? ldrsb r0, \[r1, -#c\] +0000006c <[^>]*> e09100d2 ? ldrsb r0, \[r1\], r2 +00000070 <[^>]*> e3a000de ? mov r0, #de +00000074 <[^>]*> e1df06d0 ? ldrsb r0, 000000dc <.L2> +00000078 <[^>]*> e1d100f0 ? ldrsh r0, \[r1\] +0000007c <[^>]*> e1f100f0 ? ldrsh r0, \[r1\]! +00000080 <[^>]*> e19100f2 ? ldrsh r0, \[r1, r2\] +00000084 <[^>]*> e1b100f2 ? ldrsh r0, \[r1, r2\]! +00000088 <[^>]*> e1d100fc ? ldrsh r0, \[r1, #c\] +0000008c <[^>]*> e1f100fc ? ldrsh r0, \[r1, #c\]! +00000090 <[^>]*> e15100fc ? ldrsh r0, \[r1, -#c\] +00000094 <[^>]*> e09100f2 ? ldrsh r0, \[r1\], r2 +00000098 <[^>]*> e3a00cff ? mov r0, #ff00 +0000009c <[^>]*> e1df03fc ? ldrsh r0, 000000e0 <\$\$lit_1> +000000a0 <[^>]*> e1df03f4 ? ldrsh r0, 000000dc <.L2> +000000a4 <[^>]*> e19100b2 ? ldrh r0, \[r1, r2\] +000000a8 <[^>]*> 119100b2 ? ldrneh r0, \[r1, r2\] +000000ac <[^>]*> 819100b2 ? ldrhih r0, \[r1, r2\] +000000b0 <[^>]*> b19100b2 ? ldrlth r0, \[r1, r2\] +000000b4 <[^>]*> e19100f2 ? ldrsh r0, \[r1, r2\] +000000b8 <[^>]*> 119100f2 ? ldrnesh r0, \[r1, r2\] +000000bc <[^>]*> 819100f2 ? ldrhish r0, \[r1, r2\] +000000c0 <[^>]*> b19100f2 ? ldrltsh r0, \[r1, r2\] +000000c4 <[^>]*> e19100d2 ? ldrsb r0, \[r1, r2\] +000000c8 <[^>]*> 119100d2 ? ldrnesb r0, \[r1, r2\] +000000cc <[^>]*> 819100d2 ? ldrhisb r0, \[r1, r2\] +000000d0 <[^>]*> b19100d2 ? ldrltsb r0, \[r1, r2\] +000000d4 <[^>]*> e1df00f4 ? ldrsh r0, 000000e0 <\$\$lit_1> +000000d8 <[^>]*> e1df00f4 ? ldrsh r0, 000000e4 <\$\$lit_1\+4> +000000dc <[^>]*> 00000000 ? andeq r0, r0, r0 +[ ]*dc: 32 .LC0 +000000e0 <[^>]*> 0000c0de ? .* +000000e4 <[^>]*> 0000dead ? .* diff -urN binutils-2.7/gas/testsuite/gas/arm/arm7t.s binutils-2.8/gas/testsuite/gas/arm/arm7t.s --- binutils-2.7/gas/testsuite/gas/arm/arm7t.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/arm/arm7t.s Wed Apr 30 12:53:57 1997 @@ -0,0 +1,79 @@ + .section .rdata + .align 0 +.LC0: + .ascii "some data\000" + + .text + .align 0 + +loadhalfwords: + ldrh r0, [r1] + ldrh r0, [r1]! + ldrh r0, [r1, r2] + ldrh r0, [r1, r2]! + ldrh r0, [r1,#0x0C] + ldrh r0, [r1,#0x0C]! + ldrh r0, [r1,#-0x0C] + ldrh r0, [r1], r2 + ldrh r0, =0xFF00 + ldrh r0, =0xC0DE + ldrh r0, .L2 + +storehalfwords: + strh r0, [r1] + strh r0, [r1]! + strh r0, [r1, r2] + strh r0, [r1, r2]! + strh r0, [r1,#0x0C] + strh r0, [r1,#0x0C]! + strh r0, [r1,#-0x0C] + strh r0, [r1], r2 + strh r0, .L2 + +loadsignedbytes: + ldrsb r0, [r1] + ldrsb r0, [r1]! + ldrsb r0, [r1, r2] + ldrsb r0, [r1, r2]! + ldrsb r0, [r1,#0x0C] + ldrsb r0, [r1,#0x0C]! + ldrsb r0, [r1,#-0x0C] + ldrsb r0, [r1], r2 + ldrsb r0, =0xDE + ldrsb r0, .L2 + +loadsignedhalfwords: + ldrsh r0, [r1] + ldrsh r0, [r1]! + ldrsh r0, [r1, r2] + ldrsh r0, [r1, r2]! + ldrsh r0, [r1, #0x0C] + ldrsh r0, [r1, #0x0C]! + ldrsh r0, [r1, #-0x0C] + ldrsh r0, [r1], r2 + ldrsh r0, =0xFF00 + ldrsh r0, =0xC0DE + ldrsh r0, .L2 + +misc: + ldralh r0, [r1, r2] + ldrneh r0, [r1, r2] + ldrhih r0, [r1, r2] + ldrlth r0, [r1, r2] + + ldralsh r0, [r1, r2] + ldrnesh r0, [r1, r2] + ldrhish r0, [r1, r2] + ldrltsh r0, [r1, r2] + + ldralsb r0, [r1, r2] + ldrnesb r0, [r1, r2] + ldrhisb r0, [r1, r2] + ldrltsb r0, [r1, r2] + + ldrsh r0, =0xC0DE + ldrsh r0, =0xDEAD + + .align +.L2: + .word .LC0 diff -urN binutils-2.7/gas/testsuite/gas/arm/immed.s binutils-2.8/gas/testsuite/gas/arm/immed.s --- binutils-2.7/gas/testsuite/gas/arm/immed.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/arm/immed.s Wed Apr 30 12:53:57 1997 @@ -0,0 +1,11 @@ +@ Tests for complex immediate expressions - none of these need +@ relocations + .text +bar: + mov r0, #0 + mov r0, #(. - bar - 8) + ldr r0, bar + ldr r0, [pc, # (bar - . -8)] + .space 4096 + mov r0, #(. - bar - 8) & 0xff + ldr r0, [pc, # (bar - . -8) & 0xff] diff -urN binutils-2.7/gas/testsuite/gas/arm/inst.d binutils-2.8/gas/testsuite/gas/arm/inst.d --- binutils-2.7/gas/testsuite/gas/arm/inst.d Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/arm/inst.d Wed Apr 30 12:53:57 1997 @@ -0,0 +1,168 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: ARM basic instructions +#as: -marm2 -EL + +# Test the standard ARM instructions: + +.*: +file format .*arm.*little + +Disassembly of section .text: +00000000 <[^>]*> e3a00000 ? mov r0, #0 +00000004 <[^>]*> e1a01002 ? mov r1, r2 +00000008 <[^>]*> e1a03184 ? mov r3, r4, lsl #3 +0000000c <[^>]*> e1a05736 ? mov r5, r6, lsr r7 +00000010 <[^>]*> e1a08a59 ? mov r8, r9, asr sl +00000014 <[^>]*> e1a0bd1c ? mov fp, ip, lsl sp +00000018 <[^>]*> e1a0e06f ? mov lr, pc, rrx +0000001c <[^>]*> e1a01002 ? mov r1, r2 +00000020 <[^>]*> 01a02003 ? moveq r2, r3 +00000024 <[^>]*> 11a04005 ? movne r4, r5 +00000028 <[^>]*> b1a06007 ? movlt r6, r7 +0000002c <[^>]*> a1a08009 ? movge r8, r9 +00000030 <[^>]*> d1a0a00b ? movle sl, fp +00000034 <[^>]*> c1a0c00d ? movgt ip, sp +00000038 <[^>]*> 31a01002 ? movcc r1, r2 +0000003c <[^>]*> 21a01003 ? movcs r1, r3 +00000040 <[^>]*> 41a03006 ? movmi r3, r6 +00000044 <[^>]*> 51a07009 ? movpl r7, r9 +00000048 <[^>]*> 61a01008 ? movvs r1, r8 +0000004c <[^>]*> 71a09fa1 ? movvc r9, r1, lsr #1f +00000050 <[^>]*> 81a0800f ? movhi r8, pc +00000054 <[^>]*> 91a0f00e ? movls pc, lr +00000058 <[^>]*> 21a09008 ? movcs r9, r8 +0000005c <[^>]*> 31a01003 ? movcc r1, r3 +00000060 <[^>]*> e1b00008 ? movs r0, r8 +00000064 <[^>]*> 31b00007 ? movccs r0, r7 +00000068 <[^>]*> e281000a ? add r0, r1, #a +0000006c <[^>]*> e0832004 ? add r2, r3, r4 +00000070 <[^>]*> e0865287 ? add r5, r6, r7, lsl #5 +00000074 <[^>]*> e0821113 ? add r1, r2, r3, lsl r1 +00000078 <[^>]*> e201000a ? and r0, r1, #a +0000007c <[^>]*> e0032004 ? and r2, r3, r4 +00000080 <[^>]*> e0065287 ? and r5, r6, r7, lsl #5 +00000084 <[^>]*> e0021113 ? and r1, r2, r3, lsl r1 +00000088 <[^>]*> e221000a ? eor r0, r1, #a +0000008c <[^>]*> e0232004 ? eor r2, r3, r4 +00000090 <[^>]*> e0265287 ? eor r5, r6, r7, lsl #5 +00000094 <[^>]*> e0221113 ? eor r1, r2, r3, lsl r1 +00000098 <[^>]*> e241000a ? sub r0, r1, #a +0000009c <[^>]*> e0432004 ? sub r2, r3, r4 +000000a0 <[^>]*> e0465287 ? sub r5, r6, r7, lsl #5 +000000a4 <[^>]*> e0421113 ? sub r1, r2, r3, lsl r1 +000000a8 <[^>]*> e2a1000a ? adc r0, r1, #a +000000ac <[^>]*> e0a32004 ? adc r2, r3, r4 +000000b0 <[^>]*> e0a65287 ? adc r5, r6, r7, lsl #5 +000000b4 <[^>]*> e0a21113 ? adc r1, r2, r3, lsl r1 +000000b8 <[^>]*> e2c1000a ? sbc r0, r1, #a +000000bc <[^>]*> e0c32004 ? sbc r2, r3, r4 +000000c0 <[^>]*> e0c65287 ? sbc r5, r6, r7, lsl #5 +000000c4 <[^>]*> e0c21113 ? sbc r1, r2, r3, lsl r1 +000000c8 <[^>]*> e261000a ? rsb r0, r1, #a +000000cc <[^>]*> e0632004 ? rsb r2, r3, r4 +000000d0 <[^>]*> e0665287 ? rsb r5, r6, r7, lsl #5 +000000d4 <[^>]*> e0621113 ? rsb r1, r2, r3, lsl r1 +000000d8 <[^>]*> e2e1000a ? rsc r0, r1, #a +000000dc <[^>]*> e0e32004 ? rsc r2, r3, r4 +000000e0 <[^>]*> e0e65287 ? rsc r5, r6, r7, lsl #5 +000000e4 <[^>]*> e0e21113 ? rsc r1, r2, r3, lsl r1 +000000e8 <[^>]*> e381000a ? orr r0, r1, #a +000000ec <[^>]*> e1832004 ? orr r2, r3, r4 +000000f0 <[^>]*> e1865287 ? orr r5, r6, r7, lsl #5 +000000f4 <[^>]*> e1821113 ? orr r1, r2, r3, lsl r1 +000000f8 <[^>]*> e3c1000a ? bic r0, r1, #a +000000fc <[^>]*> e1c32004 ? bic r2, r3, r4 +00000100 <[^>]*> e1c65287 ? bic r5, r6, r7, lsl #5 +00000104 <[^>]*> e1c21113 ? bic r1, r2, r3, lsl r1 +00000108 <[^>]*> e3e0000a ? mvn r0, #a +0000010c <[^>]*> e1e02004 ? mvn r2, r4 +00000110 <[^>]*> e1e05287 ? mvn r5, r7, lsl #5 +00000114 <[^>]*> e1e01113 ? mvn r1, r3, lsl r1 +00000118 <[^>]*> e310000a ? tst r0, #a +0000011c <[^>]*> e1120004 ? tst r2, r4 +00000120 <[^>]*> e1150287 ? tst r5, r7, lsl #5 +00000124 <[^>]*> e1110113 ? tst r1, r3, lsl r1 +00000128 <[^>]*> e330000a ? teq r0, #a +0000012c <[^>]*> e1320004 ? teq r2, r4 +00000130 <[^>]*> e1350287 ? teq r5, r7, lsl #5 +00000134 <[^>]*> e1310113 ? teq r1, r3, lsl r1 +00000138 <[^>]*> e350000a ? cmp r0, #a +0000013c <[^>]*> e1520004 ? cmp r2, r4 +00000140 <[^>]*> e1550287 ? cmp r5, r7, lsl #5 +00000144 <[^>]*> e1510113 ? cmp r1, r3, lsl r1 +00000148 <[^>]*> e370000a ? cmn r0, #a +0000014c <[^>]*> e1720004 ? cmn r2, r4 +00000150 <[^>]*> e1750287 ? cmn r5, r7, lsl #5 +00000154 <[^>]*> e1710113 ? cmn r1, r3, lsl r1 +00000158 <[^>]*> e330f00a ? teqp r0, #a +0000015c <[^>]*> e132f004 ? teqp r2, r4 +00000160 <[^>]*> e135f287 ? teqp r5, r7, lsl #5 +00000164 <[^>]*> e131f113 ? teqp r1, r3, lsl r1 +00000168 <[^>]*> e370f00a ? cmnp r0, #a +0000016c <[^>]*> e172f004 ? cmnp r2, r4 +00000170 <[^>]*> e175f287 ? cmnp r5, r7, lsl #5 +00000174 <[^>]*> e171f113 ? cmnp r1, r3, lsl r1 +00000178 <[^>]*> e350f00a ? cmpp r0, #a +0000017c <[^>]*> e152f004 ? cmpp r2, r4 +00000180 <[^>]*> e155f287 ? cmpp r5, r7, lsl #5 +00000184 <[^>]*> e151f113 ? cmpp r1, r3, lsl r1 +00000188 <[^>]*> e310f00a ? tstp r0, #a +0000018c <[^>]*> e112f004 ? tstp r2, r4 +00000190 <[^>]*> e115f287 ? tstp r5, r7, lsl #5 +00000194 <[^>]*> e111f113 ? tstp r1, r3, lsl r1 +00000198 <[^>]*> e0000291 ? mul r0, r1, r2 +0000019c <[^>]*> e0110392 ? muls r1, r2, r3 +000001a0 <[^>]*> 10000091 ? mulne r0, r1, r0 +000001a4 <[^>]*> 90190798 ? mullss r9, r8, r7 +000001a8 <[^>]*> e021ba99 ? mla r1, r9, sl, fp +000001ac <[^>]*> e033c994 ? mlas r3, r4, r9, ip +000001b0 <[^>]*> b029d798 ? mlalt r9, r8, r7, sp +000001b4 <[^>]*> a034e391 ? mlages r4, r1, r3, lr +000001b8 <[^>]*> e5910000 ? ldr r0, \[r1\] +000001bc <[^>]*> e7911002 ? ldr r1, \[r1, r2\] +000001c0 <[^>]*> e7b32004 ? ldr r2, \[r3, r4\]! +000001c4 <[^>]*> e5922020 ? ldr r2, \[r2, #20\] +000001c8 <[^>]*> e7932424 ? ldr r2, \[r3, r4, lsr #8\] +000001cc <[^>]*> 07b54484 ? ldreq r4, \[r5, r4, lsl #9\]! +000001d0 <[^>]*> 14954006 ? ldrne r4, \[r5\], #6 +000001d4 <[^>]*> e6b21003 ? ldrt r1, \[r2\], r3 +000001d8 <[^>]*> e6942425 ? ldr r2, \[r4\], r5, lsr #8 +000001dc <[^>]*> e51f0008 ? ldr r0, 000001dc <[^>]*> +000001e0 <[^>]*> e5d43000 ? ldrb r3, \[r4\] +000001e4 <[^>]*> 14f85000 ? ldrnebt r5, \[r8\] +000001e8 <[^>]*> e5810000 ? str r0, \[r1\] +000001ec <[^>]*> e7811002 ? str r1, \[r1, r2\] +000001f0 <[^>]*> e7a33004 ? str r3, \[r3, r4\]! +000001f4 <[^>]*> e5822020 ? str r2, \[r2, #20\] +000001f8 <[^>]*> e7832424 ? str r2, \[r3, r4, lsr #8\] +000001fc <[^>]*> 07a54484 ? streq r4, \[r5, r4, lsl #9\]! +00000200 <[^>]*> 14854006 ? strne r4, \[r5\], #6 +00000204 <[^>]*> e6821003 ? str r1, \[r2\], r3 +00000208 <[^>]*> e6a42425 ? strt r2, \[r4\], r5, lsr #8 +0000020c <[^>]*> e50f1004 ? str r1, 00000210 <[^>]*> +00000210 <[^>]*> e5c71000 ? strb r1, \[r7\] +00000214 <[^>]*> e4e02000 ? strbt r2, \[r0\] +00000218 <[^>]*> e8900002 ? ldmia r0, {r1} +0000021c <[^>]*> 09920038 ? ldmeqib r2, {r3, r4, r5} +00000220 <[^>]*> e853ffff ? ldmda r3, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp, ip, sp, lr, pc}\^ +00000224 <[^>]*> e93b05ff ? ldmdb fp!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, sl} +00000228 <[^>]*> e99100f7 ? ldmib r1, {r0, r1, r2, r4, r5, r6, r7} +0000022c <[^>]*> e89201f8 ? ldmia r2, {r3, r4, r5, r6, r7, r8} +00000230 <[^>]*> e9130003 ? ldmdb r3, {r0, r1} +00000234 <[^>]*> e8740300 ? ldmda r4!, {r8, r9}\^ +00000238 <[^>]*> e8800002 ? stmia r0, {r1} +0000023c <[^>]*> 09820038 ? stmeqib r2, {r3, r4, r5} +00000240 <[^>]*> e843ffff ? stmda r3, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp, ip, sp, lr, pc}\^ +00000244 <[^>]*> e92a05ff ? stmdb sl!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, sl} +00000248 <[^>]*> e8010007 ? stmda r1, {r0, r1, r2} +0000024c <[^>]*> e9020018 ? stmdb r2, {r3, r4} +00000250 <[^>]*> e8830003 ? stmia r3, {r0, r1} +00000254 <[^>]*> e9e40300 ? stmib r4!, {r8, r9}\^ +00000258 <[^>]*> ef123456 ? swi 0x00123456 +0000025c <[^>]*> 2f000033 ? swics 0x00000033 +00000260 <[^>]*> ebfffffe ? bl 00000260 <[^>]*> +[ ]*260: ARM26 _wombat +00000264 <[^>]*> 5bffffe9 ? blpl 00000210 +00000268 <[^>]*> eafffffe ? b 00000268 <[^>]*> +[ ]*268: ARM26 _wibble +0000026c <[^>]*> dafffffe ? ble 0000026c <[^>]*> +[ ]*26c: ARM26 testerfunc diff -urN binutils-2.7/gas/testsuite/gas/arm/thumb.s binutils-2.8/gas/testsuite/gas/arm/thumb.s --- binutils-2.7/gas/testsuite/gas/arm/thumb.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/arm/thumb.s Wed Apr 30 12:53:58 1997 @@ -0,0 +1,191 @@ + .text + .code 16 +foo: + lsl r2, r1, #3 + lsr r3, r4, #31 +wibble/data: + asr r7, r0, #5 + + lsl r1, r2, #0 + lsr r3, r4, #0 + asr r4, r5, #0 + + lsr r6, r7, #32 + asr r0, r1, #32 + + add r1, r2, r3 + add r2, r4, #2 + sub r3, r5, r7 + sub r2, r4, #7 + + mov r4, #255 + cmp r3, #250 + add r6, #123 + sub r5, #128 + + and r3, r5 + eor r4, r6 + lsl r1, r0 + lsr r2, r3 + asr r4, r6 + adc r5, r7 + sbc r0, r4 + ror r1, r4 + tst r2, r5 + neg r1, r1 + cmp r2, r3 + cmn r1, r4 + orr r0, r3 + mul r4, r5 + bic r5, r7 + mvn r5, r5 + + add r1, r13 + add r12, r2 + add r9, r9 + cmp r1, r14 + cmp r8, r0 + cmp r12, r14 + mov r0, r9 + mov r9, r4 + mov r8, r8 + bx r7 + bx r8 + .align 0 + bx pc + + ldr r3, [pc, #128] + ldr r4, bar + + str r0, [r1, r2] + strb r1, [r2, r4] + ldr r5, [r6, r7] + ldrb r2, [r4, r5] + + .align 0 +bar: + strh r1, [r2, r3] + ldrh r3, [r4, r0] + ldsb r1, [r6, r7] + ldsh r2, [r0, r5] + + str r3, [r3, #124] + ldr r1, [r4, #124] + ldr r5, [r5] + strb r1, [r5, #31] + strb r1, [r4, #5] + strb r2, [r6] + + strh r4, [r5, #62] + ldrh r5, [r0, #4] + ldrh r3, [r2] + + str r3, [r13, #1020] + ldr r1, [r13, #44] + ldr r2, [r13] + + add r7, r15, #1020 + add r4, r13, #512 + + add r13, #268 + add r13, #-104 + sub r13, #268 + sub r13, #-108 + + push {r0, r1, r2, r4} + push {r0, r3-r7, lr} + pop {r3, r4, r7} + pop {r0-r7, r15} + + stmia r3!, {r0, r1, r4-r7} + ldmia r0!, {r1-r7} + + beq bar + bne bar + bcs bar + bcc bar + bmi bar + bpl bar + bvs bar + bvc bar + bhi bar + bls bar + bge bar + bgt bar + blt bar + bgt bar + ble bar + bhi bar + blo bar + bul bar + +close: + lsl r4, r5, #near - close +near: + add r2, r3, #near - close + + add sp, sp, #127 << 2 + sub sp, sp, #127 << 2 + add r0, sp, #255 << 2 + add r0, pc, #255 << 2 + + add sp, sp, #bar - foo + sub sp, sp, #bar - foo + add r0, sp, #bar - foo + add r0, pc, #bar - foo + + add r1, #bar - foo + mov r6, #bar - foo + cmp r7, #bar - foo + + nop + nop + + .arm +localbar: + b localbar + b wombat + bl localbar + bl wombat + + bx r0 + swi 0x123456 + + .thumb + + adr r0, forwardonly + + b foo + b wombat + bl foo + bl wombat + + bx r0 + + swi 0xff + .align 0 +forwardonly: + beq wombat + bne wombat + bcs wombat + bcc wombat + bmi wombat + bpl wombat + bvs wombat + bvc wombat + bhi wombat + bls wombat + bge wombat + bgt wombat + blt wombat + bgt wombat + ble wombat + bhi wombat + blo wombat + bul wombat + +back: + bl local + .space (1 << 11) @ leave space to force long offsets +local: + bl back diff -urN binutils-2.7/gas/testsuite/gas/h8300/addsubs.s binutils-2.8/gas/testsuite/gas/h8300/addsubs.s --- binutils-2.7/gas/testsuite/gas/h8300/addsubs.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/addsubs.s Wed Apr 30 12:54:01 1997 @@ -0,0 +1,25 @@ + .h8300s + .text +h8300s_add_sub: + add.b #16,r1l + add.b r1h,r1l + add.w #32,r1 + add.w r1,r2 + add.l #64,er1 + add.l er1,er2 + adds #1,er4 + adds #2,er5 + adds #4,er6 + addx r0l,r1l + addx #16,r2h + sub.b r0l,r1l + sub.w #16,r1 + sub.w r0,r1 + sub.l #64,er1 + sub.l er1,er2 + subs #1,er4 + subs #2,er5 + subs #4,er6 + subx r0l,r1l + subx #16,r2h + diff -urN binutils-2.7/gas/testsuite/gas/h8300/bitops1s.s binutils-2.8/gas/testsuite/gas/h8300/bitops1s.s --- binutils-2.7/gas/testsuite/gas/h8300/bitops1s.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/bitops1s.s Wed Apr 30 12:54:01 1997 @@ -0,0 +1,29 @@ + .h8300s + .text +h8300s_bit_ops_1: + band #0,r0l + band #0,@er0 + band #0,@64:8 + band #0,@128:16 + band #0,@65536:32 + bclr #0,r0l + bclr #0,@er0 + bclr #0,@64:8 + bclr #0,@128:16 + bclr #0,@65536:32 + bclr r1l,r0l + bclr r1l,@er0 + bclr r1l,@64:8 + bclr r1l,@128:16 + bclr r1l,@65536:32 + biand #0,r0l + biand #0,@er0 + biand #0,@64:8 + biand #0,@128:16 + biand #0,@65536:32 + bild #0,r0l + bild #0,@er0 + bild #0,@64:8 + bild #0,@128:16 + bild #0,@65536:32 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/bitops2s.s binutils-2.8/gas/testsuite/gas/h8300/bitops2s.s --- binutils-2.7/gas/testsuite/gas/h8300/bitops2s.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/bitops2s.s Wed Apr 30 12:54:02 1997 @@ -0,0 +1,23 @@ + .h8300s + .text +h8300s_bit_ops_2: + bior #0,r0l + bior #0,@er0 + bior #0,@64:8 + bior #0,@128:16 + bior #0,@65536:32 + bist #0,r0l + bist #0,@er0 + bist #0,@64:8 + bist #0,@128:16 + bist #0,@65536:32 + bixor #0,r0l + bixor #0,@er0 + bixor #0,@64:8 + bixor #0,@128:16 + bixor #0,@65536:32 + bld #0,r0l + bld #0,@er0 + bld #0,@64:8 + bld #0,@128:16 + bld #0,@65536:32 diff -urN binutils-2.7/gas/testsuite/gas/h8300/bitops3s.s binutils-2.8/gas/testsuite/gas/h8300/bitops3s.s --- binutils-2.7/gas/testsuite/gas/h8300/bitops3s.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/bitops3s.s Wed Apr 30 12:54:02 1997 @@ -0,0 +1,24 @@ + .h8300s + .text +h8300s_bit_ops_3: + bnot #0,r0l + bnot #0,@er0 + bnot #0,@64:8 + bnot #0,@128:16 + bnot #0,@65536:32 + bnot r1l,r0l + bnot r1l,@er0 + bnot r1l,@64:8 + bnot r1l,@128:16 + bnot r1l,@65536:32 + bset #0,r0l + bset #0,@er0 + bset #0,@64:8 + bset #0,@128:16 + bset #0,@65536:32 + bset r1l,r0l + bset r1l,@er0 + bset r1l,@64:8 + bset r1l,@128:16 + bset r1l,@65536:32 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/bitops4s.s binutils-2.8/gas/testsuite/gas/h8300/bitops4s.s --- binutils-2.7/gas/testsuite/gas/h8300/bitops4s.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/bitops4s.s Wed Apr 30 12:54:02 1997 @@ -0,0 +1,29 @@ + .h8300s + .text +h8300s_bit_ops_4: + bor #0,r0l + bor #0,@er0 + bor #0,@64:8 + bor #0,@128:16 + bor #0,@65536:32 + bst #0,r0l + bst #0,@er0 + bst #0,@64:8 + bst #0,@128:16 + bst #0,@65536:32 + btst #0,r0l + btst #0,@er0 + btst #0,@64:8 + btst #0,@128:16 + btst #0,@65536:32 + btst r1l,r0l + btst r1l,@er0 + btst r1l,@64:8 + btst r1l,@128:16 + btst r1l,@65536:32 + bxor #0,r0l + bxor #0,@er0 + bxor #0,@64:8 + bxor #0,@128:16 + bxor #0,@65536:32 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/branchs.s binutils-2.8/gas/testsuite/gas/h8300/branchs.s --- binutils-2.7/gas/testsuite/gas/h8300/branchs.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/branchs.s Wed Apr 30 12:54:03 1997 @@ -0,0 +1,12 @@ + .h8300s + .text +h8300s_branches: + bsr h8300s_branches:8 + bsr h8300s_branches:16 + jmp h8300s_branches + jmp @er0 + jmp @@16:8 + jsr h8300s_branches + jsr @er0 + jsr @@16:8 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/cbranchs.s binutils-2.8/gas/testsuite/gas/h8300/cbranchs.s --- binutils-2.7/gas/testsuite/gas/h8300/cbranchs.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/cbranchs.s Wed Apr 30 12:54:03 1997 @@ -0,0 +1,44 @@ + .text + .h8300s +h8300s_cbranch: + bra h8300s_cbranch:8 + bt h8300s_cbranch:8 + brn h8300s_cbranch:8 + bf h8300s_cbranch:8 + bhi h8300s_cbranch:8 + bls h8300s_cbranch:8 + bcc h8300s_cbranch:8 + bhs h8300s_cbranch:8 + bcs h8300s_cbranch:8 + blo h8300s_cbranch:8 + bne h8300s_cbranch:8 + beq h8300s_cbranch:8 + bvc h8300s_cbranch:8 + bvs h8300s_cbranch:8 + bpl h8300s_cbranch:8 + bmi h8300s_cbranch:8 + bge h8300s_cbranch:8 + blt h8300s_cbranch:8 + bgt h8300s_cbranch:8 + ble h8300s_cbranch:8 + bra h8300s_cbranch:16 + bt h8300s_cbranch:16 + brn h8300s_cbranch:16 + bf h8300s_cbranch:16 + bhi h8300s_cbranch:16 + bls h8300s_cbranch:16 + bcc h8300s_cbranch:16 + bhs h8300s_cbranch:16 + bcs h8300s_cbranch:16 + blo h8300s_cbranch:16 + bne h8300s_cbranch:16 + beq h8300s_cbranch:16 + bvc h8300s_cbranch:16 + bvs h8300s_cbranch:16 + bpl h8300s_cbranch:16 + bmi h8300s_cbranch:16 + bge h8300s_cbranch:16 + blt h8300s_cbranch:16 + bgt h8300s_cbranch:16 + ble h8300s_cbranch:16 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/compares.s binutils-2.8/gas/testsuite/gas/h8300/compares.s --- binutils-2.7/gas/testsuite/gas/h8300/compares.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/compares.s Wed Apr 30 12:54:04 1997 @@ -0,0 +1,10 @@ + .h8300s + .text +h8300s_cmp: + cmp.b #0,r0l + cmp.b r0h,r0l + cmp.w #32,r0 + cmp.w r0,r1 + cmp.l #64,er0 + cmp.l er0,er1 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/decimals.s binutils-2.8/gas/testsuite/gas/h8300/decimals.s --- binutils-2.7/gas/testsuite/gas/h8300/decimals.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/decimals.s Wed Apr 30 12:54:04 1997 @@ -0,0 +1,6 @@ + .h8300s + .text +h8300s_decimal: + daa r0l + das r0l + diff -urN binutils-2.7/gas/testsuite/gas/h8300/divmuls.s binutils-2.8/gas/testsuite/gas/h8300/divmuls.s --- binutils-2.7/gas/testsuite/gas/h8300/divmuls.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/divmuls.s Wed Apr 30 12:54:04 1997 @@ -0,0 +1,12 @@ + .h8300h + .text +h8300h_div_mul: + divxu.b r0l,r1 + divxu.w r0,er1 + divxs.b r0l,r1 + divxs.w r0,er1 + mulxu.b r0l,r1 + mulxu.w r0,er1 + mulxs.b r0l,r1 + mulxs.w r0,er1 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/extends.s binutils-2.8/gas/testsuite/gas/h8300/extends.s --- binutils-2.7/gas/testsuite/gas/h8300/extends.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/extends.s Wed Apr 30 12:54:05 1997 @@ -0,0 +1,8 @@ + .h8300s + .text +h8300s_extend: + exts.w r0 + exts.l er0 + extu.w r0 + extu.l er0 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/ffxx1.d binutils-2.8/gas/testsuite/gas/h8300/ffxx1.d --- binutils-2.7/gas/testsuite/gas/h8300/ffxx1.d Thu Jul 4 12:15:21 1996 +++ binutils-2.8/gas/testsuite/gas/h8300/ffxx1.d Wed Apr 30 12:54:05 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: --prefix-addresses -dr #name: FFxx1 # Test for FFxx:8 addressing. @@ -6,8 +6,8 @@ .*: file format .*h8300.* Disassembly of section .text: -... - RELOC: 0+0000 16 main + ... + 0: 16 main 0+0400
f8 7f mov.b #0x7f,r0l 0+0402 28 bb mov.b @0xbb:8,r0l 0+0404 6a 88 ff b9 mov.b r0l,@0xffb9:16 @@ -16,8 +16,8 @@ 0+040e 79 01 00 00 mov.w #0x0,r1 0+0412 0b 01 adds #0x1,er1 0+0414 46 00 bne .0 \(416\) - RELOC: 0+0415 DISP8 deloop[+]0x[0f]*ffffffff + 415: DISP8 deloop[+]0xffffffff 0+0416 12 88 rotl r0l 0+0418 40 00 bra .0 \(41a\) - RELOC: 0+0419 DISP8 loop[+]0x[0f]*ffffffff -... + 419: DISP8 loop[+]0xffffffff + ... diff -urN binutils-2.7/gas/testsuite/gas/h8300/h8300.exp binutils-2.8/gas/testsuite/gas/h8300/h8300.exp --- binutils-2.7/gas/testsuite/gas/h8300/h8300.exp Thu Jul 4 14:29:03 1996 +++ binutils-2.8/gas/testsuite/gas/h8300/h8300.exp Wed Apr 30 12:54:06 1997 @@ -1000,25 +1000,26 @@ while 1 { expect { -re " +\[0-9\]+ 0000 7B5C598F\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0004 0700\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0006 0308\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0008 01406900\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000c 01406F00\[^\n\]*\n +\[0-9\]+ +0010\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0012 01407800\[^\n\]*\n +\[0-9\]+ +6B200000\[^\n\]*\n +\[0-9\]+ +0020\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 001c 01406D00\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0020 01406B00\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0026 01406B20\[^\n\]*\n +\[0-9\]+ +00000000\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 002e 0000\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0030 5670\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0032 5470\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0034 0180\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0036 0208\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0038 01406980\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 003c 01406F80\[^\n\]*\n +\[0-9\]+ +0010\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0042 01407800\[^\n\]*\n +\[0-9\]+ +6BA00000\[^\n\]*\n +\[0-9\]+ +0020\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 004c 01406D80\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0050 01406B80\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0056 01406BA0\[^\n\]*\n +\[0-9\]+ +00000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 7BD4598F\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 0700\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 0308\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 01406900\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 01406F00\[^\n\]*\n +\[0-9\]+ +0010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 01407800\[^\n\]*\n +\[0-9\]+ +6B200000\[^\n\]*\n +\[0-9\]+ +0020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 01406D00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 01406B00\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002a 01406B20\[^\n\]*\n +\[0-9\]+ +00000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0032 0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0034 5670\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0036 5470\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0038 0180\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003a 0208\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003c 01406980\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0040 01406F80\[^\n\]*\n +\[0-9\]+ +0010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0046 01407800\[^\n\]*\n +\[0-9\]+ +6BA00000\[^\n\]*\n +\[0-9\]+ +0020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0050 01406D80\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0054 01406B80\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 005a 01406BA0\[^\n\]*\n +\[0-9\]+ +00000000\[^\n\]*\n" { set x [expr $x+1] } eof { break } } } @@ -1028,13 +1029,10 @@ gas_finish # Did we find what we were looking for? If not, flunk it. - if [expr $x == 20] then { pass $testname } else { fail $testname } + if [expr $x == 21] then { pass $testname } else { fail $testname } setup_xfail "h8300*-*-*" fail "h8300h movfpe/movtpe tests" - - setup_xfail "h8300*-*-*" - fail "h8300h eepmov.w tests" } proc do_h8300h_movb {} { @@ -1245,6 +1243,845 @@ if [expr $x == 4] then { pass $testname } else { fail $testname } } +proc do_h8300s_add_sub {} { + set testname "addsubs.s: h8300s add/sub tests" + set x 0 + + gas_start "addsubs.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 8910\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 0819\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 79110020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 0912\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 7A110000\[^\n\]*\n +\[0-9\]+ +0040\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 0A92\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 0B04\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 0B85\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 0B96\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 0E89\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 9210\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c 1889\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 79310010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 1901\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 7A310000\[^\n\]*\n +\[0-9\]+ +0040\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002a 1A92\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002c 1B04\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002e 1B85\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 1B96\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0032 1E89\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0034 B210\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 21] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_logical {} { + set testname "logicals.s: h8300s logical tests" + set x 0 + + gas_start "logicals.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 E910\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 1691\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 79610020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 6611\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 7A610000\[^\n\]*\n +\[0-9\]+ +0040\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 01F06611\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 0610\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 01410610\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a C810\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c 1498\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 79410020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 6411\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 7A410000\[^\n\]*\n +\[0-9\]+ +0040\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002a 01F06411\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002e 0410\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 01410410\[^\n\]*\n" { set x [expr $x+1] } + + -re " +\[0-9\]+ 0034 D810\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0036 1589\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0038 79510020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003c 6511\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003e 7A510000\[^\n\]*\n +\[0-9\]+ +0040\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0044 01F06511\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0048 0510\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004a 01410510\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004e 1788\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0050 1790\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0052 17B0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0054 1708\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0056 1710\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0058 1730\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 30] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_cbranch {} { + set testname "cbranchs.s: h8300s conditional branch tests" + set x 0 + + gas_start "cbranchs.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 4000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 4000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 4100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 4100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 4200\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 4300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 4400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 4400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 4500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 4500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 4600\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 4700\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 4800\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 4900\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c 4A00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 4B00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 4C00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 4D00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 4E00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0026 4F00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 58000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002c 58000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 58100000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0034 58100000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0038 58200000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003c 58300000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0040 58400000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0044 58400000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0048 58500000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004c 58500000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0050 58600000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0054 58700000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0058 58800000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 005c 58900000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0060 58A00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0064 58B00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0068 58C00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 006c 58D00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0070 58E00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0074 58F00000\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 40] then { pass $testname } else { fail $testname } +} +proc do_h8300s_bitops1 {} { + set testname "bitops1s.s: h8300s bitops tests #1" + set x 0 + + gas_start "bitops1s.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 7608\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 7C007600\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 7E407600\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 6A100080\[^\n\]*\n +\[0-9\]+ +7600" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 6A300001\[^\n\]*\n +\[0-9\]+ +00007600" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 7208\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 7D007200\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 7F407200\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 6A180080\[^\n\]*\n +\[0-9\]+ +7200" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 6A380001\[^\n\]*\n +\[0-9\]+ +00007200" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 6298\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0032 7D006290\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0036 7F406290\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003a 6A180080\[^\n\]*\n +\[0-9\]+ +6290" { set x [expr $x+1] } + -re " +\[0-9\]+ 0040 6A380001\[^\n\]*\n +\[0-9\]+ +00006290" { set x [expr $x+1] } + -re " +\[0-9\]+ 0048 7688\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004a 7C007680\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004e 7E407680\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0052 6A100080\[^\n\]*\n +\[0-9\]+ +7680" { set x [expr $x+1] } + -re " +\[0-9\]+ 0058 6A300001\[^\n\]*\n +\[0-9\]+ +00007680" { set x [expr $x+1] } + -re " +\[0-9\]+ 0060 7788\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0062 7C007780\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0066 7E407780\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 006a 6A100080\[^\n\]*\n +\[0-9\]+ +7780" { set x [expr $x+1] } + -re " +\[0-9\]+ 0070 6A300001\[^\n\]*\n +\[0-9\]+ +00007780" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 25] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_bitops2 {} { + set testname "bitops2s.s: h8300s bitops tests #2" + set x 0 + + gas_start "bitops2s.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 7488\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 7C007480\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 7E407480\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 6A100080\[^\n\]*\n +\[0-9\]+ +7480" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 6A300001\[^\n\]*\n +\[0-9\]+ +00007480" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 6788\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 7D006780\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 7F406780\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 6A180080\[^\n\]*\n +\[0-9\]+ +6780" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 6A380001\[^\n\]*\n +\[0-9\]+ +00006780" { set x [expr $x+1] } + + -re " +\[0-9\]+ 0030 7588\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0032 7C007580\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0036 7E407580\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003a 6A100080\[^\n\]*\n +\[0-9\]+ +7580" { set x [expr $x+1] } + -re " +\[0-9\]+ 0040 6A300001\[^\n\]*\n +\[0-9\]+ +00007580" { set x [expr $x+1] } + -re " +\[0-9\]+ 0048 7708\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004a 7C007700\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004e 7E407700\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0052 6A100080\[^\n\]*\n +\[0-9\]+ +7700" { set x [expr $x+1] } + -re " +\[0-9\]+ 0058 6A300001\[^\n\]*\n +\[0-9\]+ +00007700" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 20] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_bitops3 {} { + set testname "bitops3s.s: h8300s bitops tests #3" + set x 0 + + gas_start "bitops3s.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 7108\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 7D007100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 7F407100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 6A180080\[^\n\]*\n +\[0-9\]+ +7100" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 6A380001\[^\n\]*\n +\[0-9\]+ +00007100" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 6198\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 7D006190\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 7F406190\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 6A180080\[^\n\]*\n +\[0-9\]+ +6190" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 6A380001\[^\n\]*\n +\[0-9\]+ +00006190" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 7008\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0032 7D007000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0036 7F407000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003a 6A180080\[^\n\]*\n +\[0-9\]+ +7000" { set x [expr $x+1] } + -re " +\[0-9\]+ 0040 6A380001\[^\n\]*\n +\[0-9\]+ +00007000" { set x [expr $x+1] } + -re " +\[0-9\]+ 0048 6098\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004a 7D006090\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004e 7F406090\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0052 6A180080\[^\n\]*\n +\[0-9\]+ +6090" { set x [expr $x+1] } + -re " +\[0-9\]+ 0058 6A380001\[^\n\]*\n +\[0-9\]+ +00006090" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 20] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_bitops4 {} { + set testname "bitops4s.s: h8300s bitops tests #4" + set x 0 + + gas_start "bitops4s.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 7408\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 7C007400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 7E407400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 6A100080\[^\n\]*\n +\[0-9\]+ +7400" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 6A300001\[^\n\]*\n +\[0-9\]+ +00007400" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 6708\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 7D006700\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 7F406700\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 6A180080\[^\n\]*\n +\[0-9\]+ +6700" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 6A380001\[^\n\]*\n +\[0-9\]+ +00006700" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 7308\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0032 7C007300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0036 7E407300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003a 6A100080\[^\n\]*\n +\[0-9\]+ +7300" { set x [expr $x+1] } + -re " +\[0-9\]+ 0040 6A300001\[^\n\]*\n +\[0-9\]+ +00007300" { set x [expr $x+1] } + -re " +\[0-9\]+ 0048 6398\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004a 7C006390\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004e 7E406390\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0052 6A100080\[^\n\]*\n +\[0-9\]+ +6390" { set x [expr $x+1] } + -re " +\[0-9\]+ 0058 6A300001\[^\n\]*\n +\[0-9\]+ +00006390" { set x [expr $x+1] } + -re " +\[0-9\]+ 0060 7508\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0062 7C007500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0066 7E407500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 006a 6A100080\[^\n\]*\n +\[0-9\]+ +7500" { set x [expr $x+1] } + -re " +\[0-9\]+ 0070 6A300001\[^\n\]*\n +\[0-9\]+ +00007500" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 25] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_branch {} { + set testname "branchs.s: h8300s branch tests" + set x 0 + + gas_start "branchs.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 5500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 5C000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 5A000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 5900\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 5B00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 5E000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 5D00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 5F00\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 8] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_compare {} { + set testname "compares.s: h8300s compare tests" + set x 0 + + gas_start "compares.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 A800\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 1C08\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 79200020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 1D01\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 7A200000\[^\n\]*\n +\[0-9\]+ +0040\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 1F81\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 6] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_decimal {} { + set testname "decimals.s: h8300s decimal tests" + set x 0 + + gas_start "decimals.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 0F08\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 1F08\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 2] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_incdec {} { + set testname "incdecs.s: h8300s incdec tests" + set x 0 + + gas_start "incdecs.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 1A08\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 1B50\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 1BD0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 1B70\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 1BF0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 0A08\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 0B50\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 0BD0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 0B70\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 0BF0\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 10] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_divmul {} { + set testname "divmuls.s: h8300s divmul tests" + set x 0 + + gas_start "divmuls.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 5181\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 5301\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 01D05181\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 01D05301\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 5081\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 5201\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 01C05081\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 01C05201\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 8] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_misc {} { + set testname "miscs.s: h8300s misc tests" + set x 0 + + gas_start "miscs.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 7B5C598F\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 7BD4598F\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 0700\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 0308\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 01410700\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 0318\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 01406900\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 01406F00\[^\n\]*\n +\[0-9\]+ +0010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c 01407800\[^\n\]*\n +\[0-9\]+ +6B200000\[^\n\]*\n +\[0-9\]+ +0020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0026 01406D00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002a 01406B00\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 01406B20\[^\n\]*\n +\[0-9\]+ +00000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0038 01416900\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003c 01416F00\[^\n\]*\n +\[0-9\]+ +0010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0042 01417800\[^\n\]*\n +\[0-9\]+ +6B200000\[^\n\]*\n +\[0-9\]+ +0020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004c 01416D00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0050 01416B00\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0056 01416B20\[^\n\]*\n +\[0-9\]+ +00000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 005e 0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0060 5670\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0062 5470\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0064 0180\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0066 0208\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0068 0218\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 006a 01406980\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 006e 01406F80\[^\n\]*\n +\[0-9\]+ +0010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0074 01407800\[^\n\]*\n +\[0-9\]+ +6BA00000\[^\n\]*\n +\[0-9\]+ +0020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 007e 01406D80\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0082 01406B80\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0088 01406BA0\[^\n\]*\n +\[0-9\]+ +00000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0090 01416980\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0094 01416F80\[^\n\]*\n +\[0-9\]+ +0010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 009a 01417800\[^\n\]*\n +\[0-9\]+ +6BA00000\[^\n\]*\n +\[0-9\]+ +0020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 00a4 01416D80\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 00a8 01416B80\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 00ae 01416BA0\[^\n\]*\n +\[0-9\]+ +00000000\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 36] then { pass $testname } else { fail $testname } + + setup_xfail "h8300*-*-*" + fail "h8300s movfpe/movtpe tests" +} + +proc do_h8300s_movb {} { + set testname "movbs.s: h8300s movb tests" + set x 0 + + gas_start "movbs.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 0C89\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 F810\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 6818\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 6E180010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 78106A28\[^\n\]*\n +\[0-9\]+ +00000020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 6C18\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 2810\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 6A080000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 6A280000\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 6898\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 6E980010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0026 78106AA8\[^\n\]*\n +\[0-9\]+ +00000020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002e 6C98\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 3810\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0032 6A880000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0036 6AA80000\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 16] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_movw {} { + set testname "movws.s: h8300s movw tests" + set x 0 + + gas_start "movws.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 0D01\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 79000010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 6910\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 6F100010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 78106B20\[^\n\]*\n +\[0-9\]+ +00000020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 6D10\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 6B000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 6B200000\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 6990\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 6F900010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0026 78106BA0\[^\n\]*\n +\[0-9\]+ +00000020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002e 6D90\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 6B800000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0034 6BA00000\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 14] then { pass $testname } else { fail $testname } +} + + +proc do_h8300s_movl {} { + set testname "movls.s: h8300s movl tests" + set x 0 + + gas_start "movls.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 0F81\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 7A000000\[^\n\]*\n +\[0-9\]+ +0040\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 01006910\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 01006F10\[^\n\]*\n +\[0-9\]+ +0010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 01007810\[^\n\]*\n +\[0-9\]+ +6B200000\[^\n\]*\n +\[0-9\]+ +0020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c 01006D10\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 01006B00\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0026 01006B20\[^\n\]*\n +\[0-9\]+ +00000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002e 01006990\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0032 01006F90\[^\n\]*\n +\[0-9\]+ +0010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0038 01007890\[^\n\]*\n +\[0-9\]+ +6BA00000\[^\n\]*\n +\[0-9\]+ +0020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0042 01006D90\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0046 01006B80\[^\n\]*\n +\[0-9\]+ +0000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004c 01006BA0\[^\n\]*\n +\[0-9\]+ +00000000\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 14] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_pushpop {} { + set testname "pushpops.s: h8300s pushpop tests" + set x 0 + + gas_start "pushpops.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 6D70\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 01006D70\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 6DF0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 01006DF0\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 4] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_rotate_shift {} { + set testname "rotshs.s: h8300s rotate and shift tests" + set x 0 + + gas_start "rotshs.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 1288\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 12C8\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 1290\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 12D0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 12B0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 12F0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 1388\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 13C8\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 1390\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 13D0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 13B0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 13F0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 1208\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 1248\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c 1210\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 1250\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 1230\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 1270\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 1308\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0026 1348\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 1310\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002a 1350\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002c 1330\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002e 1370\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 1088\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0032 10C8\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0034 1090\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0036 10D0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0038 10B0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003a 10F0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003c 1188\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003e 11C8\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0040 1190\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0042 11D0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0044 11B0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0046 11F0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0048 1008\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004a 1048\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004c 1010\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004e 1050\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0050 1030\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0052 1070\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0054 1108\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0056 1148\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0058 1110\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 005a 1150\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 005c 1130\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 005e 1170\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 48] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_extend {} { + set testname "extends.s: h8300s extend tests" + set x 0 + + gas_start "extends.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 17D0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 17F0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 1750\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 1770\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 4] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_mac {} { + set testname "macs.s: h8300s mac tests" + set x 0 + + gas_start "macs.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 01A0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 0320\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 0331\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 01606D01\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 0220\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 0231\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 6] then { pass $testname } else { fail $testname } +} + +proc do_h8300s_multiple {} { + set testname "multiples.s: h8300s multiple tests" + set x 0 + + gas_start "multiples.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 01106D71\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 01206D72\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 01306D73\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 01106DF0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 01206DF0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 01306DF0\[^\n\]*\n" { set x [expr $x+1] } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 6] then { pass $testname } else { fail $testname } +} + proc do_h8300h_mov32bug {} { set testname "mov32bug.s: h8300h mov32bug test" set x 0 @@ -1310,6 +2147,29 @@ do_h8300_pushpop do_h8300h_rotate_shift do_h8300h_extend + + # Now test the h8300s instruction parser + do_h8300s_add_sub + do_h8300s_logical + do_h8300s_cbranch + do_h8300s_bitops1 + do_h8300s_bitops2 + do_h8300s_bitops3 + do_h8300s_bitops4 + do_h8300s_branch + do_h8300s_compare + do_h8300s_decimal + do_h8300s_incdec + do_h8300s_divmul + do_h8300s_misc + do_h8300s_movb + do_h8300s_movw + do_h8300s_movl + do_h8300_pushpop + do_h8300s_rotate_shift + do_h8300s_extend + do_h8300s_mac + do_h8300s_multiple do_h8300h_mov32bug diff -urN binutils-2.7/gas/testsuite/gas/h8300/incdecs.s binutils-2.8/gas/testsuite/gas/h8300/incdecs.s --- binutils-2.7/gas/testsuite/gas/h8300/incdecs.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/incdecs.s Wed Apr 30 12:54:06 1997 @@ -0,0 +1,14 @@ + .h8300s + .text +h8300s_incdec: + dec.b r0l + dec.w #1,r0 + dec.w #2,r0 + dec.l #1,er0 + dec.l #2,er0 + inc.b r0l + inc.w #1,r0 + inc.w #2,r0 + inc.l #1,er0 + inc.l #2,er0 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/logicals.s binutils-2.8/gas/testsuite/gas/h8300/logicals.s --- binutils-2.7/gas/testsuite/gas/h8300/logicals.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/logicals.s Wed Apr 30 12:54:06 1997 @@ -0,0 +1,34 @@ + .h8300s + .text +h8300s_logical: + and.b #16,r1l + and.b r1l,r1h + and.w #32,r1 + and.w r1,r1 + and.l #64,er1 + and.l er1,er1 + andc #16,ccr + andc #16,exr + or.b #16,r0l + or.b r1l,r0l + or.w #32,r1 + or.w r1,r1 + or.l #64,er1 + or.l er1,er1 + orc #16,ccr + orc #16,exr + xor.b #16,r0l + xor.b r0l,r1l + xor.w #32,r1 + xor.w r1,r1 + xor.l #64,er1 + xor.l er1,er1 + xorc #16,ccr + xorc #16,exr + neg.b r0l + neg.w r0 + neg.l er0 + not.b r0l + not.w r0 + not.l er0 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/macs.s binutils-2.8/gas/testsuite/gas/h8300/macs.s --- binutils-2.7/gas/testsuite/gas/h8300/macs.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/macs.s Wed Apr 30 12:54:06 1997 @@ -0,0 +1,11 @@ + .h8300s + .text +h8300s_mac: + clrmac + ldmac er0,mach + ldmac er1,macl + mac @er0+,@er1+ + stmac mach,er0 + stmac macl,er1 + + diff -urN binutils-2.7/gas/testsuite/gas/h8300/misch.s binutils-2.8/gas/testsuite/gas/h8300/misch.s --- binutils-2.7/gas/testsuite/gas/h8300/misch.s Thu Jul 4 12:15:22 1996 +++ binutils-2.8/gas/testsuite/gas/h8300/misch.s Wed Apr 30 12:54:06 1997 @@ -2,7 +2,7 @@ .text h8300h_misc: eepmov.b -; eepmov.w + eepmov.w ldc.b #0,ccr ldc.b r0l,ccr ldc.w @er0,ccr diff -urN binutils-2.7/gas/testsuite/gas/h8300/miscs.s binutils-2.8/gas/testsuite/gas/h8300/miscs.s --- binutils-2.7/gas/testsuite/gas/h8300/miscs.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/miscs.s Wed Apr 30 12:54:06 1997 @@ -0,0 +1,41 @@ + .h8300s + .text +h8300s_misc: + eepmov.b + eepmov.w + ldc.b #0,ccr + ldc.b r0l,ccr + ldc.b #0,exr + ldc.b r0l,exr + ldc.w @er0,ccr + ldc.w @(16:16,er0),ccr + ldc.w @(32:32,er0),ccr + ldc.w @er0+,ccr + ldc.w @h8300s_misc:16,ccr + ldc.w @h8300s_misc:32,ccr + ldc.w @er0,exr + ldc.w @(16:16,er0),exr + ldc.w @(32:32,er0),exr + ldc.w @er0+,exr + ldc.w @h8300s_misc:16,exr + ldc.w @h8300s_misc:32,exr +; movfpe 16:16,r0l +; movtpe r0l,16:16 + nop + rte + rts + sleep + stc.b ccr,r0l + stc.b exr,r0l + stc.w ccr,@er0 + stc.w ccr,@(16:16,er0) + stc.w ccr,@(32:32,er0) + stc.w ccr,@-er0 + stc.w ccr,@h8300s_misc:16 + stc.w ccr,@h8300s_misc:32 + stc.w exr,@er0 + stc.w exr,@(16:16,er0) + stc.w exr,@(32:32,er0) + stc.w exr,@-er0 + stc.w exr,@h8300s_misc:16 + stc.w exr,@h8300s_misc:32 diff -urN binutils-2.7/gas/testsuite/gas/h8300/movbs.s binutils-2.8/gas/testsuite/gas/h8300/movbs.s --- binutils-2.7/gas/testsuite/gas/h8300/movbs.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/movbs.s Wed Apr 30 12:54:07 1997 @@ -0,0 +1,20 @@ + .h8300s + .text +h8300s_movb: + mov.b r0l,r1l + mov.b #16,r0l + mov.b @er1,r0l + mov.b @(16:16,er1),r0l + mov.b @(32:32,er1),r0l + mov.b @er1+,r0l + mov.b @16:8,r0l + mov.b @h8300s_movb:16,r0l + mov.b @h8300s_movb:32,r0l + mov.b r0l,@er1 + mov.b r0l,@(16:16,er1) + mov.b r0l,@(32:32,er1) + mov.b r0l,@-er1 + mov.b r0l,@16:8 + mov.b r0l,@h8300s_movb:16 + mov.b r0l,@h8300s_movb:32 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/movls.s binutils-2.8/gas/testsuite/gas/h8300/movls.s --- binutils-2.7/gas/testsuite/gas/h8300/movls.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/movls.s Wed Apr 30 12:54:07 1997 @@ -0,0 +1,18 @@ + .h8300s + .text +h8300s_movl: + mov.l er0,er1 + mov.l #64,er0 + mov.l @er1,er0 + mov.l @(16:16,er1),er0 + mov.l @(32:32,er1),er0 + mov.l @er1+,er0 + mov.l @h8300s_movl:16,er0 + mov.l @h8300s_movl:32,er0 + mov.l er0,@er1 + mov.l er0,@(16:16,er1) + mov.l er0,@(32:32,er1) + mov.l er0,@-er1 + mov.l er0,@h8300s_movl:16 + mov.l er0,@h8300s_movl:32 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/movws.s binutils-2.8/gas/testsuite/gas/h8300/movws.s --- binutils-2.7/gas/testsuite/gas/h8300/movws.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/movws.s Wed Apr 30 12:54:07 1997 @@ -0,0 +1,18 @@ + .h8300s + .text +h8300s_movw: + mov.w r0,r1 + mov.w #16,r0 + mov.w @er1,r0 + mov.w @(16:16,er1),r0 + mov.w @(32:32,er1),r0 + mov.w @er1+,r0 + mov.w @h8300s_movw:16,r0 + mov.w @h8300s_movw:32,r0 + mov.w r0,@er1 + mov.w r0,@(16:16,er1) + mov.w r0,@(32:32,er1) + mov.w r0,@-er1 + mov.w r0,@h8300s_movw:16 + mov.w r0,@h8300s_movw:32 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/multiples.s binutils-2.8/gas/testsuite/gas/h8300/multiples.s --- binutils-2.7/gas/testsuite/gas/h8300/multiples.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/multiples.s Wed Apr 30 12:53:59 1997 @@ -0,0 +1,10 @@ + .h8300s + .text +h8300s_multiple: + ldm.l @sp+,er0-er1 + ldm.l @sp+,er0-er2 + ldm.l @sp+,er0-er3 + stm.l er0-er1,@-sp + stm.l er0-er2,@-sp + stm.l er0-er3,@-sp + diff -urN binutils-2.7/gas/testsuite/gas/h8300/pushpops.s binutils-2.8/gas/testsuite/gas/h8300/pushpops.s --- binutils-2.7/gas/testsuite/gas/h8300/pushpops.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/pushpops.s Wed Apr 30 12:54:07 1997 @@ -0,0 +1,8 @@ + .h8300s + .text +h8300s_push_pop: + pop.w r0 + pop.l er0 + push.w r0 + push.l er0 + diff -urN binutils-2.7/gas/testsuite/gas/h8300/rotshs.s binutils-2.8/gas/testsuite/gas/h8300/rotshs.s --- binutils-2.7/gas/testsuite/gas/h8300/rotshs.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/h8300/rotshs.s Wed Apr 30 12:54:07 1997 @@ -0,0 +1,51 @@ + .h8300s + .text +h8300s_rotate_shift: + rotl.b r0l + rotl.b #2,r0l + rotl.w r0 + rotl.w #2,r0 + rotl.l er0 + rotl.l #2,er0 + rotr.b r0l + rotr.b #2,r0l + rotr.w r0 + rotr.w #2,r0 + rotr.l er0 + rotr.l #2,er0 + rotxl.b r0l + rotxl.b #2,r0l + rotxl.w r0 + rotxl.w #2,r0 + rotxl.l er0 + rotxl.l #2,er0 + rotxr.b r0l + rotxr.b #2,r0l + rotxr.w r0 + rotxr.w #2,r0 + rotxr.l er0 + rotxr.l #2,er0 + shal.b r0l + shal.b #2,r0l + shal.w r0 + shal.w #2,r0 + shal.l er0 + shal.l #2,er0 + shar.b r0l + shar.b #2,r0l + shar.w r0 + shar.w #2,r0 + shar.l er0 + shar.l #2,er0 + shll.b r0l + shll.b #2,r0l + shll.w r0 + shll.w #2,r0 + shll.l er0 + shll.l #2,er0 + shlr.b r0l + shlr.b #2,r0l + shlr.w r0 + shlr.w #2,r0 + shlr.l er0 + shlr.l #2,er0 diff -urN binutils-2.7/gas/testsuite/gas/hppa/basic/basic.exp binutils-2.8/gas/testsuite/gas/hppa/basic/basic.exp --- binutils-2.7/gas/testsuite/gas/hppa/basic/basic.exp Thu Jul 4 12:15:26 1996 +++ binutils-2.8/gas/testsuite/gas/hppa/basic/basic.exp Wed Apr 30 12:54:09 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1993 Free Software Foundation, Inc. +# Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # DejaGnu@cygnus.com @@ -1503,9 +1503,9 @@ -re "^ +\[0-9\]+ 0054 04A41326\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0058 04A41306\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 005c 04A41040\[^\n]*\n" { set x [expr $x+1] } - -re "^ +\[0-9\]+ 0060 04A40040\[^\n]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0060 04A42040\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0064 04A41000\[^\n]*\n" { set x [expr $x+1] } - -re "^ +\[0-9\]+ 0068 04A40000\[^\n]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0068 04A42000\[^\n]*\n" { set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } @@ -1537,22 +1537,22 @@ expect { -re "^ +\[0-9\]+ 0000 04A41200\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0004 04A41220\[^\n]*\n" { set x [expr $x+1] } - -re "^ +\[0-9\]+ 0008 04A40200\[^\n]*\n" { set x [expr $x+1] } - -re "^ +\[0-9\]+ 000c 04A40220\[^\n]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 04A42200\[^\n]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c 04A42220\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0010 04A41240\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0014 04A41260\[^\n]*\n" { set x [expr $x+1] } - -re "^ +\[0-9\]+ 0018 04A40240\[^\n]*\n" { set x [expr $x+1] } - -re "^ +\[0-9\]+ 001c 04A40260\[^\n]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0018 04A42240\[^\n]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c 04A42260\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0020 04A41380\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0024 04A413A0\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0028 04A41280\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 002c 04A412A0\[^\n]*\n" { set x [expr $x+1] } - -re "^ +\[0-9\]+ 0030 04A40280\[^\n]*\n" { set x [expr $x+1] } - -re "^ +\[0-9\]+ 0034 04A402A0\[^\n]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0030 04A42280\[^\n]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0034 04A422A0\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0038 04A412C0\[^\n]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 003c 04A412E0\[^\n]*\n" { set x [expr $x+1] } - -re "^ +\[0-9\]+ 0040 04A402C0\[^\n]*\n" { set x [expr $x+1] } - -re "^ +\[0-9\]+ 0044 04A402E0\[^\n]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0040 04A422C0\[^\n]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0044 04A422E0\[^\n]*\n" { set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } diff -urN binutils-2.7/gas/testsuite/gas/hppa/basic/purge.s binutils-2.8/gas/testsuite/gas/hppa/basic/purge.s --- binutils-2.7/gas/testsuite/gas/hppa/basic/purge.s Thu Jul 4 12:15:28 1996 +++ binutils-2.8/gas/testsuite/gas/hppa/basic/purge.s Wed Apr 30 12:54:11 1997 @@ -16,20 +16,20 @@ ; selectors to make sure they're handled correctly. pdtlb %r4(%sr0,%r5) pdtlb,m %r4(%sr0,%r5) - pitlb %r4(%sr0,%r5) - pitlb,m %r4(%sr0,%r5) + pitlb %r4(%sr4,%r5) + pitlb,m %r4(%sr4,%r5) pdtlbe %r4(%sr0,%r5) pdtlbe,m %r4(%sr0,%r5) - pitlbe %r4(%sr0,%r5) - pitlbe,m %r4(%sr0,%r5) + pitlbe %r4(%sr4,%r5) + pitlbe,m %r4(%sr4,%r5) pdc %r4(%sr0,%r5) pdc,m %r4(%sr0,%r5) fdc %r4(%sr0,%r5) fdc,m %r4(%sr0,%r5) - fic %r4(%sr0,%r5) - fic,m %r4(%sr0,%r5) + fic %r4(%sr4,%r5) + fic,m %r4(%sr4,%r5) fdce %r4(%sr0,%r5) fdce,m %r4(%sr0,%r5) - fice %r4(%sr0,%r5) - fice,m %r4(%sr0,%r5) + fice %r4(%sr4,%r5) + fice,m %r4(%sr4,%r5) diff -urN binutils-2.7/gas/testsuite/gas/hppa/basic/system.s binutils-2.8/gas/testsuite/gas/hppa/basic/system.s --- binutils-2.7/gas/testsuite/gas/hppa/basic/system.s Thu Jul 4 12:15:29 1996 +++ binutils-2.8/gas/testsuite/gas/hppa/basic/system.s Wed Apr 30 12:54:12 1997 @@ -41,6 +41,6 @@ lci %r4(%sr0,%r5),%r6 idtlba %r4,(%sr0,%r5) - iitlba %r4,(%sr0,%r5) + iitlba %r4,(%sr4,%r5) idtlbp %r4,(%sr0,%r5) - iitlbp %r4,(%sr0,%r5) + iitlbp %r4,(%sr4,%r5) diff -urN binutils-2.7/gas/testsuite/gas/hppa/parse/parse.exp binutils-2.8/gas/testsuite/gas/hppa/parse/parse.exp --- binutils-2.7/gas/testsuite/gas/hppa/parse/parse.exp Thu Jul 4 12:15:33 1996 +++ binutils-2.8/gas/testsuite/gas/hppa/parse/parse.exp Wed Apr 30 12:54:15 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1993 Free Software Foundation, Inc. +# Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # DejaGnu@cygnus.com diff -urN binutils-2.7/gas/testsuite/gas/hppa/reloc/reloc.exp binutils-2.8/gas/testsuite/gas/hppa/reloc/reloc.exp --- binutils-2.7/gas/testsuite/gas/hppa/reloc/reloc.exp Thu Jul 4 12:15:40 1996 +++ binutils-2.8/gas/testsuite/gas/hppa/reloc/reloc.exp Wed Apr 30 12:54:17 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1993 Free Software Foundation, Inc. +# Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # DejaGnu@cygnus.com @@ -507,7 +507,7 @@ set testname "funcrelocbug.s: Test for reloc bug in non-plabel function reference (part3)" set x 0 - objdump_start_no_subdir "a.out" "-d" + objdump_start_no_subdir "a.out" "--prefix-addresses -d" # Make sure we didn't put anything in the instruction itself! while 1 { expect { diff -urN binutils-2.7/gas/testsuite/gas/hppa/unsorted/unsorted.exp binutils-2.8/gas/testsuite/gas/hppa/unsorted/unsorted.exp --- binutils-2.7/gas/testsuite/gas/hppa/unsorted/unsorted.exp Thu Jul 4 12:15:46 1996 +++ binutils-2.8/gas/testsuite/gas/hppa/unsorted/unsorted.exp Wed Apr 30 12:54:19 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1993 Free Software Foundation, Inc. +# Copyright (C) 1993, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # DejaGnu@cygnus.com @@ -89,7 +89,7 @@ set x 0 if [gas_test_old "fragbug.s" "" "Test bug in frag chaining (part1)"] { - objdump_start_no_subdir "a.out" "-d" + objdump_start_no_subdir "a.out" "--prefix-addresses -d" while 1 { expect { @@ -115,7 +115,7 @@ set x 0 if [gas_test_old "align3.s" "" "Test for alignment bug when switching subspaces (part1)"] { - objdump_start_no_subdir "a.out" "-d" + objdump_start_no_subdir "a.out" "--prefix-addresses -d" while 1 { expect { @@ -150,9 +150,9 @@ while 1 { expect { - -re "\[^\n\]*YABBA\[^\n\]*2..3\[^\n\]*\n" - { set x [expr $x+1] } -re "\[^\n\]*MILLICODE\[^\n\]*2..6\[^\n\]*\n" + { set x [expr $x+1] } + -re "\[^\n\]*YABBA\[^\n\]*2..3\[^\n\]*\n" { set x [expr $x+1] } timeout { perror "timeout\n"; break } eof { break } diff -urN binutils-2.7/gas/testsuite/gas/m32r/allinsn.d binutils-2.8/gas/testsuite/gas/m32r/allinsn.d --- binutils-2.7/gas/testsuite/gas/m32r/allinsn.d Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/m32r/allinsn.d Wed Apr 30 12:54:21 1997 @@ -0,0 +1,377 @@ +#as: +#objdump: -dr +#name: allinsn + +.*: +file format .* + +Disassembly of section .text: + +00000000 : + 0: 0d ad f0 00 add fp,fp || nop + +00000004 : + 4: 8d ad 00 00 add3 fp,fp,0 + +00000008 : + 8: 0d cd f0 00 and fp,fp || nop + +0000000c : + c: 8d cd 00 00 and3 fp,fp,0x0 + +00000010 : + 10: 0d ed f0 00 or fp,fp || nop + +00000014 : + 14: 8d ed 00 00 or3 fp,fp,0x0 + +00000018 : + 18: 0d dd f0 00 xor fp,fp || nop + +0000001c : + 1c: 8d dd 00 00 xor3 fp,fp,0x0 + +00000020 : + 20: 4d 00 f0 00 addi fp,0 || nop + +00000024 : + 24: 0d 8d f0 00 addv fp,fp || nop + +00000028 : + 28: 8d 8d 00 00 addv3 fp,fp,0 + +0000002c : + 2c: 0d 9d f0 00 addx fp,fp || nop + +00000030 : + 30: 7c f4 f0 00 bc 0 || nop + +00000034 : + 34: 7c f3 f0 00 bc 0 || nop + +00000038 : + 38: 7c f2 f0 00 bc 0 || nop + +0000003c : + 3c: fc ff ff f1 bc 0 + +00000040 : + 40: bd 0d ff f0 beq fp,fp,0 + +00000044 : + 44: b0 8d ff ef beqz fp,0 + +00000048 : + 48: b0 bd ff ee bgez fp,0 + +0000004c : + 4c: b0 dd ff ed bgtz fp,0 + +00000050 : + 50: b0 cd ff ec blez fp,0 + +00000054 : + 54: b0 ad ff eb bltz fp,0 + +00000058 : + 58: b0 9d ff ea bnez fp,0 + +0000005c : + 5c: 7e e9 f0 00 bl 0 || nop + +00000060 : + 60: 7e e8 f0 00 bl 0 || nop + +00000064 : + 64: 7e e7 f0 00 bl 0 || nop + +00000068 : + 68: fe ff ff e6 bl 0 + +0000006c : + 6c: 7d e5 f0 00 bnc 0 || nop + +00000070 : + 70: 7d e4 f0 00 bnc 0 || nop + +00000074 : + 74: 7d e3 f0 00 bnc 0 || nop + +00000078 : + 78: fd ff ff e2 bnc 0 + +0000007c : + 7c: bd 1d ff e1 bne fp,fp,0 + +00000080 : + 80: 7f e0 f0 00 bra 0 || nop + +00000084 : + 84: 7f df f0 00 bra 0 || nop + +00000088 : + 88: 7f de f0 00 bra 0 || nop + +0000008c : + 8c: ff ff ff dd bra 0 + +00000090 : + 90: 0d 4d f0 00 cmp fp,fp || nop + +00000094 : + 94: 80 4d 00 00 cmpi fp,0 + +00000098 : + 98: 0d 5d f0 00 cmpu fp,fp || nop + +0000009c : + 9c: 80 5d 00 00 cmpui fp,0 + +000000a0
: + a0: 9d 0d 00 00 div fp,fp + +000000a4 : + a4: 9d 1d 00 00 divu fp,fp + +000000a8 : + a8: 9d 2d 00 00 rem fp,fp + +000000ac : + ac: 9d 3d 00 00 remu fp,fp + +000000b0 : + b0: 1e cd f0 00 jl fp || nop + +000000b4 : + b4: 1f cd f0 00 jmp fp || nop + +000000b8 : + b8: 2d cd f0 00 ld fp,@fp || nop + +000000bc : + bc: 2d cd f0 00 ld fp,@fp || nop + +000000c0 : + c0: ad cd 00 00 ld fp,@\(0,fp\) + +000000c4 : + c4: ad cd 00 00 ld fp,@\(0,fp\) + +000000c8 : + c8: 2d 8d f0 00 ldb fp,@fp || nop + +000000cc : + cc: 2d 8d f0 00 ldb fp,@fp || nop + +000000d0 : + d0: ad 8d 00 00 ldb fp,@\(0,fp\) + +000000d4 : + d4: ad 8d 00 00 ldb fp,@\(0,fp\) + +000000d8 : + d8: 2d ad f0 00 ldh fp,@fp || nop + +000000dc : + dc: 2d ad f0 00 ldh fp,@fp || nop + +000000e0 : + e0: ad ad 00 00 ldh fp,@\(0,fp\) + +000000e4 : + e4: ad ad 00 00 ldh fp,@\(0,fp\) + +000000e8 : + e8: 2d 9d f0 00 ldub fp,@fp || nop + +000000ec : + ec: 2d 9d f0 00 ldub fp,@fp || nop + +000000f0 : + f0: ad 9d 00 00 ldub fp,@\(0,fp\) + +000000f4 : + f4: ad 9d 00 00 ldub fp,@\(0,fp\) + +000000f8 : + f8: 2d bd f0 00 lduh fp,@fp || nop + +000000fc : + fc: 2d bd f0 00 lduh fp,@fp || nop + +00000100 : + 100: ad bd 00 00 lduh fp,@\(0,fp\) + +00000104 : + 104: ad bd 00 00 lduh fp,@\(0,fp\) + +00000108 : + 108: 2d ed f0 00 ld fp,@fp\+ || nop + +0000010c : + 10c: ed 00 00 00 ld24 fp,0 + 10c: R_M32R_24 .data + +00000110 : + 110: 6d 00 f0 00 ldi fp,0 || nop + +00000114 : + 114: 6d 00 f0 00 ldi fp,0 || nop + +00000118 : + 118: 6d 00 f0 00 ldi fp,0 || nop + +0000011c : + 11c: 9d f0 00 00 ldi fp,0 + +00000120 : + 120: 2d dd f0 00 lock fp,@fp || nop + +00000124 : + 124: 3d 4d f0 00 machi fp,fp || nop + +00000128 : + 128: 3d 5d f0 00 maclo fp,fp || nop + +0000012c : + 12c: 3d 6d f0 00 macwhi fp,fp || nop + +00000130 : + 130: 3d 7d f0 00 macwlo fp,fp || nop + +00000134 : + 134: 1d 6d f0 00 mul fp,fp || nop + +00000138 : + 138: 3d 0d f0 00 mulhi fp,fp || nop + +0000013c : + 13c: 3d 1d f0 00 mullo fp,fp || nop + +00000140 : + 140: 3d 2d f0 00 mulwhi fp,fp || nop + +00000144 : + 144: 3d 3d f0 00 mulwlo fp,fp || nop + +00000148 : + 148: 1d 8d f0 00 mv fp,fp || nop + +0000014c : + 14c: 5d f0 f0 00 mvfachi fp || nop + +00000150 : + 150: 5d f1 f0 00 mvfaclo fp || nop + +00000154 : + 154: 5d f2 f0 00 mvfacmi fp || nop + +00000158 : + 158: 1d 90 f0 00 mvfc fp,psw || nop + +0000015c : + 15c: 5d 70 f0 00 mvtachi fp || nop + +00000160 : + 160: 5d 71 f0 00 mvtaclo fp || nop + +00000164 : + 164: 10 ad f0 00 mvtc fp,psw || nop + +00000168 : + 168: 0d 3d f0 00 neg fp,fp || nop + +0000016c : + 16c: 0d bd f0 00 not fp,fp || nop + +00000170 : + 170: dd c0 00 00 seth fp,0x0 + +00000174 : + 174: 1d 4d f0 00 sll fp,fp || nop + +00000178 : + 178: 9d cd 00 00 sll3 fp,fp,0 + +0000017c : + 17c: 5d 40 f0 00 slli fp,0x0 || nop + +00000180 : + 180: 1d 2d f0 00 sra fp,fp || nop + +00000184 : + 184: 9d ad 00 00 sra3 fp,fp,0 + +00000188 : + 188: 5d 20 f0 00 srai fp,0x0 || nop + +0000018c : + 18c: 1d 0d f0 00 srl fp,fp || nop + +00000190 : + 190: 9d 8d 00 00 srl3 fp,fp,0 + +00000194 : + 194: 5d 00 f0 00 srli fp,0x0 || nop + +00000198 : + 198: 2d 4d f0 00 st fp,@fp || nop + +0000019c : + 19c: 2d 4d f0 00 st fp,@fp || nop + +000001a0 : + 1a0: ad 4d 00 00 st fp,@\(0,fp\) + +000001a4 : + 1a4: ad 4d 00 00 st fp,@\(0,fp\) + +000001a8 : + 1a8: 2d 0d f0 00 stb fp,@fp || nop + +000001ac : + 1ac: 2d 0d f0 00 stb fp,@fp || nop + +000001b0 : + 1b0: ad 0d 00 00 stb fp,@\(0,fp\) + +000001b4 : + 1b4: ad 0d 00 00 stb fp,@\(0,fp\) + +000001b8 : + 1b8: 2d 2d f0 00 sth fp,@fp || nop + +000001bc : + 1bc: 2d 2d f0 00 sth fp,@fp || nop + +000001c0 : + 1c0: ad 2d 00 00 sth fp,@\(0,fp\) + +000001c4 : + 1c4: ad 2d 00 00 sth fp,@\(0,fp\) + +000001c8 : + 1c8: 2d 6d f0 00 st fp,@\+fp || nop + +000001cc : + 1cc: 2d 7d f0 00 st fp,@-fp || nop + +000001d0 : + 1d0: 0d 2d f0 00 sub fp,fp || nop + +000001d4 : + 1d4: 0d 0d f0 00 subv fp,fp || nop + +000001d8 : + 1d8: 0d 1d f0 00 subx fp,fp || nop + +000001dc : + 1dc: 10 f0 f0 00 trap 0x0 || nop + +000001e0 : + 1e0: 2d 5d f0 00 unlock fp,@fp || nop + +000001e4 : + 1e4: 2d 7f f0 00 st fp,@-sp || nop + +000001e8 : + 1e8: 2d ef f0 00 ld fp,@sp\+ || nop diff -urN binutils-2.7/gas/testsuite/gas/m32r/allinsn.exp binutils-2.8/gas/testsuite/gas/m32r/allinsn.exp --- binutils-2.7/gas/testsuite/gas/m32r/allinsn.exp Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/m32r/allinsn.exp Wed Apr 30 12:54:21 1997 @@ -0,0 +1,5 @@ +# M32R assembler testsuite. + +if [istarget m32r*-*-*] { + run_dump_test "allinsn" +} diff -urN binutils-2.7/gas/testsuite/gas/m32r/allinsn.s binutils-2.8/gas/testsuite/gas/m32r/allinsn.s --- binutils-2.7/gas/testsuite/gas/m32r/allinsn.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/m32r/allinsn.s Wed Apr 30 12:54:21 1997 @@ -0,0 +1,508 @@ + .data +foodata: .word 42 + .text +footext: + .text + .global add +add: + add fp,fp + .text + .global add3 +add3: + add3 fp,fp,0 + .text + .global and +and: + and fp,fp + .text + .global and3 +and3: + and3 fp,fp,0 + .text + .global or +or: + or fp,fp + .text + .global or3 +or3: + or3 fp,fp,0 + .text + .global xor +xor: + xor fp,fp + .text + .global xor3 +xor3: + xor3 fp,fp,0 + .text + .global addi +addi: + addi fp,0 + .text + .global addv +addv: + addv fp,fp + .text + .global addv3 +addv3: + addv3 fp,fp,0 + .text + .global addx +addx: + addx fp,fp + .text + .global bc8 +bc8: + bc footext + .text + .global bc8_s +bc8_s: + bc.s footext + .text + .global bc24 +bc24: + bc footext + .text + .global bc24_l +bc24_l: + bc.l footext + .text + .global beq +beq: + beq fp,fp,footext + .text + .global beqz +beqz: + beqz fp,footext + .text + .global bgez +bgez: + bgez fp,footext + .text + .global bgtz +bgtz: + bgtz fp,footext + .text + .global blez +blez: + blez fp,footext + .text + .global bltz +bltz: + bltz fp,footext + .text + .global bnez +bnez: + bnez fp,footext + .text + .global bl8 +bl8: + bl footext + .text + .global bl8_s +bl8_s: + bl.s footext + .text + .global bl24 +bl24: + bl footext + .text + .global bl24_l +bl24_l: + bl.l footext + .text + .global bnc8 +bnc8: + bnc footext + .text + .global bnc8_s +bnc8_s: + bnc.s footext + .text + .global bnc24 +bnc24: + bnc footext + .text + .global bnc24_l +bnc24_l: + bnc.l footext + .text + .global bne +bne: + bne fp,fp,footext + .text + .global bra8 +bra8: + bra footext + .text + .global bra8_s +bra8_s: + bra.s footext + .text + .global bra24 +bra24: + bra footext + .text + .global bra24_l +bra24_l: + bra.l footext + .text + .global cmp +cmp: + cmp fp,fp + .text + .global cmpi +cmpi: + cmpi fp,0 + .text + .global cmpu +cmpu: + cmpu fp,fp + .text + .global cmpui +cmpui: + cmpui fp,0 + .text + .global div +div: + div fp,fp + .text + .global divu +divu: + divu fp,fp + .text + .global rem +rem: + rem fp,fp + .text + .global remu +remu: + remu fp,fp + .text + .global jl +jl: + jl fp + .text + .global jmp +jmp: + jmp fp + .text + .global ld +ld: + ld fp,@fp + .text + .global ld_2 +ld_2: + ld fp,@(fp) + .text + .global ld_d +ld_d: + ld fp,@(0,fp) + .text + .global ld_d2 +ld_d2: + ld fp,@(fp,0) + .text + .global ldb +ldb: + ldb fp,@fp + .text + .global ldb_2 +ldb_2: + ldb fp,@(fp) + .text + .global ldb_d +ldb_d: + ldb fp,@(0,fp) + .text + .global ldb_d2 +ldb_d2: + ldb fp,@(fp,0) + .text + .global ldh +ldh: + ldh fp,@fp + .text + .global ldh_2 +ldh_2: + ldh fp,@(fp) + .text + .global ldh_d +ldh_d: + ldh fp,@(0,fp) + .text + .global ldh_d2 +ldh_d2: + ldh fp,@(fp,0) + .text + .global ldub +ldub: + ldub fp,@fp + .text + .global ldub_2 +ldub_2: + ldub fp,@(fp) + .text + .global ldub_d +ldub_d: + ldub fp,@(0,fp) + .text + .global ldub_d2 +ldub_d2: + ldub fp,@(fp,0) + .text + .global lduh +lduh: + lduh fp,@fp + .text + .global lduh_2 +lduh_2: + lduh fp,@(fp) + .text + .global lduh_d +lduh_d: + lduh fp,@(0,fp) + .text + .global lduh_d2 +lduh_d2: + lduh fp,@(fp,0) + .text + .global ld_plus +ld_plus: + ld fp,@fp+ + .text + .global ld24 +ld24: + ld24 fp,foodata + .text + .global ldi8 +ldi8: + ldi fp,0 + .text + .global ldi8a +ldi8a: + ldi8 fp,0 + .text + .global ldi16 +ldi16: + ldi fp,0 + .text + .global ldi16a +ldi16a: + ldi16 fp,0 + .text + .global lock +lock: + lock fp,@fp + .text + .global machi +machi: + machi fp,fp + .text + .global maclo +maclo: + maclo fp,fp + .text + .global macwhi +macwhi: + macwhi fp,fp + .text + .global macwlo +macwlo: + macwlo fp,fp + .text + .global mul +mul: + mul fp,fp + .text + .global mulhi +mulhi: + mulhi fp,fp + .text + .global mullo +mullo: + mullo fp,fp + .text + .global mulwhi +mulwhi: + mulwhi fp,fp + .text + .global mulwlo +mulwlo: + mulwlo fp,fp + .text + .global mv +mv: + mv fp,fp + .text + .global mvfachi +mvfachi: + mvfachi fp + .text + .global mvfaclo +mvfaclo: + mvfaclo fp + .text + .global mvfacmi +mvfacmi: + mvfacmi fp + .text + .global mvfc +mvfc: + mvfc fp,psw + .text + .global mvtachi +mvtachi: + mvtachi fp + .text + .global mvtaclo +mvtaclo: + mvtaclo fp + .text + .global mvtc +mvtc: + mvtc fp,psw + .text + .global neg +neg: + neg fp,fp + .text + .global nop +nop: + .text + .global not +not: + not fp,fp + .text + .global rac +rac: + .text + .global rach +rach: + .text + .global rte +rte: + .text + .global seth +seth: + seth fp,0 + .text + .global sll +sll: + sll fp,fp + .text + .global sll3 +sll3: + sll3 fp,fp,0 + .text + .global slli +slli: + slli fp,0 + .text + .global sra +sra: + sra fp,fp + .text + .global sra3 +sra3: + sra3 fp,fp,0 + .text + .global srai +srai: + srai fp,0 + .text + .global srl +srl: + srl fp,fp + .text + .global srl3 +srl3: + srl3 fp,fp,0 + .text + .global srli +srli: + srli fp,0 + .text + .global st +st: + st fp,@fp + .text + .global st_2 +st_2: + st fp,@(fp) + .text + .global st_d +st_d: + st fp,@(0,fp) + .text + .global st_d2 +st_d2: + st fp,@(fp,0) + .text + .global stb +stb: + stb fp,@fp + .text + .global stb_2 +stb_2: + stb fp,@(fp) + .text + .global stb_d +stb_d: + stb fp,@(0,fp) + .text + .global stb_d2 +stb_d2: + stb fp,@(fp,0) + .text + .global sth +sth: + sth fp,@fp + .text + .global sth_2 +sth_2: + sth fp,@(fp) + .text + .global sth_d +sth_d: + sth fp,@(0,fp) + .text + .global sth_d2 +sth_d2: + sth fp,@(fp,0) + .text + .global st_plus +st_plus: + st fp,@+fp + .text + .global st_minus +st_minus: + st fp,@-fp + .text + .global sub +sub: + sub fp,fp + .text + .global subv +subv: + subv fp,fp + .text + .global subx +subx: + subx fp,fp + .text + .global trap +trap: + trap 0 + .text + .global unlock +unlock: + unlock fp,@fp + .text + .global push +push: + push fp + .text + .global pop +pop: + pop fp diff -urN binutils-2.7/gas/testsuite/gas/m68k/all.exp binutils-2.8/gas/testsuite/gas/m68k/all.exp --- binutils-2.7/gas/testsuite/gas/m68k/all.exp Thu Jul 4 12:15:48 1996 +++ binutils-2.8/gas/testsuite/gas/m68k/all.exp Wed Apr 30 12:54:22 1997 @@ -10,14 +10,7 @@ gas_test_error "p2410.s" "" "out-of-range 'bras'" - if [expr [istarget m68*-*-hpux*] || [istarget m68*-*-sun*] \ - || [istarget m68*-*-*aout*] \ - || [istarget m68*-*-coff*] \ - || [istarget m68*-*-vxworks*] \ - ] then { - run_dump_test "schwab" - } - + run_dump_test pcrel run_dump_test operands run_dump_test cas run_dump_test bitfield @@ -31,7 +24,7 @@ verbose "$comp_output" 3 fail $testname } else { - if [regexp_diff "err.out" "$srcdir$subdir/op68000.d"] then { + if [regexp_diff "err.out" "$srcdir/$subdir/op68000.d"] then { fail $testname } else { pass $testname diff -urN binutils-2.7/gas/testsuite/gas/m68k/bitfield.d binutils-2.8/gas/testsuite/gas/m68k/bitfield.d --- binutils-2.7/gas/testsuite/gas/m68k/bitfield.d Thu Jul 4 12:15:48 1996 +++ binutils-2.8/gas/testsuite/gas/m68k/bitfield.d Wed Apr 30 12:54:22 1997 @@ -1,4 +1,4 @@ -#objdump: -d +#objdump: -d --prefix-addresses #name: bitfield # Test handling of bitfield instruction operands. diff -urN binutils-2.7/gas/testsuite/gas/m68k/cas.d binutils-2.8/gas/testsuite/gas/m68k/cas.d --- binutils-2.7/gas/testsuite/gas/m68k/cas.d Thu Jul 4 12:15:48 1996 +++ binutils-2.8/gas/testsuite/gas/m68k/cas.d Wed Apr 30 12:54:22 1997 @@ -1,4 +1,4 @@ -#objdump: -d +#objdump: -d --prefix-addresses #name: cas # Test parsing of the operands of the cas instruction diff -urN binutils-2.7/gas/testsuite/gas/m68k/fmoveml.d binutils-2.8/gas/testsuite/gas/m68k/fmoveml.d --- binutils-2.7/gas/testsuite/gas/m68k/fmoveml.d Thu Jul 4 12:15:49 1996 +++ binutils-2.8/gas/testsuite/gas/m68k/fmoveml.d Wed Apr 30 12:54:22 1997 @@ -1,7 +1,7 @@ -#objdump: -d +#objdump: -d --prefix-addresses #name: fmoveml -# Test handling of fmoveml instruction. +# Test handling of fmoveml and fmovemx instructions. .*: +file format .* @@ -35,3 +35,26 @@ 0+078 fmoveml #1,%fpiar/%fpcr 0+080 fmoveml #1,%fpiar/%fpsr 0+088 fmoveml #1,%fpiar/%fpsr/%fpcr +0+090 fmovemx %fp1,%a0@ +0+094 fmovemx %fp4,%a0@ +0+098 fmovemx %fp7,%a0@ +0+09c fmovemx %fp1/%fp3,%a0@ +0+0a0 fmovemx %fp1-%fp4,%a0@ +0+0a4 fmovemx %fp0/%fp7,%a0@ +0+0a8 fmovemx %fp0-%fp7,%a0@ +0+0ac fmovemx %a0@,%fp0 +0+0b0 fmovemx %a0@,%fp1 +0+0b4 fmovemx %a0@,%fp7 +0+0b8 fmovemx %a0@,%fp0/%fp3 +0+0bc fmovemx %a0@,%fp0/%fp4 +0+0c0 fmovemx %a0@,%fp2-%fp4 +0+0c4 fmovemx %a0@,%fp1-%fp7 +0+0c8 fmovemx %fp0,%a0@- +0+0cc fmovemx %fp0-%fp7,%a0@- +0+0d0 fmovemx %fp0/%fp4,%a0@- +0+0d4 fmovemx %a0@\+,%fp7 +0+0d8 fmovemx %a0@\+,%fp0-%fp7 +0+0dc fmovemx %a0@\+,%fp3/%fp7 +0+0e0 fmovemx %d0,%a0@- +0+0e4 fmovemx %a0@\+,%d0 +0+0e8 fmovemx %fp1/%fp5,%a0@- diff -urN binutils-2.7/gas/testsuite/gas/m68k/fmoveml.s binutils-2.8/gas/testsuite/gas/m68k/fmoveml.s --- binutils-2.7/gas/testsuite/gas/m68k/fmoveml.s Thu Jul 4 12:15:49 1996 +++ binutils-2.8/gas/testsuite/gas/m68k/fmoveml.s Wed Apr 30 12:54:22 1997 @@ -1,4 +1,4 @@ -# Test handling of the fmoveml instruction. +# Test handling of the fmoveml and fmovemx instructions. .text .globl foo foo: @@ -31,3 +31,28 @@ fmoveml &1,%fpcr/%fpiar fmoveml &1,%fpsr/%fpiar fmoveml &1,%fpiar/%fpsr/%fpcr + + fmovemx %fp1,%a0@ + fmovemx %fp4,%a0@ + fmovemx %fp7,%a0@ + fmovemx %fp1/%fp3,%a0@ + fmovemx %fp1-%fp4,%a0@ + fmovemx %fp0/%fp7,%a0@ + fmovemx %fp0-%fp7,%a0@ + fmovemx %a0@,%fp0 + fmovemx %a0@,%fp1 + fmovemx %a0@,%fp7 + fmovemx %a0@,%fp0/%fp3 + fmovemx %a0@,%fp0/%fp4 + fmovemx %a0@,%fp2-%fp4 + fmovemx %a0@,%fp1-%fp7 + fmovemx &1,%a0@- + fmovemx &0xff,%a0@- + fmovemx &0x11,%a0@- + fmovemx %a0@+,&1 + fmovemx %a0@+,&0xff + fmovemx %a0@+,&0x11 + fmovemx %d0,%a0@- + fmovemx %a0@+,%d0 + fmovemx &sym,%a0@- + sym = 0x22 diff -urN binutils-2.7/gas/testsuite/gas/m68k/link.d binutils-2.8/gas/testsuite/gas/m68k/link.d --- binutils-2.7/gas/testsuite/gas/m68k/link.d Thu Jul 4 12:15:49 1996 +++ binutils-2.8/gas/testsuite/gas/m68k/link.d Wed Apr 30 12:54:22 1997 @@ -1,4 +1,4 @@ -#objdump: -d +#objdump: -d --prefix-addresses #name: link # Test handling of link instruction. diff -urN binutils-2.7/gas/testsuite/gas/m68k/op68000.d binutils-2.8/gas/testsuite/gas/m68k/op68000.d --- binutils-2.7/gas/testsuite/gas/m68k/op68000.d Thu Jul 4 12:15:49 1996 +++ binutils-2.8/gas/testsuite/gas/m68k/op68000.d Wed Apr 30 12:54:22 1997 @@ -3,6 +3,7 @@ # look for the statements which should fail. .*operands.s: Assembler messages: +.*statement `tstl %a0' ignored .*statement `tstl %a0@\(8,%d0:w:2\)' ignored .*statement `tstl %a0@\(8,%d0:w:4\)' ignored .*statement `tstl %a0@\(8,%d0:w:8\)' ignored diff -urN binutils-2.7/gas/testsuite/gas/m68k/operands.d binutils-2.8/gas/testsuite/gas/m68k/operands.d --- binutils-2.7/gas/testsuite/gas/m68k/operands.d Thu Jul 4 12:15:49 1996 +++ binutils-2.8/gas/testsuite/gas/m68k/operands.d Wed Apr 30 12:54:23 1997 @@ -1,4 +1,4 @@ -#objdump: -d +#objdump: -d --prefix-addresses #name: operands # Test handling of MIT and Motorola syntax operands diff -urN binutils-2.7/gas/testsuite/gas/m68k/pcrel.d binutils-2.8/gas/testsuite/gas/m68k/pcrel.d --- binutils-2.7/gas/testsuite/gas/m68k/pcrel.d Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/m68k/pcrel.d Wed Apr 30 12:54:23 1997 @@ -0,0 +1,88 @@ +#name: pcrel +#objdump: -drs -j .text --prefix-addresses + +.*: file format .* + +Contents of section .text: + 0000 4e714e71 4cfa0300 fffa4cfa 0300fff4 NqNqL.....L..... + 0010 4cfb0300 08ee41fa ffea41fa ffe641fa L.....A...A...A. + 0020 ff6241fb 08de41fb 08da41fb 08d641fb .bA...A...A...A. + 0030 0920ffd2 41fb0920 ffcc41fb 0930ffff . ..A.. ..A..0.. + 0040 ffc641fb 0930ffff ffbe4e71 61ff0000 ..A..0....Nqa... + 0050 00586100 0052614e 614c4e71 41f90000 .Xa..RaNaLNqA... + 0060 00(a6|00)41fa 004241fa 00be41fb 083a41fb ..A..BA...A..:A. + 0070 083641fb 083241fb 0920002e 41fb0920 .6A..2A.. ..A.. + 0080 002841fb 09300000 002241fb 09300000 .\(A..0..."A..0.. + 0090 001a41fb 09300000 001241fb 0920000a ..A..0....A.. .. + 00a0 41fb0804 4e714e71 4e7141fb 088041fb A...NqNqNqA...A. + 00b0 0920ff7f 41fb0920 800041fb 0930ffff . ..A.. ..A..0.. + 00c0 7fff4e71 41fb087f 41fb0920 008041fb ..NqA...A.. ..A. + 00d0 09207fff 41fb0930 00008000 4e7141fa . ..A..0....NqA. + 00e0 800041fb 0170ffff 7fff4e71 41fa7fff ..A..p....NqA... + 00f0 41fb0170 00008000 4e7141fb 0170(ffff|0000) A..p....NqA..p.. + 0100 (ff04|0000)41fb 0930(ffff|0000) (fefc|0000)4e71 41f90000 ..A..0....NqA... + 0110 0000............................... ................ +Disassembly of section \.text: +0+0000 <.*> nop +0+0002 nop +0+0004 moveml 0+0002 ,%a0-%a1 +0+000a moveml 0+0002 ,%a0-%a1 +0+0010 moveml %pc@\(0+02 ,%d0:l\),%a0-%a1 +0+0016 lea 0+0002 ,%a0 +0+001a lea 0+0002 ,%a0 +0+001e lea f+ff82 <.*>,%a0 +0+0022 lea %pc@\(0+02 ,%d0:l\),%a0 +0+0026 lea %pc@\(0+02 ,%d0:l\),%a0 +0+002a lea %pc@\(0+02 ,%d0:l\),%a0 +0+002e lea %pc@\(0+02 ,%d0:l\),%a0 +0+0034 lea %pc@\(0+02 ,%d0:l\),%a0 +0+003a lea %pc@\(0+02 ,%d0:l\),%a0 +0+0042 lea %pc@\(0+02 ,%d0:l\),%a0 +0+004a nop +0+004c bsrl 0+00a6 +0+0052 bsrw 0+00a6 +0+0056 bsrs 0+00a6 +0+0058 bsrs 0+00a6 +0+005a nop +0+005c lea (0+00a6 |0+0 <.*>),%a0 + 5e: (32 \.text|R_68K_32 \.text\+0xa6) +0+0062 lea 0+00a6 ,%a0 +0+0066 lea 0+0126 <.*>,%a0 +0+006a lea %pc@\(0+a6 ,%d0:l\),%a0 +0+006e lea %pc@\(0+a6 ,%d0:l\),%a0 +0+0072 lea %pc@\(0+a6 ,%d0:l\),%a0 +0+0076 lea %pc@\(0+a6 ,%d0:l\),%a0 +0+007c lea %pc@\(0+a6 ,%d0:l\),%a0 +0+0082 lea %pc@\(0+a6 ,%d0:l\),%a0 +0+008a lea %pc@\(0+a6 ,%d0:l\),%a0 +0+0092 lea %pc@\(0+a6 ,%d0:l\),%a0 +0+009a lea %pc@\(0+a6 ,%d0:l\),%a0 +0+00a0 lea %pc@\(0+a6 ,%d0:l\),%a0 +0+00a4 nop +0+00a6 nop +0+00a8 nop +0+00aa lea %pc@\(0+2c ,%d0:l\),%a0 +0+00ae lea %pc@\(0+2f ,%d0:l\),%a0 +0+00b4 lea %pc@\(f+80b6 <.*>,%d0:l\),%a0 +0+00ba lea %pc@\(f+80bb <.*>,%d0:l\),%a0 +0+00c2 nop +0+00c4 lea %pc@\(0+145 <.*>,%d0:l\),%a0 +0+00c8 lea %pc@\(0+14a <.*>,%d0:l\),%a0 +0+00ce lea %pc@\(0+80cf <.*>,%d0:l\),%a0 +0+00d4 lea %pc@\(0+80d6 <.*>,%d0:l\),%a0 +0+00dc nop +0+00de lea f+80e0 <.*>,%a0 +0+00e2 lea %pc@\(f+80e3 <.*>\),%a0 +0+00ea nop +0+00ec lea 0+80ed <.*>,%a0 +0+00f0 lea %pc@\(0+80f2 <.*>\),%a0 +0+00f8 nop +0+00fa lea %pc@\((0+0 <.*>|0+0fc )\),%a0 + fe: (DISP32 undef|R_68K_PC32 undef\+0x2) +0+0102 lea %pc@\((0+0 <.*>|0+0104 ),%d0:l\),%a0 + 106: (DISP32 undef|R_68K_PC32 undef\+0x2) +0+010a nop +0+010c lea 0+0 <.*>,%a0 + 10e: (R_68K_)?32 undef +0+0112 nop +0+0114 orib #0,%d0 diff -urN binutils-2.7/gas/testsuite/gas/m68k/pcrel.s binutils-2.8/gas/testsuite/gas/m68k/pcrel.s --- binutils-2.7/gas/testsuite/gas/m68k/pcrel.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/m68k/pcrel.s Wed Apr 30 12:54:23 1997 @@ -0,0 +1,59 @@ + nop +lbl_b: nop + moveml lbl_b,%a0-%a1 + moveml %pc@(lbl_b),%a0-%a1 + moveml %pc@(lbl_b,%d0),%a0-%a1 + lea lbl_b,%a0 + lea %pc@(lbl_b),%a0 + lea %pc@(lbl_b-128),%a0 + lea %pc@(lbl_b,%d0),%a0 + lea %pc@(lbl_b:b,%d0),%a0 + lea %pc@(lbl_b-.-2:b,%d0),%a0 + lea %pc@(lbl_b:w,%d0),%a0 + lea %pc@(lbl_b-.-2:w,%d0),%a0 + lea %pc@(lbl_b:l,%d0),%a0 + lea %pc@(lbl_b-.-2:l,%d0),%a0 + nop + bsrl lbl_a + bsr lbl_a + bsrs lbl_a + jbsr lbl_a + nop + lea lbl_a,%a0 + lea %pc@(lbl_a),%a0 + lea %pc@(lbl_a+128),%a0 + lea %pc@(lbl_a,%d0),%a0 + lea %pc@(lbl_a:b,%d0),%a0 + lea %pc@(lbl_a-.-2:b,%d0),%a0 + lea %pc@(lbl_a:w,%d0),%a0 + lea %pc@(lbl_a-.-2:w,%d0),%a0 + lea %pc@(lbl_a:l,%d0),%a0 + lea %pc@(lbl_a-.-2:l,%d0),%a0 + lea %pc@(18:l,%d0),%a0 + lea %pc@(10:w,%d0),%a0 + lea %pc@(4:b,%d0),%a0 + nop +lbl_a: nop + nop + lea %pc@(.-126,%d0),%a0 + lea %pc@(.-127,%d0),%a0 + lea %pc@(.-32766,%d0),%a0 + lea %pc@(.-32767,%d0),%a0 + nop + lea %pc@(.+129,%d0),%a0 + lea %pc@(.+130,%d0),%a0 + lea %pc@(.+32769,%d0),%a0 + lea %pc@(.+32770,%d0),%a0 + nop + lea %pc@(.-32766),%a0 + lea %pc@(.-32767),%a0 + nop + lea %pc@(.+32769),%a0 + lea %pc@(.+32770),%a0 + nop + lea %pc@(undef),%a0 + lea %pc@(undef,%d0),%a0 + nop + lea undef,%a0 + nop + .long 0 diff -urN binutils-2.7/gas/testsuite/gas/m68k/schwab.d binutils-2.8/gas/testsuite/gas/m68k/schwab.d --- binutils-2.7/gas/testsuite/gas/m68k/schwab.d Thu Jul 4 12:15:49 1996 +++ binutils-2.8/gas/testsuite/gas/m68k/schwab.d Wed Dec 31 19:00:00 1969 @@ -1,88 +0,0 @@ -#name: PC-relative relocations -#objdump: -drs -j .text - -.*: file format .* - -Contents of section .text: - 0000 4e714e71 4cfa0300 fffa4cfa 0300fff4 NqNqL.....L..... - 0010 4cfb0300 08ee41fa ffea41fa ffe641fa L.....A...A...A. - 0020 ff6241fb 08de41fb 08da41fb 08d641fb .bA...A...A...A. - 0030 0920ffd2 41fb0920 ffcc41fb 0930ffff . ..A.. ..A..0.. - 0040 ffc641fb 0930ffff ffbe4e71 61ff0000 ..A..0....Nqa... - 0050 00586100 0052614e 614c4e71 41f90000 .Xa..RaNaLNqA... - 0060 00a641fa 004241fa 00be41fb 083a41fb ..A..BA...A..:A. - 0070 083641fb 083241fb 0920002e 41fb0920 .6A..2A.. ..A.. - 0080 002841fb 09300000 002241fb 09300000 .\(A..0..."A..0.. - 0090 001a41fb 09300000 001241fb 0920000a ..A..0....A.. .. - 00a0 41fb0804 4e714e71 4e7141fb 088041fb A...NqNqNqA...A. - 00b0 0920ff7f 41fb0920 800041fb 0930ffff . ..A.. ..A..0.. - 00c0 7fff4e71 41fb087f 41fb0920 008041fb ..NqA...A.. ..A. - 00d0 09207fff 41fb0930 00008000 4e7141fa . ..A..0....NqA. - 00e0 800041fb 0170ffff 7fff4e71 41fa7fff ..A..p....NqA... - 00f0 41fb0170 00008000 4e7141fb 0170ffff A..p....NqA..p.. - 0100 ff0441fb 0930ffff fefc4e71 41f90000 ..A..0....NqA... - 0110 0000............................... ................ -Disassembly of section \.text: -0+0000 <.*> nop -0+0002 nop -0+0004 moveml 0+0002 ,%a0-%a1 -0+000a moveml 0+0002 ,%a0-%a1 -0+0010 moveml %pc@\(0+02 ,%d0:l\),%a0-%a1 -0+0016 lea 0+0002 ,%a0 -0+001a lea 0+0002 ,%a0 -0+001e lea f+ff82 <.*>,%a0 -0+0022 lea %pc@\(0+02 ,%d0:l\),%a0 -0+0026 lea %pc@\(0+02 ,%d0:l\),%a0 -0+002a lea %pc@\(0+02 ,%d0:l\),%a0 -0+002e lea %pc@\(0+02 ,%d0:l\),%a0 -0+0034 lea %pc@\(0+02 ,%d0:l\),%a0 -0+003a lea %pc@\(0+02 ,%d0:l\),%a0 -0+0042 lea %pc@\(0+02 ,%d0:l\),%a0 -0+004a nop -0+004c bsrl 0+00a6 -0+0052 bsrw 0+00a6 -0+0056 bsrs 0+00a6 -0+0058 bsrs 0+00a6 -0+005a nop -0+005c lea 0+00a6 ,%a0 - RELOC: 0+005e (R_68K_)?32 \.text -0+0062 lea 0+00a6 ,%a0 -0+0066 lea 0+0126 <.*>,%a0 -0+006a lea %pc@\(0+a6 ,%d0:l\),%a0 -0+006e lea %pc@\(0+a6 ,%d0:l\),%a0 -0+0072 lea %pc@\(0+a6 ,%d0:l\),%a0 -0+0076 lea %pc@\(0+a6 ,%d0:l\),%a0 -0+007c lea %pc@\(0+a6 ,%d0:l\),%a0 -0+0082 lea %pc@\(0+a6 ,%d0:l\),%a0 -0+008a lea %pc@\(0+a6 ,%d0:l\),%a0 -0+0092 lea %pc@\(0+a6 ,%d0:l\),%a0 -0+009a lea %pc@\(0+a6 ,%d0:l\),%a0 -0+00a0 lea %pc@\(0+a6 ,%d0:l\),%a0 -0+00a4 nop -0+00a6 nop -0+00a8 nop -0+00aa lea %pc@\(0+2c ,%d0:l\),%a0 -0+00ae lea %pc@\(0+2f ,%d0:l\),%a0 -0+00b4 lea %pc@\(f+80b6 <.*>,%d0:l\),%a0 -0+00ba lea %pc@\(f+80bb <.*>,%d0:l\),%a0 -0+00c2 nop -0+00c4 lea %pc@\(0+145 <.*>,%d0:l\),%a0 -0+00c8 lea %pc@\(0+14a <.*>,%d0:l\),%a0 -0+00ce lea %pc@\(0+80cf <.*>,%d0:l\),%a0 -0+00d4 lea %pc@\(0+80d6 <.*>,%d0:l\),%a0 -0+00dc nop -0+00de lea f+80e0 <.*>,%a0 -0+00e2 lea %pc@\(f+80e3 <.*>\),%a0 -0+00ea nop -0+00ec lea 0+80ed <.*>,%a0 -0+00f0 lea %pc@\(0+80f2 <.*>\),%a0 -0+00f8 nop -0+00fa lea %pc@\(0+0 <.*>\),%a0 - RELOC: 0+00fe (R_68K_PC|DISP)32 undef -0+0102 lea %pc@\(0+0 <.*>,%d0:l\),%a0 - RELOC: 0+0106 (R_68K_PC|DISP)32 undef -0+010a nop -0+010c lea 0+0+ <.*>,%a0 - RELOC: 0+010e (R_68K_)?32 undef -0+0112 nop -\.\.\. diff -urN binutils-2.7/gas/testsuite/gas/m68k/schwab.s binutils-2.8/gas/testsuite/gas/m68k/schwab.s --- binutils-2.7/gas/testsuite/gas/m68k/schwab.s Thu Jul 4 12:15:50 1996 +++ binutils-2.8/gas/testsuite/gas/m68k/schwab.s Wed Dec 31 19:00:00 1969 @@ -1,59 +0,0 @@ - nop -lbl_b: nop - moveml lbl_b,%a0-%a1 - moveml %pc@(lbl_b),%a0-%a1 - moveml %pc@(lbl_b,%d0),%a0-%a1 - lea lbl_b,%a0 - lea %pc@(lbl_b),%a0 - lea %pc@(lbl_b-128),%a0 - lea %pc@(lbl_b,%d0),%a0 - lea %pc@(lbl_b:b,%d0),%a0 - lea %pc@(lbl_b-.-2:b,%d0),%a0 - lea %pc@(lbl_b:w,%d0),%a0 - lea %pc@(lbl_b-.-2:w,%d0),%a0 - lea %pc@(lbl_b:l,%d0),%a0 - lea %pc@(lbl_b-.-2:l,%d0),%a0 - nop - bsrl lbl_a - bsr lbl_a - bsrs lbl_a - jbsr lbl_a - nop - lea lbl_a,%a0 - lea %pc@(lbl_a),%a0 - lea %pc@(lbl_a+128),%a0 - lea %pc@(lbl_a,%d0),%a0 - lea %pc@(lbl_a:b,%d0),%a0 - lea %pc@(lbl_a-.-2:b,%d0),%a0 - lea %pc@(lbl_a:w,%d0),%a0 - lea %pc@(lbl_a-.-2:w,%d0),%a0 - lea %pc@(lbl_a:l,%d0),%a0 - lea %pc@(lbl_a-.-2:l,%d0),%a0 - lea %pc@(18:l,%d0),%a0 - lea %pc@(10:w,%d0),%a0 - lea %pc@(4:b,%d0),%a0 - nop -lbl_a: nop - nop - lea %pc@(.-126,%d0),%a0 - lea %pc@(.-127,%d0),%a0 - lea %pc@(.-32766,%d0),%a0 - lea %pc@(.-32767,%d0),%a0 - nop - lea %pc@(.+129,%d0),%a0 - lea %pc@(.+130,%d0),%a0 - lea %pc@(.+32769,%d0),%a0 - lea %pc@(.+32770,%d0),%a0 - nop - lea %pc@(.-32766),%a0 - lea %pc@(.-32767),%a0 - nop - lea %pc@(.+32769),%a0 - lea %pc@(.+32770),%a0 - nop - lea %pc@(undef),%a0 - lea %pc@(undef,%d0),%a0 - nop - lea undef,%a0 - nop - .long 0 diff -urN binutils-2.7/gas/testsuite/gas/macros/macros.exp binutils-2.8/gas/testsuite/gas/macros/macros.exp --- binutils-2.7/gas/testsuite/gas/macros/macros.exp Thu Jul 4 12:15:52 1996 +++ binutils-2.8/gas/testsuite/gas/macros/macros.exp Wed Apr 30 12:54:25 1997 @@ -13,3 +13,7 @@ run_dump_test rept gas_test_error "err.s" "" "macro infinite recursion" + +if ![istarget hppa*-*-*] { + run_dump_test semi +} diff -urN binutils-2.7/gas/testsuite/gas/macros/semi.d binutils-2.8/gas/testsuite/gas/macros/semi.d --- binutils-2.7/gas/testsuite/gas/macros/semi.d Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/macros/semi.d Wed Apr 30 12:54:26 1997 @@ -0,0 +1,8 @@ +#objdump: -s -j .text +#name: semi + +.*: .* + +Contents of section .text: + 0000 3b203b20 3a203a20 00000000 00000000 ; ; : : ........ + 0010 00000000 00000000 00000000 00000000 ................ diff -urN binutils-2.7/gas/testsuite/gas/macros/semi.s binutils-2.8/gas/testsuite/gas/macros/semi.s --- binutils-2.7/gas/testsuite/gas/macros/semi.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/macros/semi.s Wed Apr 30 12:54:26 1997 @@ -0,0 +1,14 @@ + .macro semicolon + .ascii "; " + .endm + + .macro colon + .ascii ": " + .endm + + semicolon + .ascii "; " + colon + .ascii ": " + + .p2align 5,0 diff -urN binutils-2.7/gas/testsuite/gas/mips/abs.d binutils-2.8/gas/testsuite/gas/mips/abs.d --- binutils-2.7/gas/testsuite/gas/mips/abs.d Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/abs.d Wed Apr 30 12:54:27 1997 @@ -1,16 +1,15 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS abs # Test the abs macro. .*: +file format .*mips.* -No symbols in .* Disassembly of section .text: -0+0000 bgez \$a0,0+000c -... -0+0008 neg \$a0,\$a0 -0+000c bgez \$a1,0+0018 -0+0010 move \$a0,\$a1 -0+0014 neg \$a0,\$a1 -... +0+0000 <[^>]*> bgez \$a0,0+000c +0+0004 <[^>]*> nop +0+0008 <[^>]*> neg \$a0,\$a0 +0+000c <[^>]*> bgez \$a1,0+0018 +0+0010 <[^>]*> move \$a0,\$a1 +0+0014 <[^>]*> neg \$a0,\$a1 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/abs.s binutils-2.8/gas/testsuite/gas/mips/abs.s --- binutils-2.7/gas/testsuite/gas/mips/abs.s Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/abs.s Wed Apr 30 12:54:27 1997 @@ -1,4 +1,5 @@ # Source file used to test the abs macro. +foo: abs $4 abs $4,$5 .space 8 diff -urN binutils-2.7/gas/testsuite/gas/mips/add.d binutils-2.8/gas/testsuite/gas/mips/add.d --- binutils-2.7/gas/testsuite/gas/mips/add.d Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/add.d Wed Apr 30 12:54:27 1997 @@ -1,21 +1,20 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS add # Test the add macro. .*: +file format .*mips.* -No symbols in .* Disassembly of section .text: -0+0000 addi \$a0,\$a0,0 -0+0004 addi \$a0,\$a0,1 -0+0008 li \$at,0x8000 -0+000c add \$a0,\$a0,\$at -0+0010 addi \$a0,\$a0,-32768 -0+0014 lui \$at,0x1 -0+0018 add \$a0,\$a0,\$at -0+001c lui \$at,0x1 -0+0020 ori \$at,\$at,0xa5a5 -0+0024 add \$a0,\$a0,\$at -0+0028 addiu \$a0,\$a0,1 -... +0+0000 <[^>]*> addi \$a0,\$a0,0 +0+0004 <[^>]*> addi \$a0,\$a0,1 +0+0008 <[^>]*> li \$at,0x8000 +0+000c <[^>]*> add \$a0,\$a0,\$at +0+0010 <[^>]*> addi \$a0,\$a0,-32768 +0+0014 <[^>]*> lui \$at,0x1 +0+0018 <[^>]*> add \$a0,\$a0,\$at +0+001c <[^>]*> lui \$at,0x1 +0+0020 <[^>]*> ori \$at,\$at,0xa5a5 +0+0024 <[^>]*> add \$a0,\$a0,\$at +0+0028 <[^>]*> addiu \$a0,\$a0,1 +0+002c <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/add.s binutils-2.8/gas/testsuite/gas/mips/add.s --- binutils-2.7/gas/testsuite/gas/mips/add.s Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/add.s Wed Apr 30 12:54:27 1997 @@ -1,5 +1,6 @@ # Source file used to test the add macro. +foo: add $4,$4,0 add $4,$4,1 add $4,$4,0x8000 @@ -10,3 +11,6 @@ # addu is handled the same way add is; just confirm that it isn't # totally broken. addu $4,$4,1 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/and.d binutils-2.8/gas/testsuite/gas/mips/and.d --- binutils-2.7/gas/testsuite/gas/mips/and.d Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/and.d Wed Apr 30 12:54:27 1997 @@ -1,35 +1,34 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS and # Test the and macro. .*: +file format .*mips.* -No symbols in .* Disassembly of section .text: -0+0000 andi \$a0,\$a0,0x0 -0+0004 andi \$a0,\$a0,0x1 -0+0008 andi \$a0,\$a0,0x8000 -0+000c li \$at,-32768 -0+0010 and \$a0,\$a0,\$at -0+0014 lui \$at,0x1 -0+0018 and \$a0,\$a0,\$at -0+001c lui \$at,0x1 -0+0020 ori \$at,\$at,0xa5a5 -0+0024 and \$a0,\$a0,\$at -0+0028 ori \$a0,\$a1,0x0 -0+002c nor \$a0,\$a0,\$zero -0+0030 ori \$a0,\$a1,0x1 -0+0034 nor \$a0,\$a0,\$zero -0+0038 ori \$a0,\$a1,0x8000 -0+003c nor \$a0,\$a0,\$zero -0+0040 li \$at,-32768 -0+0044 nor \$a0,\$a1,\$at -0+0048 lui \$at,0x1 -0+004c nor \$a0,\$a1,\$at -0+0050 lui \$at,0x1 -0+0054 ori \$at,\$at,0xa5a5 -0+0058 nor \$a0,\$a1,\$at -0+005c ori \$a0,\$a1,0x0 -0+0060 xori \$a0,\$a1,0x0 -... +0+0000 <[^>]*> andi \$a0,\$a0,0x0 +0+0004 <[^>]*> andi \$a0,\$a0,0x1 +0+0008 <[^>]*> andi \$a0,\$a0,0x8000 +0+000c <[^>]*> li \$at,-32768 +0+0010 <[^>]*> and \$a0,\$a0,\$at +0+0014 <[^>]*> lui \$at,0x1 +0+0018 <[^>]*> and \$a0,\$a0,\$at +0+001c <[^>]*> lui \$at,0x1 +0+0020 <[^>]*> ori \$at,\$at,0xa5a5 +0+0024 <[^>]*> and \$a0,\$a0,\$at +0+0028 <[^>]*> ori \$a0,\$a1,0x0 +0+002c <[^>]*> nor \$a0,\$a0,\$zero +0+0030 <[^>]*> ori \$a0,\$a1,0x1 +0+0034 <[^>]*> nor \$a0,\$a0,\$zero +0+0038 <[^>]*> ori \$a0,\$a1,0x8000 +0+003c <[^>]*> nor \$a0,\$a0,\$zero +0+0040 <[^>]*> li \$at,-32768 +0+0044 <[^>]*> nor \$a0,\$a1,\$at +0+0048 <[^>]*> lui \$at,0x1 +0+004c <[^>]*> nor \$a0,\$a1,\$at +0+0050 <[^>]*> lui \$at,0x1 +0+0054 <[^>]*> ori \$at,\$at,0xa5a5 +0+0058 <[^>]*> nor \$a0,\$a1,\$at +0+005c <[^>]*> ori \$a0,\$a1,0x0 +0+0060 <[^>]*> xori \$a0,\$a1,0x0 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/and.s binutils-2.8/gas/testsuite/gas/mips/and.s --- binutils-2.7/gas/testsuite/gas/mips/and.s Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/and.s Wed Apr 30 12:54:27 1997 @@ -1,5 +1,6 @@ # Source file used to test the and macro. +foo: and $4,$4,0 and $4,$4,1 and $4,$4,0x8000 @@ -20,3 +21,8 @@ or $4,$5,0 xor $4,$5,0 + + # Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/beq.d binutils-2.8/gas/testsuite/gas/mips/beq.d --- binutils-2.7/gas/testsuite/gas/mips/beq.d Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/beq.d Wed Apr 30 12:54:27 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS beq # Test the beq macro. @@ -6,35 +6,35 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> beq \$a0,\$a1,0+0000 -... -0+0008 <[^>]*> beqz \$a0,0+0000 -... -0+0010 <[^>]*> li \$at,1 -0+0014 <[^>]*> beq \$a0,\$at,0+0000 -... -0+001c <[^>]*> li \$at,0x8000 -0+0020 <[^>]*> beq \$a0,\$at,0+0000 -... -0+0028 <[^>]*> li \$at,-32768 -0+002c <[^>]*> beq \$a0,\$at,0+0000 -... -0+0034 <[^>]*> lui \$at,0x1 -0+0038 <[^>]*> beq \$a0,\$at,0+0000 -... -0+0040 <[^>]*> lui \$at,0x1 -0+0044 <[^>]*> ori \$at,\$at,0xa5a5 -0+0048 <[^>]*> beq \$a0,\$at,0+0000 -... -0+0050 <[^>]*> bnez \$a0,0+0000 -... -0+0058 <[^>]*> beqzl \$a0,0+0000 -... -0+0060 <[^>]*> bnezl \$a0,0+0000 -... -0+20068 <[^>]*> j 0+0000 -[ ]*RELOC: 0+20068 (MIPS_JMP|JMPADDR|R_MIPS_26) .text -... -0+20070 <[^>]*> jal 0+0000 -[ ]*RELOC: 0+20070 (MIPS_JMP|JMPADDR|R_MIPS_26) .text -... +0+0000 <[^>]*> beq \$a0,\$a1,0+0000 +0+0004 <[^>]*> nop +0+0008 <[^>]*> beqz \$a0,0+0000 +0+000c <[^>]*> nop +0+0010 <[^>]*> li \$at,1 +0+0014 <[^>]*> beq \$a0,\$at,0+0000 +0+0018 <[^>]*> nop +0+001c <[^>]*> li \$at,0x8000 +0+0020 <[^>]*> beq \$a0,\$at,0+0000 +0+0024 <[^>]*> nop +0+0028 <[^>]*> li \$at,-32768 +0+002c <[^>]*> beq \$a0,\$at,0+0000 +0+0030 <[^>]*> nop +0+0034 <[^>]*> lui \$at,0x1 +0+0038 <[^>]*> beq \$a0,\$at,0+0000 +0+003c <[^>]*> nop +0+0040 <[^>]*> lui \$at,0x1 +0+0044 <[^>]*> ori \$at,\$at,0xa5a5 +0+0048 <[^>]*> beq \$a0,\$at,0+0000 +0+004c <[^>]*> nop +0+0050 <[^>]*> bnez \$a0,0+0000 +0+0054 <[^>]*> nop +0+0058 <[^>]*> beqzl \$a0,0+0000 +0+005c <[^>]*> nop +0+0060 <[^>]*> bnezl \$a0,0+0000 + ... +0+20068 <[^>]*> j 0+0000 +[ ]*20068: (MIPS_JMP|JMPADDR|R_MIPS_26) .text +0+2006c <[^>]*> nop +0+20070 <[^>]*> jal 0+0000 +[ ]*20070: (MIPS_JMP|JMPADDR|R_MIPS_26) .text + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/beq.s binutils-2.8/gas/testsuite/gas/mips/beq.s --- binutils-2.7/gas/testsuite/gas/mips/beq.s Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/beq.s Wed Apr 30 12:54:28 1997 @@ -21,3 +21,8 @@ .space 0x20000 b text_label bal text_label + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/bge.d binutils-2.8/gas/testsuite/gas/mips/bge.d --- binutils-2.7/gas/testsuite/gas/mips/bge.d Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/bge.d Wed Apr 30 12:54:28 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS bge # Test the bge macro. @@ -6,48 +6,48 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> slt \$at,\$a0,\$a1 -0+0004 <[^>]*> beqz \$at,0+0000 -... -0+000c <[^>]*> bgez \$a0,0+0000 -... -0+0014 <[^>]*> blez \$a1,0+0000 -... -0+001c <[^>]*> bgez \$a0,0+0000 -... -0+0024 <[^>]*> bgtz \$a0,0+0000 -... -0+002c <[^>]*> slti \$at,\$a0,2 -0+0030 <[^>]*> beqz \$at,0+0000 -... -0+0038 <[^>]*> li \$at,0x8000 -0+003c <[^>]*> slt \$at,\$a0,\$at -0+0040 <[^>]*> beqz \$at,0+0000 -... -0+0048 <[^>]*> slti \$at,\$a0,-32768 -0+004c <[^>]*> beqz \$at,0+0000 -... -0+0054 <[^>]*> lui \$at,0x1 -0+0058 <[^>]*> slt \$at,\$a0,\$at -0+005c <[^>]*> beqz \$at,0+0000 -... -0+0064 <[^>]*> lui \$at,0x1 -0+0068 <[^>]*> ori \$at,\$at,0xa5a5 -0+006c <[^>]*> slt \$at,\$a0,\$at -0+0070 <[^>]*> beqz \$at,0+0000 -... -0+0078 <[^>]*> slt \$at,\$a1,\$a0 -0+007c <[^>]*> bnez \$at,0+0000 -... -0+0084 <[^>]*> bgtz \$a0,0+0000 -... -0+008c <[^>]*> bltz \$a1,0+0000 -... -0+0094 <[^>]*> bgtz \$a0,0+0000 -... -0+009c <[^>]*> slt \$at,\$a0,\$a1 -0+00a0 <[^>]*> beqzl \$at,0+0000 -... -0+00a8 <[^>]*> slt \$at,\$a1,\$a0 -0+00ac <[^>]*> bnezl \$at,0+0000 -... +0+0000 <[^>]*> slt \$at,\$a0,\$a1 +0+0004 <[^>]*> beqz \$at,0+0000 +0+0008 <[^>]*> nop +0+000c <[^>]*> bgez \$a0,0+0000 +0+0010 <[^>]*> nop +0+0014 <[^>]*> blez \$a1,0+0000 +0+0018 <[^>]*> nop +0+001c <[^>]*> bgez \$a0,0+0000 +0+0020 <[^>]*> nop +0+0024 <[^>]*> bgtz \$a0,0+0000 +0+0028 <[^>]*> nop +0+002c <[^>]*> slti \$at,\$a0,2 +0+0030 <[^>]*> beqz \$at,0+0000 +0+0034 <[^>]*> nop +0+0038 <[^>]*> li \$at,0x8000 +0+003c <[^>]*> slt \$at,\$a0,\$at +0+0040 <[^>]*> beqz \$at,0+0000 +0+0044 <[^>]*> nop +0+0048 <[^>]*> slti \$at,\$a0,-32768 +0+004c <[^>]*> beqz \$at,0+0000 +0+0050 <[^>]*> nop +0+0054 <[^>]*> lui \$at,0x1 +0+0058 <[^>]*> slt \$at,\$a0,\$at +0+005c <[^>]*> beqz \$at,0+0000 +0+0060 <[^>]*> nop +0+0064 <[^>]*> lui \$at,0x1 +0+0068 <[^>]*> ori \$at,\$at,0xa5a5 +0+006c <[^>]*> slt \$at,\$a0,\$at +0+0070 <[^>]*> beqz \$at,0+0000 +0+0074 <[^>]*> nop +0+0078 <[^>]*> slt \$at,\$a1,\$a0 +0+007c <[^>]*> bnez \$at,0+0000 +0+0080 <[^>]*> nop +0+0084 <[^>]*> bgtz \$a0,0+0000 +0+0088 <[^>]*> nop +0+008c <[^>]*> bltz \$a1,0+0000 +0+0090 <[^>]*> nop +0+0094 <[^>]*> bgtz \$a0,0+0000 +0+0098 <[^>]*> nop +0+009c <[^>]*> slt \$at,\$a0,\$a1 +0+00a0 <[^>]*> beqzl \$at,0+0000 +0+00a4 <[^>]*> nop +0+00a8 <[^>]*> slt \$at,\$a1,\$a0 +0+00ac <[^>]*> bnezl \$at,0+0000 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/bge.s binutils-2.8/gas/testsuite/gas/mips/bge.s --- binutils-2.7/gas/testsuite/gas/mips/bge.s Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/bge.s Wed Apr 30 12:54:28 1997 @@ -23,3 +23,9 @@ .set mips2 bgel $4,$5,text_label bgtl $4,$5,text_label + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/bgeu.d binutils-2.8/gas/testsuite/gas/mips/bgeu.d --- binutils-2.7/gas/testsuite/gas/mips/bgeu.d Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/bgeu.d Wed Apr 30 12:54:28 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS bgeu # Test the bgeu macro. @@ -6,42 +6,42 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> sltu \$at,\$a0,\$a1 -0+0004 <[^>]*> beqz \$at,0+0000 -... -0+000c <[^>]*> beq \$zero,\$a1,0+0000 -... -0+0014 <[^>]*> bnez \$a0,0+0000 -... -0+001c <[^>]*> sltiu \$at,\$a0,2 -0+0020 <[^>]*> beqz \$at,0+0000 -... -0+0028 <[^>]*> li \$at,0x8000 -0+002c <[^>]*> sltu \$at,\$a0,\$at -0+0030 <[^>]*> beqz \$at,0+0000 -... -0+0038 <[^>]*> sltiu \$at,\$a0,-32768 -0+003c <[^>]*> beqz \$at,0+0000 -... -0+0044 <[^>]*> lui \$at,0x1 -0+0048 <[^>]*> sltu \$at,\$a0,\$at -0+004c <[^>]*> beqz \$at,0+0000 -... -0+0054 <[^>]*> lui \$at,0x1 -0+0058 <[^>]*> ori \$at,\$at,0xa5a5 -0+005c <[^>]*> sltu \$at,\$a0,\$at -0+0060 <[^>]*> beqz \$at,0+0000 -... -0+0068 <[^>]*> sltu \$at,\$a1,\$a0 -0+006c <[^>]*> bnez \$at,0+0000 -... -0+0074 <[^>]*> bnez \$a0,0+0000 -... -0+007c <[^>]*> bnez \$a0,0+0000 -... -0+0084 <[^>]*> sltu \$at,\$a0,\$a1 -0+0088 <[^>]*> beqzl \$at,0+0000 -... -0+0090 <[^>]*> sltu \$at,\$a1,\$a0 -0+0094 <[^>]*> bnezl \$at,0+0000 -... +0+0000 <[^>]*> sltu \$at,\$a0,\$a1 +0+0004 <[^>]*> beqz \$at,0+0000 +0+0008 <[^>]*> nop +0+000c <[^>]*> beq \$zero,\$a1,0+0000 +0+0010 <[^>]*> nop +0+0014 <[^>]*> bnez \$a0,0+0000 +0+0018 <[^>]*> nop +0+001c <[^>]*> sltiu \$at,\$a0,2 +0+0020 <[^>]*> beqz \$at,0+0000 +0+0024 <[^>]*> nop +0+0028 <[^>]*> li \$at,0x8000 +0+002c <[^>]*> sltu \$at,\$a0,\$at +0+0030 <[^>]*> beqz \$at,0+0000 +0+0034 <[^>]*> nop +0+0038 <[^>]*> sltiu \$at,\$a0,-32768 +0+003c <[^>]*> beqz \$at,0+0000 +0+0040 <[^>]*> nop +0+0044 <[^>]*> lui \$at,0x1 +0+0048 <[^>]*> sltu \$at,\$a0,\$at +0+004c <[^>]*> beqz \$at,0+0000 +0+0050 <[^>]*> nop +0+0054 <[^>]*> lui \$at,0x1 +0+0058 <[^>]*> ori \$at,\$at,0xa5a5 +0+005c <[^>]*> sltu \$at,\$a0,\$at +0+0060 <[^>]*> beqz \$at,0+0000 +0+0064 <[^>]*> nop +0+0068 <[^>]*> sltu \$at,\$a1,\$a0 +0+006c <[^>]*> bnez \$at,0+0000 +0+0070 <[^>]*> nop +0+0074 <[^>]*> bnez \$a0,0+0000 +0+0078 <[^>]*> nop +0+007c <[^>]*> bnez \$a0,0+0000 +0+0080 <[^>]*> nop +0+0084 <[^>]*> sltu \$at,\$a0,\$a1 +0+0088 <[^>]*> beqzl \$at,0+0000 +0+008c <[^>]*> nop +0+0090 <[^>]*> sltu \$at,\$a1,\$a0 +0+0094 <[^>]*> bnezl \$at,0+0000 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/bgeu.s binutils-2.8/gas/testsuite/gas/mips/bgeu.s --- binutils-2.7/gas/testsuite/gas/mips/bgeu.s Thu Jul 4 12:15:54 1996 +++ binutils-2.8/gas/testsuite/gas/mips/bgeu.s Wed Apr 30 12:54:28 1997 @@ -21,3 +21,7 @@ .set mips2 bgeul $4,$5,text_label bgtul $4,$5,text_label + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/blt.d binutils-2.8/gas/testsuite/gas/mips/blt.d --- binutils-2.7/gas/testsuite/gas/mips/blt.d Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/blt.d Wed Apr 30 12:54:28 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS blt # Test the blt macro. @@ -6,48 +6,48 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> slt \$at,\$a0,\$a1 -0+0004 <[^>]*> bnez \$at,0+0000 -... -0+000c <[^>]*> bltz \$a0,0+0000 -... -0+0014 <[^>]*> bgtz \$a1,0+0000 -... -0+001c <[^>]*> bltz \$a0,0+0000 -... -0+0024 <[^>]*> blez \$a0,0+0000 -... -0+002c <[^>]*> slti \$at,\$a0,2 -0+0030 <[^>]*> bnez \$at,0+0000 -... -0+0038 <[^>]*> li \$at,0x8000 -0+003c <[^>]*> slt \$at,\$a0,\$at -0+0040 <[^>]*> bnez \$at,0+0000 -... -0+0048 <[^>]*> slti \$at,\$a0,-32768 -0+004c <[^>]*> bnez \$at,0+0000 -... -0+0054 <[^>]*> lui \$at,0x1 -0+0058 <[^>]*> slt \$at,\$a0,\$at -0+005c <[^>]*> bnez \$at,0+0000 -... -0+0064 <[^>]*> lui \$at,0x1 -0+0068 <[^>]*> ori \$at,\$at,0xa5a5 -0+006c <[^>]*> slt \$at,\$a0,\$at -0+0070 <[^>]*> bnez \$at,0+0000 -... -0+0078 <[^>]*> slt \$at,\$a1,\$a0 -0+007c <[^>]*> beqz \$at,0+0000 -... -0+0084 <[^>]*> blez \$a0,0+0000 -... -0+008c <[^>]*> bgez \$a1,0+0000 -... -0+0094 <[^>]*> blez \$a0,0+0000 -... -0+009c <[^>]*> slt \$at,\$a0,\$a1 -0+00a0 <[^>]*> bnezl \$at,0+0000 -... -0+00a8 <[^>]*> slt \$at,\$a1,\$a0 -0+00ac <[^>]*> beqzl \$at,0+0000 -... +0+0000 <[^>]*> slt \$at,\$a0,\$a1 +0+0004 <[^>]*> bnez \$at,0+0000 +0+0008 <[^>]*> nop +0+000c <[^>]*> bltz \$a0,0+0000 +0+0010 <[^>]*> nop +0+0014 <[^>]*> bgtz \$a1,0+0000 +0+0018 <[^>]*> nop +0+001c <[^>]*> bltz \$a0,0+0000 +0+0020 <[^>]*> nop +0+0024 <[^>]*> blez \$a0,0+0000 +0+0028 <[^>]*> nop +0+002c <[^>]*> slti \$at,\$a0,2 +0+0030 <[^>]*> bnez \$at,0+0000 +0+0034 <[^>]*> nop +0+0038 <[^>]*> li \$at,0x8000 +0+003c <[^>]*> slt \$at,\$a0,\$at +0+0040 <[^>]*> bnez \$at,0+0000 +0+0044 <[^>]*> nop +0+0048 <[^>]*> slti \$at,\$a0,-32768 +0+004c <[^>]*> bnez \$at,0+0000 +0+0050 <[^>]*> nop +0+0054 <[^>]*> lui \$at,0x1 +0+0058 <[^>]*> slt \$at,\$a0,\$at +0+005c <[^>]*> bnez \$at,0+0000 +0+0060 <[^>]*> nop +0+0064 <[^>]*> lui \$at,0x1 +0+0068 <[^>]*> ori \$at,\$at,0xa5a5 +0+006c <[^>]*> slt \$at,\$a0,\$at +0+0070 <[^>]*> bnez \$at,0+0000 +0+0074 <[^>]*> nop +0+0078 <[^>]*> slt \$at,\$a1,\$a0 +0+007c <[^>]*> beqz \$at,0+0000 +0+0080 <[^>]*> nop +0+0084 <[^>]*> blez \$a0,0+0000 +0+0088 <[^>]*> nop +0+008c <[^>]*> bgez \$a1,0+0000 +0+0090 <[^>]*> nop +0+0094 <[^>]*> blez \$a0,0+0000 +0+0098 <[^>]*> nop +0+009c <[^>]*> slt \$at,\$a0,\$a1 +0+00a0 <[^>]*> bnezl \$at,0+0000 +0+00a4 <[^>]*> nop +0+00a8 <[^>]*> slt \$at,\$a1,\$a0 +0+00ac <[^>]*> beqzl \$at,0+0000 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/blt.s binutils-2.8/gas/testsuite/gas/mips/blt.s --- binutils-2.7/gas/testsuite/gas/mips/blt.s Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/blt.s Wed Apr 30 12:54:28 1997 @@ -23,3 +23,9 @@ .set mips2 bltl $4,$5,text_label blel $4,$5,text_label + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/bltu.d binutils-2.8/gas/testsuite/gas/mips/bltu.d --- binutils-2.7/gas/testsuite/gas/mips/bltu.d Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/bltu.d Wed Apr 30 12:54:28 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS bltu # Test the bltu macro. @@ -6,42 +6,42 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> sltu \$at,\$a0,\$a1 -0+0004 <[^>]*> bnez \$at,0+0000 -... -0+000c <[^>]*> bne \$zero,\$a1,0+0000 -... -0+0014 <[^>]*> beqz \$a0,0+0000 -... -0+001c <[^>]*> sltiu \$at,\$a0,2 -0+0020 <[^>]*> bnez \$at,0+0000 -... -0+0028 <[^>]*> li \$at,0x8000 -0+002c <[^>]*> sltu \$at,\$a0,\$at -0+0030 <[^>]*> bnez \$at,0+0000 -... -0+0038 <[^>]*> sltiu \$at,\$a0,-32768 -0+003c <[^>]*> bnez \$at,0+0000 -... -0+0044 <[^>]*> lui \$at,0x1 -0+0048 <[^>]*> sltu \$at,\$a0,\$at -0+004c <[^>]*> bnez \$at,0+0000 -... -0+0054 <[^>]*> lui \$at,0x1 -0+0058 <[^>]*> ori \$at,\$at,0xa5a5 -0+005c <[^>]*> sltu \$at,\$a0,\$at -0+0060 <[^>]*> bnez \$at,0+0000 -... -0+0068 <[^>]*> sltu \$at,\$a1,\$a0 -0+006c <[^>]*> beqz \$at,0+0000 -... -0+0074 <[^>]*> beqz \$a0,0+0000 -... -0+007c <[^>]*> beqz \$a0,0+0000 -... -0+0084 <[^>]*> sltu \$at,\$a0,\$a1 -0+0088 <[^>]*> bnezl \$at,0+0000 -... -0+0090 <[^>]*> sltu \$at,\$a1,\$a0 -0+0094 <[^>]*> beqzl \$at,0+0000 -... +0+0000 <[^>]*> sltu \$at,\$a0,\$a1 +0+0004 <[^>]*> bnez \$at,0+0000 +0+0008 <[^>]*> nop +0+000c <[^>]*> bne \$zero,\$a1,0+0000 +0+0010 <[^>]*> nop +0+0014 <[^>]*> beqz \$a0,0+0000 +0+0018 <[^>]*> nop +0+001c <[^>]*> sltiu \$at,\$a0,2 +0+0020 <[^>]*> bnez \$at,0+0000 +0+0024 <[^>]*> nop +0+0028 <[^>]*> li \$at,0x8000 +0+002c <[^>]*> sltu \$at,\$a0,\$at +0+0030 <[^>]*> bnez \$at,0+0000 +0+0034 <[^>]*> nop +0+0038 <[^>]*> sltiu \$at,\$a0,-32768 +0+003c <[^>]*> bnez \$at,0+0000 +0+0040 <[^>]*> nop +0+0044 <[^>]*> lui \$at,0x1 +0+0048 <[^>]*> sltu \$at,\$a0,\$at +0+004c <[^>]*> bnez \$at,0+0000 +0+0050 <[^>]*> nop +0+0054 <[^>]*> lui \$at,0x1 +0+0058 <[^>]*> ori \$at,\$at,0xa5a5 +0+005c <[^>]*> sltu \$at,\$a0,\$at +0+0060 <[^>]*> bnez \$at,0+0000 +0+0064 <[^>]*> nop +0+0068 <[^>]*> sltu \$at,\$a1,\$a0 +0+006c <[^>]*> beqz \$at,0+0000 +0+0070 <[^>]*> nop +0+0074 <[^>]*> beqz \$a0,0+0000 +0+0078 <[^>]*> nop +0+007c <[^>]*> beqz \$a0,0+0000 +0+0080 <[^>]*> nop +0+0084 <[^>]*> sltu \$at,\$a0,\$a1 +0+0088 <[^>]*> bnezl \$at,0+0000 +0+008c <[^>]*> nop +0+0090 <[^>]*> sltu \$at,\$a1,\$a0 +0+0094 <[^>]*> beqzl \$at,0+0000 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/bltu.s binutils-2.8/gas/testsuite/gas/mips/bltu.s --- binutils-2.7/gas/testsuite/gas/mips/bltu.s Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/bltu.s Wed Apr 30 12:54:28 1997 @@ -21,3 +21,7 @@ .set mips2 bltul $4,$5,text_label bleul $4,$5,text_label + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/div-ilocks.d binutils-2.8/gas/testsuite/gas/mips/div-ilocks.d --- binutils-2.7/gas/testsuite/gas/mips/div-ilocks.d Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/div-ilocks.d Wed Apr 30 12:54:28 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS div #source: div.s @@ -6,112 +6,111 @@ .*: +file format .*mips.* -No symbols in .* Disassembly of section .text: -0+0000 div \$zero,\$a0,\$a1 -0+0004 div \$zero,\$a0,\$a1 -0+0008 bnez \$a1,0+0014 -... -0+0010 break 0x7 -0+0014 li \$at,-1 -0+0018 bne \$a1,\$at,0+002c -0+001c lui \$at,0x8000 -0+0020 bne \$a0,\$at,0+002c -... -0+0028 break 0x6 -0+002c mflo \$a0 -0+0030 div \$zero,\$a1,\$a2 -0+0034 bnez \$a2,0+0040 -... -0+003c break 0x7 -0+0040 li \$at,-1 -0+0044 bne \$a2,\$at,0+0058 -0+0048 lui \$at,0x8000 -0+004c bne \$a1,\$at,0+0058 -... -0+0054 break 0x6 -0+0058 mflo \$a0 -0+005c move \$a0,\$a0 -0+0060 move \$a0,\$a1 -0+0064 neg \$a0,\$a0 -0+0068 neg \$a0,\$a1 -0+006c li \$at,2 -0+0070 div \$zero,\$a0,\$at -0+0074 mflo \$a0 -0+0078 li \$at,2 -0+007c div \$zero,\$a1,\$at -0+0080 mflo \$a0 -0+0084 li \$at,0x8000 -0+0088 div \$zero,\$a0,\$at -0+008c mflo \$a0 -0+0090 li \$at,0x8000 -0+0094 div \$zero,\$a1,\$at -0+0098 mflo \$a0 -0+009c li \$at,-32768 -0+00a0 div \$zero,\$a0,\$at -0+00a4 mflo \$a0 -0+00a8 li \$at,-32768 -0+00ac div \$zero,\$a1,\$at -0+00b0 mflo \$a0 -0+00b4 lui \$at,0x1 -0+00b8 div \$zero,\$a0,\$at -0+00bc mflo \$a0 -0+00c0 lui \$at,0x1 -0+00c4 div \$zero,\$a1,\$at -0+00c8 mflo \$a0 -0+00cc lui \$at,0x1 -0+00d0 ori \$at,\$at,0xa5a5 -0+00d4 div \$zero,\$a0,\$at -0+00d8 mflo \$a0 -0+00dc lui \$at,0x1 -0+00e0 ori \$at,\$at,0xa5a5 -0+00e4 div \$zero,\$a1,\$at -0+00e8 mflo \$a0 -0+00ec divu \$zero,\$a0,\$a1 -0+00f0 divu \$zero,\$a0,\$a1 -0+00f4 bnez \$a1,0+0100 -... -0+00fc break 0x7 -0+0100 mflo \$a0 -0+0104 divu \$zero,\$a1,\$a2 -0+0108 bnez \$a2,0+0114 -... -0+0110 break 0x7 -0+0114 mflo \$a0 -0+0118 move \$a0,\$a0 -0+011c div \$zero,\$a1,\$a2 -0+0120 bnez \$a2,0+012c -... -0+0128 break 0x7 -0+012c li \$at,-1 -0+0130 bne \$a2,\$at,0+0144 -0+0134 lui \$at,0x8000 -0+0138 bne \$a1,\$at,0+0144 -... -0+0140 break 0x6 -0+0144 mfhi \$a0 -0+0148 li \$at,2 -0+014c divu \$zero,\$a1,\$at -0+0150 mfhi \$a0 -0+0154 ddiv \$zero,\$a1,\$a2 -0+0158 bnez \$a2,0+0164 -... -0+0160 break 0x7 -0+0164 daddiu \$at,\$zero,-1 -0+0168 bne \$a2,\$at,0+0180 -0+016c daddiu \$at,\$zero,1 -0+0170 dsll32 \$at,\$at,0x1f -0+0174 bne \$a1,\$at,0+0180 -... -0+017c break 0x6 -0+0180 mflo \$a0 -0+0184 li \$at,2 -0+0188 ddivu \$zero,\$a1,\$at -0+018c mflo \$a0 -0+0190 li \$at,0x8000 -0+0194 ddiv \$zero,\$a1,\$at -0+0198 mfhi \$a0 -0+019c li \$at,-32768 -0+01a0 ddivu \$zero,\$a1,\$at -0+01a4 mfhi \$a0 -... +0+0000 <[^>]*> div \$zero,\$a0,\$a1 +0+0004 <[^>]*> div \$zero,\$a0,\$a1 +0+0008 <[^>]*> bnez \$a1,0+0014 +0+000c <[^>]*> nop +0+0010 <[^>]*> break 0x7 +0+0014 <[^>]*> li \$at,-1 +0+0018 <[^>]*> bne \$a1,\$at,0+002c +0+001c <[^>]*> lui \$at,0x8000 +0+0020 <[^>]*> bne \$a0,\$at,0+002c +0+0024 <[^>]*> nop +0+0028 <[^>]*> break 0x6 +0+002c <[^>]*> mflo \$a0 +0+0030 <[^>]*> div \$zero,\$a1,\$a2 +0+0034 <[^>]*> bnez \$a2,0+0040 +0+0038 <[^>]*> nop +0+003c <[^>]*> break 0x7 +0+0040 <[^>]*> li \$at,-1 +0+0044 <[^>]*> bne \$a2,\$at,0+0058 +0+0048 <[^>]*> lui \$at,0x8000 +0+004c <[^>]*> bne \$a1,\$at,0+0058 +0+0050 <[^>]*> nop +0+0054 <[^>]*> break 0x6 +0+0058 <[^>]*> mflo \$a0 +0+005c <[^>]*> move \$a0,\$a0 +0+0060 <[^>]*> move \$a0,\$a1 +0+0064 <[^>]*> neg \$a0,\$a0 +0+0068 <[^>]*> neg \$a0,\$a1 +0+006c <[^>]*> li \$at,2 +0+0070 <[^>]*> div \$zero,\$a0,\$at +0+0074 <[^>]*> mflo \$a0 +0+0078 <[^>]*> li \$at,2 +0+007c <[^>]*> div \$zero,\$a1,\$at +0+0080 <[^>]*> mflo \$a0 +0+0084 <[^>]*> li \$at,0x8000 +0+0088 <[^>]*> div \$zero,\$a0,\$at +0+008c <[^>]*> mflo \$a0 +0+0090 <[^>]*> li \$at,0x8000 +0+0094 <[^>]*> div \$zero,\$a1,\$at +0+0098 <[^>]*> mflo \$a0 +0+009c <[^>]*> li \$at,-32768 +0+00a0 <[^>]*> div \$zero,\$a0,\$at +0+00a4 <[^>]*> mflo \$a0 +0+00a8 <[^>]*> li \$at,-32768 +0+00ac <[^>]*> div \$zero,\$a1,\$at +0+00b0 <[^>]*> mflo \$a0 +0+00b4 <[^>]*> lui \$at,0x1 +0+00b8 <[^>]*> div \$zero,\$a0,\$at +0+00bc <[^>]*> mflo \$a0 +0+00c0 <[^>]*> lui \$at,0x1 +0+00c4 <[^>]*> div \$zero,\$a1,\$at +0+00c8 <[^>]*> mflo \$a0 +0+00cc <[^>]*> lui \$at,0x1 +0+00d0 <[^>]*> ori \$at,\$at,0xa5a5 +0+00d4 <[^>]*> div \$zero,\$a0,\$at +0+00d8 <[^>]*> mflo \$a0 +0+00dc <[^>]*> lui \$at,0x1 +0+00e0 <[^>]*> ori \$at,\$at,0xa5a5 +0+00e4 <[^>]*> div \$zero,\$a1,\$at +0+00e8 <[^>]*> mflo \$a0 +0+00ec <[^>]*> divu \$zero,\$a0,\$a1 +0+00f0 <[^>]*> divu \$zero,\$a0,\$a1 +0+00f4 <[^>]*> bnez \$a1,0+0100 +0+00f8 <[^>]*> nop +0+00fc <[^>]*> break 0x7 +0+0100 <[^>]*> mflo \$a0 +0+0104 <[^>]*> divu \$zero,\$a1,\$a2 +0+0108 <[^>]*> bnez \$a2,0+0114 +0+010c <[^>]*> nop +0+0110 <[^>]*> break 0x7 +0+0114 <[^>]*> mflo \$a0 +0+0118 <[^>]*> move \$a0,\$a0 +0+011c <[^>]*> div \$zero,\$a1,\$a2 +0+0120 <[^>]*> bnez \$a2,0+012c +0+0124 <[^>]*> nop +0+0128 <[^>]*> break 0x7 +0+012c <[^>]*> li \$at,-1 +0+0130 <[^>]*> bne \$a2,\$at,0+0144 +0+0134 <[^>]*> lui \$at,0x8000 +0+0138 <[^>]*> bne \$a1,\$at,0+0144 +0+013c <[^>]*> nop +0+0140 <[^>]*> break 0x6 +0+0144 <[^>]*> mfhi \$a0 +0+0148 <[^>]*> li \$at,2 +0+014c <[^>]*> divu \$zero,\$a1,\$at +0+0150 <[^>]*> mfhi \$a0 +0+0154 <[^>]*> ddiv \$zero,\$a1,\$a2 +0+0158 <[^>]*> bnez \$a2,0+0164 +0+015c <[^>]*> nop +0+0160 <[^>]*> break 0x7 +0+0164 <[^>]*> daddiu \$at,\$zero,-1 +0+0168 <[^>]*> bne \$a2,\$at,0+0180 +0+016c <[^>]*> daddiu \$at,\$zero,1 +0+0170 <[^>]*> dsll32 \$at,\$at,0x1f +0+0174 <[^>]*> bne \$a1,\$at,0+0180 +0+0178 <[^>]*> nop +0+017c <[^>]*> break 0x6 +0+0180 <[^>]*> mflo \$a0 +0+0184 <[^>]*> li \$at,2 +0+0188 <[^>]*> ddivu \$zero,\$a1,\$at +0+018c <[^>]*> mflo \$a0 +0+0190 <[^>]*> li \$at,0x8000 +0+0194 <[^>]*> ddiv \$zero,\$a1,\$at +0+0198 <[^>]*> mfhi \$a0 +0+019c <[^>]*> li \$at,-32768 +0+01a0 <[^>]*> ddivu \$zero,\$a1,\$at +0+01a4 <[^>]*> mfhi \$a0 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/div.d binutils-2.8/gas/testsuite/gas/mips/div.d --- binutils-2.7/gas/testsuite/gas/mips/div.d Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/div.d Wed Apr 30 12:54:28 1997 @@ -1,132 +1,131 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS div # Test the div macro. .*: +file format .*mips.* -No symbols in .* Disassembly of section .text: -0+0000 div \$zero,\$a0,\$a1 -0+0004 div \$zero,\$a0,\$a1 -0+0008 bnez \$a1,0+0014 -... -0+0010 break 0x7 -0+0014 li \$at,-1 -0+0018 bne \$a1,\$at,0+002c -0+001c lui \$at,0x8000 -0+0020 bne \$a0,\$at,0+002c -... -0+0028 break 0x6 -0+002c mflo \$a0 -... -0+0038 div \$zero,\$a1,\$a2 -0+003c bnez \$a2,0+0048 -... -0+0044 break 0x7 -0+0048 li \$at,-1 -0+004c bne \$a2,\$at,0+0060 -0+0050 lui \$at,0x8000 -0+0054 bne \$a1,\$at,0+0060 -... -0+005c break 0x6 -0+0060 mflo \$a0 -0+0064 move \$a0,\$a0 -0+0068 move \$a0,\$a1 -0+006c neg \$a0,\$a0 -0+0070 neg \$a0,\$a1 -0+0074 li \$at,2 -0+0078 div \$zero,\$a0,\$at -0+007c mflo \$a0 -0+0080 li \$at,2 -... -0+0088 div \$zero,\$a1,\$at -0+008c mflo \$a0 -0+0090 li \$at,0x8000 -... -0+0098 div \$zero,\$a0,\$at -0+009c mflo \$a0 -0+00a0 li \$at,0x8000 -... -0+00a8 div \$zero,\$a1,\$at -0+00ac mflo \$a0 -0+00b0 li \$at,-32768 -... -0+00b8 div \$zero,\$a0,\$at -0+00bc mflo \$a0 -0+00c0 li \$at,-32768 -... -0+00c8 div \$zero,\$a1,\$at -0+00cc mflo \$a0 -0+00d0 lui \$at,0x1 -... -0+00d8 div \$zero,\$a0,\$at -0+00dc mflo \$a0 -0+00e0 lui \$at,0x1 -... -0+00e8 div \$zero,\$a1,\$at -0+00ec mflo \$a0 -0+00f0 lui \$at,0x1 -0+00f4 ori \$at,\$at,0xa5a5 -0+00f8 div \$zero,\$a0,\$at -0+00fc mflo \$a0 -0+0100 lui \$at,0x1 -0+0104 ori \$at,\$at,0xa5a5 -0+0108 div \$zero,\$a1,\$at -0+010c mflo \$a0 -... -0+0118 divu \$zero,\$a0,\$a1 -0+011c divu \$zero,\$a0,\$a1 -0+0120 bnez \$a1,0+012c -... -0+0128 break 0x7 -0+012c mflo \$a0 -... -0+0138 divu \$zero,\$a1,\$a2 -0+013c bnez \$a2,0+0148 -... -0+0144 break 0x7 -0+0148 mflo \$a0 -0+014c move \$a0,\$a0 -... -0+0154 div \$zero,\$a1,\$a2 -0+0158 bnez \$a2,0+0164 -... -0+0160 break 0x7 -0+0164 li \$at,-1 -0+0168 bne \$a2,\$at,0+017c -0+016c lui \$at,0x8000 -0+0170 bne \$a1,\$at,0+017c -... -0+0178 break 0x6 -0+017c mfhi \$a0 -0+0180 li \$at,2 -... -0+0188 divu \$zero,\$a1,\$at -0+018c mfhi \$a0 -... -0+0198 ddiv \$zero,\$a1,\$a2 -0+019c bnez \$a2,0+01a8 -... -0+01a4 break 0x7 -0+01a8 daddiu \$at,\$zero,-1 -0+01ac bne \$a2,\$at,0+01c4 -0+01b0 daddiu \$at,\$zero,1 -0+01b4 dsll32 \$at,\$at,0x1f -0+01b8 bne \$a1,\$at,0+01c4 -... -0+01c0 break 0x6 -0+01c4 mflo \$a0 -0+01c8 li \$at,2 -... -0+01d0 ddivu \$zero,\$a1,\$at -0+01d4 mflo \$a0 -0+01d8 li \$at,0x8000 -... -0+01e0 ddiv \$zero,\$a1,\$at -0+01e4 mfhi \$a0 -0+01e8 li \$at,-32768 -... -0+01f0 ddivu \$zero,\$a1,\$at -0+01f4 mfhi \$a0 -... +0+0000 <[^>]*> div \$zero,\$a0,\$a1 +0+0004 <[^>]*> div \$zero,\$a0,\$a1 +0+0008 <[^>]*> bnez \$a1,0+0014 +0+000c <[^>]*> nop +0+0010 <[^>]*> break 0x7 +0+0014 <[^>]*> li \$at,-1 +0+0018 <[^>]*> bne \$a1,\$at,0+002c +0+001c <[^>]*> lui \$at,0x8000 +0+0020 <[^>]*> bne \$a0,\$at,0+002c +0+0024 <[^>]*> nop +0+0028 <[^>]*> break 0x6 +0+002c <[^>]*> mflo \$a0 + ... +0+0038 <[^>]*> div \$zero,\$a1,\$a2 +0+003c <[^>]*> bnez \$a2,0+0048 +0+0040 <[^>]*> nop +0+0044 <[^>]*> break 0x7 +0+0048 <[^>]*> li \$at,-1 +0+004c <[^>]*> bne \$a2,\$at,0+0060 +0+0050 <[^>]*> lui \$at,0x8000 +0+0054 <[^>]*> bne \$a1,\$at,0+0060 +0+0058 <[^>]*> nop +0+005c <[^>]*> break 0x6 +0+0060 <[^>]*> mflo \$a0 +0+0064 <[^>]*> move \$a0,\$a0 +0+0068 <[^>]*> move \$a0,\$a1 +0+006c <[^>]*> neg \$a0,\$a0 +0+0070 <[^>]*> neg \$a0,\$a1 +0+0074 <[^>]*> li \$at,2 +0+0078 <[^>]*> div \$zero,\$a0,\$at +0+007c <[^>]*> mflo \$a0 +0+0080 <[^>]*> li \$at,2 +0+0084 <[^>]*> nop +0+0088 <[^>]*> div \$zero,\$a1,\$at +0+008c <[^>]*> mflo \$a0 +0+0090 <[^>]*> li \$at,0x8000 +0+0094 <[^>]*> nop +0+0098 <[^>]*> div \$zero,\$a0,\$at +0+009c <[^>]*> mflo \$a0 +0+00a0 <[^>]*> li \$at,0x8000 +0+00a4 <[^>]*> nop +0+00a8 <[^>]*> div \$zero,\$a1,\$at +0+00ac <[^>]*> mflo \$a0 +0+00b0 <[^>]*> li \$at,-32768 +0+00b4 <[^>]*> nop +0+00b8 <[^>]*> div \$zero,\$a0,\$at +0+00bc <[^>]*> mflo \$a0 +0+00c0 <[^>]*> li \$at,-32768 +0+00c4 <[^>]*> nop +0+00c8 <[^>]*> div \$zero,\$a1,\$at +0+00cc <[^>]*> mflo \$a0 +0+00d0 <[^>]*> lui \$at,0x1 +0+00d4 <[^>]*> nop +0+00d8 <[^>]*> div \$zero,\$a0,\$at +0+00dc <[^>]*> mflo \$a0 +0+00e0 <[^>]*> lui \$at,0x1 +0+00e4 <[^>]*> nop +0+00e8 <[^>]*> div \$zero,\$a1,\$at +0+00ec <[^>]*> mflo \$a0 +0+00f0 <[^>]*> lui \$at,0x1 +0+00f4 <[^>]*> ori \$at,\$at,0xa5a5 +0+00f8 <[^>]*> div \$zero,\$a0,\$at +0+00fc <[^>]*> mflo \$a0 +0+0100 <[^>]*> lui \$at,0x1 +0+0104 <[^>]*> ori \$at,\$at,0xa5a5 +0+0108 <[^>]*> div \$zero,\$a1,\$at +0+010c <[^>]*> mflo \$a0 + ... +0+0118 <[^>]*> divu \$zero,\$a0,\$a1 +0+011c <[^>]*> divu \$zero,\$a0,\$a1 +0+0120 <[^>]*> bnez \$a1,0+012c +0+0124 <[^>]*> nop +0+0128 <[^>]*> break 0x7 +0+012c <[^>]*> mflo \$a0 + ... +0+0138 <[^>]*> divu \$zero,\$a1,\$a2 +0+013c <[^>]*> bnez \$a2,0+0148 +0+0140 <[^>]*> nop +0+0144 <[^>]*> break 0x7 +0+0148 <[^>]*> mflo \$a0 +0+014c <[^>]*> move \$a0,\$a0 +0+0150 <[^>]*> nop +0+0154 <[^>]*> div \$zero,\$a1,\$a2 +0+0158 <[^>]*> bnez \$a2,0+0164 +0+015c <[^>]*> nop +0+0160 <[^>]*> break 0x7 +0+0164 <[^>]*> li \$at,-1 +0+0168 <[^>]*> bne \$a2,\$at,0+017c +0+016c <[^>]*> lui \$at,0x8000 +0+0170 <[^>]*> bne \$a1,\$at,0+017c +0+0174 <[^>]*> nop +0+0178 <[^>]*> break 0x6 +0+017c <[^>]*> mfhi \$a0 +0+0180 <[^>]*> li \$at,2 +0+0184 <[^>]*> nop +0+0188 <[^>]*> divu \$zero,\$a1,\$at +0+018c <[^>]*> mfhi \$a0 + ... +0+0198 <[^>]*> ddiv \$zero,\$a1,\$a2 +0+019c <[^>]*> bnez \$a2,0+01a8 +0+01a0 <[^>]*> nop +0+01a4 <[^>]*> break 0x7 +0+01a8 <[^>]*> daddiu \$at,\$zero,-1 +0+01ac <[^>]*> bne \$a2,\$at,0+01c4 +0+01b0 <[^>]*> daddiu \$at,\$zero,1 +0+01b4 <[^>]*> dsll32 \$at,\$at,0x1f +0+01b8 <[^>]*> bne \$a1,\$at,0+01c4 +0+01bc <[^>]*> nop +0+01c0 <[^>]*> break 0x6 +0+01c4 <[^>]*> mflo \$a0 +0+01c8 <[^>]*> li \$at,2 +0+01cc <[^>]*> nop +0+01d0 <[^>]*> ddivu \$zero,\$a1,\$at +0+01d4 <[^>]*> mflo \$a0 +0+01d8 <[^>]*> li \$at,0x8000 +0+01dc <[^>]*> nop +0+01e0 <[^>]*> ddiv \$zero,\$a1,\$at +0+01e4 <[^>]*> mfhi \$a0 +0+01e8 <[^>]*> li \$at,-32768 +0+01ec <[^>]*> nop +0+01f0 <[^>]*> ddivu \$zero,\$a1,\$at +0+01f4 <[^>]*> mfhi \$a0 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/div.s binutils-2.8/gas/testsuite/gas/mips/div.s --- binutils-2.7/gas/testsuite/gas/mips/div.s Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/div.s Wed Apr 30 12:54:28 1997 @@ -1,4 +1,5 @@ # Source file used to test the div macro. +foo: div $0,$4,$5 div $4,$5 div $4,$5,$6 diff -urN binutils-2.7/gas/testsuite/gas/mips/dli.d binutils-2.8/gas/testsuite/gas/mips/dli.d --- binutils-2.7/gas/testsuite/gas/mips/dli.d Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mips/dli.d Wed Apr 30 12:54:28 1997 @@ -0,0 +1,115 @@ +#objdump: -dr --prefix-addresses +#name: MIPS dli +#as: -mips3 + +# Test the dli macro. + +.*: +file format .*mips.* + +Disassembly of section .text: +0+0000 <[^>]*> li \$a0,0 +0+0004 <[^>]*> li \$a0,1 +0+0008 <[^>]*> li \$a0,-1 +0+000c <[^>]*> li \$a0,0x8000 +0+0010 <[^>]*> li \$a0,-32768 +0+0014 <[^>]*> lui \$a0,0x1 +0+0018 <[^>]*> lui \$a0,0x1 +0+001c <[^>]*> ori \$a0,\$a0,0xa5a5 +0+0020 <[^>]*> li \$a0,0x8000 +0+0024 <[^>]*> dsll \$a0,\$a0,0x10 +0+0028 <[^>]*> ori \$a0,\$a0,0x1234 +0+002c <[^>]*> lui \$a0,0xffff +0+0030 <[^>]*> dsrl32 \$a0,\$a0,0x0 +0+0034 <[^>]*> lui \$a0,0xffff +0+0038 <[^>]*> dsrl32 \$a0,\$a0,0x0 +0+003c <[^>]*> li \$a0,-1 +0+0040 <[^>]*> li \$a0,-1 +0+0044 <[^>]*> dsrl \$a0,\$a0,0xc +0+0048 <[^>]*> lui \$a0,0x8000 +0+004c <[^>]*> ori \$a0,\$a0,0x1234 +0+0050 <[^>]*> li \$a0,-32768 +0+0054 <[^>]*> dsll \$a0,\$a0,0x10 +0+0058 <[^>]*> ori \$a0,\$a0,0x1234 +0+005c <[^>]*> dsll \$a0,\$a0,0x10 +0+0060 <[^>]*> ori \$a0,\$a0,0x5678 +0+0064 <[^>]*> lui \$a0,0x8000 +0+0068 <[^>]*> ori \$a0,\$a0,0x1234 +0+006c <[^>]*> dsll \$a0,\$a0,0x10 +0+0070 <[^>]*> ori \$a0,\$a0,0x5678 +0+0074 <[^>]*> dsll \$a0,\$a0,0x10 +0+0078 <[^>]*> li \$a0,-30875 +0+007c <[^>]*> lui \$a0,0xffff +0+0080 <[^>]*> ori \$a0,\$a0,0x4321 +0+0084 <[^>]*> li \$a0,-16 +0+0088 <[^>]*> li \$a0,-256 +0+008c <[^>]*> li \$a0,-4096 +0+0090 <[^>]*> lui \$a0,0xffff +0+0094 <[^>]*> lui \$a0,0xfff0 +0+0098 <[^>]*> lui \$a0,0xff00 +0+009c <[^>]*> lui \$a0,0xf000 +0+00a0 <[^>]*> li \$a0,-1 +0+00a4 <[^>]*> dsll32 \$a0,\$a0,0x0 +0+00a8 <[^>]*> li \$a0,-16 +0+00ac <[^>]*> dsll32 \$a0,\$a0,0x0 +0+00b0 <[^>]*> li \$a0,-256 +0+00b4 <[^>]*> dsll32 \$a0,\$a0,0x0 +0+00b8 <[^>]*> li \$a0,-4096 +0+00bc <[^>]*> dsll32 \$a0,\$a0,0x0 +0+00c0 <[^>]*> li \$a0,0xffff +0+00c4 <[^>]*> dsll32 \$a0,\$a0,0x10 +0+00c8 <[^>]*> li \$a0,0xfff0 +0+00cc <[^>]*> dsll32 \$a0,\$a0,0x10 +0+00d0 <[^>]*> li \$a0,0xff00 +0+00d4 <[^>]*> dsll32 \$a0,\$a0,0x10 +0+00d8 <[^>]*> li \$a0,0xf000 +0+00dc <[^>]*> dsll32 \$a0,\$a0,0x10 +0+00e0 <[^>]*> li \$a0,-1 +0+00e4 <[^>]*> dsrl \$a0,\$a0,0x4 +0+00e8 <[^>]*> li \$a0,-1 +0+00ec <[^>]*> dsrl \$a0,\$a0,0x8 +0+00f0 <[^>]*> li \$a0,-1 +0+00f4 <[^>]*> dsrl \$a0,\$a0,0xc +0+00f8 <[^>]*> li \$a0,-1 +0+00fc <[^>]*> dsrl \$a0,\$a0,0x10 +0+0100 <[^>]*> li \$a0,-1 +0+0104 <[^>]*> dsrl \$a0,\$a0,0x14 +0+0108 <[^>]*> li \$a0,-1 +0+010c <[^>]*> dsrl \$a0,\$a0,0x18 +0+0110 <[^>]*> li \$a0,-1 +0+0114 <[^>]*> dsrl \$a0,\$a0,0x1c +0+0118 <[^>]*> lui \$a0,0xffff +0+011c <[^>]*> dsrl32 \$a0,\$a0,0x0 +0+0120 <[^>]*> lui \$a0,0xfff +0+0124 <[^>]*> ori \$a0,\$a0,0xffff +0+0128 <[^>]*> lui \$a0,0xff +0+012c <[^>]*> ori \$a0,\$a0,0xffff +0+0130 <[^>]*> lui \$a0,0xf +0+0134 <[^>]*> ori \$a0,\$a0,0xffff +0+0138 <[^>]*> li \$a0,0xffff +0+013c <[^>]*> li \$a0,4095 +0+0140 <[^>]*> li \$a0,255 +0+0144 <[^>]*> li \$a0,15 +0+0148 <[^>]*> lui \$a0,0x3 +0+014c <[^>]*> ori \$a0,\$a0,0xfffc +0+0150 <[^>]*> li \$a0,0xffff +0+0154 <[^>]*> dsll \$a0,\$a0,0x1e +0+0158 <[^>]*> li \$a0,0xffff +0+015c <[^>]*> dsll32 \$a0,\$a0,0x2 +0+0160 <[^>]*> li \$a0,0xffff +0+0164 <[^>]*> dsll32 \$a0,\$a0,0x6 +0+0168 <[^>]*> li \$a0,-1 +0+016c <[^>]*> dsll32 \$a0,\$a0,0x0 +0+0170 <[^>]*> dsrl \$a0,\$a0,0xa +0+0174 <[^>]*> li \$a0,-1 +0+0178 <[^>]*> dsll \$a0,\$a0,0x1c +0+017c <[^>]*> dsrl \$a0,\$a0,0xa +0+0180 <[^>]*> li \$a0,-1 +0+0184 <[^>]*> dsll \$a0,\$a0,0x18 +0+0188 <[^>]*> dsrl \$a0,\$a0,0xa +0+018c <[^>]*> lui \$a0,0x3f +0+0190 <[^>]*> ori \$a0,\$a0,0xfc03 +0+0194 <[^>]*> dsll \$a0,\$a0,0x10 +0+0198 <[^>]*> ori \$a0,\$a0,0xffff +0+019c <[^>]*> dsll \$a0,\$a0,0x10 +0+01a0 <[^>]*> ori \$a0,\$a0,0xc000 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/dli.s binutils-2.8/gas/testsuite/gas/mips/dli.s --- binutils-2.7/gas/testsuite/gas/mips/dli.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mips/dli.s Wed Apr 30 12:54:29 1997 @@ -0,0 +1,67 @@ +# Source file used to test the dli macro. + +foo: + dli $4,0 + dli $4,1 + dli $4,-1 + dli $4,0x8000 + dli $4,-0x8000 + dli $4,0x10000 + dli $4,0x1a5a5 + dli $4,0x80001234 + dli $4,0xffffffff + dli $4,0x00000000ffffffff + dli $4,0xffffffffffffffff + dli $4,0x000fffffffffffff + dli $4,0xffffffff80001234 + dli $4,0xffff800012345678 + dli $4,0x8000123456780000 + dli $4,0xffffffffffff8765 + dli $4,0xffffffffffff4321 + + dli $4,0xfffffffffffffff0 + dli $4,0xffffffffffffff00 + dli $4,0xfffffffffffff000 + dli $4,0xffffffffffff0000 + dli $4,0xfffffffffff00000 + dli $4,0xffffffffff000000 + dli $4,0xfffffffff0000000 + dli $4,0xffffffff00000000 + dli $4,0xfffffff000000000 + dli $4,0xffffff0000000000 + dli $4,0xfffff00000000000 + dli $4,0xffff000000000000 + dli $4,0xfff0000000000000 + dli $4,0xff00000000000000 + dli $4,0xf000000000000000 + + dli $4,0x0fffffffffffffff + dli $4,0x00ffffffffffffff + dli $4,0x000fffffffffffff + dli $4,0x0000ffffffffffff + dli $4,0x00000fffffffffff + dli $4,0x000000ffffffffff + dli $4,0x0000000fffffffff + dli $4,0x00000000ffffffff + dli $4,0x000000000fffffff + dli $4,0x0000000000ffffff + dli $4,0x00000000000fffff + dli $4,0x000000000000ffff + dli $4,0x0000000000000fff + dli $4,0x00000000000000ff + dli $4,0x000000000000000f + + dli $4,0x000000000003fffc + dli $4,0x00003fffc0000000 + dli $4,0x0003fffc00000000 + dli $4,0x003fffc000000000 + dli $4,0x003fffffffc00000 + dli $4,0x003ffffffffc0000 + dli $4,0x003fffffffffc000 + + dli $4,0x003ffc03ffffc000 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/itbl binutils-2.8/gas/testsuite/gas/mips/itbl --- binutils-2.7/gas/testsuite/gas/mips/itbl Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mips/itbl Wed Apr 30 12:54:29 1997 @@ -0,0 +1,19 @@ + + ; Test case for assembler option "itbl". + ; Run as "as --itbl itbl itbl.s" + ; or with stand-alone test case "itbl-test itbl itbl.s". + ; Here, the processors represent mips coprocessors. + + p1 dreg d1 1 ; data register "d1" for COP1 has value 1 + p1 creg c3 3 ; ctrl register "c3" for COP1 has value 3 + p3 insn fie 0x1e:24-20 ; function "fill" for COP3 has value 31 + p3 dreg d3 3 ; data register "d3" for COP3 has value 3 + p3 creg c2 22 ; control register "c2" for COP3 has value 22 + p3 insn fee 0x1e:24-20,dreg:17-13,creg:12-8,immed:7-0 + + p3 dreg d3 3 ; data register "d3" for COP3 has value 3 + p3 creg c2 22 ; control register "c2" for COP3 has value 22 + p3 insn fum 0x01e00001 dreg:17-13 creg:12-8 + p3 insn foh 0xf:24-21 dreg:20-16 immed:15-0 + + p3 insn pig 0x1:24-21*[0x100|0x2], dreg:20-16, immed:15-0*0x10000 diff -urN binutils-2.7/gas/testsuite/gas/mips/itbl.s binutils-2.8/gas/testsuite/gas/mips/itbl.s --- binutils-2.7/gas/testsuite/gas/mips/itbl.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mips/itbl.s Wed Apr 30 12:54:29 1997 @@ -0,0 +1,18 @@ + + ; Test case for assembler option "itbl". + ; Run as "as --itbl itbl itbl.s" + ; or with stand-alone test case "itbl-test itbl itbl.s". + + ; Call mips coprocessor "cofun"s as defined in "itbl". + + fee $d3,$c2,0x1 ; 0x4ff07601 + fie ; 0x4ff00000 + foh $2,0x100 + fum $d3,$c2 ; 0x4ff07601 + pig $2,0x100 + + ; Call a mips coprocessor instruction with register "d1" + ; defined in "itbl". + + LWC1 $d1,0x100($2) + diff -urN binutils-2.7/gas/testsuite/gas/mips/jal-empic.d binutils-2.8/gas/testsuite/gas/mips/jal-empic.d --- binutils-2.7/gas/testsuite/gas/mips/jal-empic.d Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/jal-empic.d Wed Apr 30 12:54:27 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS jal-empic #as: -mips1 -membedded-pic #source: jal.s @@ -8,19 +8,19 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> jalr \$t9 -... -0+0008 <[^>]*> jalr \$a0,\$t9 -... -0+0010 <[^>]*> bal 0+0000 -[ ]*RELOC: 0+0010 PCREL16 .text -... -0+0018 <[^>]*> bal 0+0018 -[ ]*RELOC: 0+0018 PCREL16 external_text_label -... -0+0020 <[^>]*> b 0+0000 -[ ]*RELOC: 0+0020 PCREL16 .text -... -0+0028 <[^>]*> b 0+0028 -[ ]*RELOC: 0+0028 PCREL16 external_text_label -... +0+0000 <[^>]*> jalr \$t9 +0+0004 <[^>]*> nop +0+0008 <[^>]*> jalr \$a0,\$t9 +0+000c <[^>]*> nop +0+0010 <[^>]*> bal 0+0000 +[ ]*10: PCREL16 .text +0+0014 <[^>]*> nop +0+0018 <[^>]*> bal 0+0018 +[ ]*18: PCREL16 external_text_label +0+001c <[^>]*> nop +0+0020 <[^>]*> b 0+0000 +[ ]*20: PCREL16 .text +0+0024 <[^>]*> nop +0+0028 <[^>]*> b 0+0028 +[ ]*28: PCREL16 external_text_label +0+002c <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/jal-svr4pic.d binutils-2.8/gas/testsuite/gas/mips/jal-svr4pic.d --- binutils-2.7/gas/testsuite/gas/mips/jal-svr4pic.d Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/jal-svr4pic.d Wed Apr 30 12:54:29 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS jal-svr4pic #as: -mips1 -KPIC @@ -7,33 +7,33 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lui \$gp,0x0 -[ ]*RELOC: 0+0000 R_MIPS_HI16 _gp_disp -0+0004 <[^>]*> addiu \$gp,\$gp,0 -[ ]*RELOC: 0+0004 R_MIPS_LO16 _gp_disp -0+0008 <[^>]*> addu \$gp,\$gp,\$t9 -0+000c <[^>]*> sw \$gp,0\(\$sp\) -0+0010 <[^>]*> jalr \$t9 -... -0+0018 <[^>]*> lw \$gp,0\(\$sp\) -0+001c <[^>]*> jalr \$a0,\$t9 -... -0+0024 <[^>]*> lw \$gp,0\(\$sp\) -... -0+002c <[^>]*> lw \$t9,0\(\$gp\) -[ ]*RELOC: 0+002c R_MIPS_GOT16 .text -... -0+0034 <[^>]*> addiu \$t9,\$t9,0 -[ ]*RELOC: 0+0034 R_MIPS_LO16 .text -0+0038 <[^>]*> jalr \$t9 -... -0+0040 <[^>]*> lw \$gp,0\(\$sp\) -... -0+0048 <[^>]*> lw \$t9,0\(\$gp\) -[ ]*RELOC: 0+0048 R_MIPS_CALL16 external_text_label -... -0+0050 <[^>]*> jalr \$t9 -... -0+0058 <[^>]*> lw \$gp,0\(\$sp\) -0+005c <[^>]*> b 0+0000 -... +0+0000 <[^>]*> lui \$gp,0x0 +[ ]*0: R_MIPS_HI16 _gp_disp +0+0004 <[^>]*> addiu \$gp,\$gp,0 +[ ]*4: R_MIPS_LO16 _gp_disp +0+0008 <[^>]*> addu \$gp,\$gp,\$t9 +0+000c <[^>]*> sw \$gp,0\(\$sp\) +0+0010 <[^>]*> jalr \$t9 +0+0014 <[^>]*> nop +0+0018 <[^>]*> lw \$gp,0\(\$sp\) +0+001c <[^>]*> jalr \$a0,\$t9 +0+0020 <[^>]*> nop +0+0024 <[^>]*> lw \$gp,0\(\$sp\) +0+0028 <[^>]*> nop +0+002c <[^>]*> lw \$t9,0\(\$gp\) +[ ]*2c: R_MIPS_GOT16 .text +0+0030 <[^>]*> nop +0+0034 <[^>]*> addiu \$t9,\$t9,0 +[ ]*34: R_MIPS_LO16 .text +0+0038 <[^>]*> jalr \$t9 +0+003c <[^>]*> nop +0+0040 <[^>]*> lw \$gp,0\(\$sp\) +0+0044 <[^>]*> nop +0+0048 <[^>]*> lw \$t9,0\(\$gp\) +[ ]*48: R_MIPS_CALL16 external_text_label +0+004c <[^>]*> nop +0+0050 <[^>]*> jalr \$t9 +0+0054 <[^>]*> nop +0+0058 <[^>]*> lw \$gp,0\(\$sp\) +0+005c <[^>]*> b 0+0000 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/jal-svr4pic.s binutils-2.8/gas/testsuite/gas/mips/jal-svr4pic.s --- binutils-2.7/gas/testsuite/gas/mips/jal-svr4pic.s Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/jal-svr4pic.s Wed Apr 30 12:54:29 1997 @@ -12,3 +12,9 @@ # Test j as well j text_label + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/jal-xgot.d binutils-2.8/gas/testsuite/gas/mips/jal-xgot.d --- binutils-2.7/gas/testsuite/gas/mips/jal-xgot.d Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/jal-xgot.d Wed Apr 30 12:54:29 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS jal-xgot #as: -mips1 -KPIC -xgot #source: jal-svr4pic.s @@ -8,35 +8,35 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lui \$gp,0x0 -[ ]*RELOC: 0+0000 R_MIPS_HI16 _gp_disp -0+0004 <[^>]*> addiu \$gp,\$gp,0 -[ ]*RELOC: 0+0004 R_MIPS_LO16 _gp_disp -0+0008 <[^>]*> addu \$gp,\$gp,\$t9 -0+000c <[^>]*> sw \$gp,0\(\$sp\) -0+0010 <[^>]*> jalr \$t9 -... -0+0018 <[^>]*> lw \$gp,0\(\$sp\) -0+001c <[^>]*> jalr \$a0,\$t9 -... -0+0024 <[^>]*> lw \$gp,0\(\$sp\) -... -0+002c <[^>]*> lw \$t9,0\(\$gp\) -[ ]*RELOC: 0+002c R_MIPS_GOT16 .text -... -0+0034 <[^>]*> addiu \$t9,\$t9,0 -[ ]*RELOC: 0+0034 R_MIPS_LO16 .text -0+0038 <[^>]*> jalr \$t9 -... -0+0040 <[^>]*> lw \$gp,0\(\$sp\) -0+0044 <[^>]*> lui \$t9,0x0 -[ ]*RELOC: 0+0044 R_MIPS_CALL_HI16 external_text_label -0+0048 <[^>]*> addu \$t9,\$t9,\$gp -0+004c <[^>]*> lw \$t9,0\(\$t9\) -[ ]*RELOC: 0+004c R_MIPS_CALL_LO16 external_text_label -... -0+0054 <[^>]*> jalr \$t9 -... -0+005c <[^>]*> lw \$gp,0\(\$sp\) -0+0060 <[^>]*> b 0+0000 -... +0+0000 <[^>]*> lui \$gp,0x0 +[ ]*0: R_MIPS_HI16 _gp_disp +0+0004 <[^>]*> addiu \$gp,\$gp,0 +[ ]*4: R_MIPS_LO16 _gp_disp +0+0008 <[^>]*> addu \$gp,\$gp,\$t9 +0+000c <[^>]*> sw \$gp,0\(\$sp\) +0+0010 <[^>]*> jalr \$t9 +0+0014 <[^>]*> nop +0+0018 <[^>]*> lw \$gp,0\(\$sp\) +0+001c <[^>]*> jalr \$a0,\$t9 +0+0020 <[^>]*> nop +0+0024 <[^>]*> lw \$gp,0\(\$sp\) +0+0028 <[^>]*> nop +0+002c <[^>]*> lw \$t9,0\(\$gp\) +[ ]*2c: R_MIPS_GOT16 .text +0+0030 <[^>]*> nop +0+0034 <[^>]*> addiu \$t9,\$t9,0 +[ ]*34: R_MIPS_LO16 .text +0+0038 <[^>]*> jalr \$t9 +0+003c <[^>]*> nop +0+0040 <[^>]*> lw \$gp,0\(\$sp\) +0+0044 <[^>]*> lui \$t9,0x0 +[ ]*44: R_MIPS_CALL_HI16 external_text_label +0+0048 <[^>]*> addu \$t9,\$t9,\$gp +0+004c <[^>]*> lw \$t9,0\(\$t9\) +[ ]*4c: R_MIPS_CALL_LO16 external_text_label +0+0050 <[^>]*> nop +0+0054 <[^>]*> jalr \$t9 +0+0058 <[^>]*> nop +0+005c <[^>]*> lw \$gp,0\(\$sp\) +0+0060 <[^>]*> b 0+0000 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/jal.d binutils-2.8/gas/testsuite/gas/mips/jal.d --- binutils-2.7/gas/testsuite/gas/mips/jal.d Thu Jul 4 12:15:55 1996 +++ binutils-2.8/gas/testsuite/gas/mips/jal.d Wed Apr 30 12:54:29 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS jal # Test the jal macro. @@ -6,19 +6,19 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> jalr \$t9 -... -0+0008 <[^>]*> jalr \$a0,\$t9 -... -0+0010 <[^>]*> jal 0+ -[ ]*RELOC: 0+0010 (MIPS_JMP|MIPS_JMP|JMPADDR|R_MIPS_26) .text -... -0+0018 <[^>]*> jal 0+ -[ ]*RELOC: 0+0018 (MIPS_JMP|JMPADDR|R_MIPS_26) external_text_label -... -0+0020 <[^>]*> j 0+ -[ ]*RELOC: 0+0020 (MIPS_JMP|JMPADDR|R_MIPS_26) .text -... -0+0028 <[^>]*> j 0+ -[ ]*RELOC: 0+0028 (MIPS_JMP|JMPADDR|R_MIPS_26) external_text_label -... +0+0000 <[^>]*> jalr \$t9 +0+0004 <[^>]*> nop +0+0008 <[^>]*> jalr \$a0,\$t9 +0+000c <[^>]*> nop +0+0010 <[^>]*> jal 0+ +[ ]*10: (MIPS_JMP|MIPS_JMP|JMPADDR|R_MIPS_26) .text +0+0014 <[^>]*> nop +0+0018 <[^>]*> jal 0+ +[ ]*18: (MIPS_JMP|JMPADDR|R_MIPS_26) external_text_label +0+001c <[^>]*> nop +0+0020 <[^>]*> j 0+ +[ ]*20: (MIPS_JMP|JMPADDR|R_MIPS_26) .text +0+0024 <[^>]*> nop +0+0028 <[^>]*> j 0+ +[ ]*28: (MIPS_JMP|JMPADDR|R_MIPS_26) external_text_label +0+002c <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/la-empic.d binutils-2.8/gas/testsuite/gas/mips/la-empic.d --- binutils-2.7/gas/testsuite/gas/mips/la-empic.d Thu Jul 4 12:15:56 1996 +++ binutils-2.8/gas/testsuite/gas/mips/la-empic.d Wed Apr 30 12:54:29 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS la-empic #as: -mips1 -membedded-pic @@ -7,99 +7,99 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> li \$a0,0 -0+0004 <[^>]*> li \$a0,1 -0+0008 <[^>]*> li \$a0,0x8000 -0+000c <[^>]*> li \$a0,-32768 -0+0010 <[^>]*> lui \$a0,0x1 -0+0014 <[^>]*> lui \$a0,0x1 -0+0018 <[^>]*> ori \$a0,\$a0,0xa5a5 -0+001c <[^>]*> li \$a0,0 -0+0020 <[^>]*> addu \$a0,\$a0,\$a1 -0+0024 <[^>]*> li \$a0,1 -0+0028 <[^>]*> addu \$a0,\$a0,\$a1 -0+002c <[^>]*> li \$a0,0x8000 -0+0030 <[^>]*> addu \$a0,\$a0,\$a1 -0+0034 <[^>]*> li \$a0,-32768 -0+0038 <[^>]*> addu \$a0,\$a0,\$a1 -0+003c <[^>]*> lui \$a0,0x1 -0+0040 <[^>]*> addu \$a0,\$a0,\$a1 -0+0044 <[^>]*> lui \$a0,0x1 -0+0048 <[^>]*> ori \$a0,\$a0,0xa5a5 -0+004c <[^>]*> addu \$a0,\$a0,\$a1 -0+0050 <[^>]*> addiu \$a0,\$gp,-16384 -[ ]*RELOC: 0+0050 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+0054 <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+0054 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+0058 <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+0058 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+005c <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+005c [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+0060 <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+0060 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0064 <[^>]*> addiu \$a0,\$gp,-16384 -[ ]*RELOC: 0+0064 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0068 <[^>]*> addiu \$a0,\$gp,-15384 -[ ]*RELOC: 0+0068 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+006c <[^>]*> addiu \$a0,\$gp,-16383 -[ ]*RELOC: 0+006c [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+0070 <[^>]*> addiu \$a0,\$gp,1 -[ ]*RELOC: 0+0070 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+0074 <[^>]*> addiu \$a0,\$gp,1 -[ ]*RELOC: 0+0074 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0078 <[^>]*> addiu \$a0,\$gp,1 -[ ]*RELOC: 0+0078 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+007c <[^>]*> addiu \$a0,\$gp,1 -[ ]*RELOC: 0+007c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0080 <[^>]*> addiu \$a0,\$gp,-16383 -[ ]*RELOC: 0+0080 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0084 <[^>]*> addiu \$a0,\$gp,-15383 -[ ]*RELOC: 0+0084 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0088 <[^>]*> addiu \$a0,\$gp,-16384 -[ ]*RELOC: 0+0088 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+008c <[^>]*> addu \$a0,\$a0,\$a1 -0+0090 <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+0090 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+0094 <[^>]*> addu \$a0,\$a0,\$a1 -0+0098 <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+0098 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+009c <[^>]*> addu \$a0,\$a0,\$a1 -0+00a0 <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+00a0 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+00a4 <[^>]*> addu \$a0,\$a0,\$a1 -0+00a8 <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+00a8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00ac <[^>]*> addu \$a0,\$a0,\$a1 -0+00b0 <[^>]*> addiu \$a0,\$gp,-16384 -[ ]*RELOC: 0+00b0 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00b4 <[^>]*> addu \$a0,\$a0,\$a1 -0+00b8 <[^>]*> addiu \$a0,\$gp,-15384 -[ ]*RELOC: 0+00b8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00bc <[^>]*> addu \$a0,\$a0,\$a1 -0+00c0 <[^>]*> addiu \$a0,\$gp,-16383 -[ ]*RELOC: 0+00c0 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+00c4 <[^>]*> addu \$a0,\$a0,\$a1 -0+00c8 <[^>]*> addiu \$a0,\$gp,1 -[ ]*RELOC: 0+00c8 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+00cc <[^>]*> addu \$a0,\$a0,\$a1 -0+00d0 <[^>]*> addiu \$a0,\$gp,1 -[ ]*RELOC: 0+00d0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00d4 <[^>]*> addu \$a0,\$a0,\$a1 -0+00d8 <[^>]*> addiu \$a0,\$gp,1 -[ ]*RELOC: 0+00d8 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+00dc <[^>]*> addu \$a0,\$a0,\$a1 -0+00e0 <[^>]*> addiu \$a0,\$gp,1 -[ ]*RELOC: 0+00e0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00e4 <[^>]*> addu \$a0,\$a0,\$a1 -0+00e8 <[^>]*> addiu \$a0,\$gp,-16383 -[ ]*RELOC: 0+00e8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00ec <[^>]*> addu \$a0,\$a0,\$a1 -0+00f0 <[^>]*> addiu \$a0,\$gp,-15383 -[ ]*RELOC: 0+00f0 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00f4 <[^>]*> addu \$a0,\$a0,\$a1 -0+00f8 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00f8 RELHI external_text_label -0+00fc <[^>]*> addiu \$a0,\$a0,252 -[ ]*RELOC: 0+00fc RELLO external_text_label -0+0100 <[^>]*> li \$a0,248 -... +0+0000 <[^>]*> li \$a0,0 +0+0004 <[^>]*> li \$a0,1 +0+0008 <[^>]*> li \$a0,0x8000 +0+000c <[^>]*> li \$a0,-32768 +0+0010 <[^>]*> lui \$a0,0x1 +0+0014 <[^>]*> lui \$a0,0x1 +0+0018 <[^>]*> ori \$a0,\$a0,0xa5a5 +0+001c <[^>]*> li \$a0,0 +0+0020 <[^>]*> addu \$a0,\$a0,\$a1 +0+0024 <[^>]*> li \$a0,1 +0+0028 <[^>]*> addu \$a0,\$a0,\$a1 +0+002c <[^>]*> li \$a0,0x8000 +0+0030 <[^>]*> addu \$a0,\$a0,\$a1 +0+0034 <[^>]*> li \$a0,-32768 +0+0038 <[^>]*> addu \$a0,\$a0,\$a1 +0+003c <[^>]*> lui \$a0,0x1 +0+0040 <[^>]*> addu \$a0,\$a0,\$a1 +0+0044 <[^>]*> lui \$a0,0x1 +0+0048 <[^>]*> ori \$a0,\$a0,0xa5a5 +0+004c <[^>]*> addu \$a0,\$a0,\$a1 +0+0050 <[^>]*> addiu \$a0,\$gp,-16384 +[ ]*50: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+0054 <[^>]*> addiu \$a0,\$gp,0 +[ ]*54: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+0058 <[^>]*> addiu \$a0,\$gp,0 +[ ]*58: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+005c <[^>]*> addiu \$a0,\$gp,0 +[ ]*5c: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+0060 <[^>]*> addiu \$a0,\$gp,0 +[ ]*60: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0064 <[^>]*> addiu \$a0,\$gp,-16384 +[ ]*64: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0068 <[^>]*> addiu \$a0,\$gp,-15384 +[ ]*68: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+006c <[^>]*> addiu \$a0,\$gp,-16383 +[ ]*6c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+0070 <[^>]*> addiu \$a0,\$gp,1 +[ ]*70: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+0074 <[^>]*> addiu \$a0,\$gp,1 +[ ]*74: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0078 <[^>]*> addiu \$a0,\$gp,1 +[ ]*78: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+007c <[^>]*> addiu \$a0,\$gp,1 +[ ]*7c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0080 <[^>]*> addiu \$a0,\$gp,-16383 +[ ]*80: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0084 <[^>]*> addiu \$a0,\$gp,-15383 +[ ]*84: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0088 <[^>]*> addiu \$a0,\$gp,-16384 +[ ]*88: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+008c <[^>]*> addu \$a0,\$a0,\$a1 +0+0090 <[^>]*> addiu \$a0,\$gp,0 +[ ]*90: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+0094 <[^>]*> addu \$a0,\$a0,\$a1 +0+0098 <[^>]*> addiu \$a0,\$gp,0 +[ ]*98: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+009c <[^>]*> addu \$a0,\$a0,\$a1 +0+00a0 <[^>]*> addiu \$a0,\$gp,0 +[ ]*a0: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+00a4 <[^>]*> addu \$a0,\$a0,\$a1 +0+00a8 <[^>]*> addiu \$a0,\$gp,0 +[ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00ac <[^>]*> addu \$a0,\$a0,\$a1 +0+00b0 <[^>]*> addiu \$a0,\$gp,-16384 +[ ]*b0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00b4 <[^>]*> addu \$a0,\$a0,\$a1 +0+00b8 <[^>]*> addiu \$a0,\$gp,-15384 +[ ]*b8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00bc <[^>]*> addu \$a0,\$a0,\$a1 +0+00c0 <[^>]*> addiu \$a0,\$gp,-16383 +[ ]*c0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+00c4 <[^>]*> addu \$a0,\$a0,\$a1 +0+00c8 <[^>]*> addiu \$a0,\$gp,1 +[ ]*c8: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+00cc <[^>]*> addu \$a0,\$a0,\$a1 +0+00d0 <[^>]*> addiu \$a0,\$gp,1 +[ ]*d0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00d4 <[^>]*> addu \$a0,\$a0,\$a1 +0+00d8 <[^>]*> addiu \$a0,\$gp,1 +[ ]*d8: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+00dc <[^>]*> addu \$a0,\$a0,\$a1 +0+00e0 <[^>]*> addiu \$a0,\$gp,1 +[ ]*e0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00e4 <[^>]*> addu \$a0,\$a0,\$a1 +0+00e8 <[^>]*> addiu \$a0,\$gp,-16383 +[ ]*e8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00ec <[^>]*> addu \$a0,\$a0,\$a1 +0+00f0 <[^>]*> addiu \$a0,\$gp,-15383 +[ ]*f0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00f4 <[^>]*> addu \$a0,\$a0,\$a1 +0+00f8 <[^>]*> lui \$a0,0x0 +[ ]*f8: RELHI external_text_label +0+00fc <[^>]*> addiu \$a0,\$a0,252 +[ ]*fc: RELLO external_text_label +0+0100 <[^>]*> li \$a0,248 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/la-svr4pic.d binutils-2.8/gas/testsuite/gas/mips/la-svr4pic.d --- binutils-2.7/gas/testsuite/gas/mips/la-svr4pic.d Thu Jul 4 12:15:56 1996 +++ binutils-2.8/gas/testsuite/gas/mips/la-svr4pic.d Wed Apr 30 12:54:29 1997 @@ -1,6 +1,6 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS la-svr4pic -#as: -mips1 -KPIC +#as: -mips1 -KPIC --defsym KPIC=1 #source: la.s # Test the la macro with -KPIC. @@ -8,467 +8,467 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> li \$a0,0 -0+0004 <[^>]*> li \$a0,1 -0+0008 <[^>]*> li \$a0,0x8000 -0+000c <[^>]*> li \$a0,-32768 -0+0010 <[^>]*> lui \$a0,0x1 -0+0014 <[^>]*> lui \$a0,0x1 -0+0018 <[^>]*> ori \$a0,\$a0,0xa5a5 -0+001c <[^>]*> li \$a0,0 -0+0020 <[^>]*> addu \$a0,\$a0,\$a1 -0+0024 <[^>]*> li \$a0,1 -0+0028 <[^>]*> addu \$a0,\$a0,\$a1 -0+002c <[^>]*> li \$a0,0x8000 -0+0030 <[^>]*> addu \$a0,\$a0,\$a1 -0+0034 <[^>]*> li \$a0,-32768 -0+0038 <[^>]*> addu \$a0,\$a0,\$a1 -0+003c <[^>]*> lui \$a0,0x1 -0+0040 <[^>]*> addu \$a0,\$a0,\$a1 -0+0044 <[^>]*> lui \$a0,0x1 -0+0048 <[^>]*> ori \$a0,\$a0,0xa5a5 -0+004c <[^>]*> addu \$a0,\$a0,\$a1 -0+0050 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0050 R_MIPS_GOT16 .data -... -0+0058 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0058 R_MIPS_LO16 .data -0+005c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+005c R_MIPS_GOT16 big_external_data_label -0+0060 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0060 R_MIPS_GOT16 small_external_data_label -0+0064 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0064 R_MIPS_GOT16 big_external_common -0+0068 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0068 R_MIPS_GOT16 small_external_common -0+006c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+006c R_MIPS_GOT16 .bss -... -0+0074 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0074 R_MIPS_LO16 .bss -0+0078 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0078 R_MIPS_GOT16 .bss -... -0+0080 <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+0080 R_MIPS_LO16 .bss -0+0084 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0084 R_MIPS_GOT16 .data -... -0+008c <[^>]*> addiu \$a0,\$a0,1 -[ ]*RELOC: 0+008c R_MIPS_LO16 .data -0+0090 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0090 R_MIPS_GOT16 big_external_data_label -... -0+0098 <[^>]*> addiu \$a0,\$a0,1 -0+009c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+009c R_MIPS_GOT16 small_external_data_label -... -0+00a4 <[^>]*> addiu \$a0,\$a0,1 -0+00a8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00a8 R_MIPS_GOT16 big_external_common -... -0+00b0 <[^>]*> addiu \$a0,\$a0,1 -0+00b4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00b4 R_MIPS_GOT16 small_external_common -... -0+00bc <[^>]*> addiu \$a0,\$a0,1 -0+00c0 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00c0 R_MIPS_GOT16 .bss -... -0+00c8 <[^>]*> addiu \$a0,\$a0,1 -[ ]*RELOC: 0+00c8 R_MIPS_LO16 .bss -0+00cc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00cc R_MIPS_GOT16 .bss -... -0+00d4 <[^>]*> addiu \$a0,\$a0,1001 -[ ]*RELOC: 0+00d4 R_MIPS_LO16 .bss -0+00d8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00d8 R_MIPS_GOT16 .data -0+00dc <[^>]*> lui \$at,0x1 -0+00e0 <[^>]*> addiu \$at,\$at,-32768 -[ ]*RELOC: 0+00e0 R_MIPS_LO16 .data -0+00e4 <[^>]*> addu \$a0,\$a0,\$at -0+00e8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00e8 R_MIPS_GOT16 big_external_data_label -0+00ec <[^>]*> lui \$at,0x1 -0+00f0 <[^>]*> addiu \$at,\$at,-32768 -0+00f4 <[^>]*> addu \$a0,\$a0,\$at -0+00f8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00f8 R_MIPS_GOT16 small_external_data_label -0+00fc <[^>]*> lui \$at,0x1 -0+0100 <[^>]*> addiu \$at,\$at,-32768 -0+0104 <[^>]*> addu \$a0,\$a0,\$at -0+0108 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0108 R_MIPS_GOT16 big_external_common -0+010c <[^>]*> lui \$at,0x1 -0+0110 <[^>]*> addiu \$at,\$at,-32768 -0+0114 <[^>]*> addu \$a0,\$a0,\$at -0+0118 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0118 R_MIPS_GOT16 small_external_common -0+011c <[^>]*> lui \$at,0x1 -0+0120 <[^>]*> addiu \$at,\$at,-32768 -0+0124 <[^>]*> addu \$a0,\$a0,\$at -0+0128 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0128 R_MIPS_GOT16 .bss -0+012c <[^>]*> lui \$at,0x1 -0+0130 <[^>]*> addiu \$at,\$at,-32768 -[ ]*RELOC: 0+0130 R_MIPS_LO16 .bss -0+0134 <[^>]*> addu \$a0,\$a0,\$at -0+0138 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0138 R_MIPS_GOT16 .bss -0+013c <[^>]*> lui \$at,0x1 -0+0140 <[^>]*> addiu \$at,\$at,-31768 -[ ]*RELOC: 0+0140 R_MIPS_LO16 .bss -0+0144 <[^>]*> addu \$a0,\$a0,\$at -0+0148 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0148 R_MIPS_GOT16 .data -... -0+0150 <[^>]*> addiu \$a0,\$a0,-32768 -[ ]*RELOC: 0+0150 R_MIPS_LO16 .data -0+0154 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0154 R_MIPS_GOT16 big_external_data_label -... -0+015c <[^>]*> addiu \$a0,\$a0,-32768 -0+0160 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0160 R_MIPS_GOT16 small_external_data_label -... -0+0168 <[^>]*> addiu \$a0,\$a0,-32768 -0+016c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+016c R_MIPS_GOT16 big_external_common -... -0+0174 <[^>]*> addiu \$a0,\$a0,-32768 -0+0178 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0178 R_MIPS_GOT16 small_external_common -... -0+0180 <[^>]*> addiu \$a0,\$a0,-32768 -0+0184 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0184 R_MIPS_GOT16 .bss -... -0+018c <[^>]*> addiu \$a0,\$a0,-32768 -[ ]*RELOC: 0+018c R_MIPS_LO16 .bss -0+0190 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0190 R_MIPS_GOT16 .bss -... -0+0198 <[^>]*> addiu \$a0,\$a0,-31768 -[ ]*RELOC: 0+0198 R_MIPS_LO16 .bss -0+019c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+019c R_MIPS_GOT16 .data -0+01a0 <[^>]*> lui \$at,0x1 -0+01a4 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+01a4 R_MIPS_LO16 .data -0+01a8 <[^>]*> addu \$a0,\$a0,\$at -0+01ac <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01ac R_MIPS_GOT16 big_external_data_label -0+01b0 <[^>]*> lui \$at,0x1 -0+01b4 <[^>]*> addiu \$at,\$at,0 -0+01b8 <[^>]*> addu \$a0,\$a0,\$at -0+01bc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01bc R_MIPS_GOT16 small_external_data_label -0+01c0 <[^>]*> lui \$at,0x1 -0+01c4 <[^>]*> addiu \$at,\$at,0 -0+01c8 <[^>]*> addu \$a0,\$a0,\$at -0+01cc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01cc R_MIPS_GOT16 big_external_common -0+01d0 <[^>]*> lui \$at,0x1 -0+01d4 <[^>]*> addiu \$at,\$at,0 -0+01d8 <[^>]*> addu \$a0,\$a0,\$at -0+01dc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01dc R_MIPS_GOT16 small_external_common -0+01e0 <[^>]*> lui \$at,0x1 -0+01e4 <[^>]*> addiu \$at,\$at,0 -0+01e8 <[^>]*> addu \$a0,\$a0,\$at -0+01ec <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01ec R_MIPS_GOT16 .bss -0+01f0 <[^>]*> lui \$at,0x1 -0+01f4 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+01f4 R_MIPS_LO16 .bss -0+01f8 <[^>]*> addu \$a0,\$a0,\$at -0+01fc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01fc R_MIPS_GOT16 .bss -0+0200 <[^>]*> lui \$at,0x1 -0+0204 <[^>]*> addiu \$at,\$at,1000 -[ ]*RELOC: 0+0204 R_MIPS_LO16 .bss -0+0208 <[^>]*> addu \$a0,\$a0,\$at -0+020c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+020c R_MIPS_GOT16 .data -0+0210 <[^>]*> lui \$at,0x2 -0+0214 <[^>]*> addiu \$at,\$at,-23131 -[ ]*RELOC: 0+0214 R_MIPS_LO16 .data -0+0218 <[^>]*> addu \$a0,\$a0,\$at -0+021c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+021c R_MIPS_GOT16 big_external_data_label -0+0220 <[^>]*> lui \$at,0x2 -0+0224 <[^>]*> addiu \$at,\$at,-23131 -0+0228 <[^>]*> addu \$a0,\$a0,\$at -0+022c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+022c R_MIPS_GOT16 small_external_data_label -0+0230 <[^>]*> lui \$at,0x2 -0+0234 <[^>]*> addiu \$at,\$at,-23131 -0+0238 <[^>]*> addu \$a0,\$a0,\$at -0+023c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+023c R_MIPS_GOT16 big_external_common -0+0240 <[^>]*> lui \$at,0x2 -0+0244 <[^>]*> addiu \$at,\$at,-23131 -0+0248 <[^>]*> addu \$a0,\$a0,\$at -0+024c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+024c R_MIPS_GOT16 small_external_common -0+0250 <[^>]*> lui \$at,0x2 -0+0254 <[^>]*> addiu \$at,\$at,-23131 -0+0258 <[^>]*> addu \$a0,\$a0,\$at -0+025c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+025c R_MIPS_GOT16 .bss -0+0260 <[^>]*> lui \$at,0x2 -0+0264 <[^>]*> addiu \$at,\$at,-23131 -[ ]*RELOC: 0+0264 R_MIPS_LO16 .bss -0+0268 <[^>]*> addu \$a0,\$a0,\$at -0+026c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+026c R_MIPS_GOT16 .bss -0+0270 <[^>]*> lui \$at,0x2 -0+0274 <[^>]*> addiu \$at,\$at,-22131 -[ ]*RELOC: 0+0274 R_MIPS_LO16 .bss -0+0278 <[^>]*> addu \$a0,\$a0,\$at -0+027c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+027c R_MIPS_GOT16 .data -... -0+0284 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0284 R_MIPS_LO16 .data -0+0288 <[^>]*> addu \$a0,\$a0,\$a1 -0+028c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+028c R_MIPS_GOT16 big_external_data_label -... -0+0294 <[^>]*> addu \$a0,\$a0,\$a1 -0+0298 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0298 R_MIPS_GOT16 small_external_data_label -... -0+02a0 <[^>]*> addu \$a0,\$a0,\$a1 -0+02a4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+02a4 R_MIPS_GOT16 big_external_common -... -0+02ac <[^>]*> addu \$a0,\$a0,\$a1 -0+02b0 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+02b0 R_MIPS_GOT16 small_external_common -... -0+02b8 <[^>]*> addu \$a0,\$a0,\$a1 -0+02bc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+02bc R_MIPS_GOT16 .bss -... -0+02c4 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+02c4 R_MIPS_LO16 .bss -0+02c8 <[^>]*> addu \$a0,\$a0,\$a1 -0+02cc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+02cc R_MIPS_GOT16 .bss -... -0+02d4 <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+02d4 R_MIPS_LO16 .bss -0+02d8 <[^>]*> addu \$a0,\$a0,\$a1 -0+02dc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+02dc R_MIPS_GOT16 .data -... -0+02e4 <[^>]*> addiu \$a0,\$a0,1 -[ ]*RELOC: 0+02e4 R_MIPS_LO16 .data -0+02e8 <[^>]*> addu \$a0,\$a0,\$a1 -0+02ec <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+02ec R_MIPS_GOT16 big_external_data_label -... -0+02f4 <[^>]*> addiu \$a0,\$a0,1 -0+02f8 <[^>]*> addu \$a0,\$a0,\$a1 -0+02fc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+02fc R_MIPS_GOT16 small_external_data_label -... -0+0304 <[^>]*> addiu \$a0,\$a0,1 -0+0308 <[^>]*> addu \$a0,\$a0,\$a1 -0+030c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+030c R_MIPS_GOT16 big_external_common -... -0+0314 <[^>]*> addiu \$a0,\$a0,1 -0+0318 <[^>]*> addu \$a0,\$a0,\$a1 -0+031c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+031c R_MIPS_GOT16 small_external_common -... -0+0324 <[^>]*> addiu \$a0,\$a0,1 -0+0328 <[^>]*> addu \$a0,\$a0,\$a1 -0+032c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+032c R_MIPS_GOT16 .bss -... -0+0334 <[^>]*> addiu \$a0,\$a0,1 -[ ]*RELOC: 0+0334 R_MIPS_LO16 .bss -0+0338 <[^>]*> addu \$a0,\$a0,\$a1 -0+033c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+033c R_MIPS_GOT16 .bss -... -0+0344 <[^>]*> addiu \$a0,\$a0,1001 -[ ]*RELOC: 0+0344 R_MIPS_LO16 .bss -0+0348 <[^>]*> addu \$a0,\$a0,\$a1 -0+034c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+034c R_MIPS_GOT16 .data -0+0350 <[^>]*> lui \$at,0x1 -0+0354 <[^>]*> addiu \$at,\$at,-32768 -[ ]*RELOC: 0+0354 R_MIPS_LO16 .data -0+0358 <[^>]*> addu \$a0,\$a0,\$at -0+035c <[^>]*> addu \$a0,\$a0,\$a1 -0+0360 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0360 R_MIPS_GOT16 big_external_data_label -0+0364 <[^>]*> lui \$at,0x1 -0+0368 <[^>]*> addiu \$at,\$at,-32768 -0+036c <[^>]*> addu \$a0,\$a0,\$at -0+0370 <[^>]*> addu \$a0,\$a0,\$a1 -0+0374 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0374 R_MIPS_GOT16 small_external_data_label -0+0378 <[^>]*> lui \$at,0x1 -0+037c <[^>]*> addiu \$at,\$at,-32768 -0+0380 <[^>]*> addu \$a0,\$a0,\$at -0+0384 <[^>]*> addu \$a0,\$a0,\$a1 -0+0388 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0388 R_MIPS_GOT16 big_external_common -0+038c <[^>]*> lui \$at,0x1 -0+0390 <[^>]*> addiu \$at,\$at,-32768 -0+0394 <[^>]*> addu \$a0,\$a0,\$at -0+0398 <[^>]*> addu \$a0,\$a0,\$a1 -0+039c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+039c R_MIPS_GOT16 small_external_common -0+03a0 <[^>]*> lui \$at,0x1 -0+03a4 <[^>]*> addiu \$at,\$at,-32768 -0+03a8 <[^>]*> addu \$a0,\$a0,\$at -0+03ac <[^>]*> addu \$a0,\$a0,\$a1 -0+03b0 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+03b0 R_MIPS_GOT16 .bss -0+03b4 <[^>]*> lui \$at,0x1 -0+03b8 <[^>]*> addiu \$at,\$at,-32768 -[ ]*RELOC: 0+03b8 R_MIPS_LO16 .bss -0+03bc <[^>]*> addu \$a0,\$a0,\$at -0+03c0 <[^>]*> addu \$a0,\$a0,\$a1 -0+03c4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+03c4 R_MIPS_GOT16 .bss -0+03c8 <[^>]*> lui \$at,0x1 -0+03cc <[^>]*> addiu \$at,\$at,-31768 -[ ]*RELOC: 0+03cc R_MIPS_LO16 .bss -0+03d0 <[^>]*> addu \$a0,\$a0,\$at -0+03d4 <[^>]*> addu \$a0,\$a0,\$a1 -0+03d8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+03d8 R_MIPS_GOT16 .data -... -0+03e0 <[^>]*> addiu \$a0,\$a0,-32768 -[ ]*RELOC: 0+03e0 R_MIPS_LO16 .data -0+03e4 <[^>]*> addu \$a0,\$a0,\$a1 -0+03e8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+03e8 R_MIPS_GOT16 big_external_data_label -... -0+03f0 <[^>]*> addiu \$a0,\$a0,-32768 -0+03f4 <[^>]*> addu \$a0,\$a0,\$a1 -0+03f8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+03f8 R_MIPS_GOT16 small_external_data_label -... -0+0400 <[^>]*> addiu \$a0,\$a0,-32768 -0+0404 <[^>]*> addu \$a0,\$a0,\$a1 -0+0408 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0408 R_MIPS_GOT16 big_external_common -... -0+0410 <[^>]*> addiu \$a0,\$a0,-32768 -0+0414 <[^>]*> addu \$a0,\$a0,\$a1 -0+0418 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0418 R_MIPS_GOT16 small_external_common -... -0+0420 <[^>]*> addiu \$a0,\$a0,-32768 -0+0424 <[^>]*> addu \$a0,\$a0,\$a1 -0+0428 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0428 R_MIPS_GOT16 .bss -... -0+0430 <[^>]*> addiu \$a0,\$a0,-32768 -[ ]*RELOC: 0+0430 R_MIPS_LO16 .bss -0+0434 <[^>]*> addu \$a0,\$a0,\$a1 -0+0438 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0438 R_MIPS_GOT16 .bss -... -0+0440 <[^>]*> addiu \$a0,\$a0,-31768 -[ ]*RELOC: 0+0440 R_MIPS_LO16 .bss -0+0444 <[^>]*> addu \$a0,\$a0,\$a1 -0+0448 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0448 R_MIPS_GOT16 .data -0+044c <[^>]*> lui \$at,0x1 -0+0450 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0450 R_MIPS_LO16 .data -0+0454 <[^>]*> addu \$a0,\$a0,\$at -0+0458 <[^>]*> addu \$a0,\$a0,\$a1 -0+045c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+045c R_MIPS_GOT16 big_external_data_label -0+0460 <[^>]*> lui \$at,0x1 -0+0464 <[^>]*> addiu \$at,\$at,0 -0+0468 <[^>]*> addu \$a0,\$a0,\$at -0+046c <[^>]*> addu \$a0,\$a0,\$a1 -0+0470 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0470 R_MIPS_GOT16 small_external_data_label -0+0474 <[^>]*> lui \$at,0x1 -0+0478 <[^>]*> addiu \$at,\$at,0 -0+047c <[^>]*> addu \$a0,\$a0,\$at -0+0480 <[^>]*> addu \$a0,\$a0,\$a1 -0+0484 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0484 R_MIPS_GOT16 big_external_common -0+0488 <[^>]*> lui \$at,0x1 -0+048c <[^>]*> addiu \$at,\$at,0 -0+0490 <[^>]*> addu \$a0,\$a0,\$at -0+0494 <[^>]*> addu \$a0,\$a0,\$a1 -0+0498 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0498 R_MIPS_GOT16 small_external_common -0+049c <[^>]*> lui \$at,0x1 -0+04a0 <[^>]*> addiu \$at,\$at,0 -0+04a4 <[^>]*> addu \$a0,\$a0,\$at -0+04a8 <[^>]*> addu \$a0,\$a0,\$a1 -0+04ac <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+04ac R_MIPS_GOT16 .bss -0+04b0 <[^>]*> lui \$at,0x1 -0+04b4 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+04b4 R_MIPS_LO16 .bss -0+04b8 <[^>]*> addu \$a0,\$a0,\$at -0+04bc <[^>]*> addu \$a0,\$a0,\$a1 -0+04c0 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+04c0 R_MIPS_GOT16 .bss -0+04c4 <[^>]*> lui \$at,0x1 -0+04c8 <[^>]*> addiu \$at,\$at,1000 -[ ]*RELOC: 0+04c8 R_MIPS_LO16 .bss -0+04cc <[^>]*> addu \$a0,\$a0,\$at -0+04d0 <[^>]*> addu \$a0,\$a0,\$a1 -0+04d4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+04d4 R_MIPS_GOT16 .data -0+04d8 <[^>]*> lui \$at,0x2 -0+04dc <[^>]*> addiu \$at,\$at,-23131 -[ ]*RELOC: 0+04dc R_MIPS_LO16 .data -0+04e0 <[^>]*> addu \$a0,\$a0,\$at -0+04e4 <[^>]*> addu \$a0,\$a0,\$a1 -0+04e8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+04e8 R_MIPS_GOT16 big_external_data_label -0+04ec <[^>]*> lui \$at,0x2 -0+04f0 <[^>]*> addiu \$at,\$at,-23131 -0+04f4 <[^>]*> addu \$a0,\$a0,\$at -0+04f8 <[^>]*> addu \$a0,\$a0,\$a1 -0+04fc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+04fc R_MIPS_GOT16 small_external_data_label -0+0500 <[^>]*> lui \$at,0x2 -0+0504 <[^>]*> addiu \$at,\$at,-23131 -0+0508 <[^>]*> addu \$a0,\$a0,\$at -0+050c <[^>]*> addu \$a0,\$a0,\$a1 -0+0510 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0510 R_MIPS_GOT16 big_external_common -0+0514 <[^>]*> lui \$at,0x2 -0+0518 <[^>]*> addiu \$at,\$at,-23131 -0+051c <[^>]*> addu \$a0,\$a0,\$at -0+0520 <[^>]*> addu \$a0,\$a0,\$a1 -0+0524 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0524 R_MIPS_GOT16 small_external_common -0+0528 <[^>]*> lui \$at,0x2 -0+052c <[^>]*> addiu \$at,\$at,-23131 -0+0530 <[^>]*> addu \$a0,\$a0,\$at -0+0534 <[^>]*> addu \$a0,\$a0,\$a1 -0+0538 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0538 R_MIPS_GOT16 .bss -0+053c <[^>]*> lui \$at,0x2 -0+0540 <[^>]*> addiu \$at,\$at,-23131 -[ ]*RELOC: 0+0540 R_MIPS_LO16 .bss -0+0544 <[^>]*> addu \$a0,\$a0,\$at -0+0548 <[^>]*> addu \$a0,\$a0,\$a1 -0+054c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+054c R_MIPS_GOT16 .bss -0+0550 <[^>]*> lui \$at,0x2 -0+0554 <[^>]*> addiu \$at,\$at,-22131 -[ ]*RELOC: 0+0554 R_MIPS_LO16 .bss -0+0558 <[^>]*> addu \$a0,\$a0,\$at -0+055c <[^>]*> addu \$a0,\$a0,\$a1 +0+0000 <[^>]*> li \$a0,0 +0+0004 <[^>]*> li \$a0,1 +0+0008 <[^>]*> li \$a0,0x8000 +0+000c <[^>]*> li \$a0,-32768 +0+0010 <[^>]*> lui \$a0,0x1 +0+0014 <[^>]*> lui \$a0,0x1 +0+0018 <[^>]*> ori \$a0,\$a0,0xa5a5 +0+001c <[^>]*> li \$a0,0 +0+0020 <[^>]*> addu \$a0,\$a0,\$a1 +0+0024 <[^>]*> li \$a0,1 +0+0028 <[^>]*> addu \$a0,\$a0,\$a1 +0+002c <[^>]*> li \$a0,0x8000 +0+0030 <[^>]*> addu \$a0,\$a0,\$a1 +0+0034 <[^>]*> li \$a0,-32768 +0+0038 <[^>]*> addu \$a0,\$a0,\$a1 +0+003c <[^>]*> lui \$a0,0x1 +0+0040 <[^>]*> addu \$a0,\$a0,\$a1 +0+0044 <[^>]*> lui \$a0,0x1 +0+0048 <[^>]*> ori \$a0,\$a0,0xa5a5 +0+004c <[^>]*> addu \$a0,\$a0,\$a1 +0+0050 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*50: R_MIPS_GOT16 .data +0+0054 <[^>]*> nop +0+0058 <[^>]*> addiu \$a0,\$a0,0 +[ ]*58: R_MIPS_LO16 .data +0+005c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*5c: R_MIPS_GOT16 big_external_data_label +0+0060 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*60: R_MIPS_GOT16 small_external_data_label +0+0064 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*64: R_MIPS_GOT16 big_external_common +0+0068 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*68: R_MIPS_GOT16 small_external_common +0+006c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*6c: R_MIPS_GOT16 .bss +0+0070 <[^>]*> nop +0+0074 <[^>]*> addiu \$a0,\$a0,0 +[ ]*74: R_MIPS_LO16 .bss +0+0078 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*78: R_MIPS_GOT16 .bss +0+007c <[^>]*> nop +0+0080 <[^>]*> addiu \$a0,\$a0,1000 +[ ]*80: R_MIPS_LO16 .bss +0+0084 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*84: R_MIPS_GOT16 .data +0+0088 <[^>]*> nop +0+008c <[^>]*> addiu \$a0,\$a0,1 +[ ]*8c: R_MIPS_LO16 .data +0+0090 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*90: R_MIPS_GOT16 big_external_data_label +0+0094 <[^>]*> nop +0+0098 <[^>]*> addiu \$a0,\$a0,1 +0+009c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*9c: R_MIPS_GOT16 small_external_data_label +0+00a0 <[^>]*> nop +0+00a4 <[^>]*> addiu \$a0,\$a0,1 +0+00a8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*a8: R_MIPS_GOT16 big_external_common +0+00ac <[^>]*> nop +0+00b0 <[^>]*> addiu \$a0,\$a0,1 +0+00b4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*b4: R_MIPS_GOT16 small_external_common +0+00b8 <[^>]*> nop +0+00bc <[^>]*> addiu \$a0,\$a0,1 +0+00c0 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*c0: R_MIPS_GOT16 .bss +0+00c4 <[^>]*> nop +0+00c8 <[^>]*> addiu \$a0,\$a0,1 +[ ]*c8: R_MIPS_LO16 .bss +0+00cc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*cc: R_MIPS_GOT16 .bss +0+00d0 <[^>]*> nop +0+00d4 <[^>]*> addiu \$a0,\$a0,1001 +[ ]*d4: R_MIPS_LO16 .bss +0+00d8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*d8: R_MIPS_GOT16 .data +0+00dc <[^>]*> lui \$at,0x1 +0+00e0 <[^>]*> addiu \$at,\$at,-32768 +[ ]*e0: R_MIPS_LO16 .data +0+00e4 <[^>]*> addu \$a0,\$a0,\$at +0+00e8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*e8: R_MIPS_GOT16 big_external_data_label +0+00ec <[^>]*> lui \$at,0x1 +0+00f0 <[^>]*> addiu \$at,\$at,-32768 +0+00f4 <[^>]*> addu \$a0,\$a0,\$at +0+00f8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*f8: R_MIPS_GOT16 small_external_data_label +0+00fc <[^>]*> lui \$at,0x1 +0+0100 <[^>]*> addiu \$at,\$at,-32768 +0+0104 <[^>]*> addu \$a0,\$a0,\$at +0+0108 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*108: R_MIPS_GOT16 big_external_common +0+010c <[^>]*> lui \$at,0x1 +0+0110 <[^>]*> addiu \$at,\$at,-32768 +0+0114 <[^>]*> addu \$a0,\$a0,\$at +0+0118 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*118: R_MIPS_GOT16 small_external_common +0+011c <[^>]*> lui \$at,0x1 +0+0120 <[^>]*> addiu \$at,\$at,-32768 +0+0124 <[^>]*> addu \$a0,\$a0,\$at +0+0128 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*128: R_MIPS_GOT16 .bss +0+012c <[^>]*> lui \$at,0x1 +0+0130 <[^>]*> addiu \$at,\$at,-32768 +[ ]*130: R_MIPS_LO16 .bss +0+0134 <[^>]*> addu \$a0,\$a0,\$at +0+0138 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*138: R_MIPS_GOT16 .bss +0+013c <[^>]*> lui \$at,0x1 +0+0140 <[^>]*> addiu \$at,\$at,-31768 +[ ]*140: R_MIPS_LO16 .bss +0+0144 <[^>]*> addu \$a0,\$a0,\$at +0+0148 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*148: R_MIPS_GOT16 .data +0+014c <[^>]*> nop +0+0150 <[^>]*> addiu \$a0,\$a0,-32768 +[ ]*150: R_MIPS_LO16 .data +0+0154 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*154: R_MIPS_GOT16 big_external_data_label +0+0158 <[^>]*> nop +0+015c <[^>]*> addiu \$a0,\$a0,-32768 +0+0160 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*160: R_MIPS_GOT16 small_external_data_label +0+0164 <[^>]*> nop +0+0168 <[^>]*> addiu \$a0,\$a0,-32768 +0+016c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*16c: R_MIPS_GOT16 big_external_common +0+0170 <[^>]*> nop +0+0174 <[^>]*> addiu \$a0,\$a0,-32768 +0+0178 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*178: R_MIPS_GOT16 small_external_common +0+017c <[^>]*> nop +0+0180 <[^>]*> addiu \$a0,\$a0,-32768 +0+0184 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*184: R_MIPS_GOT16 .bss +0+0188 <[^>]*> nop +0+018c <[^>]*> addiu \$a0,\$a0,-32768 +[ ]*18c: R_MIPS_LO16 .bss +0+0190 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*190: R_MIPS_GOT16 .bss +0+0194 <[^>]*> nop +0+0198 <[^>]*> addiu \$a0,\$a0,-31768 +[ ]*198: R_MIPS_LO16 .bss +0+019c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*19c: R_MIPS_GOT16 .data +0+01a0 <[^>]*> lui \$at,0x1 +0+01a4 <[^>]*> addiu \$at,\$at,0 +[ ]*1a4: R_MIPS_LO16 .data +0+01a8 <[^>]*> addu \$a0,\$a0,\$at +0+01ac <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1ac: R_MIPS_GOT16 big_external_data_label +0+01b0 <[^>]*> lui \$at,0x1 +0+01b4 <[^>]*> addiu \$at,\$at,0 +0+01b8 <[^>]*> addu \$a0,\$a0,\$at +0+01bc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1bc: R_MIPS_GOT16 small_external_data_label +0+01c0 <[^>]*> lui \$at,0x1 +0+01c4 <[^>]*> addiu \$at,\$at,0 +0+01c8 <[^>]*> addu \$a0,\$a0,\$at +0+01cc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1cc: R_MIPS_GOT16 big_external_common +0+01d0 <[^>]*> lui \$at,0x1 +0+01d4 <[^>]*> addiu \$at,\$at,0 +0+01d8 <[^>]*> addu \$a0,\$a0,\$at +0+01dc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1dc: R_MIPS_GOT16 small_external_common +0+01e0 <[^>]*> lui \$at,0x1 +0+01e4 <[^>]*> addiu \$at,\$at,0 +0+01e8 <[^>]*> addu \$a0,\$a0,\$at +0+01ec <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1ec: R_MIPS_GOT16 .bss +0+01f0 <[^>]*> lui \$at,0x1 +0+01f4 <[^>]*> addiu \$at,\$at,0 +[ ]*1f4: R_MIPS_LO16 .bss +0+01f8 <[^>]*> addu \$a0,\$a0,\$at +0+01fc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1fc: R_MIPS_GOT16 .bss +0+0200 <[^>]*> lui \$at,0x1 +0+0204 <[^>]*> addiu \$at,\$at,1000 +[ ]*204: R_MIPS_LO16 .bss +0+0208 <[^>]*> addu \$a0,\$a0,\$at +0+020c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*20c: R_MIPS_GOT16 .data +0+0210 <[^>]*> lui \$at,0x2 +0+0214 <[^>]*> addiu \$at,\$at,-23131 +[ ]*214: R_MIPS_LO16 .data +0+0218 <[^>]*> addu \$a0,\$a0,\$at +0+021c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*21c: R_MIPS_GOT16 big_external_data_label +0+0220 <[^>]*> lui \$at,0x2 +0+0224 <[^>]*> addiu \$at,\$at,-23131 +0+0228 <[^>]*> addu \$a0,\$a0,\$at +0+022c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*22c: R_MIPS_GOT16 small_external_data_label +0+0230 <[^>]*> lui \$at,0x2 +0+0234 <[^>]*> addiu \$at,\$at,-23131 +0+0238 <[^>]*> addu \$a0,\$a0,\$at +0+023c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*23c: R_MIPS_GOT16 big_external_common +0+0240 <[^>]*> lui \$at,0x2 +0+0244 <[^>]*> addiu \$at,\$at,-23131 +0+0248 <[^>]*> addu \$a0,\$a0,\$at +0+024c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*24c: R_MIPS_GOT16 small_external_common +0+0250 <[^>]*> lui \$at,0x2 +0+0254 <[^>]*> addiu \$at,\$at,-23131 +0+0258 <[^>]*> addu \$a0,\$a0,\$at +0+025c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*25c: R_MIPS_GOT16 .bss +0+0260 <[^>]*> lui \$at,0x2 +0+0264 <[^>]*> addiu \$at,\$at,-23131 +[ ]*264: R_MIPS_LO16 .bss +0+0268 <[^>]*> addu \$a0,\$a0,\$at +0+026c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*26c: R_MIPS_GOT16 .bss +0+0270 <[^>]*> lui \$at,0x2 +0+0274 <[^>]*> addiu \$at,\$at,-22131 +[ ]*274: R_MIPS_LO16 .bss +0+0278 <[^>]*> addu \$a0,\$a0,\$at +0+027c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*27c: R_MIPS_GOT16 .data +0+0280 <[^>]*> nop +0+0284 <[^>]*> addiu \$a0,\$a0,0 +[ ]*284: R_MIPS_LO16 .data +0+0288 <[^>]*> addu \$a0,\$a0,\$a1 +0+028c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*28c: R_MIPS_GOT16 big_external_data_label +0+0290 <[^>]*> nop +0+0294 <[^>]*> addu \$a0,\$a0,\$a1 +0+0298 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*298: R_MIPS_GOT16 small_external_data_label +0+029c <[^>]*> nop +0+02a0 <[^>]*> addu \$a0,\$a0,\$a1 +0+02a4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*2a4: R_MIPS_GOT16 big_external_common +0+02a8 <[^>]*> nop +0+02ac <[^>]*> addu \$a0,\$a0,\$a1 +0+02b0 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*2b0: R_MIPS_GOT16 small_external_common +0+02b4 <[^>]*> nop +0+02b8 <[^>]*> addu \$a0,\$a0,\$a1 +0+02bc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*2bc: R_MIPS_GOT16 .bss +0+02c0 <[^>]*> nop +0+02c4 <[^>]*> addiu \$a0,\$a0,0 +[ ]*2c4: R_MIPS_LO16 .bss +0+02c8 <[^>]*> addu \$a0,\$a0,\$a1 +0+02cc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*2cc: R_MIPS_GOT16 .bss +0+02d0 <[^>]*> nop +0+02d4 <[^>]*> addiu \$a0,\$a0,1000 +[ ]*2d4: R_MIPS_LO16 .bss +0+02d8 <[^>]*> addu \$a0,\$a0,\$a1 +0+02dc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*2dc: R_MIPS_GOT16 .data +0+02e0 <[^>]*> nop +0+02e4 <[^>]*> addiu \$a0,\$a0,1 +[ ]*2e4: R_MIPS_LO16 .data +0+02e8 <[^>]*> addu \$a0,\$a0,\$a1 +0+02ec <[^>]*> lw \$a0,0\(\$gp\) +[ ]*2ec: R_MIPS_GOT16 big_external_data_label +0+02f0 <[^>]*> nop +0+02f4 <[^>]*> addiu \$a0,\$a0,1 +0+02f8 <[^>]*> addu \$a0,\$a0,\$a1 +0+02fc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*2fc: R_MIPS_GOT16 small_external_data_label +0+0300 <[^>]*> nop +0+0304 <[^>]*> addiu \$a0,\$a0,1 +0+0308 <[^>]*> addu \$a0,\$a0,\$a1 +0+030c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*30c: R_MIPS_GOT16 big_external_common +0+0310 <[^>]*> nop +0+0314 <[^>]*> addiu \$a0,\$a0,1 +0+0318 <[^>]*> addu \$a0,\$a0,\$a1 +0+031c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*31c: R_MIPS_GOT16 small_external_common +0+0320 <[^>]*> nop +0+0324 <[^>]*> addiu \$a0,\$a0,1 +0+0328 <[^>]*> addu \$a0,\$a0,\$a1 +0+032c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*32c: R_MIPS_GOT16 .bss +0+0330 <[^>]*> nop +0+0334 <[^>]*> addiu \$a0,\$a0,1 +[ ]*334: R_MIPS_LO16 .bss +0+0338 <[^>]*> addu \$a0,\$a0,\$a1 +0+033c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*33c: R_MIPS_GOT16 .bss +0+0340 <[^>]*> nop +0+0344 <[^>]*> addiu \$a0,\$a0,1001 +[ ]*344: R_MIPS_LO16 .bss +0+0348 <[^>]*> addu \$a0,\$a0,\$a1 +0+034c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*34c: R_MIPS_GOT16 .data +0+0350 <[^>]*> lui \$at,0x1 +0+0354 <[^>]*> addiu \$at,\$at,-32768 +[ ]*354: R_MIPS_LO16 .data +0+0358 <[^>]*> addu \$a0,\$a0,\$at +0+035c <[^>]*> addu \$a0,\$a0,\$a1 +0+0360 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*360: R_MIPS_GOT16 big_external_data_label +0+0364 <[^>]*> lui \$at,0x1 +0+0368 <[^>]*> addiu \$at,\$at,-32768 +0+036c <[^>]*> addu \$a0,\$a0,\$at +0+0370 <[^>]*> addu \$a0,\$a0,\$a1 +0+0374 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*374: R_MIPS_GOT16 small_external_data_label +0+0378 <[^>]*> lui \$at,0x1 +0+037c <[^>]*> addiu \$at,\$at,-32768 +0+0380 <[^>]*> addu \$a0,\$a0,\$at +0+0384 <[^>]*> addu \$a0,\$a0,\$a1 +0+0388 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*388: R_MIPS_GOT16 big_external_common +0+038c <[^>]*> lui \$at,0x1 +0+0390 <[^>]*> addiu \$at,\$at,-32768 +0+0394 <[^>]*> addu \$a0,\$a0,\$at +0+0398 <[^>]*> addu \$a0,\$a0,\$a1 +0+039c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*39c: R_MIPS_GOT16 small_external_common +0+03a0 <[^>]*> lui \$at,0x1 +0+03a4 <[^>]*> addiu \$at,\$at,-32768 +0+03a8 <[^>]*> addu \$a0,\$a0,\$at +0+03ac <[^>]*> addu \$a0,\$a0,\$a1 +0+03b0 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*3b0: R_MIPS_GOT16 .bss +0+03b4 <[^>]*> lui \$at,0x1 +0+03b8 <[^>]*> addiu \$at,\$at,-32768 +[ ]*3b8: R_MIPS_LO16 .bss +0+03bc <[^>]*> addu \$a0,\$a0,\$at +0+03c0 <[^>]*> addu \$a0,\$a0,\$a1 +0+03c4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*3c4: R_MIPS_GOT16 .bss +0+03c8 <[^>]*> lui \$at,0x1 +0+03cc <[^>]*> addiu \$at,\$at,-31768 +[ ]*3cc: R_MIPS_LO16 .bss +0+03d0 <[^>]*> addu \$a0,\$a0,\$at +0+03d4 <[^>]*> addu \$a0,\$a0,\$a1 +0+03d8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*3d8: R_MIPS_GOT16 .data +0+03dc <[^>]*> nop +0+03e0 <[^>]*> addiu \$a0,\$a0,-32768 +[ ]*3e0: R_MIPS_LO16 .data +0+03e4 <[^>]*> addu \$a0,\$a0,\$a1 +0+03e8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*3e8: R_MIPS_GOT16 big_external_data_label +0+03ec <[^>]*> nop +0+03f0 <[^>]*> addiu \$a0,\$a0,-32768 +0+03f4 <[^>]*> addu \$a0,\$a0,\$a1 +0+03f8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*3f8: R_MIPS_GOT16 small_external_data_label +0+03fc <[^>]*> nop +0+0400 <[^>]*> addiu \$a0,\$a0,-32768 +0+0404 <[^>]*> addu \$a0,\$a0,\$a1 +0+0408 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*408: R_MIPS_GOT16 big_external_common +0+040c <[^>]*> nop +0+0410 <[^>]*> addiu \$a0,\$a0,-32768 +0+0414 <[^>]*> addu \$a0,\$a0,\$a1 +0+0418 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*418: R_MIPS_GOT16 small_external_common +0+041c <[^>]*> nop +0+0420 <[^>]*> addiu \$a0,\$a0,-32768 +0+0424 <[^>]*> addu \$a0,\$a0,\$a1 +0+0428 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*428: R_MIPS_GOT16 .bss +0+042c <[^>]*> nop +0+0430 <[^>]*> addiu \$a0,\$a0,-32768 +[ ]*430: R_MIPS_LO16 .bss +0+0434 <[^>]*> addu \$a0,\$a0,\$a1 +0+0438 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*438: R_MIPS_GOT16 .bss +0+043c <[^>]*> nop +0+0440 <[^>]*> addiu \$a0,\$a0,-31768 +[ ]*440: R_MIPS_LO16 .bss +0+0444 <[^>]*> addu \$a0,\$a0,\$a1 +0+0448 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*448: R_MIPS_GOT16 .data +0+044c <[^>]*> lui \$at,0x1 +0+0450 <[^>]*> addiu \$at,\$at,0 +[ ]*450: R_MIPS_LO16 .data +0+0454 <[^>]*> addu \$a0,\$a0,\$at +0+0458 <[^>]*> addu \$a0,\$a0,\$a1 +0+045c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*45c: R_MIPS_GOT16 big_external_data_label +0+0460 <[^>]*> lui \$at,0x1 +0+0464 <[^>]*> addiu \$at,\$at,0 +0+0468 <[^>]*> addu \$a0,\$a0,\$at +0+046c <[^>]*> addu \$a0,\$a0,\$a1 +0+0470 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*470: R_MIPS_GOT16 small_external_data_label +0+0474 <[^>]*> lui \$at,0x1 +0+0478 <[^>]*> addiu \$at,\$at,0 +0+047c <[^>]*> addu \$a0,\$a0,\$at +0+0480 <[^>]*> addu \$a0,\$a0,\$a1 +0+0484 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*484: R_MIPS_GOT16 big_external_common +0+0488 <[^>]*> lui \$at,0x1 +0+048c <[^>]*> addiu \$at,\$at,0 +0+0490 <[^>]*> addu \$a0,\$a0,\$at +0+0494 <[^>]*> addu \$a0,\$a0,\$a1 +0+0498 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*498: R_MIPS_GOT16 small_external_common +0+049c <[^>]*> lui \$at,0x1 +0+04a0 <[^>]*> addiu \$at,\$at,0 +0+04a4 <[^>]*> addu \$a0,\$a0,\$at +0+04a8 <[^>]*> addu \$a0,\$a0,\$a1 +0+04ac <[^>]*> lw \$a0,0\(\$gp\) +[ ]*4ac: R_MIPS_GOT16 .bss +0+04b0 <[^>]*> lui \$at,0x1 +0+04b4 <[^>]*> addiu \$at,\$at,0 +[ ]*4b4: R_MIPS_LO16 .bss +0+04b8 <[^>]*> addu \$a0,\$a0,\$at +0+04bc <[^>]*> addu \$a0,\$a0,\$a1 +0+04c0 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*4c0: R_MIPS_GOT16 .bss +0+04c4 <[^>]*> lui \$at,0x1 +0+04c8 <[^>]*> addiu \$at,\$at,1000 +[ ]*4c8: R_MIPS_LO16 .bss +0+04cc <[^>]*> addu \$a0,\$a0,\$at +0+04d0 <[^>]*> addu \$a0,\$a0,\$a1 +0+04d4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*4d4: R_MIPS_GOT16 .data +0+04d8 <[^>]*> lui \$at,0x2 +0+04dc <[^>]*> addiu \$at,\$at,-23131 +[ ]*4dc: R_MIPS_LO16 .data +0+04e0 <[^>]*> addu \$a0,\$a0,\$at +0+04e4 <[^>]*> addu \$a0,\$a0,\$a1 +0+04e8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*4e8: R_MIPS_GOT16 big_external_data_label +0+04ec <[^>]*> lui \$at,0x2 +0+04f0 <[^>]*> addiu \$at,\$at,-23131 +0+04f4 <[^>]*> addu \$a0,\$a0,\$at +0+04f8 <[^>]*> addu \$a0,\$a0,\$a1 +0+04fc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*4fc: R_MIPS_GOT16 small_external_data_label +0+0500 <[^>]*> lui \$at,0x2 +0+0504 <[^>]*> addiu \$at,\$at,-23131 +0+0508 <[^>]*> addu \$a0,\$a0,\$at +0+050c <[^>]*> addu \$a0,\$a0,\$a1 +0+0510 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*510: R_MIPS_GOT16 big_external_common +0+0514 <[^>]*> lui \$at,0x2 +0+0518 <[^>]*> addiu \$at,\$at,-23131 +0+051c <[^>]*> addu \$a0,\$a0,\$at +0+0520 <[^>]*> addu \$a0,\$a0,\$a1 +0+0524 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*524: R_MIPS_GOT16 small_external_common +0+0528 <[^>]*> lui \$at,0x2 +0+052c <[^>]*> addiu \$at,\$at,-23131 +0+0530 <[^>]*> addu \$a0,\$a0,\$at +0+0534 <[^>]*> addu \$a0,\$a0,\$a1 +0+0538 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*538: R_MIPS_GOT16 .bss +0+053c <[^>]*> lui \$at,0x2 +0+0540 <[^>]*> addiu \$at,\$at,-23131 +[ ]*540: R_MIPS_LO16 .bss +0+0544 <[^>]*> addu \$a0,\$a0,\$at +0+0548 <[^>]*> addu \$a0,\$a0,\$a1 +0+054c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*54c: R_MIPS_GOT16 .bss +0+0550 <[^>]*> lui \$at,0x2 +0+0554 <[^>]*> addiu \$at,\$at,-22131 +[ ]*554: R_MIPS_LO16 .bss +0+0558 <[^>]*> addu \$a0,\$a0,\$at +0+055c <[^>]*> addu \$a0,\$a0,\$a1 diff -urN binutils-2.7/gas/testsuite/gas/mips/la-xgot.d binutils-2.8/gas/testsuite/gas/mips/la-xgot.d --- binutils-2.7/gas/testsuite/gas/mips/la-xgot.d Thu Jul 4 12:15:56 1996 +++ binutils-2.8/gas/testsuite/gas/mips/la-xgot.d Wed Apr 30 12:54:30 1997 @@ -1,6 +1,6 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS la-xgot -#as: -mips1 -KPIC -xgot +#as: -mips1 -KPIC -xgot --defsym KPIC=1 #source: la.s # Test the la macro with -KPIC -xgot. @@ -8,611 +8,611 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> li \$a0,0 -0+0004 <[^>]*> li \$a0,1 -0+0008 <[^>]*> li \$a0,0x8000 -0+000c <[^>]*> li \$a0,-32768 -0+0010 <[^>]*> lui \$a0,0x1 -0+0014 <[^>]*> lui \$a0,0x1 -0+0018 <[^>]*> ori \$a0,\$a0,0xa5a5 -0+001c <[^>]*> li \$a0,0 -0+0020 <[^>]*> addu \$a0,\$a0,\$a1 -0+0024 <[^>]*> li \$a0,1 -0+0028 <[^>]*> addu \$a0,\$a0,\$a1 -0+002c <[^>]*> li \$a0,0x8000 -0+0030 <[^>]*> addu \$a0,\$a0,\$a1 -0+0034 <[^>]*> li \$a0,-32768 -0+0038 <[^>]*> addu \$a0,\$a0,\$a1 -0+003c <[^>]*> lui \$a0,0x1 -0+0040 <[^>]*> addu \$a0,\$a0,\$a1 -0+0044 <[^>]*> lui \$a0,0x1 -0+0048 <[^>]*> ori \$a0,\$a0,0xa5a5 -0+004c <[^>]*> addu \$a0,\$a0,\$a1 -0+0050 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0050 R_MIPS_GOT16 .data -... -0+0058 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0058 R_MIPS_LO16 .data -0+005c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+005c R_MIPS_GOT_HI16 big_external_data_label -0+0060 <[^>]*> addu \$a0,\$a0,\$gp -0+0064 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0064 R_MIPS_GOT_LO16 big_external_data_label -0+0068 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0068 R_MIPS_GOT_HI16 small_external_data_label -0+006c <[^>]*> addu \$a0,\$a0,\$gp -0+0070 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0070 R_MIPS_GOT_LO16 small_external_data_label -0+0074 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0074 R_MIPS_GOT_HI16 big_external_common -0+0078 <[^>]*> addu \$a0,\$a0,\$gp -0+007c <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+007c R_MIPS_GOT_LO16 big_external_common -0+0080 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0080 R_MIPS_GOT_HI16 small_external_common -0+0084 <[^>]*> addu \$a0,\$a0,\$gp -0+0088 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0088 R_MIPS_GOT_LO16 small_external_common -0+008c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+008c R_MIPS_GOT16 .bss -... -0+0094 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0094 R_MIPS_LO16 .bss -0+0098 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0098 R_MIPS_GOT16 .bss -... -0+00a0 <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+00a0 R_MIPS_LO16 .bss -0+00a4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00a4 R_MIPS_GOT16 .data -... -0+00ac <[^>]*> addiu \$a0,\$a0,1 -[ ]*RELOC: 0+00ac R_MIPS_LO16 .data -0+00b0 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00b0 R_MIPS_GOT_HI16 big_external_data_label -0+00b4 <[^>]*> addu \$a0,\$a0,\$gp -0+00b8 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+00b8 R_MIPS_GOT_LO16 big_external_data_label -... -0+00c0 <[^>]*> addiu \$a0,\$a0,1 -0+00c4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00c4 R_MIPS_GOT_HI16 small_external_data_label -0+00c8 <[^>]*> addu \$a0,\$a0,\$gp -0+00cc <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+00cc R_MIPS_GOT_LO16 small_external_data_label -... -0+00d4 <[^>]*> addiu \$a0,\$a0,1 -0+00d8 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00d8 R_MIPS_GOT_HI16 big_external_common -0+00dc <[^>]*> addu \$a0,\$a0,\$gp -0+00e0 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+00e0 R_MIPS_GOT_LO16 big_external_common -... -0+00e8 <[^>]*> addiu \$a0,\$a0,1 -0+00ec <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00ec R_MIPS_GOT_HI16 small_external_common -0+00f0 <[^>]*> addu \$a0,\$a0,\$gp -0+00f4 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+00f4 R_MIPS_GOT_LO16 small_external_common -... -0+00fc <[^>]*> addiu \$a0,\$a0,1 -0+0100 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0100 R_MIPS_GOT16 .bss -... -0+0108 <[^>]*> addiu \$a0,\$a0,1 -[ ]*RELOC: 0+0108 R_MIPS_LO16 .bss -0+010c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+010c R_MIPS_GOT16 .bss -... -0+0114 <[^>]*> addiu \$a0,\$a0,1001 -[ ]*RELOC: 0+0114 R_MIPS_LO16 .bss -0+0118 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0118 R_MIPS_GOT16 .data -0+011c <[^>]*> lui \$at,0x1 -0+0120 <[^>]*> addiu \$at,\$at,-32768 -[ ]*RELOC: 0+0120 R_MIPS_LO16 .data -0+0124 <[^>]*> addu \$a0,\$a0,\$at -0+0128 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0128 R_MIPS_GOT_HI16 big_external_data_label -0+012c <[^>]*> addu \$a0,\$a0,\$gp -0+0130 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0130 R_MIPS_GOT_LO16 big_external_data_label -0+0134 <[^>]*> lui \$at,0x1 -0+0138 <[^>]*> addiu \$at,\$at,-32768 -0+013c <[^>]*> addu \$a0,\$a0,\$at -0+0140 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0140 R_MIPS_GOT_HI16 small_external_data_label -0+0144 <[^>]*> addu \$a0,\$a0,\$gp -0+0148 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0148 R_MIPS_GOT_LO16 small_external_data_label -0+014c <[^>]*> lui \$at,0x1 -0+0150 <[^>]*> addiu \$at,\$at,-32768 -0+0154 <[^>]*> addu \$a0,\$a0,\$at -0+0158 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0158 R_MIPS_GOT_HI16 big_external_common -0+015c <[^>]*> addu \$a0,\$a0,\$gp -0+0160 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0160 R_MIPS_GOT_LO16 big_external_common -0+0164 <[^>]*> lui \$at,0x1 -0+0168 <[^>]*> addiu \$at,\$at,-32768 -0+016c <[^>]*> addu \$a0,\$a0,\$at -0+0170 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0170 R_MIPS_GOT_HI16 small_external_common -0+0174 <[^>]*> addu \$a0,\$a0,\$gp -0+0178 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0178 R_MIPS_GOT_LO16 small_external_common -0+017c <[^>]*> lui \$at,0x1 -0+0180 <[^>]*> addiu \$at,\$at,-32768 -0+0184 <[^>]*> addu \$a0,\$a0,\$at -0+0188 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0188 R_MIPS_GOT16 .bss -0+018c <[^>]*> lui \$at,0x1 -0+0190 <[^>]*> addiu \$at,\$at,-32768 -[ ]*RELOC: 0+0190 R_MIPS_LO16 .bss -0+0194 <[^>]*> addu \$a0,\$a0,\$at -0+0198 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0198 R_MIPS_GOT16 .bss -0+019c <[^>]*> lui \$at,0x1 -0+01a0 <[^>]*> addiu \$at,\$at,-31768 -[ ]*RELOC: 0+01a0 R_MIPS_LO16 .bss -0+01a4 <[^>]*> addu \$a0,\$a0,\$at -0+01a8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01a8 R_MIPS_GOT16 .data -... -0+01b0 <[^>]*> addiu \$a0,\$a0,-32768 -[ ]*RELOC: 0+01b0 R_MIPS_LO16 .data -0+01b4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01b4 R_MIPS_GOT_HI16 big_external_data_label -0+01b8 <[^>]*> addu \$a0,\$a0,\$gp -0+01bc <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+01bc R_MIPS_GOT_LO16 big_external_data_label -... -0+01c4 <[^>]*> addiu \$a0,\$a0,-32768 -0+01c8 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01c8 R_MIPS_GOT_HI16 small_external_data_label -0+01cc <[^>]*> addu \$a0,\$a0,\$gp -0+01d0 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+01d0 R_MIPS_GOT_LO16 small_external_data_label -... -0+01d8 <[^>]*> addiu \$a0,\$a0,-32768 -0+01dc <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01dc R_MIPS_GOT_HI16 big_external_common -0+01e0 <[^>]*> addu \$a0,\$a0,\$gp -0+01e4 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+01e4 R_MIPS_GOT_LO16 big_external_common -... -0+01ec <[^>]*> addiu \$a0,\$a0,-32768 -0+01f0 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01f0 R_MIPS_GOT_HI16 small_external_common -0+01f4 <[^>]*> addu \$a0,\$a0,\$gp -0+01f8 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+01f8 R_MIPS_GOT_LO16 small_external_common -... -0+0200 <[^>]*> addiu \$a0,\$a0,-32768 -0+0204 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0204 R_MIPS_GOT16 .bss -... -0+020c <[^>]*> addiu \$a0,\$a0,-32768 -[ ]*RELOC: 0+020c R_MIPS_LO16 .bss -0+0210 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0210 R_MIPS_GOT16 .bss -... -0+0218 <[^>]*> addiu \$a0,\$a0,-31768 -[ ]*RELOC: 0+0218 R_MIPS_LO16 .bss -0+021c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+021c R_MIPS_GOT16 .data -0+0220 <[^>]*> lui \$at,0x1 -0+0224 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0224 R_MIPS_LO16 .data -0+0228 <[^>]*> addu \$a0,\$a0,\$at -0+022c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+022c R_MIPS_GOT_HI16 big_external_data_label -0+0230 <[^>]*> addu \$a0,\$a0,\$gp -0+0234 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0234 R_MIPS_GOT_LO16 big_external_data_label -0+0238 <[^>]*> lui \$at,0x1 -0+023c <[^>]*> addiu \$at,\$at,0 -0+0240 <[^>]*> addu \$a0,\$a0,\$at -0+0244 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0244 R_MIPS_GOT_HI16 small_external_data_label -0+0248 <[^>]*> addu \$a0,\$a0,\$gp -0+024c <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+024c R_MIPS_GOT_LO16 small_external_data_label -0+0250 <[^>]*> lui \$at,0x1 -0+0254 <[^>]*> addiu \$at,\$at,0 -0+0258 <[^>]*> addu \$a0,\$a0,\$at -0+025c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+025c R_MIPS_GOT_HI16 big_external_common -0+0260 <[^>]*> addu \$a0,\$a0,\$gp -0+0264 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0264 R_MIPS_GOT_LO16 big_external_common -0+0268 <[^>]*> lui \$at,0x1 -0+026c <[^>]*> addiu \$at,\$at,0 -0+0270 <[^>]*> addu \$a0,\$a0,\$at -0+0274 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0274 R_MIPS_GOT_HI16 small_external_common -0+0278 <[^>]*> addu \$a0,\$a0,\$gp -0+027c <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+027c R_MIPS_GOT_LO16 small_external_common -0+0280 <[^>]*> lui \$at,0x1 -0+0284 <[^>]*> addiu \$at,\$at,0 -0+0288 <[^>]*> addu \$a0,\$a0,\$at -0+028c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+028c R_MIPS_GOT16 .bss -0+0290 <[^>]*> lui \$at,0x1 -0+0294 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0294 R_MIPS_LO16 .bss -0+0298 <[^>]*> addu \$a0,\$a0,\$at -0+029c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+029c R_MIPS_GOT16 .bss -0+02a0 <[^>]*> lui \$at,0x1 -0+02a4 <[^>]*> addiu \$at,\$at,1000 -[ ]*RELOC: 0+02a4 R_MIPS_LO16 .bss -0+02a8 <[^>]*> addu \$a0,\$a0,\$at -0+02ac <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+02ac R_MIPS_GOT16 .data -0+02b0 <[^>]*> lui \$at,0x2 -0+02b4 <[^>]*> addiu \$at,\$at,-23131 -[ ]*RELOC: 0+02b4 R_MIPS_LO16 .data -0+02b8 <[^>]*> addu \$a0,\$a0,\$at -0+02bc <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+02bc R_MIPS_GOT_HI16 big_external_data_label -0+02c0 <[^>]*> addu \$a0,\$a0,\$gp -0+02c4 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+02c4 R_MIPS_GOT_LO16 big_external_data_label -0+02c8 <[^>]*> lui \$at,0x2 -0+02cc <[^>]*> addiu \$at,\$at,-23131 -0+02d0 <[^>]*> addu \$a0,\$a0,\$at -0+02d4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+02d4 R_MIPS_GOT_HI16 small_external_data_label -0+02d8 <[^>]*> addu \$a0,\$a0,\$gp -0+02dc <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+02dc R_MIPS_GOT_LO16 small_external_data_label -0+02e0 <[^>]*> lui \$at,0x2 -0+02e4 <[^>]*> addiu \$at,\$at,-23131 -0+02e8 <[^>]*> addu \$a0,\$a0,\$at -0+02ec <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+02ec R_MIPS_GOT_HI16 big_external_common -0+02f0 <[^>]*> addu \$a0,\$a0,\$gp -0+02f4 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+02f4 R_MIPS_GOT_LO16 big_external_common -0+02f8 <[^>]*> lui \$at,0x2 -0+02fc <[^>]*> addiu \$at,\$at,-23131 -0+0300 <[^>]*> addu \$a0,\$a0,\$at -0+0304 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0304 R_MIPS_GOT_HI16 small_external_common -0+0308 <[^>]*> addu \$a0,\$a0,\$gp -0+030c <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+030c R_MIPS_GOT_LO16 small_external_common -0+0310 <[^>]*> lui \$at,0x2 -0+0314 <[^>]*> addiu \$at,\$at,-23131 -0+0318 <[^>]*> addu \$a0,\$a0,\$at -0+031c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+031c R_MIPS_GOT16 .bss -0+0320 <[^>]*> lui \$at,0x2 -0+0324 <[^>]*> addiu \$at,\$at,-23131 -[ ]*RELOC: 0+0324 R_MIPS_LO16 .bss -0+0328 <[^>]*> addu \$a0,\$a0,\$at -0+032c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+032c R_MIPS_GOT16 .bss -0+0330 <[^>]*> lui \$at,0x2 -0+0334 <[^>]*> addiu \$at,\$at,-22131 -[ ]*RELOC: 0+0334 R_MIPS_LO16 .bss -0+0338 <[^>]*> addu \$a0,\$a0,\$at -0+033c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+033c R_MIPS_GOT16 .data -... -0+0344 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0344 R_MIPS_LO16 .data -0+0348 <[^>]*> addu \$a0,\$a0,\$a1 -0+034c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+034c R_MIPS_GOT_HI16 big_external_data_label -0+0350 <[^>]*> addu \$a0,\$a0,\$gp -0+0354 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0354 R_MIPS_GOT_LO16 big_external_data_label -... -0+035c <[^>]*> addu \$a0,\$a0,\$a1 -0+0360 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0360 R_MIPS_GOT_HI16 small_external_data_label -0+0364 <[^>]*> addu \$a0,\$a0,\$gp -0+0368 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0368 R_MIPS_GOT_LO16 small_external_data_label -... -0+0370 <[^>]*> addu \$a0,\$a0,\$a1 -0+0374 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0374 R_MIPS_GOT_HI16 big_external_common -0+0378 <[^>]*> addu \$a0,\$a0,\$gp -0+037c <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+037c R_MIPS_GOT_LO16 big_external_common -... -0+0384 <[^>]*> addu \$a0,\$a0,\$a1 -0+0388 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0388 R_MIPS_GOT_HI16 small_external_common -0+038c <[^>]*> addu \$a0,\$a0,\$gp -0+0390 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0390 R_MIPS_GOT_LO16 small_external_common -... -0+0398 <[^>]*> addu \$a0,\$a0,\$a1 -0+039c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+039c R_MIPS_GOT16 .bss -... -0+03a4 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+03a4 R_MIPS_LO16 .bss -0+03a8 <[^>]*> addu \$a0,\$a0,\$a1 -0+03ac <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+03ac R_MIPS_GOT16 .bss -... -0+03b4 <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+03b4 R_MIPS_LO16 .bss -0+03b8 <[^>]*> addu \$a0,\$a0,\$a1 -0+03bc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+03bc R_MIPS_GOT16 .data -... -0+03c4 <[^>]*> addiu \$a0,\$a0,1 -[ ]*RELOC: 0+03c4 R_MIPS_LO16 .data -0+03c8 <[^>]*> addu \$a0,\$a0,\$a1 -0+03cc <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+03cc R_MIPS_GOT_HI16 big_external_data_label -0+03d0 <[^>]*> addu \$a0,\$a0,\$gp -0+03d4 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+03d4 R_MIPS_GOT_LO16 big_external_data_label -... -0+03dc <[^>]*> addiu \$a0,\$a0,1 -0+03e0 <[^>]*> addu \$a0,\$a0,\$a1 -0+03e4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+03e4 R_MIPS_GOT_HI16 small_external_data_label -0+03e8 <[^>]*> addu \$a0,\$a0,\$gp -0+03ec <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+03ec R_MIPS_GOT_LO16 small_external_data_label -... -0+03f4 <[^>]*> addiu \$a0,\$a0,1 -0+03f8 <[^>]*> addu \$a0,\$a0,\$a1 -0+03fc <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+03fc R_MIPS_GOT_HI16 big_external_common -0+0400 <[^>]*> addu \$a0,\$a0,\$gp -0+0404 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0404 R_MIPS_GOT_LO16 big_external_common -... -0+040c <[^>]*> addiu \$a0,\$a0,1 -0+0410 <[^>]*> addu \$a0,\$a0,\$a1 -0+0414 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0414 R_MIPS_GOT_HI16 small_external_common -0+0418 <[^>]*> addu \$a0,\$a0,\$gp -0+041c <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+041c R_MIPS_GOT_LO16 small_external_common -... -0+0424 <[^>]*> addiu \$a0,\$a0,1 -0+0428 <[^>]*> addu \$a0,\$a0,\$a1 -0+042c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+042c R_MIPS_GOT16 .bss -... -0+0434 <[^>]*> addiu \$a0,\$a0,1 -[ ]*RELOC: 0+0434 R_MIPS_LO16 .bss -0+0438 <[^>]*> addu \$a0,\$a0,\$a1 -0+043c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+043c R_MIPS_GOT16 .bss -... -0+0444 <[^>]*> addiu \$a0,\$a0,1001 -[ ]*RELOC: 0+0444 R_MIPS_LO16 .bss -0+0448 <[^>]*> addu \$a0,\$a0,\$a1 -0+044c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+044c R_MIPS_GOT16 .data -0+0450 <[^>]*> lui \$at,0x1 -0+0454 <[^>]*> addiu \$at,\$at,-32768 -[ ]*RELOC: 0+0454 R_MIPS_LO16 .data -0+0458 <[^>]*> addu \$a0,\$a0,\$at -0+045c <[^>]*> addu \$a0,\$a0,\$a1 -0+0460 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0460 R_MIPS_GOT_HI16 big_external_data_label -0+0464 <[^>]*> addu \$a0,\$a0,\$gp -0+0468 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0468 R_MIPS_GOT_LO16 big_external_data_label -0+046c <[^>]*> lui \$at,0x1 -0+0470 <[^>]*> addiu \$at,\$at,-32768 -0+0474 <[^>]*> addu \$a0,\$a0,\$at -0+0478 <[^>]*> addu \$a0,\$a0,\$a1 -0+047c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+047c R_MIPS_GOT_HI16 small_external_data_label -0+0480 <[^>]*> addu \$a0,\$a0,\$gp -0+0484 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0484 R_MIPS_GOT_LO16 small_external_data_label -0+0488 <[^>]*> lui \$at,0x1 -0+048c <[^>]*> addiu \$at,\$at,-32768 -0+0490 <[^>]*> addu \$a0,\$a0,\$at -0+0494 <[^>]*> addu \$a0,\$a0,\$a1 -0+0498 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0498 R_MIPS_GOT_HI16 big_external_common -0+049c <[^>]*> addu \$a0,\$a0,\$gp -0+04a0 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+04a0 R_MIPS_GOT_LO16 big_external_common -0+04a4 <[^>]*> lui \$at,0x1 -0+04a8 <[^>]*> addiu \$at,\$at,-32768 -0+04ac <[^>]*> addu \$a0,\$a0,\$at -0+04b0 <[^>]*> addu \$a0,\$a0,\$a1 -0+04b4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+04b4 R_MIPS_GOT_HI16 small_external_common -0+04b8 <[^>]*> addu \$a0,\$a0,\$gp -0+04bc <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+04bc R_MIPS_GOT_LO16 small_external_common -0+04c0 <[^>]*> lui \$at,0x1 -0+04c4 <[^>]*> addiu \$at,\$at,-32768 -0+04c8 <[^>]*> addu \$a0,\$a0,\$at -0+04cc <[^>]*> addu \$a0,\$a0,\$a1 -0+04d0 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+04d0 R_MIPS_GOT16 .bss -0+04d4 <[^>]*> lui \$at,0x1 -0+04d8 <[^>]*> addiu \$at,\$at,-32768 -[ ]*RELOC: 0+04d8 R_MIPS_LO16 .bss -0+04dc <[^>]*> addu \$a0,\$a0,\$at -0+04e0 <[^>]*> addu \$a0,\$a0,\$a1 -0+04e4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+04e4 R_MIPS_GOT16 .bss -0+04e8 <[^>]*> lui \$at,0x1 -0+04ec <[^>]*> addiu \$at,\$at,-31768 -[ ]*RELOC: 0+04ec R_MIPS_LO16 .bss -0+04f0 <[^>]*> addu \$a0,\$a0,\$at -0+04f4 <[^>]*> addu \$a0,\$a0,\$a1 -0+04f8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+04f8 R_MIPS_GOT16 .data -... -0+0500 <[^>]*> addiu \$a0,\$a0,-32768 -[ ]*RELOC: 0+0500 R_MIPS_LO16 .data -0+0504 <[^>]*> addu \$a0,\$a0,\$a1 -0+0508 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0508 R_MIPS_GOT_HI16 big_external_data_label -0+050c <[^>]*> addu \$a0,\$a0,\$gp -0+0510 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0510 R_MIPS_GOT_LO16 big_external_data_label -... -0+0518 <[^>]*> addiu \$a0,\$a0,-32768 -0+051c <[^>]*> addu \$a0,\$a0,\$a1 -0+0520 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0520 R_MIPS_GOT_HI16 small_external_data_label -0+0524 <[^>]*> addu \$a0,\$a0,\$gp -0+0528 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0528 R_MIPS_GOT_LO16 small_external_data_label -... -0+0530 <[^>]*> addiu \$a0,\$a0,-32768 -0+0534 <[^>]*> addu \$a0,\$a0,\$a1 -0+0538 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0538 R_MIPS_GOT_HI16 big_external_common -0+053c <[^>]*> addu \$a0,\$a0,\$gp -0+0540 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0540 R_MIPS_GOT_LO16 big_external_common -... -0+0548 <[^>]*> addiu \$a0,\$a0,-32768 -0+054c <[^>]*> addu \$a0,\$a0,\$a1 -0+0550 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0550 R_MIPS_GOT_HI16 small_external_common -0+0554 <[^>]*> addu \$a0,\$a0,\$gp -0+0558 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0558 R_MIPS_GOT_LO16 small_external_common -... -0+0560 <[^>]*> addiu \$a0,\$a0,-32768 -0+0564 <[^>]*> addu \$a0,\$a0,\$a1 -0+0568 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0568 R_MIPS_GOT16 .bss -... -0+0570 <[^>]*> addiu \$a0,\$a0,-32768 -[ ]*RELOC: 0+0570 R_MIPS_LO16 .bss -0+0574 <[^>]*> addu \$a0,\$a0,\$a1 -0+0578 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0578 R_MIPS_GOT16 .bss -... -0+0580 <[^>]*> addiu \$a0,\$a0,-31768 -[ ]*RELOC: 0+0580 R_MIPS_LO16 .bss -0+0584 <[^>]*> addu \$a0,\$a0,\$a1 -0+0588 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0588 R_MIPS_GOT16 .data -0+058c <[^>]*> lui \$at,0x1 -0+0590 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0590 R_MIPS_LO16 .data -0+0594 <[^>]*> addu \$a0,\$a0,\$at -0+0598 <[^>]*> addu \$a0,\$a0,\$a1 -0+059c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+059c R_MIPS_GOT_HI16 big_external_data_label -0+05a0 <[^>]*> addu \$a0,\$a0,\$gp -0+05a4 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+05a4 R_MIPS_GOT_LO16 big_external_data_label -0+05a8 <[^>]*> lui \$at,0x1 -0+05ac <[^>]*> addiu \$at,\$at,0 -0+05b0 <[^>]*> addu \$a0,\$a0,\$at -0+05b4 <[^>]*> addu \$a0,\$a0,\$a1 -0+05b8 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+05b8 R_MIPS_GOT_HI16 small_external_data_label -0+05bc <[^>]*> addu \$a0,\$a0,\$gp -0+05c0 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+05c0 R_MIPS_GOT_LO16 small_external_data_label -0+05c4 <[^>]*> lui \$at,0x1 -0+05c8 <[^>]*> addiu \$at,\$at,0 -0+05cc <[^>]*> addu \$a0,\$a0,\$at -0+05d0 <[^>]*> addu \$a0,\$a0,\$a1 -0+05d4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+05d4 R_MIPS_GOT_HI16 big_external_common -0+05d8 <[^>]*> addu \$a0,\$a0,\$gp -0+05dc <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+05dc R_MIPS_GOT_LO16 big_external_common -0+05e0 <[^>]*> lui \$at,0x1 -0+05e4 <[^>]*> addiu \$at,\$at,0 -0+05e8 <[^>]*> addu \$a0,\$a0,\$at -0+05ec <[^>]*> addu \$a0,\$a0,\$a1 -0+05f0 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+05f0 R_MIPS_GOT_HI16 small_external_common -0+05f4 <[^>]*> addu \$a0,\$a0,\$gp -0+05f8 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+05f8 R_MIPS_GOT_LO16 small_external_common -0+05fc <[^>]*> lui \$at,0x1 -0+0600 <[^>]*> addiu \$at,\$at,0 -0+0604 <[^>]*> addu \$a0,\$a0,\$at -0+0608 <[^>]*> addu \$a0,\$a0,\$a1 -0+060c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+060c R_MIPS_GOT16 .bss -0+0610 <[^>]*> lui \$at,0x1 -0+0614 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0614 R_MIPS_LO16 .bss -0+0618 <[^>]*> addu \$a0,\$a0,\$at -0+061c <[^>]*> addu \$a0,\$a0,\$a1 -0+0620 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0620 R_MIPS_GOT16 .bss -0+0624 <[^>]*> lui \$at,0x1 -0+0628 <[^>]*> addiu \$at,\$at,1000 -[ ]*RELOC: 0+0628 R_MIPS_LO16 .bss -0+062c <[^>]*> addu \$a0,\$a0,\$at -0+0630 <[^>]*> addu \$a0,\$a0,\$a1 -0+0634 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0634 R_MIPS_GOT16 .data -0+0638 <[^>]*> lui \$at,0x2 -0+063c <[^>]*> addiu \$at,\$at,-23131 -[ ]*RELOC: 0+063c R_MIPS_LO16 .data -0+0640 <[^>]*> addu \$a0,\$a0,\$at -0+0644 <[^>]*> addu \$a0,\$a0,\$a1 -0+0648 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0648 R_MIPS_GOT_HI16 big_external_data_label -0+064c <[^>]*> addu \$a0,\$a0,\$gp -0+0650 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0650 R_MIPS_GOT_LO16 big_external_data_label -0+0654 <[^>]*> lui \$at,0x2 -0+0658 <[^>]*> addiu \$at,\$at,-23131 -0+065c <[^>]*> addu \$a0,\$a0,\$at -0+0660 <[^>]*> addu \$a0,\$a0,\$a1 -0+0664 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0664 R_MIPS_GOT_HI16 small_external_data_label -0+0668 <[^>]*> addu \$a0,\$a0,\$gp -0+066c <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+066c R_MIPS_GOT_LO16 small_external_data_label -0+0670 <[^>]*> lui \$at,0x2 -0+0674 <[^>]*> addiu \$at,\$at,-23131 -0+0678 <[^>]*> addu \$a0,\$a0,\$at -0+067c <[^>]*> addu \$a0,\$a0,\$a1 -0+0680 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0680 R_MIPS_GOT_HI16 big_external_common -0+0684 <[^>]*> addu \$a0,\$a0,\$gp -0+0688 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0688 R_MIPS_GOT_LO16 big_external_common -0+068c <[^>]*> lui \$at,0x2 -0+0690 <[^>]*> addiu \$at,\$at,-23131 -0+0694 <[^>]*> addu \$a0,\$a0,\$at -0+0698 <[^>]*> addu \$a0,\$a0,\$a1 -0+069c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+069c R_MIPS_GOT_HI16 small_external_common -0+06a0 <[^>]*> addu \$a0,\$a0,\$gp -0+06a4 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+06a4 R_MIPS_GOT_LO16 small_external_common -0+06a8 <[^>]*> lui \$at,0x2 -0+06ac <[^>]*> addiu \$at,\$at,-23131 -0+06b0 <[^>]*> addu \$a0,\$a0,\$at -0+06b4 <[^>]*> addu \$a0,\$a0,\$a1 -0+06b8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+06b8 R_MIPS_GOT16 .bss -0+06bc <[^>]*> lui \$at,0x2 -0+06c0 <[^>]*> addiu \$at,\$at,-23131 -[ ]*RELOC: 0+06c0 R_MIPS_LO16 .bss -0+06c4 <[^>]*> addu \$a0,\$a0,\$at -0+06c8 <[^>]*> addu \$a0,\$a0,\$a1 -0+06cc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+06cc R_MIPS_GOT16 .bss -0+06d0 <[^>]*> lui \$at,0x2 -0+06d4 <[^>]*> addiu \$at,\$at,-22131 -[ ]*RELOC: 0+06d4 R_MIPS_LO16 .bss -0+06d8 <[^>]*> addu \$a0,\$a0,\$at -0+06dc <[^>]*> addu \$a0,\$a0,\$a1 +0+0000 <[^>]*> li \$a0,0 +0+0004 <[^>]*> li \$a0,1 +0+0008 <[^>]*> li \$a0,0x8000 +0+000c <[^>]*> li \$a0,-32768 +0+0010 <[^>]*> lui \$a0,0x1 +0+0014 <[^>]*> lui \$a0,0x1 +0+0018 <[^>]*> ori \$a0,\$a0,0xa5a5 +0+001c <[^>]*> li \$a0,0 +0+0020 <[^>]*> addu \$a0,\$a0,\$a1 +0+0024 <[^>]*> li \$a0,1 +0+0028 <[^>]*> addu \$a0,\$a0,\$a1 +0+002c <[^>]*> li \$a0,0x8000 +0+0030 <[^>]*> addu \$a0,\$a0,\$a1 +0+0034 <[^>]*> li \$a0,-32768 +0+0038 <[^>]*> addu \$a0,\$a0,\$a1 +0+003c <[^>]*> lui \$a0,0x1 +0+0040 <[^>]*> addu \$a0,\$a0,\$a1 +0+0044 <[^>]*> lui \$a0,0x1 +0+0048 <[^>]*> ori \$a0,\$a0,0xa5a5 +0+004c <[^>]*> addu \$a0,\$a0,\$a1 +0+0050 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*50: R_MIPS_GOT16 .data +0+0054 <[^>]*> nop +0+0058 <[^>]*> addiu \$a0,\$a0,0 +[ ]*58: R_MIPS_LO16 .data +0+005c <[^>]*> lui \$a0,0x0 +[ ]*5c: R_MIPS_GOT_HI16 big_external_data_label +0+0060 <[^>]*> addu \$a0,\$a0,\$gp +0+0064 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*64: R_MIPS_GOT_LO16 big_external_data_label +0+0068 <[^>]*> lui \$a0,0x0 +[ ]*68: R_MIPS_GOT_HI16 small_external_data_label +0+006c <[^>]*> addu \$a0,\$a0,\$gp +0+0070 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*70: R_MIPS_GOT_LO16 small_external_data_label +0+0074 <[^>]*> lui \$a0,0x0 +[ ]*74: R_MIPS_GOT_HI16 big_external_common +0+0078 <[^>]*> addu \$a0,\$a0,\$gp +0+007c <[^>]*> lw \$a0,0\(\$a0\) +[ ]*7c: R_MIPS_GOT_LO16 big_external_common +0+0080 <[^>]*> lui \$a0,0x0 +[ ]*80: R_MIPS_GOT_HI16 small_external_common +0+0084 <[^>]*> addu \$a0,\$a0,\$gp +0+0088 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*88: R_MIPS_GOT_LO16 small_external_common +0+008c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*8c: R_MIPS_GOT16 .bss +0+0090 <[^>]*> nop +0+0094 <[^>]*> addiu \$a0,\$a0,0 +[ ]*94: R_MIPS_LO16 .bss +0+0098 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*98: R_MIPS_GOT16 .bss +0+009c <[^>]*> nop +0+00a0 <[^>]*> addiu \$a0,\$a0,1000 +[ ]*a0: R_MIPS_LO16 .bss +0+00a4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*a4: R_MIPS_GOT16 .data +0+00a8 <[^>]*> nop +0+00ac <[^>]*> addiu \$a0,\$a0,1 +[ ]*ac: R_MIPS_LO16 .data +0+00b0 <[^>]*> lui \$a0,0x0 +[ ]*b0: R_MIPS_GOT_HI16 big_external_data_label +0+00b4 <[^>]*> addu \$a0,\$a0,\$gp +0+00b8 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*b8: R_MIPS_GOT_LO16 big_external_data_label +0+00bc <[^>]*> nop +0+00c0 <[^>]*> addiu \$a0,\$a0,1 +0+00c4 <[^>]*> lui \$a0,0x0 +[ ]*c4: R_MIPS_GOT_HI16 small_external_data_label +0+00c8 <[^>]*> addu \$a0,\$a0,\$gp +0+00cc <[^>]*> lw \$a0,0\(\$a0\) +[ ]*cc: R_MIPS_GOT_LO16 small_external_data_label +0+00d0 <[^>]*> nop +0+00d4 <[^>]*> addiu \$a0,\$a0,1 +0+00d8 <[^>]*> lui \$a0,0x0 +[ ]*d8: R_MIPS_GOT_HI16 big_external_common +0+00dc <[^>]*> addu \$a0,\$a0,\$gp +0+00e0 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*e0: R_MIPS_GOT_LO16 big_external_common +0+00e4 <[^>]*> nop +0+00e8 <[^>]*> addiu \$a0,\$a0,1 +0+00ec <[^>]*> lui \$a0,0x0 +[ ]*ec: R_MIPS_GOT_HI16 small_external_common +0+00f0 <[^>]*> addu \$a0,\$a0,\$gp +0+00f4 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*f4: R_MIPS_GOT_LO16 small_external_common +0+00f8 <[^>]*> nop +0+00fc <[^>]*> addiu \$a0,\$a0,1 +0+0100 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*100: R_MIPS_GOT16 .bss +0+0104 <[^>]*> nop +0+0108 <[^>]*> addiu \$a0,\$a0,1 +[ ]*108: R_MIPS_LO16 .bss +0+010c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*10c: R_MIPS_GOT16 .bss +0+0110 <[^>]*> nop +0+0114 <[^>]*> addiu \$a0,\$a0,1001 +[ ]*114: R_MIPS_LO16 .bss +0+0118 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*118: R_MIPS_GOT16 .data +0+011c <[^>]*> lui \$at,0x1 +0+0120 <[^>]*> addiu \$at,\$at,-32768 +[ ]*120: R_MIPS_LO16 .data +0+0124 <[^>]*> addu \$a0,\$a0,\$at +0+0128 <[^>]*> lui \$a0,0x0 +[ ]*128: R_MIPS_GOT_HI16 big_external_data_label +0+012c <[^>]*> addu \$a0,\$a0,\$gp +0+0130 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*130: R_MIPS_GOT_LO16 big_external_data_label +0+0134 <[^>]*> lui \$at,0x1 +0+0138 <[^>]*> addiu \$at,\$at,-32768 +0+013c <[^>]*> addu \$a0,\$a0,\$at +0+0140 <[^>]*> lui \$a0,0x0 +[ ]*140: R_MIPS_GOT_HI16 small_external_data_label +0+0144 <[^>]*> addu \$a0,\$a0,\$gp +0+0148 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*148: R_MIPS_GOT_LO16 small_external_data_label +0+014c <[^>]*> lui \$at,0x1 +0+0150 <[^>]*> addiu \$at,\$at,-32768 +0+0154 <[^>]*> addu \$a0,\$a0,\$at +0+0158 <[^>]*> lui \$a0,0x0 +[ ]*158: R_MIPS_GOT_HI16 big_external_common +0+015c <[^>]*> addu \$a0,\$a0,\$gp +0+0160 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*160: R_MIPS_GOT_LO16 big_external_common +0+0164 <[^>]*> lui \$at,0x1 +0+0168 <[^>]*> addiu \$at,\$at,-32768 +0+016c <[^>]*> addu \$a0,\$a0,\$at +0+0170 <[^>]*> lui \$a0,0x0 +[ ]*170: R_MIPS_GOT_HI16 small_external_common +0+0174 <[^>]*> addu \$a0,\$a0,\$gp +0+0178 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*178: R_MIPS_GOT_LO16 small_external_common +0+017c <[^>]*> lui \$at,0x1 +0+0180 <[^>]*> addiu \$at,\$at,-32768 +0+0184 <[^>]*> addu \$a0,\$a0,\$at +0+0188 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*188: R_MIPS_GOT16 .bss +0+018c <[^>]*> lui \$at,0x1 +0+0190 <[^>]*> addiu \$at,\$at,-32768 +[ ]*190: R_MIPS_LO16 .bss +0+0194 <[^>]*> addu \$a0,\$a0,\$at +0+0198 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*198: R_MIPS_GOT16 .bss +0+019c <[^>]*> lui \$at,0x1 +0+01a0 <[^>]*> addiu \$at,\$at,-31768 +[ ]*1a0: R_MIPS_LO16 .bss +0+01a4 <[^>]*> addu \$a0,\$a0,\$at +0+01a8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1a8: R_MIPS_GOT16 .data +0+01ac <[^>]*> nop +0+01b0 <[^>]*> addiu \$a0,\$a0,-32768 +[ ]*1b0: R_MIPS_LO16 .data +0+01b4 <[^>]*> lui \$a0,0x0 +[ ]*1b4: R_MIPS_GOT_HI16 big_external_data_label +0+01b8 <[^>]*> addu \$a0,\$a0,\$gp +0+01bc <[^>]*> lw \$a0,0\(\$a0\) +[ ]*1bc: R_MIPS_GOT_LO16 big_external_data_label +0+01c0 <[^>]*> nop +0+01c4 <[^>]*> addiu \$a0,\$a0,-32768 +0+01c8 <[^>]*> lui \$a0,0x0 +[ ]*1c8: R_MIPS_GOT_HI16 small_external_data_label +0+01cc <[^>]*> addu \$a0,\$a0,\$gp +0+01d0 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*1d0: R_MIPS_GOT_LO16 small_external_data_label +0+01d4 <[^>]*> nop +0+01d8 <[^>]*> addiu \$a0,\$a0,-32768 +0+01dc <[^>]*> lui \$a0,0x0 +[ ]*1dc: R_MIPS_GOT_HI16 big_external_common +0+01e0 <[^>]*> addu \$a0,\$a0,\$gp +0+01e4 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*1e4: R_MIPS_GOT_LO16 big_external_common +0+01e8 <[^>]*> nop +0+01ec <[^>]*> addiu \$a0,\$a0,-32768 +0+01f0 <[^>]*> lui \$a0,0x0 +[ ]*1f0: R_MIPS_GOT_HI16 small_external_common +0+01f4 <[^>]*> addu \$a0,\$a0,\$gp +0+01f8 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*1f8: R_MIPS_GOT_LO16 small_external_common +0+01fc <[^>]*> nop +0+0200 <[^>]*> addiu \$a0,\$a0,-32768 +0+0204 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*204: R_MIPS_GOT16 .bss +0+0208 <[^>]*> nop +0+020c <[^>]*> addiu \$a0,\$a0,-32768 +[ ]*20c: R_MIPS_LO16 .bss +0+0210 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*210: R_MIPS_GOT16 .bss +0+0214 <[^>]*> nop +0+0218 <[^>]*> addiu \$a0,\$a0,-31768 +[ ]*218: R_MIPS_LO16 .bss +0+021c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*21c: R_MIPS_GOT16 .data +0+0220 <[^>]*> lui \$at,0x1 +0+0224 <[^>]*> addiu \$at,\$at,0 +[ ]*224: R_MIPS_LO16 .data +0+0228 <[^>]*> addu \$a0,\$a0,\$at +0+022c <[^>]*> lui \$a0,0x0 +[ ]*22c: R_MIPS_GOT_HI16 big_external_data_label +0+0230 <[^>]*> addu \$a0,\$a0,\$gp +0+0234 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*234: R_MIPS_GOT_LO16 big_external_data_label +0+0238 <[^>]*> lui \$at,0x1 +0+023c <[^>]*> addiu \$at,\$at,0 +0+0240 <[^>]*> addu \$a0,\$a0,\$at +0+0244 <[^>]*> lui \$a0,0x0 +[ ]*244: R_MIPS_GOT_HI16 small_external_data_label +0+0248 <[^>]*> addu \$a0,\$a0,\$gp +0+024c <[^>]*> lw \$a0,0\(\$a0\) +[ ]*24c: R_MIPS_GOT_LO16 small_external_data_label +0+0250 <[^>]*> lui \$at,0x1 +0+0254 <[^>]*> addiu \$at,\$at,0 +0+0258 <[^>]*> addu \$a0,\$a0,\$at +0+025c <[^>]*> lui \$a0,0x0 +[ ]*25c: R_MIPS_GOT_HI16 big_external_common +0+0260 <[^>]*> addu \$a0,\$a0,\$gp +0+0264 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*264: R_MIPS_GOT_LO16 big_external_common +0+0268 <[^>]*> lui \$at,0x1 +0+026c <[^>]*> addiu \$at,\$at,0 +0+0270 <[^>]*> addu \$a0,\$a0,\$at +0+0274 <[^>]*> lui \$a0,0x0 +[ ]*274: R_MIPS_GOT_HI16 small_external_common +0+0278 <[^>]*> addu \$a0,\$a0,\$gp +0+027c <[^>]*> lw \$a0,0\(\$a0\) +[ ]*27c: R_MIPS_GOT_LO16 small_external_common +0+0280 <[^>]*> lui \$at,0x1 +0+0284 <[^>]*> addiu \$at,\$at,0 +0+0288 <[^>]*> addu \$a0,\$a0,\$at +0+028c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*28c: R_MIPS_GOT16 .bss +0+0290 <[^>]*> lui \$at,0x1 +0+0294 <[^>]*> addiu \$at,\$at,0 +[ ]*294: R_MIPS_LO16 .bss +0+0298 <[^>]*> addu \$a0,\$a0,\$at +0+029c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*29c: R_MIPS_GOT16 .bss +0+02a0 <[^>]*> lui \$at,0x1 +0+02a4 <[^>]*> addiu \$at,\$at,1000 +[ ]*2a4: R_MIPS_LO16 .bss +0+02a8 <[^>]*> addu \$a0,\$a0,\$at +0+02ac <[^>]*> lw \$a0,0\(\$gp\) +[ ]*2ac: R_MIPS_GOT16 .data +0+02b0 <[^>]*> lui \$at,0x2 +0+02b4 <[^>]*> addiu \$at,\$at,-23131 +[ ]*2b4: R_MIPS_LO16 .data +0+02b8 <[^>]*> addu \$a0,\$a0,\$at +0+02bc <[^>]*> lui \$a0,0x0 +[ ]*2bc: R_MIPS_GOT_HI16 big_external_data_label +0+02c0 <[^>]*> addu \$a0,\$a0,\$gp +0+02c4 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*2c4: R_MIPS_GOT_LO16 big_external_data_label +0+02c8 <[^>]*> lui \$at,0x2 +0+02cc <[^>]*> addiu \$at,\$at,-23131 +0+02d0 <[^>]*> addu \$a0,\$a0,\$at +0+02d4 <[^>]*> lui \$a0,0x0 +[ ]*2d4: R_MIPS_GOT_HI16 small_external_data_label +0+02d8 <[^>]*> addu \$a0,\$a0,\$gp +0+02dc <[^>]*> lw \$a0,0\(\$a0\) +[ ]*2dc: R_MIPS_GOT_LO16 small_external_data_label +0+02e0 <[^>]*> lui \$at,0x2 +0+02e4 <[^>]*> addiu \$at,\$at,-23131 +0+02e8 <[^>]*> addu \$a0,\$a0,\$at +0+02ec <[^>]*> lui \$a0,0x0 +[ ]*2ec: R_MIPS_GOT_HI16 big_external_common +0+02f0 <[^>]*> addu \$a0,\$a0,\$gp +0+02f4 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*2f4: R_MIPS_GOT_LO16 big_external_common +0+02f8 <[^>]*> lui \$at,0x2 +0+02fc <[^>]*> addiu \$at,\$at,-23131 +0+0300 <[^>]*> addu \$a0,\$a0,\$at +0+0304 <[^>]*> lui \$a0,0x0 +[ ]*304: R_MIPS_GOT_HI16 small_external_common +0+0308 <[^>]*> addu \$a0,\$a0,\$gp +0+030c <[^>]*> lw \$a0,0\(\$a0\) +[ ]*30c: R_MIPS_GOT_LO16 small_external_common +0+0310 <[^>]*> lui \$at,0x2 +0+0314 <[^>]*> addiu \$at,\$at,-23131 +0+0318 <[^>]*> addu \$a0,\$a0,\$at +0+031c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*31c: R_MIPS_GOT16 .bss +0+0320 <[^>]*> lui \$at,0x2 +0+0324 <[^>]*> addiu \$at,\$at,-23131 +[ ]*324: R_MIPS_LO16 .bss +0+0328 <[^>]*> addu \$a0,\$a0,\$at +0+032c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*32c: R_MIPS_GOT16 .bss +0+0330 <[^>]*> lui \$at,0x2 +0+0334 <[^>]*> addiu \$at,\$at,-22131 +[ ]*334: R_MIPS_LO16 .bss +0+0338 <[^>]*> addu \$a0,\$a0,\$at +0+033c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*33c: R_MIPS_GOT16 .data +0+0340 <[^>]*> nop +0+0344 <[^>]*> addiu \$a0,\$a0,0 +[ ]*344: R_MIPS_LO16 .data +0+0348 <[^>]*> addu \$a0,\$a0,\$a1 +0+034c <[^>]*> lui \$a0,0x0 +[ ]*34c: R_MIPS_GOT_HI16 big_external_data_label +0+0350 <[^>]*> addu \$a0,\$a0,\$gp +0+0354 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*354: R_MIPS_GOT_LO16 big_external_data_label +0+0358 <[^>]*> nop +0+035c <[^>]*> addu \$a0,\$a0,\$a1 +0+0360 <[^>]*> lui \$a0,0x0 +[ ]*360: R_MIPS_GOT_HI16 small_external_data_label +0+0364 <[^>]*> addu \$a0,\$a0,\$gp +0+0368 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*368: R_MIPS_GOT_LO16 small_external_data_label +0+036c <[^>]*> nop +0+0370 <[^>]*> addu \$a0,\$a0,\$a1 +0+0374 <[^>]*> lui \$a0,0x0 +[ ]*374: R_MIPS_GOT_HI16 big_external_common +0+0378 <[^>]*> addu \$a0,\$a0,\$gp +0+037c <[^>]*> lw \$a0,0\(\$a0\) +[ ]*37c: R_MIPS_GOT_LO16 big_external_common +0+0380 <[^>]*> nop +0+0384 <[^>]*> addu \$a0,\$a0,\$a1 +0+0388 <[^>]*> lui \$a0,0x0 +[ ]*388: R_MIPS_GOT_HI16 small_external_common +0+038c <[^>]*> addu \$a0,\$a0,\$gp +0+0390 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*390: R_MIPS_GOT_LO16 small_external_common +0+0394 <[^>]*> nop +0+0398 <[^>]*> addu \$a0,\$a0,\$a1 +0+039c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*39c: R_MIPS_GOT16 .bss +0+03a0 <[^>]*> nop +0+03a4 <[^>]*> addiu \$a0,\$a0,0 +[ ]*3a4: R_MIPS_LO16 .bss +0+03a8 <[^>]*> addu \$a0,\$a0,\$a1 +0+03ac <[^>]*> lw \$a0,0\(\$gp\) +[ ]*3ac: R_MIPS_GOT16 .bss +0+03b0 <[^>]*> nop +0+03b4 <[^>]*> addiu \$a0,\$a0,1000 +[ ]*3b4: R_MIPS_LO16 .bss +0+03b8 <[^>]*> addu \$a0,\$a0,\$a1 +0+03bc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*3bc: R_MIPS_GOT16 .data +0+03c0 <[^>]*> nop +0+03c4 <[^>]*> addiu \$a0,\$a0,1 +[ ]*3c4: R_MIPS_LO16 .data +0+03c8 <[^>]*> addu \$a0,\$a0,\$a1 +0+03cc <[^>]*> lui \$a0,0x0 +[ ]*3cc: R_MIPS_GOT_HI16 big_external_data_label +0+03d0 <[^>]*> addu \$a0,\$a0,\$gp +0+03d4 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*3d4: R_MIPS_GOT_LO16 big_external_data_label +0+03d8 <[^>]*> nop +0+03dc <[^>]*> addiu \$a0,\$a0,1 +0+03e0 <[^>]*> addu \$a0,\$a0,\$a1 +0+03e4 <[^>]*> lui \$a0,0x0 +[ ]*3e4: R_MIPS_GOT_HI16 small_external_data_label +0+03e8 <[^>]*> addu \$a0,\$a0,\$gp +0+03ec <[^>]*> lw \$a0,0\(\$a0\) +[ ]*3ec: R_MIPS_GOT_LO16 small_external_data_label +0+03f0 <[^>]*> nop +0+03f4 <[^>]*> addiu \$a0,\$a0,1 +0+03f8 <[^>]*> addu \$a0,\$a0,\$a1 +0+03fc <[^>]*> lui \$a0,0x0 +[ ]*3fc: R_MIPS_GOT_HI16 big_external_common +0+0400 <[^>]*> addu \$a0,\$a0,\$gp +0+0404 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*404: R_MIPS_GOT_LO16 big_external_common +0+0408 <[^>]*> nop +0+040c <[^>]*> addiu \$a0,\$a0,1 +0+0410 <[^>]*> addu \$a0,\$a0,\$a1 +0+0414 <[^>]*> lui \$a0,0x0 +[ ]*414: R_MIPS_GOT_HI16 small_external_common +0+0418 <[^>]*> addu \$a0,\$a0,\$gp +0+041c <[^>]*> lw \$a0,0\(\$a0\) +[ ]*41c: R_MIPS_GOT_LO16 small_external_common +0+0420 <[^>]*> nop +0+0424 <[^>]*> addiu \$a0,\$a0,1 +0+0428 <[^>]*> addu \$a0,\$a0,\$a1 +0+042c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*42c: R_MIPS_GOT16 .bss +0+0430 <[^>]*> nop +0+0434 <[^>]*> addiu \$a0,\$a0,1 +[ ]*434: R_MIPS_LO16 .bss +0+0438 <[^>]*> addu \$a0,\$a0,\$a1 +0+043c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*43c: R_MIPS_GOT16 .bss +0+0440 <[^>]*> nop +0+0444 <[^>]*> addiu \$a0,\$a0,1001 +[ ]*444: R_MIPS_LO16 .bss +0+0448 <[^>]*> addu \$a0,\$a0,\$a1 +0+044c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*44c: R_MIPS_GOT16 .data +0+0450 <[^>]*> lui \$at,0x1 +0+0454 <[^>]*> addiu \$at,\$at,-32768 +[ ]*454: R_MIPS_LO16 .data +0+0458 <[^>]*> addu \$a0,\$a0,\$at +0+045c <[^>]*> addu \$a0,\$a0,\$a1 +0+0460 <[^>]*> lui \$a0,0x0 +[ ]*460: R_MIPS_GOT_HI16 big_external_data_label +0+0464 <[^>]*> addu \$a0,\$a0,\$gp +0+0468 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*468: R_MIPS_GOT_LO16 big_external_data_label +0+046c <[^>]*> lui \$at,0x1 +0+0470 <[^>]*> addiu \$at,\$at,-32768 +0+0474 <[^>]*> addu \$a0,\$a0,\$at +0+0478 <[^>]*> addu \$a0,\$a0,\$a1 +0+047c <[^>]*> lui \$a0,0x0 +[ ]*47c: R_MIPS_GOT_HI16 small_external_data_label +0+0480 <[^>]*> addu \$a0,\$a0,\$gp +0+0484 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*484: R_MIPS_GOT_LO16 small_external_data_label +0+0488 <[^>]*> lui \$at,0x1 +0+048c <[^>]*> addiu \$at,\$at,-32768 +0+0490 <[^>]*> addu \$a0,\$a0,\$at +0+0494 <[^>]*> addu \$a0,\$a0,\$a1 +0+0498 <[^>]*> lui \$a0,0x0 +[ ]*498: R_MIPS_GOT_HI16 big_external_common +0+049c <[^>]*> addu \$a0,\$a0,\$gp +0+04a0 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*4a0: R_MIPS_GOT_LO16 big_external_common +0+04a4 <[^>]*> lui \$at,0x1 +0+04a8 <[^>]*> addiu \$at,\$at,-32768 +0+04ac <[^>]*> addu \$a0,\$a0,\$at +0+04b0 <[^>]*> addu \$a0,\$a0,\$a1 +0+04b4 <[^>]*> lui \$a0,0x0 +[ ]*4b4: R_MIPS_GOT_HI16 small_external_common +0+04b8 <[^>]*> addu \$a0,\$a0,\$gp +0+04bc <[^>]*> lw \$a0,0\(\$a0\) +[ ]*4bc: R_MIPS_GOT_LO16 small_external_common +0+04c0 <[^>]*> lui \$at,0x1 +0+04c4 <[^>]*> addiu \$at,\$at,-32768 +0+04c8 <[^>]*> addu \$a0,\$a0,\$at +0+04cc <[^>]*> addu \$a0,\$a0,\$a1 +0+04d0 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*4d0: R_MIPS_GOT16 .bss +0+04d4 <[^>]*> lui \$at,0x1 +0+04d8 <[^>]*> addiu \$at,\$at,-32768 +[ ]*4d8: R_MIPS_LO16 .bss +0+04dc <[^>]*> addu \$a0,\$a0,\$at +0+04e0 <[^>]*> addu \$a0,\$a0,\$a1 +0+04e4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*4e4: R_MIPS_GOT16 .bss +0+04e8 <[^>]*> lui \$at,0x1 +0+04ec <[^>]*> addiu \$at,\$at,-31768 +[ ]*4ec: R_MIPS_LO16 .bss +0+04f0 <[^>]*> addu \$a0,\$a0,\$at +0+04f4 <[^>]*> addu \$a0,\$a0,\$a1 +0+04f8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*4f8: R_MIPS_GOT16 .data +0+04fc <[^>]*> nop +0+0500 <[^>]*> addiu \$a0,\$a0,-32768 +[ ]*500: R_MIPS_LO16 .data +0+0504 <[^>]*> addu \$a0,\$a0,\$a1 +0+0508 <[^>]*> lui \$a0,0x0 +[ ]*508: R_MIPS_GOT_HI16 big_external_data_label +0+050c <[^>]*> addu \$a0,\$a0,\$gp +0+0510 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*510: R_MIPS_GOT_LO16 big_external_data_label +0+0514 <[^>]*> nop +0+0518 <[^>]*> addiu \$a0,\$a0,-32768 +0+051c <[^>]*> addu \$a0,\$a0,\$a1 +0+0520 <[^>]*> lui \$a0,0x0 +[ ]*520: R_MIPS_GOT_HI16 small_external_data_label +0+0524 <[^>]*> addu \$a0,\$a0,\$gp +0+0528 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*528: R_MIPS_GOT_LO16 small_external_data_label +0+052c <[^>]*> nop +0+0530 <[^>]*> addiu \$a0,\$a0,-32768 +0+0534 <[^>]*> addu \$a0,\$a0,\$a1 +0+0538 <[^>]*> lui \$a0,0x0 +[ ]*538: R_MIPS_GOT_HI16 big_external_common +0+053c <[^>]*> addu \$a0,\$a0,\$gp +0+0540 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*540: R_MIPS_GOT_LO16 big_external_common +0+0544 <[^>]*> nop +0+0548 <[^>]*> addiu \$a0,\$a0,-32768 +0+054c <[^>]*> addu \$a0,\$a0,\$a1 +0+0550 <[^>]*> lui \$a0,0x0 +[ ]*550: R_MIPS_GOT_HI16 small_external_common +0+0554 <[^>]*> addu \$a0,\$a0,\$gp +0+0558 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*558: R_MIPS_GOT_LO16 small_external_common +0+055c <[^>]*> nop +0+0560 <[^>]*> addiu \$a0,\$a0,-32768 +0+0564 <[^>]*> addu \$a0,\$a0,\$a1 +0+0568 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*568: R_MIPS_GOT16 .bss +0+056c <[^>]*> nop +0+0570 <[^>]*> addiu \$a0,\$a0,-32768 +[ ]*570: R_MIPS_LO16 .bss +0+0574 <[^>]*> addu \$a0,\$a0,\$a1 +0+0578 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*578: R_MIPS_GOT16 .bss +0+057c <[^>]*> nop +0+0580 <[^>]*> addiu \$a0,\$a0,-31768 +[ ]*580: R_MIPS_LO16 .bss +0+0584 <[^>]*> addu \$a0,\$a0,\$a1 +0+0588 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*588: R_MIPS_GOT16 .data +0+058c <[^>]*> lui \$at,0x1 +0+0590 <[^>]*> addiu \$at,\$at,0 +[ ]*590: R_MIPS_LO16 .data +0+0594 <[^>]*> addu \$a0,\$a0,\$at +0+0598 <[^>]*> addu \$a0,\$a0,\$a1 +0+059c <[^>]*> lui \$a0,0x0 +[ ]*59c: R_MIPS_GOT_HI16 big_external_data_label +0+05a0 <[^>]*> addu \$a0,\$a0,\$gp +0+05a4 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*5a4: R_MIPS_GOT_LO16 big_external_data_label +0+05a8 <[^>]*> lui \$at,0x1 +0+05ac <[^>]*> addiu \$at,\$at,0 +0+05b0 <[^>]*> addu \$a0,\$a0,\$at +0+05b4 <[^>]*> addu \$a0,\$a0,\$a1 +0+05b8 <[^>]*> lui \$a0,0x0 +[ ]*5b8: R_MIPS_GOT_HI16 small_external_data_label +0+05bc <[^>]*> addu \$a0,\$a0,\$gp +0+05c0 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*5c0: R_MIPS_GOT_LO16 small_external_data_label +0+05c4 <[^>]*> lui \$at,0x1 +0+05c8 <[^>]*> addiu \$at,\$at,0 +0+05cc <[^>]*> addu \$a0,\$a0,\$at +0+05d0 <[^>]*> addu \$a0,\$a0,\$a1 +0+05d4 <[^>]*> lui \$a0,0x0 +[ ]*5d4: R_MIPS_GOT_HI16 big_external_common +0+05d8 <[^>]*> addu \$a0,\$a0,\$gp +0+05dc <[^>]*> lw \$a0,0\(\$a0\) +[ ]*5dc: R_MIPS_GOT_LO16 big_external_common +0+05e0 <[^>]*> lui \$at,0x1 +0+05e4 <[^>]*> addiu \$at,\$at,0 +0+05e8 <[^>]*> addu \$a0,\$a0,\$at +0+05ec <[^>]*> addu \$a0,\$a0,\$a1 +0+05f0 <[^>]*> lui \$a0,0x0 +[ ]*5f0: R_MIPS_GOT_HI16 small_external_common +0+05f4 <[^>]*> addu \$a0,\$a0,\$gp +0+05f8 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*5f8: R_MIPS_GOT_LO16 small_external_common +0+05fc <[^>]*> lui \$at,0x1 +0+0600 <[^>]*> addiu \$at,\$at,0 +0+0604 <[^>]*> addu \$a0,\$a0,\$at +0+0608 <[^>]*> addu \$a0,\$a0,\$a1 +0+060c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*60c: R_MIPS_GOT16 .bss +0+0610 <[^>]*> lui \$at,0x1 +0+0614 <[^>]*> addiu \$at,\$at,0 +[ ]*614: R_MIPS_LO16 .bss +0+0618 <[^>]*> addu \$a0,\$a0,\$at +0+061c <[^>]*> addu \$a0,\$a0,\$a1 +0+0620 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*620: R_MIPS_GOT16 .bss +0+0624 <[^>]*> lui \$at,0x1 +0+0628 <[^>]*> addiu \$at,\$at,1000 +[ ]*628: R_MIPS_LO16 .bss +0+062c <[^>]*> addu \$a0,\$a0,\$at +0+0630 <[^>]*> addu \$a0,\$a0,\$a1 +0+0634 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*634: R_MIPS_GOT16 .data +0+0638 <[^>]*> lui \$at,0x2 +0+063c <[^>]*> addiu \$at,\$at,-23131 +[ ]*63c: R_MIPS_LO16 .data +0+0640 <[^>]*> addu \$a0,\$a0,\$at +0+0644 <[^>]*> addu \$a0,\$a0,\$a1 +0+0648 <[^>]*> lui \$a0,0x0 +[ ]*648: R_MIPS_GOT_HI16 big_external_data_label +0+064c <[^>]*> addu \$a0,\$a0,\$gp +0+0650 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*650: R_MIPS_GOT_LO16 big_external_data_label +0+0654 <[^>]*> lui \$at,0x2 +0+0658 <[^>]*> addiu \$at,\$at,-23131 +0+065c <[^>]*> addu \$a0,\$a0,\$at +0+0660 <[^>]*> addu \$a0,\$a0,\$a1 +0+0664 <[^>]*> lui \$a0,0x0 +[ ]*664: R_MIPS_GOT_HI16 small_external_data_label +0+0668 <[^>]*> addu \$a0,\$a0,\$gp +0+066c <[^>]*> lw \$a0,0\(\$a0\) +[ ]*66c: R_MIPS_GOT_LO16 small_external_data_label +0+0670 <[^>]*> lui \$at,0x2 +0+0674 <[^>]*> addiu \$at,\$at,-23131 +0+0678 <[^>]*> addu \$a0,\$a0,\$at +0+067c <[^>]*> addu \$a0,\$a0,\$a1 +0+0680 <[^>]*> lui \$a0,0x0 +[ ]*680: R_MIPS_GOT_HI16 big_external_common +0+0684 <[^>]*> addu \$a0,\$a0,\$gp +0+0688 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*688: R_MIPS_GOT_LO16 big_external_common +0+068c <[^>]*> lui \$at,0x2 +0+0690 <[^>]*> addiu \$at,\$at,-23131 +0+0694 <[^>]*> addu \$a0,\$a0,\$at +0+0698 <[^>]*> addu \$a0,\$a0,\$a1 +0+069c <[^>]*> lui \$a0,0x0 +[ ]*69c: R_MIPS_GOT_HI16 small_external_common +0+06a0 <[^>]*> addu \$a0,\$a0,\$gp +0+06a4 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*6a4: R_MIPS_GOT_LO16 small_external_common +0+06a8 <[^>]*> lui \$at,0x2 +0+06ac <[^>]*> addiu \$at,\$at,-23131 +0+06b0 <[^>]*> addu \$a0,\$a0,\$at +0+06b4 <[^>]*> addu \$a0,\$a0,\$a1 +0+06b8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*6b8: R_MIPS_GOT16 .bss +0+06bc <[^>]*> lui \$at,0x2 +0+06c0 <[^>]*> addiu \$at,\$at,-23131 +[ ]*6c0: R_MIPS_LO16 .bss +0+06c4 <[^>]*> addu \$a0,\$a0,\$at +0+06c8 <[^>]*> addu \$a0,\$a0,\$a1 +0+06cc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*6cc: R_MIPS_GOT16 .bss +0+06d0 <[^>]*> lui \$at,0x2 +0+06d4 <[^>]*> addiu \$at,\$at,-22131 +[ ]*6d4: R_MIPS_LO16 .bss +0+06d8 <[^>]*> addu \$a0,\$a0,\$at +0+06dc <[^>]*> addu \$a0,\$a0,\$a1 diff -urN binutils-2.7/gas/testsuite/gas/mips/la.d binutils-2.8/gas/testsuite/gas/mips/la.d --- binutils-2.7/gas/testsuite/gas/mips/la.d Thu Jul 4 12:15:56 1996 +++ binutils-2.8/gas/testsuite/gas/mips/la.d Wed Apr 30 12:54:30 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS la #as: -mips1 @@ -7,378 +7,378 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> li \$a0,0 -0+0004 <[^>]*> li \$a0,1 -0+0008 <[^>]*> li \$a0,0x8000 -0+000c <[^>]*> li \$a0,-32768 -0+0010 <[^>]*> lui \$a0,0x1 -0+0014 <[^>]*> lui \$a0,0x1 -0+0018 <[^>]*> ori \$a0,\$a0,0xa5a5 -0+001c <[^>]*> li \$a0,0 -0+0020 <[^>]*> addu \$a0,\$a0,\$a1 -0+0024 <[^>]*> li \$a0,1 -0+0028 <[^>]*> addu \$a0,\$a0,\$a1 -0+002c <[^>]*> li \$a0,0x8000 -0+0030 <[^>]*> addu \$a0,\$a0,\$a1 -0+0034 <[^>]*> li \$a0,-32768 -0+0038 <[^>]*> addu \$a0,\$a0,\$a1 -0+003c <[^>]*> lui \$a0,0x1 -0+0040 <[^>]*> addu \$a0,\$a0,\$a1 -0+0044 <[^>]*> lui \$a0,0x1 -0+0048 <[^>]*> ori \$a0,\$a0,0xa5a5 -0+004c <[^>]*> addu \$a0,\$a0,\$a1 -0+0050 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0050 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0054 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0054 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0058 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0058 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+005c <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+005c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0060 <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+0060 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0064 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0064 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0068 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0068 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+006c <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+006c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0070 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0070 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0074 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0074 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0078 <[^>]*> addiu \$a0,\$gp,[-0-9]+ -[ ]*RELOC: 0+0078 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+007c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+007c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0080 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0080 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0084 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0084 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0088 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0088 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+008c <[^>]*> addiu \$a0,\$gp,[-0-9]+ -[ ]*RELOC: 0+008c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0090 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0090 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0094 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0094 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0098 <[^>]*> addiu \$a0,\$gp,[-0-9]+ -[ ]*RELOC: 0+0098 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+009c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+009c [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+00a0 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00a0 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00a4 <[^>]*> addiu \$a0,\$gp,[-0-9]+ -[ ]*RELOC: 0+00a4 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00a8 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00a8 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00ac <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00ac [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00b0 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00b0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00b4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00b4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00b8 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00b8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+00bc <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00bc [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+00c0 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00c0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00c4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00c4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+00c8 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00c8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+00cc <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00cc [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+00d0 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00d0 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+00d4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00d4 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00d8 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00d8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+00dc <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00dc [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+00e0 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00e0 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00e4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00e4 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00e8 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00e8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00ec <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00ec [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00f0 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00f0 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+00f4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00f4 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+00f8 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00f8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00fc <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+00fc [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0100 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0100 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0104 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0104 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0108 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0108 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+010c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+010c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0110 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0110 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0114 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0114 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0118 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0118 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+011c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+011c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0120 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0120 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0124 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0124 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0128 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0128 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+012c <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+012c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0130 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0130 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0134 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0134 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0138 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0138 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+013c <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+013c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0140 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0140 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0144 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0144 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0148 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0148 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+014c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+014c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0150 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0150 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0154 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0154 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0158 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0158 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+015c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+015c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0160 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0160 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0164 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0164 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0168 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0168 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+016c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+016c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0170 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0170 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0174 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0174 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0178 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0178 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+017c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+017c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0180 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0180 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0184 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0184 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0188 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0188 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+018c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+018c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0190 <[^>]*> addu \$a0,\$a0,\$a1 -0+0194 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0194 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0198 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0198 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+019c <[^>]*> addu \$a0,\$a0,\$a1 -0+01a0 <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+01a0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+01a4 <[^>]*> addu \$a0,\$a0,\$a1 -0+01a8 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01a8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01ac <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+01ac [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01b0 <[^>]*> addu \$a0,\$a0,\$a1 -0+01b4 <[^>]*> addiu \$a0,\$gp,0 -[ ]*RELOC: 0+01b4 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+01b8 <[^>]*> addu \$a0,\$a0,\$a1 -0+01bc <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01bc [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+01c0 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+01c0 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+01c4 <[^>]*> addu \$a0,\$a0,\$a1 -0+01c8 <[^>]*> addiu \$a0,\$gp,[-0-9]+ -[ ]*RELOC: 0+01c8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+01cc <[^>]*> addu \$a0,\$a0,\$a1 -0+01d0 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01d0 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+01d4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+01d4 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+01d8 <[^>]*> addu \$a0,\$a0,\$a1 -0+01dc <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01dc [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+01e0 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+01e0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01e4 <[^>]*> addu \$a0,\$a0,\$a1 -0+01e8 <[^>]*> addiu \$a0,\$gp,[-0-9]+ -[ ]*RELOC: 0+01e8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+01ec <[^>]*> addu \$a0,\$a0,\$a1 -0+01f0 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01f0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01f4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+01f4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01f8 <[^>]*> addu \$a0,\$a0,\$a1 -0+01fc <[^>]*> addiu \$a0,\$gp,[-0-9]+ -[ ]*RELOC: 0+01fc [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0200 <[^>]*> addu \$a0,\$a0,\$a1 -0+0204 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0204 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0208 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0208 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+020c <[^>]*> addu \$a0,\$a0,\$a1 -0+0210 <[^>]*> addiu \$a0,\$gp,[-0-9]+ -[ ]*RELOC: 0+0210 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0214 <[^>]*> addu \$a0,\$a0,\$a1 -0+0218 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0218 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+021c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+021c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0220 <[^>]*> addu \$a0,\$a0,\$a1 -0+0224 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0224 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0228 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0228 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+022c <[^>]*> addu \$a0,\$a0,\$a1 -0+0230 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0230 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0234 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0234 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0238 <[^>]*> addu \$a0,\$a0,\$a1 -0+023c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+023c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0240 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0240 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0244 <[^>]*> addu \$a0,\$a0,\$a1 -0+0248 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0248 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+024c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+024c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0250 <[^>]*> addu \$a0,\$a0,\$a1 -0+0254 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0254 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0258 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0258 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+025c <[^>]*> addu \$a0,\$a0,\$a1 -0+0260 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0260 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0264 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0264 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0268 <[^>]*> addu \$a0,\$a0,\$a1 -0+026c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+026c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0270 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0270 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0274 <[^>]*> addu \$a0,\$a0,\$a1 -0+0278 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0278 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+027c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+027c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0280 <[^>]*> addu \$a0,\$a0,\$a1 -0+0284 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0284 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0288 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0288 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+028c <[^>]*> addu \$a0,\$a0,\$a1 -0+0290 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0290 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0294 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0294 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0298 <[^>]*> addu \$a0,\$a0,\$a1 -0+029c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+029c [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02a0 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+02a0 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+02a4 <[^>]*> addu \$a0,\$a0,\$a1 -0+02a8 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+02a8 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02ac <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+02ac [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+02b0 <[^>]*> addu \$a0,\$a0,\$a1 -0+02b4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+02b4 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+02b8 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+02b8 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+02bc <[^>]*> addu \$a0,\$a0,\$a1 -0+02c0 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+02c0 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+02c4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+02c4 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+02c8 <[^>]*> addu \$a0,\$a0,\$a1 -0+02cc <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+02cc [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+02d0 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+02d0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+02d4 <[^>]*> addu \$a0,\$a0,\$a1 -0+02d8 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+02d8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+02dc <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+02dc [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+02e0 <[^>]*> addu \$a0,\$a0,\$a1 -0+02e4 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+02e4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+02e8 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+02e8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02ec <[^>]*> addu \$a0,\$a0,\$a1 -0+02f0 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+02f0 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02f4 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+02f4 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+02f8 <[^>]*> addu \$a0,\$a0,\$a1 -0+02fc <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+02fc [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0300 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0300 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0304 <[^>]*> addu \$a0,\$a0,\$a1 -0+0308 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0308 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+030c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+030c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0310 <[^>]*> addu \$a0,\$a0,\$a1 -0+0314 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0314 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0318 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0318 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+031c <[^>]*> addu \$a0,\$a0,\$a1 -0+0320 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0320 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0324 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0324 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0328 <[^>]*> addu \$a0,\$a0,\$a1 -0+032c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+032c [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0330 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0330 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0334 <[^>]*> addu \$a0,\$a0,\$a1 -0+0338 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0338 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+033c <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+033c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0340 <[^>]*> addu \$a0,\$a0,\$a1 -0+0344 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0344 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0348 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0348 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+034c <[^>]*> addu \$a0,\$a0,\$a1 -0+0350 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0350 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0354 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0354 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0358 <[^>]*> addu \$a0,\$a0,\$a1 -0+035c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+035c [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0360 <[^>]*> addiu \$a0,\$a0,[-0-9]+ -[ ]*RELOC: 0+0360 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0364 <[^>]*> addu \$a0,\$a0,\$a1 -... +0+0000 <[^>]*> li \$a0,0 +0+0004 <[^>]*> li \$a0,1 +0+0008 <[^>]*> li \$a0,0x8000 +0+000c <[^>]*> li \$a0,-32768 +0+0010 <[^>]*> lui \$a0,0x1 +0+0014 <[^>]*> lui \$a0,0x1 +0+0018 <[^>]*> ori \$a0,\$a0,0xa5a5 +0+001c <[^>]*> li \$a0,0 +0+0020 <[^>]*> addu \$a0,\$a0,\$a1 +0+0024 <[^>]*> li \$a0,1 +0+0028 <[^>]*> addu \$a0,\$a0,\$a1 +0+002c <[^>]*> li \$a0,0x8000 +0+0030 <[^>]*> addu \$a0,\$a0,\$a1 +0+0034 <[^>]*> li \$a0,-32768 +0+0038 <[^>]*> addu \$a0,\$a0,\$a1 +0+003c <[^>]*> lui \$a0,0x1 +0+0040 <[^>]*> addu \$a0,\$a0,\$a1 +0+0044 <[^>]*> lui \$a0,0x1 +0+0048 <[^>]*> ori \$a0,\$a0,0xa5a5 +0+004c <[^>]*> addu \$a0,\$a0,\$a1 +0+0050 <[^>]*> lui \$a0,0x0 +[ ]*50: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0054 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*54: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0058 <[^>]*> lui \$a0,0x0 +[ ]*58: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+005c <[^>]*> addiu \$a0,\$a0,0 +[ ]*5c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0060 <[^>]*> addiu \$a0,\$gp,0 +[ ]*60: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0064 <[^>]*> lui \$a0,0x0 +[ ]*64: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0068 <[^>]*> addiu \$a0,\$a0,0 +[ ]*68: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+006c <[^>]*> addiu \$a0,\$gp,0 +[ ]*6c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0070 <[^>]*> lui \$a0,0x0 +[ ]*70: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0074 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*74: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0078 <[^>]*> addiu \$a0,\$gp,[-0-9]+ +[ ]*78: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+007c <[^>]*> lui \$a0,0x0 +[ ]*7c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0080 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*80: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0084 <[^>]*> lui \$a0,0x0 +[ ]*84: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0088 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*88: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+008c <[^>]*> addiu \$a0,\$gp,[-0-9]+ +[ ]*8c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0090 <[^>]*> lui \$a0,0x0 +[ ]*90: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0094 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*94: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0098 <[^>]*> addiu \$a0,\$gp,[-0-9]+ +[ ]*98: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+009c <[^>]*> lui \$a0,0x0 +[ ]*9c: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+00a0 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*a0: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00a4 <[^>]*> addiu \$a0,\$gp,[-0-9]+ +[ ]*a4: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00a8 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*a8: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+00ac <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*ac: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00b0 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*b0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00b4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*b4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00b8 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*b8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+00bc <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*bc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+00c0 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*c0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00c4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*c4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+00c8 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*c8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+00cc <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*cc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+00d0 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*d0: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+00d4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*d4: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00d8 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*d8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+00dc <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*dc: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+00e0 <[^>]*> lui \$a0,0x0 +[ ]*e0: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+00e4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*e4: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00e8 <[^>]*> lui \$a0,0x0 +[ ]*e8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00ec <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*ec: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00f0 <[^>]*> lui \$a0,0x0 +[ ]*f0: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+00f4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*f4: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+00f8 <[^>]*> lui \$a0,0x0 +[ ]*f8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00fc <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*fc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0100 <[^>]*> lui \$a0,0x0 +[ ]*100: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0104 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*104: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0108 <[^>]*> lui \$a0,0x0 +[ ]*108: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+010c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*10c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0110 <[^>]*> lui \$a0,0x0 +[ ]*110: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0114 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*114: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0118 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*118: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+011c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*11c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0120 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*120: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0124 <[^>]*> addiu \$a0,\$a0,0 +[ ]*124: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0128 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*128: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+012c <[^>]*> addiu \$a0,\$a0,0 +[ ]*12c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0130 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*130: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0134 <[^>]*> addiu \$a0,\$a0,0 +[ ]*134: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0138 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*138: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+013c <[^>]*> addiu \$a0,\$a0,0 +[ ]*13c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0140 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*140: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0144 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*144: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0148 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*148: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+014c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*14c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0150 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*150: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0154 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*154: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0158 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*158: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+015c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*15c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0160 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*160: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0164 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*164: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0168 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*168: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+016c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*16c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0170 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*170: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0174 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*174: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0178 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*178: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+017c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*17c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0180 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*180: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0184 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*184: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0188 <[^>]*> lui \$a0,0x0 +[ ]*188: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+018c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*18c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0190 <[^>]*> addu \$a0,\$a0,\$a1 +0+0194 <[^>]*> lui \$a0,0x0 +[ ]*194: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0198 <[^>]*> addiu \$a0,\$a0,0 +[ ]*198: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+019c <[^>]*> addu \$a0,\$a0,\$a1 +0+01a0 <[^>]*> addiu \$a0,\$gp,0 +[ ]*1a0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+01a4 <[^>]*> addu \$a0,\$a0,\$a1 +0+01a8 <[^>]*> lui \$a0,0x0 +[ ]*1a8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01ac <[^>]*> addiu \$a0,\$a0,0 +[ ]*1ac: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01b0 <[^>]*> addu \$a0,\$a0,\$a1 +0+01b4 <[^>]*> addiu \$a0,\$gp,0 +[ ]*1b4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+01b8 <[^>]*> addu \$a0,\$a0,\$a1 +0+01bc <[^>]*> lui \$a0,0x0 +[ ]*1bc: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+01c0 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*1c0: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+01c4 <[^>]*> addu \$a0,\$a0,\$a1 +0+01c8 <[^>]*> addiu \$a0,\$gp,[-0-9]+ +[ ]*1c8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+01cc <[^>]*> addu \$a0,\$a0,\$a1 +0+01d0 <[^>]*> lui \$a0,0x0 +[ ]*1d0: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+01d4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*1d4: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+01d8 <[^>]*> addu \$a0,\$a0,\$a1 +0+01dc <[^>]*> lui \$a0,0x0 +[ ]*1dc: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+01e0 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*1e0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01e4 <[^>]*> addu \$a0,\$a0,\$a1 +0+01e8 <[^>]*> addiu \$a0,\$gp,[-0-9]+ +[ ]*1e8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+01ec <[^>]*> addu \$a0,\$a0,\$a1 +0+01f0 <[^>]*> lui \$a0,0x0 +[ ]*1f0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01f4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*1f4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01f8 <[^>]*> addu \$a0,\$a0,\$a1 +0+01fc <[^>]*> addiu \$a0,\$gp,[-0-9]+ +[ ]*1fc: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0200 <[^>]*> addu \$a0,\$a0,\$a1 +0+0204 <[^>]*> lui \$a0,0x0 +[ ]*204: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0208 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*208: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+020c <[^>]*> addu \$a0,\$a0,\$a1 +0+0210 <[^>]*> addiu \$a0,\$gp,[-0-9]+ +[ ]*210: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0214 <[^>]*> addu \$a0,\$a0,\$a1 +0+0218 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*218: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+021c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*21c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0220 <[^>]*> addu \$a0,\$a0,\$a1 +0+0224 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*224: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0228 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*228: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+022c <[^>]*> addu \$a0,\$a0,\$a1 +0+0230 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*230: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0234 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*234: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0238 <[^>]*> addu \$a0,\$a0,\$a1 +0+023c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*23c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0240 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*240: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0244 <[^>]*> addu \$a0,\$a0,\$a1 +0+0248 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*248: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+024c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*24c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0250 <[^>]*> addu \$a0,\$a0,\$a1 +0+0254 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*254: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0258 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*258: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+025c <[^>]*> addu \$a0,\$a0,\$a1 +0+0260 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*260: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0264 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*264: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0268 <[^>]*> addu \$a0,\$a0,\$a1 +0+026c <[^>]*> lui \$a0,0x0 +[ ]*26c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0270 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*270: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0274 <[^>]*> addu \$a0,\$a0,\$a1 +0+0278 <[^>]*> lui \$a0,0x0 +[ ]*278: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+027c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*27c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0280 <[^>]*> addu \$a0,\$a0,\$a1 +0+0284 <[^>]*> lui \$a0,0x0 +[ ]*284: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0288 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*288: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+028c <[^>]*> addu \$a0,\$a0,\$a1 +0+0290 <[^>]*> lui \$a0,0x0 +[ ]*290: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0294 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*294: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0298 <[^>]*> addu \$a0,\$a0,\$a1 +0+029c <[^>]*> lui \$a0,0x0 +[ ]*29c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02a0 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*2a0: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+02a4 <[^>]*> addu \$a0,\$a0,\$a1 +0+02a8 <[^>]*> lui \$a0,0x0 +[ ]*2a8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+02ac <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*2ac: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+02b0 <[^>]*> addu \$a0,\$a0,\$a1 +0+02b4 <[^>]*> lui \$a0,0x0 +[ ]*2b4: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+02b8 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*2b8: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+02bc <[^>]*> addu \$a0,\$a0,\$a1 +0+02c0 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*2c0: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+02c4 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*2c4: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+02c8 <[^>]*> addu \$a0,\$a0,\$a1 +0+02cc <[^>]*> lui \$a0,[-0-9x]+ +[ ]*2cc: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+02d0 <[^>]*> addiu \$a0,\$a0,0 +[ ]*2d0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+02d4 <[^>]*> addu \$a0,\$a0,\$a1 +0+02d8 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*2d8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+02dc <[^>]*> addiu \$a0,\$a0,0 +[ ]*2dc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+02e0 <[^>]*> addu \$a0,\$a0,\$a1 +0+02e4 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*2e4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+02e8 <[^>]*> addiu \$a0,\$a0,0 +[ ]*2e8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02ec <[^>]*> addu \$a0,\$a0,\$a1 +0+02f0 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*2f0: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02f4 <[^>]*> addiu \$a0,\$a0,0 +[ ]*2f4: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+02f8 <[^>]*> addu \$a0,\$a0,\$a1 +0+02fc <[^>]*> lui \$a0,[-0-9x]+ +[ ]*2fc: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0300 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*300: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0304 <[^>]*> addu \$a0,\$a0,\$a1 +0+0308 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*308: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+030c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*30c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0310 <[^>]*> addu \$a0,\$a0,\$a1 +0+0314 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*314: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0318 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*318: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+031c <[^>]*> addu \$a0,\$a0,\$a1 +0+0320 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*320: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0324 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*324: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0328 <[^>]*> addu \$a0,\$a0,\$a1 +0+032c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*32c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0330 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*330: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0334 <[^>]*> addu \$a0,\$a0,\$a1 +0+0338 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*338: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+033c <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*33c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0340 <[^>]*> addu \$a0,\$a0,\$a1 +0+0344 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*344: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0348 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*348: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+034c <[^>]*> addu \$a0,\$a0,\$a1 +0+0350 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*350: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0354 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*354: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0358 <[^>]*> addu \$a0,\$a0,\$a1 +0+035c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*35c: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0360 <[^>]*> addiu \$a0,\$a0,[-0-9]+ +[ ]*360: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0364 <[^>]*> addu \$a0,\$a0,\$a1 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/la.s binutils-2.8/gas/testsuite/gas/mips/la.s --- binutils-2.7/gas/testsuite/gas/mips/la.s Thu Jul 4 12:15:56 1996 +++ binutils-2.8/gas/testsuite/gas/mips/la.s Wed Apr 30 12:54:30 1997 @@ -106,3 +106,9 @@ la $4,small_external_common+0x1a5a5($5) la $4,big_local_common+0x1a5a5($5) la $4,small_local_common+0x1a5a5($5) + + .ifndef KPIC +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop + .endif diff -urN binutils-2.7/gas/testsuite/gas/mips/lb-empic.d binutils-2.8/gas/testsuite/gas/mips/lb-empic.d --- binutils-2.7/gas/testsuite/gas/mips/lb-empic.d Thu Jul 4 12:15:56 1996 +++ binutils-2.8/gas/testsuite/gas/mips/lb-empic.d Wed Apr 30 12:54:30 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS lb-empic #as: -mips1 -membedded-pic #source: lb-pic.s @@ -8,95 +8,95 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lb \$a0,0\(\$zero\) -0+0004 <[^>]*> lb \$a0,1\(\$zero\) -0+0008 <[^>]*> lui \$a0,0x1 -0+000c <[^>]*> lb \$a0,-32768\(\$a0\) -0+0010 <[^>]*> lb \$a0,-32768\(\$zero\) -0+0014 <[^>]*> lui \$a0,0x1 -0+0018 <[^>]*> lb \$a0,0\(\$a0\) -0+001c <[^>]*> lui \$a0,0x2 -0+0020 <[^>]*> lb \$a0,-23131\(\$a0\) -0+0024 <[^>]*> lb \$a0,0\(\$a1\) -0+0028 <[^>]*> lb \$a0,1\(\$a1\) -0+002c <[^>]*> lui \$a0,0x1 -0+0030 <[^>]*> addu \$a0,\$a0,\$a1 -0+0034 <[^>]*> lb \$a0,-32768\(\$a0\) -0+0038 <[^>]*> lb \$a0,-32768\(\$a1\) -0+003c <[^>]*> lui \$a0,0x1 -0+0040 <[^>]*> addu \$a0,\$a0,\$a1 -0+0044 <[^>]*> lb \$a0,0\(\$a0\) -0+0048 <[^>]*> lui \$a0,0x2 -0+004c <[^>]*> addu \$a0,\$a0,\$a1 -0+0050 <[^>]*> lb \$a0,-23131\(\$a0\) -0+0054 <[^>]*> lb \$a0,-16384\(\$gp\) -[ ]*RELOC: 0+0054 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+0058 <[^>]*> lb \$a0,0\(\$gp\) -[ ]*RELOC: 0+0058 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+005c <[^>]*> lb \$a0,0\(\$gp\) -[ ]*RELOC: 0+005c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0060 <[^>]*> lb \$a0,0\(\$gp\) -[ ]*RELOC: 0+0060 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+0064 <[^>]*> lb \$a0,0\(\$gp\) -[ ]*RELOC: 0+0064 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0068 <[^>]*> lb \$a0,-16384\(\$gp\) -[ ]*RELOC: 0+0068 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+006c <[^>]*> lb \$a0,-15384\(\$gp\) -[ ]*RELOC: 0+006c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0070 <[^>]*> lb \$a0,-16383\(\$gp\) -[ ]*RELOC: 0+0070 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+0074 <[^>]*> lb \$a0,1\(\$gp\) -[ ]*RELOC: 0+0074 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+0078 <[^>]*> lb \$a0,1\(\$gp\) -[ ]*RELOC: 0+0078 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+007c <[^>]*> lb \$a0,1\(\$gp\) -[ ]*RELOC: 0+007c [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+0080 <[^>]*> lb \$a0,1\(\$gp\) -[ ]*RELOC: 0+0080 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0084 <[^>]*> lb \$a0,-16383\(\$gp\) -[ ]*RELOC: 0+0084 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0088 <[^>]*> lb \$a0,-15383\(\$gp\) -[ ]*RELOC: 0+0088 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+008c <[^>]*> addu \$a0,\$a1,\$gp -0+0090 <[^>]*> lb \$a0,-16384\(\$a0\) -[ ]*RELOC: 0+0090 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+0094 <[^>]*> addu \$a0,\$a1,\$gp -0+0098 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+0098 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+009c <[^>]*> addu \$a0,\$a1,\$gp -0+00a0 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+00a0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00a4 <[^>]*> addu \$a0,\$a1,\$gp -0+00a8 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+00a8 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+00ac <[^>]*> addu \$a0,\$a1,\$gp -0+00b0 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+00b0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00b4 <[^>]*> addu \$a0,\$a1,\$gp -0+00b8 <[^>]*> lb \$a0,-16384\(\$a0\) -[ ]*RELOC: 0+00b8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00bc <[^>]*> addu \$a0,\$a1,\$gp -0+00c0 <[^>]*> lb \$a0,-15384\(\$a0\) -[ ]*RELOC: 0+00c0 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00c4 <[^>]*> addu \$a0,\$a1,\$gp -0+00c8 <[^>]*> lb \$a0,-16383\(\$a0\) -[ ]*RELOC: 0+00c8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+00cc <[^>]*> addu \$a0,\$a1,\$gp -0+00d0 <[^>]*> lb \$a0,1\(\$a0\) -[ ]*RELOC: 0+00d0 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+00d4 <[^>]*> addu \$a0,\$a1,\$gp -0+00d8 <[^>]*> lb \$a0,1\(\$a0\) -[ ]*RELOC: 0+00d8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00dc <[^>]*> addu \$a0,\$a1,\$gp -0+00e0 <[^>]*> lb \$a0,1\(\$a0\) -[ ]*RELOC: 0+00e0 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+00e4 <[^>]*> addu \$a0,\$a1,\$gp -0+00e8 <[^>]*> lb \$a0,1\(\$a0\) -[ ]*RELOC: 0+00e8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00ec <[^>]*> addu \$a0,\$a1,\$gp -0+00f0 <[^>]*> lb \$a0,-16383\(\$a0\) -[ ]*RELOC: 0+00f0 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00f4 <[^>]*> addu \$a0,\$a1,\$gp -0+00f8 <[^>]*> lb \$a0,-15383\(\$a0\) -[ ]*RELOC: 0+00f8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -... +0+0000 <[^>]*> lb \$a0,0\(\$zero\) +0+0004 <[^>]*> lb \$a0,1\(\$zero\) +0+0008 <[^>]*> lui \$a0,0x1 +0+000c <[^>]*> lb \$a0,-32768\(\$a0\) +0+0010 <[^>]*> lb \$a0,-32768\(\$zero\) +0+0014 <[^>]*> lui \$a0,0x1 +0+0018 <[^>]*> lb \$a0,0\(\$a0\) +0+001c <[^>]*> lui \$a0,0x2 +0+0020 <[^>]*> lb \$a0,-23131\(\$a0\) +0+0024 <[^>]*> lb \$a0,0\(\$a1\) +0+0028 <[^>]*> lb \$a0,1\(\$a1\) +0+002c <[^>]*> lui \$a0,0x1 +0+0030 <[^>]*> addu \$a0,\$a0,\$a1 +0+0034 <[^>]*> lb \$a0,-32768\(\$a0\) +0+0038 <[^>]*> lb \$a0,-32768\(\$a1\) +0+003c <[^>]*> lui \$a0,0x1 +0+0040 <[^>]*> addu \$a0,\$a0,\$a1 +0+0044 <[^>]*> lb \$a0,0\(\$a0\) +0+0048 <[^>]*> lui \$a0,0x2 +0+004c <[^>]*> addu \$a0,\$a0,\$a1 +0+0050 <[^>]*> lb \$a0,-23131\(\$a0\) +0+0054 <[^>]*> lb \$a0,-16384\(\$gp\) +[ ]*54: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+0058 <[^>]*> lb \$a0,0\(\$gp\) +[ ]*58: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+005c <[^>]*> lb \$a0,0\(\$gp\) +[ ]*5c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0060 <[^>]*> lb \$a0,0\(\$gp\) +[ ]*60: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+0064 <[^>]*> lb \$a0,0\(\$gp\) +[ ]*64: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0068 <[^>]*> lb \$a0,-16384\(\$gp\) +[ ]*68: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+006c <[^>]*> lb \$a0,-15384\(\$gp\) +[ ]*6c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0070 <[^>]*> lb \$a0,-16383\(\$gp\) +[ ]*70: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+0074 <[^>]*> lb \$a0,1\(\$gp\) +[ ]*74: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+0078 <[^>]*> lb \$a0,1\(\$gp\) +[ ]*78: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+007c <[^>]*> lb \$a0,1\(\$gp\) +[ ]*7c: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+0080 <[^>]*> lb \$a0,1\(\$gp\) +[ ]*80: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0084 <[^>]*> lb \$a0,-16383\(\$gp\) +[ ]*84: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0088 <[^>]*> lb \$a0,-15383\(\$gp\) +[ ]*88: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+008c <[^>]*> addu \$a0,\$a1,\$gp +0+0090 <[^>]*> lb \$a0,-16384\(\$a0\) +[ ]*90: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+0094 <[^>]*> addu \$a0,\$a1,\$gp +0+0098 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*98: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+009c <[^>]*> addu \$a0,\$a1,\$gp +0+00a0 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*a0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00a4 <[^>]*> addu \$a0,\$a1,\$gp +0+00a8 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+00ac <[^>]*> addu \$a0,\$a1,\$gp +0+00b0 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*b0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00b4 <[^>]*> addu \$a0,\$a1,\$gp +0+00b8 <[^>]*> lb \$a0,-16384\(\$a0\) +[ ]*b8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00bc <[^>]*> addu \$a0,\$a1,\$gp +0+00c0 <[^>]*> lb \$a0,-15384\(\$a0\) +[ ]*c0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00c4 <[^>]*> addu \$a0,\$a1,\$gp +0+00c8 <[^>]*> lb \$a0,-16383\(\$a0\) +[ ]*c8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+00cc <[^>]*> addu \$a0,\$a1,\$gp +0+00d0 <[^>]*> lb \$a0,1\(\$a0\) +[ ]*d0: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+00d4 <[^>]*> addu \$a0,\$a1,\$gp +0+00d8 <[^>]*> lb \$a0,1\(\$a0\) +[ ]*d8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00dc <[^>]*> addu \$a0,\$a1,\$gp +0+00e0 <[^>]*> lb \$a0,1\(\$a0\) +[ ]*e0: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+00e4 <[^>]*> addu \$a0,\$a1,\$gp +0+00e8 <[^>]*> lb \$a0,1\(\$a0\) +[ ]*e8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00ec <[^>]*> addu \$a0,\$a1,\$gp +0+00f0 <[^>]*> lb \$a0,-16383\(\$a0\) +[ ]*f0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00f4 <[^>]*> addu \$a0,\$a1,\$gp +0+00f8 <[^>]*> lb \$a0,-15383\(\$a0\) +[ ]*f8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00fc <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/lb-pic.s binutils-2.8/gas/testsuite/gas/mips/lb-pic.s --- binutils-2.7/gas/testsuite/gas/mips/lb-pic.s Thu Jul 4 12:15:56 1996 +++ binutils-2.8/gas/testsuite/gas/mips/lb-pic.s Wed Apr 30 12:54:30 1997 @@ -50,3 +50,6 @@ lb $4,small_external_common+1($5) lb $4,big_local_common+1($5) lb $4,small_local_common+1($5) + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/lb-svr4pic.d binutils-2.8/gas/testsuite/gas/mips/lb-svr4pic.d --- binutils-2.7/gas/testsuite/gas/mips/lb-svr4pic.d Thu Jul 4 12:15:56 1996 +++ binutils-2.8/gas/testsuite/gas/mips/lb-svr4pic.d Wed Apr 30 12:54:30 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS lb-svr4pic #as: -mips1 -KPIC #source: lb-pic.s @@ -8,175 +8,175 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lb \$a0,0\(\$zero\) -0+0004 <[^>]*> lb \$a0,1\(\$zero\) -0+0008 <[^>]*> lui \$a0,0x1 -0+000c <[^>]*> lb \$a0,-32768\(\$a0\) -0+0010 <[^>]*> lb \$a0,-32768\(\$zero\) -0+0014 <[^>]*> lui \$a0,0x1 -0+0018 <[^>]*> lb \$a0,0\(\$a0\) -0+001c <[^>]*> lui \$a0,0x2 -0+0020 <[^>]*> lb \$a0,-23131\(\$a0\) -0+0024 <[^>]*> lb \$a0,0\(\$a1\) -0+0028 <[^>]*> lb \$a0,1\(\$a1\) -0+002c <[^>]*> lui \$a0,0x1 -0+0030 <[^>]*> addu \$a0,\$a0,\$a1 -0+0034 <[^>]*> lb \$a0,-32768\(\$a0\) -0+0038 <[^>]*> lb \$a0,-32768\(\$a1\) -0+003c <[^>]*> lui \$a0,0x1 -0+0040 <[^>]*> addu \$a0,\$a0,\$a1 -0+0044 <[^>]*> lb \$a0,0\(\$a0\) -0+0048 <[^>]*> lui \$a0,0x2 -0+004c <[^>]*> addu \$a0,\$a0,\$a1 -0+0050 <[^>]*> lb \$a0,-23131\(\$a0\) -0+0054 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0054 R_MIPS_GOT16 .data -... -0+005c <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+005c R_MIPS_LO16 .data -0+0060 <[^>]*> lb \$a0,0\(\$a0\) -0+0064 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0064 R_MIPS_GOT16 big_external_data_label -... -0+006c <[^>]*> lb \$a0,0\(\$a0\) -0+0070 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0070 R_MIPS_GOT16 small_external_data_label -... -0+0078 <[^>]*> lb \$a0,0\(\$a0\) -0+007c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+007c R_MIPS_GOT16 big_external_common -... -0+0084 <[^>]*> lb \$a0,0\(\$a0\) -0+0088 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0088 R_MIPS_GOT16 small_external_common -... -0+0090 <[^>]*> lb \$a0,0\(\$a0\) -0+0094 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0094 R_MIPS_GOT16 .bss -... -0+009c <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+009c R_MIPS_LO16 .bss -0+00a0 <[^>]*> lb \$a0,0\(\$a0\) -0+00a4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00a4 R_MIPS_GOT16 .bss -... -0+00ac <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+00ac R_MIPS_LO16 .bss -0+00b0 <[^>]*> lb \$a0,0\(\$a0\) -0+00b4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00b4 R_MIPS_GOT16 .data -... -0+00bc <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+00bc R_MIPS_LO16 .data -0+00c0 <[^>]*> lb \$a0,1\(\$a0\) -0+00c4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00c4 R_MIPS_GOT16 big_external_data_label -... -0+00cc <[^>]*> lb \$a0,1\(\$a0\) -0+00d0 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00d0 R_MIPS_GOT16 small_external_data_label -... -0+00d8 <[^>]*> lb \$a0,1\(\$a0\) -0+00dc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00dc R_MIPS_GOT16 big_external_common -... -0+00e4 <[^>]*> lb \$a0,1\(\$a0\) -0+00e8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00e8 R_MIPS_GOT16 small_external_common -... -0+00f0 <[^>]*> lb \$a0,1\(\$a0\) -0+00f4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00f4 R_MIPS_GOT16 .bss -... -0+00fc <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+00fc R_MIPS_LO16 .bss -0+0100 <[^>]*> lb \$a0,1\(\$a0\) -0+0104 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0104 R_MIPS_GOT16 .bss -... -0+010c <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+010c R_MIPS_LO16 .bss -0+0110 <[^>]*> lb \$a0,1\(\$a0\) -0+0114 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0114 R_MIPS_GOT16 .data -... -0+011c <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+011c R_MIPS_LO16 .data -0+0120 <[^>]*> addu \$a0,\$a0,\$a1 -0+0124 <[^>]*> lb \$a0,0\(\$a0\) -0+0128 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0128 R_MIPS_GOT16 big_external_data_label -... -0+0130 <[^>]*> addu \$a0,\$a0,\$a1 -0+0134 <[^>]*> lb \$a0,0\(\$a0\) -0+0138 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0138 R_MIPS_GOT16 small_external_data_label -... -0+0140 <[^>]*> addu \$a0,\$a0,\$a1 -0+0144 <[^>]*> lb \$a0,0\(\$a0\) -0+0148 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0148 R_MIPS_GOT16 big_external_common -... -0+0150 <[^>]*> addu \$a0,\$a0,\$a1 -0+0154 <[^>]*> lb \$a0,0\(\$a0\) -0+0158 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0158 R_MIPS_GOT16 small_external_common -... -0+0160 <[^>]*> addu \$a0,\$a0,\$a1 -0+0164 <[^>]*> lb \$a0,0\(\$a0\) -0+0168 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0168 R_MIPS_GOT16 .bss -... -0+0170 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0170 R_MIPS_LO16 .bss -0+0174 <[^>]*> addu \$a0,\$a0,\$a1 -0+0178 <[^>]*> lb \$a0,0\(\$a0\) -0+017c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+017c R_MIPS_GOT16 .bss -... -0+0184 <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+0184 R_MIPS_LO16 .bss -0+0188 <[^>]*> addu \$a0,\$a0,\$a1 -0+018c <[^>]*> lb \$a0,0\(\$a0\) -0+0190 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0190 R_MIPS_GOT16 .data -... -0+0198 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0198 R_MIPS_LO16 .data -0+019c <[^>]*> addu \$a0,\$a0,\$a1 -0+01a0 <[^>]*> lb \$a0,1\(\$a0\) -0+01a4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01a4 R_MIPS_GOT16 big_external_data_label -... -0+01ac <[^>]*> addu \$a0,\$a0,\$a1 -0+01b0 <[^>]*> lb \$a0,1\(\$a0\) -0+01b4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01b4 R_MIPS_GOT16 small_external_data_label -... -0+01bc <[^>]*> addu \$a0,\$a0,\$a1 -0+01c0 <[^>]*> lb \$a0,1\(\$a0\) -0+01c4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01c4 R_MIPS_GOT16 big_external_common -... -0+01cc <[^>]*> addu \$a0,\$a0,\$a1 -0+01d0 <[^>]*> lb \$a0,1\(\$a0\) -0+01d4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01d4 R_MIPS_GOT16 small_external_common -... -0+01dc <[^>]*> addu \$a0,\$a0,\$a1 -0+01e0 <[^>]*> lb \$a0,1\(\$a0\) -0+01e4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01e4 R_MIPS_GOT16 .bss -... -0+01ec <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+01ec R_MIPS_LO16 .bss -0+01f0 <[^>]*> addu \$a0,\$a0,\$a1 -0+01f4 <[^>]*> lb \$a0,1\(\$a0\) -0+01f8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01f8 R_MIPS_GOT16 .bss -... -0+0200 <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+0200 R_MIPS_LO16 .bss -0+0204 <[^>]*> addu \$a0,\$a0,\$a1 -0+0208 <[^>]*> lb \$a0,1\(\$a0\) -... +0+0000 <[^>]*> lb \$a0,0\(\$zero\) +0+0004 <[^>]*> lb \$a0,1\(\$zero\) +0+0008 <[^>]*> lui \$a0,0x1 +0+000c <[^>]*> lb \$a0,-32768\(\$a0\) +0+0010 <[^>]*> lb \$a0,-32768\(\$zero\) +0+0014 <[^>]*> lui \$a0,0x1 +0+0018 <[^>]*> lb \$a0,0\(\$a0\) +0+001c <[^>]*> lui \$a0,0x2 +0+0020 <[^>]*> lb \$a0,-23131\(\$a0\) +0+0024 <[^>]*> lb \$a0,0\(\$a1\) +0+0028 <[^>]*> lb \$a0,1\(\$a1\) +0+002c <[^>]*> lui \$a0,0x1 +0+0030 <[^>]*> addu \$a0,\$a0,\$a1 +0+0034 <[^>]*> lb \$a0,-32768\(\$a0\) +0+0038 <[^>]*> lb \$a0,-32768\(\$a1\) +0+003c <[^>]*> lui \$a0,0x1 +0+0040 <[^>]*> addu \$a0,\$a0,\$a1 +0+0044 <[^>]*> lb \$a0,0\(\$a0\) +0+0048 <[^>]*> lui \$a0,0x2 +0+004c <[^>]*> addu \$a0,\$a0,\$a1 +0+0050 <[^>]*> lb \$a0,-23131\(\$a0\) +0+0054 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*54: R_MIPS_GOT16 .data +0+0058 <[^>]*> nop +0+005c <[^>]*> addiu \$a0,\$a0,0 +[ ]*5c: R_MIPS_LO16 .data +0+0060 <[^>]*> lb \$a0,0\(\$a0\) +0+0064 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*64: R_MIPS_GOT16 big_external_data_label +0+0068 <[^>]*> nop +0+006c <[^>]*> lb \$a0,0\(\$a0\) +0+0070 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*70: R_MIPS_GOT16 small_external_data_label +0+0074 <[^>]*> nop +0+0078 <[^>]*> lb \$a0,0\(\$a0\) +0+007c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*7c: R_MIPS_GOT16 big_external_common +0+0080 <[^>]*> nop +0+0084 <[^>]*> lb \$a0,0\(\$a0\) +0+0088 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*88: R_MIPS_GOT16 small_external_common +0+008c <[^>]*> nop +0+0090 <[^>]*> lb \$a0,0\(\$a0\) +0+0094 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*94: R_MIPS_GOT16 .bss +0+0098 <[^>]*> nop +0+009c <[^>]*> addiu \$a0,\$a0,0 +[ ]*9c: R_MIPS_LO16 .bss +0+00a0 <[^>]*> lb \$a0,0\(\$a0\) +0+00a4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*a4: R_MIPS_GOT16 .bss +0+00a8 <[^>]*> nop +0+00ac <[^>]*> addiu \$a0,\$a0,1000 +[ ]*ac: R_MIPS_LO16 .bss +0+00b0 <[^>]*> lb \$a0,0\(\$a0\) +0+00b4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*b4: R_MIPS_GOT16 .data +0+00b8 <[^>]*> nop +0+00bc <[^>]*> addiu \$a0,\$a0,0 +[ ]*bc: R_MIPS_LO16 .data +0+00c0 <[^>]*> lb \$a0,1\(\$a0\) +0+00c4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*c4: R_MIPS_GOT16 big_external_data_label +0+00c8 <[^>]*> nop +0+00cc <[^>]*> lb \$a0,1\(\$a0\) +0+00d0 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*d0: R_MIPS_GOT16 small_external_data_label +0+00d4 <[^>]*> nop +0+00d8 <[^>]*> lb \$a0,1\(\$a0\) +0+00dc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*dc: R_MIPS_GOT16 big_external_common +0+00e0 <[^>]*> nop +0+00e4 <[^>]*> lb \$a0,1\(\$a0\) +0+00e8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*e8: R_MIPS_GOT16 small_external_common +0+00ec <[^>]*> nop +0+00f0 <[^>]*> lb \$a0,1\(\$a0\) +0+00f4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*f4: R_MIPS_GOT16 .bss +0+00f8 <[^>]*> nop +0+00fc <[^>]*> addiu \$a0,\$a0,0 +[ ]*fc: R_MIPS_LO16 .bss +0+0100 <[^>]*> lb \$a0,1\(\$a0\) +0+0104 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*104: R_MIPS_GOT16 .bss +0+0108 <[^>]*> nop +0+010c <[^>]*> addiu \$a0,\$a0,1000 +[ ]*10c: R_MIPS_LO16 .bss +0+0110 <[^>]*> lb \$a0,1\(\$a0\) +0+0114 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*114: R_MIPS_GOT16 .data +0+0118 <[^>]*> nop +0+011c <[^>]*> addiu \$a0,\$a0,0 +[ ]*11c: R_MIPS_LO16 .data +0+0120 <[^>]*> addu \$a0,\$a0,\$a1 +0+0124 <[^>]*> lb \$a0,0\(\$a0\) +0+0128 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*128: R_MIPS_GOT16 big_external_data_label +0+012c <[^>]*> nop +0+0130 <[^>]*> addu \$a0,\$a0,\$a1 +0+0134 <[^>]*> lb \$a0,0\(\$a0\) +0+0138 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*138: R_MIPS_GOT16 small_external_data_label +0+013c <[^>]*> nop +0+0140 <[^>]*> addu \$a0,\$a0,\$a1 +0+0144 <[^>]*> lb \$a0,0\(\$a0\) +0+0148 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*148: R_MIPS_GOT16 big_external_common +0+014c <[^>]*> nop +0+0150 <[^>]*> addu \$a0,\$a0,\$a1 +0+0154 <[^>]*> lb \$a0,0\(\$a0\) +0+0158 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*158: R_MIPS_GOT16 small_external_common +0+015c <[^>]*> nop +0+0160 <[^>]*> addu \$a0,\$a0,\$a1 +0+0164 <[^>]*> lb \$a0,0\(\$a0\) +0+0168 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*168: R_MIPS_GOT16 .bss +0+016c <[^>]*> nop +0+0170 <[^>]*> addiu \$a0,\$a0,0 +[ ]*170: R_MIPS_LO16 .bss +0+0174 <[^>]*> addu \$a0,\$a0,\$a1 +0+0178 <[^>]*> lb \$a0,0\(\$a0\) +0+017c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*17c: R_MIPS_GOT16 .bss +0+0180 <[^>]*> nop +0+0184 <[^>]*> addiu \$a0,\$a0,1000 +[ ]*184: R_MIPS_LO16 .bss +0+0188 <[^>]*> addu \$a0,\$a0,\$a1 +0+018c <[^>]*> lb \$a0,0\(\$a0\) +0+0190 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*190: R_MIPS_GOT16 .data +0+0194 <[^>]*> nop +0+0198 <[^>]*> addiu \$a0,\$a0,0 +[ ]*198: R_MIPS_LO16 .data +0+019c <[^>]*> addu \$a0,\$a0,\$a1 +0+01a0 <[^>]*> lb \$a0,1\(\$a0\) +0+01a4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1a4: R_MIPS_GOT16 big_external_data_label +0+01a8 <[^>]*> nop +0+01ac <[^>]*> addu \$a0,\$a0,\$a1 +0+01b0 <[^>]*> lb \$a0,1\(\$a0\) +0+01b4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1b4: R_MIPS_GOT16 small_external_data_label +0+01b8 <[^>]*> nop +0+01bc <[^>]*> addu \$a0,\$a0,\$a1 +0+01c0 <[^>]*> lb \$a0,1\(\$a0\) +0+01c4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1c4: R_MIPS_GOT16 big_external_common +0+01c8 <[^>]*> nop +0+01cc <[^>]*> addu \$a0,\$a0,\$a1 +0+01d0 <[^>]*> lb \$a0,1\(\$a0\) +0+01d4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1d4: R_MIPS_GOT16 small_external_common +0+01d8 <[^>]*> nop +0+01dc <[^>]*> addu \$a0,\$a0,\$a1 +0+01e0 <[^>]*> lb \$a0,1\(\$a0\) +0+01e4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1e4: R_MIPS_GOT16 .bss +0+01e8 <[^>]*> nop +0+01ec <[^>]*> addiu \$a0,\$a0,0 +[ ]*1ec: R_MIPS_LO16 .bss +0+01f0 <[^>]*> addu \$a0,\$a0,\$a1 +0+01f4 <[^>]*> lb \$a0,1\(\$a0\) +0+01f8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1f8: R_MIPS_GOT16 .bss +0+01fc <[^>]*> nop +0+0200 <[^>]*> addiu \$a0,\$a0,1000 +[ ]*200: R_MIPS_LO16 .bss +0+0204 <[^>]*> addu \$a0,\$a0,\$a1 +0+0208 <[^>]*> lb \$a0,1\(\$a0\) +0+020c <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/lb-xgot.d binutils-2.8/gas/testsuite/gas/mips/lb-xgot.d --- binutils-2.7/gas/testsuite/gas/mips/lb-xgot.d Thu Jul 4 12:15:56 1996 +++ binutils-2.8/gas/testsuite/gas/mips/lb-xgot.d Wed Apr 30 12:54:30 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS lb-xgot #as: -mips1 -KPIC -xgot #source: lb-pic.s @@ -8,235 +8,235 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lb \$a0,0\(\$zero\) -0+0004 <[^>]*> lb \$a0,1\(\$zero\) -0+0008 <[^>]*> lui \$a0,0x1 -0+000c <[^>]*> lb \$a0,-32768\(\$a0\) -0+0010 <[^>]*> lb \$a0,-32768\(\$zero\) -0+0014 <[^>]*> lui \$a0,0x1 -0+0018 <[^>]*> lb \$a0,0\(\$a0\) -0+001c <[^>]*> lui \$a0,0x2 -0+0020 <[^>]*> lb \$a0,-23131\(\$a0\) -0+0024 <[^>]*> lb \$a0,0\(\$a1\) -0+0028 <[^>]*> lb \$a0,1\(\$a1\) -0+002c <[^>]*> lui \$a0,0x1 -0+0030 <[^>]*> addu \$a0,\$a0,\$a1 -0+0034 <[^>]*> lb \$a0,-32768\(\$a0\) -0+0038 <[^>]*> lb \$a0,-32768\(\$a1\) -0+003c <[^>]*> lui \$a0,0x1 -0+0040 <[^>]*> addu \$a0,\$a0,\$a1 -0+0044 <[^>]*> lb \$a0,0\(\$a0\) -0+0048 <[^>]*> lui \$a0,0x2 -0+004c <[^>]*> addu \$a0,\$a0,\$a1 -0+0050 <[^>]*> lb \$a0,-23131\(\$a0\) -0+0054 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0054 R_MIPS_GOT16 .data -... -0+005c <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+005c R_MIPS_LO16 .data -... -0+0064 <[^>]*> lb \$a0,0\(\$a0\) -0+0068 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0068 R_MIPS_GOT_HI16 big_external_data_label -0+006c <[^>]*> addu \$a0,\$a0,\$gp -0+0070 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0070 R_MIPS_GOT_LO16 big_external_data_label -... -0+0078 <[^>]*> lb \$a0,0\(\$a0\) -0+007c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+007c R_MIPS_GOT_HI16 small_external_data_label -0+0080 <[^>]*> addu \$a0,\$a0,\$gp -0+0084 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0084 R_MIPS_GOT_LO16 small_external_data_label -... -0+008c <[^>]*> lb \$a0,0\(\$a0\) -0+0090 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0090 R_MIPS_GOT_HI16 big_external_common -0+0094 <[^>]*> addu \$a0,\$a0,\$gp -0+0098 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0098 R_MIPS_GOT_LO16 big_external_common -... -0+00a0 <[^>]*> lb \$a0,0\(\$a0\) -0+00a4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00a4 R_MIPS_GOT_HI16 small_external_common -0+00a8 <[^>]*> addu \$a0,\$a0,\$gp -0+00ac <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+00ac R_MIPS_GOT_LO16 small_external_common -... -0+00b4 <[^>]*> lb \$a0,0\(\$a0\) -0+00b8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00b8 R_MIPS_GOT16 .bss -... -0+00c0 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+00c0 R_MIPS_LO16 .bss -... -0+00c8 <[^>]*> lb \$a0,0\(\$a0\) -0+00cc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00cc R_MIPS_GOT16 .bss -... -0+00d4 <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+00d4 R_MIPS_LO16 .bss -... -0+00dc <[^>]*> lb \$a0,0\(\$a0\) -0+00e0 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00e0 R_MIPS_GOT16 .data -... -0+00e8 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+00e8 R_MIPS_LO16 .data -... -0+00f0 <[^>]*> lb \$a0,1\(\$a0\) -0+00f4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00f4 R_MIPS_GOT_HI16 big_external_data_label -0+00f8 <[^>]*> addu \$a0,\$a0,\$gp -0+00fc <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+00fc R_MIPS_GOT_LO16 big_external_data_label -... -0+0104 <[^>]*> lb \$a0,1\(\$a0\) -0+0108 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0108 R_MIPS_GOT_HI16 small_external_data_label -0+010c <[^>]*> addu \$a0,\$a0,\$gp -0+0110 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0110 R_MIPS_GOT_LO16 small_external_data_label -... -0+0118 <[^>]*> lb \$a0,1\(\$a0\) -0+011c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+011c R_MIPS_GOT_HI16 big_external_common -0+0120 <[^>]*> addu \$a0,\$a0,\$gp -0+0124 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0124 R_MIPS_GOT_LO16 big_external_common -... -0+012c <[^>]*> lb \$a0,1\(\$a0\) -0+0130 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0130 R_MIPS_GOT_HI16 small_external_common -0+0134 <[^>]*> addu \$a0,\$a0,\$gp -0+0138 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0138 R_MIPS_GOT_LO16 small_external_common -... -0+0140 <[^>]*> lb \$a0,1\(\$a0\) -0+0144 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0144 R_MIPS_GOT16 .bss -... -0+014c <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+014c R_MIPS_LO16 .bss -... -0+0154 <[^>]*> lb \$a0,1\(\$a0\) -0+0158 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0158 R_MIPS_GOT16 .bss -... -0+0160 <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+0160 R_MIPS_LO16 .bss -... -0+0168 <[^>]*> lb \$a0,1\(\$a0\) -0+016c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+016c R_MIPS_GOT16 .data -... -0+0174 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0174 R_MIPS_LO16 .data -... -0+017c <[^>]*> addu \$a0,\$a0,\$a1 -0+0180 <[^>]*> lb \$a0,0\(\$a0\) -0+0184 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0184 R_MIPS_GOT_HI16 big_external_data_label -0+0188 <[^>]*> addu \$a0,\$a0,\$gp -0+018c <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+018c R_MIPS_GOT_LO16 big_external_data_label -... -0+0194 <[^>]*> addu \$a0,\$a0,\$a1 -0+0198 <[^>]*> lb \$a0,0\(\$a0\) -0+019c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+019c R_MIPS_GOT_HI16 small_external_data_label -0+01a0 <[^>]*> addu \$a0,\$a0,\$gp -0+01a4 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+01a4 R_MIPS_GOT_LO16 small_external_data_label -... -0+01ac <[^>]*> addu \$a0,\$a0,\$a1 -0+01b0 <[^>]*> lb \$a0,0\(\$a0\) -0+01b4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01b4 R_MIPS_GOT_HI16 big_external_common -0+01b8 <[^>]*> addu \$a0,\$a0,\$gp -0+01bc <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+01bc R_MIPS_GOT_LO16 big_external_common -... -0+01c4 <[^>]*> addu \$a0,\$a0,\$a1 -0+01c8 <[^>]*> lb \$a0,0\(\$a0\) -0+01cc <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01cc R_MIPS_GOT_HI16 small_external_common -0+01d0 <[^>]*> addu \$a0,\$a0,\$gp -0+01d4 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+01d4 R_MIPS_GOT_LO16 small_external_common -... -0+01dc <[^>]*> addu \$a0,\$a0,\$a1 -0+01e0 <[^>]*> lb \$a0,0\(\$a0\) -0+01e4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01e4 R_MIPS_GOT16 .bss -... -0+01ec <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+01ec R_MIPS_LO16 .bss -... -0+01f4 <[^>]*> addu \$a0,\$a0,\$a1 -0+01f8 <[^>]*> lb \$a0,0\(\$a0\) -0+01fc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+01fc R_MIPS_GOT16 .bss -... -0+0204 <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+0204 R_MIPS_LO16 .bss -... -0+020c <[^>]*> addu \$a0,\$a0,\$a1 -0+0210 <[^>]*> lb \$a0,0\(\$a0\) -0+0214 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0214 R_MIPS_GOT16 .data -... -0+021c <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+021c R_MIPS_LO16 .data -... -0+0224 <[^>]*> addu \$a0,\$a0,\$a1 -0+0228 <[^>]*> lb \$a0,1\(\$a0\) -0+022c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+022c R_MIPS_GOT_HI16 big_external_data_label -0+0230 <[^>]*> addu \$a0,\$a0,\$gp -0+0234 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0234 R_MIPS_GOT_LO16 big_external_data_label -... -0+023c <[^>]*> addu \$a0,\$a0,\$a1 -0+0240 <[^>]*> lb \$a0,1\(\$a0\) -0+0244 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0244 R_MIPS_GOT_HI16 small_external_data_label -0+0248 <[^>]*> addu \$a0,\$a0,\$gp -0+024c <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+024c R_MIPS_GOT_LO16 small_external_data_label -... -0+0254 <[^>]*> addu \$a0,\$a0,\$a1 -0+0258 <[^>]*> lb \$a0,1\(\$a0\) -0+025c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+025c R_MIPS_GOT_HI16 big_external_common -0+0260 <[^>]*> addu \$a0,\$a0,\$gp -0+0264 <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+0264 R_MIPS_GOT_LO16 big_external_common -... -0+026c <[^>]*> addu \$a0,\$a0,\$a1 -0+0270 <[^>]*> lb \$a0,1\(\$a0\) -0+0274 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0274 R_MIPS_GOT_HI16 small_external_common -0+0278 <[^>]*> addu \$a0,\$a0,\$gp -0+027c <[^>]*> lw \$a0,0\(\$a0\) -[ ]*RELOC: 0+027c R_MIPS_GOT_LO16 small_external_common -... -0+0284 <[^>]*> addu \$a0,\$a0,\$a1 -0+0288 <[^>]*> lb \$a0,1\(\$a0\) -0+028c <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+028c R_MIPS_GOT16 .bss -... -0+0294 <[^>]*> addiu \$a0,\$a0,0 -[ ]*RELOC: 0+0294 R_MIPS_LO16 .bss -... -0+029c <[^>]*> addu \$a0,\$a0,\$a1 -0+02a0 <[^>]*> lb \$a0,1\(\$a0\) -0+02a4 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+02a4 R_MIPS_GOT16 .bss -... -0+02ac <[^>]*> addiu \$a0,\$a0,1000 -[ ]*RELOC: 0+02ac R_MIPS_LO16 .bss -... -0+02b4 <[^>]*> addu \$a0,\$a0,\$a1 -0+02b8 <[^>]*> lb \$a0,1\(\$a0\) -... +0+0000 <[^>]*> lb \$a0,0\(\$zero\) +0+0004 <[^>]*> lb \$a0,1\(\$zero\) +0+0008 <[^>]*> lui \$a0,0x1 +0+000c <[^>]*> lb \$a0,-32768\(\$a0\) +0+0010 <[^>]*> lb \$a0,-32768\(\$zero\) +0+0014 <[^>]*> lui \$a0,0x1 +0+0018 <[^>]*> lb \$a0,0\(\$a0\) +0+001c <[^>]*> lui \$a0,0x2 +0+0020 <[^>]*> lb \$a0,-23131\(\$a0\) +0+0024 <[^>]*> lb \$a0,0\(\$a1\) +0+0028 <[^>]*> lb \$a0,1\(\$a1\) +0+002c <[^>]*> lui \$a0,0x1 +0+0030 <[^>]*> addu \$a0,\$a0,\$a1 +0+0034 <[^>]*> lb \$a0,-32768\(\$a0\) +0+0038 <[^>]*> lb \$a0,-32768\(\$a1\) +0+003c <[^>]*> lui \$a0,0x1 +0+0040 <[^>]*> addu \$a0,\$a0,\$a1 +0+0044 <[^>]*> lb \$a0,0\(\$a0\) +0+0048 <[^>]*> lui \$a0,0x2 +0+004c <[^>]*> addu \$a0,\$a0,\$a1 +0+0050 <[^>]*> lb \$a0,-23131\(\$a0\) +0+0054 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*54: R_MIPS_GOT16 .data +0+0058 <[^>]*> nop +0+005c <[^>]*> addiu \$a0,\$a0,0 +[ ]*5c: R_MIPS_LO16 .data +0+0060 <[^>]*> nop +0+0064 <[^>]*> lb \$a0,0\(\$a0\) +0+0068 <[^>]*> lui \$a0,0x0 +[ ]*68: R_MIPS_GOT_HI16 big_external_data_label +0+006c <[^>]*> addu \$a0,\$a0,\$gp +0+0070 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*70: R_MIPS_GOT_LO16 big_external_data_label +0+0074 <[^>]*> nop +0+0078 <[^>]*> lb \$a0,0\(\$a0\) +0+007c <[^>]*> lui \$a0,0x0 +[ ]*7c: R_MIPS_GOT_HI16 small_external_data_label +0+0080 <[^>]*> addu \$a0,\$a0,\$gp +0+0084 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*84: R_MIPS_GOT_LO16 small_external_data_label +0+0088 <[^>]*> nop +0+008c <[^>]*> lb \$a0,0\(\$a0\) +0+0090 <[^>]*> lui \$a0,0x0 +[ ]*90: R_MIPS_GOT_HI16 big_external_common +0+0094 <[^>]*> addu \$a0,\$a0,\$gp +0+0098 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*98: R_MIPS_GOT_LO16 big_external_common +0+009c <[^>]*> nop +0+00a0 <[^>]*> lb \$a0,0\(\$a0\) +0+00a4 <[^>]*> lui \$a0,0x0 +[ ]*a4: R_MIPS_GOT_HI16 small_external_common +0+00a8 <[^>]*> addu \$a0,\$a0,\$gp +0+00ac <[^>]*> lw \$a0,0\(\$a0\) +[ ]*ac: R_MIPS_GOT_LO16 small_external_common +0+00b0 <[^>]*> nop +0+00b4 <[^>]*> lb \$a0,0\(\$a0\) +0+00b8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*b8: R_MIPS_GOT16 .bss +0+00bc <[^>]*> nop +0+00c0 <[^>]*> addiu \$a0,\$a0,0 +[ ]*c0: R_MIPS_LO16 .bss +0+00c4 <[^>]*> nop +0+00c8 <[^>]*> lb \$a0,0\(\$a0\) +0+00cc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*cc: R_MIPS_GOT16 .bss +0+00d0 <[^>]*> nop +0+00d4 <[^>]*> addiu \$a0,\$a0,1000 +[ ]*d4: R_MIPS_LO16 .bss +0+00d8 <[^>]*> nop +0+00dc <[^>]*> lb \$a0,0\(\$a0\) +0+00e0 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*e0: R_MIPS_GOT16 .data +0+00e4 <[^>]*> nop +0+00e8 <[^>]*> addiu \$a0,\$a0,0 +[ ]*e8: R_MIPS_LO16 .data +0+00ec <[^>]*> nop +0+00f0 <[^>]*> lb \$a0,1\(\$a0\) +0+00f4 <[^>]*> lui \$a0,0x0 +[ ]*f4: R_MIPS_GOT_HI16 big_external_data_label +0+00f8 <[^>]*> addu \$a0,\$a0,\$gp +0+00fc <[^>]*> lw \$a0,0\(\$a0\) +[ ]*fc: R_MIPS_GOT_LO16 big_external_data_label +0+0100 <[^>]*> nop +0+0104 <[^>]*> lb \$a0,1\(\$a0\) +0+0108 <[^>]*> lui \$a0,0x0 +[ ]*108: R_MIPS_GOT_HI16 small_external_data_label +0+010c <[^>]*> addu \$a0,\$a0,\$gp +0+0110 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*110: R_MIPS_GOT_LO16 small_external_data_label +0+0114 <[^>]*> nop +0+0118 <[^>]*> lb \$a0,1\(\$a0\) +0+011c <[^>]*> lui \$a0,0x0 +[ ]*11c: R_MIPS_GOT_HI16 big_external_common +0+0120 <[^>]*> addu \$a0,\$a0,\$gp +0+0124 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*124: R_MIPS_GOT_LO16 big_external_common +0+0128 <[^>]*> nop +0+012c <[^>]*> lb \$a0,1\(\$a0\) +0+0130 <[^>]*> lui \$a0,0x0 +[ ]*130: R_MIPS_GOT_HI16 small_external_common +0+0134 <[^>]*> addu \$a0,\$a0,\$gp +0+0138 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*138: R_MIPS_GOT_LO16 small_external_common +0+013c <[^>]*> nop +0+0140 <[^>]*> lb \$a0,1\(\$a0\) +0+0144 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*144: R_MIPS_GOT16 .bss +0+0148 <[^>]*> nop +0+014c <[^>]*> addiu \$a0,\$a0,0 +[ ]*14c: R_MIPS_LO16 .bss +0+0150 <[^>]*> nop +0+0154 <[^>]*> lb \$a0,1\(\$a0\) +0+0158 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*158: R_MIPS_GOT16 .bss +0+015c <[^>]*> nop +0+0160 <[^>]*> addiu \$a0,\$a0,1000 +[ ]*160: R_MIPS_LO16 .bss +0+0164 <[^>]*> nop +0+0168 <[^>]*> lb \$a0,1\(\$a0\) +0+016c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*16c: R_MIPS_GOT16 .data +0+0170 <[^>]*> nop +0+0174 <[^>]*> addiu \$a0,\$a0,0 +[ ]*174: R_MIPS_LO16 .data +0+0178 <[^>]*> nop +0+017c <[^>]*> addu \$a0,\$a0,\$a1 +0+0180 <[^>]*> lb \$a0,0\(\$a0\) +0+0184 <[^>]*> lui \$a0,0x0 +[ ]*184: R_MIPS_GOT_HI16 big_external_data_label +0+0188 <[^>]*> addu \$a0,\$a0,\$gp +0+018c <[^>]*> lw \$a0,0\(\$a0\) +[ ]*18c: R_MIPS_GOT_LO16 big_external_data_label +0+0190 <[^>]*> nop +0+0194 <[^>]*> addu \$a0,\$a0,\$a1 +0+0198 <[^>]*> lb \$a0,0\(\$a0\) +0+019c <[^>]*> lui \$a0,0x0 +[ ]*19c: R_MIPS_GOT_HI16 small_external_data_label +0+01a0 <[^>]*> addu \$a0,\$a0,\$gp +0+01a4 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*1a4: R_MIPS_GOT_LO16 small_external_data_label +0+01a8 <[^>]*> nop +0+01ac <[^>]*> addu \$a0,\$a0,\$a1 +0+01b0 <[^>]*> lb \$a0,0\(\$a0\) +0+01b4 <[^>]*> lui \$a0,0x0 +[ ]*1b4: R_MIPS_GOT_HI16 big_external_common +0+01b8 <[^>]*> addu \$a0,\$a0,\$gp +0+01bc <[^>]*> lw \$a0,0\(\$a0\) +[ ]*1bc: R_MIPS_GOT_LO16 big_external_common +0+01c0 <[^>]*> nop +0+01c4 <[^>]*> addu \$a0,\$a0,\$a1 +0+01c8 <[^>]*> lb \$a0,0\(\$a0\) +0+01cc <[^>]*> lui \$a0,0x0 +[ ]*1cc: R_MIPS_GOT_HI16 small_external_common +0+01d0 <[^>]*> addu \$a0,\$a0,\$gp +0+01d4 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*1d4: R_MIPS_GOT_LO16 small_external_common +0+01d8 <[^>]*> nop +0+01dc <[^>]*> addu \$a0,\$a0,\$a1 +0+01e0 <[^>]*> lb \$a0,0\(\$a0\) +0+01e4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1e4: R_MIPS_GOT16 .bss +0+01e8 <[^>]*> nop +0+01ec <[^>]*> addiu \$a0,\$a0,0 +[ ]*1ec: R_MIPS_LO16 .bss +0+01f0 <[^>]*> nop +0+01f4 <[^>]*> addu \$a0,\$a0,\$a1 +0+01f8 <[^>]*> lb \$a0,0\(\$a0\) +0+01fc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*1fc: R_MIPS_GOT16 .bss +0+0200 <[^>]*> nop +0+0204 <[^>]*> addiu \$a0,\$a0,1000 +[ ]*204: R_MIPS_LO16 .bss +0+0208 <[^>]*> nop +0+020c <[^>]*> addu \$a0,\$a0,\$a1 +0+0210 <[^>]*> lb \$a0,0\(\$a0\) +0+0214 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*214: R_MIPS_GOT16 .data +0+0218 <[^>]*> nop +0+021c <[^>]*> addiu \$a0,\$a0,0 +[ ]*21c: R_MIPS_LO16 .data +0+0220 <[^>]*> nop +0+0224 <[^>]*> addu \$a0,\$a0,\$a1 +0+0228 <[^>]*> lb \$a0,1\(\$a0\) +0+022c <[^>]*> lui \$a0,0x0 +[ ]*22c: R_MIPS_GOT_HI16 big_external_data_label +0+0230 <[^>]*> addu \$a0,\$a0,\$gp +0+0234 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*234: R_MIPS_GOT_LO16 big_external_data_label +0+0238 <[^>]*> nop +0+023c <[^>]*> addu \$a0,\$a0,\$a1 +0+0240 <[^>]*> lb \$a0,1\(\$a0\) +0+0244 <[^>]*> lui \$a0,0x0 +[ ]*244: R_MIPS_GOT_HI16 small_external_data_label +0+0248 <[^>]*> addu \$a0,\$a0,\$gp +0+024c <[^>]*> lw \$a0,0\(\$a0\) +[ ]*24c: R_MIPS_GOT_LO16 small_external_data_label +0+0250 <[^>]*> nop +0+0254 <[^>]*> addu \$a0,\$a0,\$a1 +0+0258 <[^>]*> lb \$a0,1\(\$a0\) +0+025c <[^>]*> lui \$a0,0x0 +[ ]*25c: R_MIPS_GOT_HI16 big_external_common +0+0260 <[^>]*> addu \$a0,\$a0,\$gp +0+0264 <[^>]*> lw \$a0,0\(\$a0\) +[ ]*264: R_MIPS_GOT_LO16 big_external_common +0+0268 <[^>]*> nop +0+026c <[^>]*> addu \$a0,\$a0,\$a1 +0+0270 <[^>]*> lb \$a0,1\(\$a0\) +0+0274 <[^>]*> lui \$a0,0x0 +[ ]*274: R_MIPS_GOT_HI16 small_external_common +0+0278 <[^>]*> addu \$a0,\$a0,\$gp +0+027c <[^>]*> lw \$a0,0\(\$a0\) +[ ]*27c: R_MIPS_GOT_LO16 small_external_common +0+0280 <[^>]*> nop +0+0284 <[^>]*> addu \$a0,\$a0,\$a1 +0+0288 <[^>]*> lb \$a0,1\(\$a0\) +0+028c <[^>]*> lw \$a0,0\(\$gp\) +[ ]*28c: R_MIPS_GOT16 .bss +0+0290 <[^>]*> nop +0+0294 <[^>]*> addiu \$a0,\$a0,0 +[ ]*294: R_MIPS_LO16 .bss +0+0298 <[^>]*> nop +0+029c <[^>]*> addu \$a0,\$a0,\$a1 +0+02a0 <[^>]*> lb \$a0,1\(\$a0\) +0+02a4 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*2a4: R_MIPS_GOT16 .bss +0+02a8 <[^>]*> nop +0+02ac <[^>]*> addiu \$a0,\$a0,1000 +[ ]*2ac: R_MIPS_LO16 .bss +0+02b0 <[^>]*> nop +0+02b4 <[^>]*> addu \$a0,\$a0,\$a1 +0+02b8 <[^>]*> lb \$a0,1\(\$a0\) +0+02bc <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/lb.d binutils-2.8/gas/testsuite/gas/mips/lb.d --- binutils-2.7/gas/testsuite/gas/mips/lb.d Thu Jul 4 12:15:57 1996 +++ binutils-2.8/gas/testsuite/gas/mips/lb.d Wed Apr 30 12:54:31 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS lb #as: -mips1 @@ -7,389 +7,389 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lb \$a0,0\(\$zero\) -0+0004 <[^>]*> lb \$a0,1\(\$zero\) -0+0008 <[^>]*> lui \$a0,0x1 -0+000c <[^>]*> lb \$a0,-32768\(\$a0\) -0+0010 <[^>]*> lb \$a0,-32768\(\$zero\) -0+0014 <[^>]*> lui \$a0,0x1 -0+0018 <[^>]*> lb \$a0,0\(\$a0\) -0+001c <[^>]*> lui \$a0,0x2 -0+0020 <[^>]*> lb \$a0,-23131\(\$a0\) -0+0024 <[^>]*> lb \$a0,0\(\$a1\) -0+0028 <[^>]*> lb \$a0,1\(\$a1\) -0+002c <[^>]*> lui \$a0,0x1 -0+0030 <[^>]*> addu \$a0,\$a0,\$a1 -0+0034 <[^>]*> lb \$a0,-32768\(\$a0\) -0+0038 <[^>]*> lb \$a0,-32768\(\$a1\) -0+003c <[^>]*> lui \$a0,0x1 -0+0040 <[^>]*> addu \$a0,\$a0,\$a1 -0+0044 <[^>]*> lb \$a0,0\(\$a0\) -0+0048 <[^>]*> lui \$a0,0x2 -0+004c <[^>]*> addu \$a0,\$a0,\$a1 -0+0050 <[^>]*> lb \$a0,-23131\(\$a0\) -0+0054 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0054 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0058 <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+0058 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+005c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+005c [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0060 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+0060 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0064 <[^>]*> lb \$a0,0\(\$gp\) -[ ]*RELOC: 0+0064 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0068 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0068 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+006c <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+006c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0070 <[^>]*> lb \$a0,0\(\$gp\) -[ ]*RELOC: 0+0070 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0074 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0074 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0078 <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+0078 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+007c <[^>]*> lb \$a0,-16384\(\$gp\) -[ ]*RELOC: 0+007c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0080 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0080 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0084 <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+0084 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0088 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0088 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+008c <[^>]*> lb \$a0,1\(\$a0\) -[ ]*RELOC: 0+008c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0090 <[^>]*> lb \$a0,1\(\$gp\) -[ ]*RELOC: 0+0090 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0094 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0094 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0098 <[^>]*> lb \$a0,1\(\$a0\) -[ ]*RELOC: 0+0098 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+009c <[^>]*> lb \$a0,1\(\$gp\) -[ ]*RELOC: 0+009c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00a0 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00a0 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+00a4 <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+00a4 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00a8 <[^>]*> lb \$a0,[-0-9]+\(\$gp\) -[ ]*RELOC: 0+00a8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00ac <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00ac [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00b0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+00b0 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00b4 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00b4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00b8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+00b8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00bc <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00bc [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+00c0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+00c0 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+00c4 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00c4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00c8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+00c8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+00cc <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00cc [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+00d0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+00d0 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+00d4 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00d4 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+00d8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+00d8 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00dc <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+00dc [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+00e0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+00e0 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+00e4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00e4 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00e8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+00e8 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00ec <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00ec [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00f0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+00f0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00f4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00f4 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+00f8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+00f8 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+00fc <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+00fc [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0100 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0100 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0104 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0104 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0108 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0108 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+010c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+010c [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0110 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0110 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0114 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0114 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0118 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0118 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+011c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+011c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0120 <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+0120 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0124 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0124 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0128 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+0128 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+012c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+012c [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0130 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+0130 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0134 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0134 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0138 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+0138 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+013c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+013c [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0140 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+0140 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0144 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0144 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0148 <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+0148 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+014c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+014c [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0150 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0150 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0154 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0154 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0158 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0158 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+015c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+015c [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0160 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0160 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0164 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0164 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0168 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0168 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+016c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+016c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0170 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0170 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0174 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0174 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0178 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0178 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+017c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+017c [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0180 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0180 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0184 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0184 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0188 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0188 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+018c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+018c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0190 <[^>]*> addu \$a0,\$a0,\$a1 -0+0194 <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+0194 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0198 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0198 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+019c <[^>]*> addu \$a0,\$a0,\$a1 -0+01a0 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+01a0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01a4 <[^>]*> addu \$a0,\$a1,\$gp -0+01a8 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+01a8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+01ac <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01ac [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01b0 <[^>]*> addu \$a0,\$a0,\$a1 -0+01b4 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+01b4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01b8 <[^>]*> addu \$a0,\$a1,\$gp -0+01bc <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+01bc [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+01c0 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01c0 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+01c4 <[^>]*> addu \$a0,\$a0,\$a1 -0+01c8 <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+01c8 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+01cc <[^>]*> addu \$a0,\$a1,\$gp -0+01d0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+01d0 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+01d4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01d4 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+01d8 <[^>]*> addu \$a0,\$a0,\$a1 -0+01dc <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+01dc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+01e0 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01e0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+01e4 <[^>]*> addu \$a0,\$a0,\$a1 -0+01e8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+01e8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01ec <[^>]*> addu \$a0,\$a1,\$gp -0+01f0 <[^>]*> lb \$a0,1\(\$a0\) -[ ]*RELOC: 0+01f0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+01f4 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+01f4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01f8 <[^>]*> addu \$a0,\$a0,\$a1 -0+01fc <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+01fc [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0200 <[^>]*> addu \$a0,\$a1,\$gp -0+0204 <[^>]*> lb \$a0,1\(\$a0\) -[ ]*RELOC: 0+0204 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0208 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0208 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+020c <[^>]*> addu \$a0,\$a0,\$a1 -0+0210 <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+0210 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0214 <[^>]*> addu \$a0,\$a1,\$gp -0+0218 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0218 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+021c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+021c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0220 <[^>]*> addu \$a0,\$a0,\$a1 -0+0224 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0224 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0228 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0228 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+022c <[^>]*> addu \$a0,\$a0,\$a1 -0+0230 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0230 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0234 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0234 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0238 <[^>]*> addu \$a0,\$a0,\$a1 -0+023c <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+023c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0240 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0240 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0244 <[^>]*> addu \$a0,\$a0,\$a1 -0+0248 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0248 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+024c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+024c [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0250 <[^>]*> addu \$a0,\$a0,\$a1 -0+0254 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0254 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0258 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0258 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+025c <[^>]*> addu \$a0,\$a0,\$a1 -0+0260 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0260 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0264 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0264 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0268 <[^>]*> addu \$a0,\$a0,\$a1 -0+026c <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+026c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0270 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0270 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0274 <[^>]*> addu \$a0,\$a0,\$a1 -0+0278 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0278 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+027c <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+027c [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0280 <[^>]*> addu \$a0,\$a0,\$a1 -0+0284 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0284 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0288 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0288 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+028c <[^>]*> addu \$a0,\$a0,\$a1 -0+0290 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0290 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0294 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+0294 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0298 <[^>]*> addu \$a0,\$a0,\$a1 -0+029c <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+029c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02a0 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+02a0 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02a4 <[^>]*> addu \$a0,\$a0,\$a1 -0+02a8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+02a8 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+02ac <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+02ac [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02b0 <[^>]*> addu \$a0,\$a0,\$a1 -0+02b4 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+02b4 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+02b8 <[^>]*> lui \$a0,0x0 -[ ]*RELOC: 0+02b8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+02bc <[^>]*> addu \$a0,\$a0,\$a1 -0+02c0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+02c0 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+02c4 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+02c4 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+02c8 <[^>]*> addu \$a0,\$a0,\$a1 -0+02cc <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+02cc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+02d0 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+02d0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+02d4 <[^>]*> addu \$a0,\$a0,\$a1 -0+02d8 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+02d8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+02dc <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+02dc [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+02e0 <[^>]*> addu \$a0,\$a0,\$a1 -0+02e4 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+02e4 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+02e8 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+02e8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+02ec <[^>]*> addu \$a0,\$a0,\$a1 -0+02f0 <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+02f0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02f4 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+02f4 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02f8 <[^>]*> addu \$a0,\$a0,\$a1 -0+02fc <[^>]*> lb \$a0,0\(\$a0\) -[ ]*RELOC: 0+02fc [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0300 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0300 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0304 <[^>]*> addu \$a0,\$a0,\$a1 -0+0308 <[^>]*> lb \$a0,[0-9]+\(\$a0\) -[ ]*RELOC: 0+0308 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+030c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+030c [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0310 <[^>]*> addu \$a0,\$a0,\$a1 -0+0314 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0314 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0318 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0318 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+031c <[^>]*> addu \$a0,\$a0,\$a1 -0+0320 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0320 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0324 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0324 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0328 <[^>]*> addu \$a0,\$a0,\$a1 -0+032c <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+032c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0330 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0330 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0334 <[^>]*> addu \$a0,\$a0,\$a1 -0+0338 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0338 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+033c <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+033c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0340 <[^>]*> addu \$a0,\$a0,\$a1 -0+0344 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0344 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0348 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0348 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+034c <[^>]*> addu \$a0,\$a0,\$a1 -0+0350 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0350 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0354 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0354 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0358 <[^>]*> addu \$a0,\$a0,\$a1 -0+035c <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+035c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0360 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+0360 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0364 <[^>]*> addu \$a0,\$a0,\$a1 -0+0368 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+0368 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+036c <[^>]*> lbu \$a0,0\(\$zero\) -0+0370 <[^>]*> lh \$a0,0\(\$zero\) -0+0374 <[^>]*> lhu \$a0,0\(\$zero\) -0+0378 <[^>]*> lw \$a0,0\(\$zero\) -0+037c <[^>]*> lwl \$a0,0\(\$zero\) -0+0380 <[^>]*> lwr \$a0,0\(\$zero\) -0+0384 <[^>]*> ll \$a0,0\(\$zero\) -0+0388 <[^>]*> lwc1 \$f4,0\(\$zero\) -0+038c <[^>]*> lwc2 \$4,0\(\$zero\) -0+0390 <[^>]*> lwc3 \$4,0\(\$zero\) -... +0+0000 <[^>]*> lb \$a0,0\(\$zero\) +0+0004 <[^>]*> lb \$a0,1\(\$zero\) +0+0008 <[^>]*> lui \$a0,0x1 +0+000c <[^>]*> lb \$a0,-32768\(\$a0\) +0+0010 <[^>]*> lb \$a0,-32768\(\$zero\) +0+0014 <[^>]*> lui \$a0,0x1 +0+0018 <[^>]*> lb \$a0,0\(\$a0\) +0+001c <[^>]*> lui \$a0,0x2 +0+0020 <[^>]*> lb \$a0,-23131\(\$a0\) +0+0024 <[^>]*> lb \$a0,0\(\$a1\) +0+0028 <[^>]*> lb \$a0,1\(\$a1\) +0+002c <[^>]*> lui \$a0,0x1 +0+0030 <[^>]*> addu \$a0,\$a0,\$a1 +0+0034 <[^>]*> lb \$a0,-32768\(\$a0\) +0+0038 <[^>]*> lb \$a0,-32768\(\$a1\) +0+003c <[^>]*> lui \$a0,0x1 +0+0040 <[^>]*> addu \$a0,\$a0,\$a1 +0+0044 <[^>]*> lb \$a0,0\(\$a0\) +0+0048 <[^>]*> lui \$a0,0x2 +0+004c <[^>]*> addu \$a0,\$a0,\$a1 +0+0050 <[^>]*> lb \$a0,-23131\(\$a0\) +0+0054 <[^>]*> lui \$a0,0x0 +[ ]*54: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0058 <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*58: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+005c <[^>]*> lui \$a0,0x0 +[ ]*5c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0060 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*60: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0064 <[^>]*> lb \$a0,0\(\$gp\) +[ ]*64: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0068 <[^>]*> lui \$a0,0x0 +[ ]*68: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+006c <[^>]*> lb \$a0,0\(\$a0\) +[ ]*6c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0070 <[^>]*> lb \$a0,0\(\$gp\) +[ ]*70: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0074 <[^>]*> lui \$a0,0x0 +[ ]*74: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0078 <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*78: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+007c <[^>]*> lb \$a0,-16384\(\$gp\) +[ ]*7c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0080 <[^>]*> lui \$a0,0x0 +[ ]*80: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0084 <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*84: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0088 <[^>]*> lui \$a0,0x0 +[ ]*88: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+008c <[^>]*> lb \$a0,1\(\$a0\) +[ ]*8c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0090 <[^>]*> lb \$a0,1\(\$gp\) +[ ]*90: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0094 <[^>]*> lui \$a0,0x0 +[ ]*94: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0098 <[^>]*> lb \$a0,1\(\$a0\) +[ ]*98: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+009c <[^>]*> lb \$a0,1\(\$gp\) +[ ]*9c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00a0 <[^>]*> lui \$a0,0x0 +[ ]*a0: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+00a4 <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*a4: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00a8 <[^>]*> lb \$a0,[-0-9]+\(\$gp\) +[ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00ac <[^>]*> lui \$a0,[-0-9x]+ +[ ]*ac: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+00b0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*b0: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00b4 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*b4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00b8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*b8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00bc <[^>]*> lui \$a0,[-0-9x]+ +[ ]*bc: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+00c0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*c0: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+00c4 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*c4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00c8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*c8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+00cc <[^>]*> lui \$a0,[-0-9x]+ +[ ]*cc: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+00d0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*d0: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+00d4 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*d4: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+00d8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*d8: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00dc <[^>]*> lui \$a0,[-0-9x]+ +[ ]*dc: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+00e0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*e0: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+00e4 <[^>]*> lui \$a0,0x0 +[ ]*e4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+00e8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*e8: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00ec <[^>]*> lui \$a0,0x0 +[ ]*ec: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00f0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*f0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00f4 <[^>]*> lui \$a0,0x0 +[ ]*f4: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+00f8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*f8: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+00fc <[^>]*> lui \$a0,0x0 +[ ]*fc: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0100 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*100: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0104 <[^>]*> lui \$a0,0x0 +[ ]*104: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0108 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*108: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+010c <[^>]*> lui \$a0,0x0 +[ ]*10c: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0110 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*110: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0114 <[^>]*> lui \$a0,0x0 +[ ]*114: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0118 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*118: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+011c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*11c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0120 <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*120: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0124 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*124: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0128 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*128: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+012c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*12c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0130 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*130: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0134 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*134: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0138 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*138: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+013c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*13c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0140 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*140: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0144 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*144: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0148 <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*148: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+014c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*14c: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0150 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*150: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0154 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*154: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0158 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*158: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+015c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*15c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0160 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*160: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0164 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*164: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0168 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*168: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+016c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*16c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0170 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*170: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0174 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*174: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0178 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*178: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+017c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*17c: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0180 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*180: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0184 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*184: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0188 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*188: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+018c <[^>]*> lui \$a0,0x0 +[ ]*18c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0190 <[^>]*> addu \$a0,\$a0,\$a1 +0+0194 <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*194: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0198 <[^>]*> lui \$a0,0x0 +[ ]*198: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+019c <[^>]*> addu \$a0,\$a0,\$a1 +0+01a0 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*1a0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01a4 <[^>]*> addu \$a0,\$a1,\$gp +0+01a8 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*1a8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+01ac <[^>]*> lui \$a0,0x0 +[ ]*1ac: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01b0 <[^>]*> addu \$a0,\$a0,\$a1 +0+01b4 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*1b4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01b8 <[^>]*> addu \$a0,\$a1,\$gp +0+01bc <[^>]*> lb \$a0,0\(\$a0\) +[ ]*1bc: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+01c0 <[^>]*> lui \$a0,0x0 +[ ]*1c0: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+01c4 <[^>]*> addu \$a0,\$a0,\$a1 +0+01c8 <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*1c8: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+01cc <[^>]*> addu \$a0,\$a1,\$gp +0+01d0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*1d0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+01d4 <[^>]*> lui \$a0,0x0 +[ ]*1d4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+01d8 <[^>]*> addu \$a0,\$a0,\$a1 +0+01dc <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*1dc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+01e0 <[^>]*> lui \$a0,0x0 +[ ]*1e0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+01e4 <[^>]*> addu \$a0,\$a0,\$a1 +0+01e8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*1e8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01ec <[^>]*> addu \$a0,\$a1,\$gp +0+01f0 <[^>]*> lb \$a0,1\(\$a0\) +[ ]*1f0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+01f4 <[^>]*> lui \$a0,0x0 +[ ]*1f4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01f8 <[^>]*> addu \$a0,\$a0,\$a1 +0+01fc <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*1fc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0200 <[^>]*> addu \$a0,\$a1,\$gp +0+0204 <[^>]*> lb \$a0,1\(\$a0\) +[ ]*204: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0208 <[^>]*> lui \$a0,0x0 +[ ]*208: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+020c <[^>]*> addu \$a0,\$a0,\$a1 +0+0210 <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*210: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0214 <[^>]*> addu \$a0,\$a1,\$gp +0+0218 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*218: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+021c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*21c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0220 <[^>]*> addu \$a0,\$a0,\$a1 +0+0224 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*224: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0228 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*228: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+022c <[^>]*> addu \$a0,\$a0,\$a1 +0+0230 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*230: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0234 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*234: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0238 <[^>]*> addu \$a0,\$a0,\$a1 +0+023c <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*23c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0240 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*240: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0244 <[^>]*> addu \$a0,\$a0,\$a1 +0+0248 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*248: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+024c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*24c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0250 <[^>]*> addu \$a0,\$a0,\$a1 +0+0254 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*254: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0258 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*258: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+025c <[^>]*> addu \$a0,\$a0,\$a1 +0+0260 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*260: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0264 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*264: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0268 <[^>]*> addu \$a0,\$a0,\$a1 +0+026c <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*26c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0270 <[^>]*> lui \$a0,0x0 +[ ]*270: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0274 <[^>]*> addu \$a0,\$a0,\$a1 +0+0278 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*278: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+027c <[^>]*> lui \$a0,0x0 +[ ]*27c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0280 <[^>]*> addu \$a0,\$a0,\$a1 +0+0284 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*284: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0288 <[^>]*> lui \$a0,0x0 +[ ]*288: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+028c <[^>]*> addu \$a0,\$a0,\$a1 +0+0290 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*290: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0294 <[^>]*> lui \$a0,0x0 +[ ]*294: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0298 <[^>]*> addu \$a0,\$a0,\$a1 +0+029c <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*29c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02a0 <[^>]*> lui \$a0,0x0 +[ ]*2a0: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02a4 <[^>]*> addu \$a0,\$a0,\$a1 +0+02a8 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*2a8: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+02ac <[^>]*> lui \$a0,0x0 +[ ]*2ac: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+02b0 <[^>]*> addu \$a0,\$a0,\$a1 +0+02b4 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*2b4: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+02b8 <[^>]*> lui \$a0,0x0 +[ ]*2b8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+02bc <[^>]*> addu \$a0,\$a0,\$a1 +0+02c0 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*2c0: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+02c4 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*2c4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+02c8 <[^>]*> addu \$a0,\$a0,\$a1 +0+02cc <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*2cc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+02d0 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*2d0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+02d4 <[^>]*> addu \$a0,\$a0,\$a1 +0+02d8 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*2d8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+02dc <[^>]*> lui \$a0,[-0-9x]+ +[ ]*2dc: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+02e0 <[^>]*> addu \$a0,\$a0,\$a1 +0+02e4 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*2e4: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+02e8 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*2e8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+02ec <[^>]*> addu \$a0,\$a0,\$a1 +0+02f0 <[^>]*> lb \$a0,0\(\$a0\) +[ ]*2f0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02f4 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*2f4: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02f8 <[^>]*> addu \$a0,\$a0,\$a1 +0+02fc <[^>]*> lb \$a0,0\(\$a0\) +[ ]*2fc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0300 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*300: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0304 <[^>]*> addu \$a0,\$a0,\$a1 +0+0308 <[^>]*> lb \$a0,[0-9]+\(\$a0\) +[ ]*308: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+030c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*30c: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0310 <[^>]*> addu \$a0,\$a0,\$a1 +0+0314 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*314: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0318 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*318: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+031c <[^>]*> addu \$a0,\$a0,\$a1 +0+0320 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*320: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0324 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*324: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0328 <[^>]*> addu \$a0,\$a0,\$a1 +0+032c <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*32c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0330 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*330: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0334 <[^>]*> addu \$a0,\$a0,\$a1 +0+0338 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*338: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+033c <[^>]*> lui \$a0,[-0-9x]+ +[ ]*33c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0340 <[^>]*> addu \$a0,\$a0,\$a1 +0+0344 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*344: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0348 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*348: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+034c <[^>]*> addu \$a0,\$a0,\$a1 +0+0350 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*350: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0354 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*354: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0358 <[^>]*> addu \$a0,\$a0,\$a1 +0+035c <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*35c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0360 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*360: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0364 <[^>]*> addu \$a0,\$a0,\$a1 +0+0368 <[^>]*> lb \$a0,[-0-9]+\(\$a0\) +[ ]*368: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+036c <[^>]*> lbu \$a0,0\(\$zero\) +0+0370 <[^>]*> lh \$a0,0\(\$zero\) +0+0374 <[^>]*> lhu \$a0,0\(\$zero\) +0+0378 <[^>]*> lw \$a0,0\(\$zero\) +0+037c <[^>]*> lwl \$a0,0\(\$zero\) +0+0380 <[^>]*> lwr \$a0,0\(\$zero\) +0+0384 <[^>]*> ll \$a0,0\(\$zero\) +0+0388 <[^>]*> lwc1 \$f4,0\(\$zero\) +0+038c <[^>]*> lwc2 \$4,0\(\$zero\) +0+0390 <[^>]*> lwc3 \$4,0\(\$zero\) + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/lb.s binutils-2.8/gas/testsuite/gas/mips/lb.s --- binutils-2.7/gas/testsuite/gas/mips/lb.s Thu Jul 4 12:15:57 1996 +++ binutils-2.8/gas/testsuite/gas/mips/lb.s Wed Apr 30 12:54:31 1997 @@ -118,3 +118,8 @@ lwc1 $4,0 lwc2 $4,0 lwc3 $4,0 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/ld-empic.d binutils-2.8/gas/testsuite/gas/mips/ld-empic.d --- binutils-2.7/gas/testsuite/gas/mips/ld-empic.d Thu Jul 4 12:15:57 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ld-empic.d Wed Apr 30 12:54:31 1997 @@ -1,6 +1,6 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS ld-empic -#as: -mips1 -membedded-pic +#as: -mips1 -membedded-pic --defsym EMPIC=1 #source: ld-pic.s # Test the ld macro with -membedded-pic. @@ -8,179 +8,179 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lw \$a0,0\(\$zero\) -0+0004 <[^>]*> lw \$a1,4\(\$zero\) -0+0008 <[^>]*> lw \$a0,1\(\$zero\) -0+000c <[^>]*> lw \$a1,5\(\$zero\) -0+0010 <[^>]*> lui \$at,0x1 -0+0014 <[^>]*> lw \$a0,-32768\(\$at\) -0+0018 <[^>]*> lw \$a1,-32764\(\$at\) -0+001c <[^>]*> lw \$a0,-32768\(\$zero\) -0+0020 <[^>]*> lw \$a1,-32764\(\$zero\) -0+0024 <[^>]*> lui \$at,0x1 -0+0028 <[^>]*> lw \$a0,0\(\$at\) -0+002c <[^>]*> lw \$a1,4\(\$at\) -0+0030 <[^>]*> lui \$at,0x2 -0+0034 <[^>]*> lw \$a0,-23131\(\$at\) -0+0038 <[^>]*> lw \$a1,-23127\(\$at\) -... -0+0040 <[^>]*> lw \$a0,0\(\$a1\) -0+0044 <[^>]*> lw \$a1,4\(\$a1\) -... -0+004c <[^>]*> lw \$a0,1\(\$a1\) -0+0050 <[^>]*> lw \$a1,5\(\$a1\) -0+0054 <[^>]*> lui \$at,0x1 -0+0058 <[^>]*> addu \$at,\$a1,\$at -0+005c <[^>]*> lw \$a0,-32768\(\$at\) -0+0060 <[^>]*> lw \$a1,-32764\(\$at\) -... -0+0068 <[^>]*> lw \$a0,-32768\(\$a1\) -0+006c <[^>]*> lw \$a1,-32764\(\$a1\) -0+0070 <[^>]*> lui \$at,0x1 -0+0074 <[^>]*> addu \$at,\$a1,\$at -0+0078 <[^>]*> lw \$a0,0\(\$at\) -0+007c <[^>]*> lw \$a1,4\(\$at\) -0+0080 <[^>]*> lui \$at,0x2 -0+0084 <[^>]*> addu \$at,\$a1,\$at -0+0088 <[^>]*> lw \$a0,-23131\(\$at\) -0+008c <[^>]*> lw \$a1,-23127\(\$at\) -0+0090 <[^>]*> lw \$a0,-16384\(\$gp\) -[ ]*RELOC: 0+0090 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+0094 <[^>]*> lw \$a1,-16380\(\$gp\) -[ ]*RELOC: 0+0094 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+0098 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+0098 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+009c <[^>]*> lw \$a1,4\(\$gp\) -[ ]*RELOC: 0+009c [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+00a0 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00a0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00a4 <[^>]*> lw \$a1,4\(\$gp\) -[ ]*RELOC: 0+00a4 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00a8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00a8 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+00ac <[^>]*> lw \$a1,4\(\$gp\) -[ ]*RELOC: 0+00ac [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+00b0 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00b0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00b4 <[^>]*> lw \$a1,4\(\$gp\) -[ ]*RELOC: 0+00b4 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00b8 <[^>]*> lw \$a0,-16384\(\$gp\) -[ ]*RELOC: 0+00b8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00bc <[^>]*> lw \$a1,-16380\(\$gp\) -[ ]*RELOC: 0+00bc [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00c0 <[^>]*> lw \$a0,-15384\(\$gp\) -[ ]*RELOC: 0+00c0 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00c4 <[^>]*> lw \$a1,-15380\(\$gp\) -[ ]*RELOC: 0+00c4 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00c8 <[^>]*> lw \$a0,-16383\(\$gp\) -[ ]*RELOC: 0+00c8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+00cc <[^>]*> lw \$a1,-16379\(\$gp\) -[ ]*RELOC: 0+00cc [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+00d0 <[^>]*> lw \$a0,1\(\$gp\) -[ ]*RELOC: 0+00d0 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+00d4 <[^>]*> lw \$a1,5\(\$gp\) -[ ]*RELOC: 0+00d4 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+00d8 <[^>]*> lw \$a0,1\(\$gp\) -[ ]*RELOC: 0+00d8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00dc <[^>]*> lw \$a1,5\(\$gp\) -[ ]*RELOC: 0+00dc [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00e0 <[^>]*> lw \$a0,1\(\$gp\) -[ ]*RELOC: 0+00e0 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+00e4 <[^>]*> lw \$a1,5\(\$gp\) -[ ]*RELOC: 0+00e4 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+00e8 <[^>]*> lw \$a0,1\(\$gp\) -[ ]*RELOC: 0+00e8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00ec <[^>]*> lw \$a1,5\(\$gp\) -[ ]*RELOC: 0+00ec [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00f0 <[^>]*> lw \$a0,-16383\(\$gp\) -[ ]*RELOC: 0+00f0 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00f4 <[^>]*> lw \$a1,-16379\(\$gp\) -[ ]*RELOC: 0+00f4 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00f8 <[^>]*> lw \$a0,-15383\(\$gp\) -[ ]*RELOC: 0+00f8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00fc <[^>]*> lw \$a1,-15379\(\$gp\) -[ ]*RELOC: 0+00fc [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -... -0+0104 <[^>]*> addu \$at,\$a1,\$gp -0+0108 <[^>]*> lw \$a0,-16384\(\$at\) -[ ]*RELOC: 0+0108 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+010c <[^>]*> lw \$a1,-16380\(\$at\) -[ ]*RELOC: 0+010c [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -... -0+0114 <[^>]*> addu \$at,\$a1,\$gp -0+0118 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0118 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+011c <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+011c [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -... -0+0124 <[^>]*> addu \$at,\$a1,\$gp -0+0128 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0128 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+012c <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+012c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -... -0+0134 <[^>]*> addu \$at,\$a1,\$gp -0+0138 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0138 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+013c <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+013c [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -... -0+0144 <[^>]*> addu \$at,\$a1,\$gp -0+0148 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0148 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+014c <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+014c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -... -0+0154 <[^>]*> addu \$at,\$a1,\$gp -0+0158 <[^>]*> lw \$a0,-16384\(\$at\) -[ ]*RELOC: 0+0158 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+015c <[^>]*> lw \$a1,-16380\(\$at\) -[ ]*RELOC: 0+015c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -... -0+0164 <[^>]*> addu \$at,\$a1,\$gp -0+0168 <[^>]*> lw \$a0,-15384\(\$at\) -[ ]*RELOC: 0+0168 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+016c <[^>]*> lw \$a1,-15380\(\$at\) -[ ]*RELOC: 0+016c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -... -0+0174 <[^>]*> addu \$at,\$a1,\$gp -0+0178 <[^>]*> lw \$a0,-16383\(\$at\) -[ ]*RELOC: 0+0178 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+017c <[^>]*> lw \$a1,-16379\(\$at\) -[ ]*RELOC: 0+017c [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -... -0+0184 <[^>]*> addu \$at,\$a1,\$gp -0+0188 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+0188 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+018c <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+018c [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -... -0+0194 <[^>]*> addu \$at,\$a1,\$gp -0+0198 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+0198 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+019c <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+019c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -... -0+01a4 <[^>]*> addu \$at,\$a1,\$gp -0+01a8 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+01a8 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+01ac <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+01ac [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -... -0+01b4 <[^>]*> addu \$at,\$a1,\$gp -0+01b8 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+01b8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+01bc <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+01bc [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -... -0+01c4 <[^>]*> addu \$at,\$a1,\$gp -0+01c8 <[^>]*> lw \$a0,-16383\(\$at\) -[ ]*RELOC: 0+01c8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+01cc <[^>]*> lw \$a1,-16379\(\$at\) -[ ]*RELOC: 0+01cc [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -... -0+01d4 <[^>]*> addu \$at,\$a1,\$gp -0+01d8 <[^>]*> lw \$a0,-15383\(\$at\) -[ ]*RELOC: 0+01d8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+01dc <[^>]*> lw \$a1,-15379\(\$at\) -[ ]*RELOC: 0+01dc [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0000 <[^>]*> lw \$a0,0\(\$zero\) +0+0004 <[^>]*> lw \$a1,4\(\$zero\) +0+0008 <[^>]*> lw \$a0,1\(\$zero\) +0+000c <[^>]*> lw \$a1,5\(\$zero\) +0+0010 <[^>]*> lui \$at,0x1 +0+0014 <[^>]*> lw \$a0,-32768\(\$at\) +0+0018 <[^>]*> lw \$a1,-32764\(\$at\) +0+001c <[^>]*> lw \$a0,-32768\(\$zero\) +0+0020 <[^>]*> lw \$a1,-32764\(\$zero\) +0+0024 <[^>]*> lui \$at,0x1 +0+0028 <[^>]*> lw \$a0,0\(\$at\) +0+002c <[^>]*> lw \$a1,4\(\$at\) +0+0030 <[^>]*> lui \$at,0x2 +0+0034 <[^>]*> lw \$a0,-23131\(\$at\) +0+0038 <[^>]*> lw \$a1,-23127\(\$at\) +0+003c <[^>]*> nop +0+0040 <[^>]*> lw \$a0,0\(\$a1\) +0+0044 <[^>]*> lw \$a1,4\(\$a1\) +0+0048 <[^>]*> nop +0+004c <[^>]*> lw \$a0,1\(\$a1\) +0+0050 <[^>]*> lw \$a1,5\(\$a1\) +0+0054 <[^>]*> lui \$at,0x1 +0+0058 <[^>]*> addu \$at,\$a1,\$at +0+005c <[^>]*> lw \$a0,-32768\(\$at\) +0+0060 <[^>]*> lw \$a1,-32764\(\$at\) +0+0064 <[^>]*> nop +0+0068 <[^>]*> lw \$a0,-32768\(\$a1\) +0+006c <[^>]*> lw \$a1,-32764\(\$a1\) +0+0070 <[^>]*> lui \$at,0x1 +0+0074 <[^>]*> addu \$at,\$a1,\$at +0+0078 <[^>]*> lw \$a0,0\(\$at\) +0+007c <[^>]*> lw \$a1,4\(\$at\) +0+0080 <[^>]*> lui \$at,0x2 +0+0084 <[^>]*> addu \$at,\$a1,\$at +0+0088 <[^>]*> lw \$a0,-23131\(\$at\) +0+008c <[^>]*> lw \$a1,-23127\(\$at\) +0+0090 <[^>]*> lw \$a0,-16384\(\$gp\) +[ ]*90: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+0094 <[^>]*> lw \$a1,-16380\(\$gp\) +[ ]*94: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+0098 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*98: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+009c <[^>]*> lw \$a1,4\(\$gp\) +[ ]*9c: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+00a0 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*a0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00a4 <[^>]*> lw \$a1,4\(\$gp\) +[ ]*a4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00a8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+00ac <[^>]*> lw \$a1,4\(\$gp\) +[ ]*ac: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+00b0 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*b0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00b4 <[^>]*> lw \$a1,4\(\$gp\) +[ ]*b4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00b8 <[^>]*> lw \$a0,-16384\(\$gp\) +[ ]*b8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00bc <[^>]*> lw \$a1,-16380\(\$gp\) +[ ]*bc: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00c0 <[^>]*> lw \$a0,-15384\(\$gp\) +[ ]*c0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00c4 <[^>]*> lw \$a1,-15380\(\$gp\) +[ ]*c4: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00c8 <[^>]*> lw \$a0,-16383\(\$gp\) +[ ]*c8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+00cc <[^>]*> lw \$a1,-16379\(\$gp\) +[ ]*cc: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+00d0 <[^>]*> lw \$a0,1\(\$gp\) +[ ]*d0: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+00d4 <[^>]*> lw \$a1,5\(\$gp\) +[ ]*d4: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+00d8 <[^>]*> lw \$a0,1\(\$gp\) +[ ]*d8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00dc <[^>]*> lw \$a1,5\(\$gp\) +[ ]*dc: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00e0 <[^>]*> lw \$a0,1\(\$gp\) +[ ]*e0: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+00e4 <[^>]*> lw \$a1,5\(\$gp\) +[ ]*e4: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+00e8 <[^>]*> lw \$a0,1\(\$gp\) +[ ]*e8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00ec <[^>]*> lw \$a1,5\(\$gp\) +[ ]*ec: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00f0 <[^>]*> lw \$a0,-16383\(\$gp\) +[ ]*f0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00f4 <[^>]*> lw \$a1,-16379\(\$gp\) +[ ]*f4: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00f8 <[^>]*> lw \$a0,-15383\(\$gp\) +[ ]*f8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00fc <[^>]*> lw \$a1,-15379\(\$gp\) +[ ]*fc: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0100 <[^>]*> nop +0+0104 <[^>]*> addu \$at,\$a1,\$gp +0+0108 <[^>]*> lw \$a0,-16384\(\$at\) +[ ]*108: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+010c <[^>]*> lw \$a1,-16380\(\$at\) +[ ]*10c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+0110 <[^>]*> nop +0+0114 <[^>]*> addu \$at,\$a1,\$gp +0+0118 <[^>]*> lw \$a0,0\(\$at\) +[ ]*118: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+011c <[^>]*> lw \$a1,4\(\$at\) +[ ]*11c: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+0120 <[^>]*> nop +0+0124 <[^>]*> addu \$at,\$a1,\$gp +0+0128 <[^>]*> lw \$a0,0\(\$at\) +[ ]*128: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+012c <[^>]*> lw \$a1,4\(\$at\) +[ ]*12c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0130 <[^>]*> nop +0+0134 <[^>]*> addu \$at,\$a1,\$gp +0+0138 <[^>]*> lw \$a0,0\(\$at\) +[ ]*138: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+013c <[^>]*> lw \$a1,4\(\$at\) +[ ]*13c: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+0140 <[^>]*> nop +0+0144 <[^>]*> addu \$at,\$a1,\$gp +0+0148 <[^>]*> lw \$a0,0\(\$at\) +[ ]*148: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+014c <[^>]*> lw \$a1,4\(\$at\) +[ ]*14c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0150 <[^>]*> nop +0+0154 <[^>]*> addu \$at,\$a1,\$gp +0+0158 <[^>]*> lw \$a0,-16384\(\$at\) +[ ]*158: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+015c <[^>]*> lw \$a1,-16380\(\$at\) +[ ]*15c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0160 <[^>]*> nop +0+0164 <[^>]*> addu \$at,\$a1,\$gp +0+0168 <[^>]*> lw \$a0,-15384\(\$at\) +[ ]*168: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+016c <[^>]*> lw \$a1,-15380\(\$at\) +[ ]*16c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0170 <[^>]*> nop +0+0174 <[^>]*> addu \$at,\$a1,\$gp +0+0178 <[^>]*> lw \$a0,-16383\(\$at\) +[ ]*178: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+017c <[^>]*> lw \$a1,-16379\(\$at\) +[ ]*17c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+0180 <[^>]*> nop +0+0184 <[^>]*> addu \$at,\$a1,\$gp +0+0188 <[^>]*> lw \$a0,1\(\$at\) +[ ]*188: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+018c <[^>]*> lw \$a1,5\(\$at\) +[ ]*18c: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+0190 <[^>]*> nop +0+0194 <[^>]*> addu \$at,\$a1,\$gp +0+0198 <[^>]*> lw \$a0,1\(\$at\) +[ ]*198: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+019c <[^>]*> lw \$a1,5\(\$at\) +[ ]*19c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+01a0 <[^>]*> nop +0+01a4 <[^>]*> addu \$at,\$a1,\$gp +0+01a8 <[^>]*> lw \$a0,1\(\$at\) +[ ]*1a8: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+01ac <[^>]*> lw \$a1,5\(\$at\) +[ ]*1ac: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+01b0 <[^>]*> nop +0+01b4 <[^>]*> addu \$at,\$a1,\$gp +0+01b8 <[^>]*> lw \$a0,1\(\$at\) +[ ]*1b8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+01bc <[^>]*> lw \$a1,5\(\$at\) +[ ]*1bc: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+01c0 <[^>]*> nop +0+01c4 <[^>]*> addu \$at,\$a1,\$gp +0+01c8 <[^>]*> lw \$a0,-16383\(\$at\) +[ ]*1c8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+01cc <[^>]*> lw \$a1,-16379\(\$at\) +[ ]*1cc: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+01d0 <[^>]*> nop +0+01d4 <[^>]*> addu \$at,\$a1,\$gp +0+01d8 <[^>]*> lw \$a0,-15383\(\$at\) +[ ]*1d8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+01dc <[^>]*> lw \$a1,-15379\(\$at\) +[ ]*1dc: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* diff -urN binutils-2.7/gas/testsuite/gas/mips/ld-pic.s binutils-2.8/gas/testsuite/gas/mips/ld-pic.s --- binutils-2.7/gas/testsuite/gas/mips/ld-pic.s Thu Jul 4 12:15:57 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ld-pic.s Wed Apr 30 12:54:31 1997 @@ -52,3 +52,9 @@ ld $4,small_external_common+1($5) ld $4,big_local_common+1($5) ld $4,small_local_common+1($5) + +# Round to a 16 byte boundary, for ease in testing multiple targets. + .ifndef EMPIC + nop + nop + .endif diff -urN binutils-2.7/gas/testsuite/gas/mips/ld-svr4pic.d binutils-2.8/gas/testsuite/gas/mips/ld-svr4pic.d --- binutils-2.7/gas/testsuite/gas/mips/ld-svr4pic.d Thu Jul 4 12:15:57 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ld-svr4pic.d Wed Apr 30 12:54:32 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS ld-svr4pic #as: -mips1 -KPIC #source: ld-pic.s @@ -8,218 +8,218 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lw \$a0,0\(\$zero\) -0+0004 <[^>]*> lw \$a1,4\(\$zero\) -0+0008 <[^>]*> lw \$a0,1\(\$zero\) -0+000c <[^>]*> lw \$a1,5\(\$zero\) -0+0010 <[^>]*> lui \$at,0x1 -0+0014 <[^>]*> lw \$a0,-32768\(\$at\) -0+0018 <[^>]*> lw \$a1,-32764\(\$at\) -0+001c <[^>]*> lw \$a0,-32768\(\$zero\) -0+0020 <[^>]*> lw \$a1,-32764\(\$zero\) -0+0024 <[^>]*> lui \$at,0x1 -0+0028 <[^>]*> lw \$a0,0\(\$at\) -0+002c <[^>]*> lw \$a1,4\(\$at\) -0+0030 <[^>]*> lui \$at,0x2 -0+0034 <[^>]*> lw \$a0,-23131\(\$at\) -0+0038 <[^>]*> lw \$a1,-23127\(\$at\) -... -0+0040 <[^>]*> lw \$a0,0\(\$a1\) -0+0044 <[^>]*> lw \$a1,4\(\$a1\) -... -0+004c <[^>]*> lw \$a0,1\(\$a1\) -0+0050 <[^>]*> lw \$a1,5\(\$a1\) -0+0054 <[^>]*> lui \$at,0x1 -0+0058 <[^>]*> addu \$at,\$a1,\$at -0+005c <[^>]*> lw \$a0,-32768\(\$at\) -0+0060 <[^>]*> lw \$a1,-32764\(\$at\) -... -0+0068 <[^>]*> lw \$a0,-32768\(\$a1\) -0+006c <[^>]*> lw \$a1,-32764\(\$a1\) -0+0070 <[^>]*> lui \$at,0x1 -0+0074 <[^>]*> addu \$at,\$a1,\$at -0+0078 <[^>]*> lw \$a0,0\(\$at\) -0+007c <[^>]*> lw \$a1,4\(\$at\) -0+0080 <[^>]*> lui \$at,0x2 -0+0084 <[^>]*> addu \$at,\$a1,\$at -0+0088 <[^>]*> lw \$a0,-23131\(\$at\) -0+008c <[^>]*> lw \$a1,-23127\(\$at\) -0+0090 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0090 R_MIPS_GOT16 .data -... -0+0098 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0098 R_MIPS_LO16 .data -0+009c <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+009c R_MIPS_LO16 .data -0+00a0 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00a0 R_MIPS_GOT16 big_external_data_label -... -0+00a8 <[^>]*> lw \$a0,0\(\$at\) -0+00ac <[^>]*> lw \$a1,4\(\$at\) -0+00b0 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00b0 R_MIPS_GOT16 small_external_data_label -... -0+00b8 <[^>]*> lw \$a0,0\(\$at\) -0+00bc <[^>]*> lw \$a1,4\(\$at\) -0+00c0 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00c0 R_MIPS_GOT16 big_external_common -... -0+00c8 <[^>]*> lw \$a0,0\(\$at\) -0+00cc <[^>]*> lw \$a1,4\(\$at\) -0+00d0 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00d0 R_MIPS_GOT16 small_external_common -... -0+00d8 <[^>]*> lw \$a0,0\(\$at\) -0+00dc <[^>]*> lw \$a1,4\(\$at\) -0+00e0 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00e0 R_MIPS_GOT16 .bss -... -0+00e8 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+00e8 R_MIPS_LO16 .bss -0+00ec <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+00ec R_MIPS_LO16 .bss -0+00f0 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00f0 R_MIPS_GOT16 .bss -... -0+00f8 <[^>]*> lw \$a0,1000\(\$at\) -[ ]*RELOC: 0+00f8 R_MIPS_LO16 .bss -0+00fc <[^>]*> lw \$a1,1004\(\$at\) -[ ]*RELOC: 0+00fc R_MIPS_LO16 .bss -0+0100 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0100 R_MIPS_GOT16 .data -... -0+0108 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+0108 R_MIPS_LO16 .data -0+010c <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+010c R_MIPS_LO16 .data -0+0110 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0110 R_MIPS_GOT16 big_external_data_label -... -0+0118 <[^>]*> lw \$a0,1\(\$at\) -0+011c <[^>]*> lw \$a1,5\(\$at\) -0+0120 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0120 R_MIPS_GOT16 small_external_data_label -... -0+0128 <[^>]*> lw \$a0,1\(\$at\) -0+012c <[^>]*> lw \$a1,5\(\$at\) -0+0130 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0130 R_MIPS_GOT16 big_external_common -... -0+0138 <[^>]*> lw \$a0,1\(\$at\) -0+013c <[^>]*> lw \$a1,5\(\$at\) -0+0140 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0140 R_MIPS_GOT16 small_external_common -... -0+0148 <[^>]*> lw \$a0,1\(\$at\) -0+014c <[^>]*> lw \$a1,5\(\$at\) -0+0150 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0150 R_MIPS_GOT16 .bss -... -0+0158 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+0158 R_MIPS_LO16 .bss -0+015c <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+015c R_MIPS_LO16 .bss -0+0160 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0160 R_MIPS_GOT16 .bss -... -0+0168 <[^>]*> lw \$a0,1001\(\$at\) -[ ]*RELOC: 0+0168 R_MIPS_LO16 .bss -0+016c <[^>]*> lw \$a1,1005\(\$at\) -[ ]*RELOC: 0+016c R_MIPS_LO16 .bss -0+0170 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0170 R_MIPS_GOT16 .data -... -0+0178 <[^>]*> addu \$at,\$a1,\$at -0+017c <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+017c R_MIPS_LO16 .data -0+0180 <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+0180 R_MIPS_LO16 .data -0+0184 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0184 R_MIPS_GOT16 big_external_data_label -... -0+018c <[^>]*> addu \$at,\$a1,\$at -0+0190 <[^>]*> lw \$a0,0\(\$at\) -0+0194 <[^>]*> lw \$a1,4\(\$at\) -0+0198 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0198 R_MIPS_GOT16 small_external_data_label -... -0+01a0 <[^>]*> addu \$at,\$a1,\$at -0+01a4 <[^>]*> lw \$a0,0\(\$at\) -0+01a8 <[^>]*> lw \$a1,4\(\$at\) -0+01ac <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+01ac R_MIPS_GOT16 big_external_common -... -0+01b4 <[^>]*> addu \$at,\$a1,\$at -0+01b8 <[^>]*> lw \$a0,0\(\$at\) -0+01bc <[^>]*> lw \$a1,4\(\$at\) -0+01c0 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+01c0 R_MIPS_GOT16 small_external_common -... -0+01c8 <[^>]*> addu \$at,\$a1,\$at -0+01cc <[^>]*> lw \$a0,0\(\$at\) -0+01d0 <[^>]*> lw \$a1,4\(\$at\) -0+01d4 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+01d4 R_MIPS_GOT16 .bss -... -0+01dc <[^>]*> addu \$at,\$a1,\$at -0+01e0 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+01e0 R_MIPS_LO16 .bss -0+01e4 <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+01e4 R_MIPS_LO16 .bss -0+01e8 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+01e8 R_MIPS_GOT16 .bss -... -0+01f0 <[^>]*> addu \$at,\$a1,\$at -0+01f4 <[^>]*> lw \$a0,1000\(\$at\) -[ ]*RELOC: 0+01f4 R_MIPS_LO16 .bss -0+01f8 <[^>]*> lw \$a1,1004\(\$at\) -[ ]*RELOC: 0+01f8 R_MIPS_LO16 .bss -0+01fc <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+01fc R_MIPS_GOT16 .data -... -0+0204 <[^>]*> addu \$at,\$a1,\$at -0+0208 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+0208 R_MIPS_LO16 .data -0+020c <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+020c R_MIPS_LO16 .data -0+0210 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0210 R_MIPS_GOT16 big_external_data_label -... -0+0218 <[^>]*> addu \$at,\$a1,\$at -0+021c <[^>]*> lw \$a0,1\(\$at\) -0+0220 <[^>]*> lw \$a1,5\(\$at\) -0+0224 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0224 R_MIPS_GOT16 small_external_data_label -... -0+022c <[^>]*> addu \$at,\$a1,\$at -0+0230 <[^>]*> lw \$a0,1\(\$at\) -0+0234 <[^>]*> lw \$a1,5\(\$at\) -0+0238 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0238 R_MIPS_GOT16 big_external_common -... -0+0240 <[^>]*> addu \$at,\$a1,\$at -0+0244 <[^>]*> lw \$a0,1\(\$at\) -0+0248 <[^>]*> lw \$a1,5\(\$at\) -0+024c <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+024c R_MIPS_GOT16 small_external_common -... -0+0254 <[^>]*> addu \$at,\$a1,\$at -0+0258 <[^>]*> lw \$a0,1\(\$at\) -0+025c <[^>]*> lw \$a1,5\(\$at\) -0+0260 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0260 R_MIPS_GOT16 .bss -... -0+0268 <[^>]*> addu \$at,\$a1,\$at -0+026c <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+026c R_MIPS_LO16 .bss -0+0270 <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+0270 R_MIPS_LO16 .bss -0+0274 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0274 R_MIPS_GOT16 .bss -... -0+027c <[^>]*> addu \$at,\$a1,\$at -0+0280 <[^>]*> lw \$a0,1001\(\$at\) -[ ]*RELOC: 0+0280 R_MIPS_LO16 .bss -0+0284 <[^>]*> lw \$a1,1005\(\$at\) -[ ]*RELOC: 0+0284 R_MIPS_LO16 .bss -... +0+0000 <[^>]*> lw \$a0,0\(\$zero\) +0+0004 <[^>]*> lw \$a1,4\(\$zero\) +0+0008 <[^>]*> lw \$a0,1\(\$zero\) +0+000c <[^>]*> lw \$a1,5\(\$zero\) +0+0010 <[^>]*> lui \$at,0x1 +0+0014 <[^>]*> lw \$a0,-32768\(\$at\) +0+0018 <[^>]*> lw \$a1,-32764\(\$at\) +0+001c <[^>]*> lw \$a0,-32768\(\$zero\) +0+0020 <[^>]*> lw \$a1,-32764\(\$zero\) +0+0024 <[^>]*> lui \$at,0x1 +0+0028 <[^>]*> lw \$a0,0\(\$at\) +0+002c <[^>]*> lw \$a1,4\(\$at\) +0+0030 <[^>]*> lui \$at,0x2 +0+0034 <[^>]*> lw \$a0,-23131\(\$at\) +0+0038 <[^>]*> lw \$a1,-23127\(\$at\) +0+003c <[^>]*> nop +0+0040 <[^>]*> lw \$a0,0\(\$a1\) +0+0044 <[^>]*> lw \$a1,4\(\$a1\) +0+0048 <[^>]*> nop +0+004c <[^>]*> lw \$a0,1\(\$a1\) +0+0050 <[^>]*> lw \$a1,5\(\$a1\) +0+0054 <[^>]*> lui \$at,0x1 +0+0058 <[^>]*> addu \$at,\$a1,\$at +0+005c <[^>]*> lw \$a0,-32768\(\$at\) +0+0060 <[^>]*> lw \$a1,-32764\(\$at\) +0+0064 <[^>]*> nop +0+0068 <[^>]*> lw \$a0,-32768\(\$a1\) +0+006c <[^>]*> lw \$a1,-32764\(\$a1\) +0+0070 <[^>]*> lui \$at,0x1 +0+0074 <[^>]*> addu \$at,\$a1,\$at +0+0078 <[^>]*> lw \$a0,0\(\$at\) +0+007c <[^>]*> lw \$a1,4\(\$at\) +0+0080 <[^>]*> lui \$at,0x2 +0+0084 <[^>]*> addu \$at,\$a1,\$at +0+0088 <[^>]*> lw \$a0,-23131\(\$at\) +0+008c <[^>]*> lw \$a1,-23127\(\$at\) +0+0090 <[^>]*> lw \$at,0\(\$gp\) +[ ]*90: R_MIPS_GOT16 .data +0+0094 <[^>]*> nop +0+0098 <[^>]*> lw \$a0,0\(\$at\) +[ ]*98: R_MIPS_LO16 .data +0+009c <[^>]*> lw \$a1,4\(\$at\) +[ ]*9c: R_MIPS_LO16 .data +0+00a0 <[^>]*> lw \$at,0\(\$gp\) +[ ]*a0: R_MIPS_GOT16 big_external_data_label +0+00a4 <[^>]*> nop +0+00a8 <[^>]*> lw \$a0,0\(\$at\) +0+00ac <[^>]*> lw \$a1,4\(\$at\) +0+00b0 <[^>]*> lw \$at,0\(\$gp\) +[ ]*b0: R_MIPS_GOT16 small_external_data_label +0+00b4 <[^>]*> nop +0+00b8 <[^>]*> lw \$a0,0\(\$at\) +0+00bc <[^>]*> lw \$a1,4\(\$at\) +0+00c0 <[^>]*> lw \$at,0\(\$gp\) +[ ]*c0: R_MIPS_GOT16 big_external_common +0+00c4 <[^>]*> nop +0+00c8 <[^>]*> lw \$a0,0\(\$at\) +0+00cc <[^>]*> lw \$a1,4\(\$at\) +0+00d0 <[^>]*> lw \$at,0\(\$gp\) +[ ]*d0: R_MIPS_GOT16 small_external_common +0+00d4 <[^>]*> nop +0+00d8 <[^>]*> lw \$a0,0\(\$at\) +0+00dc <[^>]*> lw \$a1,4\(\$at\) +0+00e0 <[^>]*> lw \$at,0\(\$gp\) +[ ]*e0: R_MIPS_GOT16 .bss +0+00e4 <[^>]*> nop +0+00e8 <[^>]*> lw \$a0,0\(\$at\) +[ ]*e8: R_MIPS_LO16 .bss +0+00ec <[^>]*> lw \$a1,4\(\$at\) +[ ]*ec: R_MIPS_LO16 .bss +0+00f0 <[^>]*> lw \$at,0\(\$gp\) +[ ]*f0: R_MIPS_GOT16 .bss +0+00f4 <[^>]*> nop +0+00f8 <[^>]*> lw \$a0,1000\(\$at\) +[ ]*f8: R_MIPS_LO16 .bss +0+00fc <[^>]*> lw \$a1,1004\(\$at\) +[ ]*fc: R_MIPS_LO16 .bss +0+0100 <[^>]*> lw \$at,0\(\$gp\) +[ ]*100: R_MIPS_GOT16 .data +0+0104 <[^>]*> nop +0+0108 <[^>]*> lw \$a0,1\(\$at\) +[ ]*108: R_MIPS_LO16 .data +0+010c <[^>]*> lw \$a1,5\(\$at\) +[ ]*10c: R_MIPS_LO16 .data +0+0110 <[^>]*> lw \$at,0\(\$gp\) +[ ]*110: R_MIPS_GOT16 big_external_data_label +0+0114 <[^>]*> nop +0+0118 <[^>]*> lw \$a0,1\(\$at\) +0+011c <[^>]*> lw \$a1,5\(\$at\) +0+0120 <[^>]*> lw \$at,0\(\$gp\) +[ ]*120: R_MIPS_GOT16 small_external_data_label +0+0124 <[^>]*> nop +0+0128 <[^>]*> lw \$a0,1\(\$at\) +0+012c <[^>]*> lw \$a1,5\(\$at\) +0+0130 <[^>]*> lw \$at,0\(\$gp\) +[ ]*130: R_MIPS_GOT16 big_external_common +0+0134 <[^>]*> nop +0+0138 <[^>]*> lw \$a0,1\(\$at\) +0+013c <[^>]*> lw \$a1,5\(\$at\) +0+0140 <[^>]*> lw \$at,0\(\$gp\) +[ ]*140: R_MIPS_GOT16 small_external_common +0+0144 <[^>]*> nop +0+0148 <[^>]*> lw \$a0,1\(\$at\) +0+014c <[^>]*> lw \$a1,5\(\$at\) +0+0150 <[^>]*> lw \$at,0\(\$gp\) +[ ]*150: R_MIPS_GOT16 .bss +0+0154 <[^>]*> nop +0+0158 <[^>]*> lw \$a0,1\(\$at\) +[ ]*158: R_MIPS_LO16 .bss +0+015c <[^>]*> lw \$a1,5\(\$at\) +[ ]*15c: R_MIPS_LO16 .bss +0+0160 <[^>]*> lw \$at,0\(\$gp\) +[ ]*160: R_MIPS_GOT16 .bss +0+0164 <[^>]*> nop +0+0168 <[^>]*> lw \$a0,1001\(\$at\) +[ ]*168: R_MIPS_LO16 .bss +0+016c <[^>]*> lw \$a1,1005\(\$at\) +[ ]*16c: R_MIPS_LO16 .bss +0+0170 <[^>]*> lw \$at,0\(\$gp\) +[ ]*170: R_MIPS_GOT16 .data +0+0174 <[^>]*> nop +0+0178 <[^>]*> addu \$at,\$a1,\$at +0+017c <[^>]*> lw \$a0,0\(\$at\) +[ ]*17c: R_MIPS_LO16 .data +0+0180 <[^>]*> lw \$a1,4\(\$at\) +[ ]*180: R_MIPS_LO16 .data +0+0184 <[^>]*> lw \$at,0\(\$gp\) +[ ]*184: R_MIPS_GOT16 big_external_data_label +0+0188 <[^>]*> nop +0+018c <[^>]*> addu \$at,\$a1,\$at +0+0190 <[^>]*> lw \$a0,0\(\$at\) +0+0194 <[^>]*> lw \$a1,4\(\$at\) +0+0198 <[^>]*> lw \$at,0\(\$gp\) +[ ]*198: R_MIPS_GOT16 small_external_data_label +0+019c <[^>]*> nop +0+01a0 <[^>]*> addu \$at,\$a1,\$at +0+01a4 <[^>]*> lw \$a0,0\(\$at\) +0+01a8 <[^>]*> lw \$a1,4\(\$at\) +0+01ac <[^>]*> lw \$at,0\(\$gp\) +[ ]*1ac: R_MIPS_GOT16 big_external_common +0+01b0 <[^>]*> nop +0+01b4 <[^>]*> addu \$at,\$a1,\$at +0+01b8 <[^>]*> lw \$a0,0\(\$at\) +0+01bc <[^>]*> lw \$a1,4\(\$at\) +0+01c0 <[^>]*> lw \$at,0\(\$gp\) +[ ]*1c0: R_MIPS_GOT16 small_external_common +0+01c4 <[^>]*> nop +0+01c8 <[^>]*> addu \$at,\$a1,\$at +0+01cc <[^>]*> lw \$a0,0\(\$at\) +0+01d0 <[^>]*> lw \$a1,4\(\$at\) +0+01d4 <[^>]*> lw \$at,0\(\$gp\) +[ ]*1d4: R_MIPS_GOT16 .bss +0+01d8 <[^>]*> nop +0+01dc <[^>]*> addu \$at,\$a1,\$at +0+01e0 <[^>]*> lw \$a0,0\(\$at\) +[ ]*1e0: R_MIPS_LO16 .bss +0+01e4 <[^>]*> lw \$a1,4\(\$at\) +[ ]*1e4: R_MIPS_LO16 .bss +0+01e8 <[^>]*> lw \$at,0\(\$gp\) +[ ]*1e8: R_MIPS_GOT16 .bss +0+01ec <[^>]*> nop +0+01f0 <[^>]*> addu \$at,\$a1,\$at +0+01f4 <[^>]*> lw \$a0,1000\(\$at\) +[ ]*1f4: R_MIPS_LO16 .bss +0+01f8 <[^>]*> lw \$a1,1004\(\$at\) +[ ]*1f8: R_MIPS_LO16 .bss +0+01fc <[^>]*> lw \$at,0\(\$gp\) +[ ]*1fc: R_MIPS_GOT16 .data +0+0200 <[^>]*> nop +0+0204 <[^>]*> addu \$at,\$a1,\$at +0+0208 <[^>]*> lw \$a0,1\(\$at\) +[ ]*208: R_MIPS_LO16 .data +0+020c <[^>]*> lw \$a1,5\(\$at\) +[ ]*20c: R_MIPS_LO16 .data +0+0210 <[^>]*> lw \$at,0\(\$gp\) +[ ]*210: R_MIPS_GOT16 big_external_data_label +0+0214 <[^>]*> nop +0+0218 <[^>]*> addu \$at,\$a1,\$at +0+021c <[^>]*> lw \$a0,1\(\$at\) +0+0220 <[^>]*> lw \$a1,5\(\$at\) +0+0224 <[^>]*> lw \$at,0\(\$gp\) +[ ]*224: R_MIPS_GOT16 small_external_data_label +0+0228 <[^>]*> nop +0+022c <[^>]*> addu \$at,\$a1,\$at +0+0230 <[^>]*> lw \$a0,1\(\$at\) +0+0234 <[^>]*> lw \$a1,5\(\$at\) +0+0238 <[^>]*> lw \$at,0\(\$gp\) +[ ]*238: R_MIPS_GOT16 big_external_common +0+023c <[^>]*> nop +0+0240 <[^>]*> addu \$at,\$a1,\$at +0+0244 <[^>]*> lw \$a0,1\(\$at\) +0+0248 <[^>]*> lw \$a1,5\(\$at\) +0+024c <[^>]*> lw \$at,0\(\$gp\) +[ ]*24c: R_MIPS_GOT16 small_external_common +0+0250 <[^>]*> nop +0+0254 <[^>]*> addu \$at,\$a1,\$at +0+0258 <[^>]*> lw \$a0,1\(\$at\) +0+025c <[^>]*> lw \$a1,5\(\$at\) +0+0260 <[^>]*> lw \$at,0\(\$gp\) +[ ]*260: R_MIPS_GOT16 .bss +0+0264 <[^>]*> nop +0+0268 <[^>]*> addu \$at,\$a1,\$at +0+026c <[^>]*> lw \$a0,1\(\$at\) +[ ]*26c: R_MIPS_LO16 .bss +0+0270 <[^>]*> lw \$a1,5\(\$at\) +[ ]*270: R_MIPS_LO16 .bss +0+0274 <[^>]*> lw \$at,0\(\$gp\) +[ ]*274: R_MIPS_GOT16 .bss +0+0278 <[^>]*> nop +0+027c <[^>]*> addu \$at,\$a1,\$at +0+0280 <[^>]*> lw \$a0,1001\(\$at\) +[ ]*280: R_MIPS_LO16 .bss +0+0284 <[^>]*> lw \$a1,1005\(\$at\) +[ ]*284: R_MIPS_LO16 .bss + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/ld-xgot.d binutils-2.8/gas/testsuite/gas/mips/ld-xgot.d --- binutils-2.7/gas/testsuite/gas/mips/ld-xgot.d Thu Jul 4 12:15:57 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ld-xgot.d Wed Apr 30 12:54:32 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS ld-xgot #as: -mips1 -KPIC -xgot #source: ld-pic.s @@ -8,266 +8,266 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lw \$a0,0\(\$zero\) -0+0004 <[^>]*> lw \$a1,4\(\$zero\) -0+0008 <[^>]*> lw \$a0,1\(\$zero\) -0+000c <[^>]*> lw \$a1,5\(\$zero\) -0+0010 <[^>]*> lui \$at,0x1 -0+0014 <[^>]*> lw \$a0,-32768\(\$at\) -0+0018 <[^>]*> lw \$a1,-32764\(\$at\) -0+001c <[^>]*> lw \$a0,-32768\(\$zero\) -0+0020 <[^>]*> lw \$a1,-32764\(\$zero\) -0+0024 <[^>]*> lui \$at,0x1 -0+0028 <[^>]*> lw \$a0,0\(\$at\) -0+002c <[^>]*> lw \$a1,4\(\$at\) -0+0030 <[^>]*> lui \$at,0x2 -0+0034 <[^>]*> lw \$a0,-23131\(\$at\) -0+0038 <[^>]*> lw \$a1,-23127\(\$at\) -... -0+0040 <[^>]*> lw \$a0,0\(\$a1\) -0+0044 <[^>]*> lw \$a1,4\(\$a1\) -... -0+004c <[^>]*> lw \$a0,1\(\$a1\) -0+0050 <[^>]*> lw \$a1,5\(\$a1\) -0+0054 <[^>]*> lui \$at,0x1 -0+0058 <[^>]*> addu \$at,\$a1,\$at -0+005c <[^>]*> lw \$a0,-32768\(\$at\) -0+0060 <[^>]*> lw \$a1,-32764\(\$at\) -... -0+0068 <[^>]*> lw \$a0,-32768\(\$a1\) -0+006c <[^>]*> lw \$a1,-32764\(\$a1\) -0+0070 <[^>]*> lui \$at,0x1 -0+0074 <[^>]*> addu \$at,\$a1,\$at -0+0078 <[^>]*> lw \$a0,0\(\$at\) -0+007c <[^>]*> lw \$a1,4\(\$at\) -0+0080 <[^>]*> lui \$at,0x2 -0+0084 <[^>]*> addu \$at,\$a1,\$at -0+0088 <[^>]*> lw \$a0,-23131\(\$at\) -0+008c <[^>]*> lw \$a1,-23127\(\$at\) -0+0090 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0090 R_MIPS_GOT16 .data -... -0+0098 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0098 R_MIPS_LO16 .data -0+009c <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+009c R_MIPS_LO16 .data -0+00a0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00a0 R_MIPS_GOT_HI16 big_external_data_label -0+00a4 <[^>]*> addu \$at,\$at,\$gp -0+00a8 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+00a8 R_MIPS_GOT_LO16 big_external_data_label -... -0+00b0 <[^>]*> lw \$a0,0\(\$at\) -0+00b4 <[^>]*> lw \$a1,4\(\$at\) -0+00b8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00b8 R_MIPS_GOT_HI16 small_external_data_label -0+00bc <[^>]*> addu \$at,\$at,\$gp -0+00c0 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+00c0 R_MIPS_GOT_LO16 small_external_data_label -... -0+00c8 <[^>]*> lw \$a0,0\(\$at\) -0+00cc <[^>]*> lw \$a1,4\(\$at\) -0+00d0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00d0 R_MIPS_GOT_HI16 big_external_common -0+00d4 <[^>]*> addu \$at,\$at,\$gp -0+00d8 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+00d8 R_MIPS_GOT_LO16 big_external_common -... -0+00e0 <[^>]*> lw \$a0,0\(\$at\) -0+00e4 <[^>]*> lw \$a1,4\(\$at\) -0+00e8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00e8 R_MIPS_GOT_HI16 small_external_common -0+00ec <[^>]*> addu \$at,\$at,\$gp -0+00f0 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+00f0 R_MIPS_GOT_LO16 small_external_common -... -0+00f8 <[^>]*> lw \$a0,0\(\$at\) -0+00fc <[^>]*> lw \$a1,4\(\$at\) -0+0100 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0100 R_MIPS_GOT16 .bss -... -0+0108 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0108 R_MIPS_LO16 .bss -0+010c <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+010c R_MIPS_LO16 .bss -0+0110 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0110 R_MIPS_GOT16 .bss -... -0+0118 <[^>]*> lw \$a0,1000\(\$at\) -[ ]*RELOC: 0+0118 R_MIPS_LO16 .bss -0+011c <[^>]*> lw \$a1,1004\(\$at\) -[ ]*RELOC: 0+011c R_MIPS_LO16 .bss -0+0120 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0120 R_MIPS_GOT16 .data -... -0+0128 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+0128 R_MIPS_LO16 .data -0+012c <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+012c R_MIPS_LO16 .data -0+0130 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0130 R_MIPS_GOT_HI16 big_external_data_label -0+0134 <[^>]*> addu \$at,\$at,\$gp -0+0138 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0138 R_MIPS_GOT_LO16 big_external_data_label -... -0+0140 <[^>]*> lw \$a0,1\(\$at\) -0+0144 <[^>]*> lw \$a1,5\(\$at\) -0+0148 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0148 R_MIPS_GOT_HI16 small_external_data_label -0+014c <[^>]*> addu \$at,\$at,\$gp -0+0150 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0150 R_MIPS_GOT_LO16 small_external_data_label -... -0+0158 <[^>]*> lw \$a0,1\(\$at\) -0+015c <[^>]*> lw \$a1,5\(\$at\) -0+0160 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0160 R_MIPS_GOT_HI16 big_external_common -0+0164 <[^>]*> addu \$at,\$at,\$gp -0+0168 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0168 R_MIPS_GOT_LO16 big_external_common -... -0+0170 <[^>]*> lw \$a0,1\(\$at\) -0+0174 <[^>]*> lw \$a1,5\(\$at\) -0+0178 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0178 R_MIPS_GOT_HI16 small_external_common -0+017c <[^>]*> addu \$at,\$at,\$gp -0+0180 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0180 R_MIPS_GOT_LO16 small_external_common -... -0+0188 <[^>]*> lw \$a0,1\(\$at\) -0+018c <[^>]*> lw \$a1,5\(\$at\) -0+0190 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0190 R_MIPS_GOT16 .bss -... -0+0198 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+0198 R_MIPS_LO16 .bss -0+019c <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+019c R_MIPS_LO16 .bss -0+01a0 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+01a0 R_MIPS_GOT16 .bss -... -0+01a8 <[^>]*> lw \$a0,1001\(\$at\) -[ ]*RELOC: 0+01a8 R_MIPS_LO16 .bss -0+01ac <[^>]*> lw \$a1,1005\(\$at\) -[ ]*RELOC: 0+01ac R_MIPS_LO16 .bss -0+01b0 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+01b0 R_MIPS_GOT16 .data -... -0+01b8 <[^>]*> addu \$at,\$a1,\$at -0+01bc <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+01bc R_MIPS_LO16 .data -0+01c0 <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+01c0 R_MIPS_LO16 .data -0+01c4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01c4 R_MIPS_GOT_HI16 big_external_data_label -0+01c8 <[^>]*> addu \$at,\$at,\$gp -0+01cc <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+01cc R_MIPS_GOT_LO16 big_external_data_label -... -0+01d4 <[^>]*> addu \$at,\$a1,\$at -0+01d8 <[^>]*> lw \$a0,0\(\$at\) -0+01dc <[^>]*> lw \$a1,4\(\$at\) -0+01e0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01e0 R_MIPS_GOT_HI16 small_external_data_label -0+01e4 <[^>]*> addu \$at,\$at,\$gp -0+01e8 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+01e8 R_MIPS_GOT_LO16 small_external_data_label -... -0+01f0 <[^>]*> addu \$at,\$a1,\$at -0+01f4 <[^>]*> lw \$a0,0\(\$at\) -0+01f8 <[^>]*> lw \$a1,4\(\$at\) -0+01fc <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01fc R_MIPS_GOT_HI16 big_external_common -0+0200 <[^>]*> addu \$at,\$at,\$gp -0+0204 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0204 R_MIPS_GOT_LO16 big_external_common -... -0+020c <[^>]*> addu \$at,\$a1,\$at -0+0210 <[^>]*> lw \$a0,0\(\$at\) -0+0214 <[^>]*> lw \$a1,4\(\$at\) -0+0218 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0218 R_MIPS_GOT_HI16 small_external_common -0+021c <[^>]*> addu \$at,\$at,\$gp -0+0220 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0220 R_MIPS_GOT_LO16 small_external_common -... -0+0228 <[^>]*> addu \$at,\$a1,\$at -0+022c <[^>]*> lw \$a0,0\(\$at\) -0+0230 <[^>]*> lw \$a1,4\(\$at\) -0+0234 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0234 R_MIPS_GOT16 .bss -... -0+023c <[^>]*> addu \$at,\$a1,\$at -0+0240 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0240 R_MIPS_LO16 .bss -0+0244 <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+0244 R_MIPS_LO16 .bss -0+0248 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0248 R_MIPS_GOT16 .bss -... -0+0250 <[^>]*> addu \$at,\$a1,\$at -0+0254 <[^>]*> lw \$a0,1000\(\$at\) -[ ]*RELOC: 0+0254 R_MIPS_LO16 .bss -0+0258 <[^>]*> lw \$a1,1004\(\$at\) -[ ]*RELOC: 0+0258 R_MIPS_LO16 .bss -0+025c <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+025c R_MIPS_GOT16 .data -... -0+0264 <[^>]*> addu \$at,\$a1,\$at -0+0268 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+0268 R_MIPS_LO16 .data -0+026c <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+026c R_MIPS_LO16 .data -0+0270 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0270 R_MIPS_GOT_HI16 big_external_data_label -0+0274 <[^>]*> addu \$at,\$at,\$gp -0+0278 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0278 R_MIPS_GOT_LO16 big_external_data_label -... -0+0280 <[^>]*> addu \$at,\$a1,\$at -0+0284 <[^>]*> lw \$a0,1\(\$at\) -0+0288 <[^>]*> lw \$a1,5\(\$at\) -0+028c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+028c R_MIPS_GOT_HI16 small_external_data_label -0+0290 <[^>]*> addu \$at,\$at,\$gp -0+0294 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0294 R_MIPS_GOT_LO16 small_external_data_label -... -0+029c <[^>]*> addu \$at,\$a1,\$at -0+02a0 <[^>]*> lw \$a0,1\(\$at\) -0+02a4 <[^>]*> lw \$a1,5\(\$at\) -0+02a8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02a8 R_MIPS_GOT_HI16 big_external_common -0+02ac <[^>]*> addu \$at,\$at,\$gp -0+02b0 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+02b0 R_MIPS_GOT_LO16 big_external_common -... -0+02b8 <[^>]*> addu \$at,\$a1,\$at -0+02bc <[^>]*> lw \$a0,1\(\$at\) -0+02c0 <[^>]*> lw \$a1,5\(\$at\) -0+02c4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02c4 R_MIPS_GOT_HI16 small_external_common -0+02c8 <[^>]*> addu \$at,\$at,\$gp -0+02cc <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+02cc R_MIPS_GOT_LO16 small_external_common -... -0+02d4 <[^>]*> addu \$at,\$a1,\$at -0+02d8 <[^>]*> lw \$a0,1\(\$at\) -0+02dc <[^>]*> lw \$a1,5\(\$at\) -0+02e0 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+02e0 R_MIPS_GOT16 .bss -... -0+02e8 <[^>]*> addu \$at,\$a1,\$at -0+02ec <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+02ec R_MIPS_LO16 .bss -0+02f0 <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+02f0 R_MIPS_LO16 .bss -0+02f4 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+02f4 R_MIPS_GOT16 .bss -... -0+02fc <[^>]*> addu \$at,\$a1,\$at -0+0300 <[^>]*> lw \$a0,1001\(\$at\) -[ ]*RELOC: 0+0300 R_MIPS_LO16 .bss -0+0304 <[^>]*> lw \$a1,1005\(\$at\) -[ ]*RELOC: 0+0304 R_MIPS_LO16 .bss -... +0+0000 <[^>]*> lw \$a0,0\(\$zero\) +0+0004 <[^>]*> lw \$a1,4\(\$zero\) +0+0008 <[^>]*> lw \$a0,1\(\$zero\) +0+000c <[^>]*> lw \$a1,5\(\$zero\) +0+0010 <[^>]*> lui \$at,0x1 +0+0014 <[^>]*> lw \$a0,-32768\(\$at\) +0+0018 <[^>]*> lw \$a1,-32764\(\$at\) +0+001c <[^>]*> lw \$a0,-32768\(\$zero\) +0+0020 <[^>]*> lw \$a1,-32764\(\$zero\) +0+0024 <[^>]*> lui \$at,0x1 +0+0028 <[^>]*> lw \$a0,0\(\$at\) +0+002c <[^>]*> lw \$a1,4\(\$at\) +0+0030 <[^>]*> lui \$at,0x2 +0+0034 <[^>]*> lw \$a0,-23131\(\$at\) +0+0038 <[^>]*> lw \$a1,-23127\(\$at\) +0+003c <[^>]*> nop +0+0040 <[^>]*> lw \$a0,0\(\$a1\) +0+0044 <[^>]*> lw \$a1,4\(\$a1\) +0+0048 <[^>]*> nop +0+004c <[^>]*> lw \$a0,1\(\$a1\) +0+0050 <[^>]*> lw \$a1,5\(\$a1\) +0+0054 <[^>]*> lui \$at,0x1 +0+0058 <[^>]*> addu \$at,\$a1,\$at +0+005c <[^>]*> lw \$a0,-32768\(\$at\) +0+0060 <[^>]*> lw \$a1,-32764\(\$at\) +0+0064 <[^>]*> nop +0+0068 <[^>]*> lw \$a0,-32768\(\$a1\) +0+006c <[^>]*> lw \$a1,-32764\(\$a1\) +0+0070 <[^>]*> lui \$at,0x1 +0+0074 <[^>]*> addu \$at,\$a1,\$at +0+0078 <[^>]*> lw \$a0,0\(\$at\) +0+007c <[^>]*> lw \$a1,4\(\$at\) +0+0080 <[^>]*> lui \$at,0x2 +0+0084 <[^>]*> addu \$at,\$a1,\$at +0+0088 <[^>]*> lw \$a0,-23131\(\$at\) +0+008c <[^>]*> lw \$a1,-23127\(\$at\) +0+0090 <[^>]*> lw \$at,0\(\$gp\) +[ ]*90: R_MIPS_GOT16 .data +0+0094 <[^>]*> nop +0+0098 <[^>]*> lw \$a0,0\(\$at\) +[ ]*98: R_MIPS_LO16 .data +0+009c <[^>]*> lw \$a1,4\(\$at\) +[ ]*9c: R_MIPS_LO16 .data +0+00a0 <[^>]*> lui \$at,0x0 +[ ]*a0: R_MIPS_GOT_HI16 big_external_data_label +0+00a4 <[^>]*> addu \$at,\$at,\$gp +0+00a8 <[^>]*> lw \$at,0\(\$at\) +[ ]*a8: R_MIPS_GOT_LO16 big_external_data_label +0+00ac <[^>]*> nop +0+00b0 <[^>]*> lw \$a0,0\(\$at\) +0+00b4 <[^>]*> lw \$a1,4\(\$at\) +0+00b8 <[^>]*> lui \$at,0x0 +[ ]*b8: R_MIPS_GOT_HI16 small_external_data_label +0+00bc <[^>]*> addu \$at,\$at,\$gp +0+00c0 <[^>]*> lw \$at,0\(\$at\) +[ ]*c0: R_MIPS_GOT_LO16 small_external_data_label +0+00c4 <[^>]*> nop +0+00c8 <[^>]*> lw \$a0,0\(\$at\) +0+00cc <[^>]*> lw \$a1,4\(\$at\) +0+00d0 <[^>]*> lui \$at,0x0 +[ ]*d0: R_MIPS_GOT_HI16 big_external_common +0+00d4 <[^>]*> addu \$at,\$at,\$gp +0+00d8 <[^>]*> lw \$at,0\(\$at\) +[ ]*d8: R_MIPS_GOT_LO16 big_external_common +0+00dc <[^>]*> nop +0+00e0 <[^>]*> lw \$a0,0\(\$at\) +0+00e4 <[^>]*> lw \$a1,4\(\$at\) +0+00e8 <[^>]*> lui \$at,0x0 +[ ]*e8: R_MIPS_GOT_HI16 small_external_common +0+00ec <[^>]*> addu \$at,\$at,\$gp +0+00f0 <[^>]*> lw \$at,0\(\$at\) +[ ]*f0: R_MIPS_GOT_LO16 small_external_common +0+00f4 <[^>]*> nop +0+00f8 <[^>]*> lw \$a0,0\(\$at\) +0+00fc <[^>]*> lw \$a1,4\(\$at\) +0+0100 <[^>]*> lw \$at,0\(\$gp\) +[ ]*100: R_MIPS_GOT16 .bss +0+0104 <[^>]*> nop +0+0108 <[^>]*> lw \$a0,0\(\$at\) +[ ]*108: R_MIPS_LO16 .bss +0+010c <[^>]*> lw \$a1,4\(\$at\) +[ ]*10c: R_MIPS_LO16 .bss +0+0110 <[^>]*> lw \$at,0\(\$gp\) +[ ]*110: R_MIPS_GOT16 .bss +0+0114 <[^>]*> nop +0+0118 <[^>]*> lw \$a0,1000\(\$at\) +[ ]*118: R_MIPS_LO16 .bss +0+011c <[^>]*> lw \$a1,1004\(\$at\) +[ ]*11c: R_MIPS_LO16 .bss +0+0120 <[^>]*> lw \$at,0\(\$gp\) +[ ]*120: R_MIPS_GOT16 .data +0+0124 <[^>]*> nop +0+0128 <[^>]*> lw \$a0,1\(\$at\) +[ ]*128: R_MIPS_LO16 .data +0+012c <[^>]*> lw \$a1,5\(\$at\) +[ ]*12c: R_MIPS_LO16 .data +0+0130 <[^>]*> lui \$at,0x0 +[ ]*130: R_MIPS_GOT_HI16 big_external_data_label +0+0134 <[^>]*> addu \$at,\$at,\$gp +0+0138 <[^>]*> lw \$at,0\(\$at\) +[ ]*138: R_MIPS_GOT_LO16 big_external_data_label +0+013c <[^>]*> nop +0+0140 <[^>]*> lw \$a0,1\(\$at\) +0+0144 <[^>]*> lw \$a1,5\(\$at\) +0+0148 <[^>]*> lui \$at,0x0 +[ ]*148: R_MIPS_GOT_HI16 small_external_data_label +0+014c <[^>]*> addu \$at,\$at,\$gp +0+0150 <[^>]*> lw \$at,0\(\$at\) +[ ]*150: R_MIPS_GOT_LO16 small_external_data_label +0+0154 <[^>]*> nop +0+0158 <[^>]*> lw \$a0,1\(\$at\) +0+015c <[^>]*> lw \$a1,5\(\$at\) +0+0160 <[^>]*> lui \$at,0x0 +[ ]*160: R_MIPS_GOT_HI16 big_external_common +0+0164 <[^>]*> addu \$at,\$at,\$gp +0+0168 <[^>]*> lw \$at,0\(\$at\) +[ ]*168: R_MIPS_GOT_LO16 big_external_common +0+016c <[^>]*> nop +0+0170 <[^>]*> lw \$a0,1\(\$at\) +0+0174 <[^>]*> lw \$a1,5\(\$at\) +0+0178 <[^>]*> lui \$at,0x0 +[ ]*178: R_MIPS_GOT_HI16 small_external_common +0+017c <[^>]*> addu \$at,\$at,\$gp +0+0180 <[^>]*> lw \$at,0\(\$at\) +[ ]*180: R_MIPS_GOT_LO16 small_external_common +0+0184 <[^>]*> nop +0+0188 <[^>]*> lw \$a0,1\(\$at\) +0+018c <[^>]*> lw \$a1,5\(\$at\) +0+0190 <[^>]*> lw \$at,0\(\$gp\) +[ ]*190: R_MIPS_GOT16 .bss +0+0194 <[^>]*> nop +0+0198 <[^>]*> lw \$a0,1\(\$at\) +[ ]*198: R_MIPS_LO16 .bss +0+019c <[^>]*> lw \$a1,5\(\$at\) +[ ]*19c: R_MIPS_LO16 .bss +0+01a0 <[^>]*> lw \$at,0\(\$gp\) +[ ]*1a0: R_MIPS_GOT16 .bss +0+01a4 <[^>]*> nop +0+01a8 <[^>]*> lw \$a0,1001\(\$at\) +[ ]*1a8: R_MIPS_LO16 .bss +0+01ac <[^>]*> lw \$a1,1005\(\$at\) +[ ]*1ac: R_MIPS_LO16 .bss +0+01b0 <[^>]*> lw \$at,0\(\$gp\) +[ ]*1b0: R_MIPS_GOT16 .data +0+01b4 <[^>]*> nop +0+01b8 <[^>]*> addu \$at,\$a1,\$at +0+01bc <[^>]*> lw \$a0,0\(\$at\) +[ ]*1bc: R_MIPS_LO16 .data +0+01c0 <[^>]*> lw \$a1,4\(\$at\) +[ ]*1c0: R_MIPS_LO16 .data +0+01c4 <[^>]*> lui \$at,0x0 +[ ]*1c4: R_MIPS_GOT_HI16 big_external_data_label +0+01c8 <[^>]*> addu \$at,\$at,\$gp +0+01cc <[^>]*> lw \$at,0\(\$at\) +[ ]*1cc: R_MIPS_GOT_LO16 big_external_data_label +0+01d0 <[^>]*> nop +0+01d4 <[^>]*> addu \$at,\$a1,\$at +0+01d8 <[^>]*> lw \$a0,0\(\$at\) +0+01dc <[^>]*> lw \$a1,4\(\$at\) +0+01e0 <[^>]*> lui \$at,0x0 +[ ]*1e0: R_MIPS_GOT_HI16 small_external_data_label +0+01e4 <[^>]*> addu \$at,\$at,\$gp +0+01e8 <[^>]*> lw \$at,0\(\$at\) +[ ]*1e8: R_MIPS_GOT_LO16 small_external_data_label +0+01ec <[^>]*> nop +0+01f0 <[^>]*> addu \$at,\$a1,\$at +0+01f4 <[^>]*> lw \$a0,0\(\$at\) +0+01f8 <[^>]*> lw \$a1,4\(\$at\) +0+01fc <[^>]*> lui \$at,0x0 +[ ]*1fc: R_MIPS_GOT_HI16 big_external_common +0+0200 <[^>]*> addu \$at,\$at,\$gp +0+0204 <[^>]*> lw \$at,0\(\$at\) +[ ]*204: R_MIPS_GOT_LO16 big_external_common +0+0208 <[^>]*> nop +0+020c <[^>]*> addu \$at,\$a1,\$at +0+0210 <[^>]*> lw \$a0,0\(\$at\) +0+0214 <[^>]*> lw \$a1,4\(\$at\) +0+0218 <[^>]*> lui \$at,0x0 +[ ]*218: R_MIPS_GOT_HI16 small_external_common +0+021c <[^>]*> addu \$at,\$at,\$gp +0+0220 <[^>]*> lw \$at,0\(\$at\) +[ ]*220: R_MIPS_GOT_LO16 small_external_common +0+0224 <[^>]*> nop +0+0228 <[^>]*> addu \$at,\$a1,\$at +0+022c <[^>]*> lw \$a0,0\(\$at\) +0+0230 <[^>]*> lw \$a1,4\(\$at\) +0+0234 <[^>]*> lw \$at,0\(\$gp\) +[ ]*234: R_MIPS_GOT16 .bss +0+0238 <[^>]*> nop +0+023c <[^>]*> addu \$at,\$a1,\$at +0+0240 <[^>]*> lw \$a0,0\(\$at\) +[ ]*240: R_MIPS_LO16 .bss +0+0244 <[^>]*> lw \$a1,4\(\$at\) +[ ]*244: R_MIPS_LO16 .bss +0+0248 <[^>]*> lw \$at,0\(\$gp\) +[ ]*248: R_MIPS_GOT16 .bss +0+024c <[^>]*> nop +0+0250 <[^>]*> addu \$at,\$a1,\$at +0+0254 <[^>]*> lw \$a0,1000\(\$at\) +[ ]*254: R_MIPS_LO16 .bss +0+0258 <[^>]*> lw \$a1,1004\(\$at\) +[ ]*258: R_MIPS_LO16 .bss +0+025c <[^>]*> lw \$at,0\(\$gp\) +[ ]*25c: R_MIPS_GOT16 .data +0+0260 <[^>]*> nop +0+0264 <[^>]*> addu \$at,\$a1,\$at +0+0268 <[^>]*> lw \$a0,1\(\$at\) +[ ]*268: R_MIPS_LO16 .data +0+026c <[^>]*> lw \$a1,5\(\$at\) +[ ]*26c: R_MIPS_LO16 .data +0+0270 <[^>]*> lui \$at,0x0 +[ ]*270: R_MIPS_GOT_HI16 big_external_data_label +0+0274 <[^>]*> addu \$at,\$at,\$gp +0+0278 <[^>]*> lw \$at,0\(\$at\) +[ ]*278: R_MIPS_GOT_LO16 big_external_data_label +0+027c <[^>]*> nop +0+0280 <[^>]*> addu \$at,\$a1,\$at +0+0284 <[^>]*> lw \$a0,1\(\$at\) +0+0288 <[^>]*> lw \$a1,5\(\$at\) +0+028c <[^>]*> lui \$at,0x0 +[ ]*28c: R_MIPS_GOT_HI16 small_external_data_label +0+0290 <[^>]*> addu \$at,\$at,\$gp +0+0294 <[^>]*> lw \$at,0\(\$at\) +[ ]*294: R_MIPS_GOT_LO16 small_external_data_label +0+0298 <[^>]*> nop +0+029c <[^>]*> addu \$at,\$a1,\$at +0+02a0 <[^>]*> lw \$a0,1\(\$at\) +0+02a4 <[^>]*> lw \$a1,5\(\$at\) +0+02a8 <[^>]*> lui \$at,0x0 +[ ]*2a8: R_MIPS_GOT_HI16 big_external_common +0+02ac <[^>]*> addu \$at,\$at,\$gp +0+02b0 <[^>]*> lw \$at,0\(\$at\) +[ ]*2b0: R_MIPS_GOT_LO16 big_external_common +0+02b4 <[^>]*> nop +0+02b8 <[^>]*> addu \$at,\$a1,\$at +0+02bc <[^>]*> lw \$a0,1\(\$at\) +0+02c0 <[^>]*> lw \$a1,5\(\$at\) +0+02c4 <[^>]*> lui \$at,0x0 +[ ]*2c4: R_MIPS_GOT_HI16 small_external_common +0+02c8 <[^>]*> addu \$at,\$at,\$gp +0+02cc <[^>]*> lw \$at,0\(\$at\) +[ ]*2cc: R_MIPS_GOT_LO16 small_external_common +0+02d0 <[^>]*> nop +0+02d4 <[^>]*> addu \$at,\$a1,\$at +0+02d8 <[^>]*> lw \$a0,1\(\$at\) +0+02dc <[^>]*> lw \$a1,5\(\$at\) +0+02e0 <[^>]*> lw \$at,0\(\$gp\) +[ ]*2e0: R_MIPS_GOT16 .bss +0+02e4 <[^>]*> nop +0+02e8 <[^>]*> addu \$at,\$a1,\$at +0+02ec <[^>]*> lw \$a0,1\(\$at\) +[ ]*2ec: R_MIPS_LO16 .bss +0+02f0 <[^>]*> lw \$a1,5\(\$at\) +[ ]*2f0: R_MIPS_LO16 .bss +0+02f4 <[^>]*> lw \$at,0\(\$gp\) +[ ]*2f4: R_MIPS_GOT16 .bss +0+02f8 <[^>]*> nop +0+02fc <[^>]*> addu \$at,\$a1,\$at +0+0300 <[^>]*> lw \$a0,1001\(\$at\) +[ ]*300: R_MIPS_LO16 .bss +0+0304 <[^>]*> lw \$a1,1005\(\$at\) +[ ]*304: R_MIPS_LO16 .bss + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/ld.d binutils-2.8/gas/testsuite/gas/mips/ld.d --- binutils-2.7/gas/testsuite/gas/mips/ld.d Thu Jul 4 12:15:57 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ld.d Wed Apr 30 12:54:32 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS ld # Test the ld macro. @@ -6,633 +6,633 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lw \$a0,0\(\$zero\) -0+0004 <[^>]*> lw \$a1,4\(\$zero\) -0+0008 <[^>]*> lw \$a0,1\(\$zero\) -0+000c <[^>]*> lw \$a1,5\(\$zero\) -0+0010 <[^>]*> lui \$at,0x1 -0+0014 <[^>]*> lw \$a0,-32768\(\$at\) -0+0018 <[^>]*> lw \$a1,-32764\(\$at\) -0+001c <[^>]*> lw \$a0,-32768\(\$zero\) -0+0020 <[^>]*> lw \$a1,-32764\(\$zero\) -0+0024 <[^>]*> lui \$at,0x1 -0+0028 <[^>]*> lw \$a0,0\(\$at\) -0+002c <[^>]*> lw \$a1,4\(\$at\) -0+0030 <[^>]*> lui \$at,0x2 -0+0034 <[^>]*> lw \$a0,-23131\(\$at\) -0+0038 <[^>]*> lw \$a1,-23127\(\$at\) -... -0+0040 <[^>]*> lw \$a0,0\(\$a1\) -0+0044 <[^>]*> lw \$a1,4\(\$a1\) -... -0+004c <[^>]*> lw \$a0,1\(\$a1\) -0+0050 <[^>]*> lw \$a1,5\(\$a1\) -0+0054 <[^>]*> lui \$at,0x1 -0+0058 <[^>]*> addu \$at,\$a1,\$at -0+005c <[^>]*> lw \$a0,-32768\(\$at\) -0+0060 <[^>]*> lw \$a1,-32764\(\$at\) -... -0+0068 <[^>]*> lw \$a0,-32768\(\$a1\) -0+006c <[^>]*> lw \$a1,-32764\(\$a1\) -0+0070 <[^>]*> lui \$at,0x1 -0+0074 <[^>]*> addu \$at,\$a1,\$at -0+0078 <[^>]*> lw \$a0,0\(\$at\) -0+007c <[^>]*> lw \$a1,4\(\$at\) -0+0080 <[^>]*> lui \$at,0x2 -0+0084 <[^>]*> addu \$at,\$a1,\$at -0+0088 <[^>]*> lw \$a0,-23131\(\$at\) -0+008c <[^>]*> lw \$a1,-23127\(\$at\) -0+0090 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0090 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0094 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0094 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0098 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0098 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+009c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+009c [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00a0 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+00a0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00a4 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00a4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00a8 <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00a8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00ac <[^>]*> lw \$a1,[-0-9]+\(\$gp\) -[ ]*RELOC: 0+00ac [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00b0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00b0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00b4 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+00b4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+00b8 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00b8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+00bc <[^>]*> lw \$a0,0\(\$gp\) -[ ]*RELOC: 0+00bc [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00c0 <[^>]*> lw \$a1,[-0-9]+\(\$gp\) -[ ]*RELOC: 0+00c0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00c4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00c4 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+00c8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00c8 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00cc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00cc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00d0 <[^>]*> lw \$a0,[-0-9]+\(\$gp\) -[ ]*RELOC: 0+00d0 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00d4 <[^>]*> lw \$a1,[-0-9]+\(\$gp\) -[ ]*RELOC: 0+00d4 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00d8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00d8 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00dc <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00dc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00e0 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00e0 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00e4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00e4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00e8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00e8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00ec <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00ec [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00f0 <[^>]*> lw \$a0,1\(\$gp\) -[ ]*RELOC: 0+00f0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00f4 <[^>]*> lw \$a1,5\(\$gp\) -[ ]*RELOC: 0+00f4 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00f8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00f8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00fc <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00fc [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0100 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0100 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0104 <[^>]*> lw \$a0,1\(\$gp\) -[ ]*RELOC: 0+0104 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0108 <[^>]*> lw \$a1,5\(\$gp\) -[ ]*RELOC: 0+0108 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+010c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+010c [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0110 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0110 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0114 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0114 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0118 <[^>]*> lw \$a0,[-0-9]+\(\$gp\) -[ ]*RELOC: 0+0118 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+011c <[^>]*> lw \$a1,[-0-9]+\(\$gp\) -[ ]*RELOC: 0+011c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0120 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0120 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0124 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0124 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0128 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0128 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+012c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+012c [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0130 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0130 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0134 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0134 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0138 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0138 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+013c <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+013c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0140 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0140 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0144 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0144 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0148 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0148 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+014c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+014c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0150 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0150 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0154 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0154 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0158 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0158 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+015c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+015c [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0160 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0160 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0164 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0164 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0168 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0168 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+016c <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+016c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0170 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0170 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0174 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0174 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0178 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0178 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+017c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+017c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0180 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0180 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0184 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0184 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0188 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0188 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+018c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+018c [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0190 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0190 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0194 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0194 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0198 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0198 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+019c <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+019c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01a0 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01a0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01a4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01a4 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+01a8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01a8 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+01ac <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01ac [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+01b0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01b0 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+01b4 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01b4 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+01b8 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01b8 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+01bc <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01bc [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+01c0 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01c0 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+01c4 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01c4 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+01c8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01c8 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+01cc <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01cc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+01d0 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01d0 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+01d4 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01d4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+01d8 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+01d8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01dc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01dc [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01e0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01e0 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+01e4 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+01e4 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+01e8 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01e8 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+01ec <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01ec [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01f0 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+01f0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01f4 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01f4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01f8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01f8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+01fc <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+01fc [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0200 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0200 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0204 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0204 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0208 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0208 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+020c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+020c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0210 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0210 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0214 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0214 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0218 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0218 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+021c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+021c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0220 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0220 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0224 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0224 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0228 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0228 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+022c <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+022c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0230 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0230 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0234 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0234 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0238 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0238 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+023c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+023c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0240 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0240 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0244 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0244 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0248 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0248 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+024c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+024c [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0250 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0250 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0254 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0254 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0258 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0258 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+025c <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+025c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0260 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0260 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0264 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0264 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0268 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0268 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+026c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+026c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0270 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0270 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0274 <[^>]*> addu \$at,\$a1,\$at -0+0278 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0278 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+027c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+027c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0280 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0280 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0284 <[^>]*> addu \$at,\$a1,\$at -0+0288 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0288 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+028c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+028c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -... -0+0294 <[^>]*> addu \$at,\$a1,\$gp -0+0298 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0298 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+029c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+029c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+02a0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02a0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+02a4 <[^>]*> addu \$at,\$a1,\$at -0+02a8 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+02a8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02ac <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02ac [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -... -0+02b4 <[^>]*> addu \$at,\$a1,\$gp -0+02b8 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+02b8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+02bc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02bc [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+02c0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02c0 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02c4 <[^>]*> addu \$at,\$a1,\$at -0+02c8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02c8 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+02cc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02cc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -... -0+02d4 <[^>]*> addu \$at,\$a1,\$gp -0+02d8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02d8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+02dc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02dc [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+02e0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02e0 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+02e4 <[^>]*> addu \$at,\$a1,\$at -0+02e8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02e8 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+02ec <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02ec [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+02f0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02f0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+02f4 <[^>]*> addu \$at,\$a1,\$at -0+02f8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02f8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+02fc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02fc [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -... -0+0304 <[^>]*> addu \$at,\$a1,\$gp -0+0308 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+0308 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+030c <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+030c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0310 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0310 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0314 <[^>]*> addu \$at,\$a1,\$at -0+0318 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0318 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+031c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+031c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -... -0+0324 <[^>]*> addu \$at,\$a1,\$gp -0+0328 <[^>]*> lw \$a0,1\(\$at\) -[ ]*RELOC: 0+0328 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+032c <[^>]*> lw \$a1,5\(\$at\) -[ ]*RELOC: 0+032c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0330 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0330 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0334 <[^>]*> addu \$at,\$a1,\$at -0+0338 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0338 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+033c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+033c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -... -0+0344 <[^>]*> addu \$at,\$a1,\$gp -0+0348 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0348 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+034c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+034c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0350 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0350 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0354 <[^>]*> addu \$at,\$a1,\$at -0+0358 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0358 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+035c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+035c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0360 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0360 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0364 <[^>]*> addu \$at,\$a1,\$at -0+0368 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0368 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+036c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+036c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0370 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0370 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0374 <[^>]*> addu \$at,\$a1,\$at -0+0378 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0378 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+037c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+037c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0380 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0380 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0384 <[^>]*> addu \$at,\$a1,\$at -0+0388 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0388 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+038c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+038c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0390 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0390 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0394 <[^>]*> addu \$at,\$a1,\$at -0+0398 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0398 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+039c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+039c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+03a0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+03a0 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+03a4 <[^>]*> addu \$at,\$a1,\$at -0+03a8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03a8 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+03ac <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03ac [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+03b0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+03b0 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+03b4 <[^>]*> addu \$at,\$a1,\$at -0+03b8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03b8 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+03bc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03bc [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+03c0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+03c0 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+03c4 <[^>]*> addu \$at,\$a1,\$at -0+03c8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03c8 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+03cc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03cc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+03d0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+03d0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+03d4 <[^>]*> addu \$at,\$a1,\$at -0+03d8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03d8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+03dc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03dc [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+03e0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+03e0 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+03e4 <[^>]*> addu \$at,\$a1,\$at -0+03e8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03e8 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+03ec <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03ec [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+03f0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+03f0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+03f4 <[^>]*> addu \$at,\$a1,\$at -0+03f8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03f8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+03fc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+03fc [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0400 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0400 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0404 <[^>]*> addu \$at,\$a1,\$at -0+0408 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0408 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+040c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+040c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0410 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0410 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0414 <[^>]*> addu \$at,\$a1,\$at -0+0418 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0418 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+041c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+041c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0420 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0420 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0424 <[^>]*> addu \$at,\$a1,\$at -0+0428 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0428 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+042c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+042c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0430 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0430 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0434 <[^>]*> addu \$at,\$a1,\$at -0+0438 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0438 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+043c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+043c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0440 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0440 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0444 <[^>]*> addu \$at,\$a1,\$at -0+0448 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0448 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+044c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+044c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0450 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0450 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0454 <[^>]*> addu \$at,\$a1,\$at -0+0458 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0458 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+045c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+045c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0460 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0460 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0464 <[^>]*> addu \$at,\$a1,\$at -0+0468 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0468 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+046c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+046c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0470 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0470 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0474 <[^>]*> addu \$at,\$a1,\$at -0+0478 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0478 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+047c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+047c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0480 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0480 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0484 <[^>]*> addu \$at,\$a1,\$at -0+0488 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0488 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+048c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+048c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0490 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0490 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0494 <[^>]*> addu \$at,\$a1,\$at -0+0498 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0498 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+049c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+049c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+04a0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+04a0 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+04a4 <[^>]*> addu \$at,\$a1,\$at -0+04a8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04a8 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+04ac <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04ac [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+04b0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+04b0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+04b4 <[^>]*> addu \$at,\$a1,\$at -0+04b8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04b8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+04bc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04bc [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+04c0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+04c0 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+04c4 <[^>]*> addu \$at,\$a1,\$at -0+04c8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04c8 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+04cc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04cc [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+04d0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+04d0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+04d4 <[^>]*> addu \$at,\$a1,\$at -0+04d8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04d8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+04dc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04dc [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+04e0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+04e0 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+04e4 <[^>]*> addu \$at,\$a1,\$at -0+04e8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04e8 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+04ec <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04ec [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+04f0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+04f0 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+04f4 <[^>]*> addu \$at,\$a1,\$at -0+04f8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04f8 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+04fc <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+04fc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0500 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0500 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0504 <[^>]*> addu \$at,\$a1,\$at -0+0508 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0508 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+050c <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+050c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0510 <[^>]*> lwc1 \$f[45],0\(\$zero\) -0+0514 <[^>]*> lwc1 \$f[45],4\(\$zero\) -0+0518 <[^>]*> lwc1 \$f[45],1\(\$zero\) -0+051c <[^>]*> lwc1 \$f[45],5\(\$zero\) -0+0520 <[^>]*> lui \$at,0x1 -0+0524 <[^>]*> lwc1 \$f[45],-32768\(\$at\) -0+0528 <[^>]*> lwc1 \$f[45],-32764\(\$at\) -0+052c <[^>]*> lwc1 \$f[45],-32768\(\$zero\) -0+0530 <[^>]*> lwc1 \$f[45],-32764\(\$zero\) -0+0534 <[^>]*> lwc1 \$f[45],0\(\$a1\) -0+0538 <[^>]*> lwc1 \$f[45],4\(\$a1\) -0+053c <[^>]*> lwc1 \$f[45],1\(\$a1\) -0+0540 <[^>]*> lwc1 \$f[45],5\(\$a1\) -0+0544 <[^>]*> lui \$at,0x1 -0+0548 <[^>]*> addu \$at,\$a1,\$at -0+054c <[^>]*> lwc1 \$f[45],-32768\(\$at\) -0+0550 <[^>]*> lwc1 \$f[45],-32764\(\$at\) -0+0554 <[^>]*> lwc1 \$f[45],-32768\(\$a1\) -0+0558 <[^>]*> lwc1 \$f[45],-32764\(\$a1\) -0+055c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+055c [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0560 <[^>]*> addu \$at,\$a1,\$at -0+0564 <[^>]*> lwc1 \$f[45],[-0-9]+\(\$at\) -[ ]*RELOC: 0+0564 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0568 <[^>]*> lwc1 \$f[45],[-0-9]+\(\$at\) -[ ]*RELOC: 0+0568 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -... -0+0570 <[^>]*> swc1 \$f[45],0\(\$zero\) -0+0574 <[^>]*> swc1 \$f[45],4\(\$zero\) -0+0578 <[^>]*> swc1 \$f[45],1\(\$zero\) -0+057c <[^>]*> swc1 \$f[45],5\(\$zero\) -0+0580 <[^>]*> lui \$at,0x1 -0+0584 <[^>]*> swc1 \$f[45],-32768\(\$at\) -0+0588 <[^>]*> swc1 \$f[45],-32764\(\$at\) -0+058c <[^>]*> swc1 \$f[45],-32768\(\$zero\) -0+0590 <[^>]*> swc1 \$f[45],-32764\(\$zero\) -0+0594 <[^>]*> swc1 \$f[45],0\(\$a1\) -0+0598 <[^>]*> swc1 \$f[45],4\(\$a1\) -0+059c <[^>]*> swc1 \$f[45],1\(\$a1\) -0+05a0 <[^>]*> swc1 \$f[45],5\(\$a1\) -0+05a4 <[^>]*> lui \$at,0x1 -0+05a8 <[^>]*> addu \$at,\$a1,\$at -0+05ac <[^>]*> swc1 \$f[45],-32768\(\$at\) -0+05b0 <[^>]*> swc1 \$f[45],-32764\(\$at\) -0+05b4 <[^>]*> swc1 \$f[45],-32768\(\$a1\) -0+05b8 <[^>]*> swc1 \$f[45],-32764\(\$a1\) -0+05bc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+05bc [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+05c0 <[^>]*> addu \$at,\$a1,\$at -0+05c4 <[^>]*> swc1 \$f[45],[-0-9]+\(\$at\) -[ ]*RELOC: 0+05c4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+05c8 <[^>]*> swc1 \$f[45],[-0-9]+\(\$at\) -[ ]*RELOC: 0+05c8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+05cc <[^>]*> sw \$a0,0\(\$zero\) -0+05d0 <[^>]*> sw \$a1,4\(\$zero\) -0+05d4 <[^>]*> lui \$a0,[-0-9x]+ -[ ]*RELOC: 0+05d4 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+05d8 <[^>]*> daddu \$a0,\$a0,\$a1 -0+05dc <[^>]*> ld \$a0,[-0-9]+\(\$a0\) -[ ]*RELOC: 0+05dc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+05e0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+05e0 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+05e4 <[^>]*> daddu \$at,\$at,\$a1 -0+05e8 <[^>]*> sd \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+05e8 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -... +0+0000 <[^>]*> lw \$a0,0\(\$zero\) +0+0004 <[^>]*> lw \$a1,4\(\$zero\) +0+0008 <[^>]*> lw \$a0,1\(\$zero\) +0+000c <[^>]*> lw \$a1,5\(\$zero\) +0+0010 <[^>]*> lui \$at,0x1 +0+0014 <[^>]*> lw \$a0,-32768\(\$at\) +0+0018 <[^>]*> lw \$a1,-32764\(\$at\) +0+001c <[^>]*> lw \$a0,-32768\(\$zero\) +0+0020 <[^>]*> lw \$a1,-32764\(\$zero\) +0+0024 <[^>]*> lui \$at,0x1 +0+0028 <[^>]*> lw \$a0,0\(\$at\) +0+002c <[^>]*> lw \$a1,4\(\$at\) +0+0030 <[^>]*> lui \$at,0x2 +0+0034 <[^>]*> lw \$a0,-23131\(\$at\) +0+0038 <[^>]*> lw \$a1,-23127\(\$at\) +0+003c <[^>]*> nop +0+0040 <[^>]*> lw \$a0,0\(\$a1\) +0+0044 <[^>]*> lw \$a1,4\(\$a1\) +0+0048 <[^>]*> nop +0+004c <[^>]*> lw \$a0,1\(\$a1\) +0+0050 <[^>]*> lw \$a1,5\(\$a1\) +0+0054 <[^>]*> lui \$at,0x1 +0+0058 <[^>]*> addu \$at,\$a1,\$at +0+005c <[^>]*> lw \$a0,-32768\(\$at\) +0+0060 <[^>]*> lw \$a1,-32764\(\$at\) +0+0064 <[^>]*> nop +0+0068 <[^>]*> lw \$a0,-32768\(\$a1\) +0+006c <[^>]*> lw \$a1,-32764\(\$a1\) +0+0070 <[^>]*> lui \$at,0x1 +0+0074 <[^>]*> addu \$at,\$a1,\$at +0+0078 <[^>]*> lw \$a0,0\(\$at\) +0+007c <[^>]*> lw \$a1,4\(\$at\) +0+0080 <[^>]*> lui \$at,0x2 +0+0084 <[^>]*> addu \$at,\$a1,\$at +0+0088 <[^>]*> lw \$a0,-23131\(\$at\) +0+008c <[^>]*> lw \$a1,-23127\(\$at\) +0+0090 <[^>]*> lui \$at,0x0 +[ ]*90: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0094 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*94: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0098 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*98: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+009c <[^>]*> lui \$at,0x0 +[ ]*9c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00a0 <[^>]*> lw \$a0,0\(\$at\) +[ ]*a0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00a4 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*a4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00a8 <[^>]*> lw \$a0,0\(\$gp\) +[ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00ac <[^>]*> lw \$a1,[-0-9]+\(\$gp\) +[ ]*ac: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00b0 <[^>]*> lui \$at,0x0 +[ ]*b0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00b4 <[^>]*> lw \$a0,0\(\$at\) +[ ]*b4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+00b8 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*b8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+00bc <[^>]*> lw \$a0,0\(\$gp\) +[ ]*bc: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00c0 <[^>]*> lw \$a1,[-0-9]+\(\$gp\) +[ ]*c0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00c4 <[^>]*> lui \$at,0x0 +[ ]*c4: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+00c8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*c8: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00cc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*cc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00d0 <[^>]*> lw \$a0,[-0-9]+\(\$gp\) +[ ]*d0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00d4 <[^>]*> lw \$a1,[-0-9]+\(\$gp\) +[ ]*d4: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00d8 <[^>]*> lui \$at,0x0 +[ ]*d8: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+00dc <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*dc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00e0 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*e0: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00e4 <[^>]*> lui \$at,0x0 +[ ]*e4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00e8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*e8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00ec <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*ec: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00f0 <[^>]*> lw \$a0,1\(\$gp\) +[ ]*f0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00f4 <[^>]*> lw \$a1,5\(\$gp\) +[ ]*f4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00f8 <[^>]*> lui \$at,0x0 +[ ]*f8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00fc <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*fc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0100 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*100: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0104 <[^>]*> lw \$a0,1\(\$gp\) +[ ]*104: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0108 <[^>]*> lw \$a1,5\(\$gp\) +[ ]*108: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+010c <[^>]*> lui \$at,0x0 +[ ]*10c: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0110 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*110: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0114 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*114: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0118 <[^>]*> lw \$a0,[-0-9]+\(\$gp\) +[ ]*118: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+011c <[^>]*> lw \$a1,[-0-9]+\(\$gp\) +[ ]*11c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0120 <[^>]*> lui \$at,[-0-9x]+ +[ ]*120: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0124 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*124: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0128 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*128: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+012c <[^>]*> lui \$at,[-0-9x]+ +[ ]*12c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0130 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*130: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0134 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*134: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0138 <[^>]*> lui \$at,[-0-9x]+ +[ ]*138: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+013c <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*13c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0140 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*140: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0144 <[^>]*> lui \$at,[-0-9x]+ +[ ]*144: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0148 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*148: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+014c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*14c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0150 <[^>]*> lui \$at,[-0-9x]+ +[ ]*150: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0154 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*154: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0158 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*158: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+015c <[^>]*> lui \$at,[-0-9x]+ +[ ]*15c: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0160 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*160: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0164 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*164: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0168 <[^>]*> lui \$at,[-0-9x]+ +[ ]*168: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+016c <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*16c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0170 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*170: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0174 <[^>]*> lui \$at,0x0 +[ ]*174: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0178 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*178: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+017c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*17c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0180 <[^>]*> lui \$at,0x0 +[ ]*180: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0184 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*184: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0188 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*188: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+018c <[^>]*> lui \$at,0x0 +[ ]*18c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0190 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*190: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0194 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*194: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0198 <[^>]*> lui \$at,0x0 +[ ]*198: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+019c <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*19c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01a0 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*1a0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01a4 <[^>]*> lui \$at,0x0 +[ ]*1a4: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+01a8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*1a8: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+01ac <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*1ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+01b0 <[^>]*> lui \$at,0x0 +[ ]*1b0: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+01b4 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*1b4: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+01b8 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*1b8: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+01bc <[^>]*> lui \$at,0x0 +[ ]*1bc: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+01c0 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*1c0: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+01c4 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*1c4: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+01c8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*1c8: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+01cc <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*1cc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+01d0 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*1d0: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+01d4 <[^>]*> lui \$at,[-0-9x]+ +[ ]*1d4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+01d8 <[^>]*> lw \$a0,0\(\$at\) +[ ]*1d8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01dc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*1dc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01e0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*1e0: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+01e4 <[^>]*> lw \$a0,0\(\$at\) +[ ]*1e4: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+01e8 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*1e8: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+01ec <[^>]*> lui \$at,[-0-9x]+ +[ ]*1ec: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01f0 <[^>]*> lw \$a0,0\(\$at\) +[ ]*1f0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01f4 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*1f4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01f8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*1f8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+01fc <[^>]*> lw \$a0,0\(\$at\) +[ ]*1fc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0200 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*200: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0204 <[^>]*> lui \$at,[-0-9x]+ +[ ]*204: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0208 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*208: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+020c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*20c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0210 <[^>]*> lui \$at,[-0-9x]+ +[ ]*210: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0214 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*214: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0218 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*218: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+021c <[^>]*> lui \$at,[-0-9x]+ +[ ]*21c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0220 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*220: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0224 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*224: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0228 <[^>]*> lui \$at,[-0-9x]+ +[ ]*228: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+022c <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*22c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0230 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*230: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0234 <[^>]*> lui \$at,[-0-9x]+ +[ ]*234: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0238 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*238: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+023c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*23c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0240 <[^>]*> lui \$at,[-0-9x]+ +[ ]*240: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0244 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*244: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0248 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*248: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+024c <[^>]*> lui \$at,[-0-9x]+ +[ ]*24c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0250 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*250: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0254 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*254: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0258 <[^>]*> lui \$at,[-0-9x]+ +[ ]*258: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+025c <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*25c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0260 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*260: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0264 <[^>]*> lui \$at,[-0-9x]+ +[ ]*264: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0268 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*268: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+026c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*26c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0270 <[^>]*> lui \$at,0x0 +[ ]*270: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0274 <[^>]*> addu \$at,\$a1,\$at +0+0278 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*278: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+027c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*27c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0280 <[^>]*> lui \$at,0x0 +[ ]*280: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0284 <[^>]*> addu \$at,\$a1,\$at +0+0288 <[^>]*> lw \$a0,0\(\$at\) +[ ]*288: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+028c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*28c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0290 <[^>]*> nop +0+0294 <[^>]*> addu \$at,\$a1,\$gp +0+0298 <[^>]*> lw \$a0,0\(\$at\) +[ ]*298: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+029c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*29c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+02a0 <[^>]*> lui \$at,0x0 +[ ]*2a0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+02a4 <[^>]*> addu \$at,\$a1,\$at +0+02a8 <[^>]*> lw \$a0,0\(\$at\) +[ ]*2a8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02ac <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*2ac: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02b0 <[^>]*> nop +0+02b4 <[^>]*> addu \$at,\$a1,\$gp +0+02b8 <[^>]*> lw \$a0,0\(\$at\) +[ ]*2b8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+02bc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*2bc: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+02c0 <[^>]*> lui \$at,0x0 +[ ]*2c0: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+02c4 <[^>]*> addu \$at,\$a1,\$at +0+02c8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*2c8: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+02cc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*2cc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+02d0 <[^>]*> nop +0+02d4 <[^>]*> addu \$at,\$a1,\$gp +0+02d8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*2d8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+02dc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*2dc: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+02e0 <[^>]*> lui \$at,0x0 +[ ]*2e0: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+02e4 <[^>]*> addu \$at,\$a1,\$at +0+02e8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*2e8: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+02ec <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*2ec: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+02f0 <[^>]*> lui \$at,0x0 +[ ]*2f0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+02f4 <[^>]*> addu \$at,\$a1,\$at +0+02f8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*2f8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+02fc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*2fc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0300 <[^>]*> nop +0+0304 <[^>]*> addu \$at,\$a1,\$gp +0+0308 <[^>]*> lw \$a0,1\(\$at\) +[ ]*308: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+030c <[^>]*> lw \$a1,5\(\$at\) +[ ]*30c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0310 <[^>]*> lui \$at,0x0 +[ ]*310: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0314 <[^>]*> addu \$at,\$a1,\$at +0+0318 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*318: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+031c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*31c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0320 <[^>]*> nop +0+0324 <[^>]*> addu \$at,\$a1,\$gp +0+0328 <[^>]*> lw \$a0,1\(\$at\) +[ ]*328: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+032c <[^>]*> lw \$a1,5\(\$at\) +[ ]*32c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0330 <[^>]*> lui \$at,0x0 +[ ]*330: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0334 <[^>]*> addu \$at,\$a1,\$at +0+0338 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*338: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+033c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*33c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0340 <[^>]*> nop +0+0344 <[^>]*> addu \$at,\$a1,\$gp +0+0348 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*348: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+034c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*34c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0350 <[^>]*> lui \$at,[-0-9x]+ +[ ]*350: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0354 <[^>]*> addu \$at,\$a1,\$at +0+0358 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*358: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+035c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*35c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0360 <[^>]*> lui \$at,[-0-9x]+ +[ ]*360: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0364 <[^>]*> addu \$at,\$a1,\$at +0+0368 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*368: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+036c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*36c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0370 <[^>]*> lui \$at,[-0-9x]+ +[ ]*370: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0374 <[^>]*> addu \$at,\$a1,\$at +0+0378 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*378: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+037c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*37c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0380 <[^>]*> lui \$at,[-0-9x]+ +[ ]*380: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0384 <[^>]*> addu \$at,\$a1,\$at +0+0388 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*388: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+038c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*38c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0390 <[^>]*> lui \$at,[-0-9x]+ +[ ]*390: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0394 <[^>]*> addu \$at,\$a1,\$at +0+0398 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*398: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+039c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*39c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+03a0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*3a0: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+03a4 <[^>]*> addu \$at,\$a1,\$at +0+03a8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*3a8: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+03ac <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*3ac: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+03b0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*3b0: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+03b4 <[^>]*> addu \$at,\$a1,\$at +0+03b8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*3b8: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+03bc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*3bc: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+03c0 <[^>]*> lui \$at,0x0 +[ ]*3c0: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+03c4 <[^>]*> addu \$at,\$a1,\$at +0+03c8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*3c8: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+03cc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*3cc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+03d0 <[^>]*> lui \$at,0x0 +[ ]*3d0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+03d4 <[^>]*> addu \$at,\$a1,\$at +0+03d8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*3d8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+03dc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*3dc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+03e0 <[^>]*> lui \$at,0x0 +[ ]*3e0: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+03e4 <[^>]*> addu \$at,\$a1,\$at +0+03e8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*3e8: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+03ec <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*3ec: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+03f0 <[^>]*> lui \$at,0x0 +[ ]*3f0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+03f4 <[^>]*> addu \$at,\$a1,\$at +0+03f8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*3f8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+03fc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*3fc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0400 <[^>]*> lui \$at,0x0 +[ ]*400: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0404 <[^>]*> addu \$at,\$a1,\$at +0+0408 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*408: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+040c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*40c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0410 <[^>]*> lui \$at,0x0 +[ ]*410: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0414 <[^>]*> addu \$at,\$a1,\$at +0+0418 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*418: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+041c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*41c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0420 <[^>]*> lui \$at,0x0 +[ ]*420: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0424 <[^>]*> addu \$at,\$a1,\$at +0+0428 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*428: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+042c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*42c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0430 <[^>]*> lui \$at,[-0-9x]+ +[ ]*430: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0434 <[^>]*> addu \$at,\$a1,\$at +0+0438 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*438: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+043c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*43c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0440 <[^>]*> lui \$at,[-0-9x]+ +[ ]*440: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0444 <[^>]*> addu \$at,\$a1,\$at +0+0448 <[^>]*> lw \$a0,0\(\$at\) +[ ]*448: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+044c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*44c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0450 <[^>]*> lui \$at,[-0-9x]+ +[ ]*450: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0454 <[^>]*> addu \$at,\$a1,\$at +0+0458 <[^>]*> lw \$a0,0\(\$at\) +[ ]*458: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+045c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*45c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0460 <[^>]*> lui \$at,[-0-9x]+ +[ ]*460: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0464 <[^>]*> addu \$at,\$a1,\$at +0+0468 <[^>]*> lw \$a0,0\(\$at\) +[ ]*468: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+046c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*46c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0470 <[^>]*> lui \$at,[-0-9x]+ +[ ]*470: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0474 <[^>]*> addu \$at,\$a1,\$at +0+0478 <[^>]*> lw \$a0,0\(\$at\) +[ ]*478: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+047c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*47c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0480 <[^>]*> lui \$at,[-0-9x]+ +[ ]*480: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0484 <[^>]*> addu \$at,\$a1,\$at +0+0488 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*488: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+048c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*48c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0490 <[^>]*> lui \$at,[-0-9x]+ +[ ]*490: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0494 <[^>]*> addu \$at,\$a1,\$at +0+0498 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*498: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+049c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*49c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+04a0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*4a0: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+04a4 <[^>]*> addu \$at,\$a1,\$at +0+04a8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*4a8: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+04ac <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*4ac: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+04b0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*4b0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+04b4 <[^>]*> addu \$at,\$a1,\$at +0+04b8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*4b8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+04bc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*4bc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+04c0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*4c0: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+04c4 <[^>]*> addu \$at,\$a1,\$at +0+04c8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*4c8: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+04cc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*4cc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+04d0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*4d0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+04d4 <[^>]*> addu \$at,\$a1,\$at +0+04d8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*4d8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+04dc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*4dc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+04e0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*4e0: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+04e4 <[^>]*> addu \$at,\$a1,\$at +0+04e8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*4e8: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+04ec <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*4ec: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+04f0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*4f0: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+04f4 <[^>]*> addu \$at,\$a1,\$at +0+04f8 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*4f8: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+04fc <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*4fc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0500 <[^>]*> lui \$at,[-0-9x]+ +[ ]*500: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0504 <[^>]*> addu \$at,\$a1,\$at +0+0508 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*508: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+050c <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*50c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0510 <[^>]*> lwc1 \$f[45],0\(\$zero\) +0+0514 <[^>]*> lwc1 \$f[45],4\(\$zero\) +0+0518 <[^>]*> lwc1 \$f[45],1\(\$zero\) +0+051c <[^>]*> lwc1 \$f[45],5\(\$zero\) +0+0520 <[^>]*> lui \$at,0x1 +0+0524 <[^>]*> lwc1 \$f[45],-32768\(\$at\) +0+0528 <[^>]*> lwc1 \$f[45],-32764\(\$at\) +0+052c <[^>]*> lwc1 \$f[45],-32768\(\$zero\) +0+0530 <[^>]*> lwc1 \$f[45],-32764\(\$zero\) +0+0534 <[^>]*> lwc1 \$f[45],0\(\$a1\) +0+0538 <[^>]*> lwc1 \$f[45],4\(\$a1\) +0+053c <[^>]*> lwc1 \$f[45],1\(\$a1\) +0+0540 <[^>]*> lwc1 \$f[45],5\(\$a1\) +0+0544 <[^>]*> lui \$at,0x1 +0+0548 <[^>]*> addu \$at,\$a1,\$at +0+054c <[^>]*> lwc1 \$f[45],-32768\(\$at\) +0+0550 <[^>]*> lwc1 \$f[45],-32764\(\$at\) +0+0554 <[^>]*> lwc1 \$f[45],-32768\(\$a1\) +0+0558 <[^>]*> lwc1 \$f[45],-32764\(\$a1\) +0+055c <[^>]*> lui \$at,[-0-9x]+ +[ ]*55c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0560 <[^>]*> addu \$at,\$a1,\$at +0+0564 <[^>]*> lwc1 \$f[45],[-0-9]+\(\$at\) +[ ]*564: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0568 <[^>]*> lwc1 \$f[45],[-0-9]+\(\$at\) +[ ]*568: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+056c <[^>]*> nop +0+0570 <[^>]*> swc1 \$f[45],0\(\$zero\) +0+0574 <[^>]*> swc1 \$f[45],4\(\$zero\) +0+0578 <[^>]*> swc1 \$f[45],1\(\$zero\) +0+057c <[^>]*> swc1 \$f[45],5\(\$zero\) +0+0580 <[^>]*> lui \$at,0x1 +0+0584 <[^>]*> swc1 \$f[45],-32768\(\$at\) +0+0588 <[^>]*> swc1 \$f[45],-32764\(\$at\) +0+058c <[^>]*> swc1 \$f[45],-32768\(\$zero\) +0+0590 <[^>]*> swc1 \$f[45],-32764\(\$zero\) +0+0594 <[^>]*> swc1 \$f[45],0\(\$a1\) +0+0598 <[^>]*> swc1 \$f[45],4\(\$a1\) +0+059c <[^>]*> swc1 \$f[45],1\(\$a1\) +0+05a0 <[^>]*> swc1 \$f[45],5\(\$a1\) +0+05a4 <[^>]*> lui \$at,0x1 +0+05a8 <[^>]*> addu \$at,\$a1,\$at +0+05ac <[^>]*> swc1 \$f[45],-32768\(\$at\) +0+05b0 <[^>]*> swc1 \$f[45],-32764\(\$at\) +0+05b4 <[^>]*> swc1 \$f[45],-32768\(\$a1\) +0+05b8 <[^>]*> swc1 \$f[45],-32764\(\$a1\) +0+05bc <[^>]*> lui \$at,[-0-9x]+ +[ ]*5bc: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+05c0 <[^>]*> addu \$at,\$a1,\$at +0+05c4 <[^>]*> swc1 \$f[45],[-0-9]+\(\$at\) +[ ]*5c4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+05c8 <[^>]*> swc1 \$f[45],[-0-9]+\(\$at\) +[ ]*5c8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+05cc <[^>]*> sw \$a0,0\(\$zero\) +0+05d0 <[^>]*> sw \$a1,4\(\$zero\) +0+05d4 <[^>]*> lui \$a0,[-0-9x]+ +[ ]*5d4: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+05d8 <[^>]*> daddu \$a0,\$a0,\$a1 +0+05dc <[^>]*> ld \$a0,[-0-9]+\(\$a0\) +[ ]*5dc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+05e0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*5e0: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+05e4 <[^>]*> daddu \$at,\$at,\$a1 +0+05e8 <[^>]*> sd \$a0,[-0-9]+\(\$at\) +[ ]*5e8: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+05ec <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/ld.s binutils-2.8/gas/testsuite/gas/mips/ld.s --- binutils-2.7/gas/testsuite/gas/mips/ld.s Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ld.s Wed Apr 30 12:54:32 1997 @@ -139,3 +139,6 @@ .set mips3 ld $4,big_local_common+0x1a5a5($5) sd $4,small_local_common+0x1a5a5($5) + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/li.d binutils-2.8/gas/testsuite/gas/mips/li.d --- binutils-2.7/gas/testsuite/gas/mips/li.d Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/li.d Wed Apr 30 12:54:32 1997 @@ -1,17 +1,16 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS li # Test the li macro. .*: +file format .*mips.* -No symbols in .* Disassembly of section .text: -0+0000 li \$a0,0 -0+0004 li \$a0,1 -0+0008 li \$a0,0x8000 -0+000c li \$a0,-32768 -0+0010 lui \$a0,0x1 -0+0014 lui \$a0,0x1 -0+0018 ori \$a0,\$a0,0xa5a5 -... +0+0000 <[^>]*> li \$a0,0 +0+0004 <[^>]*> li \$a0,1 +0+0008 <[^>]*> li \$a0,0x8000 +0+000c <[^>]*> li \$a0,-32768 +0+0010 <[^>]*> lui \$a0,0x1 +0+0014 <[^>]*> lui \$a0,0x1 +0+0018 <[^>]*> ori \$a0,\$a0,0xa5a5 +0+001c <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/li.s binutils-2.8/gas/testsuite/gas/mips/li.s --- binutils-2.7/gas/testsuite/gas/mips/li.s Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/li.s Wed Apr 30 12:54:33 1997 @@ -1,8 +1,12 @@ # Source file used to test the li macro. - + +foo: li $4,0 li $4,1 li $4,0x8000 li $4,-0x8000 li $4,0x10000 li $4,0x1a5a5 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/lif-empic.d binutils-2.8/gas/testsuite/gas/mips/lif-empic.d --- binutils-2.7/gas/testsuite/gas/mips/lif-empic.d Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/lif-empic.d Wed Apr 30 12:54:33 1997 @@ -1,6 +1,6 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS lifloat-empic -#as: -mips1 -membedded-pic +#as: -mips1 -membedded-pic --defsym EMPIC=1 #source: lifloat.s # Test the li.d and li.s macros with -membedded-pic. @@ -8,14 +8,14 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> addiu \$at,\$gp,-16384 -[ ]*RELOC: 0+0000 [A-Z0-9_]*GPREL[A-Z0-9_]* .rdata.* -0+0004 <[^>]*> lw \$a0,0\(\$at\) -0+0008 <[^>]*> lw \$a1,4\(\$at\) -0+000c <[^>]*> lwc1 \$f[45],-16368\(\$gp\) -[ ]*RELOC: 0+000c [A-Z0-9_]*LITERAL[A-Z0-9_]* .lit8.* -0+0010 <[^>]*> lwc1 \$f[45],-16364\(\$gp\) -[ ]*RELOC: 0+0010 [A-Z0-9_]*LITERAL[A-Z0-9_]* .lit8.* -0+0014 <[^>]*> lui \$a0,0x3f80 -0+0018 <[^>]*> lui \$at,0x3f80 -0+001c <[^>]*> mtc1 \$at,\$f4 +0+0000 <[^>]*> addiu \$at,\$gp,-16384 +[ ]*0: [A-Z0-9_]*GPREL[A-Z0-9_]* .rdata.* +0+0004 <[^>]*> lw \$a0,0\(\$at\) +0+0008 <[^>]*> lw \$a1,4\(\$at\) +0+000c <[^>]*> lwc1 \$f[45],-16368\(\$gp\) +[ ]*c: [A-Z0-9_]*LITERAL[A-Z0-9_]* .lit8.* +0+0010 <[^>]*> lwc1 \$f[45],-16364\(\$gp\) +[ ]*10: [A-Z0-9_]*LITERAL[A-Z0-9_]* .lit8.* +0+0014 <[^>]*> lui \$a0,0x3f80 +0+0018 <[^>]*> lui \$at,0x3f80 +0+001c <[^>]*> mtc1 \$at,\$f4 diff -urN binutils-2.7/gas/testsuite/gas/mips/lif-svr4pic.d binutils-2.8/gas/testsuite/gas/mips/lif-svr4pic.d --- binutils-2.7/gas/testsuite/gas/mips/lif-svr4pic.d Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/lif-svr4pic.d Wed Apr 30 12:54:33 1997 @@ -1,6 +1,6 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS lifloat-svr4pic -#as: -mips1 -KPIC +#as: -mips1 -KPIC -EB #source: lifloat.s # Test the li.d and li.s macros with -KPIC. @@ -8,21 +8,21 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0000 R_MIPS_GOT16 .rodata -... -0+0008 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0008 R_MIPS_LO16 .rodata -0+000c <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+000c R_MIPS_LO16 .rodata -0+0010 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0010 R_MIPS_GOT16 .rodata -... -0+0018 <[^>]*> lwc1 \$f5,8\(\$at\) -[ ]*RELOC: 0+0018 R_MIPS_LO16 .rodata -0+001c <[^>]*> lwc1 \$f4,12\(\$at\) -[ ]*RELOC: 0+001c R_MIPS_LO16 .rodata -0+0020 <[^>]*> lui \$a0,0x3f80 -0+0024 <[^>]*> lui \$at,0x3f80 -0+0028 <[^>]*> mtc1 \$at,\$f4 -... +0+0000 <[^>]*> lw \$at,0\(\$gp\) +[ ]*0: R_MIPS_GOT16 .rodata +0+0004 <[^>]*> nop +0+0008 <[^>]*> lw \$a0,0\(\$at\) +[ ]*8: R_MIPS_LO16 .rodata +0+000c <[^>]*> lw \$a1,4\(\$at\) +[ ]*c: R_MIPS_LO16 .rodata +0+0010 <[^>]*> lw \$at,0\(\$gp\) +[ ]*10: R_MIPS_GOT16 .rodata +0+0014 <[^>]*> nop +0+0018 <[^>]*> lwc1 \$f5,8\(\$at\) +[ ]*18: R_MIPS_LO16 .rodata +0+001c <[^>]*> lwc1 \$f4,12\(\$at\) +[ ]*1c: R_MIPS_LO16 .rodata +0+0020 <[^>]*> lui \$a0,0x3f80 +0+0024 <[^>]*> lui \$at,0x3f80 +0+0028 <[^>]*> mtc1 \$at,\$f4 +0+002c <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/lif-xgot.d binutils-2.8/gas/testsuite/gas/mips/lif-xgot.d --- binutils-2.7/gas/testsuite/gas/mips/lif-xgot.d Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/lif-xgot.d Wed Apr 30 12:54:33 1997 @@ -1,6 +1,6 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS lifloat-xgot -#as: -mips1 -KPIC -xgot +#as: -mips1 -KPIC -xgot -EB #source: lifloat.s # Test the li.d and li.s macros with -KPIC -xgot. @@ -8,21 +8,21 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0000 R_MIPS_GOT16 .rodata -... -0+0008 <[^>]*> lw \$a0,0\(\$at\) -[ ]*RELOC: 0+0008 R_MIPS_LO16 .rodata -0+000c <[^>]*> lw \$a1,4\(\$at\) -[ ]*RELOC: 0+000c R_MIPS_LO16 .rodata -0+0010 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0010 R_MIPS_GOT16 .rodata -... -0+0018 <[^>]*> lwc1 \$f5,8\(\$at\) -[ ]*RELOC: 0+0018 R_MIPS_LO16 .rodata -0+001c <[^>]*> lwc1 \$f4,12\(\$at\) -[ ]*RELOC: 0+001c R_MIPS_LO16 .rodata -0+0020 <[^>]*> lui \$a0,0x3f80 -0+0024 <[^>]*> lui \$at,0x3f80 -0+0028 <[^>]*> mtc1 \$at,\$f4 -... +0+0000 <[^>]*> lw \$at,0\(\$gp\) +[ ]*0: R_MIPS_GOT16 .rodata +0+0004 <[^>]*> nop +0+0008 <[^>]*> lw \$a0,0\(\$at\) +[ ]*8: R_MIPS_LO16 .rodata +0+000c <[^>]*> lw \$a1,4\(\$at\) +[ ]*c: R_MIPS_LO16 .rodata +0+0010 <[^>]*> lw \$at,0\(\$gp\) +[ ]*10: R_MIPS_GOT16 .rodata +0+0014 <[^>]*> nop +0+0018 <[^>]*> lwc1 \$f5,8\(\$at\) +[ ]*18: R_MIPS_LO16 .rodata +0+001c <[^>]*> lwc1 \$f4,12\(\$at\) +[ ]*1c: R_MIPS_LO16 .rodata +0+0020 <[^>]*> lui \$a0,0x3f80 +0+0024 <[^>]*> lui \$at,0x3f80 +0+0028 <[^>]*> mtc1 \$at,\$f4 +0+002c <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/lifloat.d binutils-2.8/gas/testsuite/gas/mips/lifloat.d --- binutils-2.7/gas/testsuite/gas/mips/lifloat.d Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/lifloat.d Wed Apr 30 12:54:34 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS lifloat #as: -mips1 @@ -7,17 +7,17 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0000 [A-Z0-9_]*HI[A-Z0-9_]* .ro?data.* -0+0004 <[^>]*> lw \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0004 [A-Z0-9_]*LO[A-Z0-9_]* .ro?data.* -0+0008 <[^>]*> lw \$a1,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0008 [A-Z0-9_]*LO[A-Z0-9_]* .ro?data.* -0+000c <[^>]*> lwc1 \$f[45],[-0-9]+\(\$gp\) -[ ]*RELOC: 0+000c [A-Z0-9_]*LITERAL[A-Z0-9_]* .lit8.* -0+0010 <[^>]*> lwc1 \$f[45],[-0-9]+\(\$gp\) -[ ]*RELOC: 0+0010 [A-Z0-9_]*LITERAL[A-Z0-9_]* .lit8.* -0+0014 <[^>]*> lui \$a0,0x3f80 -0+0018 <[^>]*> lwc1 \$f4,[-0-9]+\(\$gp\) -[ ]*RELOC: 0+0018 [A-Z0-9_]*LITERAL[A-Z0-9_]* .lit4.* -... +0+0000 <[^>]*> lui \$at,0x0 +[ ]*0: [A-Z0-9_]*HI[A-Z0-9_]* .ro?data.* +0+0004 <[^>]*> lw \$a0,[-0-9]+\(\$at\) +[ ]*4: [A-Z0-9_]*LO[A-Z0-9_]* .ro?data.* +0+0008 <[^>]*> lw \$a1,[-0-9]+\(\$at\) +[ ]*8: [A-Z0-9_]*LO[A-Z0-9_]* .ro?data.* +0+000c <[^>]*> lwc1 \$f[45],[-0-9]+\(\$gp\) +[ ]*c: [A-Z0-9_]*LITERAL[A-Z0-9_]* .lit8.* +0+0010 <[^>]*> lwc1 \$f[45],[-0-9]+\(\$gp\) +[ ]*10: [A-Z0-9_]*LITERAL[A-Z0-9_]* .lit8.* +0+0014 <[^>]*> lui \$a0,0x3f80 +0+0018 <[^>]*> lwc1 \$f4,[-0-9]+\(\$gp\) +[ ]*18: [A-Z0-9_]*LITERAL[A-Z0-9_]* .lit4.* +0+001c <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/lifloat.s binutils-2.8/gas/testsuite/gas/mips/lifloat.s --- binutils-2.7/gas/testsuite/gas/mips/lifloat.s Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/lifloat.s Wed Apr 30 12:54:34 1997 @@ -6,3 +6,8 @@ li.s $4,1.0 li.s $f4,1.0 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + .ifndef EMPIC + nop + .endif diff -urN binutils-2.7/gas/testsuite/gas/mips/mips.exp binutils-2.8/gas/testsuite/gas/mips/mips.exp --- binutils-2.7/gas/testsuite/gas/mips/mips.exp Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/mips.exp Wed Apr 30 12:54:34 1997 @@ -4,8 +4,8 @@ if [istarget mips*-*-*] then { set svr4pic [expr [istarget *-*-elf*] || [istarget *-*-irix5*] ] set empic [expr [istarget *-*-ecoff*] || [istarget *-*-ultrix*] || [istarget *-*-irix\[1-4\]*] ] - set aout [expr [istarget *-*-bsd*] || [istarget *-*-netbsd*]] - set ilocks [expr [istarget *4300*-*-elf*] || [istarget *4100*-*-elf*]] + set aout [expr [istarget *-*-bsd*] || [istarget *-*-netbsd*] || [istarget *-*-openbsd*]] + set ilocks [expr [istarget mips64vr4300*-*-*] || [istarget mips64vr4100*-*-*]] run_dump_test "abs" run_dump_test "add" @@ -16,6 +16,7 @@ run_dump_test "blt" run_dump_test "bltu" if !$ilocks { run_dump_test "div" } else { run_dump_test "div-ilocks" } + run_dump_test "dli" run_dump_test "jal" if $svr4pic { run_dump_test "jal-svr4pic" } if $svr4pic { run_dump_test "jal-xgot" } @@ -53,4 +54,7 @@ run_dump_test "usw" run_dump_test "usd" } + # The mips16 test can only be run on ELF, because only ELF + # supports the necessary mips16 reloc. + if $svr4pic { run_dump_test "mips16" } } diff -urN binutils-2.7/gas/testsuite/gas/mips/mips16.d binutils-2.8/gas/testsuite/gas/mips/mips16.d --- binutils-2.7/gas/testsuite/gas/mips/mips16.d Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mips/mips16.d Wed Apr 30 12:54:35 1997 @@ -0,0 +1,683 @@ +#objdump: -dr +#as: -mips3 +#name: mips16 + +# Test the mips16 instruction set. + +.*: +file format .*mips.* + +Disassembly of section .text: + +0+000000 : + 0: 00000000 nop + +0+000004 : + 4: 3b40 ld \$v0,0\(\$v1\) + 6: f000 3b41 ld \$v0,1\(\$v1\) + a: f000 3b42 ld \$v0,2\(\$v1\) + e: f000 3b43 ld \$v0,3\(\$v1\) + 12: f000 3b44 ld \$v0,4\(\$v1\) + 16: 3b41 ld \$v0,8\(\$v1\) + 18: 3b42 ld \$v0,16\(\$v1\) + 1a: 3b44 ld \$v0,32\(\$v1\) + 1c: 3b48 ld \$v0,64\(\$v1\) + 1e: 3b50 ld \$v0,128\(\$v1\) + 20: f100 3b40 ld \$v0,256\(\$v1\) + 24: f200 3b40 ld \$v0,512\(\$v1\) + 28: f400 3b40 ld \$v0,1024\(\$v1\) + 2c: f001 3b40 ld \$v0,2048\(\$v1\) + 30: f7ff 3b5f ld \$v0,-1\(\$v1\) + 34: f7ff 3b5e ld \$v0,-2\(\$v1\) + 38: f7ff 3b5d ld \$v0,-3\(\$v1\) + 3c: f7ff 3b5c ld \$v0,-4\(\$v1\) + 40: f7ff 3b58 ld \$v0,-8\(\$v1\) + 44: f7ff 3b50 ld \$v0,-16\(\$v1\) + 48: f7ff 3b40 ld \$v0,-32\(\$v1\) + 4c: f7df 3b40 ld \$v0,-64\(\$v1\) + 50: f79f 3b40 ld \$v0,-128\(\$v1\) + 54: f71f 3b40 ld \$v0,-256\(\$v1\) + 58: f61f 3b40 ld \$v0,-512\(\$v1\) + 5c: f41f 3b40 ld \$v0,-1024\(\$v1\) + 60: f01f 3b40 ld \$v0,-2048\(\$v1\) + 64: f7bf fc40 ld \$v0,0 + 68: f6a0 fc54 ld \$v0,71c + 6c: f001 fc40 ld \$v0,868 + 70: f0c1 fc40 ld \$v0,930 + 74: f840 ld \$v0,0\(\$sp\) + 76: f000 f841 ld \$v0,1\(\$sp\) + 7a: f000 f842 ld \$v0,2\(\$sp\) + 7e: f000 f843 ld \$v0,3\(\$sp\) + 82: f000 f844 ld \$v0,4\(\$sp\) + 86: f841 ld \$v0,8\(\$sp\) + 88: f842 ld \$v0,16\(\$sp\) + 8a: f844 ld \$v0,32\(\$sp\) + 8c: f848 ld \$v0,64\(\$sp\) + 8e: f850 ld \$v0,128\(\$sp\) + 90: f100 f840 ld \$v0,256\(\$sp\) + 94: f200 f840 ld \$v0,512\(\$sp\) + 98: f400 f840 ld \$v0,1024\(\$sp\) + 9c: f001 f840 ld \$v0,2048\(\$sp\) + a0: f7ff f85f ld \$v0,-1\(\$sp\) + a4: f7ff f85e ld \$v0,-2\(\$sp\) + a8: f7ff f85d ld \$v0,-3\(\$sp\) + ac: f7ff f85c ld \$v0,-4\(\$sp\) + b0: f7ff f858 ld \$v0,-8\(\$sp\) + b4: f7ff f850 ld \$v0,-16\(\$sp\) + b8: f7ff f840 ld \$v0,-32\(\$sp\) + bc: f7df f840 ld \$v0,-64\(\$sp\) + c0: f79f f840 ld \$v0,-128\(\$sp\) + c4: f71f f840 ld \$v0,-256\(\$sp\) + c8: f61f f840 ld \$v0,-512\(\$sp\) + cc: f41f f840 ld \$v0,-1024\(\$sp\) + d0: f01f f840 ld \$v0,-2048\(\$sp\) + d4: bb40 lwu \$v0,0\(\$v1\) + d6: f000 bb41 lwu \$v0,1\(\$v1\) + da: f000 bb42 lwu \$v0,2\(\$v1\) + de: f000 bb43 lwu \$v0,3\(\$v1\) + e2: bb41 lwu \$v0,4\(\$v1\) + e4: bb42 lwu \$v0,8\(\$v1\) + e6: bb44 lwu \$v0,16\(\$v1\) + e8: bb48 lwu \$v0,32\(\$v1\) + ea: bb50 lwu \$v0,64\(\$v1\) + ec: f080 bb40 lwu \$v0,128\(\$v1\) + f0: f100 bb40 lwu \$v0,256\(\$v1\) + f4: f200 bb40 lwu \$v0,512\(\$v1\) + f8: f400 bb40 lwu \$v0,1024\(\$v1\) + fc: f001 bb40 lwu \$v0,2048\(\$v1\) + 100: f7ff bb5f lwu \$v0,-1\(\$v1\) + 104: f7ff bb5e lwu \$v0,-2\(\$v1\) + 108: f7ff bb5d lwu \$v0,-3\(\$v1\) + 10c: f7ff bb5c lwu \$v0,-4\(\$v1\) + 110: f7ff bb58 lwu \$v0,-8\(\$v1\) + 114: f7ff bb50 lwu \$v0,-16\(\$v1\) + 118: f7ff bb40 lwu \$v0,-32\(\$v1\) + 11c: f7df bb40 lwu \$v0,-64\(\$v1\) + 120: f79f bb40 lwu \$v0,-128\(\$v1\) + 124: f71f bb40 lwu \$v0,-256\(\$v1\) + 128: f61f bb40 lwu \$v0,-512\(\$v1\) + 12c: f41f bb40 lwu \$v0,-1024\(\$v1\) + 130: f01f bb40 lwu \$v0,-2048\(\$v1\) + 134: 9b40 lw \$v0,0\(\$v1\) + 136: f000 9b41 lw \$v0,1\(\$v1\) + 13a: f000 9b42 lw \$v0,2\(\$v1\) + 13e: f000 9b43 lw \$v0,3\(\$v1\) + 142: 9b41 lw \$v0,4\(\$v1\) + 144: 9b42 lw \$v0,8\(\$v1\) + 146: 9b44 lw \$v0,16\(\$v1\) + 148: 9b48 lw \$v0,32\(\$v1\) + 14a: 9b50 lw \$v0,64\(\$v1\) + 14c: f080 9b40 lw \$v0,128\(\$v1\) + 150: f100 9b40 lw \$v0,256\(\$v1\) + 154: f200 9b40 lw \$v0,512\(\$v1\) + 158: f400 9b40 lw \$v0,1024\(\$v1\) + 15c: f001 9b40 lw \$v0,2048\(\$v1\) + 160: f7ff 9b5f lw \$v0,-1\(\$v1\) + 164: f7ff 9b5e lw \$v0,-2\(\$v1\) + 168: f7ff 9b5d lw \$v0,-3\(\$v1\) + 16c: f7ff 9b5c lw \$v0,-4\(\$v1\) + 170: f7ff 9b58 lw \$v0,-8\(\$v1\) + 174: f7ff 9b50 lw \$v0,-16\(\$v1\) + 178: f7ff 9b40 lw \$v0,-32\(\$v1\) + 17c: f7df 9b40 lw \$v0,-64\(\$v1\) + 180: f79f 9b40 lw \$v0,-128\(\$v1\) + 184: f71f 9b40 lw \$v0,-256\(\$v1\) + 188: f61f 9b40 lw \$v0,-512\(\$v1\) + 18c: f41f 9b40 lw \$v0,-1024\(\$v1\) + 190: f01f 9b40 lw \$v0,-2048\(\$v1\) + 194: f67f b20c lw \$v0,0 + 198: f580 b204 lw \$v0,71c + 19c: f6c0 b20c lw \$v0,868 + 1a0: f780 b210 lw \$v0,930 + 1a4: 9200 lw \$v0,0\(\$sp\) + 1a6: f000 9201 lw \$v0,1\(\$sp\) + 1aa: f000 9202 lw \$v0,2\(\$sp\) + 1ae: f000 9203 lw \$v0,3\(\$sp\) + 1b2: 9201 lw \$v0,4\(\$sp\) + 1b4: 9202 lw \$v0,8\(\$sp\) + 1b6: 9204 lw \$v0,16\(\$sp\) + 1b8: 9208 lw \$v0,32\(\$sp\) + 1ba: 9210 lw \$v0,64\(\$sp\) + 1bc: 9220 lw \$v0,128\(\$sp\) + 1be: 9240 lw \$v0,256\(\$sp\) + 1c0: 9280 lw \$v0,512\(\$sp\) + 1c2: f400 9200 lw \$v0,1024\(\$sp\) + 1c6: f001 9200 lw \$v0,2048\(\$sp\) + 1ca: f7ff 921f lw \$v0,-1\(\$sp\) + 1ce: f7ff 921e lw \$v0,-2\(\$sp\) + 1d2: f7ff 921d lw \$v0,-3\(\$sp\) + 1d6: f7ff 921c lw \$v0,-4\(\$sp\) + 1da: f7ff 9218 lw \$v0,-8\(\$sp\) + 1de: f7ff 9210 lw \$v0,-16\(\$sp\) + 1e2: f7ff 9200 lw \$v0,-32\(\$sp\) + 1e6: f7df 9200 lw \$v0,-64\(\$sp\) + 1ea: f79f 9200 lw \$v0,-128\(\$sp\) + 1ee: f71f 9200 lw \$v0,-256\(\$sp\) + 1f2: f61f 9200 lw \$v0,-512\(\$sp\) + 1f6: f41f 9200 lw \$v0,-1024\(\$sp\) + 1fa: f01f 9200 lw \$v0,-2048\(\$sp\) + 1fe: 8b40 lh \$v0,0\(\$v1\) + 200: f000 8b41 lh \$v0,1\(\$v1\) + 204: 8b41 lh \$v0,2\(\$v1\) + 206: f000 8b43 lh \$v0,3\(\$v1\) + 20a: 8b42 lh \$v0,4\(\$v1\) + 20c: 8b44 lh \$v0,8\(\$v1\) + 20e: 8b48 lh \$v0,16\(\$v1\) + 210: 8b50 lh \$v0,32\(\$v1\) + 212: f040 8b40 lh \$v0,64\(\$v1\) + 216: f080 8b40 lh \$v0,128\(\$v1\) + 21a: f100 8b40 lh \$v0,256\(\$v1\) + 21e: f200 8b40 lh \$v0,512\(\$v1\) + 222: f400 8b40 lh \$v0,1024\(\$v1\) + 226: f001 8b40 lh \$v0,2048\(\$v1\) + 22a: f7ff 8b5f lh \$v0,-1\(\$v1\) + 22e: f7ff 8b5e lh \$v0,-2\(\$v1\) + 232: f7ff 8b5d lh \$v0,-3\(\$v1\) + 236: f7ff 8b5c lh \$v0,-4\(\$v1\) + 23a: f7ff 8b58 lh \$v0,-8\(\$v1\) + 23e: f7ff 8b50 lh \$v0,-16\(\$v1\) + 242: f7ff 8b40 lh \$v0,-32\(\$v1\) + 246: f7df 8b40 lh \$v0,-64\(\$v1\) + 24a: f79f 8b40 lh \$v0,-128\(\$v1\) + 24e: f71f 8b40 lh \$v0,-256\(\$v1\) + 252: f61f 8b40 lh \$v0,-512\(\$v1\) + 256: f41f 8b40 lh \$v0,-1024\(\$v1\) + 25a: f01f 8b40 lh \$v0,-2048\(\$v1\) + 25e: ab40 lhu \$v0,0\(\$v1\) + 260: f000 ab41 lhu \$v0,1\(\$v1\) + 264: ab41 lhu \$v0,2\(\$v1\) + 266: f000 ab43 lhu \$v0,3\(\$v1\) + 26a: ab42 lhu \$v0,4\(\$v1\) + 26c: ab44 lhu \$v0,8\(\$v1\) + 26e: ab48 lhu \$v0,16\(\$v1\) + 270: ab50 lhu \$v0,32\(\$v1\) + 272: f040 ab40 lhu \$v0,64\(\$v1\) + 276: f080 ab40 lhu \$v0,128\(\$v1\) + 27a: f100 ab40 lhu \$v0,256\(\$v1\) + 27e: f200 ab40 lhu \$v0,512\(\$v1\) + 282: f400 ab40 lhu \$v0,1024\(\$v1\) + 286: f001 ab40 lhu \$v0,2048\(\$v1\) + 28a: f7ff ab5f lhu \$v0,-1\(\$v1\) + 28e: f7ff ab5e lhu \$v0,-2\(\$v1\) + 292: f7ff ab5d lhu \$v0,-3\(\$v1\) + 296: f7ff ab5c lhu \$v0,-4\(\$v1\) + 29a: f7ff ab58 lhu \$v0,-8\(\$v1\) + 29e: f7ff ab50 lhu \$v0,-16\(\$v1\) + 2a2: f7ff ab40 lhu \$v0,-32\(\$v1\) + 2a6: f7df ab40 lhu \$v0,-64\(\$v1\) + 2aa: f79f ab40 lhu \$v0,-128\(\$v1\) + 2ae: f71f ab40 lhu \$v0,-256\(\$v1\) + 2b2: f61f ab40 lhu \$v0,-512\(\$v1\) + 2b6: f41f ab40 lhu \$v0,-1024\(\$v1\) + 2ba: f01f ab40 lhu \$v0,-2048\(\$v1\) + 2be: 8340 lb \$v0,0\(\$v1\) + 2c0: 8341 lb \$v0,1\(\$v1\) + 2c2: 8342 lb \$v0,2\(\$v1\) + 2c4: 8343 lb \$v0,3\(\$v1\) + 2c6: 8344 lb \$v0,4\(\$v1\) + 2c8: 8348 lb \$v0,8\(\$v1\) + 2ca: 8350 lb \$v0,16\(\$v1\) + 2cc: f020 8340 lb \$v0,32\(\$v1\) + 2d0: f040 8340 lb \$v0,64\(\$v1\) + 2d4: f080 8340 lb \$v0,128\(\$v1\) + 2d8: f100 8340 lb \$v0,256\(\$v1\) + 2dc: f200 8340 lb \$v0,512\(\$v1\) + 2e0: f400 8340 lb \$v0,1024\(\$v1\) + 2e4: f001 8340 lb \$v0,2048\(\$v1\) + 2e8: f7ff 835f lb \$v0,-1\(\$v1\) + 2ec: f7ff 835e lb \$v0,-2\(\$v1\) + 2f0: f7ff 835d lb \$v0,-3\(\$v1\) + 2f4: f7ff 835c lb \$v0,-4\(\$v1\) + 2f8: f7ff 8358 lb \$v0,-8\(\$v1\) + 2fc: f7ff 8350 lb \$v0,-16\(\$v1\) + 300: f7ff 8340 lb \$v0,-32\(\$v1\) + 304: f7df 8340 lb \$v0,-64\(\$v1\) + 308: f79f 8340 lb \$v0,-128\(\$v1\) + 30c: f71f 8340 lb \$v0,-256\(\$v1\) + 310: f61f 8340 lb \$v0,-512\(\$v1\) + 314: f41f 8340 lb \$v0,-1024\(\$v1\) + 318: f01f 8340 lb \$v0,-2048\(\$v1\) + 31c: a340 lbu \$v0,0\(\$v1\) + 31e: a341 lbu \$v0,1\(\$v1\) + 320: a342 lbu \$v0,2\(\$v1\) + 322: a343 lbu \$v0,3\(\$v1\) + 324: a344 lbu \$v0,4\(\$v1\) + 326: a348 lbu \$v0,8\(\$v1\) + 328: a350 lbu \$v0,16\(\$v1\) + 32a: f020 a340 lbu \$v0,32\(\$v1\) + 32e: f040 a340 lbu \$v0,64\(\$v1\) + 332: f080 a340 lbu \$v0,128\(\$v1\) + 336: f100 a340 lbu \$v0,256\(\$v1\) + 33a: f200 a340 lbu \$v0,512\(\$v1\) + 33e: f400 a340 lbu \$v0,1024\(\$v1\) + 342: f001 a340 lbu \$v0,2048\(\$v1\) + 346: f7ff a35f lbu \$v0,-1\(\$v1\) + 34a: f7ff a35e lbu \$v0,-2\(\$v1\) + 34e: f7ff a35d lbu \$v0,-3\(\$v1\) + 352: f7ff a35c lbu \$v0,-4\(\$v1\) + 356: f7ff a358 lbu \$v0,-8\(\$v1\) + 35a: f7ff a350 lbu \$v0,-16\(\$v1\) + 35e: f7ff a340 lbu \$v0,-32\(\$v1\) + 362: f7df a340 lbu \$v0,-64\(\$v1\) + 366: f79f a340 lbu \$v0,-128\(\$v1\) + 36a: f71f a340 lbu \$v0,-256\(\$v1\) + 36e: f61f a340 lbu \$v0,-512\(\$v1\) + 372: f41f a340 lbu \$v0,-1024\(\$v1\) + 376: f01f a340 lbu \$v0,-2048\(\$v1\) + 37a: 7b40 sd \$v0,0\(\$v1\) + 37c: f000 7b41 sd \$v0,1\(\$v1\) + 380: f000 7b42 sd \$v0,2\(\$v1\) + 384: f000 7b43 sd \$v0,3\(\$v1\) + 388: f000 7b44 sd \$v0,4\(\$v1\) + 38c: 7b41 sd \$v0,8\(\$v1\) + 38e: 7b42 sd \$v0,16\(\$v1\) + 390: 7b44 sd \$v0,32\(\$v1\) + 392: 7b48 sd \$v0,64\(\$v1\) + 394: 7b50 sd \$v0,128\(\$v1\) + 396: f100 7b40 sd \$v0,256\(\$v1\) + 39a: f200 7b40 sd \$v0,512\(\$v1\) + 39e: f400 7b40 sd \$v0,1024\(\$v1\) + 3a2: f001 7b40 sd \$v0,2048\(\$v1\) + 3a6: f7ff 7b5f sd \$v0,-1\(\$v1\) + 3aa: f7ff 7b5e sd \$v0,-2\(\$v1\) + 3ae: f7ff 7b5d sd \$v0,-3\(\$v1\) + 3b2: f7ff 7b5c sd \$v0,-4\(\$v1\) + 3b6: f7ff 7b58 sd \$v0,-8\(\$v1\) + 3ba: f7ff 7b50 sd \$v0,-16\(\$v1\) + 3be: f7ff 7b40 sd \$v0,-32\(\$v1\) + 3c2: f7df 7b40 sd \$v0,-64\(\$v1\) + 3c6: f79f 7b40 sd \$v0,-128\(\$v1\) + 3ca: f71f 7b40 sd \$v0,-256\(\$v1\) + 3ce: f61f 7b40 sd \$v0,-512\(\$v1\) + 3d2: f41f 7b40 sd \$v0,-1024\(\$v1\) + 3d6: f01f 7b40 sd \$v0,-2048\(\$v1\) + 3da: f940 sd \$v0,0\(\$sp\) + 3dc: f000 f941 sd \$v0,1\(\$sp\) + 3e0: f000 f942 sd \$v0,2\(\$sp\) + 3e4: f000 f943 sd \$v0,3\(\$sp\) + 3e8: f000 f944 sd \$v0,4\(\$sp\) + 3ec: f941 sd \$v0,8\(\$sp\) + 3ee: f942 sd \$v0,16\(\$sp\) + 3f0: f944 sd \$v0,32\(\$sp\) + 3f2: f948 sd \$v0,64\(\$sp\) + 3f4: f950 sd \$v0,128\(\$sp\) + 3f6: f100 f940 sd \$v0,256\(\$sp\) + 3fa: f200 f940 sd \$v0,512\(\$sp\) + 3fe: f400 f940 sd \$v0,1024\(\$sp\) + 402: f001 f940 sd \$v0,2048\(\$sp\) + 406: f7ff f95f sd \$v0,-1\(\$sp\) + 40a: f7ff f95e sd \$v0,-2\(\$sp\) + 40e: f7ff f95d sd \$v0,-3\(\$sp\) + 412: f7ff f95c sd \$v0,-4\(\$sp\) + 416: f7ff f958 sd \$v0,-8\(\$sp\) + 41a: f7ff f950 sd \$v0,-16\(\$sp\) + 41e: f7ff f940 sd \$v0,-32\(\$sp\) + 422: f7df f940 sd \$v0,-64\(\$sp\) + 426: f79f f940 sd \$v0,-128\(\$sp\) + 42a: f71f f940 sd \$v0,-256\(\$sp\) + 42e: f61f f940 sd \$v0,-512\(\$sp\) + 432: f41f f940 sd \$v0,-1024\(\$sp\) + 436: f01f f940 sd \$v0,-2048\(\$sp\) + 43a: fa00 sd \$ra,0\(\$sp\) + 43c: f000 fa01 sd \$ra,1\(\$sp\) + 440: f000 fa02 sd \$ra,2\(\$sp\) + 444: f000 fa03 sd \$ra,3\(\$sp\) + 448: f000 fa04 sd \$ra,4\(\$sp\) + 44c: fa01 sd \$ra,8\(\$sp\) + 44e: fa02 sd \$ra,16\(\$sp\) + 450: fa04 sd \$ra,32\(\$sp\) + 452: fa08 sd \$ra,64\(\$sp\) + 454: fa10 sd \$ra,128\(\$sp\) + 456: fa20 sd \$ra,256\(\$sp\) + 458: fa40 sd \$ra,512\(\$sp\) + 45a: fa80 sd \$ra,1024\(\$sp\) + 45c: f001 fa00 sd \$ra,2048\(\$sp\) + 460: f7ff fa1f sd \$ra,-1\(\$sp\) + 464: f7ff fa1e sd \$ra,-2\(\$sp\) + 468: f7ff fa1d sd \$ra,-3\(\$sp\) + 46c: f7ff fa1c sd \$ra,-4\(\$sp\) + 470: f7ff fa18 sd \$ra,-8\(\$sp\) + 474: f7ff fa10 sd \$ra,-16\(\$sp\) + 478: f7ff fa00 sd \$ra,-32\(\$sp\) + 47c: f7df fa00 sd \$ra,-64\(\$sp\) + 480: f79f fa00 sd \$ra,-128\(\$sp\) + 484: f71f fa00 sd \$ra,-256\(\$sp\) + 488: f61f fa00 sd \$ra,-512\(\$sp\) + 48c: f41f fa00 sd \$ra,-1024\(\$sp\) + 490: f01f fa00 sd \$ra,-2048\(\$sp\) + 494: db40 sw \$v0,0\(\$v1\) + 496: f000 db41 sw \$v0,1\(\$v1\) + 49a: f000 db42 sw \$v0,2\(\$v1\) + 49e: f000 db43 sw \$v0,3\(\$v1\) + 4a2: db41 sw \$v0,4\(\$v1\) + 4a4: db42 sw \$v0,8\(\$v1\) + 4a6: db44 sw \$v0,16\(\$v1\) + 4a8: db48 sw \$v0,32\(\$v1\) + 4aa: db50 sw \$v0,64\(\$v1\) + 4ac: f080 db40 sw \$v0,128\(\$v1\) + 4b0: f100 db40 sw \$v0,256\(\$v1\) + 4b4: f200 db40 sw \$v0,512\(\$v1\) + 4b8: f400 db40 sw \$v0,1024\(\$v1\) + 4bc: f001 db40 sw \$v0,2048\(\$v1\) + 4c0: f7ff db5f sw \$v0,-1\(\$v1\) + 4c4: f7ff db5e sw \$v0,-2\(\$v1\) + 4c8: f7ff db5d sw \$v0,-3\(\$v1\) + 4cc: f7ff db5c sw \$v0,-4\(\$v1\) + 4d0: f7ff db58 sw \$v0,-8\(\$v1\) + 4d4: f7ff db50 sw \$v0,-16\(\$v1\) + 4d8: f7ff db40 sw \$v0,-32\(\$v1\) + 4dc: f7df db40 sw \$v0,-64\(\$v1\) + 4e0: f79f db40 sw \$v0,-128\(\$v1\) + 4e4: f71f db40 sw \$v0,-256\(\$v1\) + 4e8: f61f db40 sw \$v0,-512\(\$v1\) + 4ec: f41f db40 sw \$v0,-1024\(\$v1\) + 4f0: f01f db40 sw \$v0,-2048\(\$v1\) + 4f4: d200 sw \$v0,0\(\$sp\) + 4f6: f000 d201 sw \$v0,1\(\$sp\) + 4fa: f000 d202 sw \$v0,2\(\$sp\) + 4fe: f000 d203 sw \$v0,3\(\$sp\) + 502: d201 sw \$v0,4\(\$sp\) + 504: d202 sw \$v0,8\(\$sp\) + 506: d204 sw \$v0,16\(\$sp\) + 508: d208 sw \$v0,32\(\$sp\) + 50a: d210 sw \$v0,64\(\$sp\) + 50c: d220 sw \$v0,128\(\$sp\) + 50e: d240 sw \$v0,256\(\$sp\) + 510: d280 sw \$v0,512\(\$sp\) + 512: f400 d200 sw \$v0,1024\(\$sp\) + 516: f001 d200 sw \$v0,2048\(\$sp\) + 51a: f7ff d21f sw \$v0,-1\(\$sp\) + 51e: f7ff d21e sw \$v0,-2\(\$sp\) + 522: f7ff d21d sw \$v0,-3\(\$sp\) + 526: f7ff d21c sw \$v0,-4\(\$sp\) + 52a: f7ff d218 sw \$v0,-8\(\$sp\) + 52e: f7ff d210 sw \$v0,-16\(\$sp\) + 532: f7ff d200 sw \$v0,-32\(\$sp\) + 536: f7df d200 sw \$v0,-64\(\$sp\) + 53a: f79f d200 sw \$v0,-128\(\$sp\) + 53e: f71f d200 sw \$v0,-256\(\$sp\) + 542: f61f d200 sw \$v0,-512\(\$sp\) + 546: f41f d200 sw \$v0,-1024\(\$sp\) + 54a: f01f d200 sw \$v0,-2048\(\$sp\) + 54e: 6200 sw \$ra,0\(\$sp\) + 550: f000 6201 sw \$ra,1\(\$sp\) + 554: f000 6202 sw \$ra,2\(\$sp\) + 558: f000 6203 sw \$ra,3\(\$sp\) + 55c: 6201 sw \$ra,4\(\$sp\) + 55e: 6202 sw \$ra,8\(\$sp\) + 560: 6204 sw \$ra,16\(\$sp\) + 562: 6208 sw \$ra,32\(\$sp\) + 564: 6210 sw \$ra,64\(\$sp\) + 566: 6220 sw \$ra,128\(\$sp\) + 568: 6240 sw \$ra,256\(\$sp\) + 56a: 6280 sw \$ra,512\(\$sp\) + 56c: f400 6200 sw \$ra,1024\(\$sp\) + 570: f001 6200 sw \$ra,2048\(\$sp\) + 574: f7ff 621f sw \$ra,-1\(\$sp\) + 578: f7ff 621e sw \$ra,-2\(\$sp\) + 57c: f7ff 621d sw \$ra,-3\(\$sp\) + 580: f7ff 621c sw \$ra,-4\(\$sp\) + 584: f7ff 6218 sw \$ra,-8\(\$sp\) + 588: f7ff 6210 sw \$ra,-16\(\$sp\) + 58c: f7ff 6200 sw \$ra,-32\(\$sp\) + 590: f7df 6200 sw \$ra,-64\(\$sp\) + 594: f79f 6200 sw \$ra,-128\(\$sp\) + 598: f71f 6200 sw \$ra,-256\(\$sp\) + 59c: f61f 6200 sw \$ra,-512\(\$sp\) + 5a0: f41f 6200 sw \$ra,-1024\(\$sp\) + 5a4: f01f 6200 sw \$ra,-2048\(\$sp\) + 5a8: cb40 sh \$v0,0\(\$v1\) + 5aa: f000 cb41 sh \$v0,1\(\$v1\) + 5ae: cb41 sh \$v0,2\(\$v1\) + 5b0: f000 cb43 sh \$v0,3\(\$v1\) + 5b4: cb42 sh \$v0,4\(\$v1\) + 5b6: cb44 sh \$v0,8\(\$v1\) + 5b8: cb48 sh \$v0,16\(\$v1\) + 5ba: cb50 sh \$v0,32\(\$v1\) + 5bc: f040 cb40 sh \$v0,64\(\$v1\) + 5c0: f080 cb40 sh \$v0,128\(\$v1\) + 5c4: f100 cb40 sh \$v0,256\(\$v1\) + 5c8: f200 cb40 sh \$v0,512\(\$v1\) + 5cc: f400 cb40 sh \$v0,1024\(\$v1\) + 5d0: f001 cb40 sh \$v0,2048\(\$v1\) + 5d4: f7ff cb5f sh \$v0,-1\(\$v1\) + 5d8: f7ff cb5e sh \$v0,-2\(\$v1\) + 5dc: f7ff cb5d sh \$v0,-3\(\$v1\) + 5e0: f7ff cb5c sh \$v0,-4\(\$v1\) + 5e4: f7ff cb58 sh \$v0,-8\(\$v1\) + 5e8: f7ff cb50 sh \$v0,-16\(\$v1\) + 5ec: f7ff cb40 sh \$v0,-32\(\$v1\) + 5f0: f7df cb40 sh \$v0,-64\(\$v1\) + 5f4: f79f cb40 sh \$v0,-128\(\$v1\) + 5f8: f71f cb40 sh \$v0,-256\(\$v1\) + 5fc: f61f cb40 sh \$v0,-512\(\$v1\) + 600: f41f cb40 sh \$v0,-1024\(\$v1\) + 604: f01f cb40 sh \$v0,-2048\(\$v1\) + 608: c340 sb \$v0,0\(\$v1\) + 60a: c341 sb \$v0,1\(\$v1\) + 60c: c342 sb \$v0,2\(\$v1\) + 60e: c343 sb \$v0,3\(\$v1\) + 610: c344 sb \$v0,4\(\$v1\) + 612: c348 sb \$v0,8\(\$v1\) + 614: c350 sb \$v0,16\(\$v1\) + 616: f020 c340 sb \$v0,32\(\$v1\) + 61a: f040 c340 sb \$v0,64\(\$v1\) + 61e: f080 c340 sb \$v0,128\(\$v1\) + 622: f100 c340 sb \$v0,256\(\$v1\) + 626: f200 c340 sb \$v0,512\(\$v1\) + 62a: f400 c340 sb \$v0,1024\(\$v1\) + 62e: f001 c340 sb \$v0,2048\(\$v1\) + 632: f7ff c35f sb \$v0,-1\(\$v1\) + 636: f7ff c35e sb \$v0,-2\(\$v1\) + 63a: f7ff c35d sb \$v0,-3\(\$v1\) + 63e: f7ff c35c sb \$v0,-4\(\$v1\) + 642: f7ff c358 sb \$v0,-8\(\$v1\) + 646: f7ff c350 sb \$v0,-16\(\$v1\) + 64a: f7ff c340 sb \$v0,-32\(\$v1\) + 64e: f7df c340 sb \$v0,-64\(\$v1\) + 652: f79f c340 sb \$v0,-128\(\$v1\) + 656: f71f c340 sb \$v0,-256\(\$v1\) + 65a: f61f c340 sb \$v0,-512\(\$v1\) + 65e: f41f c340 sb \$v0,-1024\(\$v1\) + 662: f01f c340 sb \$v0,-2048\(\$v1\) + 666: 6a00 li \$v0,0 + 668: 6a01 li \$v0,1 + 66a: f100 6a00 li \$v0,256 + 66e: 675e move \$v0,\$s8 + 670: 6592 move \$s4,\$v0 + 672: 4350 daddiu \$v0,\$v1,0 + 674: 4351 daddiu \$v0,\$v1,1 + 676: 435f daddiu \$v0,\$v1,-1 + 678: f010 4350 daddiu \$v0,\$v1,16 + 67c: f7ff 4350 daddiu \$v0,\$v1,-16 + 680: e388 daddu \$v0,\$v1,\$a0 + 682: fd40 daddiu \$v0,0 + 684: fd41 daddiu \$v0,1 + 686: fd5f daddiu \$v0,-1 + 688: f020 fd40 daddiu \$v0,32 + 68c: f7ff fd40 daddiu \$v0,-32 + 690: f080 fd40 daddiu \$v0,128 + 694: f79f fd40 daddiu \$v0,-128 + 698: f17f fe48 dla \$v0,0 + 69c: f080 fe40 dla \$v0,71c + 6a0: f1c0 fe48 dla \$v0,868 + 6a4: f280 fe4c dla \$v0,930 + 6a8: fb00 daddiu \$sp,0 + 6aa: f000 fb01 daddiu \$sp,1 + 6ae: f7ff fb1f daddiu \$sp,-1 + 6b2: fb20 daddiu \$sp,256 + 6b4: fbe0 daddiu \$sp,-256 + 6b6: ff40 daddiu \$v0,\$sp,0 + 6b8: f000 ff41 daddiu \$v0,\$sp,1 + 6bc: f7ff ff5f daddiu \$v0,\$sp,-1 + 6c0: ff48 daddiu \$v0,\$sp,32 + 6c2: f7ff ff40 daddiu \$v0,\$sp,-32 + 6c6: f080 ff40 daddiu \$v0,\$sp,128 + 6ca: f79f ff40 daddiu \$v0,\$sp,-128 + 6ce: 4340 addiu \$v0,\$v1,0 + 6d0: 4341 addiu \$v0,\$v1,1 + 6d2: 434f addiu \$v0,\$v1,-1 + 6d4: f010 4340 addiu \$v0,\$v1,16 + 6d8: f7ff 4340 addiu \$v0,\$v1,-16 + 6dc: e389 addu \$v0,\$v1,\$a0 + 6de: 4a00 addiu \$v0,0 + 6e0: 4a01 addiu \$v0,1 + 6e2: 4aff addiu \$v0,-1 + 6e4: 4a20 addiu \$v0,32 + 6e6: 4ae0 addiu \$v0,-32 + 6e8: f080 4a00 addiu \$v0,128 + 6ec: 4a80 addiu \$v0,-128 + 6ee: f11f 0a14 la \$v0,0 + 6f2: 0a0b la \$v0,71c + 6f4: 0a5d la \$v0,868 + 6f6: 0a8f la \$v0,930 + 6f8: 6300 addiu \$sp,0 + 6fa: f000 6301 addiu \$sp,1 + 6fe: f7ff 631f addiu \$sp,-1 + 702: 6320 addiu \$sp,256 + 704: 63e0 addiu \$sp,-256 + 706: 0200 addiu \$v0,\$sp,0 + 708: f000 0201 addiu \$v0,\$sp,1 + 70c: f7ff 021f addiu \$v0,\$sp,-1 + 710: 0208 addiu \$v0,\$sp,32 + 712: f7ff 0200 addiu \$v0,\$sp,-32 + 716: 0220 addiu \$v0,\$sp,128 + 718: f79f 0200 addiu \$v0,\$sp,-128 + +0+00071c : + 71c: 00000000 nop + +0+000720 : + 720: e38a dsubu \$v0,\$v1,\$a0 + 722: e38b subu \$v0,\$v1,\$a0 + 724: ea6b neg \$v0,\$v1 + 726: ea6c and \$v0,\$v1 + 728: ea6d or \$v0,\$v1 + 72a: ea6e xor \$v0,\$v1 + 72c: ea6f not \$v0,\$v1 + 72e: 5200 slti \$v0,0 + 730: 5201 slti \$v0,1 + 732: f7ff 521f slti \$v0,-1 + 736: 52ff slti \$v0,255 + 738: f100 5200 slti \$v0,256 + 73c: ea62 slt \$v0,\$v1 + 73e: 5a00 sltiu \$v0,0 + 740: 5a01 sltiu \$v0,1 + 742: f7ff 5a1f sltiu \$v0,-1 + 746: 5aff sltiu \$v0,255 + 748: f100 5a00 sltiu \$v0,256 + 74c: ea63 sltu \$v0,\$v1 + 74e: 7200 cmpi \$v0,0 + 750: 7201 cmpi \$v0,1 + 752: 72ff cmpi \$v0,255 + 754: f100 7200 cmpi \$v0,256 + 758: ea6a cmp \$v0,\$v1 + 75a: f000 3261 dsll \$v0,\$v1,0 + 75e: 3265 dsll \$v0,\$v1,1 + 760: 3261 dsll \$v0,\$v1,8 + 762: f240 3261 dsll \$v0,\$v1,9 + 766: f7e0 3261 dsll \$v0,\$v1,63 + 76a: eb54 dsllv \$v0,\$v1 + 76c: f000 e848 dsrl \$v0,0 + 770: e948 dsrl \$v0,1 + 772: e848 dsrl \$v0,0 + 774: f240 e848 dsrl \$v0,9 + 778: f7e0 e848 dsrl \$v0,63 + 77c: eb56 dsrlv \$v0,\$v1 + 77e: f000 e853 dsra \$v0,0 + 782: e953 dsra \$v0,1 + 784: e853 dsra \$v0,0 + 786: f240 e853 dsra \$v0,9 + 78a: f7e0 e853 dsra \$v0,63 + 78e: eb57 dsrav \$v0,\$v1 + 790: ea12 mflo \$v0 + 792: eb10 mfhi \$v1 + 794: f000 3260 sll \$v0,\$v1,0 + 798: 3264 sll \$v0,\$v1,1 + 79a: 3260 sll \$v0,\$v1,8 + 79c: f240 3260 sll \$v0,\$v1,9 + 7a0: f7c0 3260 sll \$v0,\$v1,31 + 7a4: eb44 sllv \$v0,\$v1 + 7a6: f000 3262 srl \$v0,\$v1,0 + 7aa: 3266 srl \$v0,\$v1,1 + 7ac: 3262 srl \$v0,\$v1,8 + 7ae: f240 3262 srl \$v0,\$v1,9 + 7b2: f7c0 3262 srl \$v0,\$v1,31 + 7b6: eb46 srlv \$v0,\$v1 + 7b8: f000 3263 sra \$v0,\$v1,0 + 7bc: 3267 sra \$v0,\$v1,1 + 7be: 3263 sra \$v0,\$v1,8 + 7c0: f240 3263 sra \$v0,\$v1,9 + 7c4: f7c0 3263 sra \$v0,\$v1,31 + 7c8: eb47 srav \$v0,\$v1 + 7ca: ea7c dmult \$v0,\$v1 + 7cc: ea7d dmultu \$v0,\$v1 + 7ce: ea7e ddiv \$zero,\$v0,\$v1 + 7d0: 2b01 bnez \$v1,7d4 + 7d2: e8e5 break 7 + 7d4: ea12 mflo \$v0 + 7d6: 6500 nop + 7d8: 6500 nop + 7da: ea7f ddivu \$zero,\$v0,\$v1 + 7dc: 2b01 bnez \$v1,7e0 + 7de: e8e5 break 7 + 7e0: ea12 mflo \$v0 + 7e2: 6500 nop + 7e4: 6500 nop + 7e6: ea78 mult \$v0,\$v1 + 7e8: ea79 multu \$v0,\$v1 + 7ea: ea7a div \$zero,\$v0,\$v1 + 7ec: 2b01 bnez \$v1,7f0 + 7ee: e8e5 break 7 + 7f0: ea12 mflo \$v0 + 7f2: 6500 nop + 7f4: 6500 nop + 7f6: ea7b divu \$zero,\$v0,\$v1 + 7f8: 2b01 bnez \$v1,7fc + 7fa: e8e5 break 7 + 7fc: ea12 mflo \$v0 + 7fe: ea00 jr \$v0 + 800: 6500 nop + 802: e820 jr \$ra + 804: 6500 nop + 806: ea40 jalr \$v0 + 808: 6500 nop + 80a: f3ff 221b beqz \$v0,4 + 80e: 2288 beqz \$v0,720 + 810: 222b beqz \$v0,868 + 812: f080 220d beqz \$v0,930 + 816: f3ff 2a15 bnez \$v0,4 + 81a: 2a82 bnez \$v0,720 + 81c: 2a25 bnez \$v0,868 + 81e: f080 2a07 bnez \$v0,930 + 822: f3ff 600f bteqz 4 + 826: f77f 601b bteqz 720 + 82a: 601e bteqz 868 + 82c: f080 6000 bteqz 930 + 830: f3ff 6108 btnez 4 + 834: f77f 6114 btnez 720 + 838: 6117 btnez 868 + 83a: 617a btnez 930 + 83c: f3ff 1002 b 4 + 840: 176f b 720 + 842: 1012 b 868 + 844: 1075 b 930 + 846: e805 break 0 + 848: e825 break 1 + 84a: efe5 break 63 + 84c: 1800 0000 jal 0 + 84c: R_MIPS16_26 extern + 850: 6500 nop + 852: e809 entry + 854: e909 entry \$a0 + 856: eb49 entry \$a0-\$a2,\$s0 + 858: e8a9 entry \$s0-\$s1,\$ra + 85a: e829 entry \$ra + 85c: ef09 exit + 85e: ef49 exit \$s0 + 860: efa9 exit \$s0-\$s1,\$ra + 862: ef29 exit \$ra + 864: 0000 addiu \$s0,\$sp,0 + ... + +0+000868 : + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/mips16.s binutils-2.8/gas/testsuite/gas/mips/mips16.s --- binutils-2.7/gas/testsuite/gas/mips/mips16.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mips/mips16.s Wed Apr 30 12:54:35 1997 @@ -0,0 +1,258 @@ +# Test the mips16 instruction set. + + .set mips16 + + .macro ldst op, reg, base + \op \reg,0(\base) + \op \reg,1(\base) + \op \reg,2(\base) + \op \reg,3(\base) + \op \reg,4(\base) + \op \reg,8(\base) + \op \reg,16(\base) + \op \reg,32(\base) + \op \reg,64(\base) + \op \reg,128(\base) + \op \reg,256(\base) + \op \reg,512(\base) + \op \reg,1024(\base) + \op \reg,2048(\base) + \op \reg,-1(\base) + \op \reg,-2(\base) + \op \reg,-3(\base) + \op \reg,-4(\base) + \op \reg,-8(\base) + \op \reg,-16(\base) + \op \reg,-32(\base) + \op \reg,-64(\base) + \op \reg,-128(\base) + \op \reg,-256(\base) + \op \reg,-512(\base) + \op \reg,-1024(\base) + \op \reg,-2048(\base) + .endm + + .p2align 3 +data1: + .word 0 +insns1: + ldst ld, $2, $3 + ld $2,data1 + ld $2,data2 + ld $2,bar + ld $2,quux + ldst ld, $2, $sp + ldst lwu, $2, $3 + ldst lw, $2, $3 + lw $2,data1 + lw $2,data2 + lw $2,bar + lw $2,quux + ldst lw, $2, $sp + ldst lh, $2, $3 + ldst lhu, $2, $3 + ldst lb, $2, $3 + ldst lbu, $2, $3 + ldst sd, $2, $3 + ldst sd, $2, $sp + ldst sd, $31, $sp + ldst sw, $2, $3 + ldst sw, $2, $sp + ldst sw, $31, $sp + ldst sh, $2, $3 + ldst sb, $2, $3 + + li $2,0 + li $2,1 + li $2,256 + + move $2,$30 + move $20,$2 + + daddu $2,$3,0 + daddu $2,$3,1 + daddu $2,$3,-1 + daddu $2,$3,16 + daddu $2,$3,-16 + daddu $2,$3,$4 + daddu $2,0 + daddu $2,1 + daddu $2,-1 + daddu $2,32 + daddu $2,-32 + daddu $2,128 + daddu $2,-128 + dla $2,data1 + dla $2,data2 + dla $2,bar + dla $2,quux + daddu $sp,0 + daddu $sp,1 + daddu $sp,-1 + daddu $sp,256 + daddu $sp,-256 + daddu $2,$sp,0 + daddu $2,$sp,1 + daddu $2,$sp,-1 + daddu $2,$sp,32 + daddu $2,$sp,-32 + daddu $2,$sp,128 + daddu $2,$sp,-128 + + addu $2,$3,0 + addu $2,$3,1 + addu $2,$3,-1 + addu $2,$3,16 + addu $2,$3,-16 + addu $2,$3,$4 + addu $2,0 + addu $2,1 + addu $2,-1 + addu $2,32 + addu $2,-32 + addu $2,128 + addu $2,-128 + la $2,data1 + la $2,data2 + la $2,bar + la $2,quux + addu $sp,0 + addu $sp,1 + addu $sp,-1 + addu $sp,256 + addu $sp,-256 + addu $2,$sp,0 + addu $2,$sp,1 + addu $2,$sp,-1 + addu $2,$sp,32 + addu $2,$sp,-32 + addu $2,$sp,128 + addu $2,$sp,-128 + +data2: + .word 0 +insns2: + dsubu $2,$3,$4 + subu $2,$3,$4 + neg $2,$3 + + and $2,$3 + or $2,$3 + xor $2,$3 + not $2,$3 + + slt $2,0 + slt $2,1 + slt $2,-1 + slt $2,255 + slt $2,256 + slt $2,$3 + sltu $2,0 + sltu $2,1 + sltu $2,-1 + sltu $2,255 + sltu $2,256 + sltu $2,$3 + cmp $2,0 + cmp $2,1 + cmp $2,255 + cmp $2,256 + cmp $2,$3 + + dsll $2,$3,0 + dsll $2,$3,1 + dsll $2,$3,8 + dsll $2,$3,9 + dsll $2,$3,63 + dsll $2,$3 + dsrl $2,0 + dsrl $2,1 + dsrl $2,8 + dsrl $2,9 + dsrl $2,63 + dsrl $2,$3 + dsra $2,0 + dsra $2,1 + dsra $2,8 + dsra $2,9 + dsra $2,63 + dsra $2,$3 + + mflo $2 + mfhi $3 + + sll $2,$3,0 + sll $2,$3,1 + sll $2,$3,8 + sll $2,$3,9 + sll $2,$3,31 + sll $2,$3 + srl $2,$3,0 + srl $2,$3,1 + srl $2,$3,8 + srl $2,$3,9 + srl $2,$3,31 + srl $2,$3 + sra $2,$3,0 + sra $2,$3,1 + sra $2,$3,8 + sra $2,$3,9 + sra $2,$3,31 + sra $2,$3 + + dmult $2,$3 + dmultu $2,$3 + ddiv $2,$3 + ddivu $2,$3 + + mult $2,$3 + multu $2,$3 + div $2,$3 + divu $2,$3 + + jr $2 + jr $31 + jalr $31,$2 + + beqz $2,insns1 + beqz $2,insns2 + beqz $2,bar + beqz $2,quux + bnez $2,insns1 + bnez $2,insns2 + bnez $2,bar + bnez $2,quux + bteqz insns1 + bteqz insns2 + bteqz bar + bteqz quux + btnez insns1 + btnez insns2 + btnez bar + btnez quux + b insns1 + b insns2 + b bar + b quux + + break 0 + break 1 + break 63 + + jal extern + + entry + entry $4 + entry $4-$6,$16 + entry $16-$17,$31 + entry $31 + exit + exit $16 + exit $16-$17,$31 + exit $31 + + .p2align 3 +bar: + + .skip 200 +quux: diff -urN binutils-2.7/gas/testsuite/gas/mips/mips4.d binutils-2.8/gas/testsuite/gas/mips/mips4.d --- binutils-2.7/gas/testsuite/gas/mips/mips4.d Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/mips4.d Wed Apr 30 12:54:33 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS mips4 #as: -mips4 @@ -7,45 +7,45 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> bc1f 00000000+ -... -0+0008 <[^>]*> bc1f 1,00000000+ -... -0+0010 <[^>]*> bc1fl 1,00000000+ -... -0+0018 <[^>]*> bc1t 1,00000000+ -... -0+0020 <[^>]*> bc1tl 2,00000000+ -... -0+0028 <[^>]*> c.f.d \$f4,\$f6 -0+002c <[^>]*> c.f.d 1,\$f4,\$f6 -0+0030 <[^>]*> ldxc1 \$f2,\$a0\(\$a1\) -0+0034 <[^>]*> lwxc1 \$f2,\$a0\(\$a1\) -0+0038 <[^>]*> madd.d \$f0,\$f2,\$f4,\$f6 -0+003c <[^>]*> madd.s \$f0,\$f2,\$f4,\$f6 -0+0040 <[^>]*> movf \$a0,\$a1,4 -0+0044 <[^>]*> movf.d \$f4,\$f6,0 -0+0048 <[^>]*> movf.s \$f4,\$f6,0 -0+004c <[^>]*> movn \$a0,\$a2,\$a2 -0+0050 <[^>]*> movn.d \$f4,\$f5,\$a2 -0+0054 <[^>]*> movn.s \$f4,\$f5,\$a2 -0+0058 <[^>]*> movt \$a0,\$a1,4 -0+005c <[^>]*> movt.d \$f4,\$f6,0 -0+0060 <[^>]*> movt.s \$f4,\$f6,0 -0+0064 <[^>]*> movz \$a0,\$a2,\$a2 -0+0068 <[^>]*> movz.d \$f4,\$f5,\$a2 -0+006c <[^>]*> movz.s \$f4,\$f5,\$a2 -0+0070 <[^>]*> msub.d \$f0,\$f2,\$f4,\$f6 -0+0074 <[^>]*> msub.s \$f0,\$f2,\$f4,\$f6 -0+0078 <[^>]*> nmadd.d \$f0,\$f2,\$f4,\$f6 -0+007c <[^>]*> nmadd.s \$f0,\$f2,\$f4,\$f6 -0+0080 <[^>]*> nmsub.d \$f0,\$f2,\$f4,\$f6 -0+0084 <[^>]*> nmsub.s \$f0,\$f2,\$f4,\$f6 -0+0088 <[^>]*> prefx 0x4,\$a0\(\$a1\) -0+008c <[^>]*> recip.d \$f4,\$f6 -0+0090 <[^>]*> recip.s \$f4,\$f6 -0+0094 <[^>]*> rsqrt.d \$f4,\$f6 -0+0098 <[^>]*> rsqrt.s \$f4,\$f6 -0+009c <[^>]*> sdxc1 \$f4,\$a0\(\$a1\) -0+00a0 <[^>]*> swxc1 \$f4,\$a0\(\$a1\) -... +0+0000 <[^>]*> bc1f 00000000+ +0+0004 <[^>]*> nop +0+0008 <[^>]*> bc1f \$fcc1,00000000+ +0+000c <[^>]*> nop +0+0010 <[^>]*> bc1fl \$fcc1,00000000+ +0+0014 <[^>]*> nop +0+0018 <[^>]*> bc1t \$fcc1,00000000+ +0+001c <[^>]*> nop +0+0020 <[^>]*> bc1tl \$fcc2,00000000+ +0+0024 <[^>]*> nop +0+0028 <[^>]*> c.f.d \$f4,\$f6 +0+002c <[^>]*> c.f.d \$fcc1,\$f4,\$f6 +0+0030 <[^>]*> ldxc1 \$f2,\$a0\(\$a1\) +0+0034 <[^>]*> lwxc1 \$f2,\$a0\(\$a1\) +0+0038 <[^>]*> madd.d \$f0,\$f2,\$f4,\$f6 +0+003c <[^>]*> madd.s \$f0,\$f2,\$f4,\$f6 +0+0040 <[^>]*> movf \$a0,\$a1,\$fcc4 +0+0044 <[^>]*> movf.d \$f4,\$f6,\$fcc0 +0+0048 <[^>]*> movf.s \$f4,\$f6,\$fcc0 +0+004c <[^>]*> movn \$a0,\$a2,\$a2 +0+0050 <[^>]*> movn.d \$f4,\$f5,\$a2 +0+0054 <[^>]*> movn.s \$f4,\$f5,\$a2 +0+0058 <[^>]*> movt \$a0,\$a1,\$fcc4 +0+005c <[^>]*> movt.d \$f4,\$f6,\$fcc0 +0+0060 <[^>]*> movt.s \$f4,\$f6,\$fcc0 +0+0064 <[^>]*> movz \$a0,\$a2,\$a2 +0+0068 <[^>]*> movz.d \$f4,\$f5,\$a2 +0+006c <[^>]*> movz.s \$f4,\$f5,\$a2 +0+0070 <[^>]*> msub.d \$f0,\$f2,\$f4,\$f6 +0+0074 <[^>]*> msub.s \$f0,\$f2,\$f4,\$f6 +0+0078 <[^>]*> nmadd.d \$f0,\$f2,\$f4,\$f6 +0+007c <[^>]*> nmadd.s \$f0,\$f2,\$f4,\$f6 +0+0080 <[^>]*> nmsub.d \$f0,\$f2,\$f4,\$f6 +0+0084 <[^>]*> nmsub.s \$f0,\$f2,\$f4,\$f6 +0+0088 <[^>]*> prefx 0x4,\$a0\(\$a1\) +0+008c <[^>]*> recip.d \$f4,\$f6 +0+0090 <[^>]*> recip.s \$f4,\$f6 +0+0094 <[^>]*> rsqrt.d \$f4,\$f6 +0+0098 <[^>]*> rsqrt.s \$f4,\$f6 +0+009c <[^>]*> sdxc1 \$f4,\$a0\(\$a1\) +0+00a0 <[^>]*> swxc1 \$f4,\$a0\(\$a1\) + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/mips4.s binutils-2.8/gas/testsuite/gas/mips/mips4.s --- binutils-2.7/gas/testsuite/gas/mips/mips4.s Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/mips4.s Wed Apr 30 12:54:35 1997 @@ -2,25 +2,25 @@ text_label: bc1f text_label - bc1f 1,text_label - bc1fl 1,text_label - bc1t 1,text_label - bc1tl 2,text_label + bc1f $fcc1,text_label + bc1fl $fcc1,text_label + bc1t $fcc1,text_label + bc1tl $fcc2,text_label c.f.d $f4,$f6 - c.f.d 1,$f4,$f6 + c.f.d $fcc1,$f4,$f6 ldxc1 $f2,$4($5) lwxc1 $f2,$4($5) madd.d $f0,$f2,$f4,$f6 madd.s $f0,$f2,$f4,$f6 - movf $4,$5,4 - movf.d $f4,$f6,0 - movf.s $f4,$f6,0 + movf $4,$5,$fcc4 + movf.d $f4,$f6,$fcc0 + movf.s $f4,$f6,$fcc0 movn $4,$6,$6 movn.d $f4,$f5,$6 movn.s $f4,$f5,$6 - movt $4,$5,4 - movt.d $f4,$f6,0 - movt.s $f4,$f6,0 + movt $4,$5,$fcc4 + movt.d $f4,$f6,$fcc0 + movt.s $f4,$f6,$fcc0 movz $4,$6,$6 movz.d $f4,$f5,$6 movz.s $f4,$f5,$6 @@ -45,3 +45,8 @@ rsqrt.s $f4,$f6 sdxc1 $f4,$4($5) swxc1 $f4,$4($5) + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/mul-ilocks.d binutils-2.8/gas/testsuite/gas/mips/mul-ilocks.d --- binutils-2.7/gas/testsuite/gas/mips/mul-ilocks.d Thu Jul 4 12:15:58 1996 +++ binutils-2.8/gas/testsuite/gas/mips/mul-ilocks.d Wed Apr 30 12:54:35 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS mul #source: mul.s @@ -6,76 +6,75 @@ .*: +file format .*mips.* -No symbols in .* Disassembly of section .text: -0+0000 multu \$a0,\$a1 -0+0004 mflo \$a0 -0+0008 multu \$a1,\$a2 -0+000c mflo \$a0 -0+0010 li \$at,0 -0+0014 mult \$a1,\$at -0+0018 mflo \$a0 -0+001c li \$at,1 -0+0020 mult \$a1,\$at -0+0024 mflo \$a0 -0+0028 li \$at,0x8000 -0+002c mult \$a1,\$at -0+0030 mflo \$a0 -0+0034 li \$at,-32768 -0+0038 mult \$a1,\$at -0+003c mflo \$a0 -0+0040 lui \$at,0x1 -0+0044 mult \$a1,\$at -0+0048 mflo \$a0 -0+004c lui \$at,0x1 -0+0050 ori \$at,\$at,0xa5a5 -0+0054 mult \$a1,\$at -0+0058 mflo \$a0 -0+005c mult \$a0,\$a1 -0+0060 mflo \$a0 -0+0064 sra \$a0,\$a0,0x1f -0+0068 mfhi \$at -0+006c beq \$a0,\$at,0+78 -... -0+0074 break 0x6 -0+0078 mflo \$a0 -0+007c mult \$a1,\$a2 -0+0080 mflo \$a0 -0+0084 sra \$a0,\$a0,0x1f -0+0088 mfhi \$at -0+008c beq \$a0,\$at,0+98 -... -0+0094 break 0x6 -0+0098 mflo \$a0 -0+009c multu \$a0,\$a1 -0+00a0 mfhi \$at -0+00a4 mflo \$a0 -0+00a8 beqz \$at,0+b4 -... -0+00b0 break 0x6 -0+00b4 multu \$a1,\$a2 -0+00b8 mfhi \$at -0+00bc mflo \$a0 -0+00c0 beqz \$at,0+cc -... -0+00c8 break 0x6 -0+00cc dmultu \$a1,\$a2 -0+00d0 mflo \$a0 -0+00d4 li \$at,1 -0+00d8 dmult \$a1,\$at -0+00dc mflo \$a0 -0+00e0 dmult \$a1,\$a2 -0+00e4 mflo \$a0 -0+00e8 dsra32 \$a0,\$a0,0x1f -0+00ec mfhi \$at -0+00f0 beq \$a0,\$at,0+fc -... -0+00f8 break 0x6 -0+00fc mflo \$a0 -0+0100 dmultu \$a1,\$a2 -0+0104 mfhi \$at -0+0108 mflo \$a0 -0+010c beqz \$at,0+118 -... -0+0114 break 0x6 -... +0+0000 <[^>]*> multu \$a0,\$a1 +0+0004 <[^>]*> mflo \$a0 +0+0008 <[^>]*> multu \$a1,\$a2 +0+000c <[^>]*> mflo \$a0 +0+0010 <[^>]*> li \$at,0 +0+0014 <[^>]*> mult \$a1,\$at +0+0018 <[^>]*> mflo \$a0 +0+001c <[^>]*> li \$at,1 +0+0020 <[^>]*> mult \$a1,\$at +0+0024 <[^>]*> mflo \$a0 +0+0028 <[^>]*> li \$at,0x8000 +0+002c <[^>]*> mult \$a1,\$at +0+0030 <[^>]*> mflo \$a0 +0+0034 <[^>]*> li \$at,-32768 +0+0038 <[^>]*> mult \$a1,\$at +0+003c <[^>]*> mflo \$a0 +0+0040 <[^>]*> lui \$at,0x1 +0+0044 <[^>]*> mult \$a1,\$at +0+0048 <[^>]*> mflo \$a0 +0+004c <[^>]*> lui \$at,0x1 +0+0050 <[^>]*> ori \$at,\$at,0xa5a5 +0+0054 <[^>]*> mult \$a1,\$at +0+0058 <[^>]*> mflo \$a0 +0+005c <[^>]*> mult \$a0,\$a1 +0+0060 <[^>]*> mflo \$a0 +0+0064 <[^>]*> sra \$a0,\$a0,0x1f +0+0068 <[^>]*> mfhi \$at +0+006c <[^>]*> beq \$a0,\$at,0+78 +0+0070 <[^>]*> nop +0+0074 <[^>]*> break 0x6 +0+0078 <[^>]*> mflo \$a0 +0+007c <[^>]*> mult \$a1,\$a2 +0+0080 <[^>]*> mflo \$a0 +0+0084 <[^>]*> sra \$a0,\$a0,0x1f +0+0088 <[^>]*> mfhi \$at +0+008c <[^>]*> beq \$a0,\$at,0+98 +0+0090 <[^>]*> nop +0+0094 <[^>]*> break 0x6 +0+0098 <[^>]*> mflo \$a0 +0+009c <[^>]*> multu \$a0,\$a1 +0+00a0 <[^>]*> mfhi \$at +0+00a4 <[^>]*> mflo \$a0 +0+00a8 <[^>]*> beqz \$at,0+b4 +0+00ac <[^>]*> nop +0+00b0 <[^>]*> break 0x6 +0+00b4 <[^>]*> multu \$a1,\$a2 +0+00b8 <[^>]*> mfhi \$at +0+00bc <[^>]*> mflo \$a0 +0+00c0 <[^>]*> beqz \$at,0+cc +0+00c4 <[^>]*> nop +0+00c8 <[^>]*> break 0x6 +0+00cc <[^>]*> dmultu \$a1,\$a2 +0+00d0 <[^>]*> mflo \$a0 +0+00d4 <[^>]*> li \$at,1 +0+00d8 <[^>]*> dmult \$a1,\$at +0+00dc <[^>]*> mflo \$a0 +0+00e0 <[^>]*> dmult \$a1,\$a2 +0+00e4 <[^>]*> mflo \$a0 +0+00e8 <[^>]*> dsra32 \$a0,\$a0,0x1f +0+00ec <[^>]*> mfhi \$at +0+00f0 <[^>]*> beq \$a0,\$at,0+fc +0+00f4 <[^>]*> nop +0+00f8 <[^>]*> break 0x6 +0+00fc <[^>]*> mflo \$a0 +0+0100 <[^>]*> dmultu \$a1,\$a2 +0+0104 <[^>]*> mfhi \$at +0+0108 <[^>]*> mflo \$a0 +0+010c <[^>]*> beqz \$at,0+118 +0+0110 <[^>]*> nop +0+0114 <[^>]*> break 0x6 + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/mul.d binutils-2.8/gas/testsuite/gas/mips/mul.d --- binutils-2.7/gas/testsuite/gas/mips/mul.d Thu Jul 4 12:15:59 1996 +++ binutils-2.8/gas/testsuite/gas/mips/mul.d Wed Apr 30 12:54:35 1997 @@ -1,91 +1,90 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS mul # Test the mul macro. .*: +file format .*mips.* -No symbols in .* Disassembly of section .text: -0+0000 multu \$a0,\$a1 -0+0004 mflo \$a0 -... -0+0010 multu \$a1,\$a2 -0+0014 mflo \$a0 -0+0018 li \$at,0 -... -0+0020 mult \$a1,\$at -0+0024 mflo \$a0 -0+0028 li \$at,1 -... -0+0030 mult \$a1,\$at -0+0034 mflo \$a0 -0+0038 li \$at,0x8000 -... -0+0040 mult \$a1,\$at -0+0044 mflo \$a0 -0+0048 li \$at,-32768 -... -0+0050 mult \$a1,\$at -0+0054 mflo \$a0 -0+0058 lui \$at,0x1 -... -0+0060 mult \$a1,\$at -0+0064 mflo \$a0 -0+0068 lui \$at,0x1 -0+006c ori \$at,\$at,0xa5a5 -0+0070 mult \$a1,\$at -0+0074 mflo \$a0 -... -0+0080 mult \$a0,\$a1 -0+0084 mflo \$a0 -0+0088 sra \$a0,\$a0,0x1f -0+008c mfhi \$at -0+0090 beq \$a0,\$at,0+9c -... -0+0098 break 0x6 -0+009c mflo \$a0 -... -0+00a8 mult \$a1,\$a2 -0+00ac mflo \$a0 -0+00b0 sra \$a0,\$a0,0x1f -0+00b4 mfhi \$at -0+00b8 beq \$a0,\$at,0+c4 -... -0+00c0 break 0x6 -0+00c4 mflo \$a0 -... -0+00d0 multu \$a0,\$a1 -0+00d4 mfhi \$at -0+00d8 mflo \$a0 -0+00dc beqz \$at,0+e8 -... -0+00e4 break 0x6 -0+00e8 multu \$a1,\$a2 -0+00ec mfhi \$at -0+00f0 mflo \$a0 -0+00f4 beqz \$at,0+100 -... -0+00fc break 0x6 -0+0100 dmultu \$a1,\$a2 -0+0104 mflo \$a0 -0+0108 li \$at,1 -... -0+0110 dmult \$a1,\$at -0+0114 mflo \$a0 -... -0+0120 dmult \$a1,\$a2 -0+0124 mflo \$a0 -0+0128 dsra32 \$a0,\$a0,0x1f -0+012c mfhi \$at -0+0130 beq \$a0,\$at,0+13c -... -0+0138 break 0x6 -0+013c mflo \$a0 -... -0+0148 dmultu \$a1,\$a2 -0+014c mfhi \$at -0+0150 mflo \$a0 -0+0154 beqz \$at,0+160 -... -0+015c break 0x6 +0+0000 <[^>]*> multu \$a0,\$a1 +0+0004 <[^>]*> mflo \$a0 + ... +0+0010 <[^>]*> multu \$a1,\$a2 +0+0014 <[^>]*> mflo \$a0 +0+0018 <[^>]*> li \$at,0 +0+001c <[^>]*> nop +0+0020 <[^>]*> mult \$a1,\$at +0+0024 <[^>]*> mflo \$a0 +0+0028 <[^>]*> li \$at,1 +0+002c <[^>]*> nop +0+0030 <[^>]*> mult \$a1,\$at +0+0034 <[^>]*> mflo \$a0 +0+0038 <[^>]*> li \$at,0x8000 +0+003c <[^>]*> nop +0+0040 <[^>]*> mult \$a1,\$at +0+0044 <[^>]*> mflo \$a0 +0+0048 <[^>]*> li \$at,-32768 +0+004c <[^>]*> nop +0+0050 <[^>]*> mult \$a1,\$at +0+0054 <[^>]*> mflo \$a0 +0+0058 <[^>]*> lui \$at,0x1 +0+005c <[^>]*> nop +0+0060 <[^>]*> mult \$a1,\$at +0+0064 <[^>]*> mflo \$a0 +0+0068 <[^>]*> lui \$at,0x1 +0+006c <[^>]*> ori \$at,\$at,0xa5a5 +0+0070 <[^>]*> mult \$a1,\$at +0+0074 <[^>]*> mflo \$a0 + ... +0+0080 <[^>]*> mult \$a0,\$a1 +0+0084 <[^>]*> mflo \$a0 +0+0088 <[^>]*> sra \$a0,\$a0,0x1f +0+008c <[^>]*> mfhi \$at +0+0090 <[^>]*> beq \$a0,\$at,0+9c +0+0094 <[^>]*> nop +0+0098 <[^>]*> break 0x6 +0+009c <[^>]*> mflo \$a0 + ... +0+00a8 <[^>]*> mult \$a1,\$a2 +0+00ac <[^>]*> mflo \$a0 +0+00b0 <[^>]*> sra \$a0,\$a0,0x1f +0+00b4 <[^>]*> mfhi \$at +0+00b8 <[^>]*> beq \$a0,\$at,0+c4 +0+00bc <[^>]*> nop +0+00c0 <[^>]*> break 0x6 +0+00c4 <[^>]*> mflo \$a0 + ... +0+00d0 <[^>]*> multu \$a0,\$a1 +0+00d4 <[^>]*> mfhi \$at +0+00d8 <[^>]*> mflo \$a0 +0+00dc <[^>]*> beqz \$at,0+e8 +0+00e0 <[^>]*> nop +0+00e4 <[^>]*> break 0x6 +0+00e8 <[^>]*> multu \$a1,\$a2 +0+00ec <[^>]*> mfhi \$at +0+00f0 <[^>]*> mflo \$a0 +0+00f4 <[^>]*> beqz \$at,0+100 +0+00f8 <[^>]*> nop +0+00fc <[^>]*> break 0x6 +0+0100 <[^>]*> dmultu \$a1,\$a2 +0+0104 <[^>]*> mflo \$a0 +0+0108 <[^>]*> li \$at,1 +0+010c <[^>]*> nop +0+0110 <[^>]*> dmult \$a1,\$at +0+0114 <[^>]*> mflo \$a0 + ... +0+0120 <[^>]*> dmult \$a1,\$a2 +0+0124 <[^>]*> mflo \$a0 +0+0128 <[^>]*> dsra32 \$a0,\$a0,0x1f +0+012c <[^>]*> mfhi \$at +0+0130 <[^>]*> beq \$a0,\$at,0+13c +0+0134 <[^>]*> nop +0+0138 <[^>]*> break 0x6 +0+013c <[^>]*> mflo \$a0 + ... +0+0148 <[^>]*> dmultu \$a1,\$a2 +0+014c <[^>]*> mfhi \$at +0+0150 <[^>]*> mflo \$a0 +0+0154 <[^>]*> beqz \$at,0+160 +0+0158 <[^>]*> nop +0+015c <[^>]*> break 0x6 diff -urN binutils-2.7/gas/testsuite/gas/mips/mul.s binutils-2.8/gas/testsuite/gas/mips/mul.s --- binutils-2.7/gas/testsuite/gas/mips/mul.s Thu Jul 4 12:15:59 1996 +++ binutils-2.8/gas/testsuite/gas/mips/mul.s Wed Apr 30 12:54:35 1997 @@ -1,5 +1,6 @@ # Source file used to test the mul macro. +foo: mul $4,$5 mul $4,$5,$6 mul $4,$5,0 diff -urN binutils-2.7/gas/testsuite/gas/mips/rol.d binutils-2.8/gas/testsuite/gas/mips/rol.d --- binutils-2.7/gas/testsuite/gas/mips/rol.d Thu Jul 4 12:15:59 1996 +++ binutils-2.8/gas/testsuite/gas/mips/rol.d Wed Apr 30 12:54:36 1997 @@ -1,37 +1,36 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS rol # Test the rol and ror macros. .*: +file format .*mips.* -No symbols in .* Disassembly of section .text: -0+0000 negu \$at,\$a1 -0+0004 srlv \$at,\$a0,\$at -0+0008 sllv \$a0,\$a0,\$a1 -0+000c or \$a0,\$a0,\$at -0+0010 negu \$at,\$a2 -0+0014 srlv \$at,\$a1,\$at -0+0018 sllv \$a0,\$a1,\$a2 -0+001c or \$a0,\$a0,\$at -0+0020 sll \$at,\$a0,0x1 -0+0024 srl \$a0,\$a0,0x1f -0+0028 or \$a0,\$a0,\$at -0+002c sll \$at,\$a1,0x1 -0+0030 srl \$a0,\$a1,0x1f -0+0034 or \$a0,\$a0,\$at -0+0038 negu \$at,\$a1 -0+003c sllv \$at,\$a0,\$at -0+0040 srlv \$a0,\$a0,\$a1 -0+0044 or \$a0,\$a0,\$at -0+0048 negu \$at,\$a2 -0+004c sllv \$at,\$a1,\$at -0+0050 srlv \$a0,\$a1,\$a2 -0+0054 or \$a0,\$a0,\$at -0+0058 srl \$at,\$a0,0x1 -0+005c sll \$a0,\$a0,0x1f -0+0060 or \$a0,\$a0,\$at -0+0064 srl \$at,\$a1,0x1 -0+0068 sll \$a0,\$a1,0x1f -0+006c or \$a0,\$a0,\$at +0+0000 <[^>]*> negu \$at,\$a1 +0+0004 <[^>]*> srlv \$at,\$a0,\$at +0+0008 <[^>]*> sllv \$a0,\$a0,\$a1 +0+000c <[^>]*> or \$a0,\$a0,\$at +0+0010 <[^>]*> negu \$at,\$a2 +0+0014 <[^>]*> srlv \$at,\$a1,\$at +0+0018 <[^>]*> sllv \$a0,\$a1,\$a2 +0+001c <[^>]*> or \$a0,\$a0,\$at +0+0020 <[^>]*> sll \$at,\$a0,0x1 +0+0024 <[^>]*> srl \$a0,\$a0,0x1f +0+0028 <[^>]*> or \$a0,\$a0,\$at +0+002c <[^>]*> sll \$at,\$a1,0x1 +0+0030 <[^>]*> srl \$a0,\$a1,0x1f +0+0034 <[^>]*> or \$a0,\$a0,\$at +0+0038 <[^>]*> negu \$at,\$a1 +0+003c <[^>]*> sllv \$at,\$a0,\$at +0+0040 <[^>]*> srlv \$a0,\$a0,\$a1 +0+0044 <[^>]*> or \$a0,\$a0,\$at +0+0048 <[^>]*> negu \$at,\$a2 +0+004c <[^>]*> sllv \$at,\$a1,\$at +0+0050 <[^>]*> srlv \$a0,\$a1,\$a2 +0+0054 <[^>]*> or \$a0,\$a0,\$at +0+0058 <[^>]*> srl \$at,\$a0,0x1 +0+005c <[^>]*> sll \$a0,\$a0,0x1f +0+0060 <[^>]*> or \$a0,\$a0,\$at +0+0064 <[^>]*> srl \$at,\$a1,0x1 +0+0068 <[^>]*> sll \$a0,\$a1,0x1f +0+006c <[^>]*> or \$a0,\$a0,\$at diff -urN binutils-2.7/gas/testsuite/gas/mips/rol.s binutils-2.8/gas/testsuite/gas/mips/rol.s --- binutils-2.7/gas/testsuite/gas/mips/rol.s Thu Jul 4 12:15:59 1996 +++ binutils-2.8/gas/testsuite/gas/mips/rol.s Wed Apr 30 12:54:36 1997 @@ -1,5 +1,6 @@ # Source file used to test the rol and ror macros. - + +foo: rol $4,$5 rol $4,$5,$6 rol $4,1 diff -urN binutils-2.7/gas/testsuite/gas/mips/sb.d binutils-2.8/gas/testsuite/gas/mips/sb.d --- binutils-2.7/gas/testsuite/gas/mips/sb.d Thu Jul 4 12:15:59 1996 +++ binutils-2.8/gas/testsuite/gas/mips/sb.d Wed Apr 30 12:54:36 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS sb #as: -mips1 @@ -7,390 +7,390 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> sb \$a0,0\(\$zero\) -0+0004 <[^>]*> sb \$a0,1\(\$zero\) -0+0008 <[^>]*> lui \$at,0x1 -0+000c <[^>]*> sb \$a0,-32768\(\$at\) -0+0010 <[^>]*> sb \$a0,-32768\(\$zero\) -0+0014 <[^>]*> lui \$at,0x1 -0+0018 <[^>]*> sb \$a0,0\(\$at\) -0+001c <[^>]*> lui \$at,0x2 -0+0020 <[^>]*> sb \$a0,-23131\(\$at\) -0+0024 <[^>]*> sb \$a0,0\(\$a1\) -0+0028 <[^>]*> sb \$a0,1\(\$a1\) -0+002c <[^>]*> lui \$at,0x1 -0+0030 <[^>]*> addu \$at,\$at,\$a1 -0+0034 <[^>]*> sb \$a0,-32768\(\$at\) -0+0038 <[^>]*> sb \$a0,-32768\(\$a1\) -0+003c <[^>]*> lui \$at,0x1 -0+0040 <[^>]*> addu \$at,\$at,\$a1 -0+0044 <[^>]*> sb \$a0,0\(\$at\) -0+0048 <[^>]*> lui \$at,0x2 -0+004c <[^>]*> addu \$at,\$at,\$a1 -0+0050 <[^>]*> sb \$a0,-23131\(\$at\) -0+0054 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0054 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0058 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0058 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+005c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+005c [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0060 <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+0060 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0064 <[^>]*> sb \$a0,0\(\$gp\) -[ ]*RELOC: 0+0064 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0068 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0068 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+006c <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+006c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0070 <[^>]*> sb \$a0,0\(\$gp\) -[ ]*RELOC: 0+0070 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0074 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0074 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0078 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0078 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+007c <[^>]*> sb \$a0,[-0-9]+\(\$gp\) -[ ]*RELOC: 0+007c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0080 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0080 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0084 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0084 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0088 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0088 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+008c <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+008c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0090 <[^>]*> sb \$a0,1\(\$gp\) -[ ]*RELOC: 0+0090 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0094 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0094 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0098 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0098 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+009c <[^>]*> sb \$a0,1\(\$gp\) -[ ]*RELOC: 0+009c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00a0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00a0 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+00a4 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00a4 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00a8 <[^>]*> sb \$a0,[-0-9]+\(\$gp\) -[ ]*RELOC: 0+00a8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00ac <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+00ac [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00b0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00b0 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00b4 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+00b4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00b8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00b8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00bc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+00bc [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+00c0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00c0 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+00c4 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+00c4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00c8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00c8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+00cc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+00cc [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+00d0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00d0 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+00d4 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+00d4 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+00d8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00d8 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00dc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+00dc [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+00e0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00e0 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+00e4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00e4 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00e8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00e8 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00ec <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00ec [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00f0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00f0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00f4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00f4 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+00f8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+00f8 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+00fc <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00fc [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0100 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0100 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0104 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0104 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0108 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0108 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+010c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+010c [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0110 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0110 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0114 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0114 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0118 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0118 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+011c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+011c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0120 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0120 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0124 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0124 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0128 <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+0128 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+012c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+012c [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0130 <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+0130 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0134 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0134 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0138 <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+0138 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+013c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+013c [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0140 <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+0140 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0144 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0144 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0148 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0148 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+014c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+014c [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0150 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0150 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0154 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0154 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0158 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0158 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+015c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+015c [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0160 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0160 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0164 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0164 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0168 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0168 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+016c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+016c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0170 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0170 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0174 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0174 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0178 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0178 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+017c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+017c [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0180 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0180 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0184 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0184 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0188 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0188 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+018c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+018c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0190 <[^>]*> addu \$at,\$at,\$a1 -0+0194 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0194 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0198 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0198 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+019c <[^>]*> addu \$at,\$at,\$a1 -0+01a0 <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+01a0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01a4 <[^>]*> addu \$at,\$a1,\$gp -0+01a8 <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+01a8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+01ac <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01ac [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01b0 <[^>]*> addu \$at,\$at,\$a1 -0+01b4 <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+01b4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01b8 <[^>]*> addu \$at,\$a1,\$gp -0+01bc <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+01bc [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+01c0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01c0 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+01c4 <[^>]*> addu \$at,\$at,\$a1 -0+01c8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01c8 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+01cc <[^>]*> addu \$at,\$a1,\$gp -0+01d0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01d0 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+01d4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01d4 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+01d8 <[^>]*> addu \$at,\$at,\$a1 -0+01dc <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01dc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+01e0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01e0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+01e4 <[^>]*> addu \$at,\$at,\$a1 -0+01e8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01e8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01ec <[^>]*> addu \$at,\$a1,\$gp -0+01f0 <[^>]*> sb \$a0,1\(\$at\) -[ ]*RELOC: 0+01f0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+01f4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01f4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01f8 <[^>]*> addu \$at,\$at,\$a1 -0+01fc <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+01fc [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0200 <[^>]*> addu \$at,\$a1,\$gp -0+0204 <[^>]*> sb \$a0,1\(\$at\) -[ ]*RELOC: 0+0204 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0208 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0208 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+020c <[^>]*> addu \$at,\$at,\$a1 -0+0210 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0210 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0214 <[^>]*> addu \$at,\$a1,\$gp -0+0218 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0218 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+021c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+021c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0220 <[^>]*> addu \$at,\$at,\$a1 -0+0224 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0224 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0228 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0228 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+022c <[^>]*> addu \$at,\$at,\$a1 -0+0230 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0230 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0234 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0234 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0238 <[^>]*> addu \$at,\$at,\$a1 -0+023c <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+023c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0240 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0240 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0244 <[^>]*> addu \$at,\$at,\$a1 -0+0248 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0248 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+024c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+024c [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0250 <[^>]*> addu \$at,\$at,\$a1 -0+0254 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0254 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0258 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0258 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+025c <[^>]*> addu \$at,\$at,\$a1 -0+0260 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0260 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0264 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0264 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0268 <[^>]*> addu \$at,\$at,\$a1 -0+026c <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+026c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0270 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0270 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0274 <[^>]*> addu \$at,\$at,\$a1 -0+0278 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0278 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+027c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+027c [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0280 <[^>]*> addu \$at,\$at,\$a1 -0+0284 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0284 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0288 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0288 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+028c <[^>]*> addu \$at,\$at,\$a1 -0+0290 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0290 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0294 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0294 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0298 <[^>]*> addu \$at,\$at,\$a1 -0+029c <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+029c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02a0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02a0 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02a4 <[^>]*> addu \$at,\$at,\$a1 -0+02a8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02a8 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+02ac <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02ac [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02b0 <[^>]*> addu \$at,\$at,\$a1 -0+02b4 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02b4 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+02b8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02b8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+02bc <[^>]*> addu \$at,\$at,\$a1 -0+02c0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02c0 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+02c4 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02c4 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+02c8 <[^>]*> addu \$at,\$at,\$a1 -0+02cc <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+02cc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+02d0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02d0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+02d4 <[^>]*> addu \$at,\$at,\$a1 -0+02d8 <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+02d8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+02dc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02dc [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+02e0 <[^>]*> addu \$at,\$at,\$a1 -0+02e4 <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+02e4 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+02e8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02e8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+02ec <[^>]*> addu \$at,\$at,\$a1 -0+02f0 <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+02f0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02f4 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02f4 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02f8 <[^>]*> addu \$at,\$at,\$a1 -0+02fc <[^>]*> sb \$a0,0\(\$at\) -[ ]*RELOC: 0+02fc [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0300 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0300 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0304 <[^>]*> addu \$at,\$at,\$a1 -0+0308 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0308 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+030c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+030c [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0310 <[^>]*> addu \$at,\$at,\$a1 -0+0314 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0314 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0318 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0318 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+031c <[^>]*> addu \$at,\$at,\$a1 -0+0320 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0320 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0324 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0324 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0328 <[^>]*> addu \$at,\$at,\$a1 -0+032c <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+032c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0330 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0330 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0334 <[^>]*> addu \$at,\$at,\$a1 -0+0338 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0338 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+033c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+033c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0340 <[^>]*> addu \$at,\$at,\$a1 -0+0344 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0344 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0348 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0348 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+034c <[^>]*> addu \$at,\$at,\$a1 -0+0350 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0350 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0354 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0354 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0358 <[^>]*> addu \$at,\$at,\$a1 -0+035c <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+035c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0360 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0360 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0364 <[^>]*> addu \$at,\$at,\$a1 -0+0368 <[^>]*> sb \$a0,[-0-9]+\(\$at\) -[ ]*RELOC: 0+0368 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+036c <[^>]*> sw \$a0,0\(\$zero\) -0+0370 <[^>]*> sw \$a1,4\(\$zero\) -0+0374 <[^>]*> sh \$a0,0\(\$zero\) -0+0378 <[^>]*> sw \$a0,0\(\$zero\) -0+037c <[^>]*> sc \$a0,0\(\$zero\) -0+0380 <[^>]*> swc1 \$f4,0\(\$zero\) -0+0384 <[^>]*> swc2 \$4,0\(\$zero\) -0+0388 <[^>]*> swc3 \$4,0\(\$zero\) -0+038c <[^>]*> swc1 \$f4,0\(\$zero\) -0+0390 <[^>]*> swl \$a0,0\(\$zero\) -0+0394 <[^>]*> swr \$a0,0\(\$zero\) -... +0+0000 <[^>]*> sb \$a0,0\(\$zero\) +0+0004 <[^>]*> sb \$a0,1\(\$zero\) +0+0008 <[^>]*> lui \$at,0x1 +0+000c <[^>]*> sb \$a0,-32768\(\$at\) +0+0010 <[^>]*> sb \$a0,-32768\(\$zero\) +0+0014 <[^>]*> lui \$at,0x1 +0+0018 <[^>]*> sb \$a0,0\(\$at\) +0+001c <[^>]*> lui \$at,0x2 +0+0020 <[^>]*> sb \$a0,-23131\(\$at\) +0+0024 <[^>]*> sb \$a0,0\(\$a1\) +0+0028 <[^>]*> sb \$a0,1\(\$a1\) +0+002c <[^>]*> lui \$at,0x1 +0+0030 <[^>]*> addu \$at,\$at,\$a1 +0+0034 <[^>]*> sb \$a0,-32768\(\$at\) +0+0038 <[^>]*> sb \$a0,-32768\(\$a1\) +0+003c <[^>]*> lui \$at,0x1 +0+0040 <[^>]*> addu \$at,\$at,\$a1 +0+0044 <[^>]*> sb \$a0,0\(\$at\) +0+0048 <[^>]*> lui \$at,0x2 +0+004c <[^>]*> addu \$at,\$at,\$a1 +0+0050 <[^>]*> sb \$a0,-23131\(\$at\) +0+0054 <[^>]*> lui \$at,0x0 +[ ]*54: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0058 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*58: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+005c <[^>]*> lui \$at,0x0 +[ ]*5c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0060 <[^>]*> sb \$a0,0\(\$at\) +[ ]*60: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0064 <[^>]*> sb \$a0,0\(\$gp\) +[ ]*64: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0068 <[^>]*> lui \$at,0x0 +[ ]*68: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+006c <[^>]*> sb \$a0,0\(\$at\) +[ ]*6c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0070 <[^>]*> sb \$a0,0\(\$gp\) +[ ]*70: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0074 <[^>]*> lui \$at,0x0 +[ ]*74: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0078 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*78: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+007c <[^>]*> sb \$a0,[-0-9]+\(\$gp\) +[ ]*7c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0080 <[^>]*> lui \$at,0x0 +[ ]*80: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0084 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*84: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0088 <[^>]*> lui \$at,0x0 +[ ]*88: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+008c <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*8c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0090 <[^>]*> sb \$a0,1\(\$gp\) +[ ]*90: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0094 <[^>]*> lui \$at,0x0 +[ ]*94: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0098 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*98: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+009c <[^>]*> sb \$a0,1\(\$gp\) +[ ]*9c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00a0 <[^>]*> lui \$at,0x0 +[ ]*a0: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+00a4 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*a4: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00a8 <[^>]*> sb \$a0,[-0-9]+\(\$gp\) +[ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00ac <[^>]*> lui \$at,[-0-9x]+ +[ ]*ac: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+00b0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*b0: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00b4 <[^>]*> lui \$at,[-0-9x]+ +[ ]*b4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00b8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*b8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00bc <[^>]*> lui \$at,[-0-9x]+ +[ ]*bc: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+00c0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*c0: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+00c4 <[^>]*> lui \$at,[-0-9x]+ +[ ]*c4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00c8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*c8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+00cc <[^>]*> lui \$at,[-0-9x]+ +[ ]*cc: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+00d0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*d0: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+00d4 <[^>]*> lui \$at,[-0-9x]+ +[ ]*d4: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+00d8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*d8: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00dc <[^>]*> lui \$at,[-0-9x]+ +[ ]*dc: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+00e0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*e0: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+00e4 <[^>]*> lui \$at,0x0 +[ ]*e4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+00e8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*e8: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00ec <[^>]*> lui \$at,0x0 +[ ]*ec: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00f0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*f0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00f4 <[^>]*> lui \$at,0x0 +[ ]*f4: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+00f8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*f8: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+00fc <[^>]*> lui \$at,0x0 +[ ]*fc: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0100 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*100: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0104 <[^>]*> lui \$at,0x0 +[ ]*104: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0108 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*108: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+010c <[^>]*> lui \$at,0x0 +[ ]*10c: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0110 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*110: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0114 <[^>]*> lui \$at,0x0 +[ ]*114: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0118 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*118: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+011c <[^>]*> lui \$at,[-0-9x]+ +[ ]*11c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0120 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*120: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0124 <[^>]*> lui \$at,[-0-9x]+ +[ ]*124: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0128 <[^>]*> sb \$a0,0\(\$at\) +[ ]*128: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+012c <[^>]*> lui \$at,[-0-9x]+ +[ ]*12c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0130 <[^>]*> sb \$a0,0\(\$at\) +[ ]*130: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0134 <[^>]*> lui \$at,[-0-9x]+ +[ ]*134: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0138 <[^>]*> sb \$a0,0\(\$at\) +[ ]*138: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+013c <[^>]*> lui \$at,[-0-9x]+ +[ ]*13c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0140 <[^>]*> sb \$a0,0\(\$at\) +[ ]*140: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0144 <[^>]*> lui \$at,[-0-9x]+ +[ ]*144: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0148 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*148: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+014c <[^>]*> lui \$at,[-0-9x]+ +[ ]*14c: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0150 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*150: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0154 <[^>]*> lui \$at,[-0-9x]+ +[ ]*154: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0158 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*158: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+015c <[^>]*> lui \$at,[-0-9x]+ +[ ]*15c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0160 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*160: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0164 <[^>]*> lui \$at,[-0-9x]+ +[ ]*164: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0168 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*168: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+016c <[^>]*> lui \$at,[-0-9x]+ +[ ]*16c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0170 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*170: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0174 <[^>]*> lui \$at,[-0-9x]+ +[ ]*174: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0178 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*178: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+017c <[^>]*> lui \$at,[-0-9x]+ +[ ]*17c: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0180 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*180: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0184 <[^>]*> lui \$at,[-0-9x]+ +[ ]*184: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0188 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*188: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+018c <[^>]*> lui \$at,0x0 +[ ]*18c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0190 <[^>]*> addu \$at,\$at,\$a1 +0+0194 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*194: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0198 <[^>]*> lui \$at,0x0 +[ ]*198: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+019c <[^>]*> addu \$at,\$at,\$a1 +0+01a0 <[^>]*> sb \$a0,0\(\$at\) +[ ]*1a0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01a4 <[^>]*> addu \$at,\$a1,\$gp +0+01a8 <[^>]*> sb \$a0,0\(\$at\) +[ ]*1a8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+01ac <[^>]*> lui \$at,0x0 +[ ]*1ac: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01b0 <[^>]*> addu \$at,\$at,\$a1 +0+01b4 <[^>]*> sb \$a0,0\(\$at\) +[ ]*1b4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01b8 <[^>]*> addu \$at,\$a1,\$gp +0+01bc <[^>]*> sb \$a0,0\(\$at\) +[ ]*1bc: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+01c0 <[^>]*> lui \$at,0x0 +[ ]*1c0: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+01c4 <[^>]*> addu \$at,\$at,\$a1 +0+01c8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*1c8: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+01cc <[^>]*> addu \$at,\$a1,\$gp +0+01d0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*1d0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+01d4 <[^>]*> lui \$at,0x0 +[ ]*1d4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+01d8 <[^>]*> addu \$at,\$at,\$a1 +0+01dc <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*1dc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+01e0 <[^>]*> lui \$at,0x0 +[ ]*1e0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+01e4 <[^>]*> addu \$at,\$at,\$a1 +0+01e8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*1e8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01ec <[^>]*> addu \$at,\$a1,\$gp +0+01f0 <[^>]*> sb \$a0,1\(\$at\) +[ ]*1f0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+01f4 <[^>]*> lui \$at,0x0 +[ ]*1f4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01f8 <[^>]*> addu \$at,\$at,\$a1 +0+01fc <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*1fc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0200 <[^>]*> addu \$at,\$a1,\$gp +0+0204 <[^>]*> sb \$a0,1\(\$at\) +[ ]*204: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0208 <[^>]*> lui \$at,0x0 +[ ]*208: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+020c <[^>]*> addu \$at,\$at,\$a1 +0+0210 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*210: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0214 <[^>]*> addu \$at,\$a1,\$gp +0+0218 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*218: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+021c <[^>]*> lui \$at,[-0-9x]+ +[ ]*21c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0220 <[^>]*> addu \$at,\$at,\$a1 +0+0224 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*224: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0228 <[^>]*> lui \$at,[-0-9x]+ +[ ]*228: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+022c <[^>]*> addu \$at,\$at,\$a1 +0+0230 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*230: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0234 <[^>]*> lui \$at,[-0-9x]+ +[ ]*234: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0238 <[^>]*> addu \$at,\$at,\$a1 +0+023c <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*23c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0240 <[^>]*> lui \$at,[-0-9x]+ +[ ]*240: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0244 <[^>]*> addu \$at,\$at,\$a1 +0+0248 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*248: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+024c <[^>]*> lui \$at,[-0-9x]+ +[ ]*24c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0250 <[^>]*> addu \$at,\$at,\$a1 +0+0254 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*254: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0258 <[^>]*> lui \$at,[-0-9x]+ +[ ]*258: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+025c <[^>]*> addu \$at,\$at,\$a1 +0+0260 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*260: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0264 <[^>]*> lui \$at,[-0-9x]+ +[ ]*264: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0268 <[^>]*> addu \$at,\$at,\$a1 +0+026c <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*26c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0270 <[^>]*> lui \$at,0x0 +[ ]*270: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0274 <[^>]*> addu \$at,\$at,\$a1 +0+0278 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*278: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+027c <[^>]*> lui \$at,0x0 +[ ]*27c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0280 <[^>]*> addu \$at,\$at,\$a1 +0+0284 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*284: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0288 <[^>]*> lui \$at,0x0 +[ ]*288: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+028c <[^>]*> addu \$at,\$at,\$a1 +0+0290 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*290: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0294 <[^>]*> lui \$at,0x0 +[ ]*294: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0298 <[^>]*> addu \$at,\$at,\$a1 +0+029c <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*29c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02a0 <[^>]*> lui \$at,0x0 +[ ]*2a0: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02a4 <[^>]*> addu \$at,\$at,\$a1 +0+02a8 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*2a8: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+02ac <[^>]*> lui \$at,0x0 +[ ]*2ac: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+02b0 <[^>]*> addu \$at,\$at,\$a1 +0+02b4 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*2b4: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+02b8 <[^>]*> lui \$at,0x0 +[ ]*2b8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+02bc <[^>]*> addu \$at,\$at,\$a1 +0+02c0 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*2c0: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+02c4 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2c4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+02c8 <[^>]*> addu \$at,\$at,\$a1 +0+02cc <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*2cc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+02d0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2d0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+02d4 <[^>]*> addu \$at,\$at,\$a1 +0+02d8 <[^>]*> sb \$a0,0\(\$at\) +[ ]*2d8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+02dc <[^>]*> lui \$at,[-0-9x]+ +[ ]*2dc: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+02e0 <[^>]*> addu \$at,\$at,\$a1 +0+02e4 <[^>]*> sb \$a0,0\(\$at\) +[ ]*2e4: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+02e8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2e8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+02ec <[^>]*> addu \$at,\$at,\$a1 +0+02f0 <[^>]*> sb \$a0,0\(\$at\) +[ ]*2f0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02f4 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2f4: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02f8 <[^>]*> addu \$at,\$at,\$a1 +0+02fc <[^>]*> sb \$a0,0\(\$at\) +[ ]*2fc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0300 <[^>]*> lui \$at,[-0-9x]+ +[ ]*300: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0304 <[^>]*> addu \$at,\$at,\$a1 +0+0308 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*308: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+030c <[^>]*> lui \$at,[-0-9x]+ +[ ]*30c: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0310 <[^>]*> addu \$at,\$at,\$a1 +0+0314 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*314: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0318 <[^>]*> lui \$at,[-0-9x]+ +[ ]*318: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+031c <[^>]*> addu \$at,\$at,\$a1 +0+0320 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*320: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0324 <[^>]*> lui \$at,[-0-9x]+ +[ ]*324: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0328 <[^>]*> addu \$at,\$at,\$a1 +0+032c <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*32c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0330 <[^>]*> lui \$at,[-0-9x]+ +[ ]*330: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0334 <[^>]*> addu \$at,\$at,\$a1 +0+0338 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*338: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+033c <[^>]*> lui \$at,[-0-9x]+ +[ ]*33c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0340 <[^>]*> addu \$at,\$at,\$a1 +0+0344 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*344: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0348 <[^>]*> lui \$at,[-0-9x]+ +[ ]*348: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+034c <[^>]*> addu \$at,\$at,\$a1 +0+0350 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*350: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0354 <[^>]*> lui \$at,[-0-9x]+ +[ ]*354: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0358 <[^>]*> addu \$at,\$at,\$a1 +0+035c <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*35c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0360 <[^>]*> lui \$at,[-0-9x]+ +[ ]*360: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0364 <[^>]*> addu \$at,\$at,\$a1 +0+0368 <[^>]*> sb \$a0,[-0-9]+\(\$at\) +[ ]*368: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+036c <[^>]*> sw \$a0,0\(\$zero\) +0+0370 <[^>]*> sw \$a1,4\(\$zero\) +0+0374 <[^>]*> sh \$a0,0\(\$zero\) +0+0378 <[^>]*> sw \$a0,0\(\$zero\) +0+037c <[^>]*> sc \$a0,0\(\$zero\) +0+0380 <[^>]*> swc1 \$f4,0\(\$zero\) +0+0384 <[^>]*> swc2 \$4,0\(\$zero\) +0+0388 <[^>]*> swc3 \$4,0\(\$zero\) +0+038c <[^>]*> swc1 \$f4,0\(\$zero\) +0+0390 <[^>]*> swl \$a0,0\(\$zero\) +0+0394 <[^>]*> swr \$a0,0\(\$zero\) + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/sb.s binutils-2.8/gas/testsuite/gas/mips/sb.s --- binutils-2.7/gas/testsuite/gas/mips/sb.s Thu Jul 4 12:15:59 1996 +++ binutils-2.8/gas/testsuite/gas/mips/sb.s Wed Apr 30 12:54:37 1997 @@ -118,3 +118,7 @@ s.s $f4,0 swl $4,0 swr $4,0 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/trunc.d binutils-2.8/gas/testsuite/gas/mips/trunc.d --- binutils-2.7/gas/testsuite/gas/mips/trunc.d Thu Jul 4 12:15:59 1996 +++ binutils-2.8/gas/testsuite/gas/mips/trunc.d Wed Apr 30 12:54:37 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS trunc #as: -mips1 @@ -6,25 +6,24 @@ .*: +file format .*mips.* -No symbols in .* Disassembly of section .text: -0+0000 cfc1 \$a0,\$31 -0+0004 cfc1 \$a0,\$31 -... -0+000c ori \$at,\$a0,0x3 -0+0010 xori \$at,\$at,0x2 -0+0014 ctc1 \$at,\$31 -... -0+001c cvt.w.d \$f4,\$f6 -0+0020 ctc1 \$a0,\$31 -... -0+0028 cfc1 \$a0,\$31 -0+002c cfc1 \$a0,\$31 -... -0+0034 ori \$at,\$a0,0x3 -0+0038 xori \$at,\$at,0x2 -0+003c ctc1 \$at,\$31 -... -0+0044 cvt.w.s \$f4,\$f6 -0+0048 ctc1 \$a0,\$31 -... +0+0000 <[^>]*> cfc1 \$a0,\$31 +0+0004 <[^>]*> cfc1 \$a0,\$31 +0+0008 <[^>]*> nop +0+000c <[^>]*> ori \$at,\$a0,0x3 +0+0010 <[^>]*> xori \$at,\$at,0x2 +0+0014 <[^>]*> ctc1 \$at,\$31 +0+0018 <[^>]*> nop +0+001c <[^>]*> cvt.w.d \$f4,\$f6 +0+0020 <[^>]*> ctc1 \$a0,\$31 +0+0024 <[^>]*> nop +0+0028 <[^>]*> cfc1 \$a0,\$31 +0+002c <[^>]*> cfc1 \$a0,\$31 +0+0030 <[^>]*> nop +0+0034 <[^>]*> ori \$at,\$a0,0x3 +0+0038 <[^>]*> xori \$at,\$at,0x2 +0+003c <[^>]*> ctc1 \$at,\$31 +0+0040 <[^>]*> nop +0+0044 <[^>]*> cvt.w.s \$f4,\$f6 +0+0048 <[^>]*> ctc1 \$a0,\$31 +0+004c <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/trunc.s binutils-2.8/gas/testsuite/gas/mips/trunc.s --- binutils-2.7/gas/testsuite/gas/mips/trunc.s Thu Jul 4 12:15:59 1996 +++ binutils-2.8/gas/testsuite/gas/mips/trunc.s Wed Apr 30 12:54:37 1997 @@ -1,5 +1,6 @@ # Source file used to test the trunc macros. +foo: trunc.w.d $f4,$f6,$4 trunc.w.s $f4,$f6,$4 diff -urN binutils-2.7/gas/testsuite/gas/mips/uld.d binutils-2.8/gas/testsuite/gas/mips/uld.d --- binutils-2.7/gas/testsuite/gas/mips/uld.d Thu Jul 4 12:15:59 1996 +++ binutils-2.8/gas/testsuite/gas/mips/uld.d Wed Apr 30 12:54:37 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS uld #as: -mips3 @@ -7,264 +7,264 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> ldl \$a0,[07]\(\$zero\) -0+0004 <[^>]*> ldr \$a0,[07]\(\$zero\) -0+0008 <[^>]*> ldl \$a0,[18]\(\$zero\) -0+000c <[^>]*> ldr \$a0,[18]\(\$zero\) -0+0010 <[^>]*> li \$at,0x8000 -0+0014 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0018 <[^>]*> ldr \$a0,[07]\(\$at\) -0+001c <[^>]*> ldl \$a0,-3276[18]\(\$zero\) -0+0020 <[^>]*> ldr \$a0,-3276[18]\(\$zero\) -0+0024 <[^>]*> lui \$at,0x1 -0+0028 <[^>]*> ldl \$a0,[07]\(\$at\) -0+002c <[^>]*> ldr \$a0,[07]\(\$at\) -0+0030 <[^>]*> lui \$at,0x1 -0+0034 <[^>]*> ori \$at,\$at,0xa5a5 -0+0038 <[^>]*> ldl \$a0,[07]\(\$at\) -0+003c <[^>]*> ldr \$a0,[07]\(\$at\) -0+0040 <[^>]*> ldl \$a0,[07]\(\$a1\) -0+0044 <[^>]*> ldr \$a0,[07]\(\$a1\) -0+0048 <[^>]*> ldl \$a0,[18]\(\$a1\) -0+004c <[^>]*> ldr \$a0,[-0-9]+\(\$a1\) -0+0050 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0050 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0054 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0054 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0058 <[^>]*> ldl \$a0,[07]\(\$at\) -0+005c <[^>]*> ldr \$a0,[07]\(\$at\) -0+0060 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0060 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0064 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0064 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0068 <[^>]*> ldl \$a0,[07]\(\$at\) -0+006c <[^>]*> ldr \$a0,[07]\(\$at\) -0+0070 <[^>]*> daddiu \$at,\$gp,0 -[ ]*RELOC: 0+0070 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0074 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0078 <[^>]*> ldr \$a0,[07]\(\$at\) -0+007c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+007c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0080 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0080 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0084 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0088 <[^>]*> ldr \$a0,[07]\(\$at\) -0+008c <[^>]*> daddiu \$at,\$gp,0 -[ ]*RELOC: 0+008c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0090 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0094 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0098 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0098 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+009c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+009c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00a0 <[^>]*> ldl \$a0,[07]\(\$at\) -0+00a4 <[^>]*> ldr \$a0,[07]\(\$at\) -0+00a8 <[^>]*> daddiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+00a8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00ac <[^>]*> ldl \$a0,[07]\(\$at\) -0+00b0 <[^>]*> ldr \$a0,[07]\(\$at\) -0+00b4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00b4 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00b8 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00b8 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00bc <[^>]*> ldl \$a0,[07]\(\$at\) -0+00c0 <[^>]*> ldr \$a0,[07]\(\$at\) -0+00c4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00c4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00c8 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00c8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00cc <[^>]*> ldl \$a0,[07]\(\$at\) -0+00d0 <[^>]*> ldr \$a0,[07]\(\$at\) -0+00d4 <[^>]*> daddiu \$at,\$gp,1 -[ ]*RELOC: 0+00d4 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00d8 <[^>]*> ldl \$a0,[07]\(\$at\) -0+00dc <[^>]*> ldr \$a0,[07]\(\$at\) -0+00e0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00e0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00e4 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00e4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+00e8 <[^>]*> ldl \$a0,[07]\(\$at\) -0+00ec <[^>]*> ldr \$a0,[07]\(\$at\) -0+00f0 <[^>]*> daddiu \$at,\$gp,1 -[ ]*RELOC: 0+00f0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00f4 <[^>]*> ldl \$a0,[07]\(\$at\) -0+00f8 <[^>]*> ldr \$a0,[07]\(\$at\) -0+00fc <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00fc [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0100 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0100 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0104 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0108 <[^>]*> ldr \$a0,[07]\(\$at\) -0+010c <[^>]*> daddiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+010c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0110 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0114 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0118 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0118 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+011c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+011c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0120 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0124 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0128 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0128 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+012c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+012c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0130 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0134 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0138 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0138 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+013c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+013c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0140 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0144 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0148 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0148 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+014c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+014c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0150 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0154 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0158 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0158 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+015c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+015c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0160 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0164 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0168 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0168 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+016c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+016c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0170 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0174 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0178 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0178 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+017c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+017c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0180 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0184 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0188 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0188 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+018c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+018c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0190 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0194 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0198 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0198 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+019c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+019c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01a0 <[^>]*> ldl \$a0,[07]\(\$at\) -0+01a4 <[^>]*> ldr \$a0,[07]\(\$at\) -0+01a8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01a8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+01ac <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01ac [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+01b0 <[^>]*> ldl \$a0,[07]\(\$at\) -0+01b4 <[^>]*> ldr \$a0,[07]\(\$at\) -0+01b8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01b8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01bc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01bc [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01c0 <[^>]*> ldl \$a0,[07]\(\$at\) -0+01c4 <[^>]*> ldr \$a0,[07]\(\$at\) -0+01c8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01c8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+01cc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01cc [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+01d0 <[^>]*> ldl \$a0,[07]\(\$at\) -0+01d4 <[^>]*> ldr \$a0,[07]\(\$at\) -0+01d8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01d8 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+01dc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01dc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+01e0 <[^>]*> ldl \$a0,[07]\(\$at\) -0+01e4 <[^>]*> ldr \$a0,[07]\(\$at\) -0+01e8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01e8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+01ec <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01ec [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+01f0 <[^>]*> ldl \$a0,[07]\(\$at\) -0+01f4 <[^>]*> ldr \$a0,[07]\(\$at\) -0+01f8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01f8 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+01fc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01fc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0200 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0204 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0208 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0208 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+020c <[^>]*> daddiu \$at,\$at,0 -[ ]*RELOC: 0+020c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0210 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0214 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0218 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0218 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+021c <[^>]*> daddiu \$at,\$at,0 -[ ]*RELOC: 0+021c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0220 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0224 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0228 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0228 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+022c <[^>]*> daddiu \$at,\$at,0 -[ ]*RELOC: 0+022c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0230 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0234 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0238 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0238 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+023c <[^>]*> daddiu \$at,\$at,0 -[ ]*RELOC: 0+023c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0240 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0244 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0248 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0248 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+024c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+024c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0250 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0254 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0258 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0258 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+025c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+025c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0260 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0264 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0268 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0268 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+026c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+026c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0270 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0274 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0278 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0278 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+027c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+027c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0280 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0284 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0288 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0288 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+028c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+028c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0290 <[^>]*> ldl \$a0,[07]\(\$at\) -0+0294 <[^>]*> ldr \$a0,[07]\(\$at\) -0+0298 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0298 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+029c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+029c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02a0 <[^>]*> ldl \$a0,[07]\(\$at\) -0+02a4 <[^>]*> ldr \$a0,[07]\(\$at\) -0+02a8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02a8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02ac <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02ac [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+02b0 <[^>]*> ldl \$a0,[07]\(\$at\) -0+02b4 <[^>]*> ldr \$a0,[07]\(\$at\) -0+02b8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02b8 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02bc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02bc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+02c0 <[^>]*> ldl \$a0,[07]\(\$at\) -0+02c4 <[^>]*> ldr \$a0,[07]\(\$at\) -0+02c8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02c8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+02cc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02cc [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+02d0 <[^>]*> ldl \$a0,[07]\(\$at\) -0+02d4 <[^>]*> ldr \$a0,[07]\(\$at\) -... +0+0000 <[^>]*> ldl \$a0,[07]\(\$zero\) +0+0004 <[^>]*> ldr \$a0,[07]\(\$zero\) +0+0008 <[^>]*> ldl \$a0,[18]\(\$zero\) +0+000c <[^>]*> ldr \$a0,[18]\(\$zero\) +0+0010 <[^>]*> li \$at,0x8000 +0+0014 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0018 <[^>]*> ldr \$a0,[07]\(\$at\) +0+001c <[^>]*> ldl \$a0,-3276[18]\(\$zero\) +0+0020 <[^>]*> ldr \$a0,-3276[18]\(\$zero\) +0+0024 <[^>]*> lui \$at,0x1 +0+0028 <[^>]*> ldl \$a0,[07]\(\$at\) +0+002c <[^>]*> ldr \$a0,[07]\(\$at\) +0+0030 <[^>]*> lui \$at,0x1 +0+0034 <[^>]*> ori \$at,\$at,0xa5a5 +0+0038 <[^>]*> ldl \$a0,[07]\(\$at\) +0+003c <[^>]*> ldr \$a0,[07]\(\$at\) +0+0040 <[^>]*> ldl \$a0,[07]\(\$a1\) +0+0044 <[^>]*> ldr \$a0,[07]\(\$a1\) +0+0048 <[^>]*> ldl \$a0,[18]\(\$a1\) +0+004c <[^>]*> ldr \$a0,[-0-9]+\(\$a1\) +0+0050 <[^>]*> lui \$at,[-0-9x]+ +[ ]*50: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0054 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*54: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0058 <[^>]*> ldl \$a0,[07]\(\$at\) +0+005c <[^>]*> ldr \$a0,[07]\(\$at\) +0+0060 <[^>]*> lui \$at,0x0 +[ ]*60: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0064 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*64: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0068 <[^>]*> ldl \$a0,[07]\(\$at\) +0+006c <[^>]*> ldr \$a0,[07]\(\$at\) +0+0070 <[^>]*> daddiu \$at,\$gp,0 +[ ]*70: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0074 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0078 <[^>]*> ldr \$a0,[07]\(\$at\) +0+007c <[^>]*> lui \$at,0x0 +[ ]*7c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0080 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*80: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0084 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0088 <[^>]*> ldr \$a0,[07]\(\$at\) +0+008c <[^>]*> daddiu \$at,\$gp,0 +[ ]*8c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0090 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0094 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0098 <[^>]*> lui \$at,[-0-9x]+ +[ ]*98: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+009c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*9c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00a0 <[^>]*> ldl \$a0,[07]\(\$at\) +0+00a4 <[^>]*> ldr \$a0,[07]\(\$at\) +0+00a8 <[^>]*> daddiu \$at,\$gp,[-0-9]+ +[ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00ac <[^>]*> ldl \$a0,[07]\(\$at\) +0+00b0 <[^>]*> ldr \$a0,[07]\(\$at\) +0+00b4 <[^>]*> lui \$at,0x0 +[ ]*b4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+00b8 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*b8: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00bc <[^>]*> ldl \$a0,[07]\(\$at\) +0+00c0 <[^>]*> ldr \$a0,[07]\(\$at\) +0+00c4 <[^>]*> lui \$at,0x0 +[ ]*c4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00c8 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*c8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00cc <[^>]*> ldl \$a0,[07]\(\$at\) +0+00d0 <[^>]*> ldr \$a0,[07]\(\$at\) +0+00d4 <[^>]*> daddiu \$at,\$gp,1 +[ ]*d4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00d8 <[^>]*> ldl \$a0,[07]\(\$at\) +0+00dc <[^>]*> ldr \$a0,[07]\(\$at\) +0+00e0 <[^>]*> lui \$at,0x0 +[ ]*e0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00e4 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*e4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+00e8 <[^>]*> ldl \$a0,[07]\(\$at\) +0+00ec <[^>]*> ldr \$a0,[07]\(\$at\) +0+00f0 <[^>]*> daddiu \$at,\$gp,1 +[ ]*f0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00f4 <[^>]*> ldl \$a0,[07]\(\$at\) +0+00f8 <[^>]*> ldr \$a0,[07]\(\$at\) +0+00fc <[^>]*> lui \$at,0x0 +[ ]*fc: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0100 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*100: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0104 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0108 <[^>]*> ldr \$a0,[07]\(\$at\) +0+010c <[^>]*> daddiu \$at,\$gp,[-0-9]+ +[ ]*10c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0110 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0114 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0118 <[^>]*> lui \$at,[-0-9x]+ +[ ]*118: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+011c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*11c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0120 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0124 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0128 <[^>]*> lui \$at,[-0-9x]+ +[ ]*128: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+012c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*12c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0130 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0134 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0138 <[^>]*> lui \$at,[-0-9x]+ +[ ]*138: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+013c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*13c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0140 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0144 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0148 <[^>]*> lui \$at,[-0-9x]+ +[ ]*148: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+014c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*14c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0150 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0154 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0158 <[^>]*> lui \$at,[-0-9x]+ +[ ]*158: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+015c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*15c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0160 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0164 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0168 <[^>]*> lui \$at,[-0-9x]+ +[ ]*168: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+016c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*16c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0170 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0174 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0178 <[^>]*> lui \$at,[-0-9x]+ +[ ]*178: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+017c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*17c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0180 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0184 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0188 <[^>]*> lui \$at,0x0 +[ ]*188: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+018c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*18c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0190 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0194 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0198 <[^>]*> lui \$at,0x0 +[ ]*198: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+019c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*19c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01a0 <[^>]*> ldl \$a0,[07]\(\$at\) +0+01a4 <[^>]*> ldr \$a0,[07]\(\$at\) +0+01a8 <[^>]*> lui \$at,0x0 +[ ]*1a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+01ac <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+01b0 <[^>]*> ldl \$a0,[07]\(\$at\) +0+01b4 <[^>]*> ldr \$a0,[07]\(\$at\) +0+01b8 <[^>]*> lui \$at,0x0 +[ ]*1b8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01bc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1bc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01c0 <[^>]*> ldl \$a0,[07]\(\$at\) +0+01c4 <[^>]*> ldr \$a0,[07]\(\$at\) +0+01c8 <[^>]*> lui \$at,0x0 +[ ]*1c8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+01cc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1cc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+01d0 <[^>]*> ldl \$a0,[07]\(\$at\) +0+01d4 <[^>]*> ldr \$a0,[07]\(\$at\) +0+01d8 <[^>]*> lui \$at,0x0 +[ ]*1d8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+01dc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1dc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+01e0 <[^>]*> ldl \$a0,[07]\(\$at\) +0+01e4 <[^>]*> ldr \$a0,[07]\(\$at\) +0+01e8 <[^>]*> lui \$at,0x0 +[ ]*1e8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+01ec <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1ec: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+01f0 <[^>]*> ldl \$a0,[07]\(\$at\) +0+01f4 <[^>]*> ldr \$a0,[07]\(\$at\) +0+01f8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*1f8: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+01fc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1fc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0200 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0204 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0208 <[^>]*> lui \$at,[-0-9x]+ +[ ]*208: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+020c <[^>]*> daddiu \$at,\$at,0 +[ ]*20c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0210 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0214 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0218 <[^>]*> lui \$at,[-0-9x]+ +[ ]*218: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+021c <[^>]*> daddiu \$at,\$at,0 +[ ]*21c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0220 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0224 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0228 <[^>]*> lui \$at,[-0-9x]+ +[ ]*228: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+022c <[^>]*> daddiu \$at,\$at,0 +[ ]*22c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0230 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0234 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0238 <[^>]*> lui \$at,[-0-9x]+ +[ ]*238: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+023c <[^>]*> daddiu \$at,\$at,0 +[ ]*23c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0240 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0244 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0248 <[^>]*> lui \$at,[-0-9x]+ +[ ]*248: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+024c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*24c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0250 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0254 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0258 <[^>]*> lui \$at,[-0-9x]+ +[ ]*258: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+025c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*25c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0260 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0264 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0268 <[^>]*> lui \$at,[-0-9x]+ +[ ]*268: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+026c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*26c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0270 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0274 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0278 <[^>]*> lui \$at,[-0-9x]+ +[ ]*278: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+027c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*27c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0280 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0284 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0288 <[^>]*> lui \$at,[-0-9x]+ +[ ]*288: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+028c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*28c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0290 <[^>]*> ldl \$a0,[07]\(\$at\) +0+0294 <[^>]*> ldr \$a0,[07]\(\$at\) +0+0298 <[^>]*> lui \$at,[-0-9x]+ +[ ]*298: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+029c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*29c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02a0 <[^>]*> ldl \$a0,[07]\(\$at\) +0+02a4 <[^>]*> ldr \$a0,[07]\(\$at\) +0+02a8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02ac <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*2ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+02b0 <[^>]*> ldl \$a0,[07]\(\$at\) +0+02b4 <[^>]*> ldr \$a0,[07]\(\$at\) +0+02b8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2b8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+02bc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*2bc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+02c0 <[^>]*> ldl \$a0,[07]\(\$at\) +0+02c4 <[^>]*> ldr \$a0,[07]\(\$at\) +0+02c8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2c8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+02cc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*2cc: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+02d0 <[^>]*> ldl \$a0,[07]\(\$at\) +0+02d4 <[^>]*> ldr \$a0,[07]\(\$at\) + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/uld.s binutils-2.8/gas/testsuite/gas/mips/uld.s --- binutils-2.7/gas/testsuite/gas/mips/uld.s Thu Jul 4 12:15:59 1996 +++ binutils-2.8/gas/testsuite/gas/mips/uld.s Wed Apr 30 12:54:38 1997 @@ -60,3 +60,7 @@ uld $4,small_external_common+0x1a5a5 uld $4,big_local_common+0x1a5a5 uld $4,small_local_common+0x1a5a5 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/ulh-empic.d binutils-2.8/gas/testsuite/gas/mips/ulh-empic.d --- binutils-2.7/gas/testsuite/gas/mips/ulh-empic.d Thu Jul 4 12:16:00 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ulh-empic.d Wed Apr 30 12:54:38 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS ulh-empic #as: -mips1 -membedded-pic #source: ulh-pic.s @@ -8,84 +8,84 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> addiu \$at,\$gp,-16384 -[ ]*RELOC: 0+0000 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+0004 <[^>]*> lb \$a0,[01]\(\$at\) -0+0008 <[^>]*> lbu \$at,[01]\(\$at\) -0+000c <[^>]*> sll \$a0,\$a0,0x8 -0+0010 <[^>]*> or \$a0,\$a0,\$at -0+0014 <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+0014 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+0018 <[^>]*> lbu \$a0,[01]\(\$at\) -0+001c <[^>]*> lbu \$at,[01]\(\$at\) -0+0020 <[^>]*> sll \$a0,\$a0,0x8 -0+0024 <[^>]*> or \$a0,\$a0,\$at -0+0028 <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+0028 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+002c <[^>]*> lwl \$a0,[03]\(\$at\) -0+0030 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0034 <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+0034 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+0038 <[^>]*> sb \$a0,[01]\(\$at\) -0+003c <[^>]*> srl \$a0,\$a0,0x8 -0+0040 <[^>]*> sb \$a0,[01]\(\$at\) -0+0044 <[^>]*> lbu \$at,[01]\(\$at\) -0+0048 <[^>]*> sll \$a0,\$a0,0x8 -0+004c <[^>]*> or \$a0,\$a0,\$at -0+0050 <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+0050 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0054 <[^>]*> swl \$a0,[03]\(\$at\) -0+0058 <[^>]*> swr \$a0,[03]\(\$at\) -0+005c <[^>]*> addiu \$at,\$gp,-16384 -[ ]*RELOC: 0+005c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0060 <[^>]*> lb \$a0,[01]\(\$at\) -0+0064 <[^>]*> lbu \$at,[01]\(\$at\) -0+0068 <[^>]*> sll \$a0,\$a0,0x8 -0+006c <[^>]*> or \$a0,\$a0,\$at -0+0070 <[^>]*> addiu \$at,\$gp,-15384 -[ ]*RELOC: 0+0070 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0074 <[^>]*> lbu \$a0,[01]\(\$at\) -0+0078 <[^>]*> lbu \$at,[01]\(\$at\) -0+007c <[^>]*> sll \$a0,\$a0,0x8 -0+0080 <[^>]*> or \$a0,\$a0,\$at -0+0084 <[^>]*> addiu \$at,\$gp,-16383 -[ ]*RELOC: 0+0084 [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* -0+0088 <[^>]*> lwl \$a0,[03]\(\$at\) -0+008c <[^>]*> lwr \$a0,[03]\(\$at\) -0+0090 <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+0090 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label -0+0094 <[^>]*> sb \$a0,[01]\(\$at\) -0+0098 <[^>]*> srl \$a0,\$a0,0x8 -0+009c <[^>]*> sb \$a0,[01]\(\$at\) -0+00a0 <[^>]*> lbu \$at,[01]\(\$at\) -0+00a4 <[^>]*> sll \$a0,\$a0,0x8 -0+00a8 <[^>]*> or \$a0,\$a0,\$at -0+00ac <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+00ac [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00b0 <[^>]*> swl \$a0,[03]\(\$at\) -0+00b4 <[^>]*> swr \$a0,[03]\(\$at\) -0+00b8 <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+00b8 [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common -0+00bc <[^>]*> lb \$a0,[01]\(\$at\) -0+00c0 <[^>]*> lbu \$at,[01]\(\$at\) -0+00c4 <[^>]*> sll \$a0,\$a0,0x8 -0+00c8 <[^>]*> or \$a0,\$a0,\$at -0+00cc <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+00cc [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00d0 <[^>]*> lbu \$a0,[01]\(\$at\) -0+00d4 <[^>]*> lbu \$at,[01]\(\$at\) -0+00d8 <[^>]*> sll \$a0,\$a0,0x8 -0+00dc <[^>]*> or \$a0,\$a0,\$at -0+00e0 <[^>]*> addiu \$at,\$gp,-16383 -[ ]*RELOC: 0+00e0 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00e4 <[^>]*> lwl \$a0,[03]\(\$at\) -0+00e8 <[^>]*> lwr \$a0,[03]\(\$at\) -0+00ec <[^>]*> addiu \$at,\$gp,-15383 -[ ]*RELOC: 0+00ec [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00f0 <[^>]*> sb \$a0,[01]\(\$at\) -0+00f4 <[^>]*> srl \$a0,\$a0,0x8 -0+00f8 <[^>]*> sb \$a0,[01]\(\$at\) -0+00fc <[^>]*> lbu \$at,[01]\(\$at\) -0+0100 <[^>]*> sll \$a0,\$a0,0x8 -0+0104 <[^>]*> or \$a0,\$a0,\$at -... +0+0000 <[^>]*> addiu \$at,\$gp,-16384 +[ ]*0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+0004 <[^>]*> lb \$a0,[01]\(\$at\) +0+0008 <[^>]*> lbu \$at,[01]\(\$at\) +0+000c <[^>]*> sll \$a0,\$a0,0x8 +0+0010 <[^>]*> or \$a0,\$a0,\$at +0+0014 <[^>]*> addiu \$at,\$gp,0 +[ ]*14: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+0018 <[^>]*> lbu \$a0,[01]\(\$at\) +0+001c <[^>]*> lbu \$at,[01]\(\$at\) +0+0020 <[^>]*> sll \$a0,\$a0,0x8 +0+0024 <[^>]*> or \$a0,\$a0,\$at +0+0028 <[^>]*> addiu \$at,\$gp,0 +[ ]*28: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+002c <[^>]*> lwl \$a0,[03]\(\$at\) +0+0030 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0034 <[^>]*> addiu \$at,\$gp,0 +[ ]*34: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+0038 <[^>]*> sb \$a0,[01]\(\$at\) +0+003c <[^>]*> srl \$a0,\$a0,0x8 +0+0040 <[^>]*> sb \$a0,[01]\(\$at\) +0+0044 <[^>]*> lbu \$at,[01]\(\$at\) +0+0048 <[^>]*> sll \$a0,\$a0,0x8 +0+004c <[^>]*> or \$a0,\$a0,\$at +0+0050 <[^>]*> addiu \$at,\$gp,0 +[ ]*50: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0054 <[^>]*> swl \$a0,[03]\(\$at\) +0+0058 <[^>]*> swr \$a0,[03]\(\$at\) +0+005c <[^>]*> addiu \$at,\$gp,-16384 +[ ]*5c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0060 <[^>]*> lb \$a0,[01]\(\$at\) +0+0064 <[^>]*> lbu \$at,[01]\(\$at\) +0+0068 <[^>]*> sll \$a0,\$a0,0x8 +0+006c <[^>]*> or \$a0,\$a0,\$at +0+0070 <[^>]*> addiu \$at,\$gp,-15384 +[ ]*70: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0074 <[^>]*> lbu \$a0,[01]\(\$at\) +0+0078 <[^>]*> lbu \$at,[01]\(\$at\) +0+007c <[^>]*> sll \$a0,\$a0,0x8 +0+0080 <[^>]*> or \$a0,\$a0,\$at +0+0084 <[^>]*> addiu \$at,\$gp,-16383 +[ ]*84: [A-Z0-9_]*GPREL[A-Z0-9_]* .sdata.* +0+0088 <[^>]*> lwl \$a0,[03]\(\$at\) +0+008c <[^>]*> lwr \$a0,[03]\(\$at\) +0+0090 <[^>]*> addiu \$at,\$gp,1 +[ ]*90: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_data_label +0+0094 <[^>]*> sb \$a0,[01]\(\$at\) +0+0098 <[^>]*> srl \$a0,\$a0,0x8 +0+009c <[^>]*> sb \$a0,[01]\(\$at\) +0+00a0 <[^>]*> lbu \$at,[01]\(\$at\) +0+00a4 <[^>]*> sll \$a0,\$a0,0x8 +0+00a8 <[^>]*> or \$a0,\$a0,\$at +0+00ac <[^>]*> addiu \$at,\$gp,1 +[ ]*ac: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00b0 <[^>]*> swl \$a0,[03]\(\$at\) +0+00b4 <[^>]*> swr \$a0,[03]\(\$at\) +0+00b8 <[^>]*> addiu \$at,\$gp,1 +[ ]*b8: [A-Z0-9_]*GPREL[A-Z0-9_]* big_external_common +0+00bc <[^>]*> lb \$a0,[01]\(\$at\) +0+00c0 <[^>]*> lbu \$at,[01]\(\$at\) +0+00c4 <[^>]*> sll \$a0,\$a0,0x8 +0+00c8 <[^>]*> or \$a0,\$a0,\$at +0+00cc <[^>]*> addiu \$at,\$gp,1 +[ ]*cc: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00d0 <[^>]*> lbu \$a0,[01]\(\$at\) +0+00d4 <[^>]*> lbu \$at,[01]\(\$at\) +0+00d8 <[^>]*> sll \$a0,\$a0,0x8 +0+00dc <[^>]*> or \$a0,\$a0,\$at +0+00e0 <[^>]*> addiu \$at,\$gp,-16383 +[ ]*e0: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00e4 <[^>]*> lwl \$a0,[03]\(\$at\) +0+00e8 <[^>]*> lwr \$a0,[03]\(\$at\) +0+00ec <[^>]*> addiu \$at,\$gp,-15383 +[ ]*ec: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00f0 <[^>]*> sb \$a0,[01]\(\$at\) +0+00f4 <[^>]*> srl \$a0,\$a0,0x8 +0+00f8 <[^>]*> sb \$a0,[01]\(\$at\) +0+00fc <[^>]*> lbu \$at,[01]\(\$at\) +0+0100 <[^>]*> sll \$a0,\$a0,0x8 +0+0104 <[^>]*> or \$a0,\$a0,\$at + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/ulh-pic.s binutils-2.8/gas/testsuite/gas/mips/ulh-pic.s --- binutils-2.7/gas/testsuite/gas/mips/ulh-pic.s Thu Jul 4 12:16:00 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ulh-pic.s Wed Apr 30 12:54:38 1997 @@ -27,3 +27,10 @@ ulhu $4,small_external_common+1 ulw $4,big_local_common+1 ush $4,small_local_common+1 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + .ifndef XGOT + nop + nop + .endif diff -urN binutils-2.7/gas/testsuite/gas/mips/ulh-svr4pic.d binutils-2.8/gas/testsuite/gas/mips/ulh-svr4pic.d --- binutils-2.7/gas/testsuite/gas/mips/ulh-svr4pic.d Thu Jul 4 12:16:00 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ulh-svr4pic.d Wed Apr 30 12:54:38 1997 @@ -1,6 +1,6 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS ulh-svr4pic -#as: -mips1 -KPIC +#as: -mips1 -KPIC -EB #source: ulh-pic.s # Test the unaligned load and store macros with -KPIC. @@ -8,117 +8,117 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0000 R_MIPS_GOT16 .data -... -0+0008 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0008 R_MIPS_LO16 .data -0+000c <[^>]*> lb \$a0,0\(\$at\) -0+0010 <[^>]*> lbu \$at,1\(\$at\) -0+0014 <[^>]*> sll \$a0,\$a0,0x8 -0+0018 <[^>]*> or \$a0,\$a0,\$at -0+001c <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+001c R_MIPS_GOT16 big_external_data_label -... -0+0024 <[^>]*> lbu \$a0,0\(\$at\) -0+0028 <[^>]*> lbu \$at,1\(\$at\) -0+002c <[^>]*> sll \$a0,\$a0,0x8 -0+0030 <[^>]*> or \$a0,\$a0,\$at -0+0034 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0034 R_MIPS_GOT16 small_external_data_label -... -0+003c <[^>]*> lwl \$a0,0\(\$at\) -0+0040 <[^>]*> lwr \$a0,3\(\$at\) -0+0044 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0044 R_MIPS_GOT16 big_external_common -... -0+004c <[^>]*> sb \$a0,1\(\$at\) -0+0050 <[^>]*> srl \$a0,\$a0,0x8 -0+0054 <[^>]*> sb \$a0,0\(\$at\) -0+0058 <[^>]*> lbu \$at,1\(\$at\) -0+005c <[^>]*> sll \$a0,\$a0,0x8 -0+0060 <[^>]*> or \$a0,\$a0,\$at -0+0064 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0064 R_MIPS_GOT16 small_external_common -... -0+006c <[^>]*> swl \$a0,0\(\$at\) -0+0070 <[^>]*> swr \$a0,3\(\$at\) -0+0074 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0074 R_MIPS_GOT16 .bss -... -0+007c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+007c R_MIPS_LO16 .bss -0+0080 <[^>]*> lb \$a0,0\(\$at\) -0+0084 <[^>]*> lbu \$at,1\(\$at\) -0+0088 <[^>]*> sll \$a0,\$a0,0x8 -0+008c <[^>]*> or \$a0,\$a0,\$at -0+0090 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0090 R_MIPS_GOT16 .bss -... -0+0098 <[^>]*> addiu \$at,\$at,1000 -[ ]*RELOC: 0+0098 R_MIPS_LO16 .bss -0+009c <[^>]*> lbu \$a0,0\(\$at\) -0+00a0 <[^>]*> lbu \$at,1\(\$at\) -0+00a4 <[^>]*> sll \$a0,\$a0,0x8 -0+00a8 <[^>]*> or \$a0,\$a0,\$at -0+00ac <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00ac R_MIPS_GOT16 .data -... -0+00b4 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+00b4 R_MIPS_LO16 .data -0+00b8 <[^>]*> addiu \$at,\$at,1 -0+00bc <[^>]*> lwl \$a0,0\(\$at\) -0+00c0 <[^>]*> lwr \$a0,3\(\$at\) -0+00c4 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00c4 R_MIPS_GOT16 big_external_data_label -... -0+00cc <[^>]*> addiu \$at,\$at,1 -0+00d0 <[^>]*> sb \$a0,1\(\$at\) -0+00d4 <[^>]*> srl \$a0,\$a0,0x8 -0+00d8 <[^>]*> sb \$a0,0\(\$at\) -0+00dc <[^>]*> lbu \$at,1\(\$at\) -0+00e0 <[^>]*> sll \$a0,\$a0,0x8 -0+00e4 <[^>]*> or \$a0,\$a0,\$at -0+00e8 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00e8 R_MIPS_GOT16 small_external_data_label -... -0+00f0 <[^>]*> addiu \$at,\$at,1 -0+00f4 <[^>]*> swl \$a0,0\(\$at\) -0+00f8 <[^>]*> swr \$a0,3\(\$at\) -0+00fc <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00fc R_MIPS_GOT16 big_external_common -... -0+0104 <[^>]*> addiu \$at,\$at,1 -0+0108 <[^>]*> lb \$a0,0\(\$at\) -0+010c <[^>]*> lbu \$at,1\(\$at\) -0+0110 <[^>]*> sll \$a0,\$a0,0x8 -0+0114 <[^>]*> or \$a0,\$a0,\$at -0+0118 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0118 R_MIPS_GOT16 small_external_common -... -0+0120 <[^>]*> addiu \$at,\$at,1 -0+0124 <[^>]*> lbu \$a0,0\(\$at\) -0+0128 <[^>]*> lbu \$at,1\(\$at\) -0+012c <[^>]*> sll \$a0,\$a0,0x8 -0+0130 <[^>]*> or \$a0,\$a0,\$at -0+0134 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0134 R_MIPS_GOT16 .bss -... -0+013c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+013c R_MIPS_LO16 .bss -0+0140 <[^>]*> addiu \$at,\$at,1 -0+0144 <[^>]*> lwl \$a0,0\(\$at\) -0+0148 <[^>]*> lwr \$a0,3\(\$at\) -0+014c <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+014c R_MIPS_GOT16 .bss -... -0+0154 <[^>]*> addiu \$at,\$at,1000 -[ ]*RELOC: 0+0154 R_MIPS_LO16 .bss -0+0158 <[^>]*> addiu \$at,\$at,1 -0+015c <[^>]*> sb \$a0,1\(\$at\) -0+0160 <[^>]*> srl \$a0,\$a0,0x8 -0+0164 <[^>]*> sb \$a0,0\(\$at\) -0+0168 <[^>]*> lbu \$at,1\(\$at\) -0+016c <[^>]*> sll \$a0,\$a0,0x8 -0+0170 <[^>]*> or \$a0,\$a0,\$at -... +0+0000 <[^>]*> lw \$at,0\(\$gp\) +[ ]*0: R_MIPS_GOT16 .data +0+0004 <[^>]*> nop +0+0008 <[^>]*> addiu \$at,\$at,0 +[ ]*8: R_MIPS_LO16 .data +0+000c <[^>]*> lb \$a0,0\(\$at\) +0+0010 <[^>]*> lbu \$at,1\(\$at\) +0+0014 <[^>]*> sll \$a0,\$a0,0x8 +0+0018 <[^>]*> or \$a0,\$a0,\$at +0+001c <[^>]*> lw \$at,0\(\$gp\) +[ ]*1c: R_MIPS_GOT16 big_external_data_label +0+0020 <[^>]*> nop +0+0024 <[^>]*> lbu \$a0,0\(\$at\) +0+0028 <[^>]*> lbu \$at,1\(\$at\) +0+002c <[^>]*> sll \$a0,\$a0,0x8 +0+0030 <[^>]*> or \$a0,\$a0,\$at +0+0034 <[^>]*> lw \$at,0\(\$gp\) +[ ]*34: R_MIPS_GOT16 small_external_data_label +0+0038 <[^>]*> nop +0+003c <[^>]*> lwl \$a0,0\(\$at\) +0+0040 <[^>]*> lwr \$a0,3\(\$at\) +0+0044 <[^>]*> lw \$at,0\(\$gp\) +[ ]*44: R_MIPS_GOT16 big_external_common +0+0048 <[^>]*> nop +0+004c <[^>]*> sb \$a0,1\(\$at\) +0+0050 <[^>]*> srl \$a0,\$a0,0x8 +0+0054 <[^>]*> sb \$a0,0\(\$at\) +0+0058 <[^>]*> lbu \$at,1\(\$at\) +0+005c <[^>]*> sll \$a0,\$a0,0x8 +0+0060 <[^>]*> or \$a0,\$a0,\$at +0+0064 <[^>]*> lw \$at,0\(\$gp\) +[ ]*64: R_MIPS_GOT16 small_external_common +0+0068 <[^>]*> nop +0+006c <[^>]*> swl \$a0,0\(\$at\) +0+0070 <[^>]*> swr \$a0,3\(\$at\) +0+0074 <[^>]*> lw \$at,0\(\$gp\) +[ ]*74: R_MIPS_GOT16 .bss +0+0078 <[^>]*> nop +0+007c <[^>]*> addiu \$at,\$at,0 +[ ]*7c: R_MIPS_LO16 .bss +0+0080 <[^>]*> lb \$a0,0\(\$at\) +0+0084 <[^>]*> lbu \$at,1\(\$at\) +0+0088 <[^>]*> sll \$a0,\$a0,0x8 +0+008c <[^>]*> or \$a0,\$a0,\$at +0+0090 <[^>]*> lw \$at,0\(\$gp\) +[ ]*90: R_MIPS_GOT16 .bss +0+0094 <[^>]*> nop +0+0098 <[^>]*> addiu \$at,\$at,1000 +[ ]*98: R_MIPS_LO16 .bss +0+009c <[^>]*> lbu \$a0,0\(\$at\) +0+00a0 <[^>]*> lbu \$at,1\(\$at\) +0+00a4 <[^>]*> sll \$a0,\$a0,0x8 +0+00a8 <[^>]*> or \$a0,\$a0,\$at +0+00ac <[^>]*> lw \$at,0\(\$gp\) +[ ]*ac: R_MIPS_GOT16 .data +0+00b0 <[^>]*> nop +0+00b4 <[^>]*> addiu \$at,\$at,0 +[ ]*b4: R_MIPS_LO16 .data +0+00b8 <[^>]*> addiu \$at,\$at,1 +0+00bc <[^>]*> lwl \$a0,0\(\$at\) +0+00c0 <[^>]*> lwr \$a0,3\(\$at\) +0+00c4 <[^>]*> lw \$at,0\(\$gp\) +[ ]*c4: R_MIPS_GOT16 big_external_data_label +0+00c8 <[^>]*> nop +0+00cc <[^>]*> addiu \$at,\$at,1 +0+00d0 <[^>]*> sb \$a0,1\(\$at\) +0+00d4 <[^>]*> srl \$a0,\$a0,0x8 +0+00d8 <[^>]*> sb \$a0,0\(\$at\) +0+00dc <[^>]*> lbu \$at,1\(\$at\) +0+00e0 <[^>]*> sll \$a0,\$a0,0x8 +0+00e4 <[^>]*> or \$a0,\$a0,\$at +0+00e8 <[^>]*> lw \$at,0\(\$gp\) +[ ]*e8: R_MIPS_GOT16 small_external_data_label +0+00ec <[^>]*> nop +0+00f0 <[^>]*> addiu \$at,\$at,1 +0+00f4 <[^>]*> swl \$a0,0\(\$at\) +0+00f8 <[^>]*> swr \$a0,3\(\$at\) +0+00fc <[^>]*> lw \$at,0\(\$gp\) +[ ]*fc: R_MIPS_GOT16 big_external_common +0+0100 <[^>]*> nop +0+0104 <[^>]*> addiu \$at,\$at,1 +0+0108 <[^>]*> lb \$a0,0\(\$at\) +0+010c <[^>]*> lbu \$at,1\(\$at\) +0+0110 <[^>]*> sll \$a0,\$a0,0x8 +0+0114 <[^>]*> or \$a0,\$a0,\$at +0+0118 <[^>]*> lw \$at,0\(\$gp\) +[ ]*118: R_MIPS_GOT16 small_external_common +0+011c <[^>]*> nop +0+0120 <[^>]*> addiu \$at,\$at,1 +0+0124 <[^>]*> lbu \$a0,0\(\$at\) +0+0128 <[^>]*> lbu \$at,1\(\$at\) +0+012c <[^>]*> sll \$a0,\$a0,0x8 +0+0130 <[^>]*> or \$a0,\$a0,\$at +0+0134 <[^>]*> lw \$at,0\(\$gp\) +[ ]*134: R_MIPS_GOT16 .bss +0+0138 <[^>]*> nop +0+013c <[^>]*> addiu \$at,\$at,0 +[ ]*13c: R_MIPS_LO16 .bss +0+0140 <[^>]*> addiu \$at,\$at,1 +0+0144 <[^>]*> lwl \$a0,0\(\$at\) +0+0148 <[^>]*> lwr \$a0,3\(\$at\) +0+014c <[^>]*> lw \$at,0\(\$gp\) +[ ]*14c: R_MIPS_GOT16 .bss +0+0150 <[^>]*> nop +0+0154 <[^>]*> addiu \$at,\$at,1000 +[ ]*154: R_MIPS_LO16 .bss +0+0158 <[^>]*> addiu \$at,\$at,1 +0+015c <[^>]*> sb \$a0,1\(\$at\) +0+0160 <[^>]*> srl \$a0,\$a0,0x8 +0+0164 <[^>]*> sb \$a0,0\(\$at\) +0+0168 <[^>]*> lbu \$at,1\(\$at\) +0+016c <[^>]*> sll \$a0,\$a0,0x8 +0+0170 <[^>]*> or \$a0,\$a0,\$at + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/ulh-xgot.d binutils-2.8/gas/testsuite/gas/mips/ulh-xgot.d --- binutils-2.7/gas/testsuite/gas/mips/ulh-xgot.d Thu Jul 4 12:16:00 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ulh-xgot.d Wed Apr 30 12:54:39 1997 @@ -1,6 +1,6 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS ulh-xgot -#as: -mips1 -KPIC -xgot +#as: -mips1 -KPIC -xgot -EB --defsym XGOT=1 #source: ulh-pic.s # Test the unaligned load and store macros with -KPIC -xgot. @@ -8,147 +8,147 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0000 R_MIPS_GOT16 .data -... -0+0008 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0008 R_MIPS_LO16 .data -... -0+0010 <[^>]*> lb \$a0,0\(\$at\) -0+0014 <[^>]*> lbu \$at,1\(\$at\) -0+0018 <[^>]*> sll \$a0,\$a0,0x8 -0+001c <[^>]*> or \$a0,\$a0,\$at -0+0020 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0020 R_MIPS_GOT_HI16 big_external_data_label -0+0024 <[^>]*> addu \$at,\$at,\$gp -0+0028 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0028 R_MIPS_GOT_LO16 big_external_data_label -... -0+0030 <[^>]*> lbu \$a0,0\(\$at\) -0+0034 <[^>]*> lbu \$at,1\(\$at\) -0+0038 <[^>]*> sll \$a0,\$a0,0x8 -0+003c <[^>]*> or \$a0,\$a0,\$at -0+0040 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0040 R_MIPS_GOT_HI16 small_external_data_label -0+0044 <[^>]*> addu \$at,\$at,\$gp -0+0048 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0048 R_MIPS_GOT_LO16 small_external_data_label -... -0+0050 <[^>]*> lwl \$a0,0\(\$at\) -0+0054 <[^>]*> lwr \$a0,3\(\$at\) -0+0058 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0058 R_MIPS_GOT_HI16 big_external_common -0+005c <[^>]*> addu \$at,\$at,\$gp -0+0060 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0060 R_MIPS_GOT_LO16 big_external_common -... -0+0068 <[^>]*> sb \$a0,1\(\$at\) -0+006c <[^>]*> srl \$a0,\$a0,0x8 -0+0070 <[^>]*> sb \$a0,0\(\$at\) -0+0074 <[^>]*> lbu \$at,1\(\$at\) -0+0078 <[^>]*> sll \$a0,\$a0,0x8 -0+007c <[^>]*> or \$a0,\$a0,\$at -0+0080 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0080 R_MIPS_GOT_HI16 small_external_common -0+0084 <[^>]*> addu \$at,\$at,\$gp -0+0088 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0088 R_MIPS_GOT_LO16 small_external_common -... -0+0090 <[^>]*> swl \$a0,0\(\$at\) -0+0094 <[^>]*> swr \$a0,3\(\$at\) -0+0098 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0098 R_MIPS_GOT16 .bss -... -0+00a0 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+00a0 R_MIPS_LO16 .bss -... -0+00a8 <[^>]*> lb \$a0,0\(\$at\) -0+00ac <[^>]*> lbu \$at,1\(\$at\) -0+00b0 <[^>]*> sll \$a0,\$a0,0x8 -0+00b4 <[^>]*> or \$a0,\$a0,\$at -0+00b8 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00b8 R_MIPS_GOT16 .bss -... -0+00c0 <[^>]*> addiu \$at,\$at,1000 -[ ]*RELOC: 0+00c0 R_MIPS_LO16 .bss -... -0+00c8 <[^>]*> lbu \$a0,0\(\$at\) -0+00cc <[^>]*> lbu \$at,1\(\$at\) -0+00d0 <[^>]*> sll \$a0,\$a0,0x8 -0+00d4 <[^>]*> or \$a0,\$a0,\$at -0+00d8 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+00d8 R_MIPS_GOT16 .data -... -0+00e0 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+00e0 R_MIPS_LO16 .data -... -0+00e8 <[^>]*> addiu \$at,\$at,1 -0+00ec <[^>]*> lwl \$a0,0\(\$at\) -0+00f0 <[^>]*> lwr \$a0,3\(\$at\) -0+00f4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00f4 R_MIPS_GOT_HI16 big_external_data_label -0+00f8 <[^>]*> addu \$at,\$at,\$gp -0+00fc <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+00fc R_MIPS_GOT_LO16 big_external_data_label -... -0+0104 <[^>]*> addiu \$at,\$at,1 -0+0108 <[^>]*> sb \$a0,1\(\$at\) -0+010c <[^>]*> srl \$a0,\$a0,0x8 -0+0110 <[^>]*> sb \$a0,0\(\$at\) -0+0114 <[^>]*> lbu \$at,1\(\$at\) -0+0118 <[^>]*> sll \$a0,\$a0,0x8 -0+011c <[^>]*> or \$a0,\$a0,\$at -0+0120 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0120 R_MIPS_GOT_HI16 small_external_data_label -0+0124 <[^>]*> addu \$at,\$at,\$gp -0+0128 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0128 R_MIPS_GOT_LO16 small_external_data_label -... -0+0130 <[^>]*> addiu \$at,\$at,1 -0+0134 <[^>]*> swl \$a0,0\(\$at\) -0+0138 <[^>]*> swr \$a0,3\(\$at\) -0+013c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+013c R_MIPS_GOT_HI16 big_external_common -0+0140 <[^>]*> addu \$at,\$at,\$gp -0+0144 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0144 R_MIPS_GOT_LO16 big_external_common -... -0+014c <[^>]*> addiu \$at,\$at,1 -0+0150 <[^>]*> lb \$a0,0\(\$at\) -0+0154 <[^>]*> lbu \$at,1\(\$at\) -0+0158 <[^>]*> sll \$a0,\$a0,0x8 -0+015c <[^>]*> or \$a0,\$a0,\$at -0+0160 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0160 R_MIPS_GOT_HI16 small_external_common -0+0164 <[^>]*> addu \$at,\$at,\$gp -0+0168 <[^>]*> lw \$at,0\(\$at\) -[ ]*RELOC: 0+0168 R_MIPS_GOT_LO16 small_external_common -... -0+0170 <[^>]*> addiu \$at,\$at,1 -0+0174 <[^>]*> lbu \$a0,0\(\$at\) -0+0178 <[^>]*> lbu \$at,1\(\$at\) -0+017c <[^>]*> sll \$a0,\$a0,0x8 -0+0180 <[^>]*> or \$a0,\$a0,\$at -0+0184 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+0184 R_MIPS_GOT16 .bss -... -0+018c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+018c R_MIPS_LO16 .bss -... -0+0194 <[^>]*> addiu \$at,\$at,1 -0+0198 <[^>]*> lwl \$a0,0\(\$at\) -0+019c <[^>]*> lwr \$a0,3\(\$at\) -0+01a0 <[^>]*> lw \$at,0\(\$gp\) -[ ]*RELOC: 0+01a0 R_MIPS_GOT16 .bss -... -0+01a8 <[^>]*> addiu \$at,\$at,1000 -[ ]*RELOC: 0+01a8 R_MIPS_LO16 .bss -... -0+01b0 <[^>]*> addiu \$at,\$at,1 -0+01b4 <[^>]*> sb \$a0,1\(\$at\) -0+01b8 <[^>]*> srl \$a0,\$a0,0x8 -0+01bc <[^>]*> sb \$a0,0\(\$at\) -0+01c0 <[^>]*> lbu \$at,1\(\$at\) -0+01c4 <[^>]*> sll \$a0,\$a0,0x8 -0+01c8 <[^>]*> or \$a0,\$a0,\$at -... +0+0000 <[^>]*> lw \$at,0\(\$gp\) +[ ]*0: R_MIPS_GOT16 .data +0+0004 <[^>]*> nop +0+0008 <[^>]*> addiu \$at,\$at,0 +[ ]*8: R_MIPS_LO16 .data +0+000c <[^>]*> nop +0+0010 <[^>]*> lb \$a0,0\(\$at\) +0+0014 <[^>]*> lbu \$at,1\(\$at\) +0+0018 <[^>]*> sll \$a0,\$a0,0x8 +0+001c <[^>]*> or \$a0,\$a0,\$at +0+0020 <[^>]*> lui \$at,0x0 +[ ]*20: R_MIPS_GOT_HI16 big_external_data_label +0+0024 <[^>]*> addu \$at,\$at,\$gp +0+0028 <[^>]*> lw \$at,0\(\$at\) +[ ]*28: R_MIPS_GOT_LO16 big_external_data_label +0+002c <[^>]*> nop +0+0030 <[^>]*> lbu \$a0,0\(\$at\) +0+0034 <[^>]*> lbu \$at,1\(\$at\) +0+0038 <[^>]*> sll \$a0,\$a0,0x8 +0+003c <[^>]*> or \$a0,\$a0,\$at +0+0040 <[^>]*> lui \$at,0x0 +[ ]*40: R_MIPS_GOT_HI16 small_external_data_label +0+0044 <[^>]*> addu \$at,\$at,\$gp +0+0048 <[^>]*> lw \$at,0\(\$at\) +[ ]*48: R_MIPS_GOT_LO16 small_external_data_label +0+004c <[^>]*> nop +0+0050 <[^>]*> lwl \$a0,0\(\$at\) +0+0054 <[^>]*> lwr \$a0,3\(\$at\) +0+0058 <[^>]*> lui \$at,0x0 +[ ]*58: R_MIPS_GOT_HI16 big_external_common +0+005c <[^>]*> addu \$at,\$at,\$gp +0+0060 <[^>]*> lw \$at,0\(\$at\) +[ ]*60: R_MIPS_GOT_LO16 big_external_common +0+0064 <[^>]*> nop +0+0068 <[^>]*> sb \$a0,1\(\$at\) +0+006c <[^>]*> srl \$a0,\$a0,0x8 +0+0070 <[^>]*> sb \$a0,0\(\$at\) +0+0074 <[^>]*> lbu \$at,1\(\$at\) +0+0078 <[^>]*> sll \$a0,\$a0,0x8 +0+007c <[^>]*> or \$a0,\$a0,\$at +0+0080 <[^>]*> lui \$at,0x0 +[ ]*80: R_MIPS_GOT_HI16 small_external_common +0+0084 <[^>]*> addu \$at,\$at,\$gp +0+0088 <[^>]*> lw \$at,0\(\$at\) +[ ]*88: R_MIPS_GOT_LO16 small_external_common +0+008c <[^>]*> nop +0+0090 <[^>]*> swl \$a0,0\(\$at\) +0+0094 <[^>]*> swr \$a0,3\(\$at\) +0+0098 <[^>]*> lw \$at,0\(\$gp\) +[ ]*98: R_MIPS_GOT16 .bss +0+009c <[^>]*> nop +0+00a0 <[^>]*> addiu \$at,\$at,0 +[ ]*a0: R_MIPS_LO16 .bss +0+00a4 <[^>]*> nop +0+00a8 <[^>]*> lb \$a0,0\(\$at\) +0+00ac <[^>]*> lbu \$at,1\(\$at\) +0+00b0 <[^>]*> sll \$a0,\$a0,0x8 +0+00b4 <[^>]*> or \$a0,\$a0,\$at +0+00b8 <[^>]*> lw \$at,0\(\$gp\) +[ ]*b8: R_MIPS_GOT16 .bss +0+00bc <[^>]*> nop +0+00c0 <[^>]*> addiu \$at,\$at,1000 +[ ]*c0: R_MIPS_LO16 .bss +0+00c4 <[^>]*> nop +0+00c8 <[^>]*> lbu \$a0,0\(\$at\) +0+00cc <[^>]*> lbu \$at,1\(\$at\) +0+00d0 <[^>]*> sll \$a0,\$a0,0x8 +0+00d4 <[^>]*> or \$a0,\$a0,\$at +0+00d8 <[^>]*> lw \$at,0\(\$gp\) +[ ]*d8: R_MIPS_GOT16 .data +0+00dc <[^>]*> nop +0+00e0 <[^>]*> addiu \$at,\$at,0 +[ ]*e0: R_MIPS_LO16 .data +0+00e4 <[^>]*> nop +0+00e8 <[^>]*> addiu \$at,\$at,1 +0+00ec <[^>]*> lwl \$a0,0\(\$at\) +0+00f0 <[^>]*> lwr \$a0,3\(\$at\) +0+00f4 <[^>]*> lui \$at,0x0 +[ ]*f4: R_MIPS_GOT_HI16 big_external_data_label +0+00f8 <[^>]*> addu \$at,\$at,\$gp +0+00fc <[^>]*> lw \$at,0\(\$at\) +[ ]*fc: R_MIPS_GOT_LO16 big_external_data_label +0+0100 <[^>]*> nop +0+0104 <[^>]*> addiu \$at,\$at,1 +0+0108 <[^>]*> sb \$a0,1\(\$at\) +0+010c <[^>]*> srl \$a0,\$a0,0x8 +0+0110 <[^>]*> sb \$a0,0\(\$at\) +0+0114 <[^>]*> lbu \$at,1\(\$at\) +0+0118 <[^>]*> sll \$a0,\$a0,0x8 +0+011c <[^>]*> or \$a0,\$a0,\$at +0+0120 <[^>]*> lui \$at,0x0 +[ ]*120: R_MIPS_GOT_HI16 small_external_data_label +0+0124 <[^>]*> addu \$at,\$at,\$gp +0+0128 <[^>]*> lw \$at,0\(\$at\) +[ ]*128: R_MIPS_GOT_LO16 small_external_data_label +0+012c <[^>]*> nop +0+0130 <[^>]*> addiu \$at,\$at,1 +0+0134 <[^>]*> swl \$a0,0\(\$at\) +0+0138 <[^>]*> swr \$a0,3\(\$at\) +0+013c <[^>]*> lui \$at,0x0 +[ ]*13c: R_MIPS_GOT_HI16 big_external_common +0+0140 <[^>]*> addu \$at,\$at,\$gp +0+0144 <[^>]*> lw \$at,0\(\$at\) +[ ]*144: R_MIPS_GOT_LO16 big_external_common +0+0148 <[^>]*> nop +0+014c <[^>]*> addiu \$at,\$at,1 +0+0150 <[^>]*> lb \$a0,0\(\$at\) +0+0154 <[^>]*> lbu \$at,1\(\$at\) +0+0158 <[^>]*> sll \$a0,\$a0,0x8 +0+015c <[^>]*> or \$a0,\$a0,\$at +0+0160 <[^>]*> lui \$at,0x0 +[ ]*160: R_MIPS_GOT_HI16 small_external_common +0+0164 <[^>]*> addu \$at,\$at,\$gp +0+0168 <[^>]*> lw \$at,0\(\$at\) +[ ]*168: R_MIPS_GOT_LO16 small_external_common +0+016c <[^>]*> nop +0+0170 <[^>]*> addiu \$at,\$at,1 +0+0174 <[^>]*> lbu \$a0,0\(\$at\) +0+0178 <[^>]*> lbu \$at,1\(\$at\) +0+017c <[^>]*> sll \$a0,\$a0,0x8 +0+0180 <[^>]*> or \$a0,\$a0,\$at +0+0184 <[^>]*> lw \$at,0\(\$gp\) +[ ]*184: R_MIPS_GOT16 .bss +0+0188 <[^>]*> nop +0+018c <[^>]*> addiu \$at,\$at,0 +[ ]*18c: R_MIPS_LO16 .bss +0+0190 <[^>]*> nop +0+0194 <[^>]*> addiu \$at,\$at,1 +0+0198 <[^>]*> lwl \$a0,0\(\$at\) +0+019c <[^>]*> lwr \$a0,3\(\$at\) +0+01a0 <[^>]*> lw \$at,0\(\$gp\) +[ ]*1a0: R_MIPS_GOT16 .bss +0+01a4 <[^>]*> nop +0+01a8 <[^>]*> addiu \$at,\$at,1000 +[ ]*1a8: R_MIPS_LO16 .bss +0+01ac <[^>]*> nop +0+01b0 <[^>]*> addiu \$at,\$at,1 +0+01b4 <[^>]*> sb \$a0,1\(\$at\) +0+01b8 <[^>]*> srl \$a0,\$a0,0x8 +0+01bc <[^>]*> sb \$a0,0\(\$at\) +0+01c0 <[^>]*> lbu \$at,1\(\$at\) +0+01c4 <[^>]*> sll \$a0,\$a0,0x8 +0+01c8 <[^>]*> or \$a0,\$a0,\$at +0+01cc <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/ulh.d binutils-2.8/gas/testsuite/gas/mips/ulh.d --- binutils-2.7/gas/testsuite/gas/mips/ulh.d Thu Jul 4 12:16:00 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ulh.d Wed Apr 30 12:54:39 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS ulh #as: -mips1 @@ -7,368 +7,368 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lb \$a0,[01]\(\$zero\) -0+0004 <[^>]*> lbu \$at,[01]\(\$zero\) -0+0008 <[^>]*> sll \$a0,\$a0,0x8 -0+000c <[^>]*> or \$a0,\$a0,\$at -0+0010 <[^>]*> lb \$a0,[12]\(\$zero\) -0+0014 <[^>]*> lbu \$at,[12]\(\$zero\) -0+0018 <[^>]*> sll \$a0,\$a0,0x8 -0+001c <[^>]*> or \$a0,\$a0,\$at -0+0020 <[^>]*> li \$at,0x8000 -0+0024 <[^>]*> lb \$a0,[01]\(\$at\) -0+0028 <[^>]*> lbu \$at,[01]\(\$at\) -0+002c <[^>]*> sll \$a0,\$a0,0x8 -0+0030 <[^>]*> or \$a0,\$a0,\$at -0+0034 <[^>]*> lb \$a0,-3276[78]\(\$zero\) -0+0038 <[^>]*> lbu \$at,-3276[78]\(\$zero\) -0+003c <[^>]*> sll \$a0,\$a0,0x8 -0+0040 <[^>]*> or \$a0,\$a0,\$at -0+0044 <[^>]*> lui \$at,0x1 -0+0048 <[^>]*> lb \$a0,[01]\(\$at\) -0+004c <[^>]*> lbu \$at,[01]\(\$at\) -0+0050 <[^>]*> sll \$a0,\$a0,0x8 -0+0054 <[^>]*> or \$a0,\$a0,\$at -0+0058 <[^>]*> lui \$at,0x1 -0+005c <[^>]*> ori \$at,\$at,0xa5a5 -0+0060 <[^>]*> lb \$a0,[01]\(\$at\) -0+0064 <[^>]*> lbu \$at,[01]\(\$at\) -0+0068 <[^>]*> sll \$a0,\$a0,0x8 -0+006c <[^>]*> or \$a0,\$a0,\$at -0+0070 <[^>]*> lb \$a0,[01]\(\$a1\) -0+0074 <[^>]*> lbu \$at,[01]\(\$a1\) -0+0078 <[^>]*> sll \$a0,\$a0,0x8 -0+007c <[^>]*> or \$a0,\$a0,\$at -0+0080 <[^>]*> lb \$a0,[12]\(\$a1\) -0+0084 <[^>]*> lbu \$at,[12]\(\$a1\) -0+0088 <[^>]*> sll \$a0,\$a0,0x8 -0+008c <[^>]*> or \$a0,\$a0,\$at -0+0090 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0090 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0094 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0094 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0098 <[^>]*> lb \$a0,[01]\(\$at\) -0+009c <[^>]*> lbu \$at,[01]\(\$at\) -0+00a0 <[^>]*> sll \$a0,\$a0,0x8 -0+00a4 <[^>]*> or \$a0,\$a0,\$at -0+00a8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00a8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00ac <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00ac [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00b0 <[^>]*> lb \$a0,[01]\(\$at\) -0+00b4 <[^>]*> lbu \$at,[01]\(\$at\) -0+00b8 <[^>]*> sll \$a0,\$a0,0x8 -0+00bc <[^>]*> or \$a0,\$a0,\$at -0+00c0 <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+00c0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00c4 <[^>]*> lb \$a0,[01]\(\$at\) -0+00c8 <[^>]*> lbu \$at,[01]\(\$at\) -0+00cc <[^>]*> sll \$a0,\$a0,0x8 -0+00d0 <[^>]*> or \$a0,\$a0,\$at -0+00d4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00d4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00d8 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00d8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+00dc <[^>]*> lb \$a0,[01]\(\$at\) -0+00e0 <[^>]*> lbu \$at,[01]\(\$at\) -0+00e4 <[^>]*> sll \$a0,\$a0,0x8 -0+00e8 <[^>]*> or \$a0,\$a0,\$at -0+00ec <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+00ec [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00f0 <[^>]*> lb \$a0,[01]\(\$at\) -0+00f4 <[^>]*> lbu \$at,[01]\(\$at\) -0+00f8 <[^>]*> sll \$a0,\$a0,0x8 -0+00fc <[^>]*> or \$a0,\$a0,\$at -0+0100 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0100 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0104 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0104 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0108 <[^>]*> lb \$a0,[01]\(\$at\) -0+010c <[^>]*> lbu \$at,[01]\(\$at\) -0+0110 <[^>]*> sll \$a0,\$a0,0x8 -0+0114 <[^>]*> or \$a0,\$a0,\$at -0+0118 <[^>]*> addiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+0118 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+011c <[^>]*> lb \$a0,[01]\(\$at\) -0+0120 <[^>]*> lbu \$at,[01]\(\$at\) -0+0124 <[^>]*> sll \$a0,\$a0,0x8 -0+0128 <[^>]*> or \$a0,\$a0,\$at -0+012c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+012c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0130 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0130 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0134 <[^>]*> lb \$a0,[01]\(\$at\) -0+0138 <[^>]*> lbu \$at,[01]\(\$at\) -0+013c <[^>]*> sll \$a0,\$a0,0x8 -0+0140 <[^>]*> or \$a0,\$a0,\$at -0+0144 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0144 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0148 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0148 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+014c <[^>]*> lb \$a0,[01]\(\$at\) -0+0150 <[^>]*> lbu \$at,[01]\(\$at\) -0+0154 <[^>]*> sll \$a0,\$a0,0x8 -0+0158 <[^>]*> or \$a0,\$a0,\$at -0+015c <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+015c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0160 <[^>]*> lb \$a0,[01]\(\$at\) -0+0164 <[^>]*> lbu \$at,[01]\(\$at\) -0+0168 <[^>]*> sll \$a0,\$a0,0x8 -0+016c <[^>]*> or \$a0,\$a0,\$at -0+0170 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0170 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0174 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0174 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0178 <[^>]*> lb \$a0,[01]\(\$at\) -0+017c <[^>]*> lbu \$at,[01]\(\$at\) -0+0180 <[^>]*> sll \$a0,\$a0,0x8 -0+0184 <[^>]*> or \$a0,\$a0,\$at -0+0188 <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+0188 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+018c <[^>]*> lb \$a0,[01]\(\$at\) -0+0190 <[^>]*> lbu \$at,[01]\(\$at\) -0+0194 <[^>]*> sll \$a0,\$a0,0x8 -0+0198 <[^>]*> or \$a0,\$a0,\$at -0+019c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+019c [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+01a0 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01a0 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+01a4 <[^>]*> lb \$a0,[01]\(\$at\) -0+01a8 <[^>]*> lbu \$at,[01]\(\$at\) -0+01ac <[^>]*> sll \$a0,\$a0,0x8 -0+01b0 <[^>]*> or \$a0,\$a0,\$at -0+01b4 <[^>]*> addiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+01b4 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+01b8 <[^>]*> lb \$a0,[01]\(\$at\) -0+01bc <[^>]*> lbu \$at,[01]\(\$at\) -0+01c0 <[^>]*> sll \$a0,\$a0,0x8 -0+01c4 <[^>]*> or \$a0,\$a0,\$at -0+01c8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01c8 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+01cc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01cc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+01d0 <[^>]*> lb \$a0,[01]\(\$at\) -0+01d4 <[^>]*> lbu \$at,[01]\(\$at\) -0+01d8 <[^>]*> sll \$a0,\$a0,0x8 -0+01dc <[^>]*> or \$a0,\$a0,\$at -0+01e0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01e0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+01e4 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01e4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01e8 <[^>]*> lb \$a0,[01]\(\$at\) -0+01ec <[^>]*> lbu \$at,[01]\(\$at\) -0+01f0 <[^>]*> sll \$a0,\$a0,0x8 -0+01f4 <[^>]*> or \$a0,\$a0,\$at -0+01f8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01f8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+01fc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01fc [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0200 <[^>]*> lb \$a0,[01]\(\$at\) -0+0204 <[^>]*> lbu \$at,[01]\(\$at\) -0+0208 <[^>]*> sll \$a0,\$a0,0x8 -0+020c <[^>]*> or \$a0,\$a0,\$at -0+0210 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0210 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0214 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0214 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0218 <[^>]*> lb \$a0,[01]\(\$at\) -0+021c <[^>]*> lbu \$at,[01]\(\$at\) -0+0220 <[^>]*> sll \$a0,\$a0,0x8 -0+0224 <[^>]*> or \$a0,\$a0,\$at -0+0228 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0228 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+022c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+022c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0230 <[^>]*> lb \$a0,[01]\(\$at\) -0+0234 <[^>]*> lbu \$at,[01]\(\$at\) -0+0238 <[^>]*> sll \$a0,\$a0,0x8 -0+023c <[^>]*> or \$a0,\$a0,\$at -0+0240 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0240 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0244 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0244 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0248 <[^>]*> lb \$a0,[01]\(\$at\) -0+024c <[^>]*> lbu \$at,[01]\(\$at\) -0+0250 <[^>]*> sll \$a0,\$a0,0x8 -0+0254 <[^>]*> or \$a0,\$a0,\$at -0+0258 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0258 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+025c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+025c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0260 <[^>]*> lb \$a0,[01]\(\$at\) -0+0264 <[^>]*> lbu \$at,[01]\(\$at\) -0+0268 <[^>]*> sll \$a0,\$a0,0x8 -0+026c <[^>]*> or \$a0,\$a0,\$at -0+0270 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0270 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0274 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0274 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0278 <[^>]*> lb \$a0,[01]\(\$at\) -0+027c <[^>]*> lbu \$at,[01]\(\$at\) -0+0280 <[^>]*> sll \$a0,\$a0,0x8 -0+0284 <[^>]*> or \$a0,\$a0,\$at -0+0288 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0288 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+028c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+028c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0290 <[^>]*> lb \$a0,[01]\(\$at\) -0+0294 <[^>]*> lbu \$at,[01]\(\$at\) -0+0298 <[^>]*> sll \$a0,\$a0,0x8 -0+029c <[^>]*> or \$a0,\$a0,\$at -0+02a0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02a0 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+02a4 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02a4 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+02a8 <[^>]*> lb \$a0,[01]\(\$at\) -0+02ac <[^>]*> lbu \$at,[01]\(\$at\) -0+02b0 <[^>]*> sll \$a0,\$a0,0x8 -0+02b4 <[^>]*> or \$a0,\$a0,\$at -0+02b8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02b8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+02bc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02bc [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02c0 <[^>]*> lb \$a0,[01]\(\$at\) -0+02c4 <[^>]*> lbu \$at,[01]\(\$at\) -0+02c8 <[^>]*> sll \$a0,\$a0,0x8 -0+02cc <[^>]*> or \$a0,\$a0,\$at -0+02d0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02d0 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02d4 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02d4 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+02d8 <[^>]*> lb \$a0,[01]\(\$at\) -0+02dc <[^>]*> lbu \$at,[01]\(\$at\) -0+02e0 <[^>]*> sll \$a0,\$a0,0x8 -0+02e4 <[^>]*> or \$a0,\$a0,\$at -0+02e8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+02e8 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02ec <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02ec [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+02f0 <[^>]*> lb \$a0,[01]\(\$at\) -0+02f4 <[^>]*> lbu \$at,[01]\(\$at\) -0+02f8 <[^>]*> sll \$a0,\$a0,0x8 -0+02fc <[^>]*> or \$a0,\$a0,\$at -0+0300 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0300 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0304 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0304 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0308 <[^>]*> lb \$a0,[01]\(\$at\) -0+030c <[^>]*> lbu \$at,[01]\(\$at\) -0+0310 <[^>]*> sll \$a0,\$a0,0x8 -0+0314 <[^>]*> or \$a0,\$a0,\$at -0+0318 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0318 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+031c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+031c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0320 <[^>]*> lb \$a0,[01]\(\$at\) -0+0324 <[^>]*> lbu \$at,[01]\(\$at\) -0+0328 <[^>]*> sll \$a0,\$a0,0x8 -0+032c <[^>]*> or \$a0,\$a0,\$at -0+0330 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0330 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0334 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0334 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0338 <[^>]*> lb \$a0,[01]\(\$at\) -0+033c <[^>]*> lbu \$at,[01]\(\$at\) -0+0340 <[^>]*> sll \$a0,\$a0,0x8 -0+0344 <[^>]*> or \$a0,\$a0,\$at -0+0348 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0348 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+034c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+034c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0350 <[^>]*> lb \$a0,[01]\(\$at\) -0+0354 <[^>]*> lbu \$at,[01]\(\$at\) -0+0358 <[^>]*> sll \$a0,\$a0,0x8 -0+035c <[^>]*> or \$a0,\$a0,\$at -0+0360 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0360 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0364 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0364 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0368 <[^>]*> lb \$a0,[01]\(\$at\) -0+036c <[^>]*> lbu \$at,[01]\(\$at\) -0+0370 <[^>]*> sll \$a0,\$a0,0x8 -0+0374 <[^>]*> or \$a0,\$a0,\$at -0+0378 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0378 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+037c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+037c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0380 <[^>]*> lb \$a0,[01]\(\$at\) -0+0384 <[^>]*> lbu \$at,[01]\(\$at\) -0+0388 <[^>]*> sll \$a0,\$a0,0x8 -0+038c <[^>]*> or \$a0,\$a0,\$at -0+0390 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0390 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0394 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0394 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0398 <[^>]*> lb \$a0,[01]\(\$at\) -0+039c <[^>]*> lbu \$at,[01]\(\$at\) -0+03a0 <[^>]*> sll \$a0,\$a0,0x8 -0+03a4 <[^>]*> or \$a0,\$a0,\$at -0+03a8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+03a8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+03ac <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+03ac [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+03b0 <[^>]*> lb \$a0,[01]\(\$at\) -0+03b4 <[^>]*> lbu \$at,[01]\(\$at\) -0+03b8 <[^>]*> sll \$a0,\$a0,0x8 -0+03bc <[^>]*> or \$a0,\$a0,\$at -0+03c0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+03c0 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+03c4 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+03c4 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+03c8 <[^>]*> lb \$a0,[01]\(\$at\) -0+03cc <[^>]*> lbu \$at,[01]\(\$at\) -0+03d0 <[^>]*> sll \$a0,\$a0,0x8 -0+03d4 <[^>]*> or \$a0,\$a0,\$at -0+03d8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+03d8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+03dc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+03dc [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+03e0 <[^>]*> lb \$a0,[01]\(\$at\) -0+03e4 <[^>]*> lbu \$at,[01]\(\$at\) -0+03e8 <[^>]*> sll \$a0,\$a0,0x8 -0+03ec <[^>]*> or \$a0,\$a0,\$at -0+03f0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+03f0 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+03f4 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+03f4 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+03f8 <[^>]*> lb \$a0,[01]\(\$at\) -0+03fc <[^>]*> lbu \$at,[01]\(\$at\) -0+0400 <[^>]*> sll \$a0,\$a0,0x8 -0+0404 <[^>]*> or \$a0,\$a0,\$at -0+0408 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0408 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+040c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+040c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0410 <[^>]*> lb \$a0,[01]\(\$at\) -0+0414 <[^>]*> lbu \$at,[01]\(\$at\) -0+0418 <[^>]*> sll \$a0,\$a0,0x8 -0+041c <[^>]*> or \$a0,\$a0,\$at -0+0420 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0420 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0424 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0424 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0428 <[^>]*> lb \$a0,[01]\(\$at\) -0+042c <[^>]*> lbu \$at,[01]\(\$at\) -0+0430 <[^>]*> sll \$a0,\$a0,0x8 -0+0434 <[^>]*> or \$a0,\$a0,\$at -0+0438 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0438 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+043c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+043c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0440 <[^>]*> lb \$a0,[01]\(\$at\) -0+0444 <[^>]*> lbu \$at,[01]\(\$at\) -0+0448 <[^>]*> sll \$a0,\$a0,0x8 -0+044c <[^>]*> or \$a0,\$a0,\$at -0+0450 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0450 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0454 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0454 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0458 <[^>]*> lb \$a0,[01]\(\$at\) -0+045c <[^>]*> lbu \$at,[01]\(\$at\) -0+0460 <[^>]*> sll \$a0,\$a0,0x8 -0+0464 <[^>]*> or \$a0,\$a0,\$at -0+0468 <[^>]*> lbu \$a0,[01]\(\$zero\) -0+046c <[^>]*> lbu \$at,[01]\(\$zero\) -0+0470 <[^>]*> sll \$a0,\$a0,0x8 -0+0474 <[^>]*> or \$a0,\$a0,\$at -... +0+0000 <[^>]*> lb \$a0,[01]\(\$zero\) +0+0004 <[^>]*> lbu \$at,[01]\(\$zero\) +0+0008 <[^>]*> sll \$a0,\$a0,0x8 +0+000c <[^>]*> or \$a0,\$a0,\$at +0+0010 <[^>]*> lb \$a0,[12]\(\$zero\) +0+0014 <[^>]*> lbu \$at,[12]\(\$zero\) +0+0018 <[^>]*> sll \$a0,\$a0,0x8 +0+001c <[^>]*> or \$a0,\$a0,\$at +0+0020 <[^>]*> li \$at,0x8000 +0+0024 <[^>]*> lb \$a0,[01]\(\$at\) +0+0028 <[^>]*> lbu \$at,[01]\(\$at\) +0+002c <[^>]*> sll \$a0,\$a0,0x8 +0+0030 <[^>]*> or \$a0,\$a0,\$at +0+0034 <[^>]*> lb \$a0,-3276[78]\(\$zero\) +0+0038 <[^>]*> lbu \$at,-3276[78]\(\$zero\) +0+003c <[^>]*> sll \$a0,\$a0,0x8 +0+0040 <[^>]*> or \$a0,\$a0,\$at +0+0044 <[^>]*> lui \$at,0x1 +0+0048 <[^>]*> lb \$a0,[01]\(\$at\) +0+004c <[^>]*> lbu \$at,[01]\(\$at\) +0+0050 <[^>]*> sll \$a0,\$a0,0x8 +0+0054 <[^>]*> or \$a0,\$a0,\$at +0+0058 <[^>]*> lui \$at,0x1 +0+005c <[^>]*> ori \$at,\$at,0xa5a5 +0+0060 <[^>]*> lb \$a0,[01]\(\$at\) +0+0064 <[^>]*> lbu \$at,[01]\(\$at\) +0+0068 <[^>]*> sll \$a0,\$a0,0x8 +0+006c <[^>]*> or \$a0,\$a0,\$at +0+0070 <[^>]*> lb \$a0,[01]\(\$a1\) +0+0074 <[^>]*> lbu \$at,[01]\(\$a1\) +0+0078 <[^>]*> sll \$a0,\$a0,0x8 +0+007c <[^>]*> or \$a0,\$a0,\$at +0+0080 <[^>]*> lb \$a0,[12]\(\$a1\) +0+0084 <[^>]*> lbu \$at,[12]\(\$a1\) +0+0088 <[^>]*> sll \$a0,\$a0,0x8 +0+008c <[^>]*> or \$a0,\$a0,\$at +0+0090 <[^>]*> lui \$at,[-0-9x]+ +[ ]*90: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0094 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*94: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0098 <[^>]*> lb \$a0,[01]\(\$at\) +0+009c <[^>]*> lbu \$at,[01]\(\$at\) +0+00a0 <[^>]*> sll \$a0,\$a0,0x8 +0+00a4 <[^>]*> or \$a0,\$a0,\$at +0+00a8 <[^>]*> lui \$at,0x0 +[ ]*a8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00ac <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*ac: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00b0 <[^>]*> lb \$a0,[01]\(\$at\) +0+00b4 <[^>]*> lbu \$at,[01]\(\$at\) +0+00b8 <[^>]*> sll \$a0,\$a0,0x8 +0+00bc <[^>]*> or \$a0,\$a0,\$at +0+00c0 <[^>]*> addiu \$at,\$gp,0 +[ ]*c0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00c4 <[^>]*> lb \$a0,[01]\(\$at\) +0+00c8 <[^>]*> lbu \$at,[01]\(\$at\) +0+00cc <[^>]*> sll \$a0,\$a0,0x8 +0+00d0 <[^>]*> or \$a0,\$a0,\$at +0+00d4 <[^>]*> lui \$at,0x0 +[ ]*d4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00d8 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*d8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+00dc <[^>]*> lb \$a0,[01]\(\$at\) +0+00e0 <[^>]*> lbu \$at,[01]\(\$at\) +0+00e4 <[^>]*> sll \$a0,\$a0,0x8 +0+00e8 <[^>]*> or \$a0,\$a0,\$at +0+00ec <[^>]*> addiu \$at,\$gp,0 +[ ]*ec: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00f0 <[^>]*> lb \$a0,[01]\(\$at\) +0+00f4 <[^>]*> lbu \$at,[01]\(\$at\) +0+00f8 <[^>]*> sll \$a0,\$a0,0x8 +0+00fc <[^>]*> or \$a0,\$a0,\$at +0+0100 <[^>]*> lui \$at,[-0-9x]+ +[ ]*100: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0104 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*104: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0108 <[^>]*> lb \$a0,[01]\(\$at\) +0+010c <[^>]*> lbu \$at,[01]\(\$at\) +0+0110 <[^>]*> sll \$a0,\$a0,0x8 +0+0114 <[^>]*> or \$a0,\$a0,\$at +0+0118 <[^>]*> addiu \$at,\$gp,[-0-9]+ +[ ]*118: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+011c <[^>]*> lb \$a0,[01]\(\$at\) +0+0120 <[^>]*> lbu \$at,[01]\(\$at\) +0+0124 <[^>]*> sll \$a0,\$a0,0x8 +0+0128 <[^>]*> or \$a0,\$a0,\$at +0+012c <[^>]*> lui \$at,0x0 +[ ]*12c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0130 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*130: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0134 <[^>]*> lb \$a0,[01]\(\$at\) +0+0138 <[^>]*> lbu \$at,[01]\(\$at\) +0+013c <[^>]*> sll \$a0,\$a0,0x8 +0+0140 <[^>]*> or \$a0,\$a0,\$at +0+0144 <[^>]*> lui \$at,0x0 +[ ]*144: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0148 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*148: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+014c <[^>]*> lb \$a0,[01]\(\$at\) +0+0150 <[^>]*> lbu \$at,[01]\(\$at\) +0+0154 <[^>]*> sll \$a0,\$a0,0x8 +0+0158 <[^>]*> or \$a0,\$a0,\$at +0+015c <[^>]*> addiu \$at,\$gp,1 +[ ]*15c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0160 <[^>]*> lb \$a0,[01]\(\$at\) +0+0164 <[^>]*> lbu \$at,[01]\(\$at\) +0+0168 <[^>]*> sll \$a0,\$a0,0x8 +0+016c <[^>]*> or \$a0,\$a0,\$at +0+0170 <[^>]*> lui \$at,0x0 +[ ]*170: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0174 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*174: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0178 <[^>]*> lb \$a0,[01]\(\$at\) +0+017c <[^>]*> lbu \$at,[01]\(\$at\) +0+0180 <[^>]*> sll \$a0,\$a0,0x8 +0+0184 <[^>]*> or \$a0,\$a0,\$at +0+0188 <[^>]*> addiu \$at,\$gp,1 +[ ]*188: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+018c <[^>]*> lb \$a0,[01]\(\$at\) +0+0190 <[^>]*> lbu \$at,[01]\(\$at\) +0+0194 <[^>]*> sll \$a0,\$a0,0x8 +0+0198 <[^>]*> or \$a0,\$a0,\$at +0+019c <[^>]*> lui \$at,0x0 +[ ]*19c: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+01a0 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1a0: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+01a4 <[^>]*> lb \$a0,[01]\(\$at\) +0+01a8 <[^>]*> lbu \$at,[01]\(\$at\) +0+01ac <[^>]*> sll \$a0,\$a0,0x8 +0+01b0 <[^>]*> or \$a0,\$a0,\$at +0+01b4 <[^>]*> addiu \$at,\$gp,[-0-9]+ +[ ]*1b4: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+01b8 <[^>]*> lb \$a0,[01]\(\$at\) +0+01bc <[^>]*> lbu \$at,[01]\(\$at\) +0+01c0 <[^>]*> sll \$a0,\$a0,0x8 +0+01c4 <[^>]*> or \$a0,\$a0,\$at +0+01c8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*1c8: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+01cc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1cc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+01d0 <[^>]*> lb \$a0,[01]\(\$at\) +0+01d4 <[^>]*> lbu \$at,[01]\(\$at\) +0+01d8 <[^>]*> sll \$a0,\$a0,0x8 +0+01dc <[^>]*> or \$a0,\$a0,\$at +0+01e0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*1e0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+01e4 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1e4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01e8 <[^>]*> lb \$a0,[01]\(\$at\) +0+01ec <[^>]*> lbu \$at,[01]\(\$at\) +0+01f0 <[^>]*> sll \$a0,\$a0,0x8 +0+01f4 <[^>]*> or \$a0,\$a0,\$at +0+01f8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*1f8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+01fc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1fc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0200 <[^>]*> lb \$a0,[01]\(\$at\) +0+0204 <[^>]*> lbu \$at,[01]\(\$at\) +0+0208 <[^>]*> sll \$a0,\$a0,0x8 +0+020c <[^>]*> or \$a0,\$a0,\$at +0+0210 <[^>]*> lui \$at,[-0-9x]+ +[ ]*210: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0214 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*214: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0218 <[^>]*> lb \$a0,[01]\(\$at\) +0+021c <[^>]*> lbu \$at,[01]\(\$at\) +0+0220 <[^>]*> sll \$a0,\$a0,0x8 +0+0224 <[^>]*> or \$a0,\$a0,\$at +0+0228 <[^>]*> lui \$at,[-0-9x]+ +[ ]*228: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+022c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*22c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0230 <[^>]*> lb \$a0,[01]\(\$at\) +0+0234 <[^>]*> lbu \$at,[01]\(\$at\) +0+0238 <[^>]*> sll \$a0,\$a0,0x8 +0+023c <[^>]*> or \$a0,\$a0,\$at +0+0240 <[^>]*> lui \$at,[-0-9x]+ +[ ]*240: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0244 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*244: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0248 <[^>]*> lb \$a0,[01]\(\$at\) +0+024c <[^>]*> lbu \$at,[01]\(\$at\) +0+0250 <[^>]*> sll \$a0,\$a0,0x8 +0+0254 <[^>]*> or \$a0,\$a0,\$at +0+0258 <[^>]*> lui \$at,[-0-9x]+ +[ ]*258: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+025c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*25c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0260 <[^>]*> lb \$a0,[01]\(\$at\) +0+0264 <[^>]*> lbu \$at,[01]\(\$at\) +0+0268 <[^>]*> sll \$a0,\$a0,0x8 +0+026c <[^>]*> or \$a0,\$a0,\$at +0+0270 <[^>]*> lui \$at,0x0 +[ ]*270: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0274 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*274: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0278 <[^>]*> lb \$a0,[01]\(\$at\) +0+027c <[^>]*> lbu \$at,[01]\(\$at\) +0+0280 <[^>]*> sll \$a0,\$a0,0x8 +0+0284 <[^>]*> or \$a0,\$a0,\$at +0+0288 <[^>]*> lui \$at,0x0 +[ ]*288: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+028c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*28c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0290 <[^>]*> lb \$a0,[01]\(\$at\) +0+0294 <[^>]*> lbu \$at,[01]\(\$at\) +0+0298 <[^>]*> sll \$a0,\$a0,0x8 +0+029c <[^>]*> or \$a0,\$a0,\$at +0+02a0 <[^>]*> lui \$at,0x0 +[ ]*2a0: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+02a4 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2a4: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+02a8 <[^>]*> lb \$a0,[01]\(\$at\) +0+02ac <[^>]*> lbu \$at,[01]\(\$at\) +0+02b0 <[^>]*> sll \$a0,\$a0,0x8 +0+02b4 <[^>]*> or \$a0,\$a0,\$at +0+02b8 <[^>]*> lui \$at,0x0 +[ ]*2b8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+02bc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2bc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02c0 <[^>]*> lb \$a0,[01]\(\$at\) +0+02c4 <[^>]*> lbu \$at,[01]\(\$at\) +0+02c8 <[^>]*> sll \$a0,\$a0,0x8 +0+02cc <[^>]*> or \$a0,\$a0,\$at +0+02d0 <[^>]*> lui \$at,0x0 +[ ]*2d0: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02d4 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2d4: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+02d8 <[^>]*> lb \$a0,[01]\(\$at\) +0+02dc <[^>]*> lbu \$at,[01]\(\$at\) +0+02e0 <[^>]*> sll \$a0,\$a0,0x8 +0+02e4 <[^>]*> or \$a0,\$a0,\$at +0+02e8 <[^>]*> lui \$at,0x0 +[ ]*2e8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+02ec <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2ec: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+02f0 <[^>]*> lb \$a0,[01]\(\$at\) +0+02f4 <[^>]*> lbu \$at,[01]\(\$at\) +0+02f8 <[^>]*> sll \$a0,\$a0,0x8 +0+02fc <[^>]*> or \$a0,\$a0,\$at +0+0300 <[^>]*> lui \$at,0x0 +[ ]*300: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0304 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*304: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0308 <[^>]*> lb \$a0,[01]\(\$at\) +0+030c <[^>]*> lbu \$at,[01]\(\$at\) +0+0310 <[^>]*> sll \$a0,\$a0,0x8 +0+0314 <[^>]*> or \$a0,\$a0,\$at +0+0318 <[^>]*> lui \$at,[-0-9x]+ +[ ]*318: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+031c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*31c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0320 <[^>]*> lb \$a0,[01]\(\$at\) +0+0324 <[^>]*> lbu \$at,[01]\(\$at\) +0+0328 <[^>]*> sll \$a0,\$a0,0x8 +0+032c <[^>]*> or \$a0,\$a0,\$at +0+0330 <[^>]*> lui \$at,[-0-9x]+ +[ ]*330: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0334 <[^>]*> addiu \$at,\$at,0 +[ ]*334: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0338 <[^>]*> lb \$a0,[01]\(\$at\) +0+033c <[^>]*> lbu \$at,[01]\(\$at\) +0+0340 <[^>]*> sll \$a0,\$a0,0x8 +0+0344 <[^>]*> or \$a0,\$a0,\$at +0+0348 <[^>]*> lui \$at,[-0-9x]+ +[ ]*348: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+034c <[^>]*> addiu \$at,\$at,0 +[ ]*34c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0350 <[^>]*> lb \$a0,[01]\(\$at\) +0+0354 <[^>]*> lbu \$at,[01]\(\$at\) +0+0358 <[^>]*> sll \$a0,\$a0,0x8 +0+035c <[^>]*> or \$a0,\$a0,\$at +0+0360 <[^>]*> lui \$at,[-0-9x]+ +[ ]*360: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0364 <[^>]*> addiu \$at,\$at,0 +[ ]*364: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0368 <[^>]*> lb \$a0,[01]\(\$at\) +0+036c <[^>]*> lbu \$at,[01]\(\$at\) +0+0370 <[^>]*> sll \$a0,\$a0,0x8 +0+0374 <[^>]*> or \$a0,\$a0,\$at +0+0378 <[^>]*> lui \$at,[-0-9x]+ +[ ]*378: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+037c <[^>]*> addiu \$at,\$at,0 +[ ]*37c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0380 <[^>]*> lb \$a0,[01]\(\$at\) +0+0384 <[^>]*> lbu \$at,[01]\(\$at\) +0+0388 <[^>]*> sll \$a0,\$a0,0x8 +0+038c <[^>]*> or \$a0,\$a0,\$at +0+0390 <[^>]*> lui \$at,[-0-9x]+ +[ ]*390: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0394 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*394: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0398 <[^>]*> lb \$a0,[01]\(\$at\) +0+039c <[^>]*> lbu \$at,[01]\(\$at\) +0+03a0 <[^>]*> sll \$a0,\$a0,0x8 +0+03a4 <[^>]*> or \$a0,\$a0,\$at +0+03a8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*3a8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+03ac <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*3ac: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+03b0 <[^>]*> lb \$a0,[01]\(\$at\) +0+03b4 <[^>]*> lbu \$at,[01]\(\$at\) +0+03b8 <[^>]*> sll \$a0,\$a0,0x8 +0+03bc <[^>]*> or \$a0,\$a0,\$at +0+03c0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*3c0: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+03c4 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*3c4: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+03c8 <[^>]*> lb \$a0,[01]\(\$at\) +0+03cc <[^>]*> lbu \$at,[01]\(\$at\) +0+03d0 <[^>]*> sll \$a0,\$a0,0x8 +0+03d4 <[^>]*> or \$a0,\$a0,\$at +0+03d8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*3d8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+03dc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*3dc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+03e0 <[^>]*> lb \$a0,[01]\(\$at\) +0+03e4 <[^>]*> lbu \$at,[01]\(\$at\) +0+03e8 <[^>]*> sll \$a0,\$a0,0x8 +0+03ec <[^>]*> or \$a0,\$a0,\$at +0+03f0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*3f0: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+03f4 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*3f4: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+03f8 <[^>]*> lb \$a0,[01]\(\$at\) +0+03fc <[^>]*> lbu \$at,[01]\(\$at\) +0+0400 <[^>]*> sll \$a0,\$a0,0x8 +0+0404 <[^>]*> or \$a0,\$a0,\$at +0+0408 <[^>]*> lui \$at,[-0-9x]+ +[ ]*408: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+040c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*40c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0410 <[^>]*> lb \$a0,[01]\(\$at\) +0+0414 <[^>]*> lbu \$at,[01]\(\$at\) +0+0418 <[^>]*> sll \$a0,\$a0,0x8 +0+041c <[^>]*> or \$a0,\$a0,\$at +0+0420 <[^>]*> lui \$at,[-0-9x]+ +[ ]*420: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0424 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*424: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0428 <[^>]*> lb \$a0,[01]\(\$at\) +0+042c <[^>]*> lbu \$at,[01]\(\$at\) +0+0430 <[^>]*> sll \$a0,\$a0,0x8 +0+0434 <[^>]*> or \$a0,\$a0,\$at +0+0438 <[^>]*> lui \$at,[-0-9x]+ +[ ]*438: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+043c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*43c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0440 <[^>]*> lb \$a0,[01]\(\$at\) +0+0444 <[^>]*> lbu \$at,[01]\(\$at\) +0+0448 <[^>]*> sll \$a0,\$a0,0x8 +0+044c <[^>]*> or \$a0,\$a0,\$at +0+0450 <[^>]*> lui \$at,[-0-9x]+ +[ ]*450: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0454 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*454: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0458 <[^>]*> lb \$a0,[01]\(\$at\) +0+045c <[^>]*> lbu \$at,[01]\(\$at\) +0+0460 <[^>]*> sll \$a0,\$a0,0x8 +0+0464 <[^>]*> or \$a0,\$a0,\$at +0+0468 <[^>]*> lbu \$a0,[01]\(\$zero\) +0+046c <[^>]*> lbu \$at,[01]\(\$zero\) +0+0470 <[^>]*> sll \$a0,\$a0,0x8 +0+0474 <[^>]*> or \$a0,\$a0,\$at + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/ulh.s binutils-2.8/gas/testsuite/gas/mips/ulh.s --- binutils-2.7/gas/testsuite/gas/mips/ulh.s Thu Jul 4 12:16:00 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ulh.s Wed Apr 30 12:54:39 1997 @@ -63,3 +63,7 @@ # ulhu is handled like ulh. Sanity check it. ulhu $4,0 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/ulw.d binutils-2.8/gas/testsuite/gas/mips/ulw.d --- binutils-2.7/gas/testsuite/gas/mips/ulw.d Thu Jul 4 12:16:00 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ulw.d Wed Apr 30 12:54:40 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS ulw #as: -mips1 @@ -7,264 +7,264 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> lwl \$a0,[03]\(\$zero\) -0+0004 <[^>]*> lwr \$a0,[03]\(\$zero\) -0+0008 <[^>]*> lwl \$a0,[14]\(\$zero\) -0+000c <[^>]*> lwr \$a0,[14]\(\$zero\) -0+0010 <[^>]*> li \$at,0x8000 -0+0014 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0018 <[^>]*> lwr \$a0,[03]\(\$at\) -0+001c <[^>]*> lwl \$a0,-3276[58]\(\$zero\) -0+0020 <[^>]*> lwr \$a0,-3276[58]\(\$zero\) -0+0024 <[^>]*> lui \$at,0x1 -0+0028 <[^>]*> lwl \$a0,[03]\(\$at\) -0+002c <[^>]*> lwr \$a0,[03]\(\$at\) -0+0030 <[^>]*> lui \$at,0x1 -0+0034 <[^>]*> ori \$at,\$at,0xa5a5 -0+0038 <[^>]*> lwl \$a0,[03]\(\$at\) -0+003c <[^>]*> lwr \$a0,[03]\(\$at\) -0+0040 <[^>]*> lwl \$a0,[03]\(\$a1\) -0+0044 <[^>]*> lwr \$a0,[03]\(\$a1\) -0+0048 <[^>]*> lwl \$a0,[14]\(\$a1\) -0+004c <[^>]*> lwr \$a0,[-0-9]+\(\$a1\) -0+0050 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0050 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0054 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0054 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0058 <[^>]*> lwl \$a0,[03]\(\$at\) -0+005c <[^>]*> lwr \$a0,[03]\(\$at\) -0+0060 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0060 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0064 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0064 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0068 <[^>]*> lwl \$a0,[03]\(\$at\) -0+006c <[^>]*> lwr \$a0,[03]\(\$at\) -0+0070 <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+0070 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0074 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0078 <[^>]*> lwr \$a0,[03]\(\$at\) -0+007c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+007c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0080 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0080 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0084 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0088 <[^>]*> lwr \$a0,[03]\(\$at\) -0+008c <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+008c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0090 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0094 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0098 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0098 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+009c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+009c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00a0 <[^>]*> lwl \$a0,[03]\(\$at\) -0+00a4 <[^>]*> lwr \$a0,[03]\(\$at\) -0+00a8 <[^>]*> addiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+00a8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00ac <[^>]*> lwl \$a0,[03]\(\$at\) -0+00b0 <[^>]*> lwr \$a0,[03]\(\$at\) -0+00b4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00b4 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00b8 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00b8 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00bc <[^>]*> lwl \$a0,[03]\(\$at\) -0+00c0 <[^>]*> lwr \$a0,[03]\(\$at\) -0+00c4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00c4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00c8 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00c8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00cc <[^>]*> lwl \$a0,[03]\(\$at\) -0+00d0 <[^>]*> lwr \$a0,[03]\(\$at\) -0+00d4 <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+00d4 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00d8 <[^>]*> lwl \$a0,[03]\(\$at\) -0+00dc <[^>]*> lwr \$a0,[03]\(\$at\) -0+00e0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00e0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00e4 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00e4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+00e8 <[^>]*> lwl \$a0,[03]\(\$at\) -0+00ec <[^>]*> lwr \$a0,[03]\(\$at\) -0+00f0 <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+00f0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00f4 <[^>]*> lwl \$a0,[03]\(\$at\) -0+00f8 <[^>]*> lwr \$a0,[03]\(\$at\) -0+00fc <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00fc [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0100 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0100 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0104 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0108 <[^>]*> lwr \$a0,[03]\(\$at\) -0+010c <[^>]*> addiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+010c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0110 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0114 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0118 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0118 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+011c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+011c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0120 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0124 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0128 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0128 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+012c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+012c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0130 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0134 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0138 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0138 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+013c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+013c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0140 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0144 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0148 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0148 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+014c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+014c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0150 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0154 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0158 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0158 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+015c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+015c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0160 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0164 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0168 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0168 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+016c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+016c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0170 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0174 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0178 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0178 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+017c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+017c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0180 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0184 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0188 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0188 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+018c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+018c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0190 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0194 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0198 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0198 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+019c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+019c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01a0 <[^>]*> lwl \$a0,[03]\(\$at\) -0+01a4 <[^>]*> lwr \$a0,[03]\(\$at\) -0+01a8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01a8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+01ac <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01ac [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+01b0 <[^>]*> lwl \$a0,[03]\(\$at\) -0+01b4 <[^>]*> lwr \$a0,[03]\(\$at\) -0+01b8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01b8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01bc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01bc [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01c0 <[^>]*> lwl \$a0,[03]\(\$at\) -0+01c4 <[^>]*> lwr \$a0,[03]\(\$at\) -0+01c8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01c8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+01cc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01cc [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+01d0 <[^>]*> lwl \$a0,[03]\(\$at\) -0+01d4 <[^>]*> lwr \$a0,[03]\(\$at\) -0+01d8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01d8 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+01dc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01dc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+01e0 <[^>]*> lwl \$a0,[03]\(\$at\) -0+01e4 <[^>]*> lwr \$a0,[03]\(\$at\) -0+01e8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01e8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+01ec <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01ec [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+01f0 <[^>]*> lwl \$a0,[03]\(\$at\) -0+01f4 <[^>]*> lwr \$a0,[03]\(\$at\) -0+01f8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01f8 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+01fc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01fc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0200 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0204 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0208 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0208 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+020c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+020c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0210 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0214 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0218 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0218 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+021c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+021c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0220 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0224 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0228 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0228 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+022c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+022c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0230 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0234 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0238 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0238 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+023c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+023c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0240 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0244 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0248 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0248 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+024c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+024c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0250 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0254 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0258 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0258 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+025c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+025c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0260 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0264 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0268 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0268 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+026c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+026c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0270 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0274 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0278 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0278 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+027c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+027c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0280 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0284 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0288 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0288 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+028c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+028c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0290 <[^>]*> lwl \$a0,[03]\(\$at\) -0+0294 <[^>]*> lwr \$a0,[03]\(\$at\) -0+0298 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0298 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+029c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+029c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02a0 <[^>]*> lwl \$a0,[03]\(\$at\) -0+02a4 <[^>]*> lwr \$a0,[03]\(\$at\) -0+02a8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02a8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02ac <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02ac [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+02b0 <[^>]*> lwl \$a0,[03]\(\$at\) -0+02b4 <[^>]*> lwr \$a0,[03]\(\$at\) -0+02b8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02b8 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02bc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02bc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+02c0 <[^>]*> lwl \$a0,[03]\(\$at\) -0+02c4 <[^>]*> lwr \$a0,[03]\(\$at\) -0+02c8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02c8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+02cc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02cc [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+02d0 <[^>]*> lwl \$a0,[03]\(\$at\) -0+02d4 <[^>]*> lwr \$a0,[03]\(\$at\) -... +0+0000 <[^>]*> lwl \$a0,[03]\(\$zero\) +0+0004 <[^>]*> lwr \$a0,[03]\(\$zero\) +0+0008 <[^>]*> lwl \$a0,[14]\(\$zero\) +0+000c <[^>]*> lwr \$a0,[14]\(\$zero\) +0+0010 <[^>]*> li \$at,0x8000 +0+0014 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0018 <[^>]*> lwr \$a0,[03]\(\$at\) +0+001c <[^>]*> lwl \$a0,-3276[58]\(\$zero\) +0+0020 <[^>]*> lwr \$a0,-3276[58]\(\$zero\) +0+0024 <[^>]*> lui \$at,0x1 +0+0028 <[^>]*> lwl \$a0,[03]\(\$at\) +0+002c <[^>]*> lwr \$a0,[03]\(\$at\) +0+0030 <[^>]*> lui \$at,0x1 +0+0034 <[^>]*> ori \$at,\$at,0xa5a5 +0+0038 <[^>]*> lwl \$a0,[03]\(\$at\) +0+003c <[^>]*> lwr \$a0,[03]\(\$at\) +0+0040 <[^>]*> lwl \$a0,[03]\(\$a1\) +0+0044 <[^>]*> lwr \$a0,[03]\(\$a1\) +0+0048 <[^>]*> lwl \$a0,[14]\(\$a1\) +0+004c <[^>]*> lwr \$a0,[-0-9]+\(\$a1\) +0+0050 <[^>]*> lui \$at,[-0-9x]+ +[ ]*50: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0054 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*54: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0058 <[^>]*> lwl \$a0,[03]\(\$at\) +0+005c <[^>]*> lwr \$a0,[03]\(\$at\) +0+0060 <[^>]*> lui \$at,0x0 +[ ]*60: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0064 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*64: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0068 <[^>]*> lwl \$a0,[03]\(\$at\) +0+006c <[^>]*> lwr \$a0,[03]\(\$at\) +0+0070 <[^>]*> addiu \$at,\$gp,0 +[ ]*70: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0074 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0078 <[^>]*> lwr \$a0,[03]\(\$at\) +0+007c <[^>]*> lui \$at,0x0 +[ ]*7c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0080 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*80: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0084 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0088 <[^>]*> lwr \$a0,[03]\(\$at\) +0+008c <[^>]*> addiu \$at,\$gp,0 +[ ]*8c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0090 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0094 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0098 <[^>]*> lui \$at,[-0-9x]+ +[ ]*98: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+009c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*9c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00a0 <[^>]*> lwl \$a0,[03]\(\$at\) +0+00a4 <[^>]*> lwr \$a0,[03]\(\$at\) +0+00a8 <[^>]*> addiu \$at,\$gp,[-0-9]+ +[ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00ac <[^>]*> lwl \$a0,[03]\(\$at\) +0+00b0 <[^>]*> lwr \$a0,[03]\(\$at\) +0+00b4 <[^>]*> lui \$at,0x0 +[ ]*b4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+00b8 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*b8: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00bc <[^>]*> lwl \$a0,[03]\(\$at\) +0+00c0 <[^>]*> lwr \$a0,[03]\(\$at\) +0+00c4 <[^>]*> lui \$at,0x0 +[ ]*c4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00c8 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*c8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00cc <[^>]*> lwl \$a0,[03]\(\$at\) +0+00d0 <[^>]*> lwr \$a0,[03]\(\$at\) +0+00d4 <[^>]*> addiu \$at,\$gp,1 +[ ]*d4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00d8 <[^>]*> lwl \$a0,[03]\(\$at\) +0+00dc <[^>]*> lwr \$a0,[03]\(\$at\) +0+00e0 <[^>]*> lui \$at,0x0 +[ ]*e0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00e4 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*e4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+00e8 <[^>]*> lwl \$a0,[03]\(\$at\) +0+00ec <[^>]*> lwr \$a0,[03]\(\$at\) +0+00f0 <[^>]*> addiu \$at,\$gp,1 +[ ]*f0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00f4 <[^>]*> lwl \$a0,[03]\(\$at\) +0+00f8 <[^>]*> lwr \$a0,[03]\(\$at\) +0+00fc <[^>]*> lui \$at,0x0 +[ ]*fc: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0100 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*100: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0104 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0108 <[^>]*> lwr \$a0,[03]\(\$at\) +0+010c <[^>]*> addiu \$at,\$gp,[-0-9]+ +[ ]*10c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0110 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0114 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0118 <[^>]*> lui \$at,[-0-9x]+ +[ ]*118: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+011c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*11c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0120 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0124 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0128 <[^>]*> lui \$at,[-0-9x]+ +[ ]*128: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+012c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*12c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0130 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0134 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0138 <[^>]*> lui \$at,[-0-9x]+ +[ ]*138: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+013c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*13c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0140 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0144 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0148 <[^>]*> lui \$at,[-0-9x]+ +[ ]*148: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+014c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*14c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0150 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0154 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0158 <[^>]*> lui \$at,[-0-9x]+ +[ ]*158: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+015c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*15c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0160 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0164 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0168 <[^>]*> lui \$at,[-0-9x]+ +[ ]*168: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+016c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*16c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0170 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0174 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0178 <[^>]*> lui \$at,[-0-9x]+ +[ ]*178: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+017c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*17c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0180 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0184 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0188 <[^>]*> lui \$at,0x0 +[ ]*188: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+018c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*18c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0190 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0194 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0198 <[^>]*> lui \$at,0x0 +[ ]*198: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+019c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*19c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01a0 <[^>]*> lwl \$a0,[03]\(\$at\) +0+01a4 <[^>]*> lwr \$a0,[03]\(\$at\) +0+01a8 <[^>]*> lui \$at,0x0 +[ ]*1a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+01ac <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+01b0 <[^>]*> lwl \$a0,[03]\(\$at\) +0+01b4 <[^>]*> lwr \$a0,[03]\(\$at\) +0+01b8 <[^>]*> lui \$at,0x0 +[ ]*1b8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01bc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1bc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01c0 <[^>]*> lwl \$a0,[03]\(\$at\) +0+01c4 <[^>]*> lwr \$a0,[03]\(\$at\) +0+01c8 <[^>]*> lui \$at,0x0 +[ ]*1c8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+01cc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1cc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+01d0 <[^>]*> lwl \$a0,[03]\(\$at\) +0+01d4 <[^>]*> lwr \$a0,[03]\(\$at\) +0+01d8 <[^>]*> lui \$at,0x0 +[ ]*1d8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+01dc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1dc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+01e0 <[^>]*> lwl \$a0,[03]\(\$at\) +0+01e4 <[^>]*> lwr \$a0,[03]\(\$at\) +0+01e8 <[^>]*> lui \$at,0x0 +[ ]*1e8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+01ec <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1ec: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+01f0 <[^>]*> lwl \$a0,[03]\(\$at\) +0+01f4 <[^>]*> lwr \$a0,[03]\(\$at\) +0+01f8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*1f8: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+01fc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1fc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0200 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0204 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0208 <[^>]*> lui \$at,[-0-9x]+ +[ ]*208: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+020c <[^>]*> addiu \$at,\$at,0 +[ ]*20c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0210 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0214 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0218 <[^>]*> lui \$at,[-0-9x]+ +[ ]*218: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+021c <[^>]*> addiu \$at,\$at,0 +[ ]*21c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0220 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0224 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0228 <[^>]*> lui \$at,[-0-9x]+ +[ ]*228: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+022c <[^>]*> addiu \$at,\$at,0 +[ ]*22c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0230 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0234 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0238 <[^>]*> lui \$at,[-0-9x]+ +[ ]*238: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+023c <[^>]*> addiu \$at,\$at,0 +[ ]*23c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0240 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0244 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0248 <[^>]*> lui \$at,[-0-9x]+ +[ ]*248: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+024c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*24c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0250 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0254 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0258 <[^>]*> lui \$at,[-0-9x]+ +[ ]*258: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+025c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*25c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0260 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0264 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0268 <[^>]*> lui \$at,[-0-9x]+ +[ ]*268: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+026c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*26c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0270 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0274 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0278 <[^>]*> lui \$at,[-0-9x]+ +[ ]*278: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+027c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*27c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0280 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0284 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0288 <[^>]*> lui \$at,[-0-9x]+ +[ ]*288: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+028c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*28c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0290 <[^>]*> lwl \$a0,[03]\(\$at\) +0+0294 <[^>]*> lwr \$a0,[03]\(\$at\) +0+0298 <[^>]*> lui \$at,[-0-9x]+ +[ ]*298: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+029c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*29c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02a0 <[^>]*> lwl \$a0,[03]\(\$at\) +0+02a4 <[^>]*> lwr \$a0,[03]\(\$at\) +0+02a8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02ac <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+02b0 <[^>]*> lwl \$a0,[03]\(\$at\) +0+02b4 <[^>]*> lwr \$a0,[03]\(\$at\) +0+02b8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2b8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+02bc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2bc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+02c0 <[^>]*> lwl \$a0,[03]\(\$at\) +0+02c4 <[^>]*> lwr \$a0,[03]\(\$at\) +0+02c8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2c8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+02cc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2cc: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+02d0 <[^>]*> lwl \$a0,[03]\(\$at\) +0+02d4 <[^>]*> lwr \$a0,[03]\(\$at\) + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/ulw.s binutils-2.8/gas/testsuite/gas/mips/ulw.s --- binutils-2.7/gas/testsuite/gas/mips/ulw.s Thu Jul 4 12:16:00 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ulw.s Wed Apr 30 12:54:40 1997 @@ -60,3 +60,7 @@ ulw $4,small_external_common+0x1a5a5 ulw $4,big_local_common+0x1a5a5 ulw $4,small_local_common+0x1a5a5 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/usd.d binutils-2.8/gas/testsuite/gas/mips/usd.d --- binutils-2.7/gas/testsuite/gas/mips/usd.d Thu Jul 4 12:16:00 1996 +++ binutils-2.8/gas/testsuite/gas/mips/usd.d Wed Apr 30 12:54:40 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS usd #as: -mips3 @@ -7,264 +7,264 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> sdl \$a0,[07]\(\$zero\) -0+0004 <[^>]*> sdr \$a0,[07]\(\$zero\) -0+0008 <[^>]*> sdl \$a0,[18]\(\$zero\) -0+000c <[^>]*> sdr \$a0,[18]\(\$zero\) -0+0010 <[^>]*> li \$at,0x8000 -0+0014 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0018 <[^>]*> sdr \$a0,[07]\(\$at\) -0+001c <[^>]*> sdl \$a0,-3276[18]\(\$zero\) -0+0020 <[^>]*> sdr \$a0,-3276[18]\(\$zero\) -0+0024 <[^>]*> lui \$at,0x1 -0+0028 <[^>]*> sdl \$a0,[07]\(\$at\) -0+002c <[^>]*> sdr \$a0,[07]\(\$at\) -0+0030 <[^>]*> lui \$at,0x1 -0+0034 <[^>]*> ori \$at,\$at,0xa5a5 -0+0038 <[^>]*> sdl \$a0,[07]\(\$at\) -0+003c <[^>]*> sdr \$a0,[07]\(\$at\) -0+0040 <[^>]*> sdl \$a0,[07]\(\$a1\) -0+0044 <[^>]*> sdr \$a0,[07]\(\$a1\) -0+0048 <[^>]*> sdl \$a0,[18]\(\$a1\) -0+004c <[^>]*> sdr \$a0,[-0-9]+\(\$a1\) -0+0050 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0050 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0054 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0054 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0058 <[^>]*> sdl \$a0,[07]\(\$at\) -0+005c <[^>]*> sdr \$a0,[07]\(\$at\) -0+0060 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0060 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0064 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0064 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0068 <[^>]*> sdl \$a0,[07]\(\$at\) -0+006c <[^>]*> sdr \$a0,[07]\(\$at\) -0+0070 <[^>]*> daddiu \$at,\$gp,0 -[ ]*RELOC: 0+0070 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0074 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0078 <[^>]*> sdr \$a0,[07]\(\$at\) -0+007c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+007c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0080 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0080 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0084 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0088 <[^>]*> sdr \$a0,[07]\(\$at\) -0+008c <[^>]*> daddiu \$at,\$gp,0 -[ ]*RELOC: 0+008c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0090 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0094 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0098 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0098 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+009c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+009c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00a0 <[^>]*> sdl \$a0,[07]\(\$at\) -0+00a4 <[^>]*> sdr \$a0,[07]\(\$at\) -0+00a8 <[^>]*> daddiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+00a8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00ac <[^>]*> sdl \$a0,[07]\(\$at\) -0+00b0 <[^>]*> sdr \$a0,[07]\(\$at\) -0+00b4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00b4 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00b8 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00b8 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00bc <[^>]*> sdl \$a0,[07]\(\$at\) -0+00c0 <[^>]*> sdr \$a0,[07]\(\$at\) -0+00c4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00c4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00c8 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00c8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00cc <[^>]*> sdl \$a0,[07]\(\$at\) -0+00d0 <[^>]*> sdr \$a0,[07]\(\$at\) -0+00d4 <[^>]*> daddiu \$at,\$gp,1 -[ ]*RELOC: 0+00d4 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00d8 <[^>]*> sdl \$a0,[07]\(\$at\) -0+00dc <[^>]*> sdr \$a0,[07]\(\$at\) -0+00e0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00e0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00e4 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00e4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+00e8 <[^>]*> sdl \$a0,[07]\(\$at\) -0+00ec <[^>]*> sdr \$a0,[07]\(\$at\) -0+00f0 <[^>]*> daddiu \$at,\$gp,1 -[ ]*RELOC: 0+00f0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00f4 <[^>]*> sdl \$a0,[07]\(\$at\) -0+00f8 <[^>]*> sdr \$a0,[07]\(\$at\) -0+00fc <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00fc [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0100 <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0100 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0104 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0108 <[^>]*> sdr \$a0,[07]\(\$at\) -0+010c <[^>]*> daddiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+010c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0110 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0114 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0118 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0118 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+011c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+011c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0120 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0124 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0128 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0128 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+012c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+012c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0130 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0134 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0138 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0138 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+013c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+013c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0140 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0144 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0148 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0148 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+014c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+014c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0150 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0154 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0158 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0158 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+015c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+015c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0160 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0164 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0168 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0168 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+016c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+016c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0170 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0174 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0178 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0178 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+017c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+017c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0180 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0184 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0188 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0188 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+018c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+018c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0190 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0194 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0198 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0198 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+019c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+019c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01a0 <[^>]*> sdl \$a0,[07]\(\$at\) -0+01a4 <[^>]*> sdr \$a0,[07]\(\$at\) -0+01a8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01a8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+01ac <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01ac [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+01b0 <[^>]*> sdl \$a0,[07]\(\$at\) -0+01b4 <[^>]*> sdr \$a0,[07]\(\$at\) -0+01b8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01b8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01bc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01bc [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01c0 <[^>]*> sdl \$a0,[07]\(\$at\) -0+01c4 <[^>]*> sdr \$a0,[07]\(\$at\) -0+01c8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01c8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+01cc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01cc [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+01d0 <[^>]*> sdl \$a0,[07]\(\$at\) -0+01d4 <[^>]*> sdr \$a0,[07]\(\$at\) -0+01d8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01d8 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+01dc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01dc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+01e0 <[^>]*> sdl \$a0,[07]\(\$at\) -0+01e4 <[^>]*> sdr \$a0,[07]\(\$at\) -0+01e8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01e8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+01ec <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01ec [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+01f0 <[^>]*> sdl \$a0,[07]\(\$at\) -0+01f4 <[^>]*> sdr \$a0,[07]\(\$at\) -0+01f8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01f8 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+01fc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01fc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0200 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0204 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0208 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0208 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+020c <[^>]*> daddiu \$at,\$at,0 -[ ]*RELOC: 0+020c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0210 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0214 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0218 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0218 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+021c <[^>]*> daddiu \$at,\$at,0 -[ ]*RELOC: 0+021c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0220 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0224 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0228 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0228 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+022c <[^>]*> daddiu \$at,\$at,0 -[ ]*RELOC: 0+022c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0230 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0234 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0238 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0238 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+023c <[^>]*> daddiu \$at,\$at,0 -[ ]*RELOC: 0+023c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0240 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0244 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0248 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0248 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+024c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+024c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0250 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0254 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0258 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0258 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+025c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+025c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0260 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0264 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0268 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0268 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+026c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+026c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0270 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0274 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0278 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0278 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+027c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+027c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0280 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0284 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0288 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0288 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+028c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+028c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0290 <[^>]*> sdl \$a0,[07]\(\$at\) -0+0294 <[^>]*> sdr \$a0,[07]\(\$at\) -0+0298 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0298 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+029c <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+029c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02a0 <[^>]*> sdl \$a0,[07]\(\$at\) -0+02a4 <[^>]*> sdr \$a0,[07]\(\$at\) -0+02a8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02a8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02ac <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02ac [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+02b0 <[^>]*> sdl \$a0,[07]\(\$at\) -0+02b4 <[^>]*> sdr \$a0,[07]\(\$at\) -0+02b8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02b8 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02bc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02bc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+02c0 <[^>]*> sdl \$a0,[07]\(\$at\) -0+02c4 <[^>]*> sdr \$a0,[07]\(\$at\) -0+02c8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02c8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+02cc <[^>]*> daddiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02cc [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+02d0 <[^>]*> sdl \$a0,[07]\(\$at\) -0+02d4 <[^>]*> sdr \$a0,[07]\(\$at\) -... +0+0000 <[^>]*> sdl \$a0,[07]\(\$zero\) +0+0004 <[^>]*> sdr \$a0,[07]\(\$zero\) +0+0008 <[^>]*> sdl \$a0,[18]\(\$zero\) +0+000c <[^>]*> sdr \$a0,[18]\(\$zero\) +0+0010 <[^>]*> li \$at,0x8000 +0+0014 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0018 <[^>]*> sdr \$a0,[07]\(\$at\) +0+001c <[^>]*> sdl \$a0,-3276[18]\(\$zero\) +0+0020 <[^>]*> sdr \$a0,-3276[18]\(\$zero\) +0+0024 <[^>]*> lui \$at,0x1 +0+0028 <[^>]*> sdl \$a0,[07]\(\$at\) +0+002c <[^>]*> sdr \$a0,[07]\(\$at\) +0+0030 <[^>]*> lui \$at,0x1 +0+0034 <[^>]*> ori \$at,\$at,0xa5a5 +0+0038 <[^>]*> sdl \$a0,[07]\(\$at\) +0+003c <[^>]*> sdr \$a0,[07]\(\$at\) +0+0040 <[^>]*> sdl \$a0,[07]\(\$a1\) +0+0044 <[^>]*> sdr \$a0,[07]\(\$a1\) +0+0048 <[^>]*> sdl \$a0,[18]\(\$a1\) +0+004c <[^>]*> sdr \$a0,[-0-9]+\(\$a1\) +0+0050 <[^>]*> lui \$at,[-0-9x]+ +[ ]*50: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0054 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*54: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0058 <[^>]*> sdl \$a0,[07]\(\$at\) +0+005c <[^>]*> sdr \$a0,[07]\(\$at\) +0+0060 <[^>]*> lui \$at,[-0-9x]+ +[ ]*60: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0064 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*64: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0068 <[^>]*> sdl \$a0,[07]\(\$at\) +0+006c <[^>]*> sdr \$a0,[07]\(\$at\) +0+0070 <[^>]*> daddiu \$at,\$gp,0 +[ ]*70: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0074 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0078 <[^>]*> sdr \$a0,[07]\(\$at\) +0+007c <[^>]*> lui \$at,0x0 +[ ]*7c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0080 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*80: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0084 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0088 <[^>]*> sdr \$a0,[07]\(\$at\) +0+008c <[^>]*> daddiu \$at,\$gp,0 +[ ]*8c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0090 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0094 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0098 <[^>]*> lui \$at,[-0-9x]+ +[ ]*98: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+009c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*9c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00a0 <[^>]*> sdl \$a0,[07]\(\$at\) +0+00a4 <[^>]*> sdr \$a0,[07]\(\$at\) +0+00a8 <[^>]*> daddiu \$at,\$gp,[-0-9]+ +[ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00ac <[^>]*> sdl \$a0,[07]\(\$at\) +0+00b0 <[^>]*> sdr \$a0,[07]\(\$at\) +0+00b4 <[^>]*> lui \$at,0x0 +[ ]*b4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+00b8 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*b8: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00bc <[^>]*> sdl \$a0,[07]\(\$at\) +0+00c0 <[^>]*> sdr \$a0,[07]\(\$at\) +0+00c4 <[^>]*> lui \$at,0x0 +[ ]*c4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00c8 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*c8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00cc <[^>]*> sdl \$a0,[07]\(\$at\) +0+00d0 <[^>]*> sdr \$a0,[07]\(\$at\) +0+00d4 <[^>]*> daddiu \$at,\$gp,1 +[ ]*d4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00d8 <[^>]*> sdl \$a0,[07]\(\$at\) +0+00dc <[^>]*> sdr \$a0,[07]\(\$at\) +0+00e0 <[^>]*> lui \$at,0x0 +[ ]*e0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00e4 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*e4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+00e8 <[^>]*> sdl \$a0,[07]\(\$at\) +0+00ec <[^>]*> sdr \$a0,[07]\(\$at\) +0+00f0 <[^>]*> daddiu \$at,\$gp,1 +[ ]*f0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00f4 <[^>]*> sdl \$a0,[07]\(\$at\) +0+00f8 <[^>]*> sdr \$a0,[07]\(\$at\) +0+00fc <[^>]*> lui \$at,0x0 +[ ]*fc: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0100 <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*100: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0104 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0108 <[^>]*> sdr \$a0,[07]\(\$at\) +0+010c <[^>]*> daddiu \$at,\$gp,[-0-9]+ +[ ]*10c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0110 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0114 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0118 <[^>]*> lui \$at,[-0-9x]+ +[ ]*118: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+011c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*11c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0120 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0124 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0128 <[^>]*> lui \$at,[-0-9x]+ +[ ]*128: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+012c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*12c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0130 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0134 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0138 <[^>]*> lui \$at,[-0-9x]+ +[ ]*138: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+013c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*13c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0140 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0144 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0148 <[^>]*> lui \$at,[-0-9x]+ +[ ]*148: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+014c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*14c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0150 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0154 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0158 <[^>]*> lui \$at,[-0-9x]+ +[ ]*158: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+015c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*15c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0160 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0164 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0168 <[^>]*> lui \$at,[-0-9x]+ +[ ]*168: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+016c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*16c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0170 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0174 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0178 <[^>]*> lui \$at,[-0-9x]+ +[ ]*178: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+017c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*17c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0180 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0184 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0188 <[^>]*> lui \$at,0x0 +[ ]*188: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+018c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*18c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0190 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0194 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0198 <[^>]*> lui \$at,0x0 +[ ]*198: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+019c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*19c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01a0 <[^>]*> sdl \$a0,[07]\(\$at\) +0+01a4 <[^>]*> sdr \$a0,[07]\(\$at\) +0+01a8 <[^>]*> lui \$at,0x0 +[ ]*1a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+01ac <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+01b0 <[^>]*> sdl \$a0,[07]\(\$at\) +0+01b4 <[^>]*> sdr \$a0,[07]\(\$at\) +0+01b8 <[^>]*> lui \$at,0x0 +[ ]*1b8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01bc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1bc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01c0 <[^>]*> sdl \$a0,[07]\(\$at\) +0+01c4 <[^>]*> sdr \$a0,[07]\(\$at\) +0+01c8 <[^>]*> lui \$at,0x0 +[ ]*1c8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+01cc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1cc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+01d0 <[^>]*> sdl \$a0,[07]\(\$at\) +0+01d4 <[^>]*> sdr \$a0,[07]\(\$at\) +0+01d8 <[^>]*> lui \$at,0x0 +[ ]*1d8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+01dc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1dc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+01e0 <[^>]*> sdl \$a0,[07]\(\$at\) +0+01e4 <[^>]*> sdr \$a0,[07]\(\$at\) +0+01e8 <[^>]*> lui \$at,0x0 +[ ]*1e8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+01ec <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1ec: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+01f0 <[^>]*> sdl \$a0,[07]\(\$at\) +0+01f4 <[^>]*> sdr \$a0,[07]\(\$at\) +0+01f8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*1f8: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+01fc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*1fc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0200 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0204 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0208 <[^>]*> lui \$at,[-0-9x]+ +[ ]*208: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+020c <[^>]*> daddiu \$at,\$at,0 +[ ]*20c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0210 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0214 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0218 <[^>]*> lui \$at,[-0-9x]+ +[ ]*218: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+021c <[^>]*> daddiu \$at,\$at,0 +[ ]*21c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0220 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0224 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0228 <[^>]*> lui \$at,[-0-9x]+ +[ ]*228: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+022c <[^>]*> daddiu \$at,\$at,0 +[ ]*22c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0230 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0234 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0238 <[^>]*> lui \$at,[-0-9x]+ +[ ]*238: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+023c <[^>]*> daddiu \$at,\$at,0 +[ ]*23c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0240 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0244 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0248 <[^>]*> lui \$at,[-0-9x]+ +[ ]*248: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+024c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*24c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0250 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0254 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0258 <[^>]*> lui \$at,[-0-9x]+ +[ ]*258: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+025c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*25c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0260 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0264 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0268 <[^>]*> lui \$at,[-0-9x]+ +[ ]*268: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+026c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*26c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0270 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0274 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0278 <[^>]*> lui \$at,[-0-9x]+ +[ ]*278: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+027c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*27c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0280 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0284 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0288 <[^>]*> lui \$at,[-0-9x]+ +[ ]*288: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+028c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*28c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0290 <[^>]*> sdl \$a0,[07]\(\$at\) +0+0294 <[^>]*> sdr \$a0,[07]\(\$at\) +0+0298 <[^>]*> lui \$at,[-0-9x]+ +[ ]*298: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+029c <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*29c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02a0 <[^>]*> sdl \$a0,[07]\(\$at\) +0+02a4 <[^>]*> sdr \$a0,[07]\(\$at\) +0+02a8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02ac <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*2ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+02b0 <[^>]*> sdl \$a0,[07]\(\$at\) +0+02b4 <[^>]*> sdr \$a0,[07]\(\$at\) +0+02b8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2b8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+02bc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*2bc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+02c0 <[^>]*> sdl \$a0,[07]\(\$at\) +0+02c4 <[^>]*> sdr \$a0,[07]\(\$at\) +0+02c8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2c8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+02cc <[^>]*> daddiu \$at,\$at,[-0-9]+ +[ ]*2cc: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+02d0 <[^>]*> sdl \$a0,[07]\(\$at\) +0+02d4 <[^>]*> sdr \$a0,[07]\(\$at\) + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/usd.s binutils-2.8/gas/testsuite/gas/mips/usd.s --- binutils-2.7/gas/testsuite/gas/mips/usd.s Thu Jul 4 12:16:00 1996 +++ binutils-2.8/gas/testsuite/gas/mips/usd.s Wed Apr 30 12:54:40 1997 @@ -60,3 +60,7 @@ usd $4,small_external_common+0x1a5a5 usd $4,big_local_common+0x1a5a5 usd $4,small_local_common+0x1a5a5 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/ush.d binutils-2.8/gas/testsuite/gas/mips/ush.d --- binutils-2.7/gas/testsuite/gas/mips/ush.d Thu Jul 4 12:16:01 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ush.d Wed Apr 30 12:54:41 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS ush #as: -mips1 @@ -7,449 +7,449 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> sb \$a0,[01]\(\$zero\) -0+0004 <[^>]*> srl \$at,\$a0,0x8 -0+0008 <[^>]*> sb \$at,[01]\(\$zero\) -0+000c <[^>]*> sb \$a0,[12]\(\$zero\) -0+0010 <[^>]*> srl \$at,\$a0,0x8 -0+0014 <[^>]*> sb \$at,[12]\(\$zero\) -0+0018 <[^>]*> li \$at,0x8000 -0+001c <[^>]*> sb \$a0,[01]\(\$at\) -0+0020 <[^>]*> srl \$a0,\$a0,0x8 -0+0024 <[^>]*> sb \$a0,[01]\(\$at\) -0+0028 <[^>]*> lbu \$at,[01]\(\$at\) -0+002c <[^>]*> sll \$a0,\$a0,0x8 -0+0030 <[^>]*> or \$a0,\$a0,\$at -0+0034 <[^>]*> sb \$a0,-3276[78]\(\$zero\) -0+0038 <[^>]*> srl \$at,\$a0,0x8 -0+003c <[^>]*> sb \$at,-3276[78]\(\$zero\) -0+0040 <[^>]*> lui \$at,0x1 -0+0044 <[^>]*> sb \$a0,[01]\(\$at\) -0+0048 <[^>]*> srl \$a0,\$a0,0x8 -0+004c <[^>]*> sb \$a0,[01]\(\$at\) -0+0050 <[^>]*> lbu \$at,[01]\(\$at\) -0+0054 <[^>]*> sll \$a0,\$a0,0x8 -0+0058 <[^>]*> or \$a0,\$a0,\$at -0+005c <[^>]*> lui \$at,0x1 -0+0060 <[^>]*> ori \$at,\$at,0xa5a5 -0+0064 <[^>]*> sb \$a0,[01]\(\$at\) -0+0068 <[^>]*> srl \$a0,\$a0,0x8 -0+006c <[^>]*> sb \$a0,[01]\(\$at\) -0+0070 <[^>]*> lbu \$at,[01]\(\$at\) -0+0074 <[^>]*> sll \$a0,\$a0,0x8 -0+0078 <[^>]*> or \$a0,\$a0,\$at -0+007c <[^>]*> sb \$a0,[01]\(\$a1\) -0+0080 <[^>]*> srl \$at,\$a0,0x8 -0+0084 <[^>]*> sb \$at,[01]\(\$a1\) -0+0088 <[^>]*> sb \$a0,[12]\(\$a1\) -0+008c <[^>]*> srl \$at,\$a0,0x8 -0+0090 <[^>]*> sb \$at,[12]\(\$a1\) -0+0094 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0094 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0098 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0098 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+009c <[^>]*> sb \$a0,[01]\(\$at\) -0+00a0 <[^>]*> srl \$a0,\$a0,0x8 -0+00a4 <[^>]*> sb \$a0,[01]\(\$at\) -0+00a8 <[^>]*> lbu \$at,[01]\(\$at\) -0+00ac <[^>]*> sll \$a0,\$a0,0x8 -0+00b0 <[^>]*> or \$a0,\$a0,\$at -0+00b4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00b4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00b8 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00b8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00bc <[^>]*> sb \$a0,[01]\(\$at\) -0+00c0 <[^>]*> srl \$a0,\$a0,0x8 -0+00c4 <[^>]*> sb \$a0,[01]\(\$at\) -0+00c8 <[^>]*> lbu \$at,[01]\(\$at\) -0+00cc <[^>]*> sll \$a0,\$a0,0x8 -0+00d0 <[^>]*> or \$a0,\$a0,\$at -0+00d4 <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+00d4 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00d8 <[^>]*> sb \$a0,[01]\(\$at\) -0+00dc <[^>]*> srl \$a0,\$a0,0x8 -0+00e0 <[^>]*> sb \$a0,[01]\(\$at\) -0+00e4 <[^>]*> lbu \$at,[01]\(\$at\) -0+00e8 <[^>]*> sll \$a0,\$a0,0x8 -0+00ec <[^>]*> or \$a0,\$a0,\$at -0+00f0 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+00f0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00f4 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00f4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+00f8 <[^>]*> sb \$a0,[01]\(\$at\) -0+00fc <[^>]*> srl \$a0,\$a0,0x8 -0+0100 <[^>]*> sb \$a0,[01]\(\$at\) -0+0104 <[^>]*> lbu \$at,[01]\(\$at\) -0+0108 <[^>]*> sll \$a0,\$a0,0x8 -0+010c <[^>]*> or \$a0,\$a0,\$at -0+0110 <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+0110 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0114 <[^>]*> sb \$a0,[01]\(\$at\) -0+0118 <[^>]*> srl \$a0,\$a0,0x8 -0+011c <[^>]*> sb \$a0,[01]\(\$at\) -0+0120 <[^>]*> lbu \$at,[01]\(\$at\) -0+0124 <[^>]*> sll \$a0,\$a0,0x8 -0+0128 <[^>]*> or \$a0,\$a0,\$at -0+012c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+012c [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0130 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0130 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0134 <[^>]*> sb \$a0,[01]\(\$at\) -0+0138 <[^>]*> srl \$a0,\$a0,0x8 -0+013c <[^>]*> sb \$a0,[01]\(\$at\) -0+0140 <[^>]*> lbu \$at,[01]\(\$at\) -0+0144 <[^>]*> sll \$a0,\$a0,0x8 -0+0148 <[^>]*> or \$a0,\$a0,\$at -0+014c <[^>]*> addiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+014c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0150 <[^>]*> sb \$a0,[01]\(\$at\) -0+0154 <[^>]*> srl \$a0,\$a0,0x8 -0+0158 <[^>]*> sb \$a0,[01]\(\$at\) -0+015c <[^>]*> lbu \$at,[01]\(\$at\) -0+0160 <[^>]*> sll \$a0,\$a0,0x8 -0+0164 <[^>]*> or \$a0,\$a0,\$at -0+0168 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0168 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+016c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+016c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0170 <[^>]*> sb \$a0,[01]\(\$at\) -0+0174 <[^>]*> srl \$a0,\$a0,0x8 -0+0178 <[^>]*> sb \$a0,[01]\(\$at\) -0+017c <[^>]*> lbu \$at,[01]\(\$at\) -0+0180 <[^>]*> sll \$a0,\$a0,0x8 -0+0184 <[^>]*> or \$a0,\$a0,\$at -0+0188 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0188 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+018c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+018c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0190 <[^>]*> sb \$a0,[01]\(\$at\) -0+0194 <[^>]*> srl \$a0,\$a0,0x8 -0+0198 <[^>]*> sb \$a0,[01]\(\$at\) -0+019c <[^>]*> lbu \$at,[01]\(\$at\) -0+01a0 <[^>]*> sll \$a0,\$a0,0x8 -0+01a4 <[^>]*> or \$a0,\$a0,\$at -0+01a8 <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+01a8 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+01ac <[^>]*> sb \$a0,[01]\(\$at\) -0+01b0 <[^>]*> srl \$a0,\$a0,0x8 -0+01b4 <[^>]*> sb \$a0,[01]\(\$at\) -0+01b8 <[^>]*> lbu \$at,[01]\(\$at\) -0+01bc <[^>]*> sll \$a0,\$a0,0x8 -0+01c0 <[^>]*> or \$a0,\$a0,\$at -0+01c4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01c4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01c8 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01c8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01cc <[^>]*> sb \$a0,[01]\(\$at\) -0+01d0 <[^>]*> srl \$a0,\$a0,0x8 -0+01d4 <[^>]*> sb \$a0,[01]\(\$at\) -0+01d8 <[^>]*> lbu \$at,[01]\(\$at\) -0+01dc <[^>]*> sll \$a0,\$a0,0x8 -0+01e0 <[^>]*> or \$a0,\$a0,\$at -0+01e4 <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+01e4 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+01e8 <[^>]*> sb \$a0,[01]\(\$at\) -0+01ec <[^>]*> srl \$a0,\$a0,0x8 -0+01f0 <[^>]*> sb \$a0,[01]\(\$at\) -0+01f4 <[^>]*> lbu \$at,[01]\(\$at\) -0+01f8 <[^>]*> sll \$a0,\$a0,0x8 -0+01fc <[^>]*> or \$a0,\$a0,\$at -0+0200 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0200 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0204 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0204 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0208 <[^>]*> sb \$a0,[01]\(\$at\) -0+020c <[^>]*> srl \$a0,\$a0,0x8 -0+0210 <[^>]*> sb \$a0,[01]\(\$at\) -0+0214 <[^>]*> lbu \$at,[01]\(\$at\) -0+0218 <[^>]*> sll \$a0,\$a0,0x8 -0+021c <[^>]*> or \$a0,\$a0,\$at -0+0220 <[^>]*> addiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+0220 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0224 <[^>]*> sb \$a0,[01]\(\$at\) -0+0228 <[^>]*> srl \$a0,\$a0,0x8 -0+022c <[^>]*> sb \$a0,[01]\(\$at\) -0+0230 <[^>]*> lbu \$at,[01]\(\$at\) -0+0234 <[^>]*> sll \$a0,\$a0,0x8 -0+0238 <[^>]*> or \$a0,\$a0,\$at -0+023c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+023c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0240 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0240 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0244 <[^>]*> sb \$a0,[01]\(\$at\) -0+0248 <[^>]*> srl \$a0,\$a0,0x8 -0+024c <[^>]*> sb \$a0,[01]\(\$at\) -0+0250 <[^>]*> lbu \$at,[01]\(\$at\) -0+0254 <[^>]*> sll \$a0,\$a0,0x8 -0+0258 <[^>]*> or \$a0,\$a0,\$at -0+025c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+025c [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0260 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0260 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0264 <[^>]*> sb \$a0,[01]\(\$at\) -0+0268 <[^>]*> srl \$a0,\$a0,0x8 -0+026c <[^>]*> sb \$a0,[01]\(\$at\) -0+0270 <[^>]*> lbu \$at,[01]\(\$at\) -0+0274 <[^>]*> sll \$a0,\$a0,0x8 -0+0278 <[^>]*> or \$a0,\$a0,\$at -0+027c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+027c [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0280 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0280 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0284 <[^>]*> sb \$a0,[01]\(\$at\) -0+0288 <[^>]*> srl \$a0,\$a0,0x8 -0+028c <[^>]*> sb \$a0,[01]\(\$at\) -0+0290 <[^>]*> lbu \$at,[01]\(\$at\) -0+0294 <[^>]*> sll \$a0,\$a0,0x8 -0+0298 <[^>]*> or \$a0,\$a0,\$at -0+029c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+029c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+02a0 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02a0 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02a4 <[^>]*> sb \$a0,[01]\(\$at\) -0+02a8 <[^>]*> srl \$a0,\$a0,0x8 -0+02ac <[^>]*> sb \$a0,[01]\(\$at\) -0+02b0 <[^>]*> lbu \$at,[01]\(\$at\) -0+02b4 <[^>]*> sll \$a0,\$a0,0x8 -0+02b8 <[^>]*> or \$a0,\$a0,\$at -0+02bc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02bc [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02c0 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02c0 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+02c4 <[^>]*> sb \$a0,[01]\(\$at\) -0+02c8 <[^>]*> srl \$a0,\$a0,0x8 -0+02cc <[^>]*> sb \$a0,[01]\(\$at\) -0+02d0 <[^>]*> lbu \$at,[01]\(\$at\) -0+02d4 <[^>]*> sll \$a0,\$a0,0x8 -0+02d8 <[^>]*> or \$a0,\$a0,\$at -0+02dc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02dc [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02e0 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02e0 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+02e4 <[^>]*> sb \$a0,[01]\(\$at\) -0+02e8 <[^>]*> srl \$a0,\$a0,0x8 -0+02ec <[^>]*> sb \$a0,[01]\(\$at\) -0+02f0 <[^>]*> lbu \$at,[01]\(\$at\) -0+02f4 <[^>]*> sll \$a0,\$a0,0x8 -0+02f8 <[^>]*> or \$a0,\$a0,\$at -0+02fc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02fc [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+0300 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0300 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0304 <[^>]*> sb \$a0,[01]\(\$at\) -0+0308 <[^>]*> srl \$a0,\$a0,0x8 -0+030c <[^>]*> sb \$a0,[01]\(\$at\) -0+0310 <[^>]*> lbu \$at,[01]\(\$at\) -0+0314 <[^>]*> sll \$a0,\$a0,0x8 -0+0318 <[^>]*> or \$a0,\$a0,\$at -0+031c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+031c [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0320 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0320 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0324 <[^>]*> sb \$a0,[01]\(\$at\) -0+0328 <[^>]*> srl \$a0,\$a0,0x8 -0+032c <[^>]*> sb \$a0,[01]\(\$at\) -0+0330 <[^>]*> lbu \$at,[01]\(\$at\) -0+0334 <[^>]*> sll \$a0,\$a0,0x8 -0+0338 <[^>]*> or \$a0,\$a0,\$at -0+033c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+033c [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0340 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0340 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0344 <[^>]*> sb \$a0,[01]\(\$at\) -0+0348 <[^>]*> srl \$a0,\$a0,0x8 -0+034c <[^>]*> sb \$a0,[01]\(\$at\) -0+0350 <[^>]*> lbu \$at,[01]\(\$at\) -0+0354 <[^>]*> sll \$a0,\$a0,0x8 -0+0358 <[^>]*> or \$a0,\$a0,\$at -0+035c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+035c [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0360 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0360 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0364 <[^>]*> sb \$a0,[01]\(\$at\) -0+0368 <[^>]*> srl \$a0,\$a0,0x8 -0+036c <[^>]*> sb \$a0,[01]\(\$at\) -0+0370 <[^>]*> lbu \$at,[01]\(\$at\) -0+0374 <[^>]*> sll \$a0,\$a0,0x8 -0+0378 <[^>]*> or \$a0,\$a0,\$at -0+037c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+037c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0380 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0380 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0384 <[^>]*> sb \$a0,[01]\(\$at\) -0+0388 <[^>]*> srl \$a0,\$a0,0x8 -0+038c <[^>]*> sb \$a0,[01]\(\$at\) -0+0390 <[^>]*> lbu \$at,[01]\(\$at\) -0+0394 <[^>]*> sll \$a0,\$a0,0x8 -0+0398 <[^>]*> or \$a0,\$a0,\$at -0+039c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+039c [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+03a0 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+03a0 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+03a4 <[^>]*> sb \$a0,[01]\(\$at\) -0+03a8 <[^>]*> srl \$a0,\$a0,0x8 -0+03ac <[^>]*> sb \$a0,[01]\(\$at\) -0+03b0 <[^>]*> lbu \$at,[01]\(\$at\) -0+03b4 <[^>]*> sll \$a0,\$a0,0x8 -0+03b8 <[^>]*> or \$a0,\$a0,\$at -0+03bc <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+03bc [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+03c0 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+03c0 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+03c4 <[^>]*> sb \$a0,[01]\(\$at\) -0+03c8 <[^>]*> srl \$a0,\$a0,0x8 -0+03cc <[^>]*> sb \$a0,[01]\(\$at\) -0+03d0 <[^>]*> lbu \$at,[01]\(\$at\) -0+03d4 <[^>]*> sll \$a0,\$a0,0x8 -0+03d8 <[^>]*> or \$a0,\$a0,\$at -0+03dc <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+03dc [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+03e0 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+03e0 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+03e4 <[^>]*> sb \$a0,[01]\(\$at\) -0+03e8 <[^>]*> srl \$a0,\$a0,0x8 -0+03ec <[^>]*> sb \$a0,[01]\(\$at\) -0+03f0 <[^>]*> lbu \$at,[01]\(\$at\) -0+03f4 <[^>]*> sll \$a0,\$a0,0x8 -0+03f8 <[^>]*> or \$a0,\$a0,\$at -0+03fc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+03fc [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0400 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0400 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0404 <[^>]*> sb \$a0,[01]\(\$at\) -0+0408 <[^>]*> srl \$a0,\$a0,0x8 -0+040c <[^>]*> sb \$a0,[01]\(\$at\) -0+0410 <[^>]*> lbu \$at,[01]\(\$at\) -0+0414 <[^>]*> sll \$a0,\$a0,0x8 -0+0418 <[^>]*> or \$a0,\$a0,\$at -0+041c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+041c [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0420 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0420 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0424 <[^>]*> sb \$a0,[01]\(\$at\) -0+0428 <[^>]*> srl \$a0,\$a0,0x8 -0+042c <[^>]*> sb \$a0,[01]\(\$at\) -0+0430 <[^>]*> lbu \$at,[01]\(\$at\) -0+0434 <[^>]*> sll \$a0,\$a0,0x8 -0+0438 <[^>]*> or \$a0,\$a0,\$at -0+043c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+043c [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0440 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0440 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0444 <[^>]*> sb \$a0,[01]\(\$at\) -0+0448 <[^>]*> srl \$a0,\$a0,0x8 -0+044c <[^>]*> sb \$a0,[01]\(\$at\) -0+0450 <[^>]*> lbu \$at,[01]\(\$at\) -0+0454 <[^>]*> sll \$a0,\$a0,0x8 -0+0458 <[^>]*> or \$a0,\$a0,\$at -0+045c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+045c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0460 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0460 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0464 <[^>]*> sb \$a0,[01]\(\$at\) -0+0468 <[^>]*> srl \$a0,\$a0,0x8 -0+046c <[^>]*> sb \$a0,[01]\(\$at\) -0+0470 <[^>]*> lbu \$at,[01]\(\$at\) -0+0474 <[^>]*> sll \$a0,\$a0,0x8 -0+0478 <[^>]*> or \$a0,\$a0,\$at -0+047c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+047c [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0480 <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+0480 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0484 <[^>]*> sb \$a0,[01]\(\$at\) -0+0488 <[^>]*> srl \$a0,\$a0,0x8 -0+048c <[^>]*> sb \$a0,[01]\(\$at\) -0+0490 <[^>]*> lbu \$at,[01]\(\$at\) -0+0494 <[^>]*> sll \$a0,\$a0,0x8 -0+0498 <[^>]*> or \$a0,\$a0,\$at -0+049c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+049c [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+04a0 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+04a0 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+04a4 <[^>]*> sb \$a0,[01]\(\$at\) -0+04a8 <[^>]*> srl \$a0,\$a0,0x8 -0+04ac <[^>]*> sb \$a0,[01]\(\$at\) -0+04b0 <[^>]*> lbu \$at,[01]\(\$at\) -0+04b4 <[^>]*> sll \$a0,\$a0,0x8 -0+04b8 <[^>]*> or \$a0,\$a0,\$at -0+04bc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+04bc [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+04c0 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+04c0 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+04c4 <[^>]*> sb \$a0,[01]\(\$at\) -0+04c8 <[^>]*> srl \$a0,\$a0,0x8 -0+04cc <[^>]*> sb \$a0,[01]\(\$at\) -0+04d0 <[^>]*> lbu \$at,[01]\(\$at\) -0+04d4 <[^>]*> sll \$a0,\$a0,0x8 -0+04d8 <[^>]*> or \$a0,\$a0,\$at -0+04dc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+04dc [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+04e0 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+04e0 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+04e4 <[^>]*> sb \$a0,[01]\(\$at\) -0+04e8 <[^>]*> srl \$a0,\$a0,0x8 -0+04ec <[^>]*> sb \$a0,[01]\(\$at\) -0+04f0 <[^>]*> lbu \$at,[01]\(\$at\) -0+04f4 <[^>]*> sll \$a0,\$a0,0x8 -0+04f8 <[^>]*> or \$a0,\$a0,\$at -0+04fc <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+04fc [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0500 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0500 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0504 <[^>]*> sb \$a0,[01]\(\$at\) -0+0508 <[^>]*> srl \$a0,\$a0,0x8 -0+050c <[^>]*> sb \$a0,[01]\(\$at\) -0+0510 <[^>]*> lbu \$at,[01]\(\$at\) -0+0514 <[^>]*> sll \$a0,\$a0,0x8 -0+0518 <[^>]*> or \$a0,\$a0,\$at -0+051c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+051c [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+0520 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0520 [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0524 <[^>]*> sb \$a0,[01]\(\$at\) -0+0528 <[^>]*> srl \$a0,\$a0,0x8 -0+052c <[^>]*> sb \$a0,[01]\(\$at\) -0+0530 <[^>]*> lbu \$at,[01]\(\$at\) -0+0534 <[^>]*> sll \$a0,\$a0,0x8 -0+0538 <[^>]*> or \$a0,\$a0,\$at -0+053c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+053c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0540 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0540 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0544 <[^>]*> sb \$a0,[01]\(\$at\) -0+0548 <[^>]*> srl \$a0,\$a0,0x8 -0+054c <[^>]*> sb \$a0,[01]\(\$at\) -0+0550 <[^>]*> lbu \$at,[01]\(\$at\) -0+0554 <[^>]*> sll \$a0,\$a0,0x8 -0+0558 <[^>]*> or \$a0,\$a0,\$at -0+055c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+055c [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+0560 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0560 [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0564 <[^>]*> sb \$a0,[01]\(\$at\) -0+0568 <[^>]*> srl \$a0,\$a0,0x8 -0+056c <[^>]*> sb \$a0,[01]\(\$at\) -0+0570 <[^>]*> lbu \$at,[01]\(\$at\) -0+0574 <[^>]*> sll \$a0,\$a0,0x8 -0+0578 <[^>]*> or \$a0,\$a0,\$at -0+057c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+057c [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0580 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0580 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0584 <[^>]*> sb \$a0,[01]\(\$at\) -0+0588 <[^>]*> srl \$a0,\$a0,0x8 -0+058c <[^>]*> sb \$a0,[01]\(\$at\) -0+0590 <[^>]*> lbu \$at,[01]\(\$at\) -0+0594 <[^>]*> sll \$a0,\$a0,0x8 -0+0598 <[^>]*> or \$a0,\$a0,\$at -0+059c <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+059c [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+05a0 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+05a0 [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+05a4 <[^>]*> sb \$a0,[01]\(\$at\) -0+05a8 <[^>]*> srl \$a0,\$a0,0x8 -0+05ac <[^>]*> sb \$a0,[01]\(\$at\) -0+05b0 <[^>]*> lbu \$at,[01]\(\$at\) -0+05b4 <[^>]*> sll \$a0,\$a0,0x8 -0+05b8 <[^>]*> or \$a0,\$a0,\$at -... +0+0000 <[^>]*> sb \$a0,[01]\(\$zero\) +0+0004 <[^>]*> srl \$at,\$a0,0x8 +0+0008 <[^>]*> sb \$at,[01]\(\$zero\) +0+000c <[^>]*> sb \$a0,[12]\(\$zero\) +0+0010 <[^>]*> srl \$at,\$a0,0x8 +0+0014 <[^>]*> sb \$at,[12]\(\$zero\) +0+0018 <[^>]*> li \$at,0x8000 +0+001c <[^>]*> sb \$a0,[01]\(\$at\) +0+0020 <[^>]*> srl \$a0,\$a0,0x8 +0+0024 <[^>]*> sb \$a0,[01]\(\$at\) +0+0028 <[^>]*> lbu \$at,[01]\(\$at\) +0+002c <[^>]*> sll \$a0,\$a0,0x8 +0+0030 <[^>]*> or \$a0,\$a0,\$at +0+0034 <[^>]*> sb \$a0,-3276[78]\(\$zero\) +0+0038 <[^>]*> srl \$at,\$a0,0x8 +0+003c <[^>]*> sb \$at,-3276[78]\(\$zero\) +0+0040 <[^>]*> lui \$at,0x1 +0+0044 <[^>]*> sb \$a0,[01]\(\$at\) +0+0048 <[^>]*> srl \$a0,\$a0,0x8 +0+004c <[^>]*> sb \$a0,[01]\(\$at\) +0+0050 <[^>]*> lbu \$at,[01]\(\$at\) +0+0054 <[^>]*> sll \$a0,\$a0,0x8 +0+0058 <[^>]*> or \$a0,\$a0,\$at +0+005c <[^>]*> lui \$at,0x1 +0+0060 <[^>]*> ori \$at,\$at,0xa5a5 +0+0064 <[^>]*> sb \$a0,[01]\(\$at\) +0+0068 <[^>]*> srl \$a0,\$a0,0x8 +0+006c <[^>]*> sb \$a0,[01]\(\$at\) +0+0070 <[^>]*> lbu \$at,[01]\(\$at\) +0+0074 <[^>]*> sll \$a0,\$a0,0x8 +0+0078 <[^>]*> or \$a0,\$a0,\$at +0+007c <[^>]*> sb \$a0,[01]\(\$a1\) +0+0080 <[^>]*> srl \$at,\$a0,0x8 +0+0084 <[^>]*> sb \$at,[01]\(\$a1\) +0+0088 <[^>]*> sb \$a0,[12]\(\$a1\) +0+008c <[^>]*> srl \$at,\$a0,0x8 +0+0090 <[^>]*> sb \$at,[12]\(\$a1\) +0+0094 <[^>]*> lui \$at,[-0-9x]+ +[ ]*94: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0098 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*98: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+009c <[^>]*> sb \$a0,[01]\(\$at\) +0+00a0 <[^>]*> srl \$a0,\$a0,0x8 +0+00a4 <[^>]*> sb \$a0,[01]\(\$at\) +0+00a8 <[^>]*> lbu \$at,[01]\(\$at\) +0+00ac <[^>]*> sll \$a0,\$a0,0x8 +0+00b0 <[^>]*> or \$a0,\$a0,\$at +0+00b4 <[^>]*> lui \$at,0x0 +[ ]*b4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00b8 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*b8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00bc <[^>]*> sb \$a0,[01]\(\$at\) +0+00c0 <[^>]*> srl \$a0,\$a0,0x8 +0+00c4 <[^>]*> sb \$a0,[01]\(\$at\) +0+00c8 <[^>]*> lbu \$at,[01]\(\$at\) +0+00cc <[^>]*> sll \$a0,\$a0,0x8 +0+00d0 <[^>]*> or \$a0,\$a0,\$at +0+00d4 <[^>]*> addiu \$at,\$gp,0 +[ ]*d4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00d8 <[^>]*> sb \$a0,[01]\(\$at\) +0+00dc <[^>]*> srl \$a0,\$a0,0x8 +0+00e0 <[^>]*> sb \$a0,[01]\(\$at\) +0+00e4 <[^>]*> lbu \$at,[01]\(\$at\) +0+00e8 <[^>]*> sll \$a0,\$a0,0x8 +0+00ec <[^>]*> or \$a0,\$a0,\$at +0+00f0 <[^>]*> lui \$at,[-0-9x]+ +[ ]*f0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00f4 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*f4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+00f8 <[^>]*> sb \$a0,[01]\(\$at\) +0+00fc <[^>]*> srl \$a0,\$a0,0x8 +0+0100 <[^>]*> sb \$a0,[01]\(\$at\) +0+0104 <[^>]*> lbu \$at,[01]\(\$at\) +0+0108 <[^>]*> sll \$a0,\$a0,0x8 +0+010c <[^>]*> or \$a0,\$a0,\$at +0+0110 <[^>]*> addiu \$at,\$gp,0 +[ ]*110: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0114 <[^>]*> sb \$a0,[01]\(\$at\) +0+0118 <[^>]*> srl \$a0,\$a0,0x8 +0+011c <[^>]*> sb \$a0,[01]\(\$at\) +0+0120 <[^>]*> lbu \$at,[01]\(\$at\) +0+0124 <[^>]*> sll \$a0,\$a0,0x8 +0+0128 <[^>]*> or \$a0,\$a0,\$at +0+012c <[^>]*> lui \$at,[-0-9x]+ +[ ]*12c: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0130 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*130: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0134 <[^>]*> sb \$a0,[01]\(\$at\) +0+0138 <[^>]*> srl \$a0,\$a0,0x8 +0+013c <[^>]*> sb \$a0,[01]\(\$at\) +0+0140 <[^>]*> lbu \$at,[01]\(\$at\) +0+0144 <[^>]*> sll \$a0,\$a0,0x8 +0+0148 <[^>]*> or \$a0,\$a0,\$at +0+014c <[^>]*> addiu \$at,\$gp,[-0-9]+ +[ ]*14c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0150 <[^>]*> sb \$a0,[01]\(\$at\) +0+0154 <[^>]*> srl \$a0,\$a0,0x8 +0+0158 <[^>]*> sb \$a0,[01]\(\$at\) +0+015c <[^>]*> lbu \$at,[01]\(\$at\) +0+0160 <[^>]*> sll \$a0,\$a0,0x8 +0+0164 <[^>]*> or \$a0,\$a0,\$at +0+0168 <[^>]*> lui \$at,0x0 +[ ]*168: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+016c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*16c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0170 <[^>]*> sb \$a0,[01]\(\$at\) +0+0174 <[^>]*> srl \$a0,\$a0,0x8 +0+0178 <[^>]*> sb \$a0,[01]\(\$at\) +0+017c <[^>]*> lbu \$at,[01]\(\$at\) +0+0180 <[^>]*> sll \$a0,\$a0,0x8 +0+0184 <[^>]*> or \$a0,\$a0,\$at +0+0188 <[^>]*> lui \$at,0x0 +[ ]*188: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+018c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*18c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0190 <[^>]*> sb \$a0,[01]\(\$at\) +0+0194 <[^>]*> srl \$a0,\$a0,0x8 +0+0198 <[^>]*> sb \$a0,[01]\(\$at\) +0+019c <[^>]*> lbu \$at,[01]\(\$at\) +0+01a0 <[^>]*> sll \$a0,\$a0,0x8 +0+01a4 <[^>]*> or \$a0,\$a0,\$at +0+01a8 <[^>]*> addiu \$at,\$gp,1 +[ ]*1a8: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+01ac <[^>]*> sb \$a0,[01]\(\$at\) +0+01b0 <[^>]*> srl \$a0,\$a0,0x8 +0+01b4 <[^>]*> sb \$a0,[01]\(\$at\) +0+01b8 <[^>]*> lbu \$at,[01]\(\$at\) +0+01bc <[^>]*> sll \$a0,\$a0,0x8 +0+01c0 <[^>]*> or \$a0,\$a0,\$at +0+01c4 <[^>]*> lui \$at,0x0 +[ ]*1c4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01c8 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1c8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01cc <[^>]*> sb \$a0,[01]\(\$at\) +0+01d0 <[^>]*> srl \$a0,\$a0,0x8 +0+01d4 <[^>]*> sb \$a0,[01]\(\$at\) +0+01d8 <[^>]*> lbu \$at,[01]\(\$at\) +0+01dc <[^>]*> sll \$a0,\$a0,0x8 +0+01e0 <[^>]*> or \$a0,\$a0,\$at +0+01e4 <[^>]*> addiu \$at,\$gp,1 +[ ]*1e4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+01e8 <[^>]*> sb \$a0,[01]\(\$at\) +0+01ec <[^>]*> srl \$a0,\$a0,0x8 +0+01f0 <[^>]*> sb \$a0,[01]\(\$at\) +0+01f4 <[^>]*> lbu \$at,[01]\(\$at\) +0+01f8 <[^>]*> sll \$a0,\$a0,0x8 +0+01fc <[^>]*> or \$a0,\$a0,\$at +0+0200 <[^>]*> lui \$at,0x0 +[ ]*200: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0204 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*204: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0208 <[^>]*> sb \$a0,[01]\(\$at\) +0+020c <[^>]*> srl \$a0,\$a0,0x8 +0+0210 <[^>]*> sb \$a0,[01]\(\$at\) +0+0214 <[^>]*> lbu \$at,[01]\(\$at\) +0+0218 <[^>]*> sll \$a0,\$a0,0x8 +0+021c <[^>]*> or \$a0,\$a0,\$at +0+0220 <[^>]*> addiu \$at,\$gp,[-0-9]+ +[ ]*220: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0224 <[^>]*> sb \$a0,[01]\(\$at\) +0+0228 <[^>]*> srl \$a0,\$a0,0x8 +0+022c <[^>]*> sb \$a0,[01]\(\$at\) +0+0230 <[^>]*> lbu \$at,[01]\(\$at\) +0+0234 <[^>]*> sll \$a0,\$a0,0x8 +0+0238 <[^>]*> or \$a0,\$a0,\$at +0+023c <[^>]*> lui \$at,[-0-9x]+ +[ ]*23c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0240 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*240: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0244 <[^>]*> sb \$a0,[01]\(\$at\) +0+0248 <[^>]*> srl \$a0,\$a0,0x8 +0+024c <[^>]*> sb \$a0,[01]\(\$at\) +0+0250 <[^>]*> lbu \$at,[01]\(\$at\) +0+0254 <[^>]*> sll \$a0,\$a0,0x8 +0+0258 <[^>]*> or \$a0,\$a0,\$at +0+025c <[^>]*> lui \$at,[-0-9x]+ +[ ]*25c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0260 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*260: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0264 <[^>]*> sb \$a0,[01]\(\$at\) +0+0268 <[^>]*> srl \$a0,\$a0,0x8 +0+026c <[^>]*> sb \$a0,[01]\(\$at\) +0+0270 <[^>]*> lbu \$at,[01]\(\$at\) +0+0274 <[^>]*> sll \$a0,\$a0,0x8 +0+0278 <[^>]*> or \$a0,\$a0,\$at +0+027c <[^>]*> lui \$at,[-0-9x]+ +[ ]*27c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0280 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*280: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0284 <[^>]*> sb \$a0,[01]\(\$at\) +0+0288 <[^>]*> srl \$a0,\$a0,0x8 +0+028c <[^>]*> sb \$a0,[01]\(\$at\) +0+0290 <[^>]*> lbu \$at,[01]\(\$at\) +0+0294 <[^>]*> sll \$a0,\$a0,0x8 +0+0298 <[^>]*> or \$a0,\$a0,\$at +0+029c <[^>]*> lui \$at,[-0-9x]+ +[ ]*29c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+02a0 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2a0: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02a4 <[^>]*> sb \$a0,[01]\(\$at\) +0+02a8 <[^>]*> srl \$a0,\$a0,0x8 +0+02ac <[^>]*> sb \$a0,[01]\(\$at\) +0+02b0 <[^>]*> lbu \$at,[01]\(\$at\) +0+02b4 <[^>]*> sll \$a0,\$a0,0x8 +0+02b8 <[^>]*> or \$a0,\$a0,\$at +0+02bc <[^>]*> lui \$at,[-0-9x]+ +[ ]*2bc: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02c0 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2c0: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+02c4 <[^>]*> sb \$a0,[01]\(\$at\) +0+02c8 <[^>]*> srl \$a0,\$a0,0x8 +0+02cc <[^>]*> sb \$a0,[01]\(\$at\) +0+02d0 <[^>]*> lbu \$at,[01]\(\$at\) +0+02d4 <[^>]*> sll \$a0,\$a0,0x8 +0+02d8 <[^>]*> or \$a0,\$a0,\$at +0+02dc <[^>]*> lui \$at,[-0-9x]+ +[ ]*2dc: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+02e0 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2e0: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+02e4 <[^>]*> sb \$a0,[01]\(\$at\) +0+02e8 <[^>]*> srl \$a0,\$a0,0x8 +0+02ec <[^>]*> sb \$a0,[01]\(\$at\) +0+02f0 <[^>]*> lbu \$at,[01]\(\$at\) +0+02f4 <[^>]*> sll \$a0,\$a0,0x8 +0+02f8 <[^>]*> or \$a0,\$a0,\$at +0+02fc <[^>]*> lui \$at,[-0-9x]+ +[ ]*2fc: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+0300 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*300: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0304 <[^>]*> sb \$a0,[01]\(\$at\) +0+0308 <[^>]*> srl \$a0,\$a0,0x8 +0+030c <[^>]*> sb \$a0,[01]\(\$at\) +0+0310 <[^>]*> lbu \$at,[01]\(\$at\) +0+0314 <[^>]*> sll \$a0,\$a0,0x8 +0+0318 <[^>]*> or \$a0,\$a0,\$at +0+031c <[^>]*> lui \$at,0x0 +[ ]*31c: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0320 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*320: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0324 <[^>]*> sb \$a0,[01]\(\$at\) +0+0328 <[^>]*> srl \$a0,\$a0,0x8 +0+032c <[^>]*> sb \$a0,[01]\(\$at\) +0+0330 <[^>]*> lbu \$at,[01]\(\$at\) +0+0334 <[^>]*> sll \$a0,\$a0,0x8 +0+0338 <[^>]*> or \$a0,\$a0,\$at +0+033c <[^>]*> lui \$at,0x0 +[ ]*33c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0340 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*340: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0344 <[^>]*> sb \$a0,[01]\(\$at\) +0+0348 <[^>]*> srl \$a0,\$a0,0x8 +0+034c <[^>]*> sb \$a0,[01]\(\$at\) +0+0350 <[^>]*> lbu \$at,[01]\(\$at\) +0+0354 <[^>]*> sll \$a0,\$a0,0x8 +0+0358 <[^>]*> or \$a0,\$a0,\$at +0+035c <[^>]*> lui \$at,0x0 +[ ]*35c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0360 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*360: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0364 <[^>]*> sb \$a0,[01]\(\$at\) +0+0368 <[^>]*> srl \$a0,\$a0,0x8 +0+036c <[^>]*> sb \$a0,[01]\(\$at\) +0+0370 <[^>]*> lbu \$at,[01]\(\$at\) +0+0374 <[^>]*> sll \$a0,\$a0,0x8 +0+0378 <[^>]*> or \$a0,\$a0,\$at +0+037c <[^>]*> lui \$at,0x0 +[ ]*37c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0380 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*380: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0384 <[^>]*> sb \$a0,[01]\(\$at\) +0+0388 <[^>]*> srl \$a0,\$a0,0x8 +0+038c <[^>]*> sb \$a0,[01]\(\$at\) +0+0390 <[^>]*> lbu \$at,[01]\(\$at\) +0+0394 <[^>]*> sll \$a0,\$a0,0x8 +0+0398 <[^>]*> or \$a0,\$a0,\$at +0+039c <[^>]*> lui \$at,0x0 +[ ]*39c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+03a0 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*3a0: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+03a4 <[^>]*> sb \$a0,[01]\(\$at\) +0+03a8 <[^>]*> srl \$a0,\$a0,0x8 +0+03ac <[^>]*> sb \$a0,[01]\(\$at\) +0+03b0 <[^>]*> lbu \$at,[01]\(\$at\) +0+03b4 <[^>]*> sll \$a0,\$a0,0x8 +0+03b8 <[^>]*> or \$a0,\$a0,\$at +0+03bc <[^>]*> lui \$at,0x0 +[ ]*3bc: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+03c0 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*3c0: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+03c4 <[^>]*> sb \$a0,[01]\(\$at\) +0+03c8 <[^>]*> srl \$a0,\$a0,0x8 +0+03cc <[^>]*> sb \$a0,[01]\(\$at\) +0+03d0 <[^>]*> lbu \$at,[01]\(\$at\) +0+03d4 <[^>]*> sll \$a0,\$a0,0x8 +0+03d8 <[^>]*> or \$a0,\$a0,\$at +0+03dc <[^>]*> lui \$at,0x0 +[ ]*3dc: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+03e0 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*3e0: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+03e4 <[^>]*> sb \$a0,[01]\(\$at\) +0+03e8 <[^>]*> srl \$a0,\$a0,0x8 +0+03ec <[^>]*> sb \$a0,[01]\(\$at\) +0+03f0 <[^>]*> lbu \$at,[01]\(\$at\) +0+03f4 <[^>]*> sll \$a0,\$a0,0x8 +0+03f8 <[^>]*> or \$a0,\$a0,\$at +0+03fc <[^>]*> lui \$at,[-0-9x]+ +[ ]*3fc: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0400 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*400: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0404 <[^>]*> sb \$a0,[01]\(\$at\) +0+0408 <[^>]*> srl \$a0,\$a0,0x8 +0+040c <[^>]*> sb \$a0,[01]\(\$at\) +0+0410 <[^>]*> lbu \$at,[01]\(\$at\) +0+0414 <[^>]*> sll \$a0,\$a0,0x8 +0+0418 <[^>]*> or \$a0,\$a0,\$at +0+041c <[^>]*> lui \$at,[-0-9x]+ +[ ]*41c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0420 <[^>]*> addiu \$at,\$at,0 +[ ]*420: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0424 <[^>]*> sb \$a0,[01]\(\$at\) +0+0428 <[^>]*> srl \$a0,\$a0,0x8 +0+042c <[^>]*> sb \$a0,[01]\(\$at\) +0+0430 <[^>]*> lbu \$at,[01]\(\$at\) +0+0434 <[^>]*> sll \$a0,\$a0,0x8 +0+0438 <[^>]*> or \$a0,\$a0,\$at +0+043c <[^>]*> lui \$at,[-0-9x]+ +[ ]*43c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0440 <[^>]*> addiu \$at,\$at,0 +[ ]*440: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0444 <[^>]*> sb \$a0,[01]\(\$at\) +0+0448 <[^>]*> srl \$a0,\$a0,0x8 +0+044c <[^>]*> sb \$a0,[01]\(\$at\) +0+0450 <[^>]*> lbu \$at,[01]\(\$at\) +0+0454 <[^>]*> sll \$a0,\$a0,0x8 +0+0458 <[^>]*> or \$a0,\$a0,\$at +0+045c <[^>]*> lui \$at,[-0-9x]+ +[ ]*45c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0460 <[^>]*> addiu \$at,\$at,0 +[ ]*460: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0464 <[^>]*> sb \$a0,[01]\(\$at\) +0+0468 <[^>]*> srl \$a0,\$a0,0x8 +0+046c <[^>]*> sb \$a0,[01]\(\$at\) +0+0470 <[^>]*> lbu \$at,[01]\(\$at\) +0+0474 <[^>]*> sll \$a0,\$a0,0x8 +0+0478 <[^>]*> or \$a0,\$a0,\$at +0+047c <[^>]*> lui \$at,[-0-9x]+ +[ ]*47c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0480 <[^>]*> addiu \$at,\$at,0 +[ ]*480: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0484 <[^>]*> sb \$a0,[01]\(\$at\) +0+0488 <[^>]*> srl \$a0,\$a0,0x8 +0+048c <[^>]*> sb \$a0,[01]\(\$at\) +0+0490 <[^>]*> lbu \$at,[01]\(\$at\) +0+0494 <[^>]*> sll \$a0,\$a0,0x8 +0+0498 <[^>]*> or \$a0,\$a0,\$at +0+049c <[^>]*> lui \$at,[-0-9x]+ +[ ]*49c: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+04a0 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*4a0: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+04a4 <[^>]*> sb \$a0,[01]\(\$at\) +0+04a8 <[^>]*> srl \$a0,\$a0,0x8 +0+04ac <[^>]*> sb \$a0,[01]\(\$at\) +0+04b0 <[^>]*> lbu \$at,[01]\(\$at\) +0+04b4 <[^>]*> sll \$a0,\$a0,0x8 +0+04b8 <[^>]*> or \$a0,\$a0,\$at +0+04bc <[^>]*> lui \$at,[-0-9x]+ +[ ]*4bc: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+04c0 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*4c0: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+04c4 <[^>]*> sb \$a0,[01]\(\$at\) +0+04c8 <[^>]*> srl \$a0,\$a0,0x8 +0+04cc <[^>]*> sb \$a0,[01]\(\$at\) +0+04d0 <[^>]*> lbu \$at,[01]\(\$at\) +0+04d4 <[^>]*> sll \$a0,\$a0,0x8 +0+04d8 <[^>]*> or \$a0,\$a0,\$at +0+04dc <[^>]*> lui \$at,[-0-9x]+ +[ ]*4dc: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+04e0 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*4e0: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+04e4 <[^>]*> sb \$a0,[01]\(\$at\) +0+04e8 <[^>]*> srl \$a0,\$a0,0x8 +0+04ec <[^>]*> sb \$a0,[01]\(\$at\) +0+04f0 <[^>]*> lbu \$at,[01]\(\$at\) +0+04f4 <[^>]*> sll \$a0,\$a0,0x8 +0+04f8 <[^>]*> or \$a0,\$a0,\$at +0+04fc <[^>]*> lui \$at,[-0-9x]+ +[ ]*4fc: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0500 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*500: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0504 <[^>]*> sb \$a0,[01]\(\$at\) +0+0508 <[^>]*> srl \$a0,\$a0,0x8 +0+050c <[^>]*> sb \$a0,[01]\(\$at\) +0+0510 <[^>]*> lbu \$at,[01]\(\$at\) +0+0514 <[^>]*> sll \$a0,\$a0,0x8 +0+0518 <[^>]*> or \$a0,\$a0,\$at +0+051c <[^>]*> lui \$at,[-0-9x]+ +[ ]*51c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+0520 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*520: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0524 <[^>]*> sb \$a0,[01]\(\$at\) +0+0528 <[^>]*> srl \$a0,\$a0,0x8 +0+052c <[^>]*> sb \$a0,[01]\(\$at\) +0+0530 <[^>]*> lbu \$at,[01]\(\$at\) +0+0534 <[^>]*> sll \$a0,\$a0,0x8 +0+0538 <[^>]*> or \$a0,\$a0,\$at +0+053c <[^>]*> lui \$at,[-0-9x]+ +[ ]*53c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0540 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*540: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0544 <[^>]*> sb \$a0,[01]\(\$at\) +0+0548 <[^>]*> srl \$a0,\$a0,0x8 +0+054c <[^>]*> sb \$a0,[01]\(\$at\) +0+0550 <[^>]*> lbu \$at,[01]\(\$at\) +0+0554 <[^>]*> sll \$a0,\$a0,0x8 +0+0558 <[^>]*> or \$a0,\$a0,\$at +0+055c <[^>]*> lui \$at,[-0-9x]+ +[ ]*55c: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+0560 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*560: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0564 <[^>]*> sb \$a0,[01]\(\$at\) +0+0568 <[^>]*> srl \$a0,\$a0,0x8 +0+056c <[^>]*> sb \$a0,[01]\(\$at\) +0+0570 <[^>]*> lbu \$at,[01]\(\$at\) +0+0574 <[^>]*> sll \$a0,\$a0,0x8 +0+0578 <[^>]*> or \$a0,\$a0,\$at +0+057c <[^>]*> lui \$at,[-0-9x]+ +[ ]*57c: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0580 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*580: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0584 <[^>]*> sb \$a0,[01]\(\$at\) +0+0588 <[^>]*> srl \$a0,\$a0,0x8 +0+058c <[^>]*> sb \$a0,[01]\(\$at\) +0+0590 <[^>]*> lbu \$at,[01]\(\$at\) +0+0594 <[^>]*> sll \$a0,\$a0,0x8 +0+0598 <[^>]*> or \$a0,\$a0,\$at +0+059c <[^>]*> lui \$at,[-0-9x]+ +[ ]*59c: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+05a0 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*5a0: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+05a4 <[^>]*> sb \$a0,[01]\(\$at\) +0+05a8 <[^>]*> srl \$a0,\$a0,0x8 +0+05ac <[^>]*> sb \$a0,[01]\(\$at\) +0+05b0 <[^>]*> lbu \$at,[01]\(\$at\) +0+05b4 <[^>]*> sll \$a0,\$a0,0x8 +0+05b8 <[^>]*> or \$a0,\$a0,\$at +0+05bc <[^>]*> nop diff -urN binutils-2.7/gas/testsuite/gas/mips/ush.s binutils-2.8/gas/testsuite/gas/mips/ush.s --- binutils-2.7/gas/testsuite/gas/mips/ush.s Thu Jul 4 12:16:01 1996 +++ binutils-2.8/gas/testsuite/gas/mips/ush.s Wed Apr 30 12:54:41 1997 @@ -60,3 +60,6 @@ ush $4,small_external_common+0x1a5a5 ush $4,big_local_common+0x1a5a5 ush $4,small_local_common+0x1a5a5 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop diff -urN binutils-2.7/gas/testsuite/gas/mips/usw.d binutils-2.8/gas/testsuite/gas/mips/usw.d --- binutils-2.7/gas/testsuite/gas/mips/usw.d Thu Jul 4 12:16:01 1996 +++ binutils-2.8/gas/testsuite/gas/mips/usw.d Wed Apr 30 12:54:41 1997 @@ -1,4 +1,4 @@ -#objdump: -dr +#objdump: -dr --prefix-addresses #name: MIPS usw #as: -mips1 @@ -7,264 +7,264 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> swl \$a0,[03]\(\$zero\) -0+0004 <[^>]*> swr \$a0,[03]\(\$zero\) -0+0008 <[^>]*> swl \$a0,[14]\(\$zero\) -0+000c <[^>]*> swr \$a0,[14]\(\$zero\) -0+0010 <[^>]*> li \$at,0x8000 -0+0014 <[^>]*> swl \$a0,[03]\(\$at\) -0+0018 <[^>]*> swr \$a0,[03]\(\$at\) -0+001c <[^>]*> swl \$a0,-3276[58]\(\$zero\) -0+0020 <[^>]*> swr \$a0,-3276[58]\(\$zero\) -0+0024 <[^>]*> lui \$at,0x1 -0+0028 <[^>]*> swl \$a0,[03]\(\$at\) -0+002c <[^>]*> swr \$a0,[03]\(\$at\) -0+0030 <[^>]*> lui \$at,0x1 -0+0034 <[^>]*> ori \$at,\$at,0xa5a5 -0+0038 <[^>]*> swl \$a0,[03]\(\$at\) -0+003c <[^>]*> swr \$a0,[03]\(\$at\) -0+0040 <[^>]*> swl \$a0,[03]\(\$a1\) -0+0044 <[^>]*> swr \$a0,[03]\(\$a1\) -0+0048 <[^>]*> swl \$a0,[14]\(\$a1\) -0+004c <[^>]*> swr \$a0,[-0-9]+\(\$a1\) -0+0050 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0050 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0054 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0054 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0058 <[^>]*> swl \$a0,[03]\(\$at\) -0+005c <[^>]*> swr \$a0,[03]\(\$at\) -0+0060 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0060 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0064 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0064 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0068 <[^>]*> swl \$a0,[03]\(\$at\) -0+006c <[^>]*> swr \$a0,[03]\(\$at\) -0+0070 <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+0070 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+0074 <[^>]*> swl \$a0,[03]\(\$at\) -0+0078 <[^>]*> swr \$a0,[03]\(\$at\) -0+007c <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+007c [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0080 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0080 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0084 <[^>]*> swl \$a0,[03]\(\$at\) -0+0088 <[^>]*> swr \$a0,[03]\(\$at\) -0+008c <[^>]*> addiu \$at,\$gp,0 -[ ]*RELOC: 0+008c [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+0090 <[^>]*> swl \$a0,[03]\(\$at\) -0+0094 <[^>]*> swr \$a0,[03]\(\$at\) -0+0098 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0098 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+009c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+009c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+00a0 <[^>]*> swl \$a0,[03]\(\$at\) -0+00a4 <[^>]*> swr \$a0,[03]\(\$at\) -0+00a8 <[^>]*> addiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+00a8 [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+00ac <[^>]*> swl \$a0,[03]\(\$at\) -0+00b0 <[^>]*> swr \$a0,[03]\(\$at\) -0+00b4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00b4 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00b8 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00b8 [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+00bc <[^>]*> swl \$a0,[03]\(\$at\) -0+00c0 <[^>]*> swr \$a0,[03]\(\$at\) -0+00c4 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00c4 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00c8 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00c8 [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+00cc <[^>]*> swl \$a0,[03]\(\$at\) -0+00d0 <[^>]*> swr \$a0,[03]\(\$at\) -0+00d4 <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+00d4 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label -0+00d8 <[^>]*> swl \$a0,[03]\(\$at\) -0+00dc <[^>]*> swr \$a0,[03]\(\$at\) -0+00e0 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00e0 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00e4 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+00e4 [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+00e8 <[^>]*> swl \$a0,[03]\(\$at\) -0+00ec <[^>]*> swr \$a0,[03]\(\$at\) -0+00f0 <[^>]*> addiu \$at,\$gp,1 -[ ]*RELOC: 0+00f0 [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common -0+00f4 <[^>]*> swl \$a0,[03]\(\$at\) -0+00f8 <[^>]*> swr \$a0,[03]\(\$at\) -0+00fc <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+00fc [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0100 <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+0100 [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0104 <[^>]*> swl \$a0,[03]\(\$at\) -0+0108 <[^>]*> swr \$a0,[03]\(\$at\) -0+010c <[^>]*> addiu \$at,\$gp,[-0-9]+ -[ ]*RELOC: 0+010c [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* -0+0110 <[^>]*> swl \$a0,[03]\(\$at\) -0+0114 <[^>]*> swr \$a0,[03]\(\$at\) -0+0118 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0118 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+011c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+011c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0120 <[^>]*> swl \$a0,[03]\(\$at\) -0+0124 <[^>]*> swr \$a0,[03]\(\$at\) -0+0128 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0128 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+012c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+012c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0130 <[^>]*> swl \$a0,[03]\(\$at\) -0+0134 <[^>]*> swr \$a0,[03]\(\$at\) -0+0138 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0138 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+013c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+013c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0140 <[^>]*> swl \$a0,[03]\(\$at\) -0+0144 <[^>]*> swr \$a0,[03]\(\$at\) -0+0148 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0148 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+014c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+014c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0150 <[^>]*> swl \$a0,[03]\(\$at\) -0+0154 <[^>]*> swr \$a0,[03]\(\$at\) -0+0158 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0158 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+015c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+015c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0160 <[^>]*> swl \$a0,[03]\(\$at\) -0+0164 <[^>]*> swr \$a0,[03]\(\$at\) -0+0168 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0168 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+016c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+016c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0170 <[^>]*> swl \$a0,[03]\(\$at\) -0+0174 <[^>]*> swr \$a0,[03]\(\$at\) -0+0178 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0178 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+017c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+017c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0180 <[^>]*> swl \$a0,[03]\(\$at\) -0+0184 <[^>]*> swr \$a0,[03]\(\$at\) -0+0188 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0188 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+018c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+018c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0190 <[^>]*> swl \$a0,[03]\(\$at\) -0+0194 <[^>]*> swr \$a0,[03]\(\$at\) -0+0198 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+0198 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+019c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+019c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+01a0 <[^>]*> swl \$a0,[03]\(\$at\) -0+01a4 <[^>]*> swr \$a0,[03]\(\$at\) -0+01a8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01a8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+01ac <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01ac [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+01b0 <[^>]*> swl \$a0,[03]\(\$at\) -0+01b4 <[^>]*> swr \$a0,[03]\(\$at\) -0+01b8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01b8 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01bc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01bc [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+01c0 <[^>]*> swl \$a0,[03]\(\$at\) -0+01c4 <[^>]*> swr \$a0,[03]\(\$at\) -0+01c8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01c8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+01cc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01cc [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+01d0 <[^>]*> swl \$a0,[03]\(\$at\) -0+01d4 <[^>]*> swr \$a0,[03]\(\$at\) -0+01d8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01d8 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+01dc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01dc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+01e0 <[^>]*> swl \$a0,[03]\(\$at\) -0+01e4 <[^>]*> swr \$a0,[03]\(\$at\) -0+01e8 <[^>]*> lui \$at,0x0 -[ ]*RELOC: 0+01e8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+01ec <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01ec [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+01f0 <[^>]*> swl \$a0,[03]\(\$at\) -0+01f4 <[^>]*> swr \$a0,[03]\(\$at\) -0+01f8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+01f8 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+01fc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+01fc [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0200 <[^>]*> swl \$a0,[03]\(\$at\) -0+0204 <[^>]*> swr \$a0,[03]\(\$at\) -0+0208 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0208 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+020c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+020c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0210 <[^>]*> swl \$a0,[03]\(\$at\) -0+0214 <[^>]*> swr \$a0,[03]\(\$at\) -0+0218 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0218 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+021c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+021c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0220 <[^>]*> swl \$a0,[03]\(\$at\) -0+0224 <[^>]*> swr \$a0,[03]\(\$at\) -0+0228 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0228 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+022c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+022c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+0230 <[^>]*> swl \$a0,[03]\(\$at\) -0+0234 <[^>]*> swr \$a0,[03]\(\$at\) -0+0238 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0238 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+023c <[^>]*> addiu \$at,\$at,0 -[ ]*RELOC: 0+023c [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+0240 <[^>]*> swl \$a0,[03]\(\$at\) -0+0244 <[^>]*> swr \$a0,[03]\(\$at\) -0+0248 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0248 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+024c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+024c [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+0250 <[^>]*> swl \$a0,[03]\(\$at\) -0+0254 <[^>]*> swr \$a0,[03]\(\$at\) -0+0258 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0258 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+025c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+025c [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+0260 <[^>]*> swl \$a0,[03]\(\$at\) -0+0264 <[^>]*> swr \$a0,[03]\(\$at\) -0+0268 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0268 [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+026c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+026c [A-Z0-9_]*LO[A-Z0-9_]* .data.* -0+0270 <[^>]*> swl \$a0,[03]\(\$at\) -0+0274 <[^>]*> swr \$a0,[03]\(\$at\) -0+0278 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0278 [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+027c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+027c [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label -0+0280 <[^>]*> swl \$a0,[03]\(\$at\) -0+0284 <[^>]*> swr \$a0,[03]\(\$at\) -0+0288 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0288 [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+028c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+028c [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label -0+0290 <[^>]*> swl \$a0,[03]\(\$at\) -0+0294 <[^>]*> swr \$a0,[03]\(\$at\) -0+0298 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+0298 [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+029c <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+029c [A-Z0-9_]*LO[A-Z0-9_]* big_external_common -0+02a0 <[^>]*> swl \$a0,[03]\(\$at\) -0+02a4 <[^>]*> swr \$a0,[03]\(\$at\) -0+02a8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02a8 [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02ac <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02ac [A-Z0-9_]*LO[A-Z0-9_]* small_external_common -0+02b0 <[^>]*> swl \$a0,[03]\(\$at\) -0+02b4 <[^>]*> swr \$a0,[03]\(\$at\) -0+02b8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02b8 [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02bc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02bc [A-Z0-9_]*LO[A-Z0-9_]* .bss.* -0+02c0 <[^>]*> swl \$a0,[03]\(\$at\) -0+02c4 <[^>]*> swr \$a0,[03]\(\$at\) -0+02c8 <[^>]*> lui \$at,[-0-9x]+ -[ ]*RELOC: 0+02c8 [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+02cc <[^>]*> addiu \$at,\$at,[-0-9]+ -[ ]*RELOC: 0+02cc [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* -0+02d0 <[^>]*> swl \$a0,[03]\(\$at\) -0+02d4 <[^>]*> swr \$a0,[03]\(\$at\) -... +0+0000 <[^>]*> swl \$a0,[03]\(\$zero\) +0+0004 <[^>]*> swr \$a0,[03]\(\$zero\) +0+0008 <[^>]*> swl \$a0,[14]\(\$zero\) +0+000c <[^>]*> swr \$a0,[14]\(\$zero\) +0+0010 <[^>]*> li \$at,0x8000 +0+0014 <[^>]*> swl \$a0,[03]\(\$at\) +0+0018 <[^>]*> swr \$a0,[03]\(\$at\) +0+001c <[^>]*> swl \$a0,-3276[58]\(\$zero\) +0+0020 <[^>]*> swr \$a0,-3276[58]\(\$zero\) +0+0024 <[^>]*> lui \$at,0x1 +0+0028 <[^>]*> swl \$a0,[03]\(\$at\) +0+002c <[^>]*> swr \$a0,[03]\(\$at\) +0+0030 <[^>]*> lui \$at,0x1 +0+0034 <[^>]*> ori \$at,\$at,0xa5a5 +0+0038 <[^>]*> swl \$a0,[03]\(\$at\) +0+003c <[^>]*> swr \$a0,[03]\(\$at\) +0+0040 <[^>]*> swl \$a0,[03]\(\$a1\) +0+0044 <[^>]*> swr \$a0,[03]\(\$a1\) +0+0048 <[^>]*> swl \$a0,[14]\(\$a1\) +0+004c <[^>]*> swr \$a0,[-0-9]+\(\$a1\) +0+0050 <[^>]*> lui \$at,[-0-9x]+ +[ ]*50: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+0054 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*54: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0058 <[^>]*> swl \$a0,[03]\(\$at\) +0+005c <[^>]*> swr \$a0,[03]\(\$at\) +0+0060 <[^>]*> lui \$at,[-0-9x]+ +[ ]*60: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+0064 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*64: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0068 <[^>]*> swl \$a0,[03]\(\$at\) +0+006c <[^>]*> swr \$a0,[03]\(\$at\) +0+0070 <[^>]*> addiu \$at,\$gp,0 +[ ]*70: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+0074 <[^>]*> swl \$a0,[03]\(\$at\) +0+0078 <[^>]*> swr \$a0,[03]\(\$at\) +0+007c <[^>]*> lui \$at,0x0 +[ ]*7c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+0080 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*80: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0084 <[^>]*> swl \$a0,[03]\(\$at\) +0+0088 <[^>]*> swr \$a0,[03]\(\$at\) +0+008c <[^>]*> addiu \$at,\$gp,0 +[ ]*8c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+0090 <[^>]*> swl \$a0,[03]\(\$at\) +0+0094 <[^>]*> swr \$a0,[03]\(\$at\) +0+0098 <[^>]*> lui \$at,[-0-9x]+ +[ ]*98: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+009c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*9c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+00a0 <[^>]*> swl \$a0,[03]\(\$at\) +0+00a4 <[^>]*> swr \$a0,[03]\(\$at\) +0+00a8 <[^>]*> addiu \$at,\$gp,[-0-9]+ +[ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+00ac <[^>]*> swl \$a0,[03]\(\$at\) +0+00b0 <[^>]*> swr \$a0,[03]\(\$at\) +0+00b4 <[^>]*> lui \$at,0x0 +[ ]*b4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+00b8 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*b8: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+00bc <[^>]*> swl \$a0,[03]\(\$at\) +0+00c0 <[^>]*> swr \$a0,[03]\(\$at\) +0+00c4 <[^>]*> lui \$at,0x0 +[ ]*c4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+00c8 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*c8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+00cc <[^>]*> swl \$a0,[03]\(\$at\) +0+00d0 <[^>]*> swr \$a0,[03]\(\$at\) +0+00d4 <[^>]*> addiu \$at,\$gp,1 +[ ]*d4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label +0+00d8 <[^>]*> swl \$a0,[03]\(\$at\) +0+00dc <[^>]*> swr \$a0,[03]\(\$at\) +0+00e0 <[^>]*> lui \$at,0x0 +[ ]*e0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+00e4 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*e4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+00e8 <[^>]*> swl \$a0,[03]\(\$at\) +0+00ec <[^>]*> swr \$a0,[03]\(\$at\) +0+00f0 <[^>]*> addiu \$at,\$gp,1 +[ ]*f0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common +0+00f4 <[^>]*> swl \$a0,[03]\(\$at\) +0+00f8 <[^>]*> swr \$a0,[03]\(\$at\) +0+00fc <[^>]*> lui \$at,0x0 +[ ]*fc: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+0100 <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*100: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0104 <[^>]*> swl \$a0,[03]\(\$at\) +0+0108 <[^>]*> swr \$a0,[03]\(\$at\) +0+010c <[^>]*> addiu \$at,\$gp,[-0-9]+ +[ ]*10c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* +0+0110 <[^>]*> swl \$a0,[03]\(\$at\) +0+0114 <[^>]*> swr \$a0,[03]\(\$at\) +0+0118 <[^>]*> lui \$at,[-0-9x]+ +[ ]*118: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+011c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*11c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0120 <[^>]*> swl \$a0,[03]\(\$at\) +0+0124 <[^>]*> swr \$a0,[03]\(\$at\) +0+0128 <[^>]*> lui \$at,[-0-9x]+ +[ ]*128: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+012c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*12c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0130 <[^>]*> swl \$a0,[03]\(\$at\) +0+0134 <[^>]*> swr \$a0,[03]\(\$at\) +0+0138 <[^>]*> lui \$at,[-0-9x]+ +[ ]*138: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+013c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*13c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0140 <[^>]*> swl \$a0,[03]\(\$at\) +0+0144 <[^>]*> swr \$a0,[03]\(\$at\) +0+0148 <[^>]*> lui \$at,[-0-9x]+ +[ ]*148: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+014c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*14c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0150 <[^>]*> swl \$a0,[03]\(\$at\) +0+0154 <[^>]*> swr \$a0,[03]\(\$at\) +0+0158 <[^>]*> lui \$at,[-0-9x]+ +[ ]*158: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+015c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*15c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0160 <[^>]*> swl \$a0,[03]\(\$at\) +0+0164 <[^>]*> swr \$a0,[03]\(\$at\) +0+0168 <[^>]*> lui \$at,[-0-9x]+ +[ ]*168: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+016c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*16c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0170 <[^>]*> swl \$a0,[03]\(\$at\) +0+0174 <[^>]*> swr \$a0,[03]\(\$at\) +0+0178 <[^>]*> lui \$at,[-0-9x]+ +[ ]*178: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+017c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*17c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0180 <[^>]*> swl \$a0,[03]\(\$at\) +0+0184 <[^>]*> swr \$a0,[03]\(\$at\) +0+0188 <[^>]*> lui \$at,0x0 +[ ]*188: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+018c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*18c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0190 <[^>]*> swl \$a0,[03]\(\$at\) +0+0194 <[^>]*> swr \$a0,[03]\(\$at\) +0+0198 <[^>]*> lui \$at,0x0 +[ ]*198: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+019c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*19c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+01a0 <[^>]*> swl \$a0,[03]\(\$at\) +0+01a4 <[^>]*> swr \$a0,[03]\(\$at\) +0+01a8 <[^>]*> lui \$at,0x0 +[ ]*1a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+01ac <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+01b0 <[^>]*> swl \$a0,[03]\(\$at\) +0+01b4 <[^>]*> swr \$a0,[03]\(\$at\) +0+01b8 <[^>]*> lui \$at,0x0 +[ ]*1b8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+01bc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1bc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+01c0 <[^>]*> swl \$a0,[03]\(\$at\) +0+01c4 <[^>]*> swr \$a0,[03]\(\$at\) +0+01c8 <[^>]*> lui \$at,0x0 +[ ]*1c8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+01cc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1cc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+01d0 <[^>]*> swl \$a0,[03]\(\$at\) +0+01d4 <[^>]*> swr \$a0,[03]\(\$at\) +0+01d8 <[^>]*> lui \$at,0x0 +[ ]*1d8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+01dc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1dc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+01e0 <[^>]*> swl \$a0,[03]\(\$at\) +0+01e4 <[^>]*> swr \$a0,[03]\(\$at\) +0+01e8 <[^>]*> lui \$at,0x0 +[ ]*1e8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+01ec <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1ec: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+01f0 <[^>]*> swl \$a0,[03]\(\$at\) +0+01f4 <[^>]*> swr \$a0,[03]\(\$at\) +0+01f8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*1f8: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+01fc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*1fc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0200 <[^>]*> swl \$a0,[03]\(\$at\) +0+0204 <[^>]*> swr \$a0,[03]\(\$at\) +0+0208 <[^>]*> lui \$at,[-0-9x]+ +[ ]*208: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+020c <[^>]*> addiu \$at,\$at,0 +[ ]*20c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0210 <[^>]*> swl \$a0,[03]\(\$at\) +0+0214 <[^>]*> swr \$a0,[03]\(\$at\) +0+0218 <[^>]*> lui \$at,[-0-9x]+ +[ ]*218: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+021c <[^>]*> addiu \$at,\$at,0 +[ ]*21c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0220 <[^>]*> swl \$a0,[03]\(\$at\) +0+0224 <[^>]*> swr \$a0,[03]\(\$at\) +0+0228 <[^>]*> lui \$at,[-0-9x]+ +[ ]*228: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+022c <[^>]*> addiu \$at,\$at,0 +[ ]*22c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+0230 <[^>]*> swl \$a0,[03]\(\$at\) +0+0234 <[^>]*> swr \$a0,[03]\(\$at\) +0+0238 <[^>]*> lui \$at,[-0-9x]+ +[ ]*238: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+023c <[^>]*> addiu \$at,\$at,0 +[ ]*23c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+0240 <[^>]*> swl \$a0,[03]\(\$at\) +0+0244 <[^>]*> swr \$a0,[03]\(\$at\) +0+0248 <[^>]*> lui \$at,[-0-9x]+ +[ ]*248: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+024c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*24c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+0250 <[^>]*> swl \$a0,[03]\(\$at\) +0+0254 <[^>]*> swr \$a0,[03]\(\$at\) +0+0258 <[^>]*> lui \$at,[-0-9x]+ +[ ]*258: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+025c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*25c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+0260 <[^>]*> swl \$a0,[03]\(\$at\) +0+0264 <[^>]*> swr \$a0,[03]\(\$at\) +0+0268 <[^>]*> lui \$at,[-0-9x]+ +[ ]*268: [A-Z0-9_]*HI[A-Z0-9_]* .data.* +0+026c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*26c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* +0+0270 <[^>]*> swl \$a0,[03]\(\$at\) +0+0274 <[^>]*> swr \$a0,[03]\(\$at\) +0+0278 <[^>]*> lui \$at,[-0-9x]+ +[ ]*278: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label +0+027c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*27c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label +0+0280 <[^>]*> swl \$a0,[03]\(\$at\) +0+0284 <[^>]*> swr \$a0,[03]\(\$at\) +0+0288 <[^>]*> lui \$at,[-0-9x]+ +[ ]*288: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label +0+028c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*28c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label +0+0290 <[^>]*> swl \$a0,[03]\(\$at\) +0+0294 <[^>]*> swr \$a0,[03]\(\$at\) +0+0298 <[^>]*> lui \$at,[-0-9x]+ +[ ]*298: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common +0+029c <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*29c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common +0+02a0 <[^>]*> swl \$a0,[03]\(\$at\) +0+02a4 <[^>]*> swr \$a0,[03]\(\$at\) +0+02a8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common +0+02ac <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common +0+02b0 <[^>]*> swl \$a0,[03]\(\$at\) +0+02b4 <[^>]*> swr \$a0,[03]\(\$at\) +0+02b8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2b8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* +0+02bc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2bc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* +0+02c0 <[^>]*> swl \$a0,[03]\(\$at\) +0+02c4 <[^>]*> swr \$a0,[03]\(\$at\) +0+02c8 <[^>]*> lui \$at,[-0-9x]+ +[ ]*2c8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* +0+02cc <[^>]*> addiu \$at,\$at,[-0-9]+ +[ ]*2cc: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* +0+02d0 <[^>]*> swl \$a0,[03]\(\$at\) +0+02d4 <[^>]*> swr \$a0,[03]\(\$at\) + ... diff -urN binutils-2.7/gas/testsuite/gas/mips/usw.s binutils-2.8/gas/testsuite/gas/mips/usw.s --- binutils-2.7/gas/testsuite/gas/mips/usw.s Thu Jul 4 12:16:01 1996 +++ binutils-2.8/gas/testsuite/gas/mips/usw.s Wed Apr 30 12:54:41 1997 @@ -60,3 +60,7 @@ usw $4,small_external_common+0x1a5a5 usw $4,big_local_common+0x1a5a5 usw $4,small_local_common+0x1a5a5 + +# Round to a 16 byte boundary, for ease in testing multiple targets. + nop + nop diff -urN binutils-2.7/gas/testsuite/gas/mn10200/add.s binutils-2.8/gas/testsuite/gas/mn10200/add.s --- binutils-2.7/gas/testsuite/gas/mn10200/add.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/add.s Wed Apr 30 12:54:44 1997 @@ -0,0 +1,13 @@ + .text + add d1,d2 + add d2,a3 + add a2,d1 + add a3,a2 + add 16,d1 + add 256,d2 + add 131071,d3 + add 16,a1 + add 256,a2 + add 131071,a3 + addc d1,d2 + addnf 16,a2 diff -urN binutils-2.7/gas/testsuite/gas/mn10200/basic.exp binutils-2.8/gas/testsuite/gas/mn10200/basic.exp --- binutils-2.7/gas/testsuite/gas/mn10200/basic.exp Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/basic.exp Wed Apr 30 12:54:44 1997 @@ -0,0 +1,836 @@ +# Copyright (C) 1996 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +# Written by Cygnus Support. + +proc do_add {} { + set testname "add.s: Add operations" + set x 0 + + gas_start "add.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 96\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0001 F20B\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 F2C9\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 F24E\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 D510\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 F71A0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000d F463FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +8 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 D110\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0014 F70A0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0018 F467FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +11 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001d F286\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001f F50E10\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==14] then { pass $testname } else { fail $testname } +} + +proc do_bcc {} { + set testname "bcc.s: Bcc tests" + set x 0 + + gas_start "bcc.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 E800\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 E900\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 E100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 E200\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 E300\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000a E000\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c E500\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000e E600\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0010 E700\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 E400\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0014 F5FC00\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0017 F5FD00\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001a F5FE00\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001d F5FF00\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0020 EA00\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==15] then { pass $testname } else { fail $testname } +} + +proc do_bccx {} { + set testname "bccx.s: Bccx tests" + set x 0 + + gas_start "bccx.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F5E800\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 F5E900\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 F5E100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 F5E200\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c F5E300\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000f F5E000\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 F5E500\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0015 F5E600\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0018 F5E700\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001b F5E400\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001e F5EC00\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0021 F5ED00\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0024 F5EE00\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0027 F5EF00\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==14] then { pass $testname } else { fail $testname } +} + +proc do_bit {} { + set testname "bit.s: bit tests" + set x 0 + + gas_start "bit.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F50540\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 F7060020\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 F029\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 F039\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +12 +FFFF40\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==4] then { pass $testname } else { fail $testname } +} + + +proc do_cmp {} { + set testname "cmp.s: cmp tests" + set x 0 + + gas_start "cmp.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F396\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F22B\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 F2EF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 F26E\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 DB10\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000a F74A0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000e F479FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +8 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0013 EE0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0016 F47DFFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +10 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==11] then { pass $testname } else { fail $testname } +} + +proc do_ext {} { + set testname "ext.s: ext tests" + set x 0 + + gas_start "ext.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F3C5\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 B2\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 B7\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 BA\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 BD\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==5] then { pass $testname } else { fail $testname } +} + +proc do_extend {} { + set testname "extend.s: extended instruction tests" + set x 0 + + gas_start "extend.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F505\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F6FA\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 F606\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 F90210\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 FB030100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000d FD030001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +7 +FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0013 F616\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0015 F91610\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0018 FB170100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c FD170001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +11 +FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0022 F64B\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0024 F65E\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0026 F676\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==15] then { pass $testname } else { fail $testname } +} + +proc do_logical {} { + set testname "logical.s: logical tests" + set x 0 + + gas_start "logical.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F306\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F5027F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 F703FF7F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 F710FF7F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000d F316\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000f F50A7F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 F743FF7F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0016 F714FF7F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001a F326\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c F74FFF7F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0020 F3E7\[^\n\]*\n" { set x [expr $x+1] } + -re "^\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==11] then { pass $testname } else { fail $testname } +} + +proc do_loop {} { + set testname "loop.s: loop tests" + set x 0 + + gas_start "loop.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 D8\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0001 D9\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 D1\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 D2\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 D3\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 D0\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 D5\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 D6\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 D7\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 D4\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000a DA\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000b DB\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==12] then { pass $testname } else { fail $testname } +} + +proc do_mov1 {} { + set testname "mov1.s: mov1 tests" + set x 0 + + gas_start "mov1.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F236\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F2F9\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 86\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 F279\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 F3F3\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 F3D8\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000b F3E1\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000d F3C8\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000f 29\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0010 6908\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 F7C90001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0016 F489FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +13 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==13] then { pass $testname } else { fail $testname } +} + +proc do_mov2 {} { + set testname "mov2.s: mov2 tests" + set x 0 + + gas_start "mov2.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F156\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 C90080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 F4C1FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +4 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000a 7908\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c F7B90001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0010 F4F9FFFF \[^\n\]*\n" { set x [expr $x+1] } + -re "^ +7 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0015 F116\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0017 F7310080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001b F4D1FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +10 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==12] then { pass $testname } else { fail $testname } +} + +proc do_mov3 {} { + set testname "mov3.s: mov3 tests" + set x 0 + + gas_start "mov3.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 09\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0001 4920\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 F7890001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 F409FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +5 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c F1E9\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000e C18000\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0011 F441FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +8 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0016 5920\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0018 F7A90001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c F419FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +11 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==13] then { pass $testname } else { fail $testname } +} + +proc do_mov4 {} { + set testname "mov4.s: mov4 tests" + set x 0 + + gas_start "mov4.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F1A9\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F7218000\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 F451FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +4 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000b 8508\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000d F90001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0010 F471FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +7 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0015 DD0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0018 F475FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +9 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==11] then { pass $testname } else { fail $testname } +} + +proc do_movx {} { + set testname "movx.s: movx tests" + set x 0 + + gas_start "movx.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F57908\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 F7790001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 F4B9FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +4 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c F55908\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000f F7690001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0013 F439FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +7 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==8] then { pass $testname } else { fail $testname } +} + +proc do_movb {} { + set testname "movb.s: movb tests" + set x 0 + + gas_start "movb.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F52908\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 F7D90001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 F4A9FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +4 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c F06B\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000e F4C6FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +6 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0013 19\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0014 F51908\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0017 F7990001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001b F429FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +10 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0020 F0E9\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0022 C50001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0025 F445FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +13 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==16] then { pass $testname } else { fail $testname } +} + +proc do_movbu {} { + set testname "movbu.s: movbu tests" + set x 0 + + gas_start "movbu.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 39\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0001 F53908\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 F7590001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 F499FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +5 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000d F096\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000f CD0080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 F4C9FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +8 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==9] then { pass $testname } else { fail $testname } +} + +proc do_movhu {} { + set testname "movhu.s: movhu tests" + set x 0 + + gas_start "movhu.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F066\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F86608\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 FA660100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 FC660001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +5 +FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000f F8BD08\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 FABD0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0016 FCBD0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +8 +FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c F4A5\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001e 398000\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0021 FCAD0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +11 +FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0027 F076\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0029 F87620\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002c FA760100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0030 FC760001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +15 +FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0036 F89720\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0039 FA978000\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 003d FC970001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +18 +FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0043 F4DA\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0045 070080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0048 FC870001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +21 +FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==26] then { pass $testname } else { fail $testname } +} + +proc do_movm {} { + set testname "movm.s: movm tests" + set x 0 + + gas_start "movm.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 CE30\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 CEF8\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 CF30\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 CFF8\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==4] then { pass $testname } else { fail $testname } +} + +proc do_muldiv {} { + set testname "muldiv.s: muldiv tests" + set x 0 + + gas_start "muldiv.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F346\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F35B\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 F36E\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==3] then { pass $testname } else { fail $testname } +} + +proc do_other {} { + set testname "other.s: other tests" + set x 0 + + gas_start "other.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 FC0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 F4E0FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +3 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 F008\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000a FD0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000d F4E1FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +6 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 F009\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0014 FE\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0015 EB\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0016 F6\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==11] then { pass $testname } else { fail $testname } +} + +proc do_shift {} { + set testname "shift.s: shift tests" + set x 0 + + gas_start "shift.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F33A\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F33F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 F335\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 F332\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==4] then { pass $testname } else { fail $testname } +} + +proc do_sub {} { + set testname "sub.s: sub tests" + set x 0 + + gas_start "sub.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 A6\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0001 F21B\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 F2DF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 F25E\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 F71EFF7F \[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000b F46AFFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +7 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0010 F70EFF7F \[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0014 F46EFFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +9 +01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0019 F296 \[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==11] then { pass $testname } else { fail $testname } +} + +if [istarget mn10200*-*-*] then { + # Test the basic instruction parser. + do_add + do_bcc + do_bccx + do_bit + do_cmp + do_ext + do_logical + do_mov1 + do_mov2 + do_mov3 + do_mov4 + do_movb + do_movx + do_movbu + do_muldiv + do_other + do_shift + do_sub +} diff -urN binutils-2.7/gas/testsuite/gas/mn10200/bcc.s binutils-2.8/gas/testsuite/gas/mn10200/bcc.s --- binutils-2.7/gas/testsuite/gas/mn10200/bcc.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/bcc.s Wed Apr 30 12:54:45 1997 @@ -0,0 +1,17 @@ + .text +foo: + beq foo + bne foo + bgt foo + bge foo + ble foo + blt foo + bhi foo + bcc foo + bls foo + bcs foo + bvc foo + bvs foo + bnc foo + bns foo + bra foo diff -urN binutils-2.7/gas/testsuite/gas/mn10200/bccx.s binutils-2.8/gas/testsuite/gas/mn10200/bccx.s --- binutils-2.7/gas/testsuite/gas/mn10200/bccx.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/bccx.s Wed Apr 30 12:54:45 1997 @@ -0,0 +1,16 @@ + .text +foo: + beqx foo + bnex foo + bgtx foo + bgex foo + blex foo + bltx foo + bhix foo + bccx foo + blsx foo + bcsx foo + bvcx foo + bvsx foo + bncx foo + bnsx foo diff -urN binutils-2.7/gas/testsuite/gas/mn10200/bit.s binutils-2.8/gas/testsuite/gas/mn10200/bit.s --- binutils-2.7/gas/testsuite/gas/mn10200/bit.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/bit.s Wed Apr 30 12:54:45 1997 @@ -0,0 +1,5 @@ + .text + btst 64,d1 + btst 8192,d2 + bset d1,(a2) + bclr d1,(a2) diff -urN binutils-2.7/gas/testsuite/gas/mn10200/cmp.s binutils-2.8/gas/testsuite/gas/mn10200/cmp.s --- binutils-2.7/gas/testsuite/gas/mn10200/cmp.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/cmp.s Wed Apr 30 12:54:46 1997 @@ -0,0 +1,10 @@ + .text + cmp d1,d2 + cmp d2,a3 + cmp a3,d3 + cmp a3,a2 + cmp 16,d3 + cmp 256,d2 + cmp 131071,d1 + cmp 256,a2 + cmp 131071,a1 diff -urN binutils-2.7/gas/testsuite/gas/mn10200/ext.s binutils-2.8/gas/testsuite/gas/mn10200/ext.s --- binutils-2.7/gas/testsuite/gas/mn10200/ext.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/ext.s Wed Apr 30 12:54:46 1997 @@ -0,0 +1,7 @@ + .text + ext d1 + extx d2 + extxu d3 + extxb d2 + extxbu d1 + diff -urN binutils-2.7/gas/testsuite/gas/mn10200/logical.s binutils-2.8/gas/testsuite/gas/mn10200/logical.s --- binutils-2.7/gas/testsuite/gas/mn10200/logical.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/logical.s Wed Apr 30 12:54:45 1997 @@ -0,0 +1,12 @@ + .text + and d1,d2 + and 127,d2 + and 32767,d3 + and 32767,psw + or d1,d2 + or 127,d2 + or 32767,d3 + or 32767,psw + xor d1,d2 + xor 32767,d3 + not d3 diff -urN binutils-2.7/gas/testsuite/gas/mn10200/mov1.s binutils-2.8/gas/testsuite/gas/mn10200/mov1.s --- binutils-2.7/gas/testsuite/gas/mn10200/mov1.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/mov1.s Wed Apr 30 12:54:46 1997 @@ -0,0 +1,13 @@ + .text + mov d1,a2 + mov a2,d1 + mov d1,d2 + mov a2,a1 + mov psw,d3 + mov d2,psw + mov mdr,d1 + mov d2,mdr + mov (a2),d1 + mov (8,a2),d1 + mov (256,a2),d1 + mov (131071,a2),d1 diff -urN binutils-2.7/gas/testsuite/gas/mn10200/mov2.s binutils-2.8/gas/testsuite/gas/mn10200/mov2.s --- binutils-2.7/gas/testsuite/gas/mn10200/mov2.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/mov2.s Wed Apr 30 12:54:46 1997 @@ -0,0 +1,10 @@ + .text + mov (d1,a1),d2 + mov (32768),d1 + mov (131071),d1 + mov (8,a2),a1 + mov (256,a2),a1 + mov (131071,a2),a1 + mov (d1,a1),a2 + mov (32768),a1 + mov (131071),a1 diff -urN binutils-2.7/gas/testsuite/gas/mn10200/mov3.s binutils-2.8/gas/testsuite/gas/mn10200/mov3.s --- binutils-2.7/gas/testsuite/gas/mn10200/mov3.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/mov3.s Wed Apr 30 12:54:47 1997 @@ -0,0 +1,11 @@ + .text + mov d1,(a2) + mov d1,(32,a2) + mov d1,(256,a2) + mov d1,(131071,a2) + mov d1,(d2,a2) + mov d1,(128) + mov d1,(131071) + mov a1,(32,a2) + mov a1,(256,a2) + mov a1,(131071,a2) diff -urN binutils-2.7/gas/testsuite/gas/mn10200/mov4.s binutils-2.8/gas/testsuite/gas/mn10200/mov4.s --- binutils-2.7/gas/testsuite/gas/mn10200/mov4.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/mov4.s Wed Apr 30 12:54:47 1997 @@ -0,0 +1,9 @@ + .text + mov a1,(d2,a2) + mov a1,(128) + mov a1,(131071) + mov 8,d1 + mov 256,d1 + mov 131071,d1 + mov 256,a1 + mov 131071,a1 diff -urN binutils-2.7/gas/testsuite/gas/mn10200/movb.s binutils-2.8/gas/testsuite/gas/mn10200/movb.s --- binutils-2.7/gas/testsuite/gas/mn10200/movb.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/movb.s Wed Apr 30 12:54:47 1997 @@ -0,0 +1,13 @@ + .text + movb (8,a2),d1 + movb (256,a2),d1 + movb (131071,a2),d1 + movb (d2,a2),d3 + movb (131071),d2 + movb d1,(a2) + movb d1,(8,a2) + movb d1,(256,a2) + movb d1,(131071,a2) + movb d1,(d2,a2) + movb d1,(256) + movb d1,(131071) diff -urN binutils-2.7/gas/testsuite/gas/mn10200/movbu.s binutils-2.8/gas/testsuite/gas/mn10200/movbu.s --- binutils-2.7/gas/testsuite/gas/mn10200/movbu.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/movbu.s Wed Apr 30 12:54:46 1997 @@ -0,0 +1,8 @@ + .text + movbu (a2),d1 + movbu (8,a2),d1 + movbu (256,a2),d1 + movbu (131071,a2),d1 + movbu (d1,a1),d2 + movbu (32768),d1 + movbu (131071),d1 diff -urN binutils-2.7/gas/testsuite/gas/mn10200/movx.s binutils-2.8/gas/testsuite/gas/mn10200/movx.s --- binutils-2.7/gas/testsuite/gas/mn10200/movx.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/movx.s Wed Apr 30 12:54:47 1997 @@ -0,0 +1,7 @@ + .text + movx (8,a2),d1 + movx (256,a2),d1 + movx (131071,a2),d1 + movx d1,(8,a2) + movx d1,(256,a2) + movx d1,(131071,a2) diff -urN binutils-2.7/gas/testsuite/gas/mn10200/muldiv.s binutils-2.8/gas/testsuite/gas/mn10200/muldiv.s --- binutils-2.7/gas/testsuite/gas/mn10200/muldiv.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/muldiv.s Wed Apr 30 12:54:47 1997 @@ -0,0 +1,4 @@ + .text + mul d1,d2 + mulu d2,d3 + divu d3,d2 diff -urN binutils-2.7/gas/testsuite/gas/mn10200/other.s binutils-2.8/gas/testsuite/gas/mn10200/other.s --- binutils-2.7/gas/testsuite/gas/mn10200/other.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/other.s Wed Apr 30 12:54:48 1997 @@ -0,0 +1,10 @@ + .text + jmp 256 + jmp 131071 + jmp (a2) + jsr 256 + jsr 131071 + jsr (a2) + rts + rti + nop diff -urN binutils-2.7/gas/testsuite/gas/mn10200/shift.s binutils-2.8/gas/testsuite/gas/mn10200/shift.s --- binutils-2.7/gas/testsuite/gas/mn10200/shift.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/shift.s Wed Apr 30 12:54:48 1997 @@ -0,0 +1,5 @@ + .text + asr d2 + lsr d3 + ror d1 + rol d2 diff -urN binutils-2.7/gas/testsuite/gas/mn10200/sub.s binutils-2.8/gas/testsuite/gas/mn10200/sub.s --- binutils-2.7/gas/testsuite/gas/mn10200/sub.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10200/sub.s Wed Apr 30 12:54:48 1997 @@ -0,0 +1,10 @@ + .text + sub d1,d2 + sub d2,a3 + sub a3,d3 + sub a3,a2 + sub 32767,d2 + sub 131071,d2 + sub 32767,a2 + sub 131071,a2 + subc d1,d2 diff -urN binutils-2.7/gas/testsuite/gas/mn10300/add.s binutils-2.8/gas/testsuite/gas/mn10300/add.s --- binutils-2.7/gas/testsuite/gas/mn10300/add.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/add.s Wed Apr 30 12:54:50 1997 @@ -0,0 +1,15 @@ + .text + add d1,d2 + add d2,a3 + add a3,a2 + add a2,d1 + add 16,d1 + add 256,d2 + add 131071,d3 + add 16,a1 + add 256,a2 + add 131071,a3 + add 16,sp + add 256,sp + add 131071,sp + addc d1,d2 diff -urN binutils-2.7/gas/testsuite/gas/mn10300/basic.exp binutils-2.8/gas/testsuite/gas/mn10300/basic.exp --- binutils-2.7/gas/testsuite/gas/mn10300/basic.exp Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/basic.exp Wed Apr 30 12:54:50 1997 @@ -0,0 +1,799 @@ +# Copyright (C) 1996 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +# Written by Cygnus Support. + +proc do_add {} { + set testname "add.s: Add operations" + set x 0 + + gas_start "add.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 E6\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0001 F16B\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 F17E\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 F159\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 2910\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 FAC20001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000d FCC3FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +8 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0013 2110\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0015 FAD20001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0019 FCD3FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +11 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001f F8FE10\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0022 FAFE0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0026 FCFEFFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +14 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002c F146\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==17] then { pass $testname } else { fail $testname } +} + +proc do_bcc {} { + set testname "bcc.s: Bcc tests" + set x 0 + + gas_start "bcc.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 C800\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 C900\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 C100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 C200\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 C300\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000a C000\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c C500\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000e C600\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0010 C700\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 C400\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0014 F8E800\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0017 F8E900\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001a F8EA00\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001d F8EB00\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0020 CA00\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==15] then { pass $testname } else { fail $testname } +} + +proc do_bit {} { + set testname "bit.s: bit tests" + set x 0 + + gas_start "bit.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F8ED40\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 FAEE0020\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 FCEFFFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +4 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000d FAF90840\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0011 FE02FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +6 +010040\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0018 F086\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001a FAF10840\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001e FE00FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +9 +010040\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0025 F096\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0027 FAF50840\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002b FE01FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +12 +010040\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==15] then { pass $testname } else { fail $testname } +} + +proc do_cmp {} { + set testname "cmp.s: cmp tests" + set x 0 + + gas_start "cmp.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 A6\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0001 F1AB\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 F19F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 BE\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 AF10\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 FACA0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c FCC9FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +8 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 BF10\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0014 FADA0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0018 FCD9FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +11 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==12] then { pass $testname } else { fail $testname } +} + +proc do_ext {} { + set testname "ext.s: ext tests" + set x 0 + + gas_start "ext.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F2D1\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 12\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 17\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 1A\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 1D\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==5] then { pass $testname } else { fail $testname } +} + +proc do_extend {} { + set testname "extend.s: extended instruction tests" + set x 0 + + gas_start "extend.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F505\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F6FA\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 F606\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 F90210\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 FB030001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000d FD03FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +7 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0013 F616\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0015 F91610\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0018 FB170001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c FD17FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +11 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0022 F64B\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0024 F65E\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0026 F676\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==15] then { pass $testname } else { fail $testname } +} + +proc do_logical {} { + set testname "logical.s: logical tests" + set x 0 + + gas_start "logical.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F206\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F8E27F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 FAE3FF7F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 FCE3FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +5 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000f FAFCFF7F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0013 F216\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0015 F8E67F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0018 FAE7FF7F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c FCE7FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +10 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0022 FAFDFF7F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0026 F226\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0028 FAEBFF7F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002c FCEBFFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +14 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0032 F233\[^\n\]*\n" { set x [expr $x+1] } + -re "^\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==17] then { pass $testname } else { fail $testname } +} + +proc do_loop {} { + set testname "loop.s: loop tests" + set x 0 + + gas_start "loop.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 D8\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0001 D9\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 D1\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 D2\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 D3\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 D0\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 D5\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 D6\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 D7\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 D4\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000a DA\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000b DB\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==12] then { pass $testname } else { fail $testname } +} + +proc do_mov1 {} { + set testname "mov1.s: mov1 tests" + set x 0 + + gas_start "mov1.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 86\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0001 F1E6\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 F1D9\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 99\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 3E\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 F2F4\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 F2FB\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000b F2E1\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000d F2FA\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000f 76\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0010 F80608\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0013 FA060001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0017 FC06FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +14 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001d 5908\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001f FAB50001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0023 F2E7\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==17] then { pass $testname } else { fail $testname } +} + +proc do_mov2 {} { + set testname "mov2.s: mov2 tests" + set x 0 + + gas_start "mov2.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 FCB5FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +2 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 F325\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 310080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000b FCA5FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +5 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0011 F006\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0013 F82608\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0016 FA260001 \[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001a FC26FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +9 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0020 5D08\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0022 FAB10001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0026 FCB1FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +12 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002c F3A5\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002e FAA10080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0032 FCA1FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +15 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0038 F8F120\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==20] then { pass $testname } else { fail $testname } +} + +proc do_mov3 {} { + set testname "mov3.s: mov3 tests" + set x 0 + + gas_start "mov3.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 66\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0001 F81620\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 FA160001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 FC16FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +5 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000e 4620\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0010 FA950080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0014 FC95FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +8 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001a F35A\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c 058000\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001f FC85FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +11 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0025 F016\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0027 F83620\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002a FA360001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002e FC36FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +15 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0034 4720\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==19] then { pass $testname } else { fail $testname } +} + +proc do_mov4 {} { + set testname "mov4.s: mov4 tests" + set x 0 + + gas_start "mov4.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 FA940080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 FC94FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +3 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000a F3DA\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c FA848000\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0010 FC84FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +6 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0016 F8F520\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0019 8508\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001b 2D0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001e FCCDFFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +10 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0024 9508\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0026 250001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0029 FCDDFFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +13 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==16] then { pass $testname } else { fail $testname } +} + +proc do_movbu {} { + set testname "movbu.s: movbu tests" + set x 0 + + gas_start "movbu.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F046\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F84608\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 FA460001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 FC46FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +5 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000f F8B908\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 FAB90001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0016 FCB9FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +8 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c F425\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001e 350080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0021 FCA9FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +11 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0027 F056\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0029 F85620\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002c FA560001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0030 FC56FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +15 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0036 F89620\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0039 FA960080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 003d FC96FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +18 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0043 F45A\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0045 068000\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0048 FC86FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +21 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==26] then { pass $testname } else { fail $testname } +} + +proc do_movhu {} { + set testname "movhu.s: movhu tests" + set x 0 + + gas_start "movhu.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F066\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F86608\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 FA660001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 FC66FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +5 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000f F8BD08\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 FABD0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0016 FCBDFFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +8 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c F4A5\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001e 390080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0021 FCADFFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +11 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0027 F076\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0029 F87620\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002c FA760001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0030 FC76FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +15 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0036 F89720\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0039 FA970080\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 003d FC97FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +18 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0043 F4DA\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0045 078000\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0048 FC87FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +21 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==26] then { pass $testname } else { fail $testname } +} + +proc do_movm {} { + set testname "movm.s: movm tests" + set x 0 + + gas_start "movm.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 CE30\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 CEF8\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 CF30\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 CFF8\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==4] then { pass $testname } else { fail $testname } +} + +proc do_muldiv {} { + set testname "muldiv.s: muldiv tests" + set x 0 + + gas_start "muldiv.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F246\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F25B\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 F26F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 F27E\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==4] then { pass $testname } else { fail $testname } +} + +proc do_other {} { + set testname "other.s: other tests" + set x 0 + + gas_start "other.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 08\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0001 44\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 49\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0003 53\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 F0F6\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 CC0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0009 DCFFFF01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +8 +00\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000e CD000130\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +9 +09\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0013 DDFFFF01\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +10 +003020\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001a F0F2\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c FAFF0001\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0020 FCFFFFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +13 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0026 DF3007\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0029 DE3005\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002c F0FC\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002e F0FD\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0030 F0FE\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0032 CB\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0033 F0FF\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==23] then { pass $testname } else { fail $testname } +} + +proc do_shift {} { + set testname "shift.s: shift tests" + set x 0 + + gas_start "shift.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F2B6\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F8CA04\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0005 F2AB\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0007 F8C704\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000a F29E\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c F8C204\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000f 56\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0010 F285\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 F282\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==9] then { pass $testname } else { fail $testname } +} + +proc do_sub {} { + set testname "sub.s: sub tests" + set x 0 + + gas_start "sub.s" "-al" + + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F106\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F12B\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 F11F\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 F13E\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 FCC6FFFF \[^\n\]*\n" { set x [expr $x+1] } + -re "^ +6 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000e FCD5FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +7 +0100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0014 F186\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==9] then { pass $testname } else { fail $testname } +} + +if [istarget mn10300*-*-*] then { + # Test the basic instruction parser. + do_add + do_bcc + do_bit + do_cmp + do_ext + do_extend + do_logical + do_loop + do_mov1 + do_mov2 + do_mov3 + do_mov4 + do_movbu + do_movhu + do_movm + do_muldiv + do_other + do_shift + do_sub +} diff -urN binutils-2.7/gas/testsuite/gas/mn10300/bcc.s binutils-2.8/gas/testsuite/gas/mn10300/bcc.s --- binutils-2.7/gas/testsuite/gas/mn10300/bcc.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/bcc.s Wed Apr 30 12:54:51 1997 @@ -0,0 +1,17 @@ + .text +foo: + beq foo + bne foo + bgt foo + bge foo + ble foo + blt foo + bhi foo + bcc foo + bls foo + bcs foo + bvc foo + bvs foo + bnc foo + bns foo + bra foo diff -urN binutils-2.7/gas/testsuite/gas/mn10300/bit.s binutils-2.8/gas/testsuite/gas/mn10300/bit.s --- binutils-2.7/gas/testsuite/gas/mn10300/bit.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/bit.s Wed Apr 30 12:54:51 1997 @@ -0,0 +1,12 @@ + .text + btst 64,d1 + btst 8192,d2 + btst 131071,d3 + btst 64,(8,a1) + btst 64,(131071) + bset d1,(a2) + bset 64,(8,a1) + bset 64,(131071) + bclr d1,(a2) + bclr 64,(8,a1) + bclr 64,(131071) diff -urN binutils-2.7/gas/testsuite/gas/mn10300/cmp.s binutils-2.8/gas/testsuite/gas/mn10300/cmp.s --- binutils-2.7/gas/testsuite/gas/mn10300/cmp.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/cmp.s Wed Apr 30 12:54:51 1997 @@ -0,0 +1,11 @@ + .text + cmp d1,d2 + cmp d2,a3 + cmp a3,d3 + cmp a3,a2 + cmp 16,d3 + cmp 256,d2 + cmp 131071,d1 + cmp 16,a3 + cmp 256,a2 + cmp 131071,a1 diff -urN binutils-2.7/gas/testsuite/gas/mn10300/ext.s binutils-2.8/gas/testsuite/gas/mn10300/ext.s --- binutils-2.7/gas/testsuite/gas/mn10300/ext.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/ext.s Wed Apr 30 12:54:51 1997 @@ -0,0 +1,7 @@ + .text + ext d1 + extb d2 + extbu d3 + exth d2 + exthu d1 + diff -urN binutils-2.7/gas/testsuite/gas/mn10300/extend.s binutils-2.8/gas/testsuite/gas/mn10300/extend.s --- binutils-2.7/gas/testsuite/gas/mn10300/extend.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/extend.s Wed Apr 30 12:54:51 1997 @@ -0,0 +1,15 @@ + .text + putx d1 + getx d2 + mulq d1,d2 + mulq 16,d2 + mulq 256,d3 + mulq 131071,d3 + mulqu d1,d2 + mulqu 16,d2 + mulqu 256,d3 + mulqu 131071,d3 + sat16 d2,d3 + sat24 d3,d2 + bsch d1,d2 + diff -urN binutils-2.7/gas/testsuite/gas/mn10300/logical.s binutils-2.8/gas/testsuite/gas/mn10300/logical.s --- binutils-2.7/gas/testsuite/gas/mn10300/logical.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/logical.s Wed Apr 30 12:54:51 1997 @@ -0,0 +1,15 @@ + .text + and d1,d2 + and 127,d2 + and 32767,d3 + and 131071,d3 + and 32767,psw + or d1,d2 + or 127,d2 + or 32767,d3 + or 131071,d3 + or 32767,psw + xor d1,d2 + xor 32767,d3 + xor 131071,d3 + not d3 diff -urN binutils-2.7/gas/testsuite/gas/mn10300/loop.s binutils-2.8/gas/testsuite/gas/mn10300/loop.s --- binutils-2.7/gas/testsuite/gas/mn10300/loop.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/loop.s Wed Apr 30 12:54:52 1997 @@ -0,0 +1,15 @@ + .text +foo: + leq + lne + lgt + lge + lle + llt + lhi + lcc + lls + lcs + lra + setlb + diff -urN binutils-2.7/gas/testsuite/gas/mn10300/mov1.s binutils-2.8/gas/testsuite/gas/mn10300/mov1.s --- binutils-2.7/gas/testsuite/gas/mn10300/mov1.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/mov1.s Wed Apr 30 12:54:52 1997 @@ -0,0 +1,17 @@ + .text + mov d1,d2 + mov d1,a2 + mov a2,d1 + mov a2,a1 + mov sp,a2 + mov a1,sp + mov d2,psw + mov mdr,d1 + mov d2,mdr + mov (a2),d1 + mov (8,a2),d1 + mov (256,a2),d1 + mov (131071,a2),d1 + mov (8,sp),d1 + mov (256,sp),d1 + mov psw,d3 diff -urN binutils-2.7/gas/testsuite/gas/mn10300/mov2.s binutils-2.8/gas/testsuite/gas/mn10300/mov2.s --- binutils-2.7/gas/testsuite/gas/mn10300/mov2.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/mov2.s Wed Apr 30 12:54:52 1997 @@ -0,0 +1,16 @@ + .text + mov (131071,sp),d1 + mov (d1,a1),d2 + mov (32768),d1 + mov (131071),d1 + mov (a2),a1 + mov (8,a2),a1 + mov (256,a2),a1 + mov (131071,a2),a1 + mov (8,sp),a1 + mov (256,sp),a1 + mov (131071,sp),a1 + mov (d1,a1),a2 + mov (32768),a1 + mov (131071),a1 + mov (32,a1),sp diff -urN binutils-2.7/gas/testsuite/gas/mn10300/mov3.s binutils-2.8/gas/testsuite/gas/mn10300/mov3.s --- binutils-2.7/gas/testsuite/gas/mn10300/mov3.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/mov3.s Wed Apr 30 12:54:52 1997 @@ -0,0 +1,16 @@ + .text + mov d1,(a2) + mov d1,(32,a2) + mov d1,(256,a2) + mov d1,(131071,a2) + mov d1,(32,sp) + mov d1,(32768,sp) + mov d1,(131071,sp) + mov d1,(d2,a2) + mov d1,(128) + mov d1,(131071) + mov a1,(a2) + mov a1,(32,a2) + mov a1,(256,a2) + mov a1,(131071,a2) + mov a1,(32,sp) diff -urN binutils-2.7/gas/testsuite/gas/mn10300/mov4.s binutils-2.8/gas/testsuite/gas/mn10300/mov4.s --- binutils-2.7/gas/testsuite/gas/mn10300/mov4.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/mov4.s Wed Apr 30 12:54:52 1997 @@ -0,0 +1,13 @@ + .text + mov a1,(32768,sp) + mov a1,(131071,sp) + mov a1,(d2,a2) + mov a1,(128) + mov a1,(131071) + mov sp,(32,a1) + mov 8,d1 + mov 256,d1 + mov 131071,d1 + mov 8,a1 + mov 256,a1 + mov 131071,a1 diff -urN binutils-2.7/gas/testsuite/gas/mn10300/movbu.s binutils-2.8/gas/testsuite/gas/mn10300/movbu.s --- binutils-2.7/gas/testsuite/gas/mn10300/movbu.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/movbu.s Wed Apr 30 12:54:53 1997 @@ -0,0 +1,21 @@ + .text + movbu (a2),d1 + movbu (8,a2),d1 + movbu (256,a2),d1 + movbu (131071,a2),d1 + movbu (8,sp),d1 + movbu (256,sp),d1 + movbu (131071,sp),d1 + movbu (d1,a1),d2 + movbu (32768),d1 + movbu (131071),d1 + movbu d1,(a2) + movbu d1,(32,a2) + movbu d1,(256,a2) + movbu d1,(131071,a2) + movbu d1,(32,sp) + movbu d1,(32768,sp) + movbu d1,(131071,sp) + movbu d1,(d2,a2) + movbu d1,(128) + movbu d1,(131071) diff -urN binutils-2.7/gas/testsuite/gas/mn10300/movhu.s binutils-2.8/gas/testsuite/gas/mn10300/movhu.s --- binutils-2.7/gas/testsuite/gas/mn10300/movhu.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/movhu.s Wed Apr 30 12:54:53 1997 @@ -0,0 +1,21 @@ + .text + movhu (a2),d1 + movhu (8,a2),d1 + movhu (256,a2),d1 + movhu (131071,a2),d1 + movhu (8,sp),d1 + movhu (256,sp),d1 + movhu (131071,sp),d1 + movhu (d1,a1),d2 + movhu (32768),d1 + movhu (131071),d1 + movhu d1,(a2) + movhu d1,(32,a2) + movhu d1,(256,a2) + movhu d1,(131071,a2) + movhu d1,(32,sp) + movhu d1,(32768,sp) + movhu d1,(131071,sp) + movhu d1,(d2,a2) + movhu d1,(128) + movhu d1,(131071) diff -urN binutils-2.7/gas/testsuite/gas/mn10300/movm.s binutils-2.8/gas/testsuite/gas/mn10300/movm.s --- binutils-2.7/gas/testsuite/gas/mn10300/movm.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/movm.s Wed Apr 30 12:54:53 1997 @@ -0,0 +1,5 @@ + .text + movm (sp),[a2,a3] + movm (sp),[d2,d3,a2,a3,other] + movm [a2,a3],(sp) + movm [d2,d3,a2,a3,other],(sp) diff -urN binutils-2.7/gas/testsuite/gas/mn10300/muldiv.s binutils-2.8/gas/testsuite/gas/mn10300/muldiv.s --- binutils-2.7/gas/testsuite/gas/mn10300/muldiv.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/muldiv.s Wed Apr 30 12:54:53 1997 @@ -0,0 +1,5 @@ + .text + mul d1,d2 + mulu d2,d3 + div d3,d3 + divu d3,d2 diff -urN binutils-2.7/gas/testsuite/gas/mn10300/other.s binutils-2.8/gas/testsuite/gas/mn10300/other.s --- binutils-2.7/gas/testsuite/gas/mn10300/other.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/other.s Wed Apr 30 12:54:53 1997 @@ -0,0 +1,20 @@ + .text + clr d2 + inc d1 + inc a2 + inc4 a3 + jmp (a2) + jmp 256 + jmp 131071 + call 256,[a2,a3],9 + call 131071,[a2,a3],32 + calls (a2) + calls 256 + calls 131071 + ret [a2,a3],7 + retf [a2,a3],5 + rets + rti + trap + nop + rtm diff -urN binutils-2.7/gas/testsuite/gas/mn10300/shift.s binutils-2.8/gas/testsuite/gas/mn10300/shift.s --- binutils-2.7/gas/testsuite/gas/mn10300/shift.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/shift.s Wed Apr 30 12:54:53 1997 @@ -0,0 +1,10 @@ + .text + asr d1,d2 + asr 4,d2 + lsr d2,d3 + lsr 4,d3 + asl d3,d2 + asl 4,d2 + asl2 d2 + ror d1 + rol d2 diff -urN binutils-2.7/gas/testsuite/gas/mn10300/sub.s binutils-2.8/gas/testsuite/gas/mn10300/sub.s --- binutils-2.7/gas/testsuite/gas/mn10300/sub.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mn10300/sub.s Wed Apr 30 12:54:54 1997 @@ -0,0 +1,8 @@ + .text + sub d1,d2 + sub d2,a3 + sub a3,d3 + sub a3,a2 + sub 131071,d2 + sub 131071,a1 + subc d1,d2 diff -urN binutils-2.7/gas/testsuite/gas/mri/for.d binutils-2.8/gas/testsuite/gas/mri/for.d --- binutils-2.7/gas/testsuite/gas/mri/for.d Thu Jul 4 12:16:03 1996 +++ binutils-2.8/gas/testsuite/gas/mri/for.d Wed Apr 30 12:55:00 1997 @@ -1,4 +1,4 @@ -#objdump: -d +#objdump: -d --prefix-addresses #name: MRI structured for #as: -M diff -urN binutils-2.7/gas/testsuite/gas/mri/if.d binutils-2.8/gas/testsuite/gas/mri/if.d --- binutils-2.7/gas/testsuite/gas/mri/if.d Thu Jul 4 12:16:03 1996 +++ binutils-2.8/gas/testsuite/gas/mri/if.d Wed Apr 30 12:55:00 1997 @@ -1,4 +1,4 @@ -#objdump: -d +#objdump: -d --prefix-addresses #name: MRI structured if #as: -M diff -urN binutils-2.7/gas/testsuite/gas/mri/immconst.d binutils-2.8/gas/testsuite/gas/mri/immconst.d --- binutils-2.7/gas/testsuite/gas/mri/immconst.d Thu Jul 4 12:16:03 1996 +++ binutils-2.8/gas/testsuite/gas/mri/immconst.d Wed Apr 30 12:55:00 1997 @@ -1,4 +1,4 @@ -#objdump: -d +#objdump: -d --prefix-addresses #name: MRI immediate constants #as: -M #source: constants.s diff -urN binutils-2.7/gas/testsuite/gas/mri/mri.exp binutils-2.8/gas/testsuite/gas/mri/mri.exp --- binutils-2.7/gas/testsuite/gas/mri/mri.exp Thu Jul 4 12:16:03 1996 +++ binutils-2.8/gas/testsuite/gas/mri/mri.exp Wed Apr 30 12:55:01 1997 @@ -24,3 +24,4 @@ run_dump_test if run_dump_test repeat run_dump_test while +run_dump_test semi diff -urN binutils-2.7/gas/testsuite/gas/mri/repeat.d binutils-2.8/gas/testsuite/gas/mri/repeat.d --- binutils-2.7/gas/testsuite/gas/mri/repeat.d Thu Jul 4 12:16:03 1996 +++ binutils-2.8/gas/testsuite/gas/mri/repeat.d Wed Apr 30 12:55:01 1997 @@ -1,4 +1,4 @@ -#objdump: -d +#objdump: -d --prefix-addresses #name: MRI structured repeat #as: -M diff -urN binutils-2.7/gas/testsuite/gas/mri/semi.d binutils-2.8/gas/testsuite/gas/mri/semi.d --- binutils-2.7/gas/testsuite/gas/mri/semi.d Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mri/semi.d Wed Apr 30 12:55:01 1997 @@ -0,0 +1,9 @@ +#objdump: -s -j .text +#name: MRI semi +#as: -M + +.*: .* + +Contents of section .text: + 0000 3b203b20 3a203a20 00000000 00000000 ; ; : : ........ + 0010 00000000 00000000 00000000 00000000 ................ diff -urN binutils-2.7/gas/testsuite/gas/mri/semi.s binutils-2.8/gas/testsuite/gas/mri/semi.s --- binutils-2.7/gas/testsuite/gas/mri/semi.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/mri/semi.s Wed Apr 30 12:55:02 1997 @@ -0,0 +1,14 @@ +semicolon macro + dc.b '; ' + endm + +colon macro + dc.b ': ' + endm + + semicolon + dc.b '; ' + colon + dc.b ': ' + + p2align 5 diff -urN binutils-2.7/gas/testsuite/gas/mri/while.d binutils-2.8/gas/testsuite/gas/mri/while.d --- binutils-2.7/gas/testsuite/gas/mri/while.d Thu Jul 4 12:16:03 1996 +++ binutils-2.8/gas/testsuite/gas/mri/while.d Wed Apr 30 12:54:57 1997 @@ -1,4 +1,4 @@ -#objdump: -d +#objdump: -d --prefix-addresses #name: MRI structured while #as: -M diff -urN binutils-2.7/gas/testsuite/gas/sh/basic.exp binutils-2.8/gas/testsuite/gas/sh/basic.exp --- binutils-2.7/gas/testsuite/gas/sh/basic.exp Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/sh/basic.exp Wed Apr 30 12:55:02 1997 @@ -0,0 +1,87 @@ +# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +# Written by Cygnus Support. + +proc do_fp {} { + set testname "fp.s: floating point tests (sh3e)" + set x 0 + + gas_start "fp.s" "-al" + + # Check the assembled instruction against a table built by the HP assembler + # Any differences should be checked by hand -- with the number of problems + # I've seen in the HP assembler I don't completely trust it. + # + # Instead of having a variable for each match string just increment the + # total number of matches seen. That's simpler when testing large numbers + # of instructions (as these tests to). + while 1 { + expect { + -re "^ +\[0-9\]+ 0000 F008\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0002 F00A\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0004 F009\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0006 F00B\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0008 F006\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000a F007\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000c F10C\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 000e F08D\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0010 F09D\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0012 F100\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0014 F101\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0016 F102\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0018 F103\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001a F10E\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001c F104\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 001e F105\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0020 F07D\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0022 F04D\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0024 F05D\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0026 F06D\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0028 F02D\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002a F03D\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002c F00D\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 002e F01D\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0030 435A\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0032 4356\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0034 436A\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0036 4366\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 0038 035A\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 003a 4352\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 003c 036A\[^\n\]*\n" { set x [expr $x+1] } + -re "^ +\[0-9\]+ 003e 4362\[^\n\]*\n" { set x [expr $x+1] } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x==32] then { pass $testname } else { fail $testname } +} + + +if [istarget sh*-*-*] then { + # Test the basic instruction parser. + do_fp +} diff -urN binutils-2.7/gas/testsuite/gas/sh/fp.s binutils-2.8/gas/testsuite/gas/sh/fp.s --- binutils-2.7/gas/testsuite/gas/sh/fp.s Wed Dec 31 19:00:00 1969 +++ binutils-2.8/gas/testsuite/gas/sh/fp.s Wed Apr 30 12:55:02 1997 @@ -0,0 +1,45 @@ + .file "test.c" + .data + +! Hitachi SH cc1 (cygnus-2.7.1-950728) arguments: -O -fpeephole +! -ffunction-cse -freg-struct-return -fdelayed-branch -fcommon -fgnu-linker + +gcc2_compiled.: +___gnu_compiled_c: + .text + .align 2 + .global _foo +_foo: + fmov.s @r0,fr0 + fmov.s fr0,@r0 + fmov.s @r0+,fr0 + fmov.s fr0,@-r0 + fmov.s @(r0,r0),fr0 + fmov.s fr0,@(r0,r0) + fmov fr0,fr1 + fldi0 fr0 + fldi1 fr0 + fadd fr0,fr1 + fsub fr0,fr1 + fmul fr0,fr1 + fdiv fr0,fr1 + fmac fr0,fr0,fr1 + fcmp/eq fr0,fr1 + fcmp/gt fr0,fr1 + ftst/nan fr0 + fneg fr0 + fabs fr0 + fsqrt fr0 + float fpul,fr0 + ftrc fr0,fpul + fsts fpul,fr0 + flds fr0,fpul + lds r3,fpul + lds.l @r3+,fpul + lds r3,fpscr + lds.l @r3+,fpscr + sts fpul,r3 + sts.l fpul,@-r3 + sts fpscr,r3 + sts.l fpscr,@-r3 + diff -urN binutils-2.7/gas/testsuite/gas/sparc/asi.s binutils-2.8/gas/testsuite/gas/sparc/asi.s --- binutils-2.7/gas/testsuite/gas/sparc/asi.s Thu Jul 4 12:16:05 1996 +++ binutils-2.8/gas/testsuite/gas/sparc/asi.s Wed Apr 30 12:55:03 1997 @@ -16,8 +16,8 @@ lduwa [%g1]#ASI_SNF_L,%g2 lduwa [%g1]#ASI_AS_IF_USER_PRIMARY,%g2 lduwa [%g1]#ASI_AS_IF_USER_SECONDARY,%g2 - lduwa [%g1]#ASI_AS_IF_USER_PRIMARY_L,%g2 - lduwa [%g1]#ASI_AS_IF_USER_SECONDARY_L,%g2 + lduwa [%g1]#ASI_AS_IF_USER_PRIMARY_LITTLE,%g2 + lduwa [%g1]#ASI_AS_IF_USER_SECONDARY_LITTLE,%g2 lduwa [%g1]#ASI_PRIMARY,%g2 lduwa [%g1]#ASI_SECONDARY,%g2 lduwa [%g1]#ASI_PRIMARY_NOFAULT,%g2 diff -urN binutils-2.7/gas/testsuite/gas/sparc/synth.d binutils-2.8/gas/testsuite/gas/sparc/synth.d --- binutils-2.7/gas/testsuite/gas/sparc/synth.d Thu Jul 4 12:16:06 1996 +++ binutils-2.8/gas/testsuite/gas/sparc/synth.d Wed Apr 30 12:55:04 1997 @@ -1,5 +1,5 @@ #as: -Av7 -#objdump: -dr +#objdump: -dr --prefix-addresses #name: sparc synth .*: +file format .* diff -urN binutils-2.7/gas/testsuite/gas/sparc/synth64.d binutils-2.8/gas/testsuite/gas/sparc/synth64.d --- binutils-2.7/gas/testsuite/gas/sparc/synth64.d Thu Jul 4 12:16:06 1996 +++ binutils-2.8/gas/testsuite/gas/sparc/synth64.d Wed Apr 30 12:55:05 1997 @@ -1,5 +1,5 @@ #as: -Av9 -#objdump: -dr +#objdump: -dr --prefix-addresses #name: sparc64 synth64 .*: +file format .*sparc.* diff -urN binutils-2.7/gas/testsuite/gas/sparc-solaris/addend.exp binutils-2.8/gas/testsuite/gas/sparc-solaris/addend.exp --- binutils-2.7/gas/testsuite/gas/sparc-solaris/addend.exp Thu Jul 4 12:16:07 1996 +++ binutils-2.8/gas/testsuite/gas/sparc-solaris/addend.exp Wed Apr 30 12:55:08 1997 @@ -1,8 +1,8 @@ # -# SunOS4 on SPARC tests +# Solaris on SPARC tests # -if [istarget sparc-*-solaris2*] then { +if [istarget sparc*-*-solaris2*] then { set x1 0 set x2 0 set x3 0 @@ -15,13 +15,13 @@ while 1 { # These are what we get using the Solaris assembler. expect { - -re "08 R_SPARC_WDISP22 +foo1\[+\]+0x0+04\r\n" { incr x1 } - -re "0c R_SPARC_WDISP22 +foo1\[+\]+0x0+04\r\n" { incr x2 } - -re "10 R_SPARC_WDISP22 +foo1\r\n" { incr x3 } - -re "14 R_SPARC_WDISP22 +foo1\r\n" { incr x4 } - -re "1c R_SPARC_32 +foo1\r\n" { incr x5 } - -re "20 R_SPARC_32 +foo1\[+\]+0x0*04\r\n" { incr x6 } - -re "\[^\n\]*\n" { } + -re "08 R_SPARC_WDISP22 +foo1\[+\]+0x0+04\[^\n\]*\n" { incr x1 } + -re "0c R_SPARC_WDISP22 +foo1\[+\]+0x0+04\[^\n\]*\n" { incr x2 } + -re "10 R_SPARC_WDISP22 +foo1\[^\n\]*\n" { incr x3 } + -re "14 R_SPARC_WDISP22 +foo1\[^\n\]*\n" { incr x4 } + -re "1c R_SPARC_32 +foo1\[^\n\]*\n" { incr x5 } + -re "20 R_SPARC_32 +foo1\[+\]+0x0+04\[^\n\]*\n" { incr x6 } + -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } diff -urN binutils-2.7/gas/testsuite/gasp/gasp.exp binutils-2.8/gas/testsuite/gasp/gasp.exp --- binutils-2.7/gas/testsuite/gasp/gasp.exp Thu Jul 4 12:16:11 1996 +++ binutils-2.8/gas/testsuite/gasp/gasp.exp Wed Apr 30 12:55:17 1997 @@ -8,7 +8,7 @@ send_log "$srcdir/lib/run $GASP -I$srcdir/gasp -s $opt $filename.asm -o gasp.out\n" catch "exec $srcdir/lib/run $GASP -I$srcdir/gasp -s $opt $filename.asm -o gasp.out" errs catch "exec diff gasp.out $filename.out" diffs - set diffs [prune_system_crud $host_triplet $diffs] + set diffs [prune_warnings $diffs] if ![string match "" $diffs] { send_log "$diffs\n" verbose $diffs diff -urN binutils-2.7/gas/testsuite/lib/gas-defs.exp binutils-2.8/gas/testsuite/lib/gas-defs.exp --- binutils-2.7/gas/testsuite/lib/gas-defs.exp Thu Jul 4 12:16:27 1996 +++ binutils-2.8/gas/testsuite/lib/gas-defs.exp Wed Apr 30 12:55:31 1997 @@ -1,4 +1,4 @@ -# Copyright (C) 1993, 1994 Free Software Foundation, Inc. +# Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # DejaGnu@cygnus.com @@ -24,10 +24,11 @@ catch "exec $AS -version < /dev/null" tmp # Should find a way to discard constant parts, keep whatever's # left, so the version string could be almost anything at all... - regexp "version (cygnus-|)\[-0-9.a-zA-Z-\]+" $tmp version - set tmp $version - clone_output "[which $AS] $version\n" - unset tmp + regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" $tmp version cyg number + if ![info exists number] then { + return "[which $AS] (no version number)\n" + } + clone_output "[which $AS] $number\n" unset version } @@ -39,9 +40,11 @@ global subdir global host_triplet - verbose "Executing $AS $ASFLAGS $as_opts $prog $redir" + verbose "Executing $srcdir/lib/run $AS $ASFLAGS $as_opts $srcdir/$subdir/$prog $redir" catch "exec $srcdir/lib/run $AS $ASFLAGS $as_opts $srcdir/$subdir/$prog $redir" comp_output - set comp_output [prune_system_crud $host_triplet $comp_output] + set comp_output [prune_warnings $comp_output] + verbose "output was $comp_output" + return [list $comp_output ""]; } proc all_ones { args } { @@ -154,7 +157,7 @@ proc gas_exit {} {} -proc gas_init {} { +proc gas_init { args } { global target_cpu global target_cpu_family global target_family @@ -261,7 +264,7 @@ send_log "$AS $ASFLAGS $opts(as) -o dump.o $sourcefile\n" catch "exec $srcdir/lib/run $AS $ASFLAGS $opts(as) -o dump.o $sourcefile" comp_output - set comp_output [prune_system_crud $host_triplet $comp_output] + set comp_output [prune_warnings $comp_output] if ![string match "" $comp_output] then { send_log "$comp_output\n" @@ -280,7 +283,7 @@ if { $program == "objcopy" } { send_log "$binary $progopts $progopts1 dump.o dump.out\n" catch "exec $binary $progopts $progopts1 dump.o dump.out" comp_output - set comp_output [prune_system_crud $host_triplet $comp_output] + set comp_output [prune_warnings $comp_output] if ![string match "" $comp_output] then { send_log "$comp_output\n" fail $testname @@ -289,7 +292,7 @@ } else { send_log "$binary $progopts $progopts1 dump.o > dump.out\n" catch "exec $binary $progopts $progopts1 dump.o > dump.out" comp_output - set comp_output [prune_system_crud $host_triplet $comp_output] + set comp_output [prune_warnings $comp_output] if ![string match "" $comp_output] then { send_log "$comp_output\n" fail $testname @@ -300,6 +303,7 @@ verbose_eval {[file_contents "dump.out"]} 3 if { [regexp_diff "dump.out" "${file}.d"] } then { fail $testname + verbose "output is [file_contents "dump.out"]" 2 return } @@ -339,7 +343,7 @@ global host_triplet catch "exec $OBJDUMP $opts" comp_output - set comp_output [prune_system_crud $host_triplet $comp_output] + set comp_output [prune_warnings $comp_output] verbose "objdump output=$comp_output\n" 3 } @@ -461,19 +465,16 @@ # This definition is taken from an unreleased version of DejaGnu. Once # that version gets released, and has been out in the world for a few # months at least, it may be safe to delete this copy. -if ![string length [info proc prune_system_crud]] { +if ![string length [info proc prune_warnings]] { # - # prune_system_crud -- delete various system verbosities from TEXT on SYSTEM + # prune_warnings -- delete various system verbosities from TEXT. # # An example is: # ld.so: warning: /usr/lib/libc.so.1.8.1 has older revision than expected 9 # - # SYSTEM is typical $target_triplet or $host_triplet. - # - # This is useful when trying to do pattern matches on program output. # Sites with particular verbose os's may wish to override this in site.exp. # - proc prune_system_crud { system text } { + proc prune_warnings { text } { # This is from sun4's. Do it for all machines for now. # The "\\1" is to try to preserve a "\n" but only if necessary. regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text diff -urN binutils-2.7/gas/testsuite/lib/gas-dg.exp binutils-2.8/gas/testsuite/lib/gas-dg.exp --- binutils-2.7/gas/testsuite/lib/gas-dg.exp Thu Jul 4 12:16:27 1996 +++ binutils-2.8/gas/testsuite/lib/gas-dg.exp Wed Apr 30 12:55:31 1997 @@ -40,9 +40,7 @@ } # FIXME: This should be gas_start but it doesn't set comp_output. - gas_run $prog $tool_flags "" - - return $output_file + return [gas_run $prog $tool_flags ""] } proc gas-dg-prune { system text } { diff -urN binutils-2.7/gas/write.c binutils-2.8/gas/write.c --- binutils-2.7/gas/write.c Thu Jul 4 12:13:21 1996 +++ binutils-2.8/gas/write.c Wed Apr 30 12:53:41 1997 @@ -1,5 +1,5 @@ /* write.c - emit .o file - Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* This thing should be set up to do byteordering correctly. But... */ @@ -111,6 +112,26 @@ static long fixup_segment PARAMS ((fixS * fixP, segT this_segment_type)); #endif static relax_addressT relax_align PARAMS ((relax_addressT addr, int align)); +#if defined (BFD_ASSEMBLER) || ! defined (BFD) +static fragS *chain_frchains_together_1 PARAMS ((segT, struct frchain *)); +#endif +#ifdef BFD_ASSEMBLER +static void chain_frchains_together PARAMS ((bfd *, segT, PTR)); +static void cvt_frag_to_fill PARAMS ((segT, fragS *)); +static void relax_and_size_seg PARAMS ((bfd *, asection *, PTR)); +static void adjust_reloc_syms PARAMS ((bfd *, asection *, PTR)); +static void write_relocs PARAMS ((bfd *, asection *, PTR)); +static void write_contents PARAMS ((bfd *, asection *, PTR)); +static void set_symtab PARAMS ((void)); +#endif +#if defined (BFD_ASSEMBLER) || (! defined (BFD) && ! defined (OBJ_AOUT)) +static void merge_data_into_text PARAMS ((void)); +#endif +#if ! defined (BFD_ASSEMBLER) && ! defined (BFD) +static void cvt_frag_to_fill PARAMS ((object_headers *, segT, fragS *)); +static void remove_subsegs PARAMS ((frchainS *, int, fragS **, fragS **)); +static void relax_and_size_all_segments PARAMS ((void)); +#endif /* * fix_new() @@ -162,6 +183,8 @@ fixP->fx_addnumber = 0; fixP->fx_tcbit = 0; fixP->fx_done = 0; + fixP->fx_no_overflow = 0; + fixP->fx_signed = 0; #ifdef TC_FIX_TYPE TC_INIT_FIX_DATA(fixP); @@ -257,7 +280,6 @@ /* This comes up when _GLOBAL_OFFSET_TABLE_+(.-L0) is read, if the difference expression cannot immediately be reduced. */ { - extern symbolS *make_expr_symbol (); symbolS *stmp = make_expr_symbol (exp); exp->X_op = O_symbol; exp->X_op_symbol = 0; @@ -295,9 +317,10 @@ case O_constant: off = exp->X_add_number; break; - + default: - as_bad ("expression too complex for fixup"); + add = make_expr_symbol (exp); + break; } return fix_new_internal (frag, where, size, add, sub, off, @@ -319,7 +342,7 @@ *charPP += length; } -#ifndef BFD_ASSEMBLER +#ifndef BFD_ASSEMBLER int section_alignment[SEG_MAXIMUM_ORDINAL]; #endif @@ -329,7 +352,7 @@ * boundary, all of the other alignments within it will work. At * least one object format really uses this info. */ -void +void record_alignment (seg, align) /* Segment to which alignment pertains */ segT seg; @@ -427,7 +450,7 @@ #if !defined (BFD) && !defined (BFD_ASSEMBLER) -void +static void remove_subsegs (head, seg, root, last) frchainS *head; int seg; @@ -666,7 +689,27 @@ #endif sym = fixp->fx_addsy; - symsec = sym->bsym->section; + + /* All symbols should have already been resolved at this + point. It is possible to see unresolved expression + symbols, though, since they are not in the regular symbol + table. */ + if (sym != NULL && ! sym->sy_resolved) + resolve_symbol_value (sym); + if (fixp->fx_subsy != NULL && ! fixp->fx_subsy->sy_resolved) + resolve_symbol_value (fixp->fx_subsy); + + /* If this symbol is equated to an undefined symbol, convert + the fixup to being against that symbol. */ + if (sym->sy_value.X_op == O_symbol + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) + { + fixp->fx_offset += sym->sy_value.X_add_number; + sym = sym->sy_value.X_add_symbol; + fixp->fx_addsy = sym; + } + + symsec = S_GET_SEGMENT (sym); if (sym != NULL && sym->sy_mri_common) { @@ -708,6 +751,40 @@ goto done; } + /* Don't try to reduce relocs which refer to .linkonce + sections. It can lead to confusion when a debugging + section refers to a .linkonce section. I hope this will + always be correct. */ + if (symsec != sec) + { + boolean linkonce; + + linkonce = false; +#ifdef BFD_ASSEMBLER + if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE) + != 0) + linkonce = true; +#endif +#ifdef OBJ_ELF + /* The GNU toolchain uses an extension for ELF: a section + beginning with the magic string .gnu.linkonce is a + linkonce section. */ + if (strncmp (segment_name (symsec), ".gnu.linkonce", + sizeof ".gnu.linkonce" - 1) == 0) + linkonce = true; +#endif + + if (linkonce) + { + fixp->fx_addsy->sy_used_in_reloc = 1; +#ifdef UNDEFINED_DIFFERENCE_OK + if (fixp->fx_subsy != NULL) + fixp->fx_subsy->sy_used_in_reloc = 1; +#endif + goto done; + } + } + /* Since we're reducing to section symbols, don't attempt to reduce anything that's already using one. */ if (sym->bsym->flags & BSF_SECTION_SYM) @@ -727,7 +804,7 @@ #endif /* Is there some other (target cpu dependent) reason we can't adjust - this one? (E.g. relocations involving function addresses on + this one? (E.g. relocations involving function addresses on the PA. */ #ifdef tc_fix_adjustable if (! tc_fix_adjustable (fixp)) @@ -737,27 +814,6 @@ } #endif - /* For PIC support: We may get expressions like - "_GLOBAL_OFFSET_TABLE_+(.-L5)" where "." and "L5" may not - necessarily have had a fixed difference initially. But now - it should be a known constant, so we can reduce it. Since - we can't easily handle a symbol value that looks like - someUndefinedSymbol+const, though, we convert the fixup to - access the undefined symbol directly, and discard the - intermediate symbol. */ - if (S_GET_SEGMENT (sym) == expr_section - && sym->sy_value.X_op == O_add - && (resolve_symbol_value (sym->sy_value.X_add_symbol), - S_GET_SEGMENT (sym->sy_value.X_add_symbol) == undefined_section) - && (resolve_symbol_value (sym->sy_value.X_op_symbol), - S_GET_SEGMENT (sym->sy_value.X_op_symbol) == absolute_section)) - { - fixp->fx_offset += S_GET_VALUE (sym->sy_value.X_op_symbol); - fixp->fx_offset += sym->sy_value.X_add_number; - fixp->fx_addsy = sym->sy_value.X_add_symbol; - goto reduce_fixup; - } - /* If the section symbol isn't going to be output, the relocs at least should still work. If not, figure out what to do when we run into that case. @@ -814,8 +870,7 @@ #ifndef RELOC_EXPANSION_POSSIBLE /* Set up reloc information as well. */ - relocs = (arelent **) bfd_alloc_by_size_t (stdoutput, - n * sizeof (arelent *)); + relocs = (arelent **) xmalloc (n * sizeof (arelent *)); memset ((char*)relocs, 0, n * sizeof (arelent*)); i = 0; @@ -837,7 +892,17 @@ sym = fixp->fx_addsy; while (sym->sy_value.X_op == O_symbol && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) - sym = sym->sy_value.X_add_symbol; + { + symbolS *n; + + /* We must avoid looping, as that can occur with a badly + written program. */ + n = sym->sy_value.X_add_symbol; + if (n == sym) + break; + fixp->fx_offset += sym->sy_value.X_add_number; + sym = n; + } fixp->fx_addsy = sym; reloc = tc_gen_reloc (sec, fixp); @@ -846,9 +911,13 @@ n--; continue; } + +#if 0 + /* This test is triggered inappropriately for the SH. */ if (fixp->fx_where + fixp->fx_size > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset) abort (); +#endif s = bfd_install_relocation (stdoutput, reloc, fixp->fx_frag->fr_literal, @@ -862,7 +931,7 @@ as_bad_where (fixp->fx_file, fixp->fx_line, "relocation overflow"); break; default: - as_fatal ("%s:%u: bad return from bfd_perform_relocation", + as_fatal ("%s:%u: bad return from bfd_install_relocation", fixp->fx_file, fixp->fx_line); } relocs[i++] = reloc; @@ -870,8 +939,7 @@ #else n = n * MAX_RELOC_EXPANSION; /* Set up reloc information as well. */ - relocs = (arelent **) bfd_alloc_by_size_t (stdoutput, - n * sizeof (arelent *)); + relocs = (arelent **) xmalloc (n * sizeof (arelent *)); i = 0; for (fixp = seginfo->fix_root; fixp != (fixS *) NULL; fixp = fixp->fx_next) @@ -907,7 +975,8 @@ data = fixp->fx_frag->fr_literal + fixp->fx_where; if (fixp->fx_where + fixp->fx_size > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset) - abort (); + as_bad_where (fixp->fx_file, fixp->fx_line, + "internal error: fixup not contained within frag"); for (j = 0; reloc[j]; j++) { s = bfd_install_relocation (stdoutput, reloc[j], @@ -923,7 +992,7 @@ "relocation overflow"); break; default: - as_fatal ("%s:%u: bad return from bfd_perform_relocation", + as_fatal ("%s:%u: bad return from bfd_install_relocation", fixp->fx_file, fixp->fx_line); } } @@ -1232,7 +1301,7 @@ } #endif -void +void write_object_file () { struct frchain *frchainP; /* Track along all frchains. */ @@ -1287,7 +1356,7 @@ for (frchainP = frchain_root; frchainP; frchainP = frchainP->frch_next) { subseg_set (frchainP->frch_seg, frchainP->frch_subseg); - frag_align (SUB_SEGMENT_ALIGN (now_seg), NOP_OPCODE); + frag_align (SUB_SEGMENT_ALIGN (now_seg), NOP_OPCODE, 0); /* frag_align will have left a new frag. Use this last frag for an empty ".fill". @@ -1429,7 +1498,7 @@ #else fix_new_exp (lie->frag, lie->word_goes_here - lie->frag->fr_literal, - 2, &exp, 0, BFD_RELOC_NONE); + 2, &exp, 0, BFD_RELOC_16); #endif #else #if defined(TC_SPARC) || defined(TC_A29K) || defined(NEED_FX_R_TYPE) @@ -1640,6 +1709,13 @@ PROGRESS (1); +#ifdef tc_frob_file_before_adjust + tc_frob_file_before_adjust (); +#endif +#ifdef obj_frob_file_before_adjust + obj_frob_file_before_adjust (); +#endif + bfd_map_over_sections (stdoutput, adjust_reloc_syms, (char *)0); /* Set up symbol table, and write it out. */ @@ -1782,6 +1858,13 @@ bfd_map_over_sections (stdoutput, write_relocs, (char *) 0); +#ifdef tc_frob_file_after_relocs + tc_frob_file_after_relocs (); +#endif +#ifdef obj_frob_file_after_relocs + obj_frob_file_after_relocs (); +#endif + bfd_map_over_sections (stdoutput, write_contents, (char *) 0); #endif /* BFD_ASSEMBLER */ } @@ -1800,14 +1883,15 @@ * these frag addresses may not be the same as final object-file addresses. */ -#ifndef md_relax_frag #ifdef TC_GENERIC_RELAX_TABLE +static int is_dnrange PARAMS ((fragS *, fragS *)); + /* Subroutines of relax_segment. */ -static int +static int is_dnrange (f1, f2) - struct frag *f1; - struct frag *f2; + fragS *f1; + fragS *f2; { for (; f1; f1 = f1->fr_next) if (f1->fr_next == f2) @@ -1815,8 +1899,111 @@ return 0; } +/* Relax a fragment by scanning TC_GENERIC_RELAX_TABLE. */ + +long +relax_frag (fragP, stretch) + fragS *fragP; + long stretch; +{ + const relax_typeS *this_type; + const relax_typeS *start_type; + relax_substateT next_state; + relax_substateT this_state; + long aim, target, growth; + symbolS *symbolP = fragP->fr_symbol; + long offset = fragP->fr_offset; + /* Recompute was_address by undoing "+= stretch" done by relax_segment. */ + unsigned long was_address = fragP->fr_address - stretch; + unsigned long address = fragP->fr_address; + const relax_typeS *table = TC_GENERIC_RELAX_TABLE; + + this_state = fragP->fr_subtype; + start_type = this_type = table + this_state; + target = offset; + + if (symbolP) + { +#ifndef DIFF_EXPR_OK +#if !defined (MANY_SEGMENTS) && !defined (BFD_ASSEMBLER) + know ((S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE) + || (S_GET_SEGMENT (symbolP) == SEG_DATA) + || (S_GET_SEGMENT (symbolP) == SEG_BSS) + || (S_GET_SEGMENT (symbolP) == SEG_TEXT)); +#endif + know (symbolP->sy_frag); +#endif + know (!(S_GET_SEGMENT (symbolP) == absolute_section) + || symbolP->sy_frag == &zero_address_frag); + target += + S_GET_VALUE (symbolP) + + symbolP->sy_frag->fr_address; + + /* If frag has yet to be reached on this pass, + assume it will move by STRETCH just as we did. + If this is not so, it will be because some frag + between grows, and that will force another pass. + + Beware zero-length frags. + + There should be a faster way to do this. */ + + if (symbolP->sy_frag->fr_address >= was_address + && is_dnrange (fragP, symbolP->sy_frag)) + { + target += stretch; + } + } + + aim = target - address - fragP->fr_fix; +#ifdef TC_PCREL_ADJUST + /* Currently only the ns32k family needs this */ + aim += TC_PCREL_ADJUST(fragP); +/*#else*/ + /* This machine doesn't want to use pcrel_adjust. + In that case, pcrel_adjust should be zero. */ +/* assert (fragP->fr_targ.ns32k.pcrel_adjust == 0);*/ +#endif +#ifdef md_prepare_relax_scan /* formerly called M68K_AIM_KLUDGE */ + md_prepare_relax_scan (fragP, address, aim, this_state, this_type); +#endif + + if (aim < 0) + { + /* Look backwards. */ + for (next_state = this_type->rlx_more; next_state;) + if (aim >= this_type->rlx_backward) + next_state = 0; + else + { + /* Grow to next state. */ + this_state = next_state; + this_type = table + this_state; + next_state = this_type->rlx_more; + } + } + else + { + /* Look forwards. */ + for (next_state = this_type->rlx_more; next_state;) + if (aim <= this_type->rlx_forward) + next_state = 0; + else + { + /* Grow to next state. */ + this_state = next_state; + this_type = table + this_state; + next_state = this_type->rlx_more; + } + } + + growth = this_type->rlx_length - start_type->rlx_length; + if (growth != 0) + fragP->fr_subtype = this_state; + return growth; +} + #endif /* defined (TC_GENERIC_RELAX_TABLE) */ -#endif /* ! defined (md_relax_frag) */ /* Relax_align. Advance location counter to next address that has 'alignment' lowest order bits all 0s, return size of adjustment made. */ @@ -1839,7 +2026,7 @@ return (new_address - address); } -void +void relax_segment (segment_frag_root, segment) struct frag *segment_frag_root; segT segment; @@ -1869,13 +2056,18 @@ case rs_align: case rs_align_code: { - int offset = relax_align (address, (int) fragP->fr_offset); + addressT offset = relax_align (address, (int) fragP->fr_offset); + + if (fragP->fr_subtype != 0 && offset > fragP->fr_subtype) + offset = 0; + if (offset % fragP->fr_var != 0) { - as_bad ("alignment padding (%d bytes) not a multiple of %ld", - offset, (long) fragP->fr_var); + as_bad ("alignment padding (%lu bytes) not a multiple of %ld", + (unsigned long) offset, (long) fragP->fr_var); offset -= (offset % fragP->fr_var); } + address += offset; } break; @@ -1918,11 +2110,9 @@ for (fragP = segment_frag_root; fragP; fragP = fragP->fr_next) { long growth = 0; - unsigned long was_address; - long offset; + addressT was_address; + offsetT offset; symbolS *symbolP; - long target; - long after; was_address = fragP->fr_address; address = fragP->fr_address += stretch; @@ -1998,53 +2188,71 @@ #endif case rs_align: case rs_align_code: - growth = (relax_align ((relax_addressT) (address - + fragP->fr_fix), - (int) offset) - - relax_align ((relax_addressT) (was_address - + fragP->fr_fix), - (int) offset)); + { + addressT oldoff, newoff; + + oldoff = relax_align (was_address + fragP->fr_fix, + (int) offset); + newoff = relax_align (address + fragP->fr_fix, + (int) offset); + + if (fragP->fr_subtype != 0) + { + if (oldoff > fragP->fr_subtype) + oldoff = 0; + if (newoff > fragP->fr_subtype) + newoff = 0; + } + + growth = newoff - oldoff; + } break; case rs_org: - target = offset; + { + long target = offset; + long after; - if (symbolP) - { + if (symbolP) + { #if !defined (MANY_SEGMENTS) && !defined (BFD_ASSEMBLER) - know ((S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE) - || (S_GET_SEGMENT (symbolP) == SEG_DATA) - || (S_GET_SEGMENT (symbolP) == SEG_TEXT) - || S_GET_SEGMENT (symbolP) == SEG_BSS); - know (symbolP->sy_frag); - know (!(S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE) - || (symbolP->sy_frag == &zero_address_frag)); -#endif - target += S_GET_VALUE (symbolP) - + symbolP->sy_frag->fr_address; - } /* if we have a symbol */ - - know (fragP->fr_next); - after = fragP->fr_next->fr_address; - growth = target - after; - if (growth < 0) - { - /* Growth may be negative, but variable part of frag - cannot have fewer than 0 chars. That is, we can't - .org backwards. */ - as_bad ("attempt to .org backwards ignored"); - growth = 0; - } + know ((S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE) + || (S_GET_SEGMENT (symbolP) == SEG_DATA) + || (S_GET_SEGMENT (symbolP) == SEG_TEXT) + || S_GET_SEGMENT (symbolP) == SEG_BSS); + know (symbolP->sy_frag); + know (!(S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE) + || (symbolP->sy_frag == &zero_address_frag)); +#endif + target += S_GET_VALUE (symbolP) + + symbolP->sy_frag->fr_address; + } /* if we have a symbol */ - growth -= stretch; /* This is an absolute growth factor */ - break; + know (fragP->fr_next); + after = fragP->fr_next->fr_address; + growth = target - after; + if (growth < 0) + { + /* Growth may be negative, but variable part of frag + cannot have fewer than 0 chars. That is, we can't + .org backwards. */ + as_bad ("attempt to .org backwards ignored"); + growth = 0; + } + + growth -= stretch; /* This is an absolute growth factor */ + break; + } case rs_space: if (symbolP) { growth = S_GET_VALUE (symbolP); - if (symbolP->sy_frag != &zero_address_frag) - as_bad (".space specifies non-absolute value"); + if (symbolP->sy_frag != &zero_address_frag + || S_IS_COMMON (symbolP) + || ! S_IS_DEFINED (symbolP)) + as_bad_where (fragP->fr_file, fragP->fr_line, + ".space specifies non-absolute value"); fragP->fr_symbol = 0; if (growth < 0) { @@ -2062,98 +2270,8 @@ #else #ifdef TC_GENERIC_RELAX_TABLE /* The default way to relax a frag is to look through - md_relax_table. */ - { - const relax_typeS *this_type; - const relax_typeS *start_type; - relax_substateT next_state; - relax_substateT this_state; - long aim; - const relax_typeS *table = TC_GENERIC_RELAX_TABLE; - - this_state = fragP->fr_subtype; - start_type = this_type = table + this_state; - target = offset; - - if (symbolP) - { -#ifndef DIFF_EXPR_OK -#if !defined (MANY_SEGMENTS) && !defined (BFD_ASSEMBLER) - know ((S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE) - || (S_GET_SEGMENT (symbolP) == SEG_DATA) - || (S_GET_SEGMENT (symbolP) == SEG_BSS) - || (S_GET_SEGMENT (symbolP) == SEG_TEXT)); -#endif - know (symbolP->sy_frag); -#endif - know (!(S_GET_SEGMENT (symbolP) == absolute_section) - || symbolP->sy_frag == &zero_address_frag); - target += - S_GET_VALUE (symbolP) - + symbolP->sy_frag->fr_address; - - /* If frag has yet to be reached on this pass, - assume it will move by STRETCH just as we did. - If this is not so, it will be because some frag - between grows, and that will force another pass. - - Beware zero-length frags. - - There should be a faster way to do this. */ - - if (symbolP->sy_frag->fr_address >= was_address - && is_dnrange (fragP, symbolP->sy_frag)) - { - target += stretch; - } - } - - aim = target - address - fragP->fr_fix; -#ifdef TC_PCREL_ADJUST - /* Currently only the ns32k family needs this */ - aim += TC_PCREL_ADJUST(fragP); -#else - /* This machine doesn't want to use pcrel_adjust. - In that case, pcrel_adjust should be zero. */ - assert (fragP->fr_pcrel_adjust == 0); -#endif - - if (aim < 0) - { - /* Look backwards. */ - for (next_state = this_type->rlx_more; next_state;) - if (aim >= this_type->rlx_backward) - next_state = 0; - else - { - /* Grow to next state. */ - this_state = next_state; - this_type = table + this_state; - next_state = this_type->rlx_more; - } - } - else - { -#ifdef M68K_AIM_KLUDGE - M68K_AIM_KLUDGE (aim, this_state, this_type); -#endif - /* Look forwards. */ - for (next_state = this_type->rlx_more; next_state;) - if (aim <= this_type->rlx_forward) - next_state = 0; - else - { - /* Grow to next state. */ - this_state = next_state; - this_type = table + this_state; - next_state = this_type->rlx_more; - } - } - - growth = this_type->rlx_length - start_type->rlx_length; - if (growth != 0) - fragP->fr_subtype = this_state; - } + TC_GENERIC_RELAX_TABLE. */ + growth = relax_frag (fragP, stretch); #endif /* TC_GENERIC_RELAX_TABLE */ #endif break; @@ -2214,7 +2332,7 @@ int pcrel, plt; fragS *fragP; segT add_symbol_segment = absolute_section; - + /* If the linker is doing the relaxing, we must not do any fixups. Well, strictly speaking that's not true -- we could do any that are @@ -2262,7 +2380,7 @@ if (add_symbolP) add_symbol_segment = S_GET_SEGMENT (add_symbolP); - + if (sub_symbolP) { resolve_symbol_value (sub_symbolP); @@ -2399,7 +2517,7 @@ add_number += S_GET_VALUE (add_symbolP); add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type); pcrel = 0; /* Lie. Don't want further pcrel processing. */ - + /* Let the target machine make the final determination as to whether or not a relocation will be needed to handle this fixup. */ @@ -2411,7 +2529,8 @@ } else { - if (add_symbol_segment == absolute_section) + if (add_symbol_segment == absolute_section + && ! pcrel) { #ifdef TC_I960 /* See comment about reloc_callj() above. */ @@ -2422,7 +2541,7 @@ /* Let the target machine make the final determination as to whether or not a relocation will be needed to handle this fixup. */ - + if (!TC_FORCE_RELOCATION (fixP)) { fixP->fx_addsy = NULL; @@ -2450,7 +2569,7 @@ continue; } /* COBR */ #endif /* TC_I960 */ - + #ifdef OBJ_COFF #ifdef TE_I386AIX if (S_IS_COMMON (add_symbolP)) @@ -2488,10 +2607,12 @@ if (!fixP->fx_bit_fixP && !fixP->fx_no_overflow && size > 0) { - valueT mask = 0; - if (size < sizeof (mask)) + if (size < sizeof (valueT)) { + valueT mask, hibit; + /* set all bits to one */ + mask = 0; mask--; /* Technically, combining these produces an undefined result if size is sizeof (valueT), though I think these two @@ -2500,8 +2621,12 @@ the host architecture. */ mask <<= size * 4; mask <<= size * 4; - if ((add_number & mask) != 0 - && (add_number & mask) != mask) + hibit = (valueT) 1 << (size * 8 - 1); + if (((add_number & mask) != 0 + || (fixP->fx_signed + && (add_number & hibit) != 0)) + && ((add_number & mask) != mask + || (add_number & hibit) == 0)) { char buf[50], buf2[50]; sprint_value (buf, fragP->fr_address + where); @@ -2602,7 +2727,6 @@ /* for debugging */ extern int indent_level; -extern void print_symbol_value_1 (); void print_fixup (fixp) diff -urN binutils-2.7/gas/write.h binutils-2.8/gas/write.h --- binutils-2.7/gas/write.h Thu Jul 4 12:13:21 1996 +++ binutils-2.8/gas/write.h Wed Apr 30 12:53:41 1997 @@ -1,5 +1,5 @@ /* write.h - Copyright (C) 1987, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1987, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -14,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #ifndef TC_I960 #ifdef hpux @@ -23,15 +24,19 @@ #endif #endif /* TC_I960 */ +#ifndef BFD_ASSEMBLER + #ifndef LOCAL_LABEL #define LOCAL_LABEL(name) (name [0] == 'L' ) -#endif /* LOCAL_LABEL */ - -#ifndef FAKE_LABEL_NAME -#define FAKE_LABEL_NAME "L0\001" #endif -#define S_LOCAL_NAME(s) (LOCAL_LABEL(S_GET_NAME(s))) +#define S_LOCAL_NAME(s) (LOCAL_LABEL (S_GET_NAME (s))) + +#endif /* ! BFD_ASSEMBLER */ + +/* This is the name of a fake symbol which will never appear in the + assembler output. S_IS_LOCAL detects it because of the \001. */ +#define FAKE_LABEL_NAME "L0\001" #include "bit_fix.h" @@ -78,6 +83,9 @@ @@ Can this be determined from BFD? */ unsigned fx_no_overflow : 1; + /* The value is signed when checking for overflow. */ + unsigned fx_signed : 1; + /* Which frag does this fix apply to? */ fragS *fx_frag; @@ -158,6 +166,7 @@ extern void append PARAMS ((char **charPP, char *fromP, unsigned long length)); extern void record_alignment PARAMS ((segT seg, int align)); extern void write_object_file PARAMS ((void)); +extern long relax_frag PARAMS ((fragS *, long)); extern void relax_segment PARAMS ((struct frag * seg_frag_root, segT seg_type)); diff -urN binutils-2.7/gas/xmalloc.c binutils-2.8/gas/xmalloc.c --- binutils-2.7/gas/xmalloc.c Thu Jul 4 12:13:21 1996 +++ binutils-2.8/gas/xmalloc.c Wed Dec 31 19:00:00 1969 @@ -1,70 +0,0 @@ -/* xmalloc.c - get memory or bust - - Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc. - - This file is part of GAS, the GNU Assembler. - - GAS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* - NAME - xmalloc() - get memory or bust - INDEX - xmalloc() uses malloc() - - SYNOPSIS - char * my_memory; - - my_memory = xmalloc(42); / * my_memory gets address of 42 chars * / - - DESCRIPTION - - Use xmalloc() as an "error-free" malloc(). It does almost the same job. - When it cannot honour your request for memory it BOMBS your program - with a "virtual memory exceeded" message. Malloc() returns NULL and - does not bomb your program. - - SEE ALSO - malloc() - - */ - -#include "as.h" - -#define error as_fatal - -PTR -xmalloc (n) - unsigned long n; -{ - PTR retval; - - retval = malloc (n); - if (retval == NULL) - error ("virtual memory exceeded"); - return (retval); -} - -PTR -xrealloc (ptr, n) - register PTR ptr; - unsigned long n; -{ - ptr = realloc (ptr, n); - if (ptr == 0) - error ("virtual memory exceeded"); - return (ptr); -} -/* end of xmalloc.c */ diff -urN binutils-2.7/gprof/ChangeLog binutils-2.8/gprof/ChangeLog --- binutils-2.7/gprof/ChangeLog Thu Jul 4 15:33:00 1996 +++ binutils-2.8/gprof/ChangeLog Wed Apr 30 12:59:30 1997 @@ -1,8 +1,85 @@ +Thu Apr 3 18:55:05 1997 Ian Lance Taylor + + * gprof.c (VERSION): Define as "2.8". + +Thu Mar 27 17:15:23 1997 Ian Lance Taylor + + * gprof.c (main): Correct copyright message. + +Mon Mar 24 11:12:26 1997 Ian Lance Taylor + + * Makefile.in (.c.o): Define TARGET_$(MY_TARGET) when compiling. + * gmon.h: Use bytes counts rather than sizeof in struct raw_phdr + and struct raw_arc. + +Mon Mar 17 10:54:47 1997 David Mosberger-Tang + + * cg_arcs.c (arc_add): memset() newly alloced arc to ensure + all fields are initialized with 0. + +Sat Mar 15 19:17:31 1997 H.J. Lu + + * symtab.h (find_call): Declare. + * cg_arcs.c (cg_assemble): Don't declare find_call. + * hist.c (scale_and_align_entries): Declare. + +Thu Feb 27 12:46:53 1997 Ian Lance Taylor + + * configure.in: Define BSD44_FORMAT if the target looks like a + BSD4.4 derived system. + * configure: Rebuild. + * Makefile.in (.c.o): Add @DEFS@. + * gmon_io.c (gmon_out_read): In BSD44_FORMAT code, get profrate + from profrate field, not version field. + +Thu Jan 16 17:42:54 1997 Ian Lance Taylor + + * dummy.c (find_call): Clear ignore_direct_calls. + +Tue Dec 31 15:44:10 1996 Ian Lance Taylor + + * Makefile.in (.c.o): Add -D_GNU_SOURCE. Put $(CFLAGS) at the + end. + (gprof): Put $(CFLAGS) after the other options. + +Tue Nov 26 17:08:38 1996 Ian Lance Taylor + + * configure: Rebuild with autoconf 2.12. + +Wed Oct 2 15:23:16 1996 Ian Lance Taylor + + * sparc.c (find_call): Align p_lowpc to avoid bus error. + +Tue Oct 1 15:58:10 1996 Ian Lance Taylor + + * gprof.c (usage): Print bug report address. + (main): Change version printing to match current GNU standards. + +Fri Aug 30 12:16:11 1996 Ian Lance Taylor + + * gmon.h: Replace #elif with #else/#endif. + +Thu Aug 29 17:04:10 1996 Michael Meissner + + * configure.in (i[345]86-*-*): Recognize i686 for pentium pro. + * configure: Regenerate. + +Thu Aug 22 17:12:30 1996 Ian Lance Taylor + + * configure.in: Set and substitute HLDENV. + * configure: Rebuild. + * Makefile.in (HLDENV): New variable. + (gprof): Use $(HLDENV). + +Wed Aug 7 14:43:51 1996 Philippe De Muyter + + * core.c (read_function_mappings): Cast xmalloc return. + Thu Jul 4 12:01:42 1996 Ian Lance Taylor - * Released binutils 2.7. + * gprof.c (VERSION): Define as "2.7.1". - * gprof.c (VERSION): Define as "2.7". + * Released binutils 2.7. * bb_exit_func.c: Rename from __bb_exit_func.c, so that it can be stored on a System V file system. diff -urN binutils-2.7/gprof/Makefile.in binutils-2.8/gprof/Makefile.in --- binutils-2.7/gprof/Makefile.in Thu Jul 4 12:25:28 1996 +++ binutils-2.8/gprof/Makefile.in Wed Apr 30 12:59:29 1997 @@ -54,8 +54,9 @@ CFLAGS=-g -DDEBUG LDFLAGS= HLDFLAGS = @HLDFLAGS@ +HLDENV = @HLDENV@ .c.o: - $(CC) -c $(CFLAGS) -I. -I$(srcdir) -I../bfd -I$(srcdir)/../include -I$(srcdir)/../bfd -DMACHINE_H=\"$(MY_TARGET).h\" $(TCFLAGS) $(HCFLAGS) $< + $(CC) -c -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(srcdir)/../include -I$(srcdir)/../bfd @DEFS@ -DTARGET_$(MY_TARGET) -DMACHINE_H=\"$(MY_TARGET).h\" $(TCFLAGS) $(HCFLAGS) $(CFLAGS) $< all: $(GEN_FILES) $(PROG) @@ -103,7 +104,7 @@ $(INSTALL_XFORM1) $(srcdir)/gprof.1 $(man1dir)/gprof.1 gprof: $(OBJS) $(LIBDEPS) - $(CC) -o $(PROG) $(CFLAGS) $(HLDFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) + $(HLDENV) $(CC) -o $(PROG) $(HLDFLAGS) $(LDFLAGS) $(CFLAGS) $(OBJS) $(LIBS) mostlyclean: -rm -f *.o core gprof nohup.out \ diff -urN binutils-2.7/gprof/cg_arcs.c binutils-2.8/gprof/cg_arcs.c --- binutils-2.7/gprof/cg_arcs.c Thu Jul 4 12:25:31 1996 +++ binutils-2.8/gprof/cg_arcs.c Wed Apr 30 12:59:31 1997 @@ -84,6 +84,7 @@ return; } arc = (Arc *) xmalloc (sizeof (*arc)); + memset (arc, 0, sizeof (*arc)); arc->parent = parent; arc->child = child; arc->count = count; @@ -576,8 +577,7 @@ Sym *parent, **time_sorted_syms, **top_sorted_syms; long index; Arc *arc; - extern void find_call PARAMS ((Sym * parent, - bfd_vma p_lowpc, bfd_vma p_highpc)); + /* * initialize various things: * zero out child times. diff -urN binutils-2.7/gprof/configure binutils-2.8/gprof/configure --- binutils-2.7/gprof/configure Thu Jul 4 12:25:34 1996 +++ binutils-2.8/gprof/configure Wed Apr 30 12:59:32 1997 @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.10 +# Generated automatically using autoconf version 2.12 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -51,6 +51,8 @@ # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 ac_prev= for ac_option @@ -332,7 +334,7 @@ verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.10" + echo "configure generated by autoconf version 2.12" exit 0 ;; -with-* | --with-*) @@ -434,11 +436,14 @@ done # NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# 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 @@ -500,6 +505,7 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. @@ -529,6 +535,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:539: 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 @@ -557,6 +564,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:568: 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 @@ -603,7 +611,47 @@ 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:616: 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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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* + +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:650: 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:655: 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 @@ -612,7 +660,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:616: \"$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:664: \"$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 @@ -620,29 +668,34 @@ fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + if test $ac_cv_prog_gcc = yes; then GCC=yes - if test "${CFLAGS+set}" != set; then - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + 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:679: 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_gcc_g=yes + ac_cv_prog_cc_g=yes else - ac_cv_prog_gcc_g=no + ac_cv_prog_cc_g=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 - if test $ac_cv_prog_gcc_g = yes; then - CFLAGS="-g -O" - else - CFLAGS="-O" - 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 + CFLAGS="-g -O2" + else + CFLAGS="-O2" fi else GCC= @@ -679,11 +732,12 @@ # 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:736: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in @@ -706,7 +760,7 @@ ;; esac done - IFS="$ac_save_ifs" + IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then @@ -729,6 +783,7 @@ echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:787: 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 @@ -777,6 +832,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:836: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -791,12 +847,13 @@ esac host=`$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/'` +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:857: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -808,12 +865,13 @@ esac target=`$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/'` +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:875: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -825,9 +883,9 @@ esac build=`$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/'` +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" && @@ -857,7 +915,7 @@ case "${target}" in alpha-*-*) MY_TARGET=alpha ;; -i[345]86-*-*) MY_TARGET=i386 ;; +i[3456]86-*-*) MY_TARGET=i386 ;; sparc-*-*) MY_TARGET=sparc ;; tahoe-*-*) MY_TARGET=tahoe ;; vax-*-*) MY_TARGET=vax ;; @@ -867,6 +925,15 @@ +case "${target}" in +*-*-bsd4.4* | *-*-netbsd* | *-*-freebsd* | *-*-openbsd*) + cat >> confdefs.h <<\EOF +#define BSD44_FORMAT 1 +EOF + + ;; +esac + BFDLIB='-L../bfd -lbfd' # We need to handle some special cases if BFD was built shared. @@ -894,6 +961,7 @@ HLDFLAGS= +HLDENV= # If we have shared libraries, try to set rpath reasonably. if test "${shared}" = "true"; then case "${host}" in @@ -908,9 +976,12 @@ *-*-linux*) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; - *-*-sysv4* | *-*-solaris*) + *-*-solaris*) HLDFLAGS='-R $(libdir)' ;; + *-*-sysv4*) + HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;' + ;; esac fi @@ -937,6 +1008,7 @@ esac + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -954,11 +1026,25 @@ # --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 | - sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ - >> confcache + case `(ac_space=' '; set) 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 @@ -1025,7 +1111,7 @@ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.10" + echo "$CONFIG_STATUS generated by autoconf version 2.12" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1087,23 +1173,60 @@ s%@MY_TARGET@%$MY_TARGET%g s%@BFDLIB@%$BFDLIB%g s%@HLDFLAGS@%$HLDFLAGS%g +s%@HLDENV@%$HLDENV%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]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac - # Adjust relative srcdir, etc. for subdirectories. + # 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%/[^/][^/]*$%%'` @@ -1131,6 +1254,7 @@ [/$]*) 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." @@ -1139,16 +1263,22 @@ # $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 -" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done -rm -f conftest.subs +rm -f conftest.s* +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF diff -urN binutils-2.7/gprof/configure.in binutils-2.8/gprof/configure.in --- binutils-2.7/gprof/configure.in Thu Jul 4 12:25:34 1996 +++ binutils-2.8/gprof/configure.in Wed Apr 30 12:59:33 1997 @@ -22,7 +22,7 @@ case "${target}" in alpha-*-*) MY_TARGET=alpha ;; changequote(,)dnl -i[345]86-*-*) MY_TARGET=i386 ;; +i[3456]86-*-*) MY_TARGET=i386 ;; changequote([,])dnl sparc-*-*) MY_TARGET=sparc ;; tahoe-*-*) MY_TARGET=tahoe ;; @@ -33,6 +33,15 @@ AC_SUBST(MY_TARGET) +dnl We need to set BSD44_FORMAT on a host which uses the additional +dnl header fields. This is an attempt to do that. I can't think of a +dnl good feature test for this. +case "${target}" in +*-*-bsd4.4* | *-*-netbsd* | *-*-freebsd* | *-*-openbsd*) + AC_DEFINE(BSD44_FORMAT) + ;; +esac + BFDLIB='-L../bfd -lbfd' # We need to handle some special cases if BFD was built shared. @@ -60,6 +69,7 @@ AC_SUBST(BFDLIB) HLDFLAGS= +HLDENV= # If we have shared libraries, try to set rpath reasonably. if test "${shared}" = "true"; then case "${host}" in @@ -74,9 +84,12 @@ *-*-linux*) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; - *-*-sysv4* | *-*-solaris*) + *-*-solaris*) HLDFLAGS='-R $(libdir)' ;; + *-*-sysv4*) + HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;' + ;; esac fi @@ -102,5 +115,6 @@ ;; esac AC_SUBST(HLDFLAGS) +AC_SUBST(HLDENV) AC_OUTPUT(Makefile) diff -urN binutils-2.7/gprof/core.c binutils-2.8/gprof/core.c --- binutils-2.7/gprof/core.c Thu Jul 4 12:25:36 1996 +++ binutils-2.8/gprof/core.c Wed Apr 30 12:59:33 1997 @@ -66,7 +66,8 @@ } /* Now we know how big we need to make our table. */ - symbol_map = xmalloc (count * sizeof (struct function_map)); + symbol_map = ((struct function_map *) + xmalloc (count * sizeof (struct function_map))); /* Rewind the input file so we can read it again. */ rewind (file); diff -urN binutils-2.7/gprof/dummy.c binutils-2.8/gprof/dummy.c --- binutils-2.7/gprof/dummy.c Thu Jul 4 12:25:37 1996 +++ binutils-2.8/gprof/dummy.c Wed Apr 30 12:59:33 1997 @@ -13,4 +13,7 @@ { fprintf (stderr, "%s: -c not supported on this machine architecture\n", whoami); + + /* Don't give the error more than once. */ + ignore_direct_calls = FALSE; } diff -urN binutils-2.7/gprof/gmon.h binutils-2.8/gprof/gmon.h --- binutils-2.7/gprof/gmon.h Thu Jul 4 12:25:38 1996 +++ binutils-2.8/gprof/gmon.h Wed Apr 30 12:59:34 1997 @@ -37,8 +37,13 @@ struct raw_phdr { - char low_pc[sizeof (bfd_vma)]; /* base pc address of sample buffer */ - char high_pc[sizeof (bfd_vma)]; /* max pc address of sampled buffer */ +#ifdef TARGET_alpha + char low_pc[8]; /* base pc address of sample buffer */ + char high_pc[8]; /* max pc address of sampled buffer */ +#else + char low_pc[4]; /* base pc address of sample buffer */ + char high_pc[4]; /* max pc address of sampled buffer */ +#endif char ncnt[4]; /* size of sample buffer (plus this header) */ #if defined (__alpha__) && defined (__osf__) @@ -47,11 +52,13 @@ * a size that is a multiple of 8. */ char pad[4]; -#elif defined (BSD44_FORMAT) +#else +#ifdef BSD44_FORMAT char version[4]; /* version number */ char profrate[4]; /* profiling clock rate */ char spare[3*4]; /* reserved */ #endif +#endif }; /* @@ -109,9 +116,15 @@ */ struct raw_arc { - char from_pc[sizeof (bfd_vma)]; - char self_pc[sizeof (bfd_vma)]; - char count[sizeof (long)]; +#ifdef TARGET_alpha + char from_pc[8]; + char self_pc[8]; + char count[8]; +#else + char from_pc[4]; + char self_pc[4]; + char count[4]; +#endif }; /* diff -urN binutils-2.7/gprof/gmon_io.c binutils-2.8/gprof/gmon_io.c --- binutils-2.7/gprof/gmon_io.c Thu Jul 4 12:25:38 1996 +++ binutils-2.8/gprof/gmon_io.c Wed Apr 30 12:59:35 1997 @@ -188,7 +188,7 @@ { int profrate; - profrate = bfd_get_32 (core_bfd, (bfd_byte *) &raw.version[0]); + profrate = bfd_get_32 (core_bfd, (bfd_byte *) &raw.profrate[0]); if (!s_highpc) hz = profrate; else if (hz != profrate) diff -urN binutils-2.7/gprof/gprof.c binutils-2.8/gprof/gprof.c --- binutils-2.7/gprof/gprof.c Thu Jul 4 15:29:12 1996 +++ binutils-2.8/gprof/gprof.c Wed Apr 30 12:59:36 1997 @@ -30,7 +30,7 @@ #include "source.h" #include "sym_ids.h" -#define VERSION "2.7" +#define VERSION "2.8" const char *whoami; const char *function_mapping_file; @@ -147,6 +147,8 @@ [--version] [--width=n] [--ignore-non-functions]\n\ [image-file] [profile-file...]\n", whoami); + if (status == 0) + fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); done (status); } @@ -369,7 +371,11 @@ bsd_style_output = TRUE; break; case 'v': - printf ("%s version %s\n", whoami, VERSION); + /* This output is intended to follow the GNU standards document. */ + printf ("GNU gprof %s\n", VERSION); + printf ("Based on BSD gprof, copyright 1983 Regents of the University of California.\n"); + printf ("\ +This program is free software. This program has absolutely no warranty.\n"); done (0); case 'w': output_width = atoi (optarg); diff -urN binutils-2.7/gprof/gprof.info binutils-2.8/gprof/gprof.info --- binutils-2.7/gprof/gprof.info Mon Jul 15 12:23:17 1996 +++ binutils-2.8/gprof/gprof.info Wed Apr 30 12:59:36 1997 @@ -1,4 +1,4 @@ -This is Info file gprof.info, produced by Makeinfo-1.55 from the input +This is Info file gprof.info, produced by Makeinfo-1.64 from the input file ./gprof.texi. START-INFO-DIR-ENTRY @@ -23,7 +23,7 @@ versions.  -File: gprof.info, Node: Top, Next: Why, Prev: (DIR), Up: (DIR) +File: gprof.info, Node: Top, Next: Why, Up: (dir) Profiling a Program: Where Does It Spend Its Time? ************************************************** @@ -975,19 +975,19 @@  Tag Table: Node: Top888 -Node: Why2593 -Node: Compiling4687 -Node: Executing6671 -Node: Invoking8782 -Node: Flat Profile15871 -Node: Call Graph19557 -Node: Primary22796 -Node: Callers25329 -Node: Subroutines27436 -Node: Cycles29095 -Node: Implementation35859 -Node: Sampling Error37959 -Node: Assumptions40278 -Node: Incompatibilities41803 +Node: Why2579 +Node: Compiling4673 +Node: Executing6657 +Node: Invoking8768 +Node: Flat Profile15857 +Node: Call Graph19543 +Node: Primary22782 +Node: Callers25315 +Node: Subroutines27422 +Node: Cycles29081 +Node: Implementation35845 +Node: Sampling Error37945 +Node: Assumptions40264 +Node: Incompatibilities41789  End Tag Table diff -urN binutils-2.7/gprof/hist.c binutils-2.8/gprof/hist.c --- binutils-2.7/gprof/hist.c Thu Jul 4 12:25:45 1996 +++ binutils-2.8/gprof/hist.c Wed Apr 30 12:59:37 1997 @@ -12,6 +12,8 @@ #include "sym_ids.h" #include "utils.h" +static void scale_and_align_entries PARAMS ((void)); + /* declarations of automatically generated functions to output blurbs: */ extern void flat_blurb PARAMS ((FILE * fp)); diff -urN binutils-2.7/gprof/sparc.c binutils-2.8/gprof/sparc.c --- binutils-2.7/gprof/sparc.c Thu Jul 4 12:25:46 1996 +++ binutils-2.8/gprof/sparc.c Wed Apr 30 12:59:39 1997 @@ -49,7 +49,7 @@ } DBG (CALLDEBUG, printf ("[find_call] %s: 0x%lx to 0x%lx\n", parent->name, p_lowpc, p_highpc)); - for (instr = (unsigned int *) (p_lowpc + delta); + for (instr = (unsigned int *) (((p_lowpc + delta) + 3) &~ 3); instr < (unsigned int *) (p_highpc + delta); ++instr) { diff -urN binutils-2.7/gprof/symtab.h binutils-2.8/gprof/symtab.h --- binutils-2.7/gprof/symtab.h Thu Jul 4 12:25:47 1996 +++ binutils-2.8/gprof/symtab.h Wed Apr 30 12:59:40 1997 @@ -102,4 +102,6 @@ extern void symtab_finalize PARAMS ((Sym_Table * symtab)); extern Sym *sym_lookup PARAMS ((Sym_Table * symtab, bfd_vma address)); +extern void find_call PARAMS ((Sym *, bfd_vma, bfd_vma)); + #endif /* symtab_h */ diff -urN binutils-2.7/include/COPYING binutils-2.8/include/COPYING --- binutils-2.7/include/COPYING Thu Jul 4 12:21:01 1996 +++ binutils-2.8/include/COPYING Wed Apr 30 12:56:54 1997 @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -279,7 +279,7 @@ END OF TERMS AND CONDITIONS - Appendix: How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -305,7 +305,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Also add information on how to contact you by electronic and paper mail. diff -urN binutils-2.7/include/ChangeLog binutils-2.8/include/ChangeLog --- binutils-2.7/include/ChangeLog Thu Jul 4 12:35:44 1996 +++ binutils-2.8/include/ChangeLog Wed Apr 30 12:56:54 1997 @@ -1,7 +1,181 @@ +Wed Apr 2 15:23:49 1997 Doug Evans + + * remote-sim.h (SIM_OPEN_KIND, SIM_RC): New enums. + (sim_open): New argument `kind'. + +Wed Apr 2 14:45:51 1997 Ian Lance Taylor + + * COPYING: Update FSF address. + +Fri Mar 28 15:29:54 1997 Mike Meissner + + * callback.h (top level): Include stdarg.h or varargs.h if + va_start is not defined. + (host_callback_struct): Make {,e}vprintf_filtered take a va_list + instead of void *, since va_list might be an array or structure + type. + +Fri Mar 28 15:44:41 1997 H.J. Lu + + * libiberty.h (basename): Add prototype for glibc and linux. + +Mon Mar 17 19:22:12 1997 Ian Lance Taylor + + * objalloc.h: New file. + +Mon Mar 17 14:57:55 1997 Andrew Cagney + + * remote-sim.h: New file, copied in from gdb/remote-sim.h. One + day this will be placed in a directory of its own. + +Sat Mar 15 19:00:14 1997 Ian Lance Taylor + + * obstack.h: Update to current FSF version. + +Thu Mar 6 15:46:59 1997 Andrew Cagney + + * callback.h (struct host_callback_struct): Add callbacks - + flush_stdout, write_stderr, flush_stderr, vprintf_filtered, + evprintf_filtered. Delete redundant callbacks - printf_filtered. + +Thu Feb 27 23:18:27 1997 Ian Lance Taylor + + * bfdlink.h (struct bfd_link_info): Remove lprefix and lprefix_len + fields. + +Tue Feb 25 00:10:49 1997 Ian Lance Taylor + + * dis-asm.h (INIT_DISASSEMBLE_INFO_NO_ARCH): Initialize + bytes_per_chunk and display_endian. + +Mon Feb 24 17:47:02 1997 Ian Lance Taylor + + From Eric Youngdale : + * bfdlink.h (struct bfd_elf_version_expr): Define. + (struct bfd_elf_version_deps): Define. + (struct bfd_elf_version_tree): Define. + +Thu Feb 6 14:20:01 1997 Martin M. Hunt + + * dis-asm.h: (disassemble_info): Add new fields + bytes_per_chunk and display_endian to control the + display of raw instructions. + +Sun Dec 8 17:11:12 1996 Doug Evans + + * callback.h (host_callback): New member `error'. + +Wed Nov 20 00:40:23 1996 Doug Evans + + * callback.h: New file, moved here from gdb. + +Mon Nov 18 16:34:00 1996 Dawn Perchik + + * libiberty.h: Checkin again; last checkin failed due to sticky tag. + +Wed Nov 13 08:22:00 1996 Dawn Perchik + + * libiberty.h: Revert last commit due to conflicts with hpux + system headers. + +Tue Nov 12 16:31:00 1996 Dawn Perchik + + * libiberty.h: Move prototypes from argv.c here. + +Thu Oct 31 14:56:18 1996 Doug Evans + + * ansidecl.h (VPARAMS,VA_START): Define. + +Fri Oct 25 12:08:04 1996 Ian Lance Taylor + + * dis-asm.h (disassemble_info): Add bytes_per_line field. + (INIT_DISASSEMBLE_INFO_NO_ARCH): Initialize bytes_per_line field. + +Thu Oct 24 17:10:01 1996 Ian Lance Taylor + + * dis-asm.h (disassemble_info): Add symbol field. + (INIT_DISASSEMBLE_INFO_NO_ARCH): Initialize symbol field. + +Thu Oct 17 11:17:40 1996 Doug Evans + + * dis-asm.h (print_insn_m32r): Declare. + +Mon Oct 14 23:56:52 1996 Ian Lance Taylor + + * libiberty.h: Declare parameter types for xmalloc and xrealloc. + +Thu Oct 3 13:45:27 1996 Ian Lance Taylor + + * fnmatch.h: New file. + +Thu Oct 3 10:33:14 1996 Jeffrey A Law (law@cygnus.com) + + * dis-asm.h (print_insn_mn10x00): Delete declaration. + (print_insn_mn10200, print_insn_mn10300): Declare. + +Wed Oct 2 21:24:43 1996 Jeffrey A Law (law@cygnus.com) + + * dis-asm.h (print_insn_mn10x00): Declare. + +Mon Sep 30 13:56:11 1996 Fred Fish + + * libiberty.h: Remove #ifndef PRIVATE_XMALLOC. + +Tue Aug 13 16:10:30 1996 Stu Grossman (grossman@critters.cygnus.com) + + * obstack.h: Change bcopy to memcpy. Works better on Posix + systems, which generally lack bcopy. + +Mon Aug 12 17:03:18 1996 Stu Grossman (grossman@critters.cygnus.com) + + * ansidecl.h: Change WIN32 to _WIN32. + +Fri Jul 26 13:58:18 1996 Ian Lance Taylor + + * dis-asm.h: Add flavour field. + (print_insn_alpha): Declare. + (print_insn_alpha_osf, print_insn_alpha_vms): Don't declare. + (INIT_DISASSEMBLE_INFO): Initialize flavour field. + +Tue Jul 23 17:37:58 1996 Fred Fish + + * libiberty.h (PRIVATE_XMALLOC): Enclose xmalloc/xrealloc + definitions inside #ifndef so that programs that want to + can define PRIVATE_XMALLOC and then define xmalloc and + xrealloc anyway they want. + (basename): Document in source that we can't declare the + parameter type because it is declared inconsistently across + different systems. + +Mon Jul 22 13:16:13 1996 Richard Henderson + + * dis-asm.h (print_insn_alpha): Don't declare. + (print_insn_alpha_osf, print_insn_alpha_vms): Declare. + +Wed Jul 17 14:45:12 1996 Martin M. Hunt + + * dis-asm.h: (print_insn_d10v): Declare. + +Mon Jul 15 16:55:38 1996 Stu Grossman (grossman@critters.cygnus.com) + + * dis-asm.h: Get rid of decls for print_insn_i8086, + print_insn_sparc64 and print_insn_sparclite. + * (INIT_DISASSEMBLE_INFO): Split into two pieces. One, + INIT_DISASSEMBLE_INFO_NO_ARCH inits everything except for endian, + mach, and arch. + +Fri Jul 12 10:19:27 1996 Stu Grossman (grossman@critters.cygnus.com) + + * dis-asm.h (print_insn_i8086): Declare. + Wed Jul 3 16:02:39 1996 Stu Grossman (grossman@critters.cygnus.com) * dis-asm.h (print_insn_sparclite): Declare. +Tue Jun 18 16:02:46 1996 Jeffrey A. Law + + * dis-asm.h (print_insn_h8300s): Declare. + Tue Jun 18 15:11:33 1996 Klaus Kaempf * fopen-vms.h: New file. @@ -991,7 +1165,7 @@ Local Variables: -mode: indented-text +mode: change-log left-margin: 8 fill-column: 74 version-control: never diff -urN binutils-2.7/include/ansidecl.h binutils-2.8/include/ansidecl.h --- binutils-2.7/include/ansidecl.h Thu Jul 4 12:21:02 1996 +++ binutils-2.8/include/ansidecl.h Wed Apr 30 12:56:54 1997 @@ -1,5 +1,5 @@ /* ANSI and traditional C compatability macros - Copyright 1991, 1992 Free Software Foundation, Inc. + Copyright 1991, 1992, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ CONST is also defined, but is obsolete. Just use const. - DEFUN (name, arglist, args) + obsolete -- DEFUN (name, arglist, args) Defines function NAME. @@ -43,7 +43,7 @@ be separated with `AND'. For functions with a variable number of arguments, the last thing listed should be `DOTS'. - DEFUN_VOID (name) + obsolete -- DEFUN_VOID (name) Defines a function NAME, which takes no arguments. @@ -55,7 +55,11 @@ parentheses). In traditional C it is `NAME()'. For a function that takes no arguments, PROTOTYPE should be `(void)'. - PARAMS ((args)) + obsolete -- PROTO (type, name, (prototype) -- obsolete. + + This one has also been replaced by PARAMS. Do not use. + + PARAMS ((args)) We could use the EXFUN macro to handle prototype declarations, but the name is misleading and the result is ugly. So we just define a @@ -73,11 +77,11 @@ the function name out of the mess. EXFUN should be considered obsolete; new code should be written to use PARAMS. - For example: - extern int printf PARAMS ((CONST char *format DOTS)); - int DEFUN(fprintf, (stream, format), - FILE *stream AND CONST char *format DOTS) { ... } - void DEFUN_VOID(abort) { ... } + DOTS is also obsolete. + + Examples: + + extern int printf PARAMS ((const char *format, ...)); */ #ifndef _ANSIDECL_H @@ -90,7 +94,7 @@ /* LINTLIBRARY */ -#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) +#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) /* All known AIX compilers implement these things (but don't always define __STDC__). The RISC/OS MIPS compiler defines these things in SVR4 mode, but does not define __STDC__. */ @@ -101,19 +105,23 @@ #define AND , #define NOARGS void -#define CONST const #define VOLATILE volatile #define SIGNED signed -#define DOTS , ... - -#define EXFUN(name, proto) name proto -#define DEFUN(name, arglist, args) name(args) -#define DEFUN_VOID(name) name(void) -#define PROTO(type, name, arglist) type name arglist #define PARAMS(paramlist) paramlist #define ANSI_PROTOTYPES 1 +#define VPARAMS(ARGS) ARGS +#define VA_START(va_list,var) va_start(va_list,var) + +/* These are obsolete. Do not use. */ +#define CONST const +#define DOTS , ... +#define PROTO(type, name, arglist) type name arglist +#define EXFUN(name, proto) name proto +#define DEFUN(name, arglist, args) name(args) +#define DEFUN_VOID(name) name(void) + #else /* Not ANSI C. */ #define PTR char * @@ -122,19 +130,24 @@ #define AND ; #define NOARGS -#define CONST #ifndef const /* some systems define it in header files for non-ansi mode */ #define const #endif #define VOLATILE #define SIGNED -#define DOTS -#define EXFUN(name, proto) name() -#define DEFUN(name, arglist, args) name arglist args; -#define DEFUN_VOID(name) name() -#define PROTO(type, name, arglist) type name () #define PARAMS(paramlist) () + +#define VPARAMS(ARGS) (va_alist) va_dcl +#define VA_START(va_list,var) va_start(va_list) + +/* These are obsolete. Do not use. */ +#define CONST +#define DOTS +#define PROTO(type, name, arglist) type name () +#define EXFUN(name, proto) name() +#define DEFUN(name, arglist, args) name arglist args; +#define DEFUN_VOID(name) name() #endif /* ANSI C. */ diff -urN binutils-2.7/include/bfdlink.h binutils-2.8/include/bfdlink.h --- binutils-2.7/include/bfdlink.h Thu Jul 4 12:21:03 1996 +++ binutils-2.8/include/bfdlink.h Wed Apr 30 12:56:55 1997 @@ -1,5 +1,5 @@ /* bfdlink.h -- header file for BFD link routines - Copyright 1993 Free Software Foundation, Inc. + Copyright 1993, 94, 95, 96, 1997 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. @@ -35,7 +35,7 @@ enum bfd_link_discard { discard_none, /* Don't discard any locals. */ - discard_l, /* Discard locals with a certain prefix. */ + discard_l, /* Discard local temporary symbols. */ discard_all /* Discard all locals. */ }; @@ -194,9 +194,6 @@ enum bfd_link_strip strip; /* Which local symbols to discard. */ enum bfd_link_discard discard; - /* The local symbol prefix to discard if using discard_l. */ - unsigned int lprefix_len; - const char *lprefix; /* true if symbols should be retained in memory, false if they should be freed and reread. */ boolean keep_memory; @@ -456,5 +453,52 @@ /* Allocate a new link_order for a section. */ extern struct bfd_link_order *bfd_new_link_order PARAMS ((bfd *, asection *)); + +/* These structures are used to describe version information for the + ELF linker. These structures could be manipulated entirely inside + BFD, but it would be a pain. Instead, the regular linker sets up + these structures, and then passes them into BFD. */ + +/* Regular expressions for a version. */ + +struct bfd_elf_version_expr +{ + /* Next regular expression for this version. */ + struct bfd_elf_version_expr *next; + /* Regular expression. */ + const char *match; +}; + +/* Version dependencies. */ + +struct bfd_elf_version_deps +{ + /* Next dependency for this version. */ + struct bfd_elf_version_deps *next; + /* The version which this version depends upon. */ + struct bfd_elf_version_tree *version_needed; +}; + +/* A node in the version tree. */ + +struct bfd_elf_version_tree +{ + /* Next version. */ + struct bfd_elf_version_tree *next; + /* Name of this version. */ + const char *name; + /* Version number. */ + unsigned int vernum; + /* Regular expressions for global symbols in this version. */ + struct bfd_elf_version_expr *globals; + /* Regular expressions for local symbols in this version. */ + struct bfd_elf_version_expr *locals; + /* List of versions which this version depends upon. */ + struct bfd_elf_version_deps *deps; + /* Index of the version name. This is used within BFD. */ + unsigned int name_indx; + /* Whether this version tree was used. This is used within BFD. */ + int used; +}; #endif diff -urN binutils-2.7/include/callback.h binutils-2.8/include/callback.h --- binutils-2.7/include/callback.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/include/callback.h Wed Apr 30 12:56:55 1997 @@ -0,0 +1,99 @@ +/* Remote target system call callback support. + Copyright 1997 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 CALLBACK_H +#define CALLBACK_H + +#ifndef va_start +#include +#ifdef ANSI_PROTOTYPES +#include +#else +#include +#endif +#endif + +typedef struct host_callback_struct host_callback; + +#define MAX_CALLBACK_FDS 10 + +struct host_callback_struct +{ + int (*close) PARAMS ((host_callback *,int)); + int (*get_errno) PARAMS ((host_callback *)); + int (*isatty) PARAMS ((host_callback *, int)); + int (*lseek) PARAMS ((host_callback *, int, long , int)); + int (*open) PARAMS ((host_callback *, const char*, int mode)); + int (*read) PARAMS ((host_callback *,int, char *, int)); + int (*read_stdin) PARAMS (( host_callback *, char *, int)); + int (*rename) PARAMS ((host_callback *, const char *, const char *)); + int (*system) PARAMS ((host_callback *, const char *)); + long (*time) PARAMS ((host_callback *, long *)); + int (*unlink) PARAMS ((host_callback *, const char *)); + int (*write) PARAMS ((host_callback *,int, const char *, int)); + int (*write_stdout) PARAMS ((host_callback *, const char *, int)); + void (*flush_stdout) PARAMS ((host_callback *)); + int (*write_stderr) PARAMS ((host_callback *, const char *, int)); + void (*flush_stderr) PARAMS ((host_callback *)); + + /* Used when the target has gone away, so we can close open + handles and free memory etc etc. */ + int (*shutdown) PARAMS ((host_callback *)); + int (*init) PARAMS ((host_callback *)); + + /* depreciated, use vprintf_filtered - Talk to the user on a console. */ + void (*printf_filtered) PARAMS ((host_callback *, const char *, ...)); + + /* Talk to the user on a console. + The `void *' is actually `va_list *'. */ + void (*vprintf_filtered) PARAMS ((host_callback *, const char *, va_list)); + + /* Same as vprintf_filtered but to stderr. */ + void (*evprintf_filtered) PARAMS ((host_callback *, const char *, va_list)); + + /* Print an error message and "exit". + In the case of gdb "exiting" means doing a longjmp back to the main + command loop. */ + void (*error) PARAMS ((host_callback *, const char *, ...)); + + int last_errno; /* host format */ + + int fdmap[MAX_CALLBACK_FDS]; + char fdopen[MAX_CALLBACK_FDS]; + char alwaysopen[MAX_CALLBACK_FDS]; +}; + +extern host_callback default_callback; + +/* Mapping of host/target values. */ +/* ??? For debugging purposes, one might want to add a string of the + name of the symbol. */ + +typedef struct { + int host_val; + int target_val; +} target_defs_map; + +extern target_defs_map errno_map[]; +extern target_defs_map open_map[]; + +extern int host_to_target_errno PARAMS ((int)); +extern int target_to_host_open PARAMS ((int)); + +#endif diff -urN binutils-2.7/include/coff/ChangeLog binutils-2.8/include/coff/ChangeLog --- binutils-2.7/include/coff/ChangeLog Thu Jul 4 12:35:11 1996 +++ binutils-2.8/include/coff/ChangeLog Wed Apr 30 12:57:06 1997 @@ -1,3 +1,23 @@ +Fri Apr 18 11:52:55 1997 Niklas Hallqvist + + * alpha.h (ALPHA_ECOFF_BADMAG): Recognize *BSD/alpha magic too. + (ALPHA_R_LITERALSLEAZY): Define. + * ecoff.h (ALPHA_MAGIC_BSD): Define. + +Wed Jan 29 11:31:51 1997 Ian Lance Taylor + + * i960.h (R_IPR13, R_ALIGN): Define. + +Mon Jan 27 13:34:30 1997 Ian Lance Taylor + + * internal.h (R_IPRMED, R_OPTCALL, R_OPTCALLX): Move definitions + from here... + * i960.h (R_IPRMED, R_OPTCALL, R_OPTCALLX): ...to here. + +Thu Dec 19 16:18:11 1996 Ian Lance Taylor + + * arm.h (_LIT): Define. + Fri Jun 28 12:54:38 1996 Ian Lance Taylor * pe.h (FILHSZ): Define. @@ -13,6 +33,11 @@ * alpha.h: Add declarations for relocation types added for Alpha OSF/1 3.0. + +Tue Jun 18 16:04:29 1996 Jeffrey A. Law + + * h8300.h (H8300SMAGIC): Define. + (H8300SBADMAG): Define. Mon Jun 10 11:53:28 1996 Jeffrey A Law (law@cygnus.com) diff -urN binutils-2.7/include/coff/alpha.h binutils-2.8/include/coff/alpha.h --- binutils-2.7/include/coff/alpha.h Thu Jul 4 12:21:11 1996 +++ binutils-2.8/include/coff/alpha.h Wed Apr 30 12:57:06 1997 @@ -14,7 +14,8 @@ }; /* Magic numbers are defined in coff/ecoff.h. */ -#define ALPHA_ECOFF_BADMAG(x) ((x).f_magic!=ALPHA_MAGIC) +#define ALPHA_ECOFF_BADMAG(x) \ + ((x).f_magic != ALPHA_MAGIC && (x).f_magic != ALPHA_MAGIC_BSD) /* The object type is encoded in the f_flags. */ #define F_ALPHA_OBJECT_TYPE_MASK 0x3000 @@ -123,6 +124,9 @@ #define ALPHA_R_GPRELHIGH 17 #define ALPHA_R_GPRELLOW 18 #define ALPHA_R_IMMED 19 + +/* Overloaded reloc value used by Net- and OpenBSD. */ +#define ALPHA_R_LITERALSLEAZY 17 /* With ALPHA_R_LITUSE, the r_size field is one of the following values. */ #define ALPHA_R_LU_BASE 1 diff -urN binutils-2.7/include/coff/arm.h binutils-2.8/include/coff/arm.h --- binutils-2.7/include/coff/arm.h Thu Jul 4 12:21:11 1996 +++ binutils-2.8/include/coff/arm.h Wed Apr 30 12:57:06 1997 @@ -99,6 +99,9 @@ #define _COMMENT ".comment" #define _LIB ".lib" +/* We use the .rdata section to hold read only data. */ +#define _LIT ".rdata" + /********************** LINE NUMBERS **********************/ /* 1 line number entry for every "breakpointable" source line in a section. diff -urN binutils-2.7/include/coff/ecoff.h binutils-2.8/include/coff/ecoff.h --- binutils-2.7/include/coff/ecoff.h Thu Jul 4 12:21:12 1996 +++ binutils-2.8/include/coff/ecoff.h Wed Apr 30 12:57:06 1997 @@ -24,6 +24,7 @@ /* Alpha magic numbers used in filehdr. */ #define ALPHA_MAGIC 0x183 +#define ALPHA_MAGIC_BSD 0x185 /* Magic numbers used in a.out header. */ #define ECOFF_AOUT_OMAGIC 0407 /* not demand paged (ld -N). */ diff -urN binutils-2.7/include/coff/h8300.h binutils-2.8/include/coff/h8300.h --- binutils-2.7/include/coff/h8300.h Thu Jul 4 12:35:12 1996 +++ binutils-2.8/include/coff/h8300.h Wed Apr 30 12:57:06 1997 @@ -16,9 +16,11 @@ #define H8300MAGIC 0x8300 #define H8300HMAGIC 0x8301 +#define H8300SMAGIC 0x8302 #define H8300BADMAG(x) (((x).f_magic!=H8300MAGIC)) #define H8300HBADMAG(x) (((x).f_magic!=H8300HMAGIC)) +#define H8300SBADMAG(x) (((x).f_magic!=H8300SMAGIC)) #define FILHDR struct external_filehdr #define FILHSZ 20 diff -urN binutils-2.7/include/coff/i960.h binutils-2.8/include/coff/i960.h --- binutils-2.7/include/coff/i960.h Thu Jul 4 12:21:12 1996 +++ binutils-2.8/include/coff/i960.h Wed Apr 30 12:57:06 1997 @@ -242,9 +242,33 @@ char pad[2]; }; +/* r_type values for the i960. */ -/* Relevent values for r_type and i960. Would someone please document them */ +/* The i960 uses R_RELLONG, which is defined in internal.h as 0x11. + It is an absolute 32 bit relocation. */ +#define R_IPRMED (0x19) /* 24-bit ip-relative relocation */ +#define R_OPTCALL (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */ +#define R_OPTCALLX (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */ + +/* The following relocation types are defined use by relaxing linkers, + which convert 32 bit calls (which require a 64 bit instruction) + into 24 bit calls (which require a 32 bit instruction) when + possible. It will be possible whenever the target of the call is + within a 24 bit range of the call instruction. + + It is always safe to ignore these relocations. They only serve to + mark points which the relaxing linker will have to consider. The + assembler must ensure that the correct code is generated even if + the relocations are ignored. In particular, this means that the + R_IPR13 relocation may not appear with an external symbol. */ + +#define R_IPR13 (0x1d) /* 13 bit ip-relative branch */ +#define R_ALIGN (0x1e) /* alignment marker. This has no + associated symbol. Instead, the + r_symndx field indicates the + require alignment at this point in + the file. It must be a power of 2. */ #define RELOC struct external_reloc #define RELSZ 12 diff -urN binutils-2.7/include/coff/internal.h binutils-2.8/include/coff/internal.h --- binutils-2.7/include/coff/internal.h Thu Jul 4 12:21:13 1996 +++ binutils-2.8/include/coff/internal.h Wed Apr 30 12:57:07 1997 @@ -587,10 +587,7 @@ #define R_VRT32 133 #define R_RELLONG (0x11) /* Direct 32-bit relocation */ #define R_IPRSHORT (0x18) -#define R_IPRMED (0x19) /* 24-bit ip-relative relocation */ #define R_IPRLONG (0x1a) -#define R_OPTCALL (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */ -#define R_OPTCALLX (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */ #define R_GETSEG (0x1d) #define R_GETPA (0x1e) #define R_TAGWORD (0x1f) diff -urN binutils-2.7/include/coff/sh.h binutils-2.8/include/coff/sh.h --- binutils-2.7/include/coff/sh.h Thu Jul 4 12:21:14 1996 +++ binutils-2.8/include/coff/sh.h Wed Apr 30 12:57:07 1997 @@ -228,7 +228,7 @@ The r_offset field holds the difference between the reloc address and L2. */ #define R_SH_SWITCH16 25 /* 16 bit switch table entry */ -#define R_SH_SWITCH32 26 /* 16 bit switch table entry */ +#define R_SH_SWITCH32 26 /* 32 bit switch table entry */ /* The USES reloc type is used for relaxing. The compiler will generate .uses pseudo-ops when it finds a function call which it @@ -240,7 +240,7 @@ /* The COUNT reloc type is used for relaxing. The assembler will generate COUNT relocs for addresses referred to by the register loads associated with USES relocs. The r_offset field of the COUNT - reloc holds the number of times the address is references in the + reloc holds the number of times the address is referenced in the object file. */ #define R_SH_COUNT 28 /* Count of constant pool uses */ diff -urN binutils-2.7/include/dis-asm.h binutils-2.8/include/dis-asm.h --- binutils-2.7/include/dis-asm.h Thu Jul 4 12:35:45 1996 +++ binutils-2.8/include/dis-asm.h Wed Apr 30 12:56:56 1997 @@ -43,12 +43,17 @@ /* Target description. We could replace this with a pointer to the bfd, but that would require one. There currently isn't any such requirement so to avoid introducing one we record these explicitly. */ + /* The bfd_flavour. This can be bfd_target_unknown_flavour. */ + enum bfd_flavour flavour; /* The bfd_arch value. */ enum bfd_architecture arch; /* The bfd_mach value. */ unsigned long mach; /* Endianness (for bi-endian cpus). Mono-endian cpus can ignore this. */ enum bfd_endian endian; + /* The symbol at the start of the function being disassembled. This + is not set reliably, but if it is not NULL, it is correct. */ + asymbol *symbol; /* For use by the disassembler. The top 16 bits are reserved for public use (and are documented here). @@ -81,6 +86,20 @@ bfd_vma buffer_vma; int buffer_length; + /* This variable may be set by the instruction decoder. It suggests + the number of bytes objdump should display on a single line. If + the instruction decoder sets this, it should always set it to + the same value in order to get reasonable looking output. */ + int bytes_per_line; + + /* the next two variables control the way objdump displays the raw data */ + /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */ + /* output will look like this: + 00: 00000000 00000000 + with the chunks displayed according to "display_endian". */ + int bytes_per_chunk; + enum bfd_endian display_endian; + /* Results from instruction decoders. Not all decoders yet support this information. This info is set each time an instruction is decoded, and is only valid for the last such instruction. @@ -113,25 +132,28 @@ extern int print_insn_z8002 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_h8300 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_h8300h PARAMS ((bfd_vma, disassemble_info*)); +extern int print_insn_h8300s PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_h8500 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_alpha PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_big_arm PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_little_arm PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_sparc PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_sparc64 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_sparclite PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_big_a29k PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_little_a29k PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_i960 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_sh PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_shl PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_hppa PARAMS ((bfd_vma, disassemble_info*)); +extern int print_insn_m32r PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_m88k PARAMS ((bfd_vma, disassemble_info*)); +extern int print_insn_mn10200 PARAMS ((bfd_vma, disassemble_info*)); +extern int print_insn_mn10300 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_ns32k PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_big_powerpc PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_little_powerpc PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_rs6000 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_w65 PARAMS ((bfd_vma, disassemble_info*)); +extern int print_insn_d10v PARAMS ((bfd_vma, disassemble_info*)); /* Fetch the disassembler for a given BFD, if that support is available. */ extern disassembler_ftype disassembler PARAMS ((bfd *)); @@ -159,18 +181,31 @@ /* Macro to initialize a disassemble_info struct. This should be called by all applications creating such a struct. */ #define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \ + (INFO).flavour = bfd_target_unknown_flavour, \ + (INFO).arch = bfd_arch_unknown, \ + (INFO).mach = 0, \ + (INFO).endian = BFD_ENDIAN_UNKNOWN, \ + INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) + +/* Call this macro to initialize only the internal variables for the + disassembler. Architecture dependent things such as byte order, or machine + variant are not touched by this macro. This makes things much easier for + GDB which must initialize these things seperatly. */ + +#define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \ (INFO).fprintf_func = (FPRINTF_FUNC), \ (INFO).stream = (STREAM), \ + (INFO).symbol = NULL, \ (INFO).buffer = NULL, \ (INFO).buffer_vma = 0, \ (INFO).buffer_length = 0, \ (INFO).read_memory_func = buffer_read_memory, \ (INFO).memory_error_func = perror_memory, \ (INFO).print_address_func = generic_print_address, \ - (INFO).arch = bfd_arch_unknown, \ - (INFO).mach = 0, \ - (INFO).endian = BFD_ENDIAN_UNKNOWN, \ (INFO).flags = 0, \ + (INFO).bytes_per_line = 0, \ + (INFO).bytes_per_chunk = 0, \ + (INFO).display_endian = BFD_ENDIAN_UNKNOWN, \ (INFO).insn_info_valid = 0 #endif /* ! defined (DIS_ASM_H) */ diff -urN binutils-2.7/include/elf/ChangeLog binutils-2.8/include/elf/ChangeLog --- binutils-2.7/include/elf/ChangeLog Thu Jul 4 12:35:18 1996 +++ binutils-2.8/include/elf/ChangeLog Wed Apr 30 12:57:01 1997 @@ -1,3 +1,86 @@ +Wed Mar 5 15:35:26 1997 Doug Evans + + * m32r.h (SHF_M32R_CAN_RELAX): Define. + +Mon Feb 24 17:49:01 1997 Ian Lance Taylor + + * external.h: Dump the 32/64 bit specific forms of the version + structures, and just define them as size independent. + + * common.h (VERSYM_HIDDEN, VERSYM_VERSION): Define. + +Fri Feb 21 13:00:34 1997 Doug Evans + + * m32r.h (enum reloc_type): Add R_M32R_SDA16. + (SHN_M32R_SCOMMON): Define. + +Wed Feb 19 15:35:31 1997 Ian Lance Taylor + + From Eric Youngdale : + * external.h, internal.h, common.h: Added new structures and + definitions for ELF versions. + +Mon Jan 27 11:54:44 1997 Doug Evans + + * m32r.h (enum reloc_type): Add R_M32R_HI16_[SU]LO,R_M32R_LO16. + +Tue Dec 31 14:44:32 1996 Ian Lance Taylor + + * common.h (DT_AUXILIARY): Define. + (DT_FILTER): Define. + +Wed Dec 4 05:03:37 1996 Jason Merrill + + * dwarf2.h: Update. + +Tue Nov 26 10:44:47 1996 Ian Lance Taylor + + * mips.h (STO_MIPS16): Define. + +Tue Nov 12 15:45:42 1996 Martin M. Hunt + + * d10v.h: Remove empty file. + +Tue Oct 8 11:31:24 1996 Ian Lance Taylor + + * mips.h (EF_MIPS_ABI2): Define. + +Thu Oct 3 10:01:40 1996 Jeffrey A Law (law@cygnus.com) + + * common.h: Break mn10x00 support into mn10200 and mn10300. + +Wed Oct 2 21:26:43 1996 Jeffrey A Law (law@cygnus.com) + + * common.h (EM_CYGNUS_MN10x00): Define. + +Mon Sep 23 09:18:04 1996 Doug Evans + + * m32r.h: New file. + +Fri Aug 30 17:06:21 1996 Ian Lance Taylor + + * common.h (EM_SH): Define. + +Mon Aug 19 10:59:10 1996 Doug Evans + + * common.h (EM_CYGNUS_M32R): Define. + +Mon Jul 22 18:59:55 1996 Ian Lance Taylor + + * mips.h (SHT_MIPS_IFACE, SHT_MIPS_CONTENT): Define. + (SHT_MIPS_SYMBOL_LIB): Define. + (SHF_MIPS_MERGE, SHF_MIPS_ADDR32, SHF_MIPS_ADDR64): Define. + (SHF_MIPS_NOSTRIP, SHF_MIPS_LOCAL, SHF_MIPS_NAMES): Define. + +Thu Jul 18 19:12:15 1996 Stan Shebs + + * dwarf2.h: New file. + +Jul 18 13:20:39 1996 Martin M. Hunt + + * common.h (EM_CYGNUS_D10V): Define. + * d10v.h: New file. + Fri Jun 21 12:33:24 1996 Richard Henderson * alpha.h: New file. diff -urN binutils-2.7/include/elf/alpha.h binutils-2.8/include/elf/alpha.h --- binutils-2.7/include/elf/alpha.h Thu Jul 4 12:21:17 1996 +++ binutils-2.8/include/elf/alpha.h Wed Apr 30 12:57:02 1997 @@ -64,10 +64,14 @@ #define R_ALPHA_SREL16 9 /* PC relative 16 bit */ #define R_ALPHA_SREL32 10 /* PC relative 32 bit */ #define R_ALPHA_SREL64 11 /* PC relative 64 bit */ + +/* Inherited these from ECOFF, but they are not particularly useful + and are depreciated. And not implemented in the BFD, btw. */ #define R_ALPHA_OP_PUSH 12 /* OP stack push */ #define R_ALPHA_OP_STORE 13 /* OP stack pop and store */ #define R_ALPHA_OP_PSUB 14 /* OP stack subtract */ #define R_ALPHA_OP_PRSHIFT 15 /* OP stack right shift */ + #define R_ALPHA_GPVALUE 16 #define R_ALPHA_GPRELHIGH 17 #define R_ALPHA_GPRELLOW 18 @@ -76,6 +80,8 @@ #define R_ALPHA_IMMED_SCN_HI32 21 #define R_ALPHA_IMMED_BR_HI32 22 #define R_ALPHA_IMMED_LO32 23 + +/* These relocations are specific to shared libraries. */ #define R_ALPHA_COPY 24 /* Copy symbol at runtime */ #define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ #define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ diff -urN binutils-2.7/include/elf/common.h binutils-2.8/include/elf/common.h --- binutils-2.7/include/elf/common.h Thu Jul 4 12:35:18 1996 +++ binutils-2.8/include/elf/common.h Wed Apr 30 12:57:02 1997 @@ -1,5 +1,5 @@ /* ELF support for BFD. - Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, from information published in "UNIX System V Release 4, Programmers Guide: ANSI C and @@ -90,9 +90,15 @@ #define EM_PPC 20 /* PowerPC */ +#define EM_SH 42 /* Hitachi SH */ + /* If it is necessary to assign new unofficial EM_* values, please pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision - with official or non-GNU unofficial values. */ + with official or non-GNU unofficial values. + + NOTE: Do not just increment the most recent number by one. + Somebody else somewhere will do exactly the same thing, and you + will have a collision. Instead, pick a random number. */ /* Cygnus PowerPC ELF backend. Written in the absence of an ABI. */ #define EM_CYGNUS_POWERPC 0x9025 @@ -101,9 +107,24 @@ #define EM_PPC_OLD 17 +/* Cygnus M32R ELF backend. Written in the absence of an ABI. */ +#define EM_CYGNUS_M32R 0x9041 + /* Alpha backend magic number. Written in the absence of an ABI. */ #define EM_ALPHA 0x9026 +/* D10V backend magic number. Written in the absence of an ABI. */ +#define EM_CYGNUS_D10V 0x7650 + + + +/* mn10200 and mn10300 backend magic numbers. + Written in the absense of an ABI. */ +#define EM_CYGNUS_MN10200 0xdead +#define EM_CYGNUS_MN10300 0xbeef + +/* See the above comment before you add a new EM_* value here. */ + /* Values for e_version */ #define EV_NONE 0 /* Invalid ELF version */ @@ -142,6 +163,18 @@ #define SHT_REL 9 /* Relocation entries, no addends */ #define SHT_SHLIB 10 /* Reserved, unspecified semantics */ #define SHT_DYNSYM 11 /* Dynamic linking symbol table */ + +/* The next three section types are defined by Solaris, and are named + SHT_SUNW*. We use them in GNU code, so we also define SHT_GNU* + versions. */ +#define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */ +#define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */ +#define SHT_SUNW_versym 0x6fffffff /* Symbol versions */ + +#define SHT_GNU_verdef SHT_SUNW_verdef +#define SHT_GNU_verneed SHT_SUNW_verneed +#define SHT_GNU_versym SHT_SUNW_versym + #define SHT_LOPROC 0x70000000 /* Processor-specific semantics, lo */ #define SHT_HIPROC 0x7FFFFFFF /* Processor-specific semantics, hi */ #define SHT_LOUSER 0x80000000 /* Application-specific semantics */ @@ -236,7 +269,65 @@ #define DT_DEBUG 21 #define DT_TEXTREL 22 #define DT_JMPREL 23 + +/* The next four dynamic tags are used on Solaris. We support them + everywhere. */ +#define DT_VERDEF 0x6ffffffc +#define DT_VERDEFNUM 0x6ffffffd +#define DT_VERNEED 0x6ffffffe +#define DT_VERNEEDNUM 0x6fffffff + +/* This tag is a GNU extension to the Solaris version scheme. */ +#define DT_VERSYM 0x6ffffff0 + #define DT_LOPROC 0x70000000 #define DT_HIPROC 0x7fffffff + +/* These section tags are used on Solaris. We support them + everywhere, and hope they do not conflict. */ + +#define DT_AUXILIARY 0x7ffffffd +#define DT_FILTER 0x7fffffff + +/* These constants are used for the version number of a Elf32_Verdef + structure. */ + +#define VER_DEF_NONE 0 +#define VER_DEF_CURRENT 1 + +/* These constants appear in the vd_flags field of a Elf32_Verdef + structure. */ + +#define VER_FLG_BASE 0x1 +#define VER_FLG_WEAK 0x2 + +/* These special constants can be found in an Elf32_Versym field. */ + +#define VER_NDX_LOCAL 0 +#define VER_NDX_GLOBAL 1 + +/* These constants are used for the version number of a Elf32_Verneed + structure. */ + +#define VER_NEED_NONE 0 +#define VER_NEED_CURRENT 1 + +/* This flag appears in a Versym structure. It means that the symbol + is hidden, and is only visible with an explicit version number. + This is a GNU extension. */ + +#define VERSYM_HIDDEN 0x8000 + +/* This is the mask for the rest of the Versym information. */ + +#define VERSYM_VERSION 0x7fff + +/* This is a special token which appears as part of a symbol name. It + indictes that the rest of the name is actually the name of a + version node, and is not part of the actual name. This is a GNU + extension. For example, the symbol name `stat@ver2' is taken to + mean the symbol `stat' in version `ver2'. */ + +#define ELF_VER_CHR '@' #endif /* _ELF_COMMON_H */ diff -urN binutils-2.7/include/elf/dwarf2.h binutils-2.8/include/elf/dwarf2.h --- binutils-2.7/include/elf/dwarf2.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/include/elf/dwarf2.h Wed Apr 30 12:57:02 1997 @@ -0,0 +1,551 @@ +/* Declarations and definitions of codes relating to the DWARF symbolic + debugging information format. + Copyright (C) 1992, 1993, 1995, 1996 Free Software Foundation, Inc. + + Written by Gary Funck (gary@intrepid.com) The Ada Joint Program + Office (AJPO), Florida State Unviversity and Silicon Graphics Inc. + provided support for this effort -- June 21, 1995. + + Derived from the DWARF 1 implementation written by Ron Guilmette + (rfg@netcom.com), November 1990. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +GNU CC is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* This file is derived from the DWARF specification (a public document) + Revision 2.0.0 (July 27, 1993) developed by the UNIX International + Programming Languages Special Interest Group (UI/PLSIG) and distributed + by UNIX International. Copies of this specification are available from + UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054. */ + +#ifndef _ELF_DWARF2_H +#define _ELF_DWARF2_H + +/* Tag names and codes. */ + +enum dwarf_tag + { + DW_TAG_padding = 0x00, + DW_TAG_array_type = 0x01, + DW_TAG_class_type = 0x02, + DW_TAG_entry_point = 0x03, + DW_TAG_enumeration_type = 0x04, + DW_TAG_formal_parameter = 0x05, + DW_TAG_imported_declaration = 0x08, + DW_TAG_label = 0x0a, + DW_TAG_lexical_block = 0x0b, + DW_TAG_member = 0x0d, + DW_TAG_pointer_type = 0x0f, + DW_TAG_reference_type = 0x10, + DW_TAG_compile_unit = 0x11, + DW_TAG_string_type = 0x12, + DW_TAG_structure_type = 0x13, + DW_TAG_subroutine_type = 0x15, + DW_TAG_typedef = 0x16, + DW_TAG_union_type = 0x17, + DW_TAG_unspecified_parameters = 0x18, + DW_TAG_variant = 0x19, + DW_TAG_common_block = 0x1a, + DW_TAG_common_inclusion = 0x1b, + DW_TAG_inheritance = 0x1c, + DW_TAG_inlined_subroutine = 0x1d, + DW_TAG_module = 0x1e, + DW_TAG_ptr_to_member_type = 0x1f, + DW_TAG_set_type = 0x20, + DW_TAG_subrange_type = 0x21, + DW_TAG_with_stmt = 0x22, + DW_TAG_access_declaration = 0x23, + DW_TAG_base_type = 0x24, + DW_TAG_catch_block = 0x25, + DW_TAG_const_type = 0x26, + DW_TAG_constant = 0x27, + DW_TAG_enumerator = 0x28, + DW_TAG_file_type = 0x29, + DW_TAG_friend = 0x2a, + DW_TAG_namelist = 0x2b, + DW_TAG_namelist_item = 0x2c, + DW_TAG_packed_type = 0x2d, + DW_TAG_subprogram = 0x2e, + DW_TAG_template_type_param = 0x2f, + DW_TAG_template_value_param = 0x30, + DW_TAG_thrown_type = 0x31, + DW_TAG_try_block = 0x32, + DW_TAG_variant_part = 0x33, + DW_TAG_variable = 0x34, + DW_TAG_volatile_type = 0x35, + /* SGI/MIPS Extensions */ + DW_TAG_MIPS_loop = 0x4081, + /* GNU extensions */ + DW_TAG_format_label = 0x4101, /* for FORTRAN 77 and Fortran 90 */ + DW_TAG_function_template = 0x4102, /* for C++ */ + DW_TAG_class_template = 0x4103 /* for C++ */ + }; + +#define DW_TAG_lo_user 0x4080 +#define DW_TAG_hi_user 0xffff + +/* flag that tells whether entry has a child or not */ +#define DW_children_no 0 +#define DW_children_yes 1 + +/* Form names and codes. */ +enum dwarf_form + { + DW_FORM_addr = 0x01, + DW_FORM_block2 = 0x03, + DW_FORM_block4 = 0x04, + DW_FORM_data2 = 0x05, + DW_FORM_data4 = 0x06, + DW_FORM_data8 = 0x07, + DW_FORM_string = 0x08, + DW_FORM_block = 0x09, + DW_FORM_block1 = 0x0a, + DW_FORM_data1 = 0x0b, + DW_FORM_flag = 0x0c, + DW_FORM_sdata = 0x0d, + DW_FORM_strp = 0x0e, + DW_FORM_udata = 0x0f, + DW_FORM_ref_addr = 0x10, + DW_FORM_ref1 = 0x11, + DW_FORM_ref2 = 0x12, + DW_FORM_ref4 = 0x13, + DW_FORM_ref8 = 0x14, + DW_FORM_ref_udata = 0x15, + DW_FORM_indirect = 0x16 + }; + +/* Attribute names and codes. */ + +enum dwarf_attribute + { + DW_AT_sibling = 0x01, + DW_AT_location = 0x02, + DW_AT_name = 0x03, + DW_AT_ordering = 0x09, + DW_AT_subscr_data = 0x0a, + DW_AT_byte_size = 0x0b, + DW_AT_bit_offset = 0x0c, + DW_AT_bit_size = 0x0d, + DW_AT_element_list = 0x0f, + DW_AT_stmt_list = 0x10, + DW_AT_low_pc = 0x11, + DW_AT_high_pc = 0x12, + DW_AT_language = 0x13, + DW_AT_member = 0x14, + DW_AT_discr = 0x15, + DW_AT_discr_value = 0x16, + DW_AT_visibility = 0x17, + DW_AT_import = 0x18, + DW_AT_string_length = 0x19, + DW_AT_common_reference = 0x1a, + DW_AT_comp_dir = 0x1b, + DW_AT_const_value = 0x1c, + DW_AT_containing_type = 0x1d, + DW_AT_default_value = 0x1e, + DW_AT_inline = 0x20, + DW_AT_is_optional = 0x21, + DW_AT_lower_bound = 0x22, + DW_AT_producer = 0x25, + DW_AT_prototyped = 0x27, + DW_AT_return_addr = 0x2a, + DW_AT_start_scope = 0x2c, + DW_AT_stride_size = 0x2e, + DW_AT_upper_bound = 0x2f, + DW_AT_abstract_origin = 0x31, + DW_AT_accessibility = 0x32, + DW_AT_address_class = 0x33, + DW_AT_artificial = 0x34, + DW_AT_base_types = 0x35, + DW_AT_calling_convention = 0x36, + DW_AT_count = 0x37, + DW_AT_data_member_location = 0x38, + DW_AT_decl_column = 0x39, + DW_AT_decl_file = 0x3a, + DW_AT_decl_line = 0x3b, + DW_AT_declaration = 0x3c, + DW_AT_discr_list = 0x3d, + DW_AT_encoding = 0x3e, + DW_AT_external = 0x3f, + DW_AT_frame_base = 0x40, + DW_AT_friend = 0x41, + DW_AT_identifier_case = 0x42, + DW_AT_macro_info = 0x43, + DW_AT_namelist_items = 0x44, + DW_AT_priority = 0x45, + DW_AT_segment = 0x46, + DW_AT_specification = 0x47, + DW_AT_static_link = 0x48, + DW_AT_type = 0x49, + DW_AT_use_location = 0x4a, + DW_AT_variable_parameter = 0x4b, + DW_AT_virtuality = 0x4c, + DW_AT_vtable_elem_location = 0x4d, + /* SGI/MIPS Extensions */ + DW_AT_MIPS_fde = 0x2001, + DW_AT_MIPS_loop_begin = 0x2002, + DW_AT_MIPS_tail_loop_begin = 0x2003, + DW_AT_MIPS_epilog_begin = 0x2004, + DW_AT_MIPS_loop_unroll_factor = 0x2005, + DW_AT_MIPS_software_pipeline_depth = 0x2006, + DW_AT_MIPS_linkage_name = 0x2007, + DW_AT_MIPS_stride = 0x2008, + DW_AT_MIPS_abstract_name = 0x2009, + DW_AT_MIPS_clone_origin = 0x200a, + DW_AT_MIPS_has_inlines = 0x200b, + /* GNU extensions. */ + DW_AT_sf_names = 0x2101, + DW_AT_src_info = 0x2102, + DW_AT_mac_info = 0x2103, + DW_AT_src_coords = 0x2104, + DW_AT_body_begin = 0x2105, + DW_AT_body_end = 0x2106 + }; + +#define DW_AT_lo_user 0x2000 /* implementation-defined range start */ +#define DW_AT_hi_user 0x3ff0 /* implementation-defined range end */ + +/* Location atom names and codes. */ + +enum dwarf_location_atom + { + DW_OP_addr = 0x03, + DW_OP_deref = 0x06, + DW_OP_const1u = 0x08, + DW_OP_const1s = 0x09, + DW_OP_const2u = 0x0a, + DW_OP_const2s = 0x0b, + DW_OP_const4u = 0x0c, + DW_OP_const4s = 0x0d, + DW_OP_const8u = 0x0e, + DW_OP_const8s = 0x0f, + DW_OP_constu = 0x10, + DW_OP_consts = 0x11, + DW_OP_dup = 0x12, + DW_OP_drop = 0x13, + DW_OP_over = 0x14, + DW_OP_pick = 0x15, + DW_OP_swap = 0x16, + DW_OP_rot = 0x17, + DW_OP_xderef = 0x18, + DW_OP_abs = 0x19, + DW_OP_and = 0x1a, + DW_OP_div = 0x1b, + DW_OP_minus = 0x1c, + DW_OP_mod = 0x1d, + DW_OP_mul = 0x1e, + DW_OP_neg = 0x1f, + DW_OP_not = 0x20, + DW_OP_or = 0x21, + DW_OP_plus = 0x22, + DW_OP_plus_uconst = 0x23, + DW_OP_shl = 0x24, + DW_OP_shr = 0x25, + DW_OP_shra = 0x26, + DW_OP_xor = 0x27, + DW_OP_bra = 0x28, + DW_OP_eq = 0x29, + DW_OP_ge = 0x2a, + DW_OP_gt = 0x2b, + DW_OP_le = 0x2c, + DW_OP_lt = 0x2d, + DW_OP_ne = 0x2e, + DW_OP_skip = 0x2f, + DW_OP_lit0 = 0x30, + DW_OP_lit1 = 0x31, + DW_OP_lit2 = 0x32, + DW_OP_lit3 = 0x33, + DW_OP_lit4 = 0x34, + DW_OP_lit5 = 0x35, + DW_OP_lit6 = 0x36, + DW_OP_lit7 = 0x37, + DW_OP_lit8 = 0x38, + DW_OP_lit9 = 0x39, + DW_OP_lit10 = 0x3a, + DW_OP_lit11 = 0x3b, + DW_OP_lit12 = 0x3c, + DW_OP_lit13 = 0x3d, + DW_OP_lit14 = 0x3e, + DW_OP_lit15 = 0x3f, + DW_OP_lit16 = 0x40, + DW_OP_lit17 = 0x41, + DW_OP_lit18 = 0x42, + DW_OP_lit19 = 0x43, + DW_OP_lit20 = 0x44, + DW_OP_lit21 = 0x45, + DW_OP_lit22 = 0x46, + DW_OP_lit23 = 0x47, + DW_OP_lit24 = 0x48, + DW_OP_lit25 = 0x49, + DW_OP_lit26 = 0x4a, + DW_OP_lit27 = 0x4b, + DW_OP_lit28 = 0x4c, + DW_OP_lit29 = 0x4d, + DW_OP_lit30 = 0x4e, + DW_OP_lit31 = 0x4f, + DW_OP_reg0 = 0x50, + DW_OP_reg1 = 0x51, + DW_OP_reg2 = 0x52, + DW_OP_reg3 = 0x53, + DW_OP_reg4 = 0x54, + DW_OP_reg5 = 0x55, + DW_OP_reg6 = 0x56, + DW_OP_reg7 = 0x57, + DW_OP_reg8 = 0x58, + DW_OP_reg9 = 0x59, + DW_OP_reg10 = 0x5a, + DW_OP_reg11 = 0x5b, + DW_OP_reg12 = 0x5c, + DW_OP_reg13 = 0x5d, + DW_OP_reg14 = 0x5e, + DW_OP_reg15 = 0x5f, + DW_OP_reg16 = 0x60, + DW_OP_reg17 = 0x61, + DW_OP_reg18 = 0x62, + DW_OP_reg19 = 0x63, + DW_OP_reg20 = 0x64, + DW_OP_reg21 = 0x65, + DW_OP_reg22 = 0x66, + DW_OP_reg23 = 0x67, + DW_OP_reg24 = 0x68, + DW_OP_reg25 = 0x69, + DW_OP_reg26 = 0x6a, + DW_OP_reg27 = 0x6b, + DW_OP_reg28 = 0x6c, + DW_OP_reg29 = 0x6d, + DW_OP_reg30 = 0x6e, + DW_OP_reg31 = 0x6f, + DW_OP_breg0 = 0x70, + DW_OP_breg1 = 0x71, + DW_OP_breg2 = 0x72, + DW_OP_breg3 = 0x73, + DW_OP_breg4 = 0x74, + DW_OP_breg5 = 0x75, + DW_OP_breg6 = 0x76, + DW_OP_breg7 = 0x77, + DW_OP_breg8 = 0x78, + DW_OP_breg9 = 0x79, + DW_OP_breg10 = 0x7a, + DW_OP_breg11 = 0x7b, + DW_OP_breg12 = 0x7c, + DW_OP_breg13 = 0x7d, + DW_OP_breg14 = 0x7e, + DW_OP_breg15 = 0x7f, + DW_OP_breg16 = 0x80, + DW_OP_breg17 = 0x81, + DW_OP_breg18 = 0x82, + DW_OP_breg19 = 0x83, + DW_OP_breg20 = 0x84, + DW_OP_breg21 = 0x85, + DW_OP_breg22 = 0x86, + DW_OP_breg23 = 0x87, + DW_OP_breg24 = 0x88, + DW_OP_breg25 = 0x89, + DW_OP_breg26 = 0x8a, + DW_OP_breg27 = 0x8b, + DW_OP_breg28 = 0x8c, + DW_OP_breg29 = 0x8d, + DW_OP_breg30 = 0x8e, + DW_OP_breg31 = 0x8f, + DW_OP_regx = 0x90, + DW_OP_fbreg = 0x91, + DW_OP_bregx = 0x92, + DW_OP_piece = 0x93, + DW_OP_deref_size = 0x94, + DW_OP_xderef_size = 0x95, + DW_OP_nop = 0x96 + }; + +#define DW_OP_lo_user 0x80 /* implementation-defined range start */ +#define DW_OP_hi_user 0xff /* implementation-defined range end */ + +/* Type encodings. */ + +enum dwarf_type + { + DW_ATE_void = 0x0, + DW_ATE_address = 0x1, + DW_ATE_boolean = 0x2, + DW_ATE_complex_float = 0x3, + DW_ATE_float = 0x4, + DW_ATE_signed = 0x5, + DW_ATE_signed_char = 0x6, + DW_ATE_unsigned = 0x7, + DW_ATE_unsigned_char = 0x8 + }; + +#define DW_ATE_lo_user 0x80 +#define DW_ATE_hi_user 0xff + +/* Array ordering names and codes. */ +enum dwarf_array_dim_ordering + { + DW_ORD_row_major = 0, + DW_ORD_col_major = 1 + }; + +/* access attribute */ +enum dwarf_access_attribute + { + DW_ACCESS_public = 1, + DW_ACCESS_protected = 2, + DW_ACCESS_private = 3 + }; + +/* visibility */ +enum dwarf_visibility_attribute + { + DW_VIS_local = 1, + DW_VIS_exported = 2, + DW_VIS_qualified = 3 + }; + +/* virtuality */ +enum dwarf_virtuality_attribute + { + DW_VIRTUALITY_none = 0, + DW_VIRTUALITY_virtual = 1, + DW_VIRTUALITY_pure_virtual = 2 + }; + +/* case sensitivity */ +enum dwarf_id_case + { + DW_ID_case_sensitive = 0, + DW_ID_up_case = 1, + DW_ID_down_case = 2, + DW_ID_case_insensitive = 3 + }; + +/* calling convention */ +enum dwarf_calling_convention + { + DW_CC_normal = 0x1, + DW_CC_program = 0x2, + DW_CC_nocall = 0x3 + }; + +#define DW_CC_lo_user 0x40 +#define DW_CC_hi_user 0xff + +/* inline attribute */ +enum dwarf_inline_attribute + { + DW_INL_not_inlined = 0, + DW_INL_inlined = 1, + DW_INL_declared_not_inlined = 2, + DW_INL_declared_inlined = 3 + }; + +/* descriminant lists */ +enum dwarf_descrim_list + { + DW_DSC_label = 0, + DW_DSC_range = 1 + }; + +/* line number opcodes */ +enum dwarf_line_number_ops + { + DW_LNS_extended_op = 0, + DW_LNS_copy = 1, + DW_LNS_advance_pc = 2, + DW_LNS_advance_line = 3, + DW_LNS_set_file = 4, + DW_LNS_set_column = 5, + DW_LNS_negate_stmt = 6, + DW_LNS_set_basic_block = 7, + DW_LNS_const_add_pc = 8, + DW_LNS_fixed_advance_pc = 9 + }; + +/* line number extended opcodes */ +enum dwarf_line_number_x_ops + { + DW_LNE_end_sequence = 1, + DW_LNE_set_address = 2, + DW_LNE_define_file = 3 + }; + +/* call frame information */ +enum dwarf_call_frame_info + { + DW_CFA_advance_loc = 0x40, + DW_CFA_offset = 0x80, + DW_CFA_restore = 0xc0, + DW_CFA_nop = 0x00, + DW_CFA_set_loc = 0x01, + DW_CFA_advance_loc1 = 0x02, + DW_CFA_advance_loc2 = 0x03, + DW_CFA_advance_loc4 = 0x04, + DW_CFA_offset_extended = 0x05, + DW_CFA_restore_extended = 0x06, + DW_CFA_undefined = 0x07, + DW_CFA_same_value = 0x08, + DW_CFA_register = 0x09, + DW_CFA_remember_state = 0x0a, + DW_CFA_restore_state = 0x0b, + DW_CFA_def_cfa = 0x0c, + DW_CFA_def_cfa_register = 0x0d, + DW_CFA_def_cfa_offset = 0x0e, + /* SGI/MIPS specific */ + DW_CFA_MIPS_advance_loc8 = 0x1d + }; + +#define DW_CIE_ID 0xffffffff +#define DW_CIE_VERSION 1 + +#define DW_CFA_extended 0 +#define DW_CFA_low_user 0x1c +#define DW_CFA_high_user 0x3f + +#define DW_CHILDREN_no 0x00 +#define DW_CHILDREN_yes 0x01 + +#define DW_ADDR_none 0 + +/* Source language names and codes. */ + +enum dwarf_source_language + { + DW_LANG_C89 = 0x0001, + DW_LANG_C = 0x0002, + DW_LANG_Ada83 = 0x0003, + DW_LANG_C_plus_plus = 0x0004, + DW_LANG_Cobol74 = 0x0005, + DW_LANG_Cobol85 = 0x0006, + DW_LANG_Fortran77 = 0x0007, + DW_LANG_Fortran90 = 0x0008, + DW_LANG_Pascal83 = 0x0009, + DW_LANG_Modula2 = 0x000a, + DW_LANG_Mips_Assembler = 0x8001 + }; + + +#define DW_LANG_lo_user 0x8000 /* implementation-defined range start */ +#define DW_LANG_hi_user 0xffff /* implementation-defined range start */ + +/* Names and codes for macro information. */ + +enum dwarf_macinfo_record_type + { + DW_MACINFO_define = 1, + DW_MACINFO_undef = 2, + DW_MACINFO_start_file = 3, + DW_MACINFO_end_file = 4, + DW_MACINFO_vendor_ext = 255 + }; + +#endif /* _ELF_DWARF2_H */ diff -urN binutils-2.7/include/elf/external.h binutils-2.8/include/elf/external.h --- binutils-2.7/include/elf/external.h Thu Jul 4 12:21:18 1996 +++ binutils-2.8/include/elf/external.h Wed Apr 30 12:57:02 1997 @@ -1,5 +1,5 @@ /* ELF support for BFD. - Copyright (C) 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 95, 1997 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, from information published in "UNIX System V Release 4, Programmers Guide: ANSI C and @@ -191,5 +191,55 @@ unsigned char d_ptr[8]; } d_un; } Elf64_External_Dyn; + +/* The version structures are currently size independent. They are + named without a 32 or 64. If that ever changes, these structures + will need to be renamed. */ + +/* This structure appears in a SHT_GNU_verdef section. */ + +typedef struct { + unsigned char vd_version[2]; + unsigned char vd_flags[2]; + unsigned char vd_ndx[2]; + unsigned char vd_cnt[2]; + unsigned char vd_hash[4]; + unsigned char vd_aux[4]; + unsigned char vd_next[4]; +} Elf_External_Verdef; + +/* This structure appears in a SHT_GNU_verdef section. */ + +typedef struct { + unsigned char vda_name[4]; + unsigned char vda_next[4]; +} Elf_External_Verdaux; + +/* This structure appears in a SHT_GNU_verneed section. */ + +typedef struct { + unsigned char vn_version[2]; + unsigned char vn_cnt[2]; + unsigned char vn_file[4]; + unsigned char vn_aux[4]; + unsigned char vn_next[4]; +} Elf_External_Verneed; + +/* This structure appears in a SHT_GNU_verneed section. */ + +typedef struct { + unsigned char vna_hash[4]; + unsigned char vna_flags[2]; + unsigned char vna_other[2]; + unsigned char vna_name[4]; + unsigned char vna_next[4]; +} Elf_External_Vernaux; + +/* This structure appears in a SHT_GNU_versym section. This is not a + standard ELF structure; ELF just uses Elf32_Half. */ + +typedef struct { + unsigned char vs_vers[2]; +} Elf_External_Versym; #endif /* _ELF_EXTERNAL_H */ diff -urN binutils-2.7/include/elf/internal.h binutils-2.8/include/elf/internal.h --- binutils-2.7/include/elf/internal.h Thu Jul 4 12:21:19 1996 +++ binutils-2.8/include/elf/internal.h Wed Apr 30 12:57:03 1997 @@ -1,5 +1,5 @@ /* ELF support for BFD. - Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, from information published in "UNIX System V Release 4, Programmers Guide: ANSI C and @@ -174,6 +174,99 @@ #define elf64_internal_dyn elf_internal_dyn #define Elf32_Internal_Dyn Elf_Internal_Dyn #define Elf64_Internal_Dyn Elf_Internal_Dyn + +/* This structure appears in a SHT_GNU_verdef section. */ + +typedef struct elf_internal_verdef { + unsigned short vd_version; /* Version number of structure. */ + unsigned short vd_flags; /* Flags (VER_FLG_*). */ + unsigned short vd_ndx; /* Version index. */ + unsigned short vd_cnt; /* Number of verdaux entries. */ + unsigned long vd_hash; /* Hash of name. */ + unsigned long vd_aux; /* Offset to verdaux entries. */ + unsigned long vd_next; /* Offset to next verdef. */ + + /* These fields are set up when BFD reads in the structure. FIXME: + It would be cleaner to store these in a different structure. */ + bfd *vd_bfd; /* BFD. */ + const char *vd_nodename; /* Version name. */ + struct elf_internal_verdef *vd_nextdef; /* vd_next as pointer. */ + struct elf_internal_verdaux *vd_auxptr; /* vd_aux as pointer. */ + unsigned int vd_exp_refno; /* Used by the linker. */ +} Elf_Internal_Verdef; + +/* This structure appears in a SHT_GNU_verdef section. */ + +typedef struct elf_internal_verdaux { + unsigned long vda_name; /* String table offset of name. */ + unsigned long vda_next; /* Offset to next verdaux. */ + + /* These fields are set up when BFD reads in the structure. FIXME: + It would be cleaner to store these in a different structure. */ + const char *vda_nodename; /* vda_name as pointer. */ + struct elf_internal_verdaux *vda_nextptr; /* vda_next as pointer. */ +} Elf_Internal_Verdaux; + +/* This structure appears in a SHT_GNU_verneed section. */ + +typedef struct elf_internal_verneed { + unsigned short vn_version; /* Version number of structure. */ + unsigned short vn_cnt; /* Number of vernaux entries. */ + unsigned long vn_file; /* String table offset of library name. */ + unsigned long vn_aux; /* Offset to vernaux entries. */ + unsigned long vn_next; /* Offset to next verneed. */ + + /* These fields are set up when BFD reads in the structure. FIXME: + It would be cleaner to store these in a different structure. */ + bfd *vn_bfd; /* BFD. */ + const char *vn_filename; /* vn_file as pointer. */ + struct elf_internal_vernaux *vn_auxptr; /* vn_aux as pointer. */ + struct elf_internal_verneed *vn_nextref; /* vn_nextref as pointer. */ +} Elf_Internal_Verneed; + +/* This structure appears in a SHT_GNU_verneed section. */ + +typedef struct elf_internal_vernaux { + unsigned long vna_hash; /* Hash of dependency name. */ + unsigned short vna_flags; /* Flags (VER_FLG_*). */ + unsigned short vna_other; /* Unused. */ + unsigned long vna_name; /* String table offset to version name. */ + unsigned long vna_next; /* Offset to next vernaux. */ + + /* These fields are set up when BFD reads in the structure. FIXME: + It would be cleaner to store these in a different structure. */ + const char *vna_nodename; /* vna_name as pointer. */ + struct elf_internal_vernaux *vna_nextptr; /* vna_next as pointer. */ +} Elf_Internal_Vernaux; + +/* This structure appears in a SHT_GNU_versym section. This is not a + standard ELF structure; ELF just uses Elf32_Half. */ + +typedef struct elf_internal_versym { + unsigned short vs_vers; +} Elf_Internal_Versym; + +#define elf32_internal_verdef elf_internal_verdef +#define elf64_internal_verdef elf_internal_verdef +#define elf32_internal_verdaux elf_internal_verdaux +#define elf64_internal_verdaux elf_internal_verdaux +#define elf32_internal_verneed elf_internal_verneed +#define elf64_internal_verneed elf_internal_verneed +#define elf32_internal_vernaux elf_internal_vernaux +#define elf64_internal_vernaux elf_internal_vernaux +#define elf32_internal_versym elf_internal_versym +#define elf64_internal_versym elf_internal_versym + +#define Elf32_Internal_Verdef Elf_Internal_Verdef +#define Elf64_Internal_Verdef Elf_Internal_Verdef +#define Elf32_Internal_Verdaux Elf_Internal_Verdaux +#define Elf64_Internal_Verdaux Elf_Internal_Verdaux +#define Elf32_Internal_Verneed Elf_Internal_Verneed +#define Elf64_Internal_Verneed Elf_Internal_Verneed +#define Elf32_Internal_Vernaux Elf_Internal_Vernaux +#define Elf64_Internal_Vernaux Elf_Internal_Vernaux +#define Elf32_Internal_Versym Elf_Internal_Versym +#define Elf64_Internal_Versym Elf_Internal_Versym /* This structure is used to describe how sections should be assigned to program segments. */ diff -urN binutils-2.7/include/elf/m32r.h binutils-2.8/include/elf/m32r.h --- binutils-2.7/include/elf/m32r.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/include/elf/m32r.h Wed Apr 30 12:57:03 1997 @@ -0,0 +1,54 @@ +/* M32R ELF support for BFD. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _ELF_M32R_H +#define _ELF_M32R_H + +enum reloc_type +{ + R_M32R_NONE = 0, + R_M32R_16, + R_M32R_32, + R_M32R_24, + R_M32R_10_PCREL, + R_M32R_18_PCREL, + R_M32R_26_PCREL, + R_M32R_HI16_ULO, + R_M32R_HI16_SLO, + R_M32R_LO16, + R_M32R_SDA16, + R_M32R_max +}; + +/* Processor specific section indices. These sections do not actually + exist. Symbols with a st_shndx field corresponding to one of these + values have a special meaning. */ + +/* Small common symbol. */ +#define SHN_M32R_SCOMMON 0xff00 + +/* Processor specific section flags. */ + +/* This section contains sufficient relocs to be relaxed. + When relaxing, even relocs of branch instructions the assembler could + complete must be present because relaxing may cause the branch target to + move. */ +#define SHF_M32R_CAN_RELAX 0x10000000 + +#endif diff -urN binutils-2.7/include/elf/mips.h binutils-2.8/include/elf/mips.h --- binutils-2.7/include/elf/mips.h Thu Jul 4 12:21:19 1996 +++ binutils-2.8/include/elf/mips.h Wed Apr 30 12:57:03 1997 @@ -39,6 +39,9 @@ position independent code. */ #define EF_MIPS_CPIC 0x00000004 +/* Code in file uses new ABI (-n32 on Irix 6). */ +#define EF_MIPS_ABI2 0x00000020 + /* Four bit MIPS architecture field. */ #define EF_MIPS_ARCH 0xf0000000 @@ -103,12 +106,21 @@ /* Section contains register usage information. */ #define SHT_MIPS_REGINFO 0x70000006 +/* Section contains interface information. */ +#define SHT_MIPS_IFACE 0x7000000b + +/* Section contains description of contents of another section. */ +#define SHT_MIPS_CONTENT 0x7000000c + /* Section contains miscellaneous options. */ #define SHT_MIPS_OPTIONS 0x7000000d /* DWARF debugging section. */ #define SHT_MIPS_DWARF 0x7000001e +/* I'm not sure what this is, but it appears on Irix 6. */ +#define SHT_MIPS_SYMBOL_LIB 0x70000020 + /* Events section. */ #define SHT_MIPS_EVENTS 0x70000021 @@ -215,6 +227,24 @@ /* This section must be in the global data area. */ #define SHF_MIPS_GPREL 0x10000000 + +/* This section should be merged. */ +#define SHF_MIPS_MERGE 0x20000000 + +/* This section contains 32 bit addresses. */ +#define SHF_MIPS_ADDR32 0x40000000 + +/* This section contains 64 bit addresses. */ +#define SHF_MIPS_ADDR64 0x80000000 + +/* This section may not be stripped. */ +#define SHF_MIPS_NOSTRIP 0x08000000 + +/* This section is local to threads. */ +#define SHF_MIPS_LOCAL 0x04000000 + +/* Linker should generate implicit weak names for this section. */ +#define SHF_MIPS_NAMES 0x02000000 /* Processor specific program header types. */ @@ -296,6 +326,9 @@ #define STO_INTERNAL 0x01 #define STO_HIDDEN 0x02 #define STO_PROTECTED 0x03 + +/* This value is used for a mips16 .text symbol. */ +#define STO_MIPS16 0xf0 /* The 64-bit MIPS ELF ABI uses an usual reloc format. Each relocation entry specifies up to three actual relocations, all at diff -urN binutils-2.7/include/fnmatch.h binutils-2.8/include/fnmatch.h --- binutils-2.7/include/fnmatch.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/include/fnmatch.h Wed Apr 30 12:56:56 1997 @@ -0,0 +1,69 @@ +/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. + +NOTE: The canonical source of this file is maintained with the GNU C Library. +Bugs can be reported to bug-glibc@prep.ai.mit.edu. + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef _FNMATCH_H + +#define _FNMATCH_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined (__cplusplus) || (defined (__STDC__) && __STDC__) +#undef __P +#define __P(args) args +#else /* Not C++ or ANSI C. */ +#undef __P +#define __P(args) () +/* We can get away without defining `const' here only because in this file + it is used only inside the prototype for `fnmatch', which is elided in + non-ANSI C where `const' is problematical. */ +#endif /* C++ or ANSI C. */ + + +/* We #undef these before defining them because some losing systems + (HP-UX A.08.07 for example) define these in . */ +#undef FNM_PATHNAME +#undef FNM_NOESCAPE +#undef FNM_PERIOD + +/* Bits set in the FLAGS argument to `fnmatch'. */ +#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ +#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ +#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ + +#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE) +#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ +#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ +#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ +#endif + +/* Value returned by `fnmatch' if STRING does not match PATTERN. */ +#define FNM_NOMATCH 1 + +/* Match STRING against the filename pattern PATTERN, + returning zero if it matches, FNM_NOMATCH if not. */ +extern int fnmatch __P ((const char *__pattern, const char *__string, + int __flags)); + +#ifdef __cplusplus +} +#endif + +#endif /* fnmatch.h */ diff -urN binutils-2.7/include/libiberty.h binutils-2.8/include/libiberty.h --- binutils-2.7/include/libiberty.h Thu Jul 4 12:21:04 1996 +++ binutils-2.8/include/libiberty.h Wed Apr 30 12:57:04 1997 @@ -21,9 +21,16 @@ extern void freeargv PARAMS ((char **)); -/* Return the last component of a path name. */ +/* Return the last component of a path name. Note that we can't use a + prototype here because the parameter is declared inconsistently + across different systems, sometimes as "char *" and sometimes as + "const char *" */ +#if defined(__GNU_LIBRARY__ ) || defined (__linux__) +extern char *basename PARAMS ((const char *)); +#else extern char *basename (); +#endif /* Concatenate an arbitrary number of strings, up to (char *) NULL. Allocates memory using xmalloc. */ @@ -104,20 +111,20 @@ /* Allocate memory without fail. If malloc fails, this will print a message to stderr (using the name set by xmalloc_set_program_name, - if any) and then call xexit. + if any) and then call xexit. */ - FIXME: We do not declare the parameter type (size_t) in order to - avoid conflicts with other declarations of xmalloc that exist in - programs which use libiberty. */ - -extern PTR xmalloc (); +#ifdef ANSI_PROTOTYPES +/* Get a definition for size_t. */ +#include +#endif +extern PTR xmalloc PARAMS ((size_t)); /* Reallocate memory without fail. This works like xmalloc. FIXME: We do not declare the parameter types for the same reason as xmalloc. */ -extern PTR xrealloc (); +extern PTR xrealloc PARAMS ((PTR, size_t)); /* Copy a string into a memory buffer without fail. */ diff -urN binutils-2.7/include/objalloc.h binutils-2.8/include/objalloc.h --- binutils-2.7/include/objalloc.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/include/objalloc.h Wed Apr 30 12:57:04 1997 @@ -0,0 +1,115 @@ +/* objalloc.h -- routines to allocate memory for objects + Copyright 1997 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Solutions. + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef OBJALLOC_H +#define OBJALLOC_H + +#include "ansidecl.h" + +/* These routines allocate space for an object. The assumption is + that the object will want to allocate space as it goes along, but + will never want to free any particular block. There is a function + to free a block, which also frees all more recently allocated + blocks. There is also a function to free all the allocated space. + + This is essentially a specialization of obstacks. The main + difference is that a block may not be allocated a bit at a time. + Another difference is that these routines are always built on top + of malloc, and always pass an malloc failure back to the caller, + unlike more recent versions of obstacks. */ + +/* This is what an objalloc structure looks like. Callers should not + refer to these fields, nor should they allocate these structure + themselves. Instead, they should only create them via + objalloc_init, and only access them via the functions and macros + listed below. The structure is only defined here so that we can + access it via macros. */ + +struct objalloc +{ + char *current_ptr; + unsigned int current_space; + PTR chunks; +}; + +/* Work out the required alignment. */ + +struct objalloc_align { char x; double d; }; + +#if defined (__STDC__) && __STDC__ +#ifndef offsetof +#include +#endif +#define OBJALLOC_ALIGN \ + ((ptrdiff_t) ((char *) &((struct objalloc_align *) 0)->d - (char *) 0)) +#else +#define OBJALLOC_ALIGN \ + ((long) ((char *) &((struct objalloc_align *) 0)->d - (char *) 0)) +#endif + +/* Create an objalloc structure. Returns NULL if malloc fails. */ + +extern struct objalloc *objalloc_create PARAMS ((void)); + +/* Allocate space from an objalloc structure. Returns NULL if malloc + fails. */ + +extern PTR _objalloc_alloc PARAMS ((struct objalloc *, unsigned long)); + +/* The macro version of objalloc_alloc. We only define this if using + gcc, because otherwise we would have to evaluate the arguments + multiple times, or use a temporary field as obstack.h does. */ + +#if defined (__GNUC__) && defined (__STDC__) && __STDC__ + +/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and + does not implement __extension__. But that compiler doesn't define + __GNUC_MINOR__. */ +#if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) +#define __extension__ +#endif + +#define objalloc_alloc(o, l) \ + __extension__ \ + ({ struct objalloc *__o = (o); \ + unsigned long __len = (l); \ + if (__len == 0) \ + __len = 1; \ + __len = (__len + OBJALLOC_ALIGN - 1) &~ (OBJALLOC_ALIGN - 1); \ + (__len <= __o->current_space \ + ? (__o->current_ptr += __len, \ + __o->current_space -= __len, \ + (PTR) (__o->current_ptr - __len)) \ + : _objalloc_alloc (__o, __len)); }) + +#else /* ! __GNUC__ */ + +#define objalloc_alloc(o, l) _objalloc_alloc ((o), (l)) + +#endif /* ! __GNUC__ */ + +/* Free an entire objalloc structure. */ + +extern void objalloc_free PARAMS ((struct objalloc *)); + +/* Free a block allocated by objalloc_alloc. This also frees all more + recently allocated blocks. */ + +extern void objalloc_free_block PARAMS ((struct objalloc *, PTR)); + +#endif /* OBJALLOC_H */ diff -urN binutils-2.7/include/obstack.h binutils-2.8/include/obstack.h --- binutils-2.7/include/obstack.h Thu Jul 4 12:21:05 1996 +++ binutils-2.8/include/obstack.h Wed Apr 30 12:57:05 1997 @@ -1,19 +1,19 @@ /* obstack.h - object stack macros - Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc. + Copyright (C) 1988,89,90,91,92,93,94,96 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it -under the terms of the GNU Library General Public License as published by the +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 Library General Public License for more details. +GNU General Public License for more details. -You should have received a copy of the GNU Library General Public License +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Summary: @@ -103,23 +103,23 @@ #ifndef __OBSTACK_H__ #define __OBSTACK_H__ -/* We use subtraction of (char *)0 instead of casting to int +/* We use subtraction of (char *) 0 instead of casting to int because on word-addressable machines a simple cast to int may ignore the byte-within-word field of the pointer. */ #ifndef __PTR_TO_INT -#define __PTR_TO_INT(P) ((P) - (char *)0) +#define __PTR_TO_INT(P) ((P) - (char *) 0) #endif #ifndef __INT_TO_PTR -#define __INT_TO_PTR(P) ((P) + (char *)0) +#define __INT_TO_PTR(P) ((P) + (char *) 0) #endif /* We need the type of the resulting object. In ANSI C it is ptrdiff_t but in traditional C it is usually long. If we are in ANSI C and don't already have ptrdiff_t get it. */ -#if defined (__STDC__) && ! defined (offsetof) +#if defined (__STDC__) && __STDC__ && ! defined (offsetof) #if defined (__GNUC__) && defined (IN_GCC) /* On Next machine, the system's stddef.h screws up if included after we have defined just ptrdiff_t, so include all of stddef.h. @@ -132,7 +132,7 @@ #include #endif -#ifdef __STDC__ +#if defined (__STDC__) && __STDC__ #define PTR_INT_TYPE ptrdiff_t #else #define PTR_INT_TYPE long @@ -148,15 +148,24 @@ struct obstack /* control current object in current chunk */ { long chunk_size; /* preferred size to allocate chunks in */ - struct _obstack_chunk* chunk; /* address of current struct obstack_chunk */ + struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ char *object_base; /* address of object we are building */ char *next_free; /* where to add next char to current object */ char *chunk_limit; /* address of char after current chunk */ PTR_INT_TYPE temp; /* Temporary for some macros. */ int alignment_mask; /* Mask of alignment for each object. */ +#if defined (__STDC__) && __STDC__ + /* These prototypes vary based on `use_extra_arg', and we use + casts to the prototypeless function type in all assignments, + but having prototypes here quiets -Wstrict-prototypes. */ + struct _obstack_chunk *(*chunkfun) (void *, long); + void (*freefun) (void *, struct _obstack_chunk *); + void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ +#else struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */ void (*freefun) (); /* User's function to free a chunk. */ char *extra_arg; /* first arg for chunk alloc/dealloc funcs */ +#endif unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ unsigned maybe_empty_object:1;/* There is a possibility that the current chunk contains a zero-length object. This @@ -167,23 +176,28 @@ /* Declare the external functions we use; they are in obstack.c. */ -#ifdef __STDC__ +#if defined (__STDC__) && __STDC__ extern void _obstack_newchunk (struct obstack *, int); extern void _obstack_free (struct obstack *, void *); extern int _obstack_begin (struct obstack *, int, int, - void *(*) (), void (*) ()); + void *(*) (long), void (*) (void *)); extern int _obstack_begin_1 (struct obstack *, int, int, - void *(*) (), void (*) (), void *); + void *(*) (void *, long), + void (*) (void *, void *), void *); +/* CYGNUS LOCAL */ extern int _obstack_memory_used (struct obstack *); +/* END CYGNUS LOCAL */ #else extern void _obstack_newchunk (); extern void _obstack_free (); extern int _obstack_begin (); extern int _obstack_begin_1 (); +/* CYGNUS LOCAL */ extern int _obstack_memory_used (); +/* END CYGNUS LOCAL */ #endif -#ifdef __STDC__ +#if defined (__STDC__) && __STDC__ /* Do the function-declarations after the structs but before defining the macros. */ @@ -220,7 +234,9 @@ void * obstack_next_free (struct obstack *obstack); int obstack_alignment_mask (struct obstack *obstack); int obstack_chunk_size (struct obstack *obstack); +/* CYGNUS LOCAL */ int obstack_memory_used (struct obstack *obstack); +/* END CYGNUS LOCAL */ #endif /* __STDC__ */ @@ -245,6 +261,34 @@ #define obstack_alignment_mask(h) ((h)->alignment_mask) +/* To prevent prototype warnings provide complete argument list in + standard C version. */ +#if defined (__STDC__) && __STDC__ + +#define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) + +#define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) + +#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + (void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun)) + +#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ + _obstack_begin_1 ((h), (size), (alignment), \ + (void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun), (arg)) + +#define obstack_chunkfun(h, newchunkfun) \ + ((h) -> chunkfun = (struct _obstack_chunk *(*)(long)) (newchunkfun)) + +#define obstack_freefun(h, newfreefun) \ + ((h) -> freefun = (void (*)(void *)) (newfreefun)) + +#else + #define obstack_init(h) \ _obstack_begin ((h), 0, 0, \ (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) @@ -267,14 +311,21 @@ #define obstack_freefun(h, newfreefun) \ ((h) -> freefun = (void (*)()) (newfreefun)) +#endif + #define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar) #define obstack_blank_fast(h,n) ((h)->next_free += (n)) +/* CYGNUS LOCAL */ #define obstack_memory_used(h) _obstack_memory_used (h) +/* END CYGNUS LOCAL */ -#if defined (__GNUC__) && defined (__STDC__) -#if __GNUC__ < 2 +#if defined (__GNUC__) && defined (__STDC__) && __STDC__ +/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and + does not implement __extension__. But that compiler doesn't define + __GNUC_MINOR__. */ +#if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) #define __extension__ #endif @@ -302,7 +353,7 @@ _obstack_newchunk (__o, __len); \ if (!__o->alloc_failed) \ { \ - bcopy (where, __o->next_free, __len); \ + memcpy (__o->next_free, (char *) (where), __len); \ __o->next_free += __len; \ } \ (void) 0; }) @@ -315,7 +366,7 @@ _obstack_newchunk (__o, __len + 1); \ if (!__o->alloc_failed) \ { \ - bcopy (where, __o->next_free, __len); \ + memcpy (__o->next_free, (char *) (where), __len); \ __o->next_free += __len; \ *(__o->next_free)++ = 0; \ } \ @@ -333,7 +384,7 @@ /* These assume that the obstack alignment is good enough for pointers or ints, and that the data added so far to the current object shares that much alignment. */ - + #define obstack_ptr_grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ @@ -352,8 +403,8 @@ *((int *)__o->next_free)++ = ((int)datum); \ (void) 0; }) -#define obstack_ptr_grow_fast(h,aptr) (*((void **)(h)->next_free)++ = (void *)aptr) -#define obstack_int_grow_fast(h,aint) (*((int *)(h)->next_free)++ = (int)aint) +#define obstack_ptr_grow_fast(h,aptr) (*((void **) (h)->next_free)++ = (void *)aptr) +#define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint) #define obstack_blank(OBSTACK,length) \ __extension__ \ @@ -433,7 +484,7 @@ (((h)->next_free + (h)->temp > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ ((h)->alloc_failed ? 0 : \ - (bcopy (where, (h)->next_free, (h)->temp), \ + (memcpy ((h)->next_free, (char *) (where), (h)->temp), \ (h)->next_free += (h)->temp))) #define obstack_grow0(h,where,length) \ @@ -441,7 +492,7 @@ (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \ ((h)->alloc_failed ? 0 : \ - (bcopy (where, (h)->next_free, (h)->temp), \ + (memcpy ((h)->next_free, (char *) (where), (h)->temp), \ (h)->next_free += (h)->temp, \ *((h)->next_free)++ = 0))) @@ -455,16 +506,16 @@ ( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ ((h)->alloc_failed ? 0 : \ - (*((char **)(((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *)datum)))) + (*((char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *) datum)))) #define obstack_int_grow(h,datum) \ ( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ ((h)->alloc_failed ? 0 : \ - (*((int *)(((h)->next_free+=sizeof(int))-sizeof(int))) = ((int)datum)))) + (*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = ((int) datum)))) -#define obstack_ptr_grow_fast(h,aptr) (*((char **)(h)->next_free)++ = (char *)aptr) -#define obstack_int_grow_fast(h,aint) (*((int *)(h)->next_free)++ = (int)aint) +#define obstack_ptr_grow_fast(h,aptr) (*((char **) (h)->next_free)++ = (char *) aptr) +#define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint) #define obstack_blank(h,length) \ ( (h)->temp = (length), \ @@ -491,22 +542,22 @@ (h)->next_free \ = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \ & ~ ((h)->alignment_mask)), \ - (((h)->next_free - (char *)(h)->chunk \ - > (h)->chunk_limit - (char *)(h)->chunk) \ + (((h)->next_free - (char *) (h)->chunk \ + > (h)->chunk_limit - (char *) (h)->chunk) \ ? ((h)->next_free = (h)->chunk_limit) : 0), \ (h)->object_base = (h)->next_free, \ __INT_TO_PTR ((h)->temp))) -#ifdef __STDC__ +#if defined (__STDC__) && __STDC__ #define obstack_free(h,obj) \ -( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \ +( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ ? (int) ((h)->next_free = (h)->object_base \ = (h)->temp + (char *) (h)->chunk) \ : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0))) #else #define obstack_free(h,obj) \ -( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \ +( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ ? (int) ((h)->next_free = (h)->object_base \ = (h)->temp + (char *) (h)->chunk) \ diff -urN binutils-2.7/include/opcode/ChangeLog binutils-2.8/include/opcode/ChangeLog --- binutils-2.7/include/opcode/ChangeLog Thu Jul 4 12:35:38 1996 +++ binutils-2.8/include/opcode/ChangeLog Wed Apr 30 12:57:17 1997 @@ -1,3 +1,202 @@ +Mon Apr 14 14:56:58 1997 Ian Lance Taylor + + * i386.h: Change the opcodes for fsubp, fsubrp, fdivp, and fdivrp + with no arguments to match that generated by the UnixWare + assembler. + +Thu Apr 10 14:35:00 1997 Doug Evans + + * cgen.h (_cgen_assemble_insn): New arg for errmsg. + (cgen_parse_operand_fn): Declare. + (cgen_init_parse_operand): Declare. + (cgen_parse_operand): Renamed from cgen_asm_parse_operand, + new argument `want'. + (enum cgen_parse_operand_result): Renamed from cgen_asm_result. + (enum cgen_parse_operand_type): New enum. + +Sat Apr 5 13:14:05 1997 Ian Lance Taylor + + * i386.h: Revert last patch for the NON_BROKEN_OPCODES cases. + +Fri Apr 4 11:46:11 1997 Doug Evans + + * cgen.h: New file. + +Fri Apr 4 14:02:32 1997 Ian Lance Taylor + + * i386.h: Correct opcode values for fsubp, fsubrp, fdivp, and + fdivrp. + +Mon Mar 24 14:38:15 1997 Ian Lance Taylor + + * i386.h: Add iclr. + +Thu Mar 20 19:49:10 1997 Ian Lance Taylor + + * i386.h: Change DW to W for cmpxchg and xadd, since they don't + take a direction bit. + +Sat Mar 15 19:03:29 1997 H.J. Lu + + * sparc.h (sparc_opcode_lookup_arch): Use full prototype. + +Fri Mar 14 15:22:01 1997 Ian Lance Taylor + + * sparc.h: Include . Update function declarations to + use prototypes, and to use const when appropriate. + +Thu Mar 6 14:18:30 1997 Jeffrey A Law (law@cygnus.com) + + * mn10300.h (MN10300_OPERAND_RELAX): Define. + +Mon Feb 24 15:15:56 1997 Martin M. Hunt + + * d10v.h: Change pre_defined_registers to + d10v_predefined_registers and reg_name_cnt to d10v_reg_name_cnt. + +Sat Feb 22 21:25:00 1997 Dawn Perchik + + * mips.h: Add macros for cop0, cop1 cop2 and cop3. + Change mips_opcodes from const array to a pointer, + and change bfd_mips_num_opcodes from const int to int, + so that we can increase the size of the mips opcodes table + dynamically. + +Wed Jan 29 09:37:25 1997 Jeffrey A Law (law@cygnus.com) + + * mn10200.h (MN10200_OPERAND_RELAX): Define. + +Wed Dec 18 10:06:31 1996 Jeffrey A Law (law@cygnus.com) + + * mn10200.h (MN10200_OPERAND_NOCHECK): Define. + +Sat Dec 14 10:48:31 1996 Fred Fish + + * mn10200.h: Fix comment, mn10200_operand not powerpc_operand. + * mn10300.h: Fix comment, mn10300_operand not powerpc_operand. + +Mon Dec 9 16:45:39 1996 Jeffrey A Law (law@cygnus.com) + + * mn10200.h: Flesh out structures and definitions needed by + the mn10200 assembler & disassembler. + +Tue Nov 26 10:46:56 1996 Ian Lance Taylor + + * mips.h: Add mips16 definitions. + +Mon Nov 25 17:56:54 1996 J.T. Conklin + + * m68k.h: Document new <, >, m, n, o and p operand specifiers. + +Wed Nov 20 10:59:41 1996 Jeffrey A Law (law@cygnus.com) + + * mn10300.h (MN10300_OPERAND_PCREL): Define. + (MN10300_OPERAND_MEMADDR): Define. + +Tue Nov 19 13:30:40 1996 Jeffrey A Law (law@cygnus.com) + + * mn10300.h (MN10300_OPERAND_REG_LIST): Define. + +Wed Nov 6 13:41:08 1996 Jeffrey A Law (law@cygnus.com) + + * mn10300.h (MN10300_OPERAND_SPLIT): Define. + +Tue Nov 5 13:26:12 1996 Jeffrey A Law (law@cygnus.com) + + * mn10300.h (MN10300_OPERAND_EXTENDED): Define. + +Mon Nov 4 12:52:48 1996 Jeffrey A Law (law@cygnus.com) + + * mn10300.h (MN10300_OPERAND_REPEATED): Define. + +Fri Nov 1 10:31:02 1996 Richard Henderson + + * alpha.h: Don't include "bfd.h"; private relocation types are now + negative to minimize problems with shared libraries. Organize + instruction subsets by AMASK extensions and PALcode + implementation. + (struct alpha_operand): Move flags slot for better packing. + +Thu Oct 10 14:29:11 1996 Jeffrey A Law (law@cygnus.com) + + * mn10300.h (FMT_*): Move operand format definitions + here. + +Tue Oct 8 14:48:07 1996 Jeffrey A Law (law@cygnus.com) + + * mn10300.h (MN10300_OPERAND_PAREN): Define. + +Mon Oct 7 16:52:11 1996 Jeffrey A Law (law@cygnus.com) + + * mn10300.h (mn10300_opcode): Add "format" field. + (MN10300_OPERAND_*): Define. + +Thu Oct 3 10:33:46 1996 Jeffrey A Law (law@cygnus.com) + + * mn10x00.h: Delete. + * mn10200.h, mn10300.h: New files. + +Wed Oct 2 21:31:26 1996 Jeffrey A Law (law@cygnus.com) + + * mn10x00.h: New file. + +Fri Sep 13 14:58:13 1996 Jeffrey A Law (law@cygnus.com) + + * h8300.h (stmac): Add missing instruction. + +Fri Aug 16 14:44:15 1996 James G. Smith + + * mips.h (OP_SH_LOCC, OP_SH_HICC, OP_MASK_CC, OP_SH_COP1NORM, + OP_MASK_COP1NORM, OP_SH_COP1SPEC, OP_MASK_COP1SPEC, + OP_MASK_COP1SCLR, OP_MASK_COP1CMP, OP_SH_COP1CMP, OP_SH_FORMAT, + OP_MASK_FORMAT, OP_SH_TRUE, OP_MASK_TRUE, OP_SH_GE, OP_MASK_GE, + OP_SH_UNSIGNED, OP_MASK_UNSIGNED, OP_SH_HINT, OP_MASK_HINT): + Defined. + +Fri Aug 16 00:15:15 1996 Jeffrey A Law (law@cygnus.com) + + * hppa.h (pitlb, pitlbe, iitlba, iitlbp, fic, fice): Accept + a 3 bit space id instead of a 2 bit space id. + +Thu Aug 15 13:11:46 1996 Martin M. Hunt + + * d10v.h: Add some additional defines to support the + assembler in determining which operations can be done in parallel. + +Tue Aug 6 11:13:22 1996 Jeffrey A Law (law@cygnus.com) + + * h8300.h (SN): Define. + (eepmov.b): Renamed from "eepmov" + (nop, bpt, rte, rts, sleep, clrmac): These have no size associated + with them. + +Fri Jul 26 11:47:10 1996 Martin M. Hunt + + * d10v.h (OPERAND_SHIFT): New operand flag. + +Thu Jul 25 12:06:22 1996 Martin M. Hunt + + * d10v.h: Changes for divs, parallel-only instructions, and + signed numbers. + +Mon Jul 22 11:21:15 1996 Martin M. Hunt + + * d10v.h (pd_reg): Define. Putting the definition here allows + the assembler and disassembler to share the same struct. + +Mon Jul 22 12:15:25 1996 Ian Lance Taylor + + * i960.h (i960_opcodes): "halt" takes an argument. From Stephen + Williams . + +Wed Jul 17 14:46:38 1996 Martin M. Hunt + + * d10v.h: New file. + +Thu Jul 11 12:09:15 1996 Jeffrey A Law (law@cygnus.com) + + * h8300.h (band, bclr): Force high bit of immediate nibble to zero. + Wed Jul 3 14:30:12 1996 J.T. Conklin * m68k.h (mcf5200): New macro. @@ -7,6 +206,12 @@ * h8300.h (SRC_IN_DST): Define. + * h8300.h (UNOP3): Mark the register operand in this insn + as a source operand, not a destination operand. + (SHIFT_2, SHIFT_IMM): Remove. Eliminate all references. + (UNOP3): Change SHIFT_IMM to IMM for H8/S bitops. Mark + register operand with SRC_IN_DST. + Fri Jun 21 13:52:17 1996 Richard Henderson * alpha.h: New file. @@ -28,6 +233,14 @@ (EBITOP): Likewise. (O_LAST): Bump. (ldc, stc, movb, movw, movl): Use 32bit offsets and absolutes. + + * h8300.h (EXR, SHIFT_2, MACREG, SHIFT_IMM, RDINC): Define. + (O_TAS, O_CLRMAC, O_LDMAC, O_MAC, O_LDM, O_STM): Define. + (BITOP, EBITOP): Handle new H8/S addressing modes for + bit insns. + (UNOP3): Handle new shift/rotate insns on the H8/S. + (insns using exr): New instructions. + (tas, mac, ldmac, clrmac, ldm, stm): New instructions. Thu May 23 16:56:48 1996 Jeffrey A Law (law@cygnus.com) diff -urN binutils-2.7/include/opcode/alpha.h binutils-2.8/include/opcode/alpha.h --- binutils-2.7/include/opcode/alpha.h Thu Jul 4 12:21:25 1996 +++ binutils-2.8/include/opcode/alpha.h Wed Apr 30 12:57:18 1997 @@ -22,8 +22,6 @@ #ifndef OPCODE_ALPHA_H #define OPCODE_ALPHA_H -#include "bfd.h" /* for bfd_reloc_code_real_type */ - /* The opcode table is an array of struct alpha_opcode. */ struct alpha_opcode @@ -41,8 +39,8 @@ match (and are presumably filled in by operands). */ unsigned mask; - /* One bit flags for the opcode. These are primarily used to - indicate specific processors and environments support the + /* One bit flags for the opcode. These are primarily used to + indicate specific processors and environments support the instructions. The defined values are listed below. */ unsigned flags; @@ -61,11 +59,14 @@ /* Values defined for the flags field of a struct alpha_opcode. */ /* CPU Availability */ -#define AXP_OPCODE_ALL 00001 -#define AXP_OPCODE_EV4 00002 -/* EV45 is not programatically different */ -#define AXP_OPCODE_EV5 00004 -#define AXP_OPCODE_EV56 00010 +#define AXP_OPCODE_BASE 0x0001 /* Base architecture -- all cpus. */ +#define AXP_OPCODE_EV4 0x0002 /* EV4 specific PALcode insns. */ +#define AXP_OPCODE_EV5 0x0004 /* EV5 specific PALcode insns. */ +#define AXP_OPCODE_BWX 0x0100 /* Byte/word extension (amask bit 0). */ +#define AXP_OPCODE_CIX 0x0200 /* "Count" extension (amask bit 1). */ +#define AXP_OPCODE_MAX 0x0400 /* Multimedia extension (amask bit 8). */ + +#define AXP_OPCODE_NOPAL (~(AXP_OPCODE_EV4|AXP_OPCODE_EV5)) /* A macro to extract the major opcode from an instruction. */ #define AXP_OP(i) (((i) >> 26) & 0x3F) @@ -85,7 +86,10 @@ int shift; /* The default relocation type for this operand. */ - bfd_reloc_code_real_type default_reloc; + int default_reloc; + + /* One bit syntax flags. */ + unsigned flags; /* Insertion function. This is used by the assembler. To insert an operand value into an instruction, check this field. @@ -124,9 +128,6 @@ this operand (i.e., the instruction does not match). If the operand is valid, *INVALID will not be changed. */ int (*extract) PARAMS ((unsigned instruction, int *invalid)); - - /* One bit syntax flags. */ - unsigned flags; }; /* Elements in the table are retrieved by indexing with values from diff -urN binutils-2.7/include/opcode/cgen.h binutils-2.8/include/opcode/cgen.h --- binutils-2.7/include/opcode/cgen.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/include/opcode/cgen.h Wed Apr 30 12:57:18 1997 @@ -0,0 +1,686 @@ +/* Header file for targets using CGEN: Cpu tools GENerator. + +Copyright (C) 1996, 1997 Free Software Foundation, Inc. + +This file is part of GDB, the GNU debugger, and the GNU Binutils. + +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 CGEN_H +#define CGEN_H + +#ifndef CGEN_CAT3 +#if defined(__STDC__) || defined(ALMOST_STDC) +#define CGEN_XCAT3(a,b,c) a ## b ## c +#define CGEN_CAT3(a,b,c) CGEN_XCAT3 (a, b, c) +#else +#define CGEN_CAT3(a,b,c) a/**/b/**/c +#endif +#endif + +/* Prepend the cpu name, defined in cpu-opc.h, and _cgen_ to symbol S. + The lack of spaces in the arg list is important for non-stdc systems. + This file is included by -opc.h. + It can be included independently of cpu-opc.h, in which case the cpu + dependent portions will be declared as "unknown_cgen_foo". */ + +#ifndef CGEN_SYM +#define CGEN_SYM(s) CGEN_CAT3 (unknown,_cgen_,s) +#endif + +/* This file contains the static (unchanging) pieces and as much other stuff + as we can reasonably put here. It's generally cleaner to put stuff here + rather than having it machine generated if possible. */ + +/* The assembler syntax is made up of expressions (duh...). + At the lowest level the values are mnemonics, register names, numbers, etc. + Above that are subexpressions, if any (an example might be the + "effective address" in m68k cpus). At the second highest level are the + insns themselves. Above that are pseudo-insns, synthetic insns, and macros, + if any. +*/ + +/* Lots of cpu's have a fixed insn size, or one which rarely changes, + and it's generally easier to handle these by treating the insn as an + integer type, rather than an array of characters. So we allow targets + to control this. */ + +#ifdef CGEN_INT_INSN +typedef unsigned int cgen_insn_t; +#else +typedef char *cgen_insn_t; +#endif + +#ifdef __GNUC__ +#define CGEN_INLINE inline +#else +#define CGEN_INLINE +#endif + +/* Perhaps we should just use bfd.h, but it's not clear + one would want to require that yet. */ +enum cgen_endian { + CGEN_ENDIAN_UNKNOWN, + CGEN_ENDIAN_LITTLE, + CGEN_ENDIAN_BIG +}; + +/* Attributes. + Attributes are used to describe various random things. */ + +/* Struct to record attribute information. */ +typedef struct { + unsigned int num_nonbools; + unsigned int bool; + unsigned int nonbool[1]; +} CGEN_ATTR; + +/* Define a structure member for attributes with N non-boolean entries. + The attributes are sorted so that the non-boolean ones come first. + num_nonbools: count of nonboolean attributes + bool: values of boolean attributes + nonbool: values of non-boolean attributes + There is a maximum of 32 attributes total. */ +#define CGEN_ATTR_TYPE(n) \ +const struct { unsigned int num_nonbools; \ + unsigned int bool; \ + unsigned int nonbool[(n) ? (n) : 1]; } + +/* Given an attribute number, return its mask. */ +#define CGEN_ATTR_MASK(attr) (1 << (attr)) + +/* Return value of attribute ATTR in ATTR_TABLE for OBJ. + OBJ is a pointer to the entity that has the attributes. + It's not used at present but is reserved for future purposes. */ +#define CGEN_ATTR_VALUE(obj, attr_table, attr) \ +((unsigned int) (attr) < (attr_table)->num_nonbools \ + ? ((attr_table)->nonbool[attr]) \ + : (((attr_table)->bool & (1 << (attr))) != 0)) + +/* Parse result (also extraction result). + + The result of parsing an insn is stored here. + To generate the actual insn, this is passed to the insert handler. + When printing an insn, the result of extraction is stored here. + To print the insn, this is passed to the print handler. + + It is machine generated so we don't define it here, + but we do need a forward decl for the handler fns. + + There is one member for each possible field in the insn. + The type depends on the field. + Also recorded here is the computed length of the insn for architectures + where it varies. +*/ + +struct cgen_fields; + +/* Total length of the insn, as recorded in the `fields' struct. */ +/* ??? The field insert handler has lots of opportunities for optimization + if it ever gets inlined. On architectures where insns all have the same + size, may wish to detect that and make this macro a constant - to allow + further optimizations. */ +#define CGEN_FIELDS_BITSIZE(fields) ((fields)->length) + +/* Associated with each insn or expression is a set of "handlers" for + performing operations like parsing, printing, etc. */ + +/* Forward decl. */ +typedef struct cgen_insn CGEN_INSN; + +/* Parse handler. + The first argument is a pointer to a struct describing the insn being + parsed. + The second argument is a pointer to a pointer to the text being parsed. + The third argument is a pointer to a cgen_fields struct + in which the results are placed. + If the expression is successfully parsed, the pointer to the text is + updated. If not it is left alone. + The result is NULL if success or an error message. */ +typedef const char * (cgen_parse_fn) PARAMS ((const struct cgen_insn *, + const char **, + struct cgen_fields *)); + +/* Print handler. + The first argument is a pointer to the disassembly info. + Eg: disassemble_info. It's defined as `PTR' so this file can be included + without dis-asm.h. + The second argument is a pointer to a struct describing the insn being + printed. + The third argument is a pointer to a cgen_fields struct. + The fourth argument is the pc value of the insn. + The fifth argument is the length of the insn, in bytes. */ +/* Don't require bfd.h unnecessarily. */ +#ifdef BFD_VERSION +typedef void (cgen_print_fn) PARAMS ((PTR, const struct cgen_insn *, + struct cgen_fields *, bfd_vma, int)); +#else +typedef void (cgen_print_fn) (); +#endif + +/* Insert handler. + The first argument is a pointer to a struct describing the insn being + parsed. + The second argument is a pointer to a cgen_fields struct + from which the values are fetched. + The third argument is a pointer to a buffer in which to place the insn. */ +typedef void (cgen_insert_fn) PARAMS ((const struct cgen_insn *, + struct cgen_fields *, cgen_insn_t *)); + +/* Extract handler. + The first argument is a pointer to a struct describing the insn being + parsed. + The second argument is a pointer to a struct controlling extraction + (only used for variable length insns). + The third argument is the first CGEN_BASE_INSN_SIZE bytes. + The fourth argument is a pointer to a cgen_fields struct + in which the results are placed. + The result is the length of the insn or zero if not recognized. */ +typedef int (cgen_extract_fn) PARAMS ((const struct cgen_insn *, + void *, cgen_insn_t, + struct cgen_fields *)); + +/* The `parse' and `insert' fields are indices into these tables. + The elements are pointer to specialized handler functions. + Element 0 is special, it means use the default handler. */ +extern cgen_parse_fn * CGEN_SYM (parse_handlers) []; +#define CGEN_PARSE_FN(x) (CGEN_SYM (parse_handlers)[(x)->base.parse]) +extern cgen_insert_fn * CGEN_SYM (insert_handlers) []; +#define CGEN_INSERT_FN(x) (CGEN_SYM (insert_handlers)[(x)->base.insert]) + +/* Likewise for the `extract' and `print' fields. */ +extern cgen_extract_fn * CGEN_SYM (extract_handlers) []; +#define CGEN_EXTRACT_FN(x) (CGEN_SYM (extract_handlers)[(x)->base.extract]) +extern cgen_print_fn * CGEN_SYM (print_handlers) []; +#define CGEN_PRINT_FN(x) (CGEN_SYM (print_handlers)[(x)->base.print]) + +/* Base class of parser/printer. + (Don't read too much into the use of the phrase "base class"). + + Instructions and expressions all share this data in common. + It's a collection of the common elements needed to parse and print + each of them. */ + +#ifndef CGEN_MAX_INSN_ATTRS +#define CGEN_MAX_INSN_ATTRS 1 +#endif + +struct cgen_base { + /* Indices into the handler tables. + We could use pointers here instead, but in the case of the insn table, + 90% of them would be identical and that's a lot of redundant data. + 0 means use the default (what the default is is up to the code). */ + unsigned char parse, insert, extract, print; + + /* Attributes. */ + CGEN_ATTR_TYPE (CGEN_MAX_INSN_ATTRS) attrs; +}; + +/* Syntax table. + + Each insn and subexpression has one of these. + + The syntax "string" consists of characters (n > 0 && n < 128), and operand + values (n >= 128), and is terminated by 0. Operand values are 128 + index + into the operand table. The operand table doesn't exist in C, per se, as + the data is recorded in the parse/insert/extract/print switch statements. + + ??? Whether we want to use yacc instead is unclear, but we do make an + effort to not make doing that difficult. At least that's the intent. +*/ + +struct cgen_syntax { + /* Original syntax string, for debugging purposes. */ + char *orig; + + /* Name of entry (that distinguishes it from all other entries). + This is used, for example, in simulator profiling results. */ + char *name; + +#if 0 /* not needed yet */ + /* Format of this insn. + This doesn't closely follow the notion of instruction formats for more + complex instruction sets. This is the value computed at runtime. */ + enum cgen_fmt_type fmt; +#endif + + /* Mnemonic (or name if expression). */ + char *mnemonic; + + /* Syntax string. */ + /* FIXME: If each insn's mnemonic is constant, do we want to record just + the arguments here? */ +#ifndef CGEN_MAX_SYNTAX_BYTES +#define CGEN_MAX_SYNTAX_BYTES 16 +#endif + unsigned char syntax[CGEN_MAX_SYNTAX_BYTES]; + +#define CGEN_SYNTAX_CHAR_P(c) ((c) < 128) +#define CGEN_SYNTAX_CHAR(c) (c) +#define CGEN_SYNTAX_FIELD(c) ((c) - 128) + + /* recognize insn if (op & mask) == value + For architectures with variable length insns, this is just a preliminary + test. */ + /* FIXME: Might want a selectable type (rather than always + unsigned long). */ + unsigned long mask, value; + + /* length, in bits + This is the size that `mask' and `value' have been calculated to. + Normally it is CGEN_BASE_INSN_BITSIZE. On vliw architectures where + the base insn size may be larger than the size of an insn, this field is + less than CGEN_BASE_INSN_BITSIZE. + On architectures like the 386 and m68k the real size of the insn may + be computed while parsing. */ + /* FIXME: wip, of course */ + int length; +}; + +/* Operand values (keywords, integers, symbols, etc.) */ + +/* Types of assembler elements. */ + +enum cgen_asm_type { + CGEN_ASM_KEYWORD, CGEN_ASM_MAX +}; + +/* List of hardware elements. */ + +typedef struct cgen_hw_entry { + struct cgen_hw_entry *next; + char *name; + enum cgen_asm_type asm_type; + PTR asm_data; +} CGEN_HW_ENTRY; + +extern CGEN_HW_ENTRY *CGEN_SYM (hw_list); + +CGEN_HW_ENTRY *cgen_hw_lookup PARAMS ((const char *)); + +#ifndef CGEN_MAX_KEYWORD_ATTRS +#define CGEN_MAX_KEYWORD_ATTRS 1 +#endif + +/* This struct is used to describe things like register names, etc. */ + +typedef struct cgen_keyword_entry { + /* Name (as in register name). */ + char *name; + + /* Value (as in register number). + The value cannot be -1 as that is used to indicate "not found". + IDEA: Have "FUNCTION" attribute? [function is called to fetch value]. */ + int value; + + /* Attributes. */ + /* FIXME: Not used yet. */ + CGEN_ATTR_TYPE (CGEN_MAX_KEYWORD_ATTRS) attrs; + + /* Next name hash table entry. */ + struct cgen_keyword_entry *next_name; + /* Next value hash table entry. */ + struct cgen_keyword_entry *next_value; +} CGEN_KEYWORD_ENTRY; + +/* Top level struct for describing a set of related keywords + (e.g. register names). + + This struct supports runtime entry of new values, and hashed lookups. */ + +typedef struct cgen_keyword { + /* Pointer to initial [compiled in] values. */ + struct cgen_keyword_entry *init_entries; + /* Number of entries in `init_entries'. */ + unsigned int num_init_entries; + /* Hash table used for name lookup. */ + struct cgen_keyword_entry **name_hash_table; + /* Hash table used for value lookup. */ + struct cgen_keyword_entry **value_hash_table; + /* Number of entries in the hash_tables. */ + unsigned int hash_table_size; +} CGEN_KEYWORD; + +/* Structure used for searching. */ + +typedef struct cgen_keyword_search { + /* Table being searched. */ + const struct cgen_keyword *table; + /* Specification of what is being searched for. */ + const char *spec; + /* Current index in hash table. */ + unsigned int current_hash; + /* Current element in current hash chain. */ + struct cgen_keyword_entry *current_entry; +} CGEN_KEYWORD_SEARCH; + +/* Lookup a keyword from its name. */ +const struct cgen_keyword_entry * cgen_keyword_lookup_name + PARAMS ((struct cgen_keyword *, const char *)); +/* Lookup a keyword from its value. */ +const struct cgen_keyword_entry * cgen_keyword_lookup_value + PARAMS ((struct cgen_keyword *, int)); +/* Add a keyword. */ +void cgen_keyword_add PARAMS ((struct cgen_keyword *, + struct cgen_keyword_entry *)); +/* Keyword searching. + This can be used to retrieve every keyword, or a subset. */ +struct cgen_keyword_search cgen_keyword_search_init + PARAMS ((struct cgen_keyword *, const char *)); +const struct cgen_keyword_entry *cgen_keyword_search_next + PARAMS ((struct cgen_keyword_search *)); + +/* Operand value support routines. */ +/* FIXME: some of the long's here will need to be bfd_vma or some such. */ + +const char * cgen_parse_keyword PARAMS ((const char **, + struct cgen_keyword *, + long *)); +const char * cgen_parse_signed_integer PARAMS ((const char **, int, + long, long, long *)); +const char * cgen_parse_unsigned_integer PARAMS ((const char **, int, + unsigned long, unsigned long, + unsigned long *)); +const char * cgen_parse_address PARAMS ((const char **, int, + int, long *)); +const char * cgen_validate_signed_integer PARAMS ((long, long, long)); +const char * cgen_validate_unsigned_integer PARAMS ((unsigned long, + unsigned long, + unsigned long)); + +/* This struct defines each entry in the operand table. */ + +#ifndef CGEN_MAX_OPERAND_ATTRS +#define CGEN_MAX_OPERAND_ATTRS 1 +#endif + +typedef struct cgen_operand { + /* For debugging. */ + char *name; + + /* Bit position (msb of first byte = bit 0). + May be unused for a modifier. */ + unsigned char start; + + /* The number of bits in the operand. + May be unused for a modifier. */ + unsigned char length; + + /* Attributes. */ + CGEN_ATTR_TYPE (CGEN_MAX_OPERAND_ATTRS) attrs; +#define CGEN_OPERAND_ATTRS(operand) (&(operand)->attrs) + +#if 0 /* ??? Interesting idea but relocs tend to get too complicated for + simple table lookups to work. */ + /* Ideally this would be the internal (external?) reloc type. */ + int reloc_type; +#endif +} CGEN_OPERAND; + +/* Return value of attribute ATTR in OPERAND. */ +#define CGEN_OPERAND_ATTR(operand, attr) \ +CGEN_ATTR_VALUE (operand, CGEN_OPERAND_ATTRS (operand), attr) + +/* The operand table is currently a very static entity. */ +extern const CGEN_OPERAND CGEN_SYM (operand_table)[]; + +enum cgen_operand_type; + +#define CGEN_OPERAND_INDEX(operand) ((int) ((operand) - CGEN_SYM (operand_table))) +/* FIXME: Rename, cpu-opc.h defines this as the typedef of the enum. */ +#define CGEN_OPERAND_TYPE(operand) ((enum cgen_operand_type) CGEN_OPERAND_INDEX (operand)) +#define CGEN_OPERAND_ENTRY(n) (& CGEN_SYM (operand_table) [n]) + +/* This struct defines each entry in the instruction table. */ + +struct cgen_insn { + struct cgen_base base; +/* Given a pointer to a cgen_insn struct, return a pointer to `base'. */ +#define CGEN_INSN_BASE(insn) (&(insn)->base) +#define CGEN_INSN_ATTRS(insn) (&(insn)->base.attrs) + + struct cgen_syntax syntax; +#define CGEN_INSN_SYNTAX(insn) (&(insn)->syntax) +#define CGEN_INSN_FMT(insn) ((insn)->syntax.fmt) +#define CGEN_INSN_BITSIZE(insn) ((insn)->syntax.length) +}; + +/* Return value of attribute ATTR in INSN. */ +#define CGEN_INSN_ATTR(insn, attr) \ +CGEN_ATTR_VALUE (insn, CGEN_INSN_ATTRS (insn), attr) + +/* Instruction lists. + This is used for adding new entries and for creating the hash lists. */ + +typedef struct cgen_insn_list { + struct cgen_insn_list *next; + const struct cgen_insn *insn; +} CGEN_INSN_LIST; + +/* The table of instructions. */ + +typedef struct cgen_insn_table { + /* Pointer to initial [compiled in] entries. */ + const struct cgen_insn *init_entries; + /* Number of entries in `init_entries', including trailing NULL entry. */ + unsigned int num_init_entries; + /* Values added at runtime. */ + struct cgen_insn_list *new_entries; + /* Assembler hash function. */ + unsigned int (*asm_hash) PARAMS ((const char *)); + /* Number of entries in assembler hash table. */ + unsigned int asm_hash_table_size; + /* Disassembler hash function. */ + unsigned int (*dis_hash) PARAMS ((const char *, unsigned long)); + /* Number of entries in disassembler hash table. */ + unsigned int dis_hash_table_size; +} CGEN_INSN_TABLE; + +/* ??? This is currently used by the simulator. + We want this to be fast and the simulator currently doesn't handle + runtime added instructions so this is ok. An alternative would be to + store the index in the table. */ +extern const CGEN_INSN CGEN_SYM (insn_table_entries)[]; +#define CGEN_INSN_INDEX(insn) ((int) ((insn) - CGEN_SYM (insn_table_entries))) +#define CGEN_INSN_ENTRY(n) (& CGEN_SYM (insn_table_entries) [n]) + +/* Return number of instructions. This includes any added at runtime. */ + +int cgen_insn_count PARAMS (()); + +/* The assembler insn table is hashed based on some function of the mnemonic + (the actually hashing done is up to the target, but we provide a few + examples like the first letter or a function of the entire mnemonic). + The index of each entry is the index of the corresponding table entry. + The value of each entry is the index of the next entry, with a 0 + terminating (thus the first entry is reserved). */ + +#ifndef CGEN_ASM_HASH +#ifdef CGEN_MNEMONIC_OPERANDS +#define CGEN_ASM_HASH_SIZE 127 +#define CGEN_ASM_HASH(string) (*(unsigned char *) (string) % CGEN_ASM_HASH_SIZE) +#else +#define CGEN_ASM_HASH_SIZE 128 +#define CGEN_ASM_HASH(string) (*(unsigned char *) (string) % CGEN_ASM_HASH_SIZE) /*FIXME*/ +#endif +#endif + +unsigned int CGEN_SYM (asm_hash_insn) PARAMS ((const char *)); +CGEN_INSN_LIST * cgen_asm_lookup_insn PARAMS ((const char *)); +#define CGEN_ASM_LOOKUP_INSN(insn) cgen_asm_lookup_insn (insn) +#define CGEN_ASM_NEXT_INSN(insn) ((insn)->next) + +/* The disassembler insn table is hashed based on some function of machine + instruction (the actually hashing done is up to the target). */ + +/* It doesn't make much sense to provide a default here, + but while this is under development we do. + BUFFER is a pointer to the bytes of the insn. + INSN is the first CGEN_BASE_INSN_SIZE bytes as an int in host order. */ +#ifndef CGEN_DIS_HASH +#define CGEN_DIS_HASH_SIZE 256 +#define CGEN_DIS_HASH(buffer, insn) (*(unsigned char *) (buffer)) +#endif + +unsigned int CGEN_SYM (dis_hash_insn) PARAMS ((const char *, unsigned long)); +CGEN_INSN_LIST * cgen_dis_lookup_insn PARAMS ((const char *, unsigned long)); +#define CGEN_DIS_LOOKUP_INSN(buf, insn) cgen_dis_lookup_insn (buf, insn) +#define CGEN_DIS_NEXT_INSN(insn) ((insn)->next) + +/* Top level structures and functions. */ + +typedef struct cgen_opcode_data { + CGEN_HW_ENTRY *hw_list; + /*CGEN_OPERAND_TABLE *operand_table; - FIXME:wip */ + CGEN_INSN_TABLE *insn_table; +} CGEN_OPCODE_DATA; + +/* Each CPU has one of these. */ +extern CGEN_OPCODE_DATA CGEN_SYM (opcode_data); + +/* Global state access macros. + Some of these are tucked away and accessed with cover fns. + Simpler things like the current machine and endian are not. */ + +extern int cgen_current_machine; +#define CGEN_CURRENT_MACHINE cgen_current_machine + +extern enum cgen_endian cgen_current_endian; +#define CGEN_CURRENT_ENDIAN cgen_current_endian + +/* Prototypes of major functions. */ + +/* Set the current cpu (+ mach number, endian, etc.). *? +void cgen_set_cpu PARAMS ((CGEN_OPCODE_DATA *, int, enum cgen_endian)); + +/* Initialize the assembler, disassembler. */ +void cgen_asm_init PARAMS ((void)); +void cgen_dis_init PARAMS ((void)); + +/* `init_tables' must be called before `xxx_supported'. */ +void CGEN_SYM (init_tables) PARAMS ((int)); +void CGEN_SYM (init_asm) PARAMS ((int, enum cgen_endian)); +void CGEN_SYM (init_dis) PARAMS ((int, enum cgen_endian)); +void CGEN_SYM (init_parse) PARAMS ((void)); +void CGEN_SYM (init_print) PARAMS ((void)); +void CGEN_SYM (init_insert) PARAMS ((void)); +void CGEN_SYM (init_extract) PARAMS ((void)); +const struct cgen_insn * +CGEN_SYM (assemble_insn) PARAMS ((const char *, struct cgen_fields *, + cgen_insn_t *, char **)); +int CGEN_SYM (insn_supported) PARAMS ((const struct cgen_syntax *)); +#if 0 /* old */ +int CGEN_SYM (opval_supported) PARAMS ((const struct cgen_opval *)); +#endif + +extern const struct cgen_keyword CGEN_SYM (operand_mach); +int CGEN_SYM (get_mach) PARAMS ((const char *)); + +CGEN_INLINE void +CGEN_SYM (put_operand) PARAMS ((int, const long *, + struct cgen_fields *)); +CGEN_INLINE long +CGEN_SYM (get_operand) PARAMS ((int, const struct cgen_fields *)); + +CGEN_INLINE const char * +CGEN_SYM (parse_operand) PARAMS ((int, const char **, struct cgen_fields *)); + +CGEN_INLINE const char * +CGEN_SYM (validate_operand) PARAMS ((int, const struct cgen_fields *)); + +/* Default insn parser, printer. */ +extern cgen_parse_fn CGEN_SYM (parse_insn); +extern cgen_insert_fn CGEN_SYM (insert_insn); +extern cgen_extract_fn CGEN_SYM (extract_insn); +extern cgen_print_fn CGEN_SYM (print_insn); + +/* Read in a cpu description file. */ +const char * cgen_read_cpu_file PARAMS ((const char *)); + +/* Assembler interface. + + The interface to the assembler is intended to be clean in the sense that + libopcodes.a is a standalone entity and could be used with any assembler. + Not that one would necessarily want to do that but rather that it helps + keep a clean interface. The interface will obviously be slanted towards + GAS, but at least it's a start. + + Parsing is controlled by the assembler which calls + CGEN_SYM (assemble_insn). If it can parse and build the entire insn + it doesn't call back to the assembler. If it needs/wants to call back + to the assembler, (*cgen_parse_operand_fn) is called which can either + + - return a number to be inserted in the insn + - return a "register" value to be inserted + (the register might not be a register per pe) + - queue the argument and return a marker saying the expression has been + queued (eg: a fix-up) + - return an error message indicating the expression wasn't recognizable + + The result is an error message or NULL for success. + The parsed value is stored in the bfd_vma *. */ + +/* Values for indicating what the caller wants. */ +enum cgen_parse_operand_type { + CGEN_PARSE_OPERAND_INIT, CGEN_PARSE_OPERAND_INTEGER, + CGEN_PARSE_OPERAND_ADDRESS +}; + +/* Values for indicating what was parsed. + ??? Not too useful at present but in time. */ +enum cgen_parse_operand_result { + CGEN_PARSE_OPERAND_RESULT_NUMBER, CGEN_PARSE_OPERAND_RESULT_REGISTER, + CGEN_PARSE_OPERAND_RESULT_QUEUED, CGEN_PARSE_OPERAND_RESULT_ERROR +}; + +/* Don't require bfd.h unnecessarily. */ +#ifdef BFD_VERSION +extern const char * (*cgen_parse_operand_fn) + PARAMS ((enum cgen_parse_operand_type, const char **, int, int, + enum cgen_parse_operand_result *, bfd_vma *)); +#endif + +/* Called before trying to match a table entry with the insn. */ +void cgen_init_parse_operand PARAMS ((void)); + +/* Called from -asm.c to initialize operand parsing. */ + +/* These are GAS specific. They're not here as part of the interface, + but rather that we need to put them somewhere. */ + +/* Call this from md_assemble to initialize the assembler callback. */ +void cgen_asm_init_parse PARAMS ((void)); + +/* Don't require bfd.h unnecessarily. */ +#ifdef BFD_VERSION +/* The result is an error message or NULL for success. + The parsed value is stored in the bfd_vma *. */ +const char *cgen_parse_operand PARAMS ((enum cgen_parse_operand_type, + const char **, int, int, + enum cgen_parse_operand_result *, + bfd_vma *)); +#endif + +/* Add a register to the assembler's hash table. + This makes lets GAS parse registers for us. + ??? This isn't currently used, but it could be in the future. */ +void cgen_asm_record_register PARAMS ((char *, int)); + +/* After CGEN_SYM (assemble_insn) is done, this is called to + output the insn and record any fixups. */ +void cgen_asm_finish_insn PARAMS ((const struct cgen_insn *, cgen_insn_t *, + unsigned int)); + +#endif /* CGEN_H */ diff -urN binutils-2.7/include/opcode/d10v.h binutils-2.8/include/opcode/d10v.h --- binutils-2.7/include/opcode/d10v.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/include/opcode/d10v.h Wed Apr 30 12:57:19 1997 @@ -0,0 +1,185 @@ +/* d10v.h -- Header file for D10V opcode table + Copyright 1996 Free Software Foundation, Inc. + Written by Martin Hunt (hunt@cygnus.com), Cygnus Support + +This file is part of GDB, GAS, and the GNU binutils. + +GDB, GAS, and the GNU binutils are free software; you can redistribute +them and/or modify them under the terms of the GNU General Public +License as published by the Free Software Foundation; either version +1, or (at your option) any later version. + +GDB, GAS, and the GNU binutils are distributed in the hope that they +will be useful, but WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this file; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef D10V_H +#define D10V_H + +/* Format Specifier */ +#define FM00 0 +#define FM01 0x40000000 +#define FM10 0x80000000 +#define FM11 0xC0000000 + +#define NOP 0x5e00 +#define OPCODE_DIVS 0x14002800 + +/* The opcode table is an array of struct d10v_opcode. */ + +struct d10v_opcode +{ + /* The opcode name. */ + const char *name; + + /* the opcode format */ + int format; + + /* These numbers were picked so we can do if( i & SHORT_OPCODE) */ +#define SHORT_OPCODE 1 +#define LONG_OPCODE 8 +#define SHORT_2 1 /* short with 2 operands */ +#define SHORT_B 3 /* short with 8-bit branch */ +#define LONG_B 8 /* long with 16-bit branch */ +#define LONG_L 10 /* long with 3 operands */ +#define LONG_R 12 /* reserved */ + + /* just a placeholder for variable-length instructions */ + /* for example, "bra" will be a fake for "bra.s" and bra.l" */ + /* which will immediately follow in the opcode table. */ +#define OPCODE_FAKE 32 + + /* the number of cycles */ + int cycles; + + /* the execution unit(s) used */ + int unit; +#define EITHER 0 +#define IU 1 +#define MU 2 +#define BOTH 3 + + /* execution type; parallel or sequential */ + /* this field is used to decide if two instructions */ + /* can be executed in parallel */ + int exec_type; +#define PARONLY 1 /* parallel only */ +#define SEQ 2 /* must be sequential */ +#define PAR 4 /* may be parallel */ +#define BRANCH_LINK 8 /* subroutine call. must be aligned */ +#define RMEM 16 /* reads memory */ +#define WMEM 32 /* writes memory */ +#define RF0 64 /* reads f0 */ +#define WF0 128 /* modifies f0 */ +#define WCAR 256 /* write Carry */ +#define BRANCH 512 /* branch, no link */ + + /* the opcode */ + long opcode; + + /* mask. if( (i & mask) == opcode ) then match */ + long mask; + + /* An array of operand codes. Each code is an index into the + operand table. They appear in the order which the operands must + appear in assembly code, and are terminated by a zero. */ + unsigned char operands[6]; +}; + +/* The table itself is sorted by major opcode number, and is otherwise + in the order in which the disassembler should consider + instructions. */ +extern const struct d10v_opcode d10v_opcodes[]; +extern const int d10v_num_opcodes; + +/* The operands table is an array of struct d10v_operand. */ +struct d10v_operand +{ + /* The number of bits in the operand. */ + int bits; + + /* How far the operand is left shifted in the instruction. */ + int shift; + + /* One bit syntax flags. */ + int flags; +}; + +/* Elements in the table are retrieved by indexing with values from + the operands field of the d10v_opcodes table. */ + +extern const struct d10v_operand d10v_operands[]; + +/* Values defined for the flags field of a struct d10v_operand. */ + +/* the operand must be an even number */ +#define OPERAND_EVEN (1) + +/* the operand must be an odd number */ +#define OPERAND_ODD (2) + +/* this is the destination register; it will be modified */ +/* this is used by the optimizer */ +#define OPERAND_DEST (4) + +/* number or symbol */ +#define OPERAND_NUM (8) + +/* address or label */ +#define OPERAND_ADDR (0x10) + +/* register */ +#define OPERAND_REG (0x20) + +/* postincrement + */ +#define OPERAND_PLUS (0x40) + +/* postdecrement - */ +#define OPERAND_MINUS (0x80) + +/* @ */ +#define OPERAND_ATSIGN (0x100) + +/* @( */ +#define OPERAND_ATPAR (0x200) + +/* accumulator */ +#define OPERAND_ACC (0x400) + +/* flag register */ +#define OPERAND_FLAG (0x800) + +/* control register */ +#define OPERAND_CONTROL (0x1000) + +/* predecrement mode '@-sp' */ +#define OPERAND_ATMINUS (0x2000) + +/* signed number */ +#define OPERAND_SIGNED (0x4000) + +/* special accumulator shifts need a 4-bit number */ +/* 1 <= x <= 16 */ +#define OPERAND_SHIFT (0x8000) + +/* Structure to hold information about predefined registers. */ +struct pd_reg +{ + char *name; /* name to recognize */ + char *pname; /* name to print for this register */ + int value; +}; + +extern const struct pd_reg d10v_predefined_registers[]; +int d10v_reg_name_cnt(); + +/* an expressionS only has one register type, so we fake it */ +/* by setting high bits to indicate type */ +#define REGISTER_MASK 0xFF + +#endif /* D10V_H */ diff -urN binutils-2.7/include/opcode/h8300.h binutils-2.8/include/opcode/h8300.h --- binutils-2.7/include/opcode/h8300.h Thu Jul 4 12:35:38 1996 +++ binutils-2.8/include/opcode/h8300.h Wed Apr 30 12:57:19 1997 @@ -51,6 +51,8 @@ #define DST 0x80 #define REG 0x100 +#define EXR 0x200 +#define MACREG 0x800 #define SRC_IN_DST 0x400 #define IMM 0x1000 #define DISP 0x2000 @@ -77,8 +79,7 @@ #define IMM2 IMM|L_2 #define SIZE (L_2|L_3|L_8|L_16|L_32|L_P|L_24) -#define MODE (REG|IMM|DISP|IND|INC|DEC|CCR|ABS|MEMIND \ - ) +#define MODE (REG|IMM|DISP|IND|INC|DEC|CCR|ABS|MEMIND|EXR) #define RD8 (DST|L_8|REG) #define RD16 (DST|L_16|REG) @@ -115,6 +116,7 @@ #define RDDEC (DST|DEC) #define RSINC (SRC|INC) +#define RDINC (DST|INC) #define RDIND (DST|IND) #define RSIND (SRC|IND) @@ -159,6 +161,8 @@ { code, 1, 2, name, {imm,RD8,E}, {op00, op01, imm, RD8, E, 0, 0, 0, 0}, 0, 0, 0, 0},\ { code, 1, 6, name, {imm,RDIND,E}, {op10, op11, B30|RDIND, 0, op00,op01, imm, 0, E}, 0, 0, 0, 0},\ { code, 1, 6, name, {imm,ABS8DST,E},{op20, op21, ABS8DST, IGNORE, op00,op01, imm, 0,E}, 0, 0, 0, 0}\ +,{ code, 1, 6, name, {imm,ABS16DST,E},{0x6,0xa,0x1,op30,ABS16DST,IGNORE,IGNORE,IGNORE, op00,op01, imm, 0,E}, 0, 0, 0, 0},\ +{ code, 1, 6, name, {imm,ABS32DST,E},{0x6,0xa,0x3,op30,ABS32DST,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE, op00,op01, imm, 0,E}, 0, 0, 0, 0} #define EBITOP(code, imm, name, op00, op01,op10,op11, op20,op21,op30)\ @@ -190,6 +194,9 @@ { O(code,SB), 1, 2, name, {OR8, E, 0}, {op1, op2, op3+0, OR8, E, 0, 0, 0, 0}, 0, 0, 0, 0}, \ { O(code,SW), 0, 2, name, {OR16, E, 0}, {op1, op2, op3+1, OR16, E, 0, 0, 0, 0}, 0, 0, 0, 0}, \ { O(code,SL), 0, 2, name, {OR32, E, 0}, {op1, op2, op3+3, OR32|B30, E, 0, 0, 0, 0}, 0, 0, 0, 0} \ +,{ O(code,SB), 1, 2, name, {IMM, OR8 | SRC_IN_DST, E}, {op1, op2, op3+4, OR8 | SRC_IN_DST, E, 0, 0, 0, 0}, 0, 0, 0, 0}, \ +{ O(code,SW), 0, 2, name, {IMM, OR16 | SRC_IN_DST, E}, {op1, op2, op3+5, OR16 | SRC_IN_DST, E, 0, 0, 0, 0}, 0, 0, 0, 0}, \ +{ O(code,SL), 0, 2, name, {IMM, OR32 | SRC_IN_DST, E}, {op1, op2, op3+7, OR32 | SRC_IN_DST|B30 , E, 0, 0, 0, 0}, 0, 0, 0, 0} #define IMM32LIST IMM32,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE @@ -288,10 +295,18 @@ #define O_ADDS 77 #define O_SYSCALL 78 #define O_MOV_TO_REG 79 -#define O_LAST 87 +#define O_TAS 80 +#define O_CLRMAC 82 +#define O_LDMAC 83 +#define O_MAC 84 +#define O_LDM 85 +#define O_STM 86 +#define O_STMAC 87 +#define O_LAST 88 #define SB 0 #define SW 1 #define SL 2 +#define SN 3 /* FIXME: Lots of insns have "E, 0, 0, 0, 0" in the nibble code sequences. @@ -317,8 +332,9 @@ 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, - BITOP(O(O_BAND,SB), IMM3,"band",0x7,0x6,0x7,0xC,0x7,0xE,0x0), + BITOP(O(O_BAND,SB), IMM3|B30,"band",0x7,0x6,0x7,0xC,0x7,0xE,0x0), BRANCH(O(O_BRA,SB),"bra",0x0), BRANCH(O(O_BRA,SB),"bt",0x0), BRANCH(O(O_BRN,SB),"brn",0x1), @@ -340,7 +356,7 @@ BRANCH(O(O_BGT,SB),"bgt",0xE), BRANCH(O(O_BLE,SB),"ble",0xF), - EBITOP(O(O_BCLR,SB),IMM3,"bclr", 0x6,0x2,0x7,0xD,0x7,0xF,0x8), + EBITOP(O(O_BCLR,SB),IMM3|B30,"bclr", 0x6,0x2,0x7,0xD,0x7,0xF,0x8), BITOP(O(O_BIAND,SB),IMM3|B31,"biand",0x7,0x6,0x7,0xC,0x7,0xE,0x0), BITOP(O(O_BILD,SB), IMM3|B31,"bild", 0x7,0x7,0x7,0xC,0x7,0xE,0x0), BITOP(O(O_BIOR,SB), IMM3|B31,"bior", 0x7,0x4,0x7,0xC,0x7,0xE,0x0), @@ -379,7 +395,7 @@ 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_EEPMOV,SB),1,50,"eepmov"),{ E,0,0},{0x7,0xB,0x5,0xC,0x5,0x9,0x8,0xF,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_EXTS,SW),0,2,"exts.w"),{OR16,E,0},{0x1,0x7,0xD,OR16,E }EOP, @@ -410,6 +426,14 @@ 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, 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, @@ -480,7 +504,7 @@ NEW_SOP(O(O_NEG,SW),0,2,"neg.w"),{ OR16,E,0},{ 0x1,0x7,0x9,OR16,E}EOP, NEW_SOP(O(O_NEG,SL),0,2,"neg.l"),{ OR32,E,0},{ 0x1,0x7,0xB,B30|OR32,E}EOP, - NEW_SOP(O(O_NOP,SB),1,2,"nop"),{E,0,0},{ 0x0,0x0,0x0,0x0,E,0,0,0,0}EOP, + NEW_SOP(O(O_NOP,SN),1,2,"nop"),{E,0,0},{ 0x0,0x0,0x0,0x0,E,0,0,0,0}EOP, /* ??? This can use UNOP3. */ NEW_SOP(O(O_NOT,SB),1,2,"not.b"),{ OR8,E, 0},{ 0x1,0x7,0x0,OR8,E,0,0,0,0}EOP, @@ -495,6 +519,7 @@ 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_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, @@ -506,16 +531,16 @@ UNOP3(O_ROTXL, "rotxl",0x1,0x2,0x0), UNOP3(O_ROTXR, "rotxr",0x1,0x3,0x0), - SOP(O(O_BPT,SB), 10,"bpt"),{E,0,0},{ 0x7,0xA,0xF,0xF,E,0,0,0,0}EOP, - SOP(O(O_RTE,SB), 10,"rte"),{E,0,0},{ 0x5,0x6,0x7,0x0,E,0,0,0,0}EOP, - SOP(O(O_RTS,SB), 8,"rts"),{E,0,0},{ 0x5,0x4,0x7,0x0,E,0,0,0,0}EOP, + SOP(O(O_BPT,SN), 10,"bpt"),{E,0,0},{ 0x7,0xA,0xF,0xF,E,0,0,0,0}EOP, + SOP(O(O_RTE,SN), 10,"rte"),{E,0,0},{ 0x5,0x6,0x7,0x0,E,0,0,0,0}EOP, + SOP(O(O_RTS,SN), 8,"rts"),{E,0,0},{ 0x5,0x4,0x7,0x0,E,0,0,0,0}EOP, UNOP3(O_SHAL, "shal",0x1,0x0,0x8), UNOP3(O_SHAR, "shar",0x1,0x1,0x8), UNOP3(O_SHLL, "shll",0x1,0x0,0x0), UNOP3(O_SHLR, "shlr",0x1,0x1,0x0), - SOP(O(O_SLEEP,SB),2,"sleep"),{E,0,0},{ 0x0,0x1,0x8,0x0,E,0,0,0,0} EOP, + 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, @@ -527,6 +552,15 @@ 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), 1,2,"stc"),{EXR,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,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, SOP(O(O_SUB,SB),2,"sub.b"),{RS8,RD8,E},{ 0x1,0x8,RS8,RD8,E,0,0,0,0}EOP, @@ -539,6 +573,7 @@ TWOOP(O(O_SUBX,SB),"subx",0xB,0x1,0xE), NEW_SOP(O(O_TRAPA,SB),0,2,"trapa"),{ IMM2,E}, {0x5,0x7,IMM2,IGNORE,E }EOP, + NEW_SOP(O(O_TAS,SB),0,2,"tas"),{RSIND,E}, {0x0,0x1,0xe,0x0,0x7,0xb,B30|RSIND,0xc,E }EOP, TWOOP(O(O_XOR, SB),"xor",0xD,0x1,0x5), @@ -549,6 +584,14 @@ 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, + + NEW_SOP(O(O_CLRMAC,SN),1,2,"clrmac"),{E, 0, 0},{0x0,0x1,0xa,0x0,E} EOP, + NEW_SOP(O(O_MAC,SL),1,2,"mac"),{RSINC,RDINC,E},{0x0,0x1,0x6,0x0,0x6,0xd,B30|RSINC,B30|RDINC,E} EOP, + NEW_SOP(O(O_LDMAC,SL),1,2,"ldmac"),{RS32,MACREG,E},{0x0,0x3,MACREG,RS32,E} EOP, + NEW_SOP(O(O_STMAC,SL),1,2,"stmac"),{MACREG,RD32,E},{0x0,0x2,MACREG,RD32,E} EOP, + NEW_SOP(O(O_LDM,SL),0,6,"ldm.l"),{RSINC, RS32, E},{ 0x0,0x1,IGNORE,0x0,0x6,0xD,0x7,IGNORE,E}EOP, + NEW_SOP(O(O_STM,SL),0,6,"stm.l"),{RS32, RDDEC, E},{0x0,0x1,IGNORE,0x0,0x6,0xD,0xF,IGNORE,E}EOP, 0 }; #else diff -urN binutils-2.7/include/opcode/hppa.h binutils-2.8/include/opcode/hppa.h --- binutils-2.7/include/opcode/hppa.h Thu Jul 4 12:21:31 1996 +++ binutils-2.8/include/opcode/hppa.h Wed Apr 30 12:57:19 1997 @@ -344,30 +344,30 @@ { "lci", 0x04001300, 0xfc003fe0, "x(b),t", pa10}, { "pdtlb", 0x04001200, 0xfc003fdf, "Zx(s,b)", pa10}, { "pdtlb", 0x04001200, 0xfc003fdf, "Zx(b)", pa10}, -{ "pitlb", 0x04000200, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "pitlb", 0x04000200, 0xfc003fdf, "Zx(b)", pa10}, +{ "pitlb", 0x04000200, 0xfc001fdf, "Zx(S,b)", pa10}, +{ "pitlb", 0x04000200, 0xfc001fdf, "Zx(b)", pa10}, { "pdtlbe", 0x04001240, 0xfc003fdf, "Zx(s,b)", pa10}, { "pdtlbe", 0x04001240, 0xfc003fdf, "Zx(b)", pa10}, -{ "pitlbe", 0x04000240, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "pitlbe", 0x04000240, 0xfc003fdf, "Zx(b)", pa10}, +{ "pitlbe", 0x04000240, 0xfc001fdf, "Zx(S,b)", pa10}, +{ "pitlbe", 0x04000240, 0xfc001fdf, "Zx(b)", pa10}, { "idtlba", 0x04001040, 0xfc003fff, "x,(s,b)", pa10}, { "idtlba", 0x04001040, 0xfc003fff, "x,(b)", pa10}, -{ "iitlba", 0x04000040, 0xfc003fff, "x,(s,b)", pa10}, -{ "iitlba", 0x04000040, 0xfc003fff, "x,(b)", pa10}, +{ "iitlba", 0x04000040, 0xfc001fff, "x,(S,b)", pa10}, +{ "iitlba", 0x04000040, 0xfc001fff, "x,(b)", pa10}, { "idtlbp", 0x04001000, 0xfc003fff, "x,(s,b)", pa10}, { "idtlbp", 0x04001000, 0xfc003fff, "x,(b)", pa10}, -{ "iitlbp", 0x04000000, 0xfc003fff, "x,(s,b)", pa10}, -{ "iitlbp", 0x04000000, 0xfc003fff, "x,(b)", pa10}, +{ "iitlbp", 0x04000000, 0xfc001fff, "x,(S,b)", pa10}, +{ "iitlbp", 0x04000000, 0xfc001fff, "x,(b)", pa10}, { "pdc", 0x04001380, 0xfc003fdf, "Zx(s,b)", pa10}, { "pdc", 0x04001380, 0xfc003fdf, "Zx(b)", pa10}, { "fdc", 0x04001280, 0xfc003fdf, "Zx(s,b)", pa10}, { "fdc", 0x04001280, 0xfc003fdf, "Zx(b)", pa10}, -{ "fic", 0x04000280, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "fic", 0x04000280, 0xfc003fdf, "Zx(b)", pa10}, +{ "fic", 0x04000280, 0xfc001fdf, "Zx(S,b)", pa10}, +{ "fic", 0x04000280, 0xfc001fdf, "Zx(b)", pa10}, { "fdce", 0x040012c0, 0xfc003fdf, "Zx(s,b)", pa10}, { "fdce", 0x040012c0, 0xfc003fdf, "Zx(b)", pa10}, -{ "fice", 0x040002c0, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "fice", 0x040002c0, 0xfc003fdf, "Zx(b)", pa10}, +{ "fice", 0x040002c0, 0xfc001fdf, "Zx(S,b)", pa10}, +{ "fice", 0x040002c0, 0xfc001fdf, "Zx(b)", pa10}, { "diag", 0x14000000, 0xfc000000, "D", pa10}, /* gfw and gfr are not in the HP PA 1.1 manual, but they are in either diff -urN binutils-2.7/include/opcode/i386.h binutils-2.8/include/opcode/i386.h --- binutils-2.7/include/opcode/i386.h Thu Jul 4 12:21:31 1996 +++ binutils-2.8/include/opcode/i386.h Wed Apr 30 12:57:19 1997 @@ -1,5 +1,5 @@ /* i386-opcode.h -- Intel 80386 opcode table - Copyright 1989, 91, 92, 93, 94, 95, 1996 Free Software Foundation. + Copyright 1989, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation. This file is part of GAS, the GNU Assembler, and GDB, the GNU Debugger. @@ -17,6 +17,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* The NON_BROKEN_OPCODES cases use the operands in the reverse order + from that documented in the Intel manuals. The opcode values are + such that they actually generate different instructions. These + values must not be changed, as they are the values generated by the + UnixWare assembler, and possibly other ix86 assemblers. */ + static const template i386_optab[] = { #define _ None @@ -155,6 +161,9 @@ {"xor", 2, 0x34, _, W|NoModrm, { Imm, Acc, 0} }, {"xor", 2, 0x80, 6, W|Modrm, { Imm, Reg|Mem, 0} }, +/* iclr with 1 operand is really xor with 2 operands. */ +{"clr", 1, 0x30, _, W|Modrm|iclrKludge, { Reg } }, + {"adc", 2, 0x10, _, DW|Modrm, { Reg, Reg|Mem, 0} }, {"adc", 2, 0x83, 2, Modrm, { Imm8S, WordReg|WordMem, 0} }, {"adc", 2, 0x14, _, W|NoModrm, { Imm, Acc, 0} }, @@ -519,7 +528,7 @@ /* comparison (without pop) */ {"fcom", 1, 0xd8d0, _, ShortForm, { FloatReg, 0, 0} }, {"fcoms", 1, 0xd8, 2, Modrm, { Mem, 0, 0} }, /* compare %st0, mem float */ -{"ficoml", 1, 0xda, 2, Modrm, { Mem, 0, 0} }, /* compare %st0, mem word */ +{"ficoml", 1, 0xda, 2, Modrm, { Mem, 0, 0} }, /* compare %st0, mem word */ {"fcoml", 1, 0xdc, 2, Modrm, { Mem, 0, 0} }, /* compare %st0, mem double */ {"fcoml", 1, 0xd8d0, _, ShortForm, { FloatReg, 0, 0} }, {"ficoms", 1, 0xde, 2, Modrm, { Mem, 0, 0} }, /* compare %st0, mem dword */ @@ -527,7 +536,7 @@ /* comparison (with pop) */ {"fcomp", 1, 0xd8d8, _, ShortForm, { FloatReg, 0, 0} }, {"fcomps", 1, 0xd8, 3, Modrm, { Mem, 0, 0} }, /* compare %st0, mem float */ -{"ficompl", 1, 0xda, 3, Modrm, { Mem, 0, 0} }, /* compare %st0, mem word */ +{"ficompl", 1, 0xda, 3, Modrm, { Mem, 0, 0} }, /* compare %st0, mem word */ {"fcompl", 1, 0xdc, 3, Modrm, { Mem, 0, 0} }, /* compare %st0, mem double */ {"fcompl", 1, 0xd8d8, _, ShortForm, { FloatReg, 0, 0} }, {"ficomps", 1, 0xde, 3, Modrm, { Mem, 0, 0} }, /* compare %st0, mem dword */ @@ -576,14 +585,15 @@ {"fsub", 2, 0xdce0, _, ShortForm, { FloatAcc, FloatReg, 0} }, #endif {"fsub", 0, 0xdce1, _, NoModrm, { 0, 0, 0} }, -{"fsubp", 1, 0xdee0, _, ShortForm, { FloatReg, 0, 0} }, -{"fsubp", 2, 0xdee0, _, ShortForm, { FloatReg, FloatAcc, 0} }, +{"fsubp", 1, 0xdee8, _, ShortForm, { FloatReg, 0, 0} }, +{"fsubp", 2, 0xdee8, _, ShortForm, { FloatReg, FloatAcc, 0} }, #ifdef NON_BROKEN_OPCODES {"fsubp", 2, 0xdee8, _, ShortForm, { FloatAcc, FloatReg, 0} }, +{"fsubp", 0, 0xdee9, _, NoModrm, { 0, 0, 0} }, #else {"fsubp", 2, 0xdee0, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif {"fsubp", 0, 0xdee1, _, NoModrm, { 0, 0, 0} }, +#endif {"fsubs", 1, 0xd8, 4, Modrm, { Mem, 0, 0} }, {"fisubl", 1, 0xda, 4, Modrm, { Mem, 0, 0} }, {"fsubl", 1, 0xdc, 4, Modrm, { Mem, 0, 0} }, @@ -598,14 +608,15 @@ {"fsubr", 2, 0xdce8, _, ShortForm, { FloatAcc, FloatReg, 0} }, #endif {"fsubr", 0, 0xdce9, _, NoModrm, { 0, 0, 0} }, -{"fsubrp", 1, 0xdee8, _, ShortForm, { FloatReg, 0, 0} }, -{"fsubrp", 2, 0xdee8, _, ShortForm, { FloatReg, FloatAcc, 0} }, +{"fsubrp", 1, 0xdee0, _, ShortForm, { FloatReg, 0, 0} }, +{"fsubrp", 2, 0xdee0, _, ShortForm, { FloatReg, FloatAcc, 0} }, #ifdef NON_BROKEN_OPCODES {"fsubrp", 2, 0xdee0, _, ShortForm, { FloatAcc, FloatReg, 0} }, +{"fsubrp", 0, 0xdee1, _, NoModrm, { 0, 0, 0} }, #else {"fsubrp", 2, 0xdee8, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif {"fsubrp", 0, 0xdee9, _, NoModrm, { 0, 0, 0} }, +#endif {"fsubrs", 1, 0xd8, 5, Modrm, { Mem, 0, 0} }, {"fisubrl", 1, 0xda, 5, Modrm, { Mem, 0, 0} }, {"fsubrl", 1, 0xdc, 5, Modrm, { Mem, 0, 0} }, @@ -635,14 +646,15 @@ {"fdiv", 2, 0xdcf0, _, ShortForm, { FloatAcc, FloatReg, 0} }, #endif {"fdiv", 0, 0xdcf1, _, NoModrm, { 0, 0, 0} }, -{"fdivp", 1, 0xdef0, _, ShortForm, { FloatReg, 0, 0} }, -{"fdivp", 2, 0xdef0, _, ShortForm, { FloatReg, FloatAcc, 0} }, +{"fdivp", 1, 0xdef8, _, ShortForm, { FloatReg, 0, 0} }, +{"fdivp", 2, 0xdef8, _, ShortForm, { FloatReg, FloatAcc, 0} }, #ifdef NON_BROKEN_OPCODES {"fdivp", 2, 0xdef8, _, ShortForm, { FloatAcc, FloatReg, 0} }, +{"fdivp", 0, 0xdef9, _, NoModrm, { 0, 0, 0} }, #else {"fdivp", 2, 0xdef0, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif {"fdivp", 0, 0xdef1, _, NoModrm, { 0, 0, 0} }, +#endif {"fdivs", 1, 0xd8, 6, Modrm, { Mem, 0, 0} }, {"fidivl", 1, 0xda, 6, Modrm, { Mem, 0, 0} }, {"fdivl", 1, 0xdc, 6, Modrm, { Mem, 0, 0} }, @@ -657,14 +669,15 @@ {"fdivr", 2, 0xdcf8, _, ShortForm, { FloatAcc, FloatReg, 0} }, #endif {"fdivr", 0, 0xdcf9, _, NoModrm, { 0, 0, 0} }, -{"fdivrp", 1, 0xdef8, _, ShortForm, { FloatReg, 0, 0} }, -{"fdivrp", 2, 0xdef8, _, ShortForm, { FloatReg, FloatAcc, 0} }, +{"fdivrp", 1, 0xdef0, _, ShortForm, { FloatReg, 0, 0} }, +{"fdivrp", 2, 0xdef0, _, ShortForm, { FloatReg, FloatAcc, 0} }, #ifdef NON_BROKEN_OPCODES {"fdivrp", 2, 0xdef0, _, ShortForm, { FloatAcc, FloatReg, 0} }, +{"fdivrp", 0, 0xdef1, _, NoModrm, { 0, 0, 0} }, #else {"fdivrp", 2, 0xdef8, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif {"fdivrp", 0, 0xdef9, _, NoModrm, { 0, 0, 0} }, +#endif {"fdivrs", 1, 0xd8, 7, Modrm, { Mem, 0, 0} }, {"fidivrl", 1, 0xda, 7, Modrm, { Mem, 0, 0} }, {"fdivrl", 1, 0xdc, 7, Modrm, { Mem, 0, 0} }, @@ -746,8 +759,8 @@ /* 486 extensions */ {"bswap", 1, 0x0fc8, _, ShortForm, { Reg32,0,0 } }, -{"xadd", 2, 0x0fc0, _, DW|Modrm, { Reg, Reg|Mem, 0 } }, -{"cmpxchg", 2, 0x0fb0, _, DW|Modrm, { Reg, Reg|Mem, 0 } }, +{"xadd", 2, 0x0fc0, _, W|Modrm, { Reg, Reg|Mem, 0 } }, +{"cmpxchg", 2, 0x0fb0, _, W|Modrm, { Reg, Reg|Mem, 0 } }, {"invd", 0, 0x0f08, _, NoModrm, { 0, 0, 0} }, {"wbinvd", 0, 0x0f09, _, NoModrm, { 0, 0, 0} }, {"invlpg", 1, 0x0f01, 7, Modrm, { Mem, 0, 0} }, @@ -832,8 +845,8 @@ /* float registers */ {"st(0)", FloatReg|FloatAcc, 0}, {"st", FloatReg|FloatAcc, 0}, - {"st(1)", FloatReg, 1}, {"st(2)", FloatReg, 2}, - {"st(3)", FloatReg, 3}, {"st(4)", FloatReg, 4}, {"st(5)", FloatReg, 5}, + {"st(1)", FloatReg, 1}, {"st(2)", FloatReg, 2}, + {"st(3)", FloatReg, 3}, {"st(4)", FloatReg, 4}, {"st(5)", FloatReg, 5}, {"st(6)", FloatReg, 6}, {"st(7)", FloatReg, 7} }; diff -urN binutils-2.7/include/opcode/i960.h binutils-2.8/include/opcode/i960.h --- binutils-2.7/include/opcode/i960.h Thu Jul 4 12:21:33 1996 +++ binutils-2.8/include/opcode/i960.h Wed Apr 30 12:57:20 1997 @@ -496,7 +496,7 @@ { R_2D(0x658), "intctl", I_JX, REG, 2, { RSL, RS, 0 } }, { R_0(0x5b4), "intdis", I_JX, REG, 0, { 0, 0, 0 } }, { R_0(0x5b5), "inten", I_JX, REG, 0, { 0, 0, 0 } }, - { R_0(0x65d), "halt", I_JX, REG, 0, { 0, 0, 0 } }, + { R_0(0x65d), "halt", I_JX, REG, 1, { RSL, 0, 0 } }, /* Hx extensions. */ { 0xac000000, "dcinva", I_HX, MEM1, 1, { M, 0, 0 } }, diff -urN binutils-2.7/include/opcode/m68k.h binutils-2.8/include/opcode/m68k.h --- binutils-2.7/include/opcode/m68k.h Thu Jul 4 12:21:33 1996 +++ binutils-2.8/include/opcode/m68k.h Wed Apr 30 12:57:20 1997 @@ -176,7 +176,8 @@ * all (modes 0-6,7.*) ~ alterable memory (modes 2-6,7.0,7.1) (not 0,1,7.~) - % alterable (modes 0-6,7.0,7.1)(not 7.~) + % alterable (modes 0-6,7.0,7.1) + (not 7.~) ; data (modes 0,2-6,7.*)(not 1) @ data, but not immediate (modes 0,2-6,7.? ? ?) (not 1,7.?) @@ -193,7 +194,16 @@ / control, or data register (modes 0,2,5,6,7.0,7.1,7.2,7.3) (not 1,3,4,7.4) ` control, plus pre-dec, not simple indir. (modes 4,5,6,7.*-) - (not 0,1,2,3,7.4) */ + (not 0,1,2,3,7.4) + > *save operands (modes 2,4,5,6,7.0,7.1) + < *restore operands (modes 2,3,5,6,7.0,7.1,7.2,7.3) + + coldfire move operands: + m (modes 0-4) + n (modes 5,7.2) + o (modes 6,7.0,7.1,7.3) + p (modes 0-5) +*/ /* For the 68851: */ /* diff -urN binutils-2.7/include/opcode/mips.h binutils-2.8/include/opcode/mips.h --- binutils-2.7/include/opcode/mips.h Thu Jul 4 12:21:35 1996 +++ binutils-2.8/include/opcode/mips.h Wed Apr 30 12:57:20 1997 @@ -1,5 +1,5 @@ /* mips.h. Mips opcode list for GDB, the GNU debugger. - Copyright 1993, 1995 Free Software Foundation, Inc. + Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. Contributed by Ralph Campbell and OSF Commented and modified by Ian Lance Taylor, Cygnus Support @@ -19,6 +19,9 @@ along with this file; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _MIPS_H_ +#define _MIPS_H_ + /* These are bit masks and shift counts to use to access the various fields of an instruction. To retrieve the X field of an instruction, use the expression @@ -94,6 +97,30 @@ #define OP_SH_FUNCT 0 #define OP_MASK_SPEC 0x3f #define OP_SH_SPEC 0 +#define OP_SH_LOCC 8 /* FP condition code */ +#define OP_SH_HICC 18 /* FP condition code */ +#define OP_MASK_CC 0x7 +#define OP_SH_COP1NORM 25 /* Normal COP1 encoding */ +#define OP_MASK_COP1NORM 0x1 /* a single bit */ +#define OP_SH_COP1SPEC 21 /* COP1 encodings */ +#define OP_MASK_COP1SPEC 0xf +#define OP_MASK_COP1SCLR 0x4 +#define OP_MASK_COP1CMP 0x3 +#define OP_SH_COP1CMP 4 +#define OP_SH_FORMAT 21 /* FP short format field */ +#define OP_MASK_FORMAT 0x7 +#define OP_SH_TRUE 16 +#define OP_MASK_TRUE 0x1 +#define OP_SH_GE 17 +#define OP_MASK_GE 0x01 +#define OP_SH_UNSIGNED 16 +#define OP_MASK_UNSIGNED 0x1 +#define OP_SH_HINT 16 +#define OP_MASK_HINT 0x1f +#define OP_SH_MMI 0 /* Multimedia (parallel) op */ +#define OP_MASK_MMI 0x3f +#define OP_SH_MMISUB 6 +#define OP_MASK_MMISUB 0x1f /* This structure holds information for a particular instruction. */ @@ -266,6 +293,7 @@ M_ADD_I, M_ADDU_I, M_AND_I, + M_BEQ, M_BEQ_I, M_BEQL_I, M_BGE, @@ -300,6 +328,7 @@ M_BLTUL, M_BLTU_I, M_BLTUL_I, + M_BNE, M_BNE_I, M_BNEL_I, M_DABS, @@ -327,6 +356,7 @@ M_DREMU_3I, M_DSUB_I, M_DSUBU_I, + M_DSUBU_I_2, M_J_A, M_JAL_1, M_JAL_2, @@ -441,6 +471,7 @@ M_SWR_AB, M_SUB_I, M_SUBU_I, + M_SUBU_I_2, M_TEQ_I, M_TGE_I, M_TGEU_I, @@ -463,9 +494,15 @@ M_USW_A, M_USD, M_USD_A, - M_XOR_I + M_XOR_I, + M_COP0, + M_COP1, + M_COP2, + M_COP3, + M_NUM_MACROS }; + /* The order of overloaded instructions matters. Label arguments and register arguments look the same. Instructions that can have either for arguments must apear in the correct order in this table for the @@ -476,6 +513,169 @@ Many instructions are short hand for other instructions (i.e., The jal instruction is short for jalr ). */ -extern const struct mips_opcode mips_opcodes[]; -extern const int bfd_mips_num_opcodes; +extern const struct mips_opcode mips_builtin_opcodes[]; +extern const int bfd_mips_num_builtin_opcodes; +extern struct mips_opcode *mips_opcodes; +extern int bfd_mips_num_opcodes; #define NUMOPCODES bfd_mips_num_opcodes + + +/* The rest of this file adds definitions for the mips16 TinyRISC + processor. */ + +/* These are the bitmasks and shift counts used for the different + fields in the instruction formats. Other than OP, no masks are + provided for the fixed portions of an instruction, since they are + not needed. + + The I format uses IMM11. + + The RI format uses RX and IMM8. + + The RR format uses RX, and RY. + + The RRI format uses RX, RY, and IMM5. + + The RRR format uses RX, RY, and RZ. + + The RRI_A format uses RX, RY, and IMM4. + + The SHIFT format uses RX, RY, and SHAMT. + + The I8 format uses IMM8. + + The I8_MOVR32 format uses RY and REGR32. + + The IR_MOV32R format uses REG32R and MOV32Z. + + The I64 format uses IMM8. + + The RI64 format uses RY and IMM5. + */ + +#define MIPS16OP_MASK_OP 0x1f +#define MIPS16OP_SH_OP 11 +#define MIPS16OP_MASK_IMM11 0x7ff +#define MIPS16OP_SH_IMM11 0 +#define MIPS16OP_MASK_RX 0x7 +#define MIPS16OP_SH_RX 8 +#define MIPS16OP_MASK_IMM8 0xff +#define MIPS16OP_SH_IMM8 0 +#define MIPS16OP_MASK_RY 0x7 +#define MIPS16OP_SH_RY 5 +#define MIPS16OP_MASK_IMM5 0x1f +#define MIPS16OP_SH_IMM5 0 +#define MIPS16OP_MASK_RZ 0x7 +#define MIPS16OP_SH_RZ 2 +#define MIPS16OP_MASK_IMM4 0xf +#define MIPS16OP_SH_IMM4 0 +#define MIPS16OP_MASK_REGR32 0x1f +#define MIPS16OP_SH_REGR32 0 +#define MIPS16OP_MASK_REG32R 0x1f +#define MIPS16OP_SH_REG32R 3 +#define MIPS16OP_EXTRACT_REG32R(i) ((((i) >> 5) & 7) | ((i) & 0x18)) +#define MIPS16OP_MASK_MOVE32Z 0x7 +#define MIPS16OP_SH_MOVE32Z 0 +#define MIPS16OP_MASK_IMM6 0x3f +#define MIPS16OP_SH_IMM6 5 + +/* These are the characters which may appears in the args field of an + instruction. They appear in the order in which the fields appear + when the instruction is used. Commas and parentheses in the args + string are ignored when assembling, and written into the output + when disassembling. + + "y" 3 bit register (MIPS16OP_*_RY) + "x" 3 bit register (MIPS16OP_*_RX) + "z" 3 bit register (MIPS16OP_*_RZ) + "Z" 3 bit register (MIPS16OP_*_MOVE32Z) + "v" 3 bit same register as source and destination (MIPS16OP_*_RX) + "w" 3 bit same register as source and destination (MIPS16OP_*_RY) + "0" zero register ($0) + "S" stack pointer ($sp or $29) + "P" program counter + "R" return address register ($ra or $31) + "X" 5 bit MIPS register (MIPS16OP_*_REGR32) + "Y" 5 bit MIPS register (MIPS16OP_*_REG32R) + "6" 6 bit unsigned break code (MIPS16OP_*_IMM6) + "a" 26 bit jump address + "e" 11 bit extension value + "l" register list for entry instruction + "L" register list for exit instruction + + The remaining codes may be extended. Except as otherwise noted, + the full extended operand is a 16 bit signed value. + "<" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 5 bit unsigned) + ">" 3 bit unsigned shift count * 0 (MIPS16OP_*_RX) (full 5 bit unsigned) + "[" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 6 bit unsigned) + "]" 3 bit unsigned shift count * 0 (MIPS16OP_*_RX) (full 6 bit unsigned) + "4" 4 bit signed immediate * 0 (MIPS16OP_*_IMM4) (full 15 bit signed) + "5" 5 bit unsigned immediate * 0 (MIPS16OP_*_IMM5) + "H" 5 bit unsigned immediate * 2 (MIPS16OP_*_IMM5) + "W" 5 bit unsigned immediate * 4 (MIPS16OP_*_IMM5) + "D" 5 bit unsigned immediate * 8 (MIPS16OP_*_IMM5) + "j" 5 bit signed immediate * 0 (MIPS16OP_*_IMM5) + "8" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8) + "V" 8 bit unsigned immediate * 4 (MIPS16OP_*_IMM8) + "C" 8 bit unsigned immediate * 8 (MIPS16OP_*_IMM8) + "U" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8) (full 16 bit unsigned) + "k" 8 bit signed immediate * 0 (MIPS16OP_*_IMM8) + "K" 8 bit signed immediate * 8 (MIPS16OP_*_IMM8) + "p" 8 bit conditional branch address (MIPS16OP_*_IMM8) + "q" 11 bit branch address (MIPS16OP_*_IMM11) + "A" 8 bit PC relative address * 4 (MIPS16OP_*_IMM8) + "B" 5 bit PC relative address * 8 (MIPS16OP_*_IMM5) + "E" 5 bit PC relative address * 4 (MIPS16OP_*_IMM5) + */ + +/* For the mips16, we use the same opcode table format and a few of + the same flags. However, most of the flags are different. */ + +/* Modifies the register in MIPS16OP_*_RX. */ +#define MIPS16_INSN_WRITE_X 0x00000001 +/* Modifies the register in MIPS16OP_*_RY. */ +#define MIPS16_INSN_WRITE_Y 0x00000002 +/* Modifies the register in MIPS16OP_*_RZ. */ +#define MIPS16_INSN_WRITE_Z 0x00000004 +/* Modifies the T ($24) register. */ +#define MIPS16_INSN_WRITE_T 0x00000008 +/* Modifies the SP ($29) register. */ +#define MIPS16_INSN_WRITE_SP 0x00000010 +/* Modifies the RA ($31) register. */ +#define MIPS16_INSN_WRITE_31 0x00000020 +/* Modifies the general purpose register in MIPS16OP_*_REG32R. */ +#define MIPS16_INSN_WRITE_GPR_Y 0x00000040 +/* Reads the register in MIPS16OP_*_RX. */ +#define MIPS16_INSN_READ_X 0x00000080 +/* Reads the register in MIPS16OP_*_RY. */ +#define MIPS16_INSN_READ_Y 0x00000100 +/* Reads the register in MIPS16OP_*_MOVE32Z. */ +#define MIPS16_INSN_READ_Z 0x00000200 +/* Reads the T ($24) register. */ +#define MIPS16_INSN_READ_T 0x00000400 +/* Reads the SP ($29) register. */ +#define MIPS16_INSN_READ_SP 0x00000800 +/* Reads the RA ($31) register. */ +#define MIPS16_INSN_READ_31 0x00001000 +/* Reads the program counter. */ +#define MIPS16_INSN_READ_PC 0x00002000 +/* Reads the general purpose register in MIPS16OP_*_REGR32. */ +#define MIPS16_INSN_READ_GPR_X 0x00004000 + +/* The following flags have the same value for the mips16 opcode + table: + INSN_UNCOND_BRANCH_DELAY + INSN_COND_BRANCH_DELAY + INSN_COND_BRANCH_LIKELY (never used) + INSN_READ_HI + INSN_READ_LO + INSN_WRITE_HI + INSN_WRITE_LO + INSN_TRAP + INSN_ISA3 + */ + +extern const struct mips_opcode mips16_opcodes[]; +extern const int bfd_mips16_num_opcodes; + +#endif /* _MIPS_H_ */ diff -urN binutils-2.7/include/opcode/mn10200.h binutils-2.8/include/opcode/mn10200.h --- binutils-2.7/include/opcode/mn10200.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/include/opcode/mn10200.h Wed Apr 30 12:57:20 1997 @@ -0,0 +1,110 @@ +/* mn10200.h -- Header file for Matsushita 10200 opcode table + Copyright 1996, 1997 Free Software Foundation, Inc. + Written by Jeff Law, Cygnus Support + +This file is part of GDB, GAS, and the GNU binutils. + +GDB, GAS, and the GNU binutils are free software; you can redistribute +them and/or modify them under the terms of the GNU General Public +License as published by the Free Software Foundation; either version +1, or (at your option) any later version. + +GDB, GAS, and the GNU binutils are distributed in the hope that they +will be useful, but WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this file; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef MN10200_H +#define MN10200_H + +/* The opcode table is an array of struct mn10200_opcode. */ + +struct mn10200_opcode +{ + /* The opcode name. */ + const char *name; + + /* The opcode itself. Those bits which will be filled in with + operands are zeroes. */ + unsigned long opcode; + + /* The opcode mask. This is used by the disassembler. This is a + mask containing ones indicating those bits which must match the + opcode field, and zeroes indicating those bits which need not + match (and are presumably filled in by operands). */ + unsigned long mask; + + /* The format of this opcode. */ + unsigned char format; + + /* An array of operand codes. Each code is an index into the + operand table. They appear in the order which the operands must + appear in assembly code, and are terminated by a zero. */ + unsigned char operands[8]; +}; + +/* The table itself is sorted by major opcode number, and is otherwise + in the order in which the disassembler should consider + instructions. */ +extern const struct mn10200_opcode mn10200_opcodes[]; +extern const int mn10200_num_opcodes; + + +/* The operands table is an array of struct mn10200_operand. */ + +struct mn10200_operand +{ + /* The number of bits in the operand. */ + int bits; + + /* How far the operand is left shifted in the instruction. */ + int shift; + + /* One bit syntax flags. */ + int flags; +}; + +/* Elements in the table are retrieved by indexing with values from + the operands field of the mn10200_opcodes table. */ + +extern const struct mn10200_operand mn10200_operands[]; + +/* Values defined for the flags field of a struct mn10200_operand. */ +#define MN10200_OPERAND_DREG 0x1 + +#define MN10200_OPERAND_AREG 0x2 + +#define MN10200_OPERAND_PSW 0x4 + +#define MN10200_OPERAND_MDR 0x8 + +#define MN10200_OPERAND_SIGNED 0x10 + +#define MN10200_OPERAND_PROMOTE 0x20 + +#define MN10200_OPERAND_PAREN 0x40 + +#define MN10200_OPERAND_REPEATED 0x80 + +#define MN10200_OPERAND_EXTENDED 0x100 + +#define MN10200_OPERAND_NOCHECK 0x200 + +#define MN10200_OPERAND_PCREL 0x400 + +#define MN10200_OPERAND_MEMADDR 0x800 + +#define MN10200_OPERAND_RELAX 0x1000 + +#define FMT_1 1 +#define FMT_2 2 +#define FMT_3 3 +#define FMT_4 4 +#define FMT_5 5 +#define FMT_6 6 +#define FMT_7 7 +#endif /* MN10200_H */ diff -urN binutils-2.7/include/opcode/mn10300.h binutils-2.8/include/opcode/mn10300.h --- binutils-2.7/include/opcode/mn10300.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/include/opcode/mn10300.h Wed Apr 30 12:57:21 1997 @@ -0,0 +1,119 @@ +/* mn10300.h -- Header file for Matsushita 10300 opcode table + Copyright 1996, 1997 Free Software Foundation, Inc. + Written by Jeff Law, Cygnus Support + +This file is part of GDB, GAS, and the GNU binutils. + +GDB, GAS, and the GNU binutils are free software; you can redistribute +them and/or modify them under the terms of the GNU General Public +License as published by the Free Software Foundation; either version +1, or (at your option) any later version. + +GDB, GAS, and the GNU binutils are distributed in the hope that they +will be useful, but WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this file; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef MN10300_H +#define MN10300_H + +/* The opcode table is an array of struct mn10300_opcode. */ + +struct mn10300_opcode +{ + /* The opcode name. */ + const char *name; + + /* The opcode itself. Those bits which will be filled in with + operands are zeroes. */ + unsigned long opcode; + + /* The opcode mask. This is used by the disassembler. This is a + mask containing ones indicating those bits which must match the + opcode field, and zeroes indicating those bits which need not + match (and are presumably filled in by operands). */ + unsigned long mask; + + /* The format of this opcode. */ + unsigned char format; + + /* An array of operand codes. Each code is an index into the + operand table. They appear in the order which the operands must + appear in assembly code, and are terminated by a zero. */ + unsigned char operands[8]; +}; + +/* The table itself is sorted by major opcode number, and is otherwise + in the order in which the disassembler should consider + instructions. */ +extern const struct mn10300_opcode mn10300_opcodes[]; +extern const int mn10300_num_opcodes; + + +/* The operands table is an array of struct mn10300_operand. */ + +struct mn10300_operand +{ + /* The number of bits in the operand. */ + int bits; + + /* How far the operand is left shifted in the instruction. */ + int shift; + + /* One bit syntax flags. */ + int flags; +}; + +/* Elements in the table are retrieved by indexing with values from + the operands field of the mn10300_opcodes table. */ + +extern const struct mn10300_operand mn10300_operands[]; + +/* Values defined for the flags field of a struct mn10300_operand. */ +#define MN10300_OPERAND_DREG 0x1 + +#define MN10300_OPERAND_AREG 0x2 + +#define MN10300_OPERAND_SP 0x4 + +#define MN10300_OPERAND_PSW 0x8 + +#define MN10300_OPERAND_MDR 0x10 + +#define MN10300_OPERAND_SIGNED 0x20 + +#define MN10300_OPERAND_PROMOTE 0x40 + +#define MN10300_OPERAND_PAREN 0x80 + +#define MN10300_OPERAND_REPEATED 0x100 + +#define MN10300_OPERAND_EXTENDED 0x200 + +#define MN10300_OPERAND_SPLIT 0x400 + +#define MN10300_OPERAND_REG_LIST 0x800 + +#define MN10300_OPERAND_PCREL 0x1000 + +#define MN10300_OPERAND_MEMADDR 0x2000 + +#define MN10300_OPERAND_RELAX 0x4000 + +/* Opcode Formats. */ +#define FMT_S0 1 +#define FMT_S1 2 +#define FMT_S2 3 +#define FMT_S4 4 +#define FMT_S6 5 +#define FMT_D0 6 +#define FMT_D1 7 +#define FMT_D2 8 +#define FMT_D4 9 +#define FMT_D5 10 + +#endif /* MN10300_H */ diff -urN binutils-2.7/include/opcode/sparc.h binutils-2.8/include/opcode/sparc.h --- binutils-2.7/include/opcode/sparc.h Thu Jul 4 12:21:36 1996 +++ binutils-2.8/include/opcode/sparc.h Wed Apr 30 12:57:22 1997 @@ -1,5 +1,6 @@ /* Definitions for opcode table for the sparc. - Copyright (C) 1989, 1991, 1992, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and the GNU Binutils. @@ -19,6 +20,8 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include + /* The SPARC opcode table (and other related data) is defined in the opcodes library in sparc-opc.c. If you change anything here, make sure you fix up that file, and vice versa. */ @@ -70,7 +73,8 @@ extern const struct sparc_opcode_arch sparc_opcode_archs[]; /* Given architecture name, look up it's sparc_opcode_arch_val value. */ -extern enum sparc_opcode_arch_val sparc_opcode_lookup_arch (); +extern enum sparc_opcode_arch_val sparc_opcode_lookup_arch + PARAMS ((const char *)); /* Return the bitmask of supported architectures for ARCH. */ #define SPARC_OPCODE_SUPPORTED(ARCH) (sparc_opcode_archs[ARCH].supported) @@ -178,9 +182,10 @@ ? Privileged Register in rs1 (v9) * Prefetch function constant. (v9) x OPF field (v9 impdep). + 0 32/64 bit immediate for set or setx (v9) insns The following chars are unused: (note: ,[] are used as punctuation) -[3450] +[345] */ @@ -214,14 +219,14 @@ extern struct sparc_opcode sparc_opcodes[]; extern const int sparc_num_opcodes; -int sparc_encode_asi (); -char *sparc_decode_asi (); -int sparc_encode_membar (); -char *sparc_decode_membar (); -int sparc_encode_prefetch (); -char *sparc_decode_prefetch (); -int sparc_encode_sparclet_cpreg (); -char *sparc_decode_sparclet_cpreg (); +extern int sparc_encode_asi PARAMS ((const char *)); +extern const char *sparc_decode_asi PARAMS ((int)); +extern int sparc_encode_membar PARAMS ((const char *)); +extern const char *sparc_decode_membar PARAMS ((int)); +extern int sparc_encode_prefetch PARAMS ((const char *)); +extern const char *sparc_decode_prefetch PARAMS ((int)); +extern int sparc_encode_sparclet_cpreg PARAMS ((const char *)); +extern const char *sparc_decode_sparclet_cpreg PARAMS ((int)); /* * Local Variables: diff -urN binutils-2.7/include/remote-sim.h binutils-2.8/include/remote-sim.h --- binutils-2.7/include/remote-sim.h Wed Dec 31 19:00:00 1969 +++ binutils-2.8/include/remote-sim.h Wed Apr 30 12:57:05 1997 @@ -0,0 +1,144 @@ +/* This file defines the interface between the simulator and gdb. + Copyright (C) 1993, 1994, 1996, 1997 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 + +/* 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; + +/* Main simulator entry points. */ + +/* Initialize the simulator. This function is called when the simulator + is selected from the gdb command line. + KIND specifies how the simulator will be used. Currently there are only + two kinds: standalone and debug. + ARGV is passed from the command line and can be used to select whatever + run time options the simulator provides. + ARGV is the standard NULL terminated array of pointers, with argv[0] + being the program name. + The result is a descriptor that must be passed back to the other sim_foo + functions. */ + +SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, char **argv)); + +/* Terminate usage of the simulator. This may involve freeing target memory + and closing any open files and mmap'd areas. You cannot assume sim_kill + has already been called. + QUITTING is non-zero if we cannot hang on errors. */ + +void sim_close PARAMS ((SIM_DESC sd, int quitting)); + +/* Load program PROG into the simulator. + Return non-zero if you wish the caller to handle it + (it is done this way because most simulators can use gr_load_image, + but defining it as a callback seems awkward). */ + +int sim_load PARAMS ((SIM_DESC sd, char *prog, int from_tty)); + +/* Prepare to run the simulated program. + START_ADDRESS is, yes, you guessed it, the start address of the program. + ARGV and ENV are NULL terminated lists of pointers. + Gdb will set the start address via sim_store_register as well, but + standalone versions of existing simulators are not set up to cleanly call + sim_store_register, so the START_ADDRESS argument is there as a + workaround. */ + +void sim_create_inferior PARAMS ((SIM_DESC sd, SIM_ADDR start_address, + char **argv, char **env)); + +/* Kill the running program. + This may involve closing any open files and deleting any mmap'd areas. */ + +void sim_kill PARAMS ((SIM_DESC sd)); + +/* Read LENGTH bytes of the simulated program's memory 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 in the simulated program's memory. + 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 and store the raw value in BUF. */ + +void sim_fetch_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf)); + +/* Store register REGNO from BUF (in raw format). */ + +void sim_store_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf)); + +/* Print some interesting information about the simulator. + VERBOSE is non-zero for the wordy version. */ + +void sim_info PARAMS ((SIM_DESC sd, int verbose)); + +/* Fetch why the program stopped. + SIGRC will contain either the argument to exit() or the signal number. */ + +enum sim_stop { sim_exited, sim_stopped, sim_signalled }; + +void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc)); + +/* Run (or resume) the program. */ + +void sim_resume PARAMS ((SIM_DESC sd, int step, int siggnal)); + +/* Passthru for other commands that the simulator might support. + If SD is NULL, the command is to be interpreted as refering to + the global state, however the simulator defines that. */ + +void sim_do_command PARAMS ((SIM_DESC sd, char *cmd)); + +/* Provide simulator with a standard host_callback_struct. + If SD is NULL, the command is to be interpreted as refering to + the global state, however the simulator defines that. */ + +void sim_set_callbacks PARAMS ((SIM_DESC sd, struct host_callback_struct *)); + +#endif /* !defined (REMOTE_SIM_H) */ diff -urN binutils-2.7/install.sh binutils-2.8/install.sh --- binutils-2.7/install.sh Thu Jul 4 12:22:01 1996 +++ binutils-2.8/install.sh Wed Apr 30 12:57:44 1997 @@ -114,6 +114,7 @@ if [ -d $dst ]; then instcmd=: + chmodcmd="" else instcmd=mkdir fi diff -urN binutils-2.7/ld/ChangeLog binutils-2.8/ld/ChangeLog --- binutils-2.7/ld/ChangeLog Mon Jul 15 11:54:28 1996 +++ binutils-2.8/ld/ChangeLog Wed Apr 30 12:57:45 1997 @@ -1,6 +1,827 @@ -Mon Jul 15 11:54:08 1996 Ian Lance Taylor +Wed Apr 30 12:23:21 1997 Manfred Hollstein - * Released binutils 2.7. + * scripttempl/m88kbcs.sc (__.initp.end, _etext): Added whitespace + around assignment of current location pointer. + +Mon Apr 14 12:06:15 1997 Ian Lance Taylor + + From Thomas Graichen : + * configure.in: Use ${CONFIG_SHELL} when running $ac_config_sub. + * configure: Rebuild. + +Fri Apr 4 11:42:41 1997 Ian Lance Taylor + + * emultempl/pe.em: Include "libiberty.h". + (sort_sections_1): Use xmalloc rather than alloca. + +Thu Apr 3 18:54:20 1997 Ian Lance Taylor + + * ldver.c (ld_program_version): Set to "2.8"; + +Wed Apr 2 11:55:27 1997 Ian Lance Taylor + + * mpw-idtmips.c: Rename from mpw-emipsidt.c. + * mpw-elfmips.c: Rename from mpw-emipself.c. + * mpw-config.in: Update accordingly. + + * ldlang.c (lang_process): Call lang_check immediately after + opening the input files, rather than at the end of the link. + +Mon Mar 31 23:44:00 1997 Ian Lance Taylor + + * emultempl/pe.em (init): Fully bracket initializer. + (set_pe_stack_heap): Remove locals begin_commit and end. + (gld_${EMULATION_NAME}_after_open): Remove unused local i. + (gld${EMULATION_NAME}_place_orphan): Remove unused local ptr. + +Mon Mar 31 16:35:51 1997 Joel Sherrill + + * configure.tgt (hppa*-*-rtems*): New target, like hppa-*-*elf*. + +Fri Mar 28 15:29:23 1997 H.J. Lu + + Contributed by David S. Miller : + * configure.tgt (sparc*-*-linuxaout*): New target. + (sparc*-*-linux*): New target. + * emulparams/sparclinux.sh: New file. + * Makefile.in (ALL_EMULATIONS): Add esparclinux.o. + (esparclinux.c): New target. + +Fri Mar 28 14:30:12 1997 Ian Lance Taylor + + From Ralf Baechle : + * configure.tgt: Set targ_extra_emuls for mips*el-*-linux* and + mips*-*-linux*. Use elf32bmip and elf32lmip, not elf32ebmip and + elf32elmip. + +Thu Mar 27 17:14:32 1997 Ian Lance Taylor + + * lexsup.c (parse_args): Update copyright date in version + message. + +Fri Mar 21 12:28:41 1997 Philippe De Muyter + + * emulparams/delta68.sh (OUTPUT_FORMAT): Set to "coff-m68k-sysv". + +Tue Mar 18 11:16:23 1997 Ian Lance Taylor + + * Makefile.in: Rebuild dependencies. + + * emultempl/aix.em: Include "obstack.h". + +Mon Mar 17 19:26:06 1997 Ian Lance Taylor + + * ldlang.c: Include "obstack.h". + +Sat Mar 15 23:23:46 1997 Fred Fish + + * configure.tgt (powerpc-*-beos*): Use aixppc for targ_emul. + +Sat Mar 15 18:10:38 1997 H.J. Lu + + * ldemul.h (ldemul_list_emulations): Use full prototype. + * ldlang.c (print_one_symbol): Add declaration. + * ldlang.h (dprint_statements): Declare. + * ldmain.c (remove_output): Declare. + * ldmisc.c (vfinfo): Declare. + * ldwrite.c (clone_section): Declare. + (split_sections): Make static. Declare. + * mri.c: Include libiberty.h. + (strdup): Don't declare. + (mri_alias): Use xstrdup rather than strdup. + +Fri Mar 14 21:30:06 1997 Ian Lance Taylor + + * scripttempl/elfmips.sc: Change handling of data area when + generating a shared library to not skip a large block of memory. + From Per Fogelstrom . + +Wed Mar 12 21:33:09 1997 Ian Lance Taylor + + * ldmain.c (multiple_definition): Only skip the warning if the + output section is absolute when the input section is not + absolute. + + * ldlex.l: Accept whitespace in VERS_START state. Warn about + invalid characters in VERS_* states. + +Tue Mar 11 13:51:31 1997 Ian Lance Taylor + + * emultempl/aix.em (gld${EMULATION_NAME}_read_file): Don't let a + trailing space lead us to think that there is a zero address. + +Sun Mar 9 23:06:35 1997 Eric Youngdale + + * ldgram.y (vers_node): Correct typo of '(' for '{'. + +Sun Mar 2 22:59:49 1997 Fred Fish + + * Makefile.in (ld.dvi): Set MAKEINFO environment variable as well + as TEXINPUTS. Needed for building in separate build dir. + * ldint.texinfo (SCRIPT_NAME): Fix typo. + +Fri Feb 28 17:42:27 1997 Ian Lance Taylor + + * ldmain.c (main): Call bfd_set_default_target. + * Makefile.in (ldmain.o): Define TARGET when compiling. + +Thu Feb 27 11:41:03 1997 Ian Lance Taylor + + * ldmain.c (main): Don't initialize link_info.lprefix or + link_info.lprefix_len. + * emultempl/hppaelf.em (hppaelf_before_parse): Likewise. + + * emultempl/m88kbcs.em: Remove. + * emulparams/m88kbcs.sh (TEMPLATE_NAME): Don't set. + * Makefile.in (em88kbcs.c): Depend upon generic.em rather than + m88kbcs.em. + + * mri.c (mri_draw_tree): Pass noload_section, not SEC_NEVER_LOAD, + to lang_enter_output_section_statement. From Mark Rasin + . + +Wed Feb 26 11:51:44 1997 Ian Lance Taylor + + * ldlang.c (lang_one_common): Clear SEC_IS_COMMON from common + section. + +Tue Feb 25 20:38:11 1997 Stan Shebs + + * configure.tgt (mips*-*-lnews*): New target. + * Makefile.in (emipslnews.c): New target. + * emulparams/mipslnews.sh: New file. + +Tue Feb 25 16:04:09 1997 Ian Lance Taylor + + * emultempl/elf32.em (hold_interp): New static variable. + (gld${EMULATION_NAME}_place_orphan): Put loadable .note sections + after hold_interp. Choose a unique output section name. + (gld${EMULATION_NAME}_place_section): Don't set hold_use if the + SEC_LOAD or SEC_ALLOC flags differ. Set hold_interp. + +Mon Feb 24 18:16:09 1997 Ian Lance Taylor + + From Eric Youngdale : + * ldlex.l (V_TAG, V_IDENTIFIER): New macros. + (VERS_START, VERS_SCRIPT, VERS_NODE): New states to parse version + information. + (ldlex_version_script, ldlex_version_file): New functions. + * ldlex.h (enum input_enum): Add input_version_script. + (ldlex_version_script): Declare. + (ldlex_version_file): Declare. + * ldgram.y (%union): Add deflist, versyms, and versnode. + (VERS_TAG, VERS_IDENTIFIER): New terminals. + (GLOBAL, LOCAL, VERSION, INPUT_VERSION_SCRIPT): New terminals. + (file): Accept INPUT_VERSION_SCRIPT. + (ifile_p1): Accept version. + (version_script_file): New nonterminal. + (version, vers_nodes, vers_node): Likewise. + (verdep, vers_tag, ver_defns): Likewise. + * ldlang.c (lang_elf_version_info): New global variable. + (lang_new_vers_regex): New function. + (lang_new_vers_node): New function. + (version_index): New static variable. + (lang_register_vers_node): New function. + (lang_add_vers_depend): New function. + * ldlang.h (lang_elf_version_info): Declare. + (lang_new_vers_regex, lang_new_vers_node): Declare. + (lang_add_vers_depend, lang_register_vers_node): Declare. + * lexsup.c (OPTION_VERSION_SCRIPT): Define. + (ld_options): Add "version-script". + (parse_args): Handle OPTION_VERSION_SCRIPT. + * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): + Pass lang_elf_version_info to size_dynamic_sections. + * scripttempl/elf.sc: Add .gnu.version sections. + * ld.texinfo: Document symbol versioning. + +Fri Feb 14 18:28:31 1997 Ian Lance Taylor + + * ld.texinfo (Option Commands): Document the INCLUDE command. + +Thu Feb 13 20:31:37 1997 Philippe De Muyter + + * configure.in: Call BFD_NEED_DECLARATION on getenv. + * acconfig.h (NEED_DECLARATION_GETENV): New macro. + * sysdep.h (getenv): Declare if NEED_DECLARATION_GETENV. + * ldemul.c (ld_emul_default_target): Do not cast getenv return + value. + * ldmain.c (get_emulation): Likewise. + * configure, config.in: Rebuild. + +Tue Feb 11 15:34:26 1997 Ian Lance Taylor + + * scripttempl/elfmips.sc: When relocating, put .mips16.fn.* and + .mips16.call.* in .text. + +Fri Jan 31 13:16:53 1997 Ian Lance Taylor + + * emultempl/sunos.em (gld${EMULATION_NAME}_find_so): Search for + ".so" in the name, not ".so.". + (gld${EMULATION_NAME}_search_dir): Accept a plain .so file. + + * Makefile.in (ld.info): Add -I$(srcdir). From Alan Modra + . + +Thu Jan 30 11:31:52 1997 Ian Lance Taylor + + * emultempl/sunos.em: Include . + (gld${EMULATION_NAME}_find_so): Skip the directory name when + searching for ".so.". + (gld${EMULATION_NAME}_search_dir): Make sure that the library name + has a version number, and that only version numbers follow .so. + +Wed Jan 29 18:15:00 1997 Geoffrey Noer + + * scripttempl/pe.sc: + * scripttempl/ppcpe.sc: add *(.gcc_except_table) to the text + section so Win32 executables are valid. + +Mon Jan 27 12:28:43 1997 Ian Lance Taylor + + * scripttempl/elf.sc: Put linkonce reloc section in other + appropriate reloc sections. + * scripttempl/elfmips.sc: Add linkonce support. + * scripttempl/elfppc.sc: Likewise. + +Fri Jan 24 10:44:09 1997 Jeffrey A Law (law@cygnus.com) + + * emulparms/mn10200.sh (OTHER_RELOCATING_SECTIONS): Move the + stack up to 0x80000. + * emulparms/mn10300.sh (OTHER_RELOCATING_SECTIONS): Likewise. + +Tue Jan 21 12:11:10 1997 Doug Evans + + * emulparams/m32relf.sh (OTHER_RELOCATING_SECTIONS): Use PROVIDE + to define `_stack'. + +Thu Jan 16 17:07:52 1997 Ian Lance Taylor + + * ld.h (args_type): Rename auxiliary_filter_shlib to + auxiliary_filters, and make it char **. + * lexsup.c (parse_args): Handle -f by setting up an array. + * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Use + new name of auxiliary_filters. + + * ld.texinfo (Options): Improve documentation of --filter and + --auxiliary. + +Tue Jan 14 15:44:28 1997 Ian Lance Taylor + + * ld.texinfo (Options): Clarify that the normal usage is -T. + (Commands): Likewise. + +Thu Jan 9 11:26:27 1997 Ian Lance Taylor + + * scripttempl/armcoff.sc: Correct mask used for .data address. + +Wed Jan 8 15:14:59 1997 Geoffrey Noer + + * emultempl/pe.em: make default executable a.exe instead of + a.out + +Fri Jan 3 17:33:34 1997 Richard Henderson + + * scripttempl/elf.sc: Move .got closer to .sdata and .sbss by + shifting .plt back. Rumour has it that the NetBSD ld.so depends + on .dynamic being after .got, so we leave that. + +Fri Jan 3 14:04:40 1997 Ian Lance Taylor + + * Makefile.in (clean): Don't remove configdoc.texi. + (maintainer-clean): Do remove configdoc.texi. + + * ld.texinfo (Operators): Remove '@' from @smallexmple in comment + to avoid confusing texi2roff. + +Thu Jan 2 18:14:32 1997 Ian Lance Taylor + + * configure.tgt (mips*el-*-linux*, mips*-*-linux*): New targets. + * scripttempl/elfmips.sc: Use __start as the entry address for + mips*-*-linux*. + +Tue Dec 31 14:48:30 1996 Ian Lance Taylor + + * Makefile.in (ALL_CFLAGS): Add -D_GNU_SOURCE. + + * ld.h (args_type): Add filter_shlib and auxiliary_filter_shlib + fields. + * lexsup.c (parse_args): Recognize --auxiliary/-f and + --filter/-F. + * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): + Pass filter_shlib and auxiliary_filter_shlib to + size_dynamic_sections. + * ld.texinfo, ld.1: Document --filter/-F and --auxiliary/-f. + +Wed Dec 18 22:57:35 1996 Stan Shebs + + * mpw-make.sed: Use NewFolderRecursive for installation. + +Fri Dec 13 10:19:57 1996 Jeffrey A Law (law@cygnus.com) + + * Makefile.in (emn10200.c): Add dependencies. + * configure.tgt: Handle mn10200. + * emulparms/mn10200.sh: New file. + +Thu Dec 12 17:04:55 1996 Ian Lance Taylor + + * emultempl/gld960c.em: Include . + (gld960_set_output_arch): Get the machine type from the -A option + if there is one, rather than always using core. + +Sat Dec 7 10:07:51 1996 Jeffrey A Law (law@cygnus.com) + + * emulparms/mn10300.sh: Handle leading underscores. + +Thu Dec 5 13:45:58 1996 Ian Lance Taylor + + * emultempl/elf32.em (gld${EMULATION_NAME}_place_section): Only + set hold_rel if SEC_ALLOC is set. + +Tue Dec 3 11:29:20 1996 Ian Lance Taylor + + * ldlang.c (section_already_linked): Set the output_offset as well + as the output_section when only reading symbols from a file. + +Mon Dec 2 11:43:50 1996 Ian Lance Taylor + + * emulparams/*.sh: Make sure that each set of parameters which + uses the elf.sc script sets MACHINE. + +Wed Nov 27 03:22:05 1996 Jason Merrill + + * scripttempl/elf{,mips,ppc}.sc: Add the remaining DWARF sections. + + * scripttempl/elfd10v.sc: Likewise. + +Tue Nov 26 16:58:33 1996 Ian Lance Taylor + + * configure: Rebuild with autoconf 2.12. + +Mon Nov 25 12:17:55 1996 Jim Wilson + + * emultempl/pe.em (gld_${EMULATION_NAME}_set_symbols): Add case + for bfd_vma to init loop. + +Mon Nov 25 09:55:07 1996 Jeffrey A Law (law@cygnus.com) + + * emulparms/mn10300.sh: Remove bogus '_' prefix for + entry symbol and ctor/dtor stuff. + +Fri Nov 15 13:00:18 1996 Jeffrey A Law (law@cygnus.com) + + * Makefile.in (emn10300.c): Add dependencies. + * configure.tgt: Handle mn10300. + * emulparms/mn10300.sh: New file. + +Tue Nov 5 10:57:50 1996 Martin M. Hunt + + * emulparams/d10velf.sh (READONLY_START_ADDR): Changed to 0x2000004. + (EMBEDDED): Define. + +Fri Nov 1 10:01:27 1996 Ian Lance Taylor + + * ld.texinfo: Add section on reporting bugs. + + * scripttempl/m68kcoff.sc: Make sure the etext and __CTOR_LIST__ + symbols are correctly aligned. + +Tue Oct 29 12:33:05 1996 Martin M. Hunt + + * emulparams/d10velf.sh: Changes needed for D10V-EVA board. + Set TEXT_START_ADDR to 0x1000000. Set READONLY_START_ADDR to + 0x2000000. + + * scripttempl/elfd10v.sc: Fix calculation of .text. Change + .stack to start at 0x2007ffe. + +Mon Oct 28 15:37:00 1996 Doug Evans + + * configure.tgt (sparclet*-*-aout*): Delete, use sparc*-*-aout*. + +Mon Oct 21 17:16:59 1996 Michael Meissner + + * scripttempl/elfd10v.sc: Clone from elf.sc, move .text to + 0x10000, so that is more room for data. + + * emulparams/d10velf.sh (TEXT_START_ADDR): Now 0x100000. + (READONLY_START_ADDR): Now 0x0. + (SCRIPT_NAME): Now elfd10v. + + * Makefile.in (ed10velf.c): Depend on elfd10v.sc, not elf.sc. + +Fri Oct 18 22:12:49 1996 Doug Evans + + * emulparams/m32relf.sh (TEXT_START_ADDR): Change from 0 to 0x100. + +Fri Oct 18 15:43:38 1996 Ian Lance Taylor + + * Makefile.in (ALL_EMULATIONS): Remove eelf64alpha.o. + (ALL_64_EMULATIONS): New variable. + * configure.in: Accept --enable-64-bit-bfd option. If it is set + with --enable-targets=all, include ALL_64_EMULATIONS in + EMULATION_OFILES. + * configure: Rebuild. + +Thu Oct 17 18:14:07 1996 Ian Lance Taylor + + * ld.texinfo: Try to consistently use a single or a double dash + for each option. + +Thu Oct 17 10:17:20 1996 Doug Evans + + * emulparams/m32relf.sh (EMBEDDED): Define. + +Thu Oct 10 17:57:00 1996 Ian Lance Taylor + + * emulparams/elf32b4300.sh: Define _gp in OTHER_GOT_SYMBOLS, not + OTHER_READWRITE_SECTIONS. + * emulparams/elf32l4300.sh: Likewise. + +Wed Oct 9 14:36:18 1996 Ian Lance Taylor + + * ld.h (ld_config_type): Add warn_section_align field. + * lexsup.c (OPTION_WARN_SECTION_ALIGN): Define. + (ld_options): Add --warn-section-align. + (parse_args): Handle --warn-section-align. + * ldlang.c (lang_size_sections): If warn_section_align, warn if + the start of a section changes due to alignment. + * ld.texinfo, ld.1: Document --warn-section-align. + * ld.texinfo: Change some single dashes to double dashes. + + * emultempl/pe.em (set_pe_subsystem): Record entry symbol for each + subsystem type. Ifdef out os2 type. Recognize a version number. + +Tue Oct 8 12:07:13 1996 Ian Lance Taylor + + * emultempl/pe.em (set_pe_subsystem): When setting the subsystem + to windows, set the entry point. + + * Makefile.in (ldlex.c): Don't pass any options to $(LEX). + +Mon Oct 7 17:29:05 1996 Ian Lance Taylor + + * ld.texinfo (Options): Mention .so extensions for shared + libraries. + +Sun Oct 6 22:35:36 1996 Jason Merrill + + * scripttempl/elf{,mips,ppc}.sc: Add DWARF 2 sections. + +Fri Oct 4 18:49:31 1996 Ian Lance Taylor + + * scripttempl/m68kcoff.sc: Only set the address of .text if + RELOCATING. + +Fri Oct 4 10:59:52 1996 Doug Evans + + * emulparams/sparcaout.sh ({BIG,LITTLE}_OUTPUT_FORMAT): Define. + * scripttempl/aout.sc ({BIG,LITTLE}_OUTPUT_FORMAT): Provide default. + (OUTPUT_FORMAT): Support bi-endian targets. + +Thu Oct 3 13:52:03 1996 Ian Lance Taylor + + * fnmatch.h, fnmatch.c: Remove (now in libiberty). + * Makefile.in: Rebuild dependencies. + (CFILES): Remove fnmatch.c. + (HFILES): Remove fnmatch.h. + (OFILES): Remove fnmatch.o. + +Thu Oct 3 15:41:24 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) + + * Makefile.in (mostlyclean): Move config.log to distclean. + +Wed Oct 2 23:45:25 1996 Geoffrey Noer + + * emultmpl/pe.em: increase size of stack reserve to 0x2000000 + (necessary in order to compile parse.c in gcc sources under NT) + +Wed Oct 2 14:49:10 1996 Ian Lance Taylor + + * lexsup.c (ld_options): Fix typo in --rpath-link description. + * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Suggest + --rpath if a needed library is not found. + +Tue Oct 1 16:17:33 1996 Joel Sherrill + + * configure.tgt (mips*-*-rtems*): New target, like mips*-*-elf*. + +Tue Oct 1 15:50:34 1996 Ian Lance Taylor + + * ld.texinfo (Options): Give more detail on -l option. + + * scripttempl/elfmips.sc: Handle CREATE_SHLIB the same way that + elf.sc does, so that glibc works better. + + * ldver.c (ld_program_version): New variable. + (ldversion): Use it. + * ldver.h (ld_program_version): Declare. + * lexsup.c (ld_options): Handle --dll-verbose like --verbose, not + --version. Change --version handling to match current GNU + standards. + (help): Print bug report address. + +Mon Sep 30 12:14:43 1996 Doug Evans + + * Makefile.in (em32relf.c): Add rule for. + * configure.tgt (m32r-*-*): Recognize. + * emulparams/m32relf.sh: New file. + +Thu Sep 26 13:58:47 1996 Stan Shebs + + * mpw-make.sed: Add symbolic doublequoting to ldmain compile edit. + * mpw-config.in: Add mips-*-* case as mips-elf, and use more + wildcards in matching. + * mpw-emipself.c: New file, pregenerated mips elf emulation. + +Tue Sep 17 12:18:21 1996 Ian Lance Taylor + + * ldint.texinfo: Rewrote. + + * configure.tgt: Add cases for MIPS 5000 like MIPS 4300. + +Mon Sep 16 17:55:21 1996 Ian Lance Taylor + + * scripttempl/armcoff.sc: Only define symbols if RELOCATING. Fix + syntax error on __end__ line. + + * scripttempl/armcoff.sc: For -N or -n, don't align .data. From + Chris Hadley + +Sun Sep 15 10:38:16 1996 Mark Alexander + + * emulparms/d10v.sh: Set OTHER_RELOCATING_SECTIONS to put + stack at top of simulator memory. + +Fri Sep 13 15:49:45 1996 Ian Lance Taylor + + * ldlex.l (SYMBOLCHARN): Add $, _, and ~. + +Wed Sep 11 23:30:42 1996 Ian Lance Taylor + + * ldmain.c (get_emulation): Check for -mips4 like -mips1, et. al. + +Thu Sep 5 15:24:12 1996 Ian Lance Taylor + + * ldlang.c (section_already_linked): Accept a lang_input_statement + as the PTR argument. If the file is symbols only, discard all + input sections. + (ldlang_add_file): Pass entry to bfd_map_over_sections. + +Wed Sep 4 15:53:43 1996 Ian Lance Taylor + + * configure.tgt (alpha-*-gnu*): New target. From Fila Kolodny + . + +Fri Aug 30 18:32:31 1996 Ian Lance Taylor + + * configure.tgt (sh-*-elf*): New target. + * emulparams/shelf.sh: New file. + * emulparams/shlelf.sh: New file. + * Makefile.in (ALL_EMULATIONS): Add eshelf.o and eshlelf.o. + (eshelf.c, eshlelf.c): New targets. + * scripttempl/elf.sc: If EMBEDDED is defined, then don't add + SIZEOF_HEADERS to TEXT_START_ADDR. Expand CTOR_START and CTOR_END + around .ctors, and DTOR_START and DTOR_END around .dtors. Expand + OTHER_RELOCATING_SECTIONS if RELOCATING. + +Thu Aug 29 16:57:46 1996 Michael Meissner + + * configure.{host,tgt} (i[345]86-*-*): Recognize i686 for pentium + pro. + +Mon Aug 26 12:58:11 1996 Ian Lance Taylor + + * ldgram.y (section): Add opt_nocrossrefs; pass value to + lang_enter_overlay. + (opt_nocrossrefs): New nonterminal. + * ldlex.l: Recognize NOCROSSREFS keyword in EXPRESSION mode. + * ldlang.c (overlay_nocrossrefs): New static variable. + (lang_enter_overlay): Add nocrossrefs parameter. + (lang_leave_overlay): Only add nocrossrefs if overlay_nocrossrefs + is set. Initialize overlay_nocrossrefs. + * ldlang.h (lang_enter_overlay): Update declaration. + * ld.texinfo (Overlays): Update documentation. + + * ldver.c (ldversion): Print GNU ld in the version message. + +Thu Aug 22 17:10:40 1996 Ian Lance Taylor + + * configure.host: Set HLDENV. + * configure.in: Substitute HLDENV. + * configure: Rebuild. + * Makefile.in (HLDENV): New variable. + ($(LD_PROG)): Use $(HLDENV). + +Thu Aug 22 11:16:02 1996 Stan Shebs + + * mpw-make.sed: Add @DASH_C_FLAG@ to compiler edit. + +Wed Aug 21 11:26:37 1996 Ian Lance Taylor + + * scripttempl/elf.sc: Put .gnu.linkonce* sections in appropriate + containing sections. + +Mon Aug 19 13:01:42 1996 Ian Lance Taylor + + * fnmatch.c: Include sysdep.h. + +Mon Aug 19 11:28:29 1996 Michael Meissner + + * genscripts.sh: Undo 8/16 change. + + * emulparams/d10velf.sh (MACHINE): Explicitly set to nothing. + +Fri Aug 16 19:18:08 1996 Michael Meissner + + * genscripts.sh: Explicitly reset any shell variables set or used + by the various .sc scripts to allow inadvertant use of these + names as normal environment variables by the person running + configure. + + * Makefile.in (ed10velf.c): Use tdir_d10v, not tdir_arcelf. + +Fri Aug 16 14:15:41 1996 James G. Smith + + * scripttempl/armcoff.sc (__bss_start__, __bss_end__, + __data_start__, __data_end__): Added to keep in sync. with the + default ARM crt0.s. Added __CTOR_LIST__ and __DTOR_LIST__ support. + +Thu Aug 8 14:24:56 1996 Ian Lance Taylor + + * ldcref.c (check_reloc_refs): If info->same, look for any symbol + defined in info->defsec, not just the section symbol. + +Wed Aug 7 14:40:48 1996 Philippe De Muyter + + * configure.in: Call BFD_NEED_DECLARATION on strstr and sbrk. + * acconfig.h (NEED_DECLARATION_STRSTR): New macro. + (NEED_DECLARATION_SBRK): New macro. + * configure, config.in: Rebuild. + * sysdep.h (strstr): Declare if NEED_DECLARATION_STRSTR. + * ldmain.c (sbrk): Declare if HAVE_SBRK and + NEED_DECLARATION_SBRK. + + * ldlang.c (lang_record_phdrs): Cast xmalloc and xrealloc return. + +Mon Aug 5 16:26:14 1996 Ian Lance Taylor + + * ldlex.l: Recognize OVERLAY. + * ldgram.y: Add section_phdr field to %union. + (section): Handle phdr_opt result. Add OVERLAY case. + (opt_exp_without_type): New nonterminal. + (phdr_opt): Return list of phdrs. + (overlay_section): New nonterminal. + * ldlang.c: Include . + (lang_leave_output_section_statement): Add phdrs parameter. + Change all callers. + (lang_section_in_phdr): Remove. + (overlay_vma, overlay_lmn, overlay_max): New static variables. + (struct overlay_list): Define. + (overlay_list): New static variable. + (lang_enter_overlay, lang_enter_overlay_section): New functions. + (lang_leave_overlay_section, lang_leave_overlay): New functions. + * ldlang.h (lang_leave_output_section_statement): Update + declaration for new parameter. + (lang_section_in_phdr): Don't declare. + (lang_enter_overlay, lang_enter_overlay_section): Declare. + (lang_leave_overlay_section, lang_leave_overlay): Declare. + * ld.texinfo (Overlays): New node under SECTIONS, documenting + overlays. + + * ldlex.l: Recognize MAX and MIN. + * ldgram.y (MAX, MIN): New terminals. + (exp): Recognize MAX and MIN. + * ldexp.c (fold_binary): Handle MAX and MIN. + * ld.texinfo (Arithmetic Functions): Document MAX and MIN. + + * ld.texinfo (PHDRS): Use @cindex, not @kindex, for program header + index entries. + + * ldgram.y (SIZEOF, ADDR): Do not specify type. + + * ldcref.c (check_nocrossref): Skip symbols with no output + sections. + +Fri Aug 2 14:57:49 1996 Ian Lance Taylor + + * ldgram.y (LOADADDR): New terminal. + (exp): Handle LOADADDR. + * ldlex.l: Recognize LOADADDR. + * ldexp.c (exp_print_token): Add LOADADDR. + (fold_name): Implement LOADADDR. + * ldlang.c (exp_init_os): Treat LOADADDR like ADDR. + * ld.texinfo (Arithmetic Functions): Document LOADADDR. + +Thu Aug 1 12:52:19 1996 Ian Lance Taylor + + * ld.h (check_nocrossrefs): Declare. + * ldlang.h (struct lang_nocrossref): Define. + (struct lang_nocrossrefs): Define. + (nocrossref_list): Declare. + (lang_add_nocrossref): Declare. + * ldlex.l: Recognize NOCROSSREFS keyword. + * ldgram.y (%union): Add nocrossref field. + (NOCROSSREFS): New terminal. + (ifile_p1): Recognize NOCROSSREFS. + (nocrossref_list): New nonterminal. + * ldlang.c (nocrossref_list): Define. + (lang_add_nocrossref): New function. + * ldmain.c (main): If nocrossref_list is not NULL, call + check_nocrossrefs. + (warning_callback): Free symbols if there is no place to store + them. + (notice): Call add_cref if nocrossref_list is not NULL. + * ldcref.c: Include "ldexp.h" and "ldlang.h". + (check_nocrossrefs): New function. + (check_nocrossref): New static function. + (struct check_refs_info): Define. + (check_refs, check_reloc_refs): New static functions. + * Makefile.in: Rebuild dependencies. + * ld.texinfo (Option Commands): Document NOCROSSREFS. + + * ld.texinfo (Section Placement): Improve the wording of the + wildcard documentation. Mention that wildcards are only searched + for on the command line, not in the file system. + + * emultempl/sunos.em (gld${EMULATION_NAME}_after_open): Move + definition of lib_path inside condition where it is used. + +Wed Jul 31 13:17:10 1996 Martin M. Hunt + + * emulparams/d10velf.sh: Now works with elf.sc. + +Wed Jul 31 11:52:03 1996 Martin M. Hunt + + * emulparams/d10velf.sh (SCRIPT_NAME): Change to vanilla. + +Tue Jul 30 14:46:42 1996 Ian Lance Taylor + + * ldlang.c (lang_size_sections): Add the section VMA to the result + value when computing the address of a section. + + * ld.h (args_type): Add cref field. + * lexsup.c (parse_args): Set command_line.cref. + * ldmain.c (main): Check command_line.cref rather than + link_info.notice_all. + (notice): Likewise. + + * ldcref.c (output_one_cref): Don't crash if a symbol is defined + in a section without an owner. + +Mon Jul 29 17:23:33 1996 Ian Lance Taylor + + * fnmatch.h, fnmatch.c: New files. + * ldlex.l: Remove unused definition of FILENAME. Add definition + of WILDCHAR. In SCRIPT mode, accept any sequence of WILDCHAR as a + NAME. + * ldgram.y (file_NAME_list): Accept '*' and '?' specially. + (input_section_spec): Accept '?' specially. + (statement): Change exp to mustbe_exp in length and FILL cases. + (section): Call ldlex_script before section statements, and call + ldlex_popstate after them. + * ldlang.c: Include "fnmatch.h". + (wildcardp): New static function. + (wild_section): Permit the section name to be a wildcard. + (wild_file): New static function, broken out of wild. + (wild): Call wild_file. Permit the file name to be a wildcard. + (open_input_bfds): Don't call lookup_name for a wildcard pattern. + * Makefile.in: Rebuild dependencies. + (CFILES): Add fnmatch.c. + (HFILES): Add fnmatch.h. + (OFILES): Add fnmatch.o. + * ld.texinfo: Document that file and section names can now be + wildcard patterns. + + * ldlang.c (lang_place_orphans): Correct condition: place a common + section if not relocateable or if common definitions are forced. + +Wed Jul 24 12:16:38 1996 Martin M. Hunt + + * emulparams/d10velf.sh (SCRIPT_NAME): Change to elf. + +Wed Jul 24 13:38:22 1996 Michael Meissner + + * configure.tgt (d10v-*-*): Don't require the -elf, allow plain d10v. + +Tue Jul 23 10:36:19 1996 Martin M. Hunt + + * Makefile.in (ed10velf.c): New target. + * configure.tgt (d10v-*-elf*): New target. + * emulparams/d10velf.sh: New file. + +Thu Jul 18 16:25:39 1996 Ian Lance Taylor + + * configure.tgt (sparc*-*-sysv4*): New target. From Andrew Gierth + . + + * configure.host: Change irix5 to irix[56]*. + * configure.tgt: Likewise. + +Wed Jul 17 10:52:46 1996 Kim Knuttila + + * emultempl/pe.em (sort_sections): Pay attention to return code. + + * ldmisc.c (demangle): Remove all prefix '.'s from a name. Mon Jul 15 11:49:49 1996 Andreas Schwab @@ -8,14 +829,7 @@ the value of __start_SECNAME to the alignment required by the section to be placed. -Wed Jul 10 11:23:54 1996 David Mosberger-Tang - - * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set - local label prefix to "$" when output architecture is Alpha. - -Tue Jul 9 12:13:15 1996 Ian Lance Taylor - - * emulparams/pc532macha.sh (EMULATION_NAME): Remove. +Tue Jul 9 12:09:02 1996 Ian Lance Taylor * configure.tgt (mips*el-*-elf*): Use elf32elmip. (mips*-*-elf*): Use elf32ebmip. @@ -32,7 +846,9 @@ Thu Jul 4 12:01:03 1996 Ian Lance Taylor - * ldver.c (ldversion): Set version to 2.7. + * ldver.c (ldversion): Set version to cygnus-2.7.1. + + * Released binutils 2.7. * emulparams/pc532macha.sh: Rename from pc532machaout.sh to avoid System V file name limitations. @@ -164,6 +980,14 @@ * configure.host (m88*-*-dgux*): Quote HOSTING_CRT0. From . +Tue Jun 18 15:53:09 1996 Jeffrey A. Law + + * scripttempl/h8300s.sc: New file for H8/S. + * emulpararms/h8300s.sh: New file for H8/S. + * Makefile.in (ALL_EMULATIONS): Add H8/S. + (e_h8300s.c): Add dependencies. + * configure.tgt: Add H8/S to targ_extra_emuls. + Tue Jun 18 17:55:39 1996 Ian Lance Taylor * configure.tgt (i[345]86*-*-isc*): New target. From @@ -6168,7 +6992,7 @@ Local Variables: -mode: indented-text +mode: change-log left-margin: 8 fill-column: 74 version-control: never diff -urN binutils-2.7/ld/Makefile.in binutils-2.8/ld/Makefile.in --- binutils-2.7/ld/Makefile.in Tue Jul 9 12:07:33 1996 +++ binutils-2.8/ld/Makefile.in Wed Apr 30 13:06:19 1997 @@ -1,5 +1,5 @@ # Makefile for the GNU linker ld (version 2) -# Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996 +# Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1997 # Free Software Foundation, Inc. # This file is part of GNU ld. @@ -64,11 +64,12 @@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ HLDFLAGS = @HLDFLAGS@ +HLDENV = @HLDENV@ RPATH_ENVVAR = @RPATH_ENVVAR@ MAKEINFO = makeinfo TEXI2DVI = texi2dvi RANLIB = ranlib -BISON = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi` +BISON = bison -y LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` EMUL = @EMUL@ @@ -186,7 +187,7 @@ #.cc.o: # $(CXX) -c -I$(srcdir) $(CXXFLAGS) $(CFLAGS) $< -ALL_CFLAGS = $(INCLUDES) @HDEFINES@ $(CFLAGS) +ALL_CFLAGS = -D_GNU_SOURCE $(INCLUDES) @HDEFINES@ $(CFLAGS) .c.o: $(CC) -c $(ALL_CFLAGS) $< @@ -215,7 +216,6 @@ eelf32lmip.o \ eelf32lppc.o \ eelf32ppc.o \ - eelf64alpha.o \ eelf64_sparc.o \ eelf_i386.o \ egld960.o \ @@ -223,6 +223,7 @@ ego32.o \ eh8300.o \ eh8300h.o \ + eh8300s.o \ eh8500.o \ eh8500b.o \ eh8500c.o \ @@ -259,6 +260,7 @@ emipsidt.o \ emipsidtl.o \ emipslit.o \ + emipslnews.o \ enews.o \ ens32knbsd.o \ epc532macha.o \ @@ -268,8 +270,11 @@ eriscix.o \ esa29200.o \ esh.o \ + eshelf.o \ + eshlelf.o \ eshl.o \ esparcaout.o \ + esparclinux.o \ esparclynx.o \ esparcnbsd.o \ est2000.o \ @@ -282,6 +287,9 @@ ez8001.o \ ez8002.o +ALL_64_EMULATIONS = \ + eelf64alpha.o + CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \ ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \ mri.c ldcref.c @@ -314,7 +322,7 @@ ldgram.h: ldgram.c ldmain.o: ldmain.c config.status - $(CC) -c -DDEFAULT_EMULATION='"$(EMUL)"' -DSCRIPTDIR='"$(scriptdir)"' $(ALL_CFLAGS) $< + $(CC) -c -DDEFAULT_EMULATION='"$(EMUL)"' -DSCRIPTDIR='"$(scriptdir)"' -DTARGET='"@target@"' $(ALL_CFLAGS) $< ldemul-list.h: Makefile (echo "/* This file is automatically generated. DO NOT EDIT! */";\ @@ -332,7 +340,7 @@ mv ldemul-tmp.h ldemul-list.h ldlex.c: ldlex.l - $(LEX) -I -Cem $(srcdir)/ldlex.l + $(LEX) $(srcdir)/ldlex.l -sed -e '/^int.*free();/d' \ -e '/^char.*malloc();/d' \ -e 's/malloc/xmalloc/g' \ @@ -373,12 +381,18 @@ ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS} ${GENSCRIPTS} coff_sparc "$(tdir_coff_sparc)" +ed10velf.c: $(srcdir)/emulparams/d10velf.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elfd10v.sc ${GEN_DEPENDS} + ${GENSCRIPTS} d10velf "$(tdir_d10v)" edelta68.c: $(srcdir)/emulparams/delta68.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/delta68.sc ${GEN_DEPENDS} ${GENSCRIPTS} delta68 "$(tdir_delta68)" eebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS} ${GENSCRIPTS} ebmon29k "$(tdir_ebmon29k)" +em32relf.c: $(srcdir)/emulparams/m32relf.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} m32relf "$(tdir_m32r)" eelf32_sparc.c: $(srcdir)/emulparams/elf32_sparc.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32_sparc "$(tdir_elf32_sparc)" @@ -430,6 +444,9 @@ eh8300h.c: $(srcdir)/emulparams/h8300h.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300h.sc ${GEN_DEPENDS} ${GENSCRIPTS} h8300h "$(tdir_h8300h)" +eh8300s.c: $(srcdir)/emulparams/h8300s.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300s.sc ${GEN_DEPENDS} + ${GENSCRIPTS} h8300s "$(tdir_h8300s)" eh8500.c: $(srcdir)/emulparams/h8500.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500.sc ${GEN_DEPENDS} ${GENSCRIPTS} h8500 "$(tdir_h8500)" @@ -521,7 +538,7 @@ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/psos.sc ${GEN_DEPENDS} ${GENSCRIPTS} m68kpsos "$(tdir_m68kpsos)" em88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \ - $(srcdir)/emultempl/m88kbcs.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS} + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS} ${GENSCRIPTS} m88kbcs "$(tdir_m88kbcs)" emipsbig.c: $(srcdir)/emulparams/mipsbig.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} @@ -538,6 +555,15 @@ emipslit.c: $(srcdir)/emulparams/mipslit.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} ${GENSCRIPTS} mipslit "$(tdir_mipslit)" +emipslnews.c: $(srcdir)/emulparams/mipslnews.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} + ${GENSCRIPTS} mipslnews +emn10300.c: $(srcdir)/emulparams/mn10300.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} mn10300 "$(tdir_mn10300)" +emn10200.c: $(srcdir)/emulparams/mn10200.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} mn10200 "$(tdir_mn10200)" enews.c: $(srcdir)/emulparams/news.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} news "$(tdir_news)" @@ -565,12 +591,21 @@ esh.c: $(srcdir)/emulparams/sh.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} ${GENSCRIPTS} sh "$(tdir_sh)" +eshelf.c: $(srcdir)/emulparams/shelf.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} shelf "$(tdir_shelf)" +eshlelf.c: $(srcdir)/emulparams/shlelf.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} shlelf "$(tdir_shlelf)" eshl.c: $(srcdir)/emulparams/shl.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} ${GENSCRIPTS} shl "$(tdir_shl)" esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} sparcaout "$(tdir_sparcaout)" +esparclinux.c: $(srcdir)/emulparams/sparclinux.sh \ + $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} + ${GENSCRIPTS} sparclinux "$(tdir_sparclinux)" esparclynx.c: $(srcdir)/emulparams/sparclynx.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparclynx.sc ${GEN_DEPENDS} ${GENSCRIPTS} sparclynx "$(tdir_sparclynx)" @@ -606,7 +641,7 @@ ${GENSCRIPTS} z8002 "$(tdir_z8002)" $(LD_PROG): $(OFILES) $(BFDDEP) $(LIBIBERTY) - $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(EXTRALIBS) + $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(EXTRALIBS) # The generated emulation files mostly have the same dependencies. $(EMULATION_OFILES): ../bfd/bfd.h sysdep.h config.h $(INCDIR)/bfdlink.h \ @@ -736,14 +771,15 @@ # TeX output dvi: ld.dvi ld.dvi: $(srcdir)/ld.texinfo configdoc.texi $(BFDDIR)/doc/bfdsumm.texi - TEXINPUTS=$(BFDDIR)/doc:$$TEXINPUTS $(TEXI2DVI) $(srcdir)/ld.texinfo + TEXINPUTS=$(BFDDIR)/doc:$$TEXINPUTS MAKEINFO='$(MAKEINFO) -I$(BFDDIR)/doc -I$(srcdir)' \ + $(TEXI2DVI) $(srcdir)/ld.texinfo ldint.dvi: $(srcdir)/ldint.texinfo $(TEXI2DVI) $(srcdir)/ldint.texinfo # info file for online browsing ld.info: $(srcdir)/ld.texinfo configdoc.texi $(BFDDIR)/doc/bfdsumm.texi - $(MAKEINFO) -I$(BFDDIR)/doc -o ld.info $(srcdir)/ld.texinfo + $(MAKEINFO) -I$(BFDDIR)/doc -I$(srcdir) -o ld.info $(srcdir)/ld.texinfo ldint.info: $(srcdir)/ldint.texinfo $(MAKEINFO) -o ldint.info $(srcdir)/ldint.texinfo @@ -866,22 +902,22 @@ diststuff: $(LDDISTSTUFF) info mostlyclean: - -rm -f $(STAGESTUFF) ld.?? ld.??? ldlex.[qp] config.log + -rm -f $(STAGESTUFF) ld.?? ld.??? ldlex.[qp] -rm -f ld ld1 ld2 ld3 *.o y.output cdtest cdtest.out cdtest.tmp -rm -f cdtest-ur cdtest-ur.out cdtest-ur.tmp crtbegin.o crtend.o -rm -f ldemul-list.h -rm -fr tmpdir clean: mostlyclean - -rm -f $(LD_PROG) configdoc.texi + -rm -f $(LD_PROG) distclean: clean -rm -f Makefile config.status TAGS site.exp site.bak config.cache - -rm -f config.h stamp-h + -rm -f config.h stamp-h config.log -rm -rf ldscripts maintainer-clean realclean: clean distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." -rm -f $(GENERATED_CFILES) $(GENERATED_HFILES) - -rm -f $(LDDISTSTUFF) *.info* + -rm -f $(LDDISTSTUFF) *.info* configdoc.texi .PHONY: diststuff mostlyclean clean distclean realclean @@ -982,60 +1018,57 @@ # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. ldctor.o: ldctor.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/bfdlink.h ld.h ldexp.h ldlang.h ldmisc.h \ - ldgram.h ldmain.h ldctor.h + sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ + ld.h ldexp.h ldlang.h ldmisc.h ldgram.h ldmain.h ldctor.h ldemul.o: ldemul.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - ld.h ldemul.h ldmisc.h ldexp.h ldlang.h ldfile.h ldmain.h \ - ldemul-list.h + sysdep.h config.h $(INCDIR)/fopen-same.h ld.h ldemul.h \ + ldmisc.h ldexp.h ldlang.h ldfile.h ldmain.h ldemul-list.h ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/bfdlink.h ld.h ldmain.h ldmisc.h ldexp.h \ - ldgram.h ldlang.h + sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ + ld.h ldmain.h ldmisc.h ldexp.h ldgram.h ldlang.h ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/bfdlink.h ld.h ldmisc.h ldexp.h ldlang.h \ - ldfile.h ldmain.h ldgram.h ldlex.h ldemul.h + sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ + ld.h ldmisc.h ldexp.h ldlang.h ldfile.h ldmain.h ldgram.h \ + ldlex.h ldemul.h ldlang.o: ldlang.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h $(INCDIR)/bfdlink.h ld.h ldmain.h \ + sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + $(INCDIR)/obstack.h $(INCDIR)/bfdlink.h ld.h ldmain.h \ ldgram.h ldexp.h ldlang.h ldemul.h ldlex.h ldmisc.h \ - ldctor.h ldfile.h + ldctor.h ldfile.h $(INCDIR)/fnmatch.h ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h $(INCDIR)/progress.h $(INCDIR)/bfdlink.h \ - ld.h ldmain.h ldmisc.h ldwrite.h ldgram.h ldexp.h ldlang.h \ - ldemul.h ldlex.h ldfile.h ldctor.h + sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + $(INCDIR)/progress.h $(INCDIR)/bfdlink.h ld.h ldmain.h \ + ldmisc.h ldwrite.h ldgram.h ldexp.h ldlang.h ldemul.h \ + ldlex.h ldfile.h ldctor.h ldmisc.o: ldmisc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h $(INCDIR)/demangle.h ld.h ldmisc.h \ - ldexp.h ldlang.h ldgram.h ldlex.h ldmain.h ldfile.h + sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h ld.h ldmisc.h ldexp.h ldlang.h \ + ldgram.h ldlex.h ldmain.h ldfile.h ldver.o: ldver.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - ld.h ldver.h ldemul.h ldmain.h + sysdep.h config.h $(INCDIR)/fopen-same.h ld.h ldver.h \ + ldemul.h ldmain.h ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h ld.h ldexp.h \ - ldlang.h ldwrite.h ldmisc.h ldgram.h ldmain.h + sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/libiberty.h ld.h ldexp.h ldlang.h ldwrite.h \ + ldmisc.h ldgram.h ldmain.h lexsup.o: lexsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ $(INCDIR)/getopt.h $(INCDIR)/bfdlink.h ld.h ldmain.h \ ldmisc.h ldexp.h ldlang.h ldgram.h ldlex.h ldfile.h \ ldver.h ldemul.h -mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h ld.h ldexp.h \ - ldlang.h ldmisc.h mri.h ldgram.h +mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h sysdep.h \ + config.h $(INCDIR)/fopen-same.h ld.h ldexp.h ldlang.h \ + ldmisc.h mri.h ldgram.h $(INCDIR)/libiberty.h ldcref.o: ldcref.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h ld.h ldmain.h \ - ldmisc.h + sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/libiberty.h ld.h ldmain.h ldmisc.h ldexp.h \ + ldlang.h ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/bfdlink.h ld.h ldexp.h ldver.h ldlang.h ldemul.h \ - ldfile.h ldmisc.h ldmain.h mri.h ldlex.h -ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/obstack.h sysdep.h \ - config.h $(INCDIR)/fopen-same.h ld.h ldgram.h ldmisc.h \ - ldexp.h ldlang.h ldfile.h ldlex.h ldmain.h + sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ + ld.h ldexp.h ldver.h ldlang.h ldemul.h ldfile.h ldmisc.h \ + ldmain.h mri.h ldlex.h +ldlex.o: ldlex.c ../bfd/bfd.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + ld.h ldgram.h ldmisc.h ldexp.h ldlang.h ldfile.h ldlex.h \ + ldmain.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff -urN binutils-2.7/ld/NEWS binutils-2.8/ld/NEWS --- binutils-2.7/ld/NEWS Thu Jul 4 12:24:19 1996 +++ binutils-2.8/ld/NEWS Wed Apr 30 12:57:45 1997 @@ -1,6 +1,26 @@ -*- text -*- -Changes since version 2.6: +Changes in version 2.8: + +* Linker scripts may now contain shell wildcard characters for file and section + names. + +* The linker now supports symbol versions in ELF. + +* The NOCROSSREFS command was added to the linker script language. + +* The LOADADDR expression was added to the linker script language. + +* MAX and MIN functions were added to the linker script language. + +* The OVERLAY construct was added to the linker script language. + +* New option --warn-section-align to warn when the address of an output section + changes due to alignment of an input section. + +* New options --filter/-F and --auxiliary/-f. + +Changes in version 2.7: * New option --cref to print out a cross reference table. @@ -15,7 +35,7 @@ the N_BINCL and N_EINCL stab types. This reduces the amount of debugging information generated. -Changes since version 2.5: +Changes in version 2.6: * When an ELF section name is representable as a C identifier (this is not true of most ELF section names), the linker will automatically define symbols @@ -48,7 +68,7 @@ only be defined once in the output file. The --traditional-format switch will prevent this optimization. -Changes since version 2.4: +Changes in version 2.5: * The linker now supports linking against SunOS shared libraries. It still can not link SunOS PIC (Position Independent Code) files, so it can not be used to @@ -87,7 +107,7 @@ * The -V flag was made a synonym for -v, for SVR4 compatibility. The old -V behaviour is available via --verbose. -Changes since version 2.3: +Changes in version 2.4: * New linker code, by Steve Chamberlain and Ian Taylor. For a.out and ecoff formats (so far), this should result in considerable savings in time @@ -111,7 +131,7 @@ forgot to note it.) Some of their C library routines don't work when statically linked, and the GNU linker doesn't support dynamic linking yet. -Changes since version 2.2: +Changes in version 2.3: * Weak symbols are now supported. @@ -120,14 +140,14 @@ * Alpha OSF/1 support has been added (non dynamic linking only). -Changes since version 2.1: +Changes in version 2.2: * The `bfd' library has been updated to reduce a.out-format string table size. The effect of this is that files linked from many input files with duplicate symbols (`-g' debugging records, or identical static symbols) should be much smaller. -Changes since version 2.0: +Changes in version 2.1: * The ld -ySYMBOL flag (to trace references to SYMBOL) is now implemented. diff -urN binutils-2.7/ld/README binutils-2.8/ld/README --- binutils-2.7/ld/README Thu Jul 4 12:24:19 1996 +++ binutils-2.8/ld/README Wed Apr 30 12:57:45 1997 @@ -34,7 +34,7 @@ Porting to a new target ======================= -See the Porting chapter in the ldint.texinfo manual. +See the ldint.texinfo manual. Reporting bugs etc =========================== diff -urN binutils-2.7/ld/acconfig.h binutils-2.8/ld/acconfig.h --- binutils-2.7/ld/acconfig.h Thu Jul 4 12:24:19 1996 +++ binutils-2.8/ld/acconfig.h Wed Apr 30 12:57:45 1997 @@ -1,6 +1,15 @@ +/* Whether strstr must be declared even if is included. */ +#undef NEED_DECLARATION_STRSTR + /* Whether free must be declared even if is included. */ #undef NEED_DECLARATION_FREE + +/* Whether sbrk must be declared even if is included. */ +#undef NEED_DECLARATION_SBRK + +/* Whether getenv must be declared even if is included. */ +#undef NEED_DECLARATION_GETENV @TOP@ /* Do we need to use the b modifier when opening binary files? */ diff -urN binutils-2.7/ld/config.in binutils-2.8/ld/config.in --- binutils-2.7/ld/config.in Thu Jul 4 12:24:20 1996 +++ binutils-2.8/ld/config.in Wed Apr 30 12:57:45 1997 @@ -1,7 +1,16 @@ /* config.in. Generated automatically from configure.in by autoheader. */ +/* Whether strstr must be declared even if is included. */ +#undef NEED_DECLARATION_STRSTR + /* Whether free must be declared even if is included. */ #undef NEED_DECLARATION_FREE + +/* Whether sbrk must be declared even if is included. */ +#undef NEED_DECLARATION_SBRK + +/* Whether getenv must be declared even if is included. */ +#undef NEED_DECLARATION_GETENV /* Do we need to use the b modifier when opening binary files? */ #undef USE_BINARY_FOPEN diff -urN binutils-2.7/ld/configdoc.texi binutils-2.8/ld/configdoc.texi --- binutils-2.7/ld/configdoc.texi Wed Dec 31 19:00:00 1969 +++ binutils-2.8/ld/configdoc.texi Wed Apr 30 13:15:16 1997 @@ -0,0 +1,13 @@ +@c ------------------------------ CONFIGURATION VARS: +@c 1. Inclusiveness of this manual +@set GENERIC + +@c 2. Specific target machines +@set H8300 +@set I960 + +@c 3. Properties of this configuration +@clear SingleFormat +@set UsesEnvVars +@c ------------------------------ end CONFIGURATION VARS + diff -urN binutils-2.7/ld/configure binutils-2.8/ld/configure --- binutils-2.7/ld/configure Thu Jul 4 12:24:21 1996 +++ binutils-2.8/ld/configure Wed Apr 30 12:57:46 1997 @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.10 +# Generated automatically using autoconf version 2.12 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -15,6 +15,8 @@ --enable-targets alternative target configurations" ac_help="$ac_help --enable-shared build shared BFD library" +ac_help="$ac_help + --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -53,6 +55,8 @@ # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 ac_prev= for ac_option @@ -334,7 +338,7 @@ verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.10" + echo "configure generated by autoconf version 2.12" exit 0 ;; -with-* | --with-*) @@ -436,11 +440,14 @@ done # NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# 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 @@ -502,6 +509,7 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. @@ -537,6 +545,17 @@ *) shared=false ;; esac fi +# Check whether --enable-64-bit-bfd or --disable-64-bit-bfd was given. +if test "${enable_64_bit_bfd+set}" = set; then + enableval="$enable_64_bit_bfd" + case "${enableval}" in + yes) want64=true ;; + no) want64=false ;; + *) { echo "configure: error: bad value ${enableval} for 64-bit-bfd option" 1>&2; exit 1; } ;; +esac +else + want64=false +fi @@ -587,6 +606,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:610: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -601,12 +621,13 @@ esac host=`$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/'` +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:631: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -618,12 +639,13 @@ esac target=`$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/'` +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:649: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -635,9 +657,9 @@ esac build=`$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/'` +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" && @@ -676,6 +698,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:702: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -704,6 +727,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:731: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -750,7 +774,47 @@ 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:779: 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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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* + +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:813: 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:818: 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 @@ -759,7 +823,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:763: \"$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:827: \"$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 @@ -767,29 +831,34 @@ fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + if test $ac_cv_prog_gcc = yes; then GCC=yes - if test "${CFLAGS+set}" != set; then - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + 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:842: 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_gcc_g=yes + ac_cv_prog_cc_g=yes else - ac_cv_prog_gcc_g=no + ac_cv_prog_cc_g=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 - if test $ac_cv_prog_gcc_g = yes; then - CFLAGS="-g -O" - else - CFLAGS="-O" - 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 + CFLAGS="-g -O2" + else + CFLAGS="-O2" fi else GCC= @@ -807,11 +876,12 @@ # 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:880: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in @@ -834,7 +904,7 @@ ;; esac done - IFS="$ac_save_ifs" + IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then @@ -865,6 +935,7 @@ + # For most hosts we can use a simple definition to pick up the BFD and # opcodes libraries. However, if we are building shared libraries, we # need to handle some hosts specially. @@ -893,6 +964,7 @@ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:968: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -907,33 +979,37 @@ # 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:917: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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:932: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1006: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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 @@ -950,24 +1026,27 @@ for ac_hdr in string.h strings.h stdlib.h unistd.h do -ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1032: 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:965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1042: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` 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 @@ -975,7 +1054,7 @@ 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 | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 +echo "configure:1071: 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; }; then +if { (eval echo configure:1099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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'` @@ -1041,34 +1122,35 @@ ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do -ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 +echo "configure:1128: 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> -int main() { return 0; } -int t() { +int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdedfghijklmnopqrstuvwxyz./\055' 'ABCDEDFGHIJKLMNOPQRSTUVWXYZ___'` + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 -ac_lib_var=`echo dir'_'opendir | tr './+\055' '__p_'` +echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 +echo "configure:1166: 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 else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 @@ -1118,30 +1202,32 @@ fi else -echo $ac_n "checking for -lx""... $ac_c" 1>&6 -ac_lib_var=`echo x'_'opendir | tr './+\055' '__p_'` +echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 +echo "configure:1207: 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 else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 @@ -1161,42 +1247,98 @@ case "${host}" in -i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32) +i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32 | *-*-windows) cat >> confdefs.h <<\EOF #define USE_BINARY_FOPEN 1 EOF ;; esac +echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 +echo "configure:1259: 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 < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { +char *(*pfn) = (char *(*)) strstr +; return 0; } +EOF +if { (eval echo configure:1285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_strstr=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_decl_needed_strstr=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$bfd_cv_decl_needed_strstr" 1>&6 +if test $bfd_cv_decl_needed_strstr = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo strstr | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +echo "configure:1307: 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 < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif -int main() { return 0; } -int t() { +int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:1192: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1333: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* bfd_cv_decl_needed_free=yes fi rm -f conftest* - fi echo "$ac_t""$bfd_cv_decl_needed_free" 1>&6 @@ -1208,6 +1350,102 @@ fi +echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6 +echo "configure:1355: checking whether sbrk must be declared" >&5 +if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { +char *(*pfn) = (char *(*)) sbrk +; return 0; } +EOF +if { (eval echo configure:1381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_sbrk=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_decl_needed_sbrk=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$bfd_cv_decl_needed_sbrk" 1>&6 +if test $bfd_cv_decl_needed_sbrk = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo sbrk | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +echo "configure:1403: 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 < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { +char *(*pfn) = (char *(*)) getenv +; return 0; } +EOF +if { (eval echo configure:1429: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_getenv=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_decl_needed_getenv=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$bfd_cv_decl_needed_getenv" 1>&6 +if test $bfd_cv_decl_needed_getenv = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo getenv | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h </dev/null` + result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null` if test -n "$result"; then targ=$result else @@ -1254,7 +1492,11 @@ if test x${all_targets} = xtrue; then - EMULATION_OFILES='$(ALL_EMULATIONS)' + if test x${want64} = xtrue; then + EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' + else + EMULATION_OFILES='$(ALL_EMULATIONS)' + fi else EMULATION_OFILES=$all_emuls fi @@ -1277,11 +1519,25 @@ # --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 | - sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ - >> confcache + case `(ac_space=' '; set) 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 @@ -1336,7 +1592,7 @@ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.10" + echo "$CONFIG_STATUS generated by autoconf version 2.12" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1396,6 +1652,7 @@ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@HLDFLAGS@%$HLDFLAGS%g +s%@HLDENV@%$HLDENV%g s%@RPATH_ENVVAR@%$RPATH_ENVVAR%g s%@HDEFINES@%$HDEFINES%g s%@HOSTING_CRT0@%$HOSTING_CRT0%g @@ -1409,20 +1666,56 @@ 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]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac - # Adjust relative srcdir, etc. for subdirectories. + # 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%/[^/][^/]*$%%'` @@ -1450,6 +1743,7 @@ [/$]*) 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." @@ -1458,14 +1752,16 @@ # $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 -" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done -rm -f conftest.subs +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. @@ -1486,11 +1782,17 @@ ac_eC=' ' ac_eD='%g' -CONFIG_HEADERS=${CONFIG_HEADERS-"config.h:config.in"} +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]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac @@ -1498,7 +1800,8 @@ echo creating $ac_file rm -f conftest.frag conftest.in conftest.out - cp $ac_given_srcdir/$ac_file_in conftest.in + 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 @@ -1526,8 +1829,6 @@ # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. -# Maximum number of lines to put in a single here document. -ac_max_here_lines=12 rm -f conftest.tail while : @@ -1569,7 +1870,11 @@ fi fi; done +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac exit 0 EOF diff -urN binutils-2.7/ld/configure.host binutils-2.8/ld/configure.host --- binutils-2.7/ld/configure.host Thu Jul 4 12:24:22 1996 +++ binutils-2.8/ld/configure.host Wed Apr 30 12:57:46 1997 @@ -9,6 +9,7 @@ # HOSTING_LIBS libraries used for bootstrapping # NATIVE_LIB_DIRS library directories to search on this host # HLDFLAGS link flags to use on this host +# HLDENV environment variable to set when linking for the host # RPATH_ENVVAR environment variable used to find shared libraries HDEFINES= @@ -27,7 +28,7 @@ NATIVE_LIB_DIRS=/usr/ccs/lib ;; -i[345]86-*-bsd* | i[345]86-*-freebsd* | i[345]86-*-netbsd*) +i[3456]86-*-bsd* | i[3456]86-*-freebsd* | i[3456]86-*-netbsd*) # The new BSD `make' has a bug: it doesn't pass empty arguments in # shell commands. So we need to make this value non-empty in order # for the genscripts.sh call to work. There's nothing magic about @@ -36,29 +37,29 @@ HOSTING_CRT0=/usr/lib/crt0.o ;; -i[345]86-*-sysv4*) +i[3456]86-*-sysv4*) HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`' HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o' NATIVE_LIB_DIRS=/usr/ccs/lib ;; -i[345]86-sequent-ptx* | i[345]86-sequent-sysv*) +i[3456]86-sequent-ptx* | i[3456]86-sequent-sysv*) HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`' HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi`' ;; -i[345]86-*-sysv*) +i[3456]86-*-sysv*) HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; fi`' HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o' ;; -i[345]86-*-solaris*) +i[3456]86-*-solaris*) HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else gcc -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else gcc -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`' HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else gcc -print-file-name=crtn.o; fi`' NATIVE_LIB_DIRS=/usr/ccs/lib ;; -i[345]86-*-sco* | i[345]86-*-isc*) +i[3456]86-*-sco* | i[3456]86-*-isc*) # In some configurations gcc does not use crtbegin.o and crtend.o. # In that case gcc -print-file-name=crtbegin.o will simply print # crtbegin.o. We create dummy crtbegin.o and crtend.o files to @@ -73,16 +74,16 @@ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` /lib/crtn.o' ;; -i[345]86-*-linuxaout* | i[345]86-*-linuxoldld) +i[3456]86-*-linuxaout* | i[3456]86-*-linuxoldld) HOSTING_CRT0=/usr/lib/crt0.o ;; -i[345]86-*-linux*) +i[3456]86-*-linux*) HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`' HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else gcc --print-file-name=crtend.o; fi` /usr/lib/crtn.o' ;; -i[345]86-*-lynxos*) +i[3456]86-*-lynxos*) HOSTING_CRT0=/lib/init1.o HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc -lm /lib/initn.o' ;; @@ -96,7 +97,7 @@ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o' ;; -mips*-sgi-irix5*) +mips*-sgi-irix[56]*) HOSTING_CRT0=/usr/lib/crt1.o HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o' ;; @@ -148,6 +149,7 @@ esac HLDFLAGS= +HLDENV= RPATH_ENVVAR=LD_LIBRARY_PATH # If we have shared libraries, try to set rpath reasonably. if test "${shared}" = "true"; then @@ -156,7 +158,7 @@ HLDFLAGS='-Wl,+s,+b,$(libdir)' RPATH_ENVVAR=SHLIB_PATH ;; - *-*-irix5*) + *-*-irix[56]*) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; *-*-linux*aout*) @@ -164,8 +166,11 @@ *-*-linux*) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; - *-*-sysv4* | *-*-solaris*) + *-*-solaris*) HLDFLAGS='-R $(libdir)' + ;; + *-*-sysv4*) + HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;' ;; esac fi diff -urN binutils-2.7/ld/configure.in binutils-2.8/ld/configure.in --- binutils-2.7/ld/configure.in Thu Jul 4 12:24:23 1996 +++ binutils-2.8/ld/configure.in Wed Apr 30 12:57:46 1997 @@ -19,6 +19,13 @@ *bfd*) shared=true ;; *) shared=false ;; esac])dnl +AC_ARG_ENABLE(64-bit-bfd, +[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)], +[case "${enableval}" in + yes) want64=true ;; + no) want64=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; +esac],[want64=false])dnl AC_CONFIG_HEADER(config.h:config.in) @@ -40,6 +47,7 @@ . ${srcdir}/configure.host AC_SUBST(HLDFLAGS) +AC_SUBST(HLDENV) AC_SUBST(RPATH_ENVVAR) AC_SUBST(HDEFINES) AC_SUBST(HOSTING_CRT0) @@ -79,7 +87,10 @@ BFD_BINARY_FOPEN +BFD_NEED_DECLARATION(strstr) BFD_NEED_DECLARATION(free) +BFD_NEED_DECLARATION(sbrk) +BFD_NEED_DECLARATION(getenv) # target-specific stuff: @@ -94,7 +105,7 @@ all_targets=true else # Canonicalize the secondary target names. - result=`$ac_config_sub $targ_alias 2>/dev/null` + result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null` if test -n "$result"; then targ=$result else @@ -125,8 +136,15 @@ AC_SUBST(EMUL) AC_SUBST(TDIRS) +dnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit +dnl target, and in those cases we should also build the 64 bit +dnl emulations. if test x${all_targets} = xtrue; then - EMULATION_OFILES='$(ALL_EMULATIONS)' + if test x${want64} = xtrue; then + EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' + else + EMULATION_OFILES='$(ALL_EMULATIONS)' + fi else EMULATION_OFILES=$all_emuls fi diff -urN binutils-2.7/ld/configure.tgt binutils-2.8/ld/configure.tgt --- binutils-2.7/ld/configure.tgt Tue Jul 9 12:07:33 1996 +++ binutils-2.8/ld/configure.tgt Wed Apr 30 12:57:47 1997 @@ -12,6 +12,7 @@ case "${targ}" in arm-*-pe) targ_emul=armpe ;; +d10v-*-*) targ_emul=d10velf ;; sparc64-*-aout*) targ_emul=sparcaout ;; sparc64-*-elf*) targ_emul=elf64_sparc ;; sparc-sun-sunos4*) targ_emul=sun4 ;; @@ -20,6 +21,17 @@ sparc*-*-aout) targ_emul=sparcaout ;; sparc*-*-coff) targ_emul=coff_sparc ;; sparc*-*-elf) targ_emul=elf32_sparc ;; +sparc*-*-sysv4*) targ_emul=elf32_sparc ;; +sparc*-*-linuxaout*) targ_emul=sparclinux + targ_extra_emuls="elf32_sparc sun4" + tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'` + tdir_sun4=sparc-sun-sunos4 + ;; +sparc*-*-linux*) targ_emul=elf32_sparc + targ_extra_emuls="sparclinux sun4" + tdir_sparclinux=${targ_alias}aout + tdir_sun4=sparc-sun-sunos4 + ;; sparc*-*-lynxos*) targ_emul=sparclynx ;; sparc*-*-netbsd*) targ_emul=sparcnbsd ;; sparc*-*-solaris2*) targ_emul=elf32_sparc ;; @@ -31,48 +43,49 @@ i960-*-coff) targ_emul=gld960coff ;; i960-intel-nindy) targ_emul=gld960 ;; i960-*-rtems*) targ_emul=gld960coff ;; +m32r-*-*) targ_emul=m32relf ;; m68*-sun-sunos[34]*) targ_emul=sun3 ;; m68*-wrs-vxworks*) targ_emul=sun3 ;; m68*-ericsson-ose) targ_emul=sun3 ;; m68*-apple-aux*) targ_emul=m68kaux ;; *-tandem-none) targ_emul=st2000 ;; -i[345]86-*-vsta) targ_emul=vsta ;; -i[345]86-go32-rtems*) targ_emul=i386go32 ;; -i[345]86-*-go32) targ_emul=i386go32 ;; -i[345]86-*-aix*) targ_emul=i386coff ;; -i[345]86-*-sco*) targ_emul=i386coff ;; -i[345]86-*-isc*) targ_emul=i386coff ;; -i[345]86-*-lynxos*) targ_emul=i386lynx ;; -i[345]86-*-coff) targ_emul=i386coff ;; -i[345]86-*-rtems*) targ_emul=i386coff ;; -i[345]86-*-bsd) targ_emul=i386bsd ;; -i[345]86-*-bsd386) targ_emul=i386bsd ;; -i[345]86-*-bsdi*) targ_emul=i386bsd ;; -i[345]86-*-aout) targ_emul=i386aout ;; -i[345]86-*-linuxaout*) targ_emul=i386linux +i[3456]86-*-vsta) targ_emul=vsta ;; +i[3456]86-go32-rtems*) targ_emul=i386go32 ;; +i[3456]86-*-go32) targ_emul=i386go32 ;; +i[3456]86-*-aix*) targ_emul=i386coff ;; +i[3456]86-*-sco*) targ_emul=i386coff ;; +i[3456]86-*-isc*) targ_emul=i386coff ;; +i[3456]86-*-lynxos*) targ_emul=i386lynx ;; +i[3456]86-*-coff) targ_emul=i386coff ;; +i[3456]86-*-rtems*) targ_emul=i386coff ;; +i[3456]86-*-bsd) targ_emul=i386bsd ;; +i[3456]86-*-bsd386) targ_emul=i386bsd ;; +i[3456]86-*-bsdi*) targ_emul=i386bsd ;; +i[3456]86-*-aout) targ_emul=i386aout ;; +i[3456]86-*-linuxaout*) targ_emul=i386linux targ_extra_emuls=elf_i386 tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'` ;; -i[345]86-*-linuxoldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;; -i[345]86-*-linux*) targ_emul=elf_i386 +i[3456]86-*-linuxoldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;; +i[3456]86-*-linux*) targ_emul=elf_i386 targ_extra_emuls=i386linux tdir_i386linux=${targ_alias}aout ;; -i[345]86-*-sysv4*) targ_emul=elf_i386 ;; -i[345]86-*-unixware) targ_emul=elf_i386 ;; -i[345]86-*-netbsd*) targ_emul=i386nbsd ;; -i[345]86-*-netware) targ_emul=i386nw ;; -i[345]86-*-elf*) targ_emul=elf_i386 ;; -i[345]86-*-freebsdelf*) targ_emul=elf_i386 ;; -i[345]86-*-sysv*) targ_emul=i386coff ;; -i[345]86-*-ptx*) targ_emul=i386coff ;; -i[345]86-*-mach*) targ_emul=i386mach ;; -i[345]86-*-gnu*) targ_emul=elf_i386; targ_extra_emuls=i386mach ;; -i[345]86-*-msdos*) targ_emul=i386msdos; targ_extra_emuls=i386aout ;; -i[345]86-*-moss*) targ_emul=i386moss; targ_extra_emuls=i386msdos ;; -i[345]86-*-winnt) targ_emul=i386pe ;; -i[345]86-*-pe) targ_emul=i386pe ;; -i[345]86-*-cygwin32) targ_emul=i386pe ;; +i[3456]86-*-sysv4*) targ_emul=elf_i386 ;; +i[3456]86-*-unixware) targ_emul=elf_i386 ;; +i[3456]86-*-netbsd*) targ_emul=i386nbsd ;; +i[3456]86-*-netware) targ_emul=i386nw ;; +i[3456]86-*-elf*) targ_emul=elf_i386 ;; +i[3456]86-*-freebsdelf*) targ_emul=elf_i386 ;; +i[3456]86-*-sysv*) targ_emul=i386coff ;; +i[3456]86-*-ptx*) targ_emul=i386coff ;; +i[3456]86-*-mach*) targ_emul=i386mach ;; +i[3456]86-*-gnu*) targ_emul=elf_i386; targ_extra_emuls=i386mach ;; +i[3456]86-*-msdos*) targ_emul=i386msdos; targ_extra_emuls=i386aout ;; +i[3456]86-*-moss*) targ_emul=i386moss; targ_extra_emuls=i386msdos ;; +i[3456]86-*-winnt) targ_emul=i386pe ;; +i[3456]86-*-pe) targ_emul=i386pe ;; +i[3456]86-*-cygwin32) targ_emul=i386pe ;; m8*-*-*) targ_emul=m88kbcs ;; a29k-*-udi) targ_emul=sa29200 ;; a29k-*-ebmon) targ_emul=ebmon29k ;; @@ -81,11 +94,14 @@ arm-*-aout | armel-*-aout) targ_emul=armaoutl ;; armeb-*-aout) targ_emul=armaoutb ;; arm-*-coff) targ_emul=armcoff ;; -h8300-*-hms) targ_emul=h8300; targ_extra_emuls="h8300h" +h8300-*-hms) targ_emul=h8300; targ_extra_emuls="h8300h h8300s" ;; h8500-*-hms) targ_emul=h8500 targ_extra_emuls="h8500s h8500b h8500m h8500c" ;; +sh-*-elf*) targ_emul=shelf + targ_extra_emuls="shlelf sh shl" + ;; sh-*-*) targ_emul=sh; targ_extra_emuls=shl ;; m68k-sony-*) targ_emul=news ;; m68k-hp-bsd*) targ_emul=hp300bsd ;; @@ -109,10 +125,11 @@ m68*-*-rtems*) targ_emul=m68kcoff ;; hppa*-*-*elf*) targ_emul=hppaelf ;; hppa*-*-lites*) targ_emul=hppaelf ;; +hppa*-*-rtems*) targ_emul=hppaelf ;; vax-dec-ultrix* | vax-dec-bsd*) targ_emul=vax ;; mips*-dec-ultrix*) targ_emul=mipslit ;; mips*-dec-osf*) targ_emul=mipslit ;; -mips*-sgi-irix5*) targ_emul=elf32bmip ;; +mips*-sgi-irix[56]*) targ_emul=elf32bmip ;; mips*-sgi-irix*) targ_emul=mipsbig ;; mips*el-*-ecoff*) targ_emul=mipsidtl ;; mips*-*-ecoff*) targ_emul=mipsidt ;; @@ -123,8 +140,20 @@ mips*vr4300-*-elf*) targ_emul=elf32b4300 ;; mips*vr4100el-*-elf*) targ_emul=elf32l4300 ;; mips*vr4100-*-elf*) targ_emul=elf32b4300 ;; +mips*vr5000el-*-elf*) targ_emul=elf32l4300 ;; +mips*vr5000-*-elf*) targ_emul=elf32b4300 ;; mips*el-*-elf*) targ_emul=elf32elmip ;; mips*-*-elf*) targ_emul=elf32ebmip ;; +mips*-*-rtems*) targ_emul=elf32ebmip ;; +mips*el-*-linux*) targ_emul=elf32lmip + targ_extra_emuls="elf32bmip mipslit mipsbig" + ;; +mips*-*-linux*) targ_emul=elf32bmip + targ_extra_emuls="elf32lmip mipsbig mipslit" + ;; +mips*-*-lnews*) targ_emul=mipslnews ;; +mn10200-*-*) targ_emul=mn10200 ;; +mn10300-*-*) targ_emul=mn10300 ;; alpha-*-linuxecoff*) targ_emul=alpha targ_extra_emuls=elf64alpha tdir_elf64alpha=`echo ${targ_alias} | sed -e 's/ecoff//'` ;; @@ -132,6 +161,7 @@ tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'` ;; alpha-*-osf*) targ_emul=alpha ;; +alpha-*-gnu*) targ_emul=elf64alpha ;; alpha-*-netware*) targ_emul=alpha ;; z8k-*-coff) targ_emul=z8002; targ_extra_emuls=z8001 ;; ns32k-pc532-mach* | ns32k-pc532-ux*) targ_emul=pc532macha ;; @@ -146,6 +176,7 @@ powerpcle-*-winnt*) targ_emul=ppcpe ;; powerpcle-*-cygwin32) targ_emul=ppcpe ;; powerpc-*-aix*) targ_emul=aixppc ;; +powerpc-*-beos*) targ_emul=aixppc ;; rs6000-*-aix*) targ_emul=aixrs6 ;; w65-*-*) targ_emul=w65 ;; *-*-aout) targ_emul=${target_cpu}-${target_vendor} ;; diff -urN binutils-2.7/ld/emulparams/d10velf.sh binutils-2.8/ld/emulparams/d10velf.sh --- binutils-2.7/ld/emulparams/d10velf.sh Wed Dec 31 19:00:00 1969 +++ binutils-2.8/ld/emulparams/d10velf.sh Wed Apr 30 12:58:00 1997 @@ -0,0 +1,8 @@ +MACHINE= +SCRIPT_NAME=elfd10v +OUTPUT_FORMAT="elf32-d10v" +TEXT_START_ADDR=0x1000000 +READONLY_START_ADDR=0x2000004 +ARCH=d10v +MAXPAGESIZE=32 +EMBEDDED=t diff -urN binutils-2.7/ld/emulparams/delta68.sh binutils-2.8/ld/emulparams/delta68.sh --- binutils-2.7/ld/emulparams/delta68.sh Thu Jul 4 12:24:46 1996 +++ binutils-2.8/ld/emulparams/delta68.sh Wed Apr 30 12:58:00 1997 @@ -1,5 +1,5 @@ SCRIPT_NAME=delta68 -OUTPUT_FORMAT="coff-m68k" +OUTPUT_FORMAT="coff-m68k-sysv" TEXT_START_ADDR=0x2000 PAGE_SIZE=0x1000000 ARCH=m68k diff -urN binutils-2.7/ld/emulparams/elf32_sparc.sh binutils-2.8/ld/emulparams/elf32_sparc.sh --- binutils-2.7/ld/emulparams/elf32_sparc.sh Thu Jul 4 12:24:46 1996 +++ binutils-2.8/ld/emulparams/elf32_sparc.sh Wed Apr 30 12:58:00 1997 @@ -4,6 +4,7 @@ MAXPAGESIZE=0x10000 NONPAGED_TEXT_START_ADDR=0x10000 ARCH=sparc +MACHINE= TEMPLATE_NAME=elf32 DATA_PLT= GENERATE_SHLIB_SCRIPT=yes diff -urN binutils-2.7/ld/emulparams/elf32b4300.sh binutils-2.8/ld/emulparams/elf32b4300.sh --- binutils-2.7/ld/emulparams/elf32b4300.sh Tue Jul 9 12:07:39 1996 +++ binutils-2.8/ld/emulparams/elf32b4300.sh Wed Apr 30 12:58:00 1997 @@ -6,8 +6,10 @@ DATA_ADDR=. MAXPAGESIZE=0x40000 OTHER_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' +OTHER_GOT_SYMBOLS=' + _gp = ALIGN(16) + 0x7ff0; +' OTHER_READWRITE_SECTIONS=' - _gp = . + 0x8000; .lit8 : { *(.lit8) } .lit4 : { *(.lit4) } ' diff -urN binutils-2.7/ld/emulparams/elf32bmip.sh binutils-2.8/ld/emulparams/elf32bmip.sh --- binutils-2.7/ld/emulparams/elf32bmip.sh Tue Jul 9 12:07:39 1996 +++ binutils-2.8/ld/emulparams/elf32bmip.sh Wed Apr 30 12:58:01 1997 @@ -23,5 +23,6 @@ .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } ' ARCH=mips +MACHINE= TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes diff -urN binutils-2.7/ld/emulparams/elf32ebmip.sh binutils-2.8/ld/emulparams/elf32ebmip.sh --- binutils-2.7/ld/emulparams/elf32ebmip.sh Tue Jul 9 12:07:39 1996 +++ binutils-2.8/ld/emulparams/elf32ebmip.sh Wed Apr 30 12:58:01 1997 @@ -23,6 +23,7 @@ .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } ' ARCH=mips +MACHINE= TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes EMBEDDED=yes diff -urN binutils-2.7/ld/emulparams/elf32elmip.sh binutils-2.8/ld/emulparams/elf32elmip.sh --- binutils-2.7/ld/emulparams/elf32elmip.sh Tue Jul 9 12:07:40 1996 +++ binutils-2.8/ld/emulparams/elf32elmip.sh Wed Apr 30 12:58:01 1997 @@ -23,6 +23,7 @@ .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } ' ARCH=mips +MACHINE= TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes EMBEDDED=yes diff -urN binutils-2.7/ld/emulparams/elf32l4300.sh binutils-2.8/ld/emulparams/elf32l4300.sh --- binutils-2.7/ld/emulparams/elf32l4300.sh Tue Jul 9 12:07:40 1996 +++ binutils-2.8/ld/emulparams/elf32l4300.sh Wed Apr 30 12:58:01 1997 @@ -6,8 +6,10 @@ DATA_ADDR=. MAXPAGESIZE=0x40000 OTHER_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' +OTHER_GOT_SYMBOLS=' + _gp = ALIGN(16) + 0x7ff0; +' OTHER_READWRITE_SECTIONS=' - _gp = . + 0x8000; .lit8 : { *(.lit8) } .lit4 : { *(.lit4) } ' diff -urN binutils-2.7/ld/emulparams/elf32lmip.sh binutils-2.8/ld/emulparams/elf32lmip.sh --- binutils-2.7/ld/emulparams/elf32lmip.sh Tue Jul 9 12:07:40 1996 +++ binutils-2.8/ld/emulparams/elf32lmip.sh Wed Apr 30 12:58:01 1997 @@ -23,5 +23,6 @@ .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } ' ARCH=mips +MACHINE= TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes diff -urN binutils-2.7/ld/emulparams/elf32lppc.sh binutils-2.8/ld/emulparams/elf32lppc.sh --- binutils-2.7/ld/emulparams/elf32lppc.sh Thu Jul 4 12:24:46 1996 +++ binutils-2.8/ld/emulparams/elf32lppc.sh Wed Apr 30 12:58:01 1997 @@ -5,3 +5,4 @@ TEXT_START_ADDR=0x40000 MAXPAGESIZE=0x40000 ARCH=powerpc +MACHINE= diff -urN binutils-2.7/ld/emulparams/elf32ppc.sh binutils-2.8/ld/emulparams/elf32ppc.sh --- binutils-2.7/ld/emulparams/elf32ppc.sh Thu Jul 4 12:24:47 1996 +++ binutils-2.8/ld/emulparams/elf32ppc.sh Wed Apr 30 12:58:02 1997 @@ -5,3 +5,4 @@ TEXT_START_ADDR=0x40000 MAXPAGESIZE=0x40000 ARCH=powerpc +MACHINE= diff -urN binutils-2.7/ld/emulparams/elf64_sparc.sh binutils-2.8/ld/emulparams/elf64_sparc.sh --- binutils-2.7/ld/emulparams/elf64_sparc.sh Thu Jul 4 12:24:47 1996 +++ binutils-2.8/ld/emulparams/elf64_sparc.sh Wed Apr 30 12:58:02 1997 @@ -4,3 +4,4 @@ MAXPAGESIZE=0x100000 NONPAGED_TEXT_START_ADDR=0x100200 ARCH="sparc:v9" +MACHINE= diff -urN binutils-2.7/ld/emulparams/elf64alpha.sh binutils-2.8/ld/emulparams/elf64alpha.sh --- binutils-2.7/ld/emulparams/elf64alpha.sh Thu Jul 4 12:24:47 1996 +++ binutils-2.8/ld/emulparams/elf64alpha.sh Wed Apr 30 12:58:02 1997 @@ -7,6 +7,7 @@ MAXPAGESIZE=0x100000 NONPAGED_TEXT_START_ADDR="0x120000000" ARCH=alpha +MACHINE= GENERATE_SHLIB_SCRIPT=yes DATA_PLT= NOP=0x47ff041f diff -urN binutils-2.7/ld/emulparams/elf_i386.sh binutils-2.8/ld/emulparams/elf_i386.sh --- binutils-2.7/ld/emulparams/elf_i386.sh Thu Jul 4 12:24:47 1996 +++ binutils-2.8/ld/emulparams/elf_i386.sh Wed Apr 30 12:58:02 1997 @@ -4,6 +4,7 @@ MAXPAGESIZE=0x1000 NONPAGED_TEXT_START_ADDR=0x08048000 ARCH=i386 +MACHINE= NOP=0x9090 TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes diff -urN binutils-2.7/ld/emulparams/h8300s.sh binutils-2.8/ld/emulparams/h8300s.sh --- binutils-2.7/ld/emulparams/h8300s.sh Wed Dec 31 19:00:00 1969 +++ binutils-2.8/ld/emulparams/h8300s.sh Wed Apr 30 12:58:02 1997 @@ -0,0 +1,5 @@ +SCRIPT_NAME=h8300s +OUTPUT_FORMAT="coff-h8300" +TEXT_START_ADDR=0x8000 +TARGET_PAGE_SIZE=128 +ARCH=h8300 diff -urN binutils-2.7/ld/emulparams/i386moss.sh binutils-2.8/ld/emulparams/i386moss.sh --- binutils-2.7/ld/emulparams/i386moss.sh Thu Jul 4 12:24:48 1996 +++ binutils-2.8/ld/emulparams/i386moss.sh Wed Apr 30 12:58:04 1997 @@ -4,6 +4,7 @@ MAXPAGESIZE=0x1000 NONPAGED_TEXT_START_ADDR=0x00002000 ARCH=i386 +MACHINE= NOP=0x9090 TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes diff -urN binutils-2.7/ld/emulparams/m32relf.sh binutils-2.8/ld/emulparams/m32relf.sh --- binutils-2.7/ld/emulparams/m32relf.sh Wed Dec 31 19:00:00 1969 +++ binutils-2.8/ld/emulparams/m32relf.sh Wed Apr 30 12:58:04 1997 @@ -0,0 +1,12 @@ +MACHINE= +SCRIPT_NAME=elf +OUTPUT_FORMAT="elf32-m32r" +TEXT_START_ADDR=0x100 +ARCH=m32r +MACHINE= +MAXPAGESIZE=32 +EMBEDDED=yes + +# Hmmm, there's got to be a better way. This sets the stack to the +# top of the simulator memory (currently 1M). +OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = 0x100000);' diff -urN binutils-2.7/ld/emulparams/m68kelf.sh binutils-2.8/ld/emulparams/m68kelf.sh --- binutils-2.7/ld/emulparams/m68kelf.sh Thu Jul 4 12:24:49 1996 +++ binutils-2.8/ld/emulparams/m68kelf.sh Wed Apr 30 12:58:04 1997 @@ -4,6 +4,7 @@ MAXPAGESIZE=0x2000 NONPAGED_TEXT_START_ADDR=${TEXT_START_ADDR} ARCH=m68k +MACHINE= NOP=0x4e75 TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes diff -urN binutils-2.7/ld/emulparams/m88kbcs.sh binutils-2.8/ld/emulparams/m88kbcs.sh --- binutils-2.7/ld/emulparams/m88kbcs.sh Thu Jul 4 12:24:50 1996 +++ binutils-2.8/ld/emulparams/m88kbcs.sh Wed Apr 30 12:58:05 1997 @@ -3,4 +3,3 @@ TEXT_START_ADDR=?? TARGET_PAGE_SIZE=?? ARCH=m88k -TEMPLATE_NAME=m88kbcs diff -urN binutils-2.7/ld/emulparams/mipslnews.sh binutils-2.8/ld/emulparams/mipslnews.sh --- binutils-2.7/ld/emulparams/mipslnews.sh Wed Dec 31 19:00:00 1969 +++ binutils-2.8/ld/emulparams/mipslnews.sh Wed Apr 30 12:58:07 1997 @@ -0,0 +1,9 @@ +SCRIPT_NAME=mips +OUTPUT_FORMAT="ecoff-littlemips" +BIG_OUTPUT_FORMAT="ecoff-bigmips" +LITTLE_OUTPUT_FORMAT="ecoff-littlemips" +TARGET_PAGE_SIZE=0x1000000 +ARCH=mips +TEXT_START_ADDR=0x80080000 +DATA_ADDR=. +EMBEDDED=yes diff -urN binutils-2.7/ld/emulparams/mn10200.sh binutils-2.8/ld/emulparams/mn10200.sh --- binutils-2.7/ld/emulparams/mn10200.sh Wed Dec 31 19:00:00 1969 +++ binutils-2.8/ld/emulparams/mn10200.sh Wed Apr 30 12:58:06 1997 @@ -0,0 +1,20 @@ +MACHINE= +SCRIPT_NAME=elf +OUTPUT_FORMAT="elf32-mn10200" +TEXT_START_ADDR=0x0 +ARCH=mn10200 +MACHINE= +MAXPAGESIZE=256 +ENTRY=_start +EMBEDDED=yes + +# Hmmm, there's got to be a better way. This sets the stack to the +# top of the simulator memory (2^19 bytes). +OTHER_RELOCATING_SECTIONS='.stack 0x80000 : { _stack = .; *(.stack) }' + +# These are for compatibility with the COFF toolchain. +# XXX These should definitely disappear. +CTOR_START='___ctors = .;' +CTOR_END='___ctors_end = .;' +DTOR_START='___dtors = .;' +DTOR_END='___dtors_end = .;' diff -urN binutils-2.7/ld/emulparams/mn10300.sh binutils-2.8/ld/emulparams/mn10300.sh --- binutils-2.7/ld/emulparams/mn10300.sh Wed Dec 31 19:00:00 1969 +++ binutils-2.8/ld/emulparams/mn10300.sh Wed Apr 30 12:58:07 1997 @@ -0,0 +1,20 @@ +MACHINE= +SCRIPT_NAME=elf +OUTPUT_FORMAT="elf32-mn10300" +TEXT_START_ADDR=0x0 +ARCH=mn10300 +MACHINE= +MAXPAGESIZE=256 +ENTRY=_start +EMBEDDED=yes + +# Hmmm, there's got to be a better way. This sets the stack to the +# top of the simulator memory (2^19 bytes). +OTHER_RELOCATING_SECTIONS='.stack 0x80000 : { _stack = .; *(.stack) }' + +# These are for compatibility with the COFF toolchain. +# XXX These should definitely disappear. +CTOR_START='___ctors = .;' +CTOR_END='___ctors_end = .;' +DTOR_START='___dtors = .;' +DTOR_END='___dtors_end = .;' diff -urN binutils-2.7/ld/emulparams/shelf.sh binutils-2.8/ld/emulparams/shelf.sh --- binutils-2.7/ld/emulparams/shelf.sh Wed Dec 31 19:00:00 1969 +++ binutils-2.8/ld/emulparams/shelf.sh Wed Apr 30 12:58:10 1997 @@ -0,0 +1,17 @@ +SCRIPT_NAME=elf +OUTPUT_FORMAT="elf32-sh" +TEXT_START_ADDR=0x1000 +MAXPAGESIZE=128 +ARCH=sh +MACHINE= +TEMPLATE_NAME=elf32 +GENERATE_SHLIB_SCRIPT=yes +EMBEDDED=yes + +# These are for compatibility with the COFF toolchain. +ENTRY=start +CTOR_START='___ctors = .;' +CTOR_END='___ctors_end = .;' +DTOR_START='___dtors = .;' +DTOR_END='___dtors_end = .;' +OTHER_RELOCATING_SECTIONS='.stack 0x30000 : { _stack = .; *(.stack) }' diff -urN binutils-2.7/ld/emulparams/shlelf.sh binutils-2.8/ld/emulparams/shlelf.sh --- binutils-2.7/ld/emulparams/shlelf.sh Wed Dec 31 19:00:00 1969 +++ binutils-2.8/ld/emulparams/shlelf.sh Wed Apr 30 12:58:10 1997 @@ -0,0 +1,17 @@ +SCRIPT_NAME=elf +OUTPUT_FORMAT="elf32-shl" +TEXT_START_ADDR=0x1000 +MAXPAGESIZE=128 +ARCH=sh +MACHINE= +TEMPLATE_NAME=elf32 +GENERATE_SHLIB_SCRIPT=yes +EMBEDDED=yes + +# These are for compatibility with the COFF toolchain. +ENTRY=start +CTOR_START='___ctors = .;' +CTOR_END='___ctors_end = .;' +DTOR_START='___dtors = .;' +DTOR_END='___dtors_end = .;' +OTHER_RELOCATING_SECTIONS='.stack 0x30000 : { _stack = .; *(.stack) }' diff -urN binutils-2.7/ld/emulparams/sparcaout.sh binutils-2.8/ld/emulparams/sparcaout.sh --- binutils-2.7/ld/emulparams/sparcaout.sh Thu Jul 4 12:24:51 1996 +++ binutils-2.8/ld/emulparams/sparcaout.sh Wed Apr 30 12:58:11 1997 @@ -1,5 +1,7 @@ SCRIPT_NAME=aout OUTPUT_FORMAT="a.out-sunos-big" +BIG_OUTPUT_FORMAT="a.out-sunos-big" +LITTLE_OUTPUT_FORMAT="a.out-sparc-little" TEXT_START_ADDR=0x2020 TARGET_PAGE_SIZE=0x2000 NONPAGED_TEXT_START_ADDR=0x2000 diff -urN binutils-2.7/ld/emulparams/sparclinux.sh binutils-2.8/ld/emulparams/sparclinux.sh --- binutils-2.7/ld/emulparams/sparclinux.sh Wed Dec 31 19:00:00 1969 +++ binutils-2.8/ld/emulparams/sparclinux.sh Wed Apr 30 12:58:11 1997 @@ -0,0 +1,7 @@ +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-sparc-linux" +TARGET_PAGE_SIZE=0x1000 +TEXT_START_ADDR=0x1020 +NONPAGED_TEXT_START_ADDR=0 +ARCH=sparc +TEMPLATE_NAME=linux diff -urN binutils-2.7/ld/emultempl/aix.em binutils-2.8/ld/emultempl/aix.em --- binutils-2.7/ld/emultempl/aix.em Thu Jul 4 12:24:54 1996 +++ binutils-2.8/ld/emultempl/aix.em Wed Apr 30 12:58:16 1997 @@ -30,6 +30,7 @@ #include "sysdep.h" #include "libiberty.h" #include "getopt.h" +#include "obstack.h" #include "bfdlink.h" #include @@ -823,8 +824,12 @@ filename, lineno); } - if (strcasecmp (s, "svc") == 0 - || strcasecmp (s, "syscall") == 0) + if (s == se) + { + /* There was no address after all. */ + } + else if (strcasecmp (s, "svc") == 0 + || strcasecmp (s, "syscall") == 0) syscall = true; else { diff -urN binutils-2.7/ld/emultempl/elf32.em binutils-2.8/ld/emultempl/elf32.em --- binutils-2.7/ld/emultempl/elf32.em Mon Jul 15 11:48:54 1996 +++ binutils-2.8/ld/emultempl/elf32.em Wed Apr 30 12:58:15 1997 @@ -7,7 +7,7 @@ /* This file is is generated by a shell script. DO NOT EDIT! */ /* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME} - Copyright (C) 1991, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1991, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Steve Chamberlain ELF support by Ian Lance Taylor @@ -71,11 +71,6 @@ { ldfile_output_architecture = bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`; config.dynamic_link = ${DYNAMIC_LINK-true}; - - if (ldfile_output_architecture == bfd_arch_alpha) { - link_info.lprefix = "$"; - link_info.lprefix_len = 1; - } } /* Try to open a dynamic archive. This is where we know that ELF @@ -332,7 +327,7 @@ fi cat >>e${EMULATION_NAME}.c <name, l->by); } } @@ -562,12 +557,11 @@ rpath = command_line.rpath; if (rpath == NULL) rpath = (const char *) getenv ("LD_RUN_PATH"); - if (! bfd_elf${ELFSIZE}_size_dynamic_sections (output_bfd, - command_line.soname, - rpath, - command_line.export_dynamic, - &link_info, - &sinterp)) + if (! (bfd_elf${ELFSIZE}_size_dynamic_sections + (output_bfd, command_line.soname, rpath, + command_line.export_dynamic, command_line.filter_shlib, + (const char * const *) command_line.auxiliary_filters, + &link_info, &sinterp, lang_elf_version_info))) einfo ("%P%F: failed to set dynamic section sizes: %E\n"); /* Let the user override the dynamic linker we are using. */ @@ -729,6 +723,7 @@ static lang_output_section_statement_type *hold_data; static lang_output_section_statement_type *hold_bss; static lang_output_section_statement_type *hold_rel; +static lang_output_section_statement_type *hold_interp; /*ARGSUSED*/ static boolean @@ -742,6 +737,7 @@ lang_statement_list_type add; etree_type *address; const char *secname, *ps; + const char *outsecname; lang_output_section_statement_type *os; if ((s->flags & SEC_ALLOC) == 0) @@ -773,10 +769,17 @@ } /* Decide which segment the section should go in based on the - section name and section flags. */ + section name and section flags. We put loadable .note sections + right after the .interp section, so that the PT_NOTE segment is + stored right after the program headers where the OS can read it + in the first page. */ place = NULL; - if ((s->flags & SEC_HAS_CONTENTS) == 0 - && hold_bss != NULL) + if ((s->flags & SEC_LOAD) != 0 + && strncmp (secname, ".note", 4) == 0 + && hold_interp != NULL) + place = hold_interp; + else if ((s->flags & SEC_HAS_CONTENTS) == 0 + && hold_bss != NULL) place = hold_bss; else if ((s->flags & SEC_READONLY) == 0 && hold_data != NULL) @@ -794,12 +797,36 @@ if (place == NULL) return false; + /* Choose a unique name for the section. This will be needed if the + same section name appears in the input file with different + loadable or allocateable characteristics. */ + outsecname = secname; + if (bfd_get_section_by_name (output_bfd, outsecname) != NULL) + { + unsigned int len; + char *newname; + unsigned int i; + + len = strlen (outsecname); + newname = xmalloc (len + 5); + strcpy (newname, outsecname); + i = 0; + do + { + sprintf (newname + len, "%d", i); + ++i; + } + while (bfd_get_section_by_name (output_bfd, newname) != NULL); + + outsecname = newname; + } + /* Create the section in the output file, and put it in the right place. This shuffling is to make the output file look neater. */ - snew = bfd_make_section (output_bfd, secname); + snew = bfd_make_section (output_bfd, outsecname); if (snew == NULL) einfo ("%P%F: output format %s cannot represent section called %s\n", - output_bfd->xvec->name, secname); + output_bfd->xvec->name, outsecname); if (place->bfd_section != NULL) { for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next) @@ -816,15 +843,15 @@ /* If the name of the section is representable in C, then create symbols to mark the start and the end of the section. */ - for (ps = secname; *ps != '\0'; ps++) + for (ps = outsecname; *ps != '\0'; ps++) if (! isalnum (*ps) && *ps != '_') break; if (*ps == '\0' && config.build_constructors) { char *symname; - symname = (char *) xmalloc (ps - secname + sizeof "__start_"); - sprintf (symname, "__start_%s", secname); + symname = (char *) xmalloc (ps - outsecname + sizeof "__start_"); + sprintf (symname, "__start_%s", outsecname); lang_add_assignment (exp_assop ('=', symname, exp_unop (ALIGN_K, exp_intop ((bfd_vma) 1 @@ -836,24 +863,25 @@ else address = exp_intop ((bfd_vma) 0); - lang_enter_output_section_statement (secname, address, 0, + lang_enter_output_section_statement (outsecname, address, 0, (bfd_vma) 0, (etree_type *) NULL, (etree_type *) NULL, (etree_type *) NULL); - os = lang_output_section_statement_lookup (secname); + os = lang_output_section_statement_lookup (outsecname); wild_doit (&os->children, s, os, file); - lang_leave_output_section_statement ((bfd_vma) 0, "*default*"); + lang_leave_output_section_statement + ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL); stat_ptr = &add; if (*ps == '\0' && config.build_constructors) { char *symname; - symname = (char *) xmalloc (ps - secname + sizeof "__stop_"); - sprintf (symname, "__stop_%s", secname); + symname = (char *) xmalloc (ps - outsecname + sizeof "__stop_"); + sprintf (symname, "__stop_%s", outsecname); lang_add_assignment (exp_assop ('=', symname, exp_nameop (NAME, "."))); } @@ -878,7 +906,9 @@ os = &s->output_section_statement; - if (strcmp (os->name, hold_section->name) == 0) + if (strcmp (os->name, hold_section->name) == 0 + && ((hold_section->flags & (SEC_LOAD | SEC_ALLOC)) + == (os->bfd_section->flags & (SEC_LOAD | SEC_ALLOC)))) hold_use = os; if (strcmp (os->name, ".text") == 0) @@ -891,8 +921,11 @@ hold_bss = os; else if (hold_rel == NULL && os->bfd_section != NULL + && (os->bfd_section->flags & SEC_ALLOC) != 0 && strncmp (os->name, ".rel", 4) == 0) hold_rel = os; + else if (strcmp (os->name, ".interp") == 0) + hold_interp = os; } static char * diff -urN binutils-2.7/ld/emultempl/gld960c.em binutils-2.8/ld/emultempl/gld960c.em --- binutils-2.7/ld/emultempl/gld960c.em Thu Jul 4 12:24:56 1996 +++ binutils-2.8/ld/emultempl/gld960c.em Wed Apr 30 12:58:16 1997 @@ -1,7 +1,7 @@ # This shell script emits a C file. -*- C -*- # It does some substitutions. cat >e${EMULATION_NAME}.c < #include "bfd.h" #include "sysdep.h" #include "libiberty.h" @@ -78,7 +80,20 @@ static void gld960_set_output_arch() { - bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core); + if (ldfile_output_machine_name != NULL + && *ldfile_output_machine_name != '\0') + { + char *s, *s1; + + s = concat ("i960:", ldfile_output_machine_name, (char *) NULL); + for (s1 = s; *s1 != '\0'; s1++) + if (isupper ((unsigned char) *s1)) + *s1 = tolower ((unsigned char) *s1); + ldfile_set_output_arch (s); + free (s); + } + + set_output_arch_default (); } static char * diff -urN binutils-2.7/ld/emultempl/hppaelf.em binutils-2.8/ld/emultempl/hppaelf.em --- binutils-2.7/ld/emultempl/hppaelf.em Thu Jul 4 12:24:56 1996 +++ binutils-2.8/ld/emultempl/hppaelf.em Wed Apr 30 12:58:16 1997 @@ -2,7 +2,7 @@ # It does some substitutions. cat >e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <pe) { einfo ("%F%P: PE operations on non PE file.\n"); @@ -411,12 +459,13 @@ lang_statement_union_type **vec; lang_statement_union_type *p; int i; + lang_statement_union_type **ret; if (count == 0) return startptr; - vec = (lang_statement_union_type **) - alloca (count * sizeof (lang_statement_union_type *)); + vec = ((lang_statement_union_type **) + xmalloc (count * sizeof (lang_statement_union_type *))); for (p = *startptr, i = 0; i < count; i++, p = p->next) vec[i] = p; @@ -428,7 +477,9 @@ for (i = 0; i < count - 1; i++) vec[i]->header.next = vec[i + 1]; vec[i]->header.next = next_after; - return &(vec[i]->header.next); + ret = &vec[i]->header.next; + free (vec); + return ret; } /* Sort the .idata\$foo input sections of archives into filename order. @@ -535,7 +586,10 @@ { LANG_FOR_EACH_INPUT_STATEMENT (is) { - ppc_process_before_allocation(is->the_bfd, &link_info); + if (!ppc_process_before_allocation(is->the_bfd, &link_info)) + { + einfo("Errors encountered processing file %s", is->filename); + } } } @@ -562,7 +616,6 @@ const char *secname; char *output_secname, *ps; lang_output_section_statement_type *os; - lang_statement_list_type *ptr; lang_statement_union_type *l; if ((s->flags & SEC_ALLOC) == 0) diff -urN binutils-2.7/ld/emultempl/sunos.em binutils-2.8/ld/emultempl/sunos.em --- binutils-2.7/ld/emultempl/sunos.em Thu Jul 4 12:25:01 1996 +++ binutils-2.8/ld/emultempl/sunos.em Wed Apr 30 12:58:17 1997 @@ -4,7 +4,7 @@ /* This file is is generated by a shell script. DO NOT EDIT! */ /* SunOS emulation code for ${EMULATION_NAME} - Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1991, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Steve Chamberlain SunOS shared library support by Ian Lance Taylor @@ -26,6 +26,7 @@ #define TARGET_IS_${EMULATION_NAME} +#include #include #include @@ -195,7 +196,7 @@ found, add it to the list of input files. */ alc = (char *) xmalloc (strlen (inp->filename) + 1); strcpy (alc, inp->filename); - strstr (alc, ".so.")[2] = 'a'; + strstr (alc + strlen (search->name), ".so")[2] = 'a'; if (stat (alc, &st) != 0) free (alc); else @@ -267,6 +268,7 @@ while ((entry = readdir (dir)) != NULL) { + const char *s; int found_maj, found_min; if (strncmp (entry->d_name, "lib", 3) != 0 @@ -280,8 +282,25 @@ continue; } + /* We accept libfoo.so without a version number, even though the + native linker does not. This is more convenient for packages + which just generate .so files for shared libraries, as on ELF + systems. */ if (strncmp (entry->d_name + 3 + len, ".so", 3) != 0) continue; + if (entry->d_name[6 + len] == '\0') + ; + else if (entry->d_name[6 + len] == '.' + && isdigit (entry->d_name[7 + len])) + ; + else + continue; + + for (s = entry->d_name + 6 + len; *s != '\0'; s++) + if (*s != '.' && ! isdigit (*s)) + break; + if (*s != '\0') + continue; /* We've found a .so file. Work out the major and minor version numbers. */ @@ -353,7 +372,6 @@ { struct bfd_link_needed_list *ll; const char *lname; - const char *lib_path; search_dirs_type *search; lname = l->name; @@ -435,9 +453,13 @@ if [ "x${host}" = "x${target}" ] ; then if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then cat >>e${EMULATION_NAME}.c <REGION :PHDR =FILL + + Everything is optional except `OVERLAY' (a keyword), and each +section must have a name (SECNAME1 and SECNAME2 above). The section +definitions within the `OVERLAY' construct are identical to those +within the general `SECTIONS' contruct (*note SECTIONS::.), except that +no addresses and no memory regions may be defined for sections within +an `OVERLAY'. + + The sections are all defined with the same starting address. The +load addresses of the sections are arranged such that they are +consecutive in memory starting at the load address used for the +`OVERLAY' as a whole (as with normal section definitions, the load +address is optional, and defaults to the start address; the start +address is also optional, and defaults to `.'). + + If the `NOCROSSREFS' keyword is used, and there any references among +the sections, the linker will report an error. Since the sections all +run at the same address, it normally does not make sense for one +section to refer directly to another. *Note NOCROSSREFS: Option +Commands. + + For each section within the `OVERLAY', the linker automatically +defines two symbols. The symbol `__load_start_SECNAME' is defined as +the starting load address of the section. The symbol +`__load_stop_SECNAME' is defined as the final load address of the +section. Any characters within SECNAME which are not legal within C +identifiers are removed. C (or assembler) code may use these symbols +to move the overlaid sections around as necessary. + + At the end of the overlay, the value of `.' is set to the start +address of the overlay plus the size of the largest section. + + Here is an example. Remember that this would appear inside a +`SECTIONS' construct. + + OVERLAY 0x1000 : AT (0x4000) + { + .text0 { o1/*.o(.text) } + .text1 { o2/*.o(.text) } + } + + This will define both `.text0' and `.text1' to start at address +0x1000. `.text0' will be loaded at address 0x4000, and `.text1' will +be loaded immediately after `.text0'. The following symbols will be +defined: `__load_start_text0', `__load_stop_text0', +`__load_start_text1', `__load_stop_text1'. + + C code to copy overlay `.text1' into the overlay area might look +like the following. + + extern char __load_start_text1, __load_stop_text1; + memcpy ((char *) 0x1000, &__load_start_text1, + &__load_stop_text1 - &__load_start_text1); + + Note that the `OVERLAY' command is just syntactic sugar, since +everything it does can be done using the more basic commands. The above +example could have been written identically as follows. + + .text0 0x1000 : AT (0x4000) { o1/*.o(.text) } + __load_start_text0 = LOADADDR (.text0); + __load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0); + .text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) { o2/*.o(.text) } + __load_start_text1 = LOADADDR (.text1); + __load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1); + . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1)); + + File: ld.info, Node: PHDRS, Next: Entry Point, Prev: SECTIONS, Up: Commands ELF Program Headers @@ -751,7 +973,7 @@ }  -File: ld.info, Node: Entry Point, Next: Option Commands, Prev: PHDRS, Up: Commands +File: ld.info, Node: Entry Point, Next: Version Script, Prev: PHDRS, Up: Commands The Entry Point =============== @@ -795,401 +1017,136 @@ start = other_symbol ;  -File: ld.info, Node: Option Commands, Prev: Entry Point, Up: Commands - -Option Commands -=============== - - The command language includes a number of other commands that you can -use for specialized purposes. They are similar in purpose to -command-line options. - -`CONSTRUCTORS' - When linking using the `a.out' object file format, the linker uses - an unusual set construct to support C++ global constructors and - destructors. When linking object file formats which do not support - arbitrary sections, such as `ECOFF' and `XCOFF', the linker will - automatically recognize C++ global constructors and destructors by - name. For these object file formats, the `CONSTRUCTORS' command - tells the linker where this information should be placed. The - `CONSTRUCTORS' command is ignored for other object file formats. - - The symbol `__CTOR_LIST__' marks the start of the global - constructors, and the symbol `__DTOR_LIST' marks the end. The - first word in the list is the number of entries, followed by the - address of each constructor or destructor, followed by a zero - word. The compiler must arrange to actually run the code. For - these object file formats GNU C++ calls constructors from a - subroutine `__main'; a call to `__main' is automatically inserted - into the startup code for `main'. GNU C++ runs destructors either - by using `atexit', or directly from the function `exit'. - - For object file formats such as `COFF' or `ELF' which support - multiple sections, GNU C++ will normally arrange to put the - addresses of global constructors and destructors into the `.ctors' - and `.dtors' sections. Placing the following sequence into your - linker script will build the sort of table which the GNU C++ - runtime code expects to see. - - __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) - *(.ctors) - LONG(0) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) - *(.dtors) - LONG(0) - __DTOR_END__ = .; - - Normally the compiler and linker will handle these issues - automatically, and you will not need to concern yourself with - them. However, you may need to consider this if you are using C++ - and writing your own linker scripts. - -`FLOAT' -`NOFLOAT' - These keywords were used in some older linkers to request a - particular math subroutine library. `ld' doesn't use the - keywords, assuming instead that any necessary subroutines are in - libraries specified using the general mechanisms for linking to - archives; but to permit the use of scripts that were written for - the older linkers, the keywords `FLOAT' and `NOFLOAT' are accepted - and ignored. - -`FORCE_COMMON_ALLOCATION' - This command has the same effect as the `-d' command-line option: - to make `ld' assign space to common symbols even if a relocatable - output file is specified (`-r'). - -`INPUT ( FILE, FILE, ... )' -`INPUT ( FILE FILE ... )' - Use this command to include binary input files in the link, without - including them in a particular section definition. Specify the - full name for each FILE, including `.a' if required. - - `ld' searches for each FILE through the archive-library search - path, just as for files you specify on the command line. See the - description of `-L' in *Note Command Line Options: Options. - - If you use `-lFILE', `ld' will transform the name to `libFILE.a' - as with the command line argument `-l'. - -`GROUP ( FILE, FILE, ... )' -`GROUP ( FILE FILE ... )' - This command is like `INPUT', except that the named files should - all be archives, and they are searched repeatedly until no new - undefined references are created. See the description of `-(' in - *Note Command Line Options: Options. - -`OUTPUT ( FILENAME )' - Use this command to name the link output file FILENAME. The - effect of `OUTPUT(FILENAME)' is identical to the effect of - `-o FILENAME', which overrides it. You can use this command to - supply a default output-file name other than `a.out'. - -`OUTPUT_ARCH ( BFDNAME )' - Specify a particular output machine architecture, with one of the - names used by the BFD back-end routines (*note BFD::.). This - command is often unnecessary; the architecture is most often set - implicitly by either the system BFD configuration or as a side - effect of the `OUTPUT_FORMAT' command. - -`OUTPUT_FORMAT ( BFDNAME )' - When `ld' is configured to support multiple object code formats, - you can use this command to specify a particular output format. - bFDNAME is one of the names used by the BFD back-end routines - (*note BFD::.). The effect is identical to the effect of the - `-oformat' command-line option. This selection affects only the - output file; the related command `TARGET' affects primarily input - files. - -`SEARCH_DIR ( PATH )' - Add PATH to the list of paths where `ld' looks for archive - libraries. `SEARCH_DIR(PATH)' has the same effect as `-LPATH' on - the command line. - -`STARTUP ( FILENAME )' - Ensure that FILENAME is the first input file used in the link - process. - -`TARGET ( FORMAT )' - When `ld' is configured to support multiple object code formats, - you can use this command to change the input-file object code - format (like the command-line option `-b' or its synonym - `-format'). The argument FORMAT is one of the strings used by BFD - to name binary formats. If `TARGET' is specified but - `OUTPUT_FORMAT' is not, the last `TARGET' argument is also used as - the default format for the `ld' output file. *Note BFD::. - - If you don't use the `TARGET' command, `ld' uses the value of the - environment variable `GNUTARGET', if available, to select the - output file format. If that variable is also absent, `ld' uses - the default format configured for your machine in the BFD - libraries. - - -File: ld.info, Node: Machine Dependent, Next: BFD, Prev: Commands, Up: Top - -Machine Dependent Features -************************** - - `ld' has additional features on some platforms; the following -sections describe them. Machines where `ld' has no additional -functionality are not listed. - -* Menu: - -* H8/300:: `ld' and the H8/300 -* i960:: `ld' and the Intel 960 family - - -File: ld.info, Node: H8/300, Next: i960, Up: Machine Dependent - -`ld' and the H8/300 -=================== - - For the H8/300, `ld' can perform these global optimizations when you -specify the `-relax' command-line option. - -*relaxing address modes* - `ld' finds all `jsr' and `jmp' instructions whose targets are - within eight bits, and turns them into eight-bit program-counter - relative `bsr' and `bra' instructions, respectively. - -*synthesizing instructions* - `ld' finds all `mov.b' instructions which use the sixteen-bit - absolute address form, but refer to the top page of memory, and - changes them to use the eight-bit address form. (That is: the - linker turns `mov.b `@'AA:16' into `mov.b `@'AA:8' whenever the - address AA is in the top page of memory). - - -File: ld.info, Node: i960, Prev: H8/300, Up: Machine Dependent - -`ld' and the Intel 960 family -============================= +File: ld.info, Node: Version Script, Next: Option Commands, Prev: Entry Point, Up: Commands - You can use the `-AARCHITECTURE' command line option to specify one -of the two-letter names identifying members of the 960 family; the -option specifies the desired output target, and warns of any -incompatible instructions in the input files. It also modifies the -linker's search strategy for archive libraries, to support the use of -libraries specific to each particular architecture, by including in the -search loop names suffixed with the string identifying the architecture. - - For example, if your `ld' command line included `-ACA' as well as -`-ltry', the linker would look (in its built-in search paths, and in -any paths you specify with `-L') for a library with the names - - try - libtry.a - tryca - libtryca.a - -The first two possibilities would be considered in any event; the last -two are due to the use of `-ACA'. - - You can meaningfully use `-A' more than once on a command line, since -the 960 architecture family allows combination of target architectures; -each use will add another pair of name variants to search for when `-l' -specifies a library. - - `ld' supports the `-relax' option for the i960 family. If you -specify `-relax', `ld' finds all `balx' and `calx' instructions whose -targets are within 24 bits, and turns them into 24-bit program-counter -relative `bal' and `cal' instructions, respectively. `ld' also turns -`cal' instructions into `bal' instructions when it determines that the -target subroutine is a leaf routine (that is, the target subroutine does -not itself call any subroutines). - - -File: ld.info, Node: BFD, Next: MRI, Prev: Machine Dependent, Up: Top - -BFD -*** - - The linker accesses object and archive files using the BFD libraries. -These libraries allow the linker to use the same routines to operate on -object files whatever the object file format. A different object file -format can be supported simply by creating a new BFD back end and adding -it to the library. To conserve runtime memory, however, the linker and -associated tools are usually configured to support only a subset of the -object file formats available. You can use `objdump -i' (*note -objdump: (binutils.info)objdump.) to list all the formats available for -your configuration. - - As with most implementations, BFD is a compromise between several -conflicting requirements. The major factor influencing BFD design was -efficiency: any time used converting between formats is time which -would not have been spent had BFD not been involved. This is partly -offset by abstraction payback; since BFD simplifies applications and -back ends, more time and care may be spent optimizing algorithms for a -greater speed. - - One minor artifact of the BFD solution which you should bear in mind -is the potential for information loss. There are two places where -useful information can be lost using the BFD mechanism: during -conversion and during output. *Note BFD information loss::. - -* Menu: +Version Script +============== -* BFD outline:: How it works: an outline of BFD - - -File: ld.info, Node: BFD outline, Up: BFD - -How it works: an outline of BFD -=============================== - - When an object file is opened, BFD subroutines automatically -determine the format of the input object file. They then build a -descriptor in memory with pointers to routines that will be used to -access elements of the object file's data structures. - - As different information from the the object files is required, BFD -reads from different sections of the file and processes them. For -example, a very common operation for the linker is processing symbol -tables. Each BFD back end provides a routine for converting between -the object file's representation of symbols and an internal canonical -format. When the linker asks for the symbol table of an object file, it -calls through a memory pointer to the routine from the relevant BFD -back end which reads and converts the table into a canonical form. The -linker then operates upon the canonical form. When the link is finished -and the linker writes the output file's symbol table, another BFD back -end routine is called to take the newly created symbol table and -convert it into the chosen output format. - -* Menu: - -* BFD information loss:: Information Loss -* Canonical format:: The BFD canonical object-file format - - -File: ld.info, Node: BFD information loss, Next: Canonical format, Up: BFD outline - -Information Loss ----------------- - - *Information can be lost during output.* The output formats -supported by BFD do not provide identical facilities, and information -which can be described in one form has nowhere to go in another format. -One example of this is alignment information in `b.out'. There is -nowhere in an `a.out' format file to store alignment information on the -contained data, so when a file is linked from `b.out' and an `a.out' -image is produced, alignment information will not propagate to the -output file. (The linker will still use the alignment information -internally, so the link is performed correctly). - - Another example is COFF section names. COFF files may contain an -unlimited number of sections, each one with a textual section name. If -the target of the link is a format which does not have many sections -(e.g., `a.out') or has sections without names (e.g., the Oasys format), -the link cannot be done simply. You can circumvent this problem by -describing the desired input-to-output section mapping with the linker -command language. - - *Information can be lost during canonicalization.* The BFD internal -canonical form of the external formats is not exhaustive; there are -structures in input formats for which there is no direct representation -internally. This means that the BFD back ends cannot maintain all -possible data richness through the transformation between external to -internal and back to external formats. - - This limitation is only a problem when an application reads one -format and writes another. Each BFD back end is responsible for -maintaining as much data as possible, and the internal BFD canonical -form has structures which are opaque to the BFD core, and exported only -to the back ends. When a file is read in one format, the canonical form -is generated for BFD and the application. At the same time, the back -end saves away any information which may otherwise be lost. If the data -is then written back in the same format, the back end routine will be -able to use the canonical form provided by the BFD core as well as the -information it prepared earlier. Since there is a great deal of -commonality between back ends, there is no information lost when -linking or copying big endian COFF to little endian COFF, or `a.out' to -`b.out'. When a mixture of formats is linked, the information is only -lost from the files whose format differs from the destination. - - -File: ld.info, Node: Canonical format, Prev: BFD information loss, Up: BFD outline - -The BFD canonical object-file format ------------------------------------- - - The greatest potential for loss of information occurs when there is -the least overlap between the information provided by the source -format, that stored by the canonical format, and that needed by the -destination format. A brief description of the canonical form may help -you understand which kinds of data you can count on preserving across -conversions. - -*files* - Information stored on a per-file basis includes target machine - architecture, particular implementation format type, a demand - pageable bit, and a write protected bit. Information like Unix - magic numbers is not stored here--only the magic numbers' meaning, - so a `ZMAGIC' file would have both the demand pageable bit and the - write protected text bit set. The byte order of the target is - stored on a per-file basis, so that big- and little-endian object - files may be used with one another. - -*sections* - Each section in the input file contains the name of the section, - the section's original address in the object file, size and - alignment information, various flags, and pointers into other BFD - data structures. - -*symbols* - Each symbol contains a pointer to the information for the object - file which originally defined it, its name, its value, and various - flag bits. When a BFD back end reads in a symbol table, it - relocates all symbols to make them relative to the base of the - section where they were defined. Doing this ensures that each - symbol points to its containing section. Each symbol also has a - varying amount of hidden private data for the BFD back end. Since - the symbol points to the original file, the private data format - for that symbol is accessible. `ld' can operate on a collection - of symbols of wildly different formats without problems. - - Normal global and simple local symbols are maintained on output, - so an output file (no matter its format) will retain symbols - pointing to functions and to global, static, and common variables. - Some symbol information is not worth retaining; in `a.out', type - information is stored in the symbol table as long symbol names. - This information would be useless to most COFF debuggers; the - linker has command line switches to allow users to throw it away. - - There is one word of type information within the symbol, so if the - format supports symbol type information within symbols (for - example, COFF, IEEE, Oasys) and the type is simple enough to fit - within one word (nearly everything but aggregates), the - information will be preserved. - -*relocation level* - Each canonical BFD relocation record contains a pointer to the - symbol to relocate to, the offset of the data to relocate, the - section the data is in, and a pointer to a relocation type - descriptor. Relocation is performed by passing messages through - the relocation type descriptor and the symbol pointer. Therefore, - relocations can be performed on output data using a relocation - method that is only available in one of the input formats. For - instance, Oasys provides a byte relocation format. A relocation - record requesting this relocation type would point indirectly to a - routine to perform this, so the relocation may be performed on a - byte being written to a 68k COFF file, even though 68k COFF has no - such relocation type. - -*line numbers* - Object formats can contain, for debugging purposes, some form of - mapping between symbols, source line numbers, and addresses in the - output file. These addresses have to be relocated along with the - symbol information. Each symbol with an associated list of line - number records points to the first record of the list. The head - of a line number list consists of a pointer to the symbol, which - allows finding out the address of the function whose line number - is being described. The rest of the list is made up of pairs: - offsets into the section and line numbers. Any format which can - simply derive this information can pass it successfully between - formats (COFF, IEEE and Oasys). + The linker command script includes a command specifically for +specifying a version script, and is only meaningful for ELF platforms +that support shared libraries. A version script can be build directly +into the linker script that you are using, or you can supply the +version script as just another input file to the linker at the time +that you link. The command script syntax is: + VERSION { version script contents } + The version script can also be specified to the linker by means of +the `--version-script' linker command line option. Version scripts are +only meaningful when creating shared libraries. + + The format of the version script itself is identical to that used by +Sun's linker in Solaris 2.5. Versioning is done by defining a tree of +version nodes with the names and interdependencies specified in the +version script. The version script can specify which symbols are bound +to which version nodes, and it can reduce a specified set of symbols to +local scope so that they are not globally visible outside of the shared +library. + + The easiest way to demonstrate the version script language is with a +few examples. + + VERS_1.1 { + global: + foo1; + local: + old*; + original*; + new*; + }; + + VERS_1.2 { + foo2; + } VERS_1.1; + + VERS_2.0 { + bar1; bar2; + } VERS_1.2; + + In this example, three version nodes are defined. `VERS_1.1' is the +first version node defined, and has no other dependencies. The symbol +`foo1' is bound to this version node, and a number of symbols that have +appeared within various object files are reduced in scope to local so +that they are not visible outside of the shared library. + + Next, the node `VERS_1.2' is defined. It depends upon `VERS_1.1'. +The symbol `foo2' is bound to this version node. + + Finally, the node `VERS_2.0' is defined. It depends upon +`VERS_1.2'. The symbols `bar1' and `bar2' are bound to this version +node. + + Symbols defined in the library which aren't specifically bound to a +version node are effectively bound to an unspecified base version of the +library. It is possible to bind all otherwise unspecified symbols to a +given version node using `global: *' somewhere in the version script. + + Lexically the names of the version nodes have no specific meaning +other than what they might suggest to the person reading them. The +`2.0' version could just as well have appeared in between `1.1' and +`1.2'. However, this would be a confusing way to write a version +script. + + When you link an application against a shared library that has +versioned symbols, the application itself knows which version of each +symbol it requires, and it also knows which version nodes it needs from +each shared library it is linked against. Thus at runtime, the dynamic +loader can make a quick check to make sure that the libraries you have +linked against do in fact supply all of the version nodes that the +application will need to resolve all of the dynamic symbols. In this +way it is possible for the dynamic linker to know with certainty that +all external symbols that it needs will be resolvable without having to +search for each symbol reference. + + The symbol versioning is in effect a much more sophisticated way of +doing minor version checking that SunOS does. The fundamental problem +that is being addressed here is that typically references to external +functions are bound on an as-needed basis, and are not all bound when +the application starts up. If a shared library is out of date, a +required interface may be missing; when the application tries to use +that interface, it may suddenly and unexpectedly fail. With symbol +versioning, the user will get a warning when they start their program if +the libraries being used with the application are too old. + + There are several GNU extensions to Sun's versioning approach. The +first of these is the ability to bind a symbol to a version node in the +source file where the symbol is defined instead of in the versioning +script. This was done mainly to reduce the burden on the library +maintainer. This can be done by putting something like: + + __asm__(".symver original_foo,foo@VERS_1.1"); + + in the C source file. This renamed the function `original_foo' to +be an alias for `foo' bound to the version node `VERS_1.1'. The +`local:' directive can be used to prevent the symbol `original_foo' +from being exported. + + The second GNU extension is to allow multiple versions of the same +function to appear in a given shared library. In this way an +incompatible change to an interface can take place without increasing +the major version number of the shared library, while still allowing +applications linked against the old interface to continue to function. + + This can only be accomplished by using multiple `.symver' directives +in the assembler. An example of this would be: + + __asm__(".symver original_foo,foo@"); + __asm__(".symver old_foo,foo@VERS_1.1"); + __asm__(".symver old_foo1,foo@VERS_1.2"); + __asm__(".symver new_foo,foo@@VERS_2.0"); + + In this example, `foo@' represents the symbol `foo' bound to the +unspecified base version of the symbol. The source file that contains +this example would define 4 C functions: `original_foo', `old_foo', +`old_foo1', and `new_foo'. + + When you have multiple definitions of a given symbol, there needs to +be some way to specify a default version to which external references to +this symbol will be bound. This can be accomplished with the +`foo@@VERS_2.0' type of `.symver' directive. Only one version of a +symbol can be declared 'default' in this manner - otherwise you would +effectively have multiple definitions of the same symbol. + + If you wish to bind a reference to a specific version of the symbol +within the shared library, you can use the aliases of convenience (i.e. +`old_foo'), or you can use the `.symver' directive to specifically bind +to an external version of the function in question. diff -urN binutils-2.7/ld/ld.info-3 binutils-2.8/ld/ld.info-3 --- binutils-2.7/ld/ld.info-3 Mon Jul 15 12:23:15 1996 +++ binutils-2.8/ld/ld.info-3 Wed Apr 30 13:15:26 1997 @@ -1,4 +1,4 @@ -This is Info file ld.info, produced by Makeinfo-1.55 from the input +This is Info file ld.info, produced by Makeinfo-1.64 from the input file ./ld.texinfo. START-INFO-DIR-ENTRY @@ -7,8 +7,8 @@ This file documents the GNU linker LD. - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, -Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -24,7 +24,618 @@ versions.  -File: ld.info, Node: MRI, Next: Index, Prev: BFD, Up: Top +File: ld.info, Node: Option Commands, Prev: Version Script, Up: Commands + +Option Commands +=============== + + The command language includes a number of other commands that you can +use for specialized purposes. They are similar in purpose to +command-line options. + +`CONSTRUCTORS' + When linking using the `a.out' object file format, the linker uses + an unusual set construct to support C++ global constructors and + destructors. When linking object file formats which do not support + arbitrary sections, such as `ECOFF' and `XCOFF', the linker will + automatically recognize C++ global constructors and destructors by + name. For these object file formats, the `CONSTRUCTORS' command + tells the linker where this information should be placed. The + `CONSTRUCTORS' command is ignored for other object file formats. + + The symbol `__CTOR_LIST__' marks the start of the global + constructors, and the symbol `__DTOR_LIST' marks the end. The + first word in the list is the number of entries, followed by the + address of each constructor or destructor, followed by a zero + word. The compiler must arrange to actually run the code. For + these object file formats GNU C++ calls constructors from a + subroutine `__main'; a call to `__main' is automatically inserted + into the startup code for `main'. GNU C++ runs destructors either + by using `atexit', or directly from the function `exit'. + + For object file formats such as `COFF' or `ELF' which support + multiple sections, GNU C++ will normally arrange to put the + addresses of global constructors and destructors into the `.ctors' + and `.dtors' sections. Placing the following sequence into your + linker script will build the sort of table which the GNU C++ + runtime code expects to see. + + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + + Normally the compiler and linker will handle these issues + automatically, and you will not need to concern yourself with + them. However, you may need to consider this if you are using C++ + and writing your own linker scripts. + +`FLOAT' +`NOFLOAT' + These keywords were used in some older linkers to request a + particular math subroutine library. `ld' doesn't use the + keywords, assuming instead that any necessary subroutines are in + libraries specified using the general mechanisms for linking to + archives; but to permit the use of scripts that were written for + the older linkers, the keywords `FLOAT' and `NOFLOAT' are accepted + and ignored. + +`FORCE_COMMON_ALLOCATION' + This command has the same effect as the `-d' command-line option: + to make `ld' assign space to common symbols even if a relocatable + output file is specified (`-r'). + +`INCLUDE FILENAME' + Include the linker script FILENAME at this point. The file will + be searched for in the current directory, and in any directory + specified with the `-L' option. You can nest calls to `INCLUDE' + up to 10 levels deep. + +`INPUT ( FILE, FILE, ... )' +`INPUT ( FILE FILE ... )' + Use this command to include binary input files in the link, without + including them in a particular section definition. Specify the + full name for each FILE, including `.a' if required. + + `ld' searches for each FILE through the archive-library search + path, just as for files you specify on the command line. See the + description of `-L' in *Note Command Line Options: Options. + + If you use `-lFILE', `ld' will transform the name to `libFILE.a' + as with the command line argument `-l'. + +`GROUP ( FILE, FILE, ... )' +`GROUP ( FILE FILE ... )' + This command is like `INPUT', except that the named files should + all be archives, and they are searched repeatedly until no new + undefined references are created. See the description of `-(' in + *Note Command Line Options: Options. + +`OUTPUT ( FILENAME )' + Use this command to name the link output file FILENAME. The + effect of `OUTPUT(FILENAME)' is identical to the effect of + `-o FILENAME', which overrides it. You can use this command to + supply a default output-file name other than `a.out'. + +`OUTPUT_ARCH ( BFDNAME )' + Specify a particular output machine architecture, with one of the + names used by the BFD back-end routines (*note BFD::.). This + command is often unnecessary; the architecture is most often set + implicitly by either the system BFD configuration or as a side + effect of the `OUTPUT_FORMAT' command. + +`OUTPUT_FORMAT ( BFDNAME )' + When `ld' is configured to support multiple object code formats, + you can use this command to specify a particular output format. + BFDNAME is one of the names used by the BFD back-end routines + (*note BFD::.). The effect is identical to the effect of the + `--oformat' command-line option. This selection affects only the + output file; the related command `TARGET' affects primarily input + files. + +`SEARCH_DIR ( PATH )' + Add PATH to the list of paths where `ld' looks for archive + libraries. `SEARCH_DIR(PATH)' has the same effect as `-LPATH' on + the command line. + +`STARTUP ( FILENAME )' + Ensure that FILENAME is the first input file used in the link + process. + +`TARGET ( FORMAT )' + When `ld' is configured to support multiple object code formats, + you can use this command to change the input-file object code + format (like the command-line option `-b' or its synonym + `--format'). The argument FORMAT is one of the strings used by + BFD to name binary formats. If `TARGET' is specified but + `OUTPUT_FORMAT' is not, the last `TARGET' argument is also used as + the default format for the `ld' output file. *Note BFD::. + + If you don't use the `TARGET' command, `ld' uses the value of the + environment variable `GNUTARGET', if available, to select the + output file format. If that variable is also absent, `ld' uses + the default format configured for your machine in the BFD + libraries. + +`NOCROSSREFS ( SECTION SECTION ... )' + This command may be used to tell `ld' to issue an error about any + references among certain sections. + + In certain types of programs, particularly on embedded systems, + when one section is loaded into memory, another section will not + be. Any direct references between the two sections would be + errors. For example, it would be an error if code in one section + called a function defined in the other section. + + The `NOCROSSREFS' command takes a list of section names. If `ld' + detects any cross references between the sections, it reports an + error and returns a non-zero exit status. The `NOCROSSREFS' + command uses output section names, defined in the `SECTIONS' + command. It does not use the names of input sections. + + +File: ld.info, Node: Machine Dependent, Next: BFD, Prev: Commands, Up: Top + +Machine Dependent Features +************************** + + `ld' has additional features on some platforms; the following +sections describe them. Machines where `ld' has no additional +functionality are not listed. + +* Menu: + +* H8/300:: `ld' and the H8/300 +* i960:: `ld' and the Intel 960 family + + +File: ld.info, Node: H8/300, Next: i960, Up: Machine Dependent + +`ld' and the H8/300 +=================== + + For the H8/300, `ld' can perform these global optimizations when you +specify the `--relax' command-line option. + +*relaxing address modes* + `ld' finds all `jsr' and `jmp' instructions whose targets are + within eight bits, and turns them into eight-bit program-counter + relative `bsr' and `bra' instructions, respectively. + +*synthesizing instructions* + `ld' finds all `mov.b' instructions which use the sixteen-bit + absolute address form, but refer to the top page of memory, and + changes them to use the eight-bit address form. (That is: the + linker turns `mov.b `@'AA:16' into `mov.b `@'AA:8' whenever the + address AA is in the top page of memory). + + +File: ld.info, Node: i960, Prev: H8/300, Up: Machine Dependent + +`ld' and the Intel 960 family +============================= + + You can use the `-AARCHITECTURE' command line option to specify one +of the two-letter names identifying members of the 960 family; the +option specifies the desired output target, and warns of any +incompatible instructions in the input files. It also modifies the +linker's search strategy for archive libraries, to support the use of +libraries specific to each particular architecture, by including in the +search loop names suffixed with the string identifying the architecture. + + For example, if your `ld' command line included `-ACA' as well as +`-ltry', the linker would look (in its built-in search paths, and in +any paths you specify with `-L') for a library with the names + + try + libtry.a + tryca + libtryca.a + +The first two possibilities would be considered in any event; the last +two are due to the use of `-ACA'. + + You can meaningfully use `-A' more than once on a command line, since +the 960 architecture family allows combination of target architectures; +each use will add another pair of name variants to search for when `-l' +specifies a library. + + `ld' supports the `--relax' option for the i960 family. If you +specify `--relax', `ld' finds all `balx' and `calx' instructions whose +targets are within 24 bits, and turns them into 24-bit program-counter +relative `bal' and `cal' instructions, respectively. `ld' also turns +`cal' instructions into `bal' instructions when it determines that the +target subroutine is a leaf routine (that is, the target subroutine does +not itself call any subroutines). + + +File: ld.info, Node: BFD, Next: Reporting Bugs, Prev: Machine Dependent, Up: Top + +BFD +*** + + The linker accesses object and archive files using the BFD libraries. +These libraries allow the linker to use the same routines to operate on +object files whatever the object file format. A different object file +format can be supported simply by creating a new BFD back end and adding +it to the library. To conserve runtime memory, however, the linker and +associated tools are usually configured to support only a subset of the +object file formats available. You can use `objdump -i' (*note +objdump: (binutils.info)objdump.) to list all the formats available for +your configuration. + + As with most implementations, BFD is a compromise between several +conflicting requirements. The major factor influencing BFD design was +efficiency: any time used converting between formats is time which +would not have been spent had BFD not been involved. This is partly +offset by abstraction payback; since BFD simplifies applications and +back ends, more time and care may be spent optimizing algorithms for a +greater speed. + + One minor artifact of the BFD solution which you should bear in mind +is the potential for information loss. There are two places where +useful information can be lost using the BFD mechanism: during +conversion and during output. *Note BFD information loss::. + +* Menu: + +* BFD outline:: How it works: an outline of BFD + + +File: ld.info, Node: BFD outline, Up: BFD + +How it works: an outline of BFD +=============================== + + When an object file is opened, BFD subroutines automatically +determine the format of the input object file. They then build a +descriptor in memory with pointers to routines that will be used to +access elements of the object file's data structures. + + As different information from the the object files is required, BFD +reads from different sections of the file and processes them. For +example, a very common operation for the linker is processing symbol +tables. Each BFD back end provides a routine for converting between +the object file's representation of symbols and an internal canonical +format. When the linker asks for the symbol table of an object file, it +calls through a memory pointer to the routine from the relevant BFD +back end which reads and converts the table into a canonical form. The +linker then operates upon the canonical form. When the link is finished +and the linker writes the output file's symbol table, another BFD back +end routine is called to take the newly created symbol table and +convert it into the chosen output format. + +* Menu: + +* BFD information loss:: Information Loss +* Canonical format:: The BFD canonical object-file format + + +File: ld.info, Node: BFD information loss, Next: Canonical format, Up: BFD outline + +Information Loss +---------------- + + *Information can be lost during output.* The output formats +supported by BFD do not provide identical facilities, and information +which can be described in one form has nowhere to go in another format. +One example of this is alignment information in `b.out'. There is +nowhere in an `a.out' format file to store alignment information on the +contained data, so when a file is linked from `b.out' and an `a.out' +image is produced, alignment information will not propagate to the +output file. (The linker will still use the alignment information +internally, so the link is performed correctly). + + Another example is COFF section names. COFF files may contain an +unlimited number of sections, each one with a textual section name. If +the target of the link is a format which does not have many sections +(e.g., `a.out') or has sections without names (e.g., the Oasys format), +the link cannot be done simply. You can circumvent this problem by +describing the desired input-to-output section mapping with the linker +command language. + + *Information can be lost during canonicalization.* The BFD internal +canonical form of the external formats is not exhaustive; there are +structures in input formats for which there is no direct representation +internally. This means that the BFD back ends cannot maintain all +possible data richness through the transformation between external to +internal and back to external formats. + + This limitation is only a problem when an application reads one +format and writes another. Each BFD back end is responsible for +maintaining as much data as possible, and the internal BFD canonical +form has structures which are opaque to the BFD core, and exported only +to the back ends. When a file is read in one format, the canonical form +is generated for BFD and the application. At the same time, the back +end saves away any information which may otherwise be lost. If the data +is then written back in the same format, the back end routine will be +able to use the canonical form provided by the BFD core as well as the +information it prepared earlier. Since there is a great deal of +commonality between back ends, there is no information lost when +linking or copying big endian COFF to little endian COFF, or `a.out' to +`b.out'. When a mixture of formats is linked, the information is only +lost from the files whose format differs from the destination. + + +File: ld.info, Node: Canonical format, Prev: BFD information loss, Up: BFD outline + +The BFD canonical object-file format +------------------------------------ + + The greatest potential for loss of information occurs when there is +the least overlap between the information provided by the source +format, that stored by the canonical format, and that needed by the +destination format. A brief description of the canonical form may help +you understand which kinds of data you can count on preserving across +conversions. + +*files* + Information stored on a per-file basis includes target machine + architecture, particular implementation format type, a demand + pageable bit, and a write protected bit. Information like Unix + magic numbers is not stored here--only the magic numbers' meaning, + so a `ZMAGIC' file would have both the demand pageable bit and the + write protected text bit set. The byte order of the target is + stored on a per-file basis, so that big- and little-endian object + files may be used with one another. + +*sections* + Each section in the input file contains the name of the section, + the section's original address in the object file, size and + alignment information, various flags, and pointers into other BFD + data structures. + +*symbols* + Each symbol contains a pointer to the information for the object + file which originally defined it, its name, its value, and various + flag bits. When a BFD back end reads in a symbol table, it + relocates all symbols to make them relative to the base of the + section where they were defined. Doing this ensures that each + symbol points to its containing section. Each symbol also has a + varying amount of hidden private data for the BFD back end. Since + the symbol points to the original file, the private data format + for that symbol is accessible. `ld' can operate on a collection + of symbols of wildly different formats without problems. + + Normal global and simple local symbols are maintained on output, + so an output file (no matter its format) will retain symbols + pointing to functions and to global, static, and common variables. + Some symbol information is not worth retaining; in `a.out', type + information is stored in the symbol table as long symbol names. + This information would be useless to most COFF debuggers; the + linker has command line switches to allow users to throw it away. + + There is one word of type information within the symbol, so if the + format supports symbol type information within symbols (for + example, COFF, IEEE, Oasys) and the type is simple enough to fit + within one word (nearly everything but aggregates), the + information will be preserved. + +*relocation level* + Each canonical BFD relocation record contains a pointer to the + symbol to relocate to, the offset of the data to relocate, the + section the data is in, and a pointer to a relocation type + descriptor. Relocation is performed by passing messages through + the relocation type descriptor and the symbol pointer. Therefore, + relocations can be performed on output data using a relocation + method that is only available in one of the input formats. For + instance, Oasys provides a byte relocation format. A relocation + record requesting this relocation type would point indirectly to a + routine to perform this, so the relocation may be performed on a + byte being written to a 68k COFF file, even though 68k COFF has no + such relocation type. + +*line numbers* + Object formats can contain, for debugging purposes, some form of + mapping between symbols, source line numbers, and addresses in the + output file. These addresses have to be relocated along with the + symbol information. Each symbol with an associated list of line + number records points to the first record of the list. The head + of a line number list consists of a pointer to the symbol, which + allows finding out the address of the function whose line number + is being described. The rest of the list is made up of pairs: + offsets into the section and line numbers. Any format which can + simply derive this information can pass it successfully between + formats (COFF, IEEE and Oasys). + + +File: ld.info, Node: Reporting Bugs, Next: MRI, Prev: BFD, Up: Top + +Reporting Bugs +************** + + Your bug reports play an essential role in making `ld' reliable. + + Reporting a bug may help you by bringing a solution to your problem, +or it may not. But in any case the principal function of a bug report +is to help the entire community by making the next version of `ld' work +better. Bug reports are your contribution to the maintenance of `ld'. + + In order for a bug report to serve its purpose, you must include the +information that enables us to fix the bug. + +* Menu: + +* Bug Criteria:: Have you found a bug? +* Bug Reporting:: How to report bugs + + +File: ld.info, Node: Bug Criteria, Next: Bug Reporting, Up: Reporting Bugs + +Have you found a bug? +===================== + + If you are not sure whether you have found a bug, here are some +guidelines: + + * If the linker gets a fatal signal, for any input whatever, that is + a `ld' bug. Reliable linkers never crash. + + * If `ld' produces an error message for valid input, that is a bug. + + * If `ld' does not produce an error message for invalid input, that + may be a bug. In the general case, the linker can not verify that + object files are correct. + + * If you are an experienced user of linkers, your suggestions for + improvement of `ld' are welcome in any case. + + +File: ld.info, Node: Bug Reporting, Prev: Bug Criteria, Up: Reporting Bugs + +How to report bugs +================== + + A number of companies and individuals offer support for GNU +products. If you obtained `ld' from a support organization, we +recommend you contact that organization first. + + You can find contact information for many support companies and +individuals in the file `etc/SERVICE' in the GNU Emacs distribution. + + In any event, we also recommend that you send bug reports for `ld' +to `bug-gnu-utils@prep.ai.mit.edu'. + + The fundamental principle of reporting bugs usefully is this: +*report all the facts*. If you are not sure whether to state a fact or +leave it out, state it! + + Often people omit facts because they think they know what causes the +problem and assume that some details do not matter. Thus, you might +assume that the name of a symbol you use in an example does not matter. +Well, probably it does not, but one cannot be sure. Perhaps the bug is +a stray memory reference which happens to fetch from the location where +that name is stored in memory; perhaps, if the name were different, the +contents of that location would fool the linker into doing the right +thing despite the bug. Play it safe and give a specific, complete +example. That is the easiest thing for you to do, and the most helpful. + + Keep in mind that the purpose of a bug report is to enable us to fix +the bug if it is new to us. Therefore, always write your bug reports +on the assumption that the bug has not been reported previously. + + Sometimes people give a few sketchy facts and ask, "Does this ring a +bell?" Those bug reports are useless, and we urge everyone to *refuse +to respond to them* except to chide the sender to report bugs properly. + + To enable us to fix the bug, you should include all these things: + + * The version of `ld'. `ld' announces it if you start it with the + `--version' argument. + + Without this, we will not know whether there is any point in + looking for the bug in the current version of `ld'. + + * Any patches you may have applied to the `ld' source, including any + patches made to the `BFD' library. + + * The type of machine you are using, and the operating system name + and version number. + + * What compiler (and its version) was used to compile `ld'--e.g. + "`gcc-2.7'". + + * The command arguments you gave the linker to link your example and + observe the bug. To guarantee you will not omit something + important, list them all. A copy of the Makefile (or the output + from make) is sufficient. + + If we were to try to guess the arguments, we would probably guess + wrong and then we might not encounter the bug. + + * A complete input file, or set of input files, that will reproduce + the bug. It is generally most helpful to send the actual object + files, uuencoded if necessary to get them through the mail system. + Making them available for anonymous FTP is not as good, but may + be the only reasonable choice for large object files. + + If the source files were assembled using `gas' or compiled using + `gcc', then it may be OK to send the source files rather than the + object files. In this case, be sure to say exactly what version of + `gas' or `gcc' was used to produce the object files. Also say how + `gas' or `gcc' were configured. + + * A description of what behavior you observe that you believe is + incorrect. For example, "It gets a fatal signal." + + Of course, if the bug is that `ld' gets a fatal signal, then we + will certainly notice it. But if the bug is incorrect output, we + might not notice unless it is glaringly wrong. You might as well + not give us a chance to make a mistake. + + Even if the problem you experience is a fatal signal, you should + still say so explicitly. Suppose something strange is going on, + such as, your copy of `ld' is out of synch, or you have + encountered a bug in the C library on your system. (This has + happened!) Your copy might crash and ours would not. If you told + us to expect a crash, then when ours fails to crash, we would know + that the bug was not happening for us. If you had not told us to + expect a crash, then we would not be able to draw any conclusion + from our observations. + + * If you wish to suggest changes to the `ld' source, send us context + diffs, as generated by `diff' with the `-u', `-c', or `-p' option. + Always send diffs from the old file to the new file. If you even + discuss something in the `ld' source, refer to it by context, not + by line number. + + The line numbers in our development sources will not match those + in your sources. Your line numbers would convey no useful + information to us. + + Here are some things that are not necessary: + + * A description of the envelope of the bug. + + Often people who encounter a bug spend a lot of time investigating + which changes to the input file will make the bug go away and which + changes will not affect it. + + This is often time consuming and not very useful, because the way + we will find the bug is by running a single example under the + debugger with breakpoints, not by pure deduction from a series of + examples. We recommend that you save your time for something else. + + Of course, if you can find a simpler example to report *instead* + of the original one, that is a convenience for us. Errors in the + output will be easier to spot, running under the debugger will take + less time, and so on. + + However, simplification is not vital; if you do not want to do + this, report the bug anyway and send us the entire test case you + used. + + * A patch for the bug. + + A patch for the bug does help us if it is a good one. But do not + omit the necessary information, such as the test case, on the + assumption that a patch is all we need. We might see problems + with your patch and decide to fix the problem another way, or we + might not understand it at all. + + Sometimes with a program as complicated as `ld' it is very hard to + construct an example that will make the program follow a certain + path through the code. If you do not send us the example, we will + not be able to construct one, so we will not be able to verify + that the bug is fixed. + + And if we cannot understand what bug you are trying to fix, or why + your patch should be an improvement, we will not install it. A + test case will help us to understand. + + * A guess about what the bug is or what it depends on. + + Such guesses are usually wrong. Even we cannot guess right about + such things without first using the debugger to find the facts. + + +File: ld.info, Node: MRI, Next: Index, Prev: Reporting Bugs, Up: Top MRI Compatible Script Files *************************** @@ -139,376 +750,4 @@ specify the start address (EXPRESSION) for section SECNAME. If you have more than one `SECT' statement for the same SECNAME, only the *first* sets the start address. - - -File: ld.info, Node: Index, Prev: MRI, Up: Top - -Index -***** - -* Menu: - -* ": Symbols. -* *( COMMON ): Section Placement. -* *(SECTION): Section Placement. -* -(: Options. -* -architecture=ARCH: Options. -* -cref: Options. -* -defsym SYMBOL=EXP: Options. -* -discard-all: Options. -* -discard-locals: Options. -* -dynamic-linker FILE: Options. -* -entry=ENTRY: Options. -* -force-exe-suffix: Options. -* -format=FORMAT: Options. -* -gpsize: Options. -* -help: Options. -* -just-symbols=FILE: Options. -* -library-path=DIR: Options. -* -library=ARCHIVE: Options. -* -mri-script=MRI-CMDFILE: Options. -* -nmagic: Options. -* -no-keep-memory: Options. -* -no-whole-archive: Options. -* -noinhibit-exec: Options. -* -omagic: Options. -* -output=OUTPUT: Options. -* -print-map: Options. -* -relax: Options. -* -relocateable: Options. -* -script=SCRIPT: Options. -* -sort-common: Options. -* -split-by-file: Options. -* -split-by-reloc: Options. -* -stats: Options. -* -strip-all: Options. -* -strip-debug: Options. -* -trace: Options. -* -trace-symbol=SYMBOL: Options. -* -undefined=SYMBOL: Options. -* -verbose: Options. -* -version: Options. -* -whole-archive: Options. -* -wrap: Options. -* -AARCH: Options. -* -aKEYWORD: Options. -* -assert KEYWORD: Options. -* -b FORMAT: Options. -* -Bdynamic: Options. -* -Bshareable: Options. -* -Bstatic: Options. -* -Bsymbolic: Options. -* -c MRI-CMDFILE: Options. -* -call_shared: Options. -* -d: Options. -* -dc: Options. -* -dn: Options. -* -dp: Options. -* -dy: Options. -* -E: Options. -* -e ENTRY: Options. -* -EB: Options. -* -EL: Options. -* -embedded-relocs: Options. -* -export-dynamic: Options. -* -F: Options. -* -g: Options. -* -G: Options. -* -hNAME: Options. -* -i: Options. -* -lARCHIVE: Options. -* -LDIR: Options. -* -M: Options. -* -m EMULATION: Options. -* -Map: Options. -* -n: Options. -* -N: Options. -* -non_shared: Options. -* -o OUTPUT: Options. -* -oformat: Options. -* -qmagic: Options. -* -Qy: Options. -* -r: Options. -* -R FILE: Options. -* -rpath: Options. -* -rpath-link: Options. -* -s: Options. -* -S: Options. -* -shared: Options. -* -soname=NAME: Options. -* -static: Options. -* -t: Options. -* -T SCRIPT: Options. -* -Tbss ORG: Options. -* -Tdata ORG: Options. -* -traditional-format: Options. -* -Ttext ORG: Options. -* -u SYMBOL: Options. -* -Ur: Options. -* -v: Options. -* -V: Options. -* -warn-comon: Options. -* -warn-constructors: Options. -* -warn-multiple-gp: Options. -* -warn-once: Options. -* -X: Options. -* -x: Options. -* -Y PATH: Options. -* -y SYMBOL: Options. -* -z KEYWORD: Options. -* .: Location Counter. -* 0x: Integers. -* :PHDR: Section Options. -* ;: Assignment. -* =FILL: Section Options. -* >REGION: Section Options. -* -relax on i960: i960. -* ABSOLUTE (MRI): MRI. -* ALIAS (MRI): MRI. -* ALIGN (MRI): MRI. -* BASE (MRI): MRI. -* CHIP (MRI): MRI. -* END (MRI): MRI. -* FORMAT (MRI): MRI. -* LIST (MRI): MRI. -* LOAD (MRI): MRI. -* NAME (MRI): MRI. -* ORDER (MRI): MRI. -* PUBLIC (MRI): MRI. -* SECT (MRI): MRI. -* [SECTION...], not supported: Section Placement. -* GNU linker: Overview. -* FILENAME: Section Placement. -* FILENAME(SECTION): Section Placement. -* SYMBOL = EXPRESSION ;: Section Data Expressions. -* SYMBOL F= EXPRESSION ;: Section Data Expressions. -* absolute and relocatable symbols: Assignment. -* ABSOLUTE(EXP): Arithmetic Functions. -* ADDR(SECTION): Arithmetic Functions. -* ALIGN(EXP): Arithmetic Functions. -* aligning sections: Section Options. -* allocating memory: MEMORY. -* architectures: Options. -* archive files, from cmd line: Options. -* arithmetic: Expressions. -* arithmetic operators: Operators. -* assignment in scripts: Assignment. -* assignment, in section defn: Section Data Expressions. -* AT ( LDADR ): Section Options. -* back end: BFD. -* BFD canonical format: Canonical format. -* BFD requirements: BFD. -* big-endian objects: Options. -* binary input files: Option Commands. -* binary input format: Options. -* BLOCK(ALIGN): Section Options. -* BYTE(EXPRESSION): Section Data Expressions. -* C++ constructors, arranging in link: Option Commands. -* combining symbols, warnings on: Options. -* command files: Commands. -* command line: Options. -* commands, fundamental: Scripts. -* comments: Scripts. -* common allocation: Option Commands. -* common allocation: Options. -* commons in output: Section Placement. -* compatibility, MRI: Options. -* CONSTRUCTORS: Option Commands. -* constructors: Options. -* constructors, arranging in link: Option Commands. -* contents of a section: Section Placement. -* CREATE_OBJECT_SYMBOLS: Section Data Expressions. -* cross reference table: Options. -* current output location: Location Counter. -* dbx: Options. -* decimal integers: Integers. -* default input format: Environment. -* DEFINED(SYMBOL): Arithmetic Functions. -* deleting local symbols: Options. -* direct output: Section Data Expressions. -* discontinuous memory: MEMORY. -* dot: Location Counter. -* dynamic linker, from command line: Options. -* dynamic symbol table: Options. -* ELF program headers: PHDRS. -* emulation: Options. -* endianness: Options. -* entry point, defaults: Entry Point. -* entry point, from command line: Options. -* ENTRY(SYMBOL): Entry Point. -* expression evaluation order: Evaluation. -* expression syntax: Expressions. -* expression, absolute: Arithmetic Functions. -* expressions in a section: Section Data Expressions. -* filename symbols: Section Data Expressions. -* files and sections, section defn: Section Placement. -* files, including in output sections: Section Placement. -* fill pattern, entire section: Section Options. -* FILL(EXPRESSION): Section Data Expressions. -* first input file: Option Commands. -* first instruction: Entry Point. -* FLOAT: Option Commands. -* FORCE_COMMON_ALLOCATION: Option Commands. -* format, output file: Option Commands. -* functions in expression language: Arithmetic Functions. -* fundamental script commands: Scripts. -* GNUTARGET: Option Commands. -* GNUTARGET: Environment. -* GROUP ( FILES ): Option Commands. -* grouping input files: Option Commands. -* groups of archives: Options. -* H8/300 support: H8/300. -* header size: Arithmetic Functions. -* help: Options. -* hexadecimal integers: Integers. -* holes: Location Counter. -* holes, filling: Section Data Expressions. -* i960 support: i960. -* including an entire archive: Options. -* incremental link: Options. -* INPUT ( FILES ): Option Commands. -* input file format: Option Commands. -* input filename symbols: Section Data Expressions. -* input files, displaying: Options. -* input files, section defn: Section Placement. -* input format: Options. -* input format: Options. -* input sections to output section: Section Placement. -* integer notation: Integers. -* integer suffixes: Integers. -* internal object-file format: Canonical format. -* K and M integer suffixes: Integers. -* l =: MEMORY. -* L, deleting symbols beginning: Options. -* layout of output file: Scripts. -* lazy evaluation: Evaluation. -* len =: MEMORY. -* LENGTH =: MEMORY. -* link map: Options. -* link map: Options. -* link-time runtime library search path: Options. -* little-endian objects: Options. -* load address, specifying: Section Options. -* loading, preventing: Section Options. -* local symbols, deleting: Options. -* location counter: Location Counter. -* LONG(EXPRESSION): Section Data Expressions. -* M and K integer suffixes: Integers. -* machine architecture, output: Option Commands. -* machine dependencies: Machine Dependent. -* MEMORY: MEMORY. -* memory region attributes: MEMORY. -* memory regions and sections: Section Options. -* memory usage: Options. -* MIPS embedded PIC code: Options. -* MRI compatibility: MRI. -* names: Symbols. -* naming memory regions: MEMORY. -* naming output sections: Section Definition. -* naming the output file: Option Commands. -* naming the output file: Options. -* negative integers: Integers. -* NEXT(EXP): Arithmetic Functions. -* NMAGIC: Options. -* NOFLOAT: Option Commands. -* NOLOAD: Section Options. -* Non constant expression: Assignment. -* o =: MEMORY. -* objdump -i: BFD. -* object file management: BFD. -* object files: Options. -* object formats available: BFD. -* object size: Options. -* octal integers: Integers. -* OMAGIC: Options. -* opening object files: BFD outline. -* Operators for arithmetic: Operators. -* options: Options. -* org =: MEMORY. -* ORIGIN =: MEMORY. -* OUTPUT ( FILENAME ): Option Commands. -* output file after errors: Options. -* output file layout: Scripts. -* OUTPUT_ARCH ( BFDNAME ): Option Commands. -* OUTPUT_FORMAT ( BFDNAME ): Option Commands. -* partial link: Options. -* path for libraries: Option Commands. -* PHDRS: PHDRS. -* precedence in expressions: Operators. -* prevent unnecessary loading: Section Options. -* program headers: PHDRS. -* program headers and sections: Section Options. -* provide: Assignment. -* QUAD(EXPRESSION): Section Data Expressions. -* quoted symbol names: Symbols. -* read-only text: Options. -* read/write from cmd line: Options. -* regions of memory: MEMORY. -* relaxing addressing modes: Options. -* relaxing on H8/300: H8/300. -* relaxing on i960: i960. -* relocatable and absolute symbols: Assignment. -* relocatable output: Options. -* requirements for BFD: BFD. -* retaining specified symbols: Options. -* rounding up location counter: Arithmetic Functions. -* runtime library name: Options. -* runtime library search path: Options. -* scaled integers: Integers. -* script files: Options. -* search directory, from cmd line: Options. -* search path, libraries: Option Commands. -* SEARCH_DIR ( PATH ): Option Commands. -* section address: Section Options. -* section address: Arithmetic Functions. -* section alignment: Section Options. -* section definition: Section Definition. -* section defn, full syntax: Section Options. -* section fill pattern: Section Options. -* section size: Arithmetic Functions. -* section start: Section Options. -* section, assigning to memory region: Section Options. -* section, assigning to program header: Section Options. -* SECTIONS: SECTIONS. -* segment origins, cmd line: Options. -* semicolon: Assignment. -* shared libraries: Options. -* SHORT(EXPRESSION): Section Data Expressions. -* SIZEOF(SECTION): Arithmetic Functions. -* SIZEOF_HEADERS: Arithmetic Functions. -* sizeof_headers: Arithmetic Functions. -* specify load address: Section Options. -* standard Unix system: Options. -* start address, section: Section Options. -* start of execution: Entry Point. -* STARTUP ( FILENAME ): Option Commands. -* strip all symbols: Options. -* strip debugger symbols: Options. -* stripping all but some symbols: Options. -* suffixes for integers: Integers. -* symbol defaults: Arithmetic Functions. -* symbol definition, scripts: Assignment. -* symbol names: Symbols. -* symbol tracing: Options. -* symbol-only input: Options. -* symbols, from command line: Options. -* symbols, relocatable and absolute: Assignment. -* symbols, retaining selectively: Options. -* synthesizing linker: Options. -* synthesizing on H8/300: H8/300. -* TARGET ( FORMAT ): Option Commands. -* traditional format: Options. -* unallocated address, next: Arithmetic Functions. -* undefined symbol: Options. -* undefined symbols, warnings on: Options. -* uninitialized data: Section Placement. -* unspecified memory: Section Data Expressions. -* usage: Options. -* variables, defining: Assignment. -* verbose: Options. -* version: Options. -* warnings, on combining symbols: Options. -* warnings, on undefined symbols: Options. -* what is this?: Overview. - diff -urN binutils-2.7/ld/ld.info-4 binutils-2.8/ld/ld.info-4 --- binutils-2.7/ld/ld.info-4 Wed Dec 31 19:00:00 1969 +++ binutils-2.8/ld/ld.info-4 Wed Apr 30 13:15:26 1997 @@ -0,0 +1,420 @@ +This is Info file ld.info, produced by Makeinfo-1.64 from the input +file ./ld.texinfo. + +START-INFO-DIR-ENTRY +* Ld: (ld). The GNU linker. +END-INFO-DIR-ENTRY + + This file documents the GNU linker LD. + + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software +Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, provided also +that the entire resulting derived work is distributed under the terms +of a permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions. + + +File: ld.info, Node: Index, Prev: MRI, Up: Top + +Index +***** + +* Menu: + +* ": Symbols. +* *( COMMON ): Section Placement. +* *(SECTION): Section Placement. +* -(: Options. +* -architecture=ARCH: Options. +* -auxiliary: Options. +* -cref: Options. +* -defsym SYMBOL=EXP: Options. +* -discard-all: Options. +* -discard-locals: Options. +* -dynamic-linker FILE: Options. +* -embedded-relocs: Options. +* -entry=ENTRY: Options. +* -export-dynamic: Options. +* -filter: Options. +* -force-exe-suffix: Options. +* -format=FORMAT: Options. +* -gpsize: Options. +* -help: Options. +* -just-symbols=FILE: Options. +* -library-path=DIR: Options. +* -library=ARCHIVE: Options. +* -mri-script=MRI-CMDFILE: Options. +* -nmagic: Options. +* -no-keep-memory: Options. +* -no-whole-archive: Options. +* -noinhibit-exec: Options. +* -oformat: Options. +* -omagic: Options. +* -output=OUTPUT: Options. +* -print-map: Options. +* -relax: Options. +* -relocateable: Options. +* -script=SCRIPT: Options. +* -sort-common: Options. +* -split-by-file: Options. +* -split-by-reloc: Options. +* -stats: Options. +* -strip-all: Options. +* -strip-debug: Options. +* -trace: Options. +* -trace-symbol=SYMBOL: Options. +* -traditional-format: Options. +* -undefined=SYMBOL: Options. +* -verbose: Options. +* -version: Options. +* -version-script=VERSION-SCRIPTFILE: Options. +* -warn-comon: Options. +* -warn-constructors: Options. +* -warn-multiple-gp: Options. +* -warn-once: Options. +* -warn-section-align: Options. +* -whole-archive: Options. +* -wrap: Options. +* -AARCH: Options. +* -aKEYWORD: Options. +* -assert KEYWORD: Options. +* -b FORMAT: Options. +* -Bdynamic: Options. +* -Bshareable: Options. +* -Bstatic: Options. +* -Bsymbolic: Options. +* -c MRI-CMDFILE: Options. +* -call_shared: Options. +* -d: Options. +* -dc: Options. +* -dn: Options. +* -dp: Options. +* -dy: Options. +* -E: Options. +* -e ENTRY: Options. +* -EB: Options. +* -EL: Options. +* -f: Options. +* -G: Options. +* -hNAME: Options. +* -i: Options. +* -lARCHIVE: Options. +* -LDIR: Options. +* -M: Options. +* -m EMULATION: Options. +* -Map: Options. +* -n: Options. +* -non_shared: Options. +* -o OUTPUT: Options. +* -qmagic: Options. +* -Qy: Options. +* -r: Options. +* -R FILE: Options. +* -rpath: Options. +* -rpath-link: Options. +* -S: Options. +* -shared: Options. +* -soname=NAME: Options. +* -static: Options. +* -t: Options. +* -T SCRIPT: Options. +* -Tbss ORG: Options. +* -Tdata ORG: Options. +* -Ttext ORG: Options. +* -u SYMBOL: Options. +* -Ur: Options. +* -V: Options. +* -X: Options. +* -Y PATH: Options. +* -y SYMBOL: Options. +* -z KEYWORD: Options. +* .: Location Counter. +* 0x: Integers. +* :PHDR: Section Options. +* ;: Assignment. +* =FILL: Section Options. +* >REGION: Section Options. +* -relax on i960: i960. +* [SECTION...], not supported: Section Placement. +* ABSOLUTE (MRI): MRI. +* ALIAS (MRI): MRI. +* ALIGN (MRI): MRI. +* BASE (MRI): MRI. +* CHIP (MRI): MRI. +* END (MRI): MRI. +* FORMAT (MRI): MRI. +* ld bugs, reporting: Bug Reporting. +* LIST (MRI): MRI. +* LOAD (MRI): MRI. +* NAME (MRI): MRI. +* ORDER (MRI): MRI. +* PUBLIC (MRI): MRI. +* SECT (MRI): MRI. +* GNU linker: Overview. +* FILENAME: Section Placement. +* FILENAME(SECTION): Section Placement. +* SYMBOL = EXPRESSION ;: Section Data Expressions. +* SYMBOL F= EXPRESSION ;: Section Data Expressions. +* absolute and relocatable symbols: Assignment. +* ABSOLUTE(EXP): Arithmetic Functions. +* ADDR(SECTION): Arithmetic Functions. +* ALIGN(EXP): Arithmetic Functions. +* aligning sections: Section Options. +* allocating memory: MEMORY. +* architectures: Options. +* archive files, from cmd line: Options. +* arithmetic: Expressions. +* arithmetic operators: Operators. +* assignment in scripts: Assignment. +* assignment, in section defn: Section Data Expressions. +* AT ( LDADR ): Section Options. +* back end: BFD. +* BFD canonical format: Canonical format. +* BFD requirements: BFD. +* big-endian objects: Options. +* binary input files: Option Commands. +* binary input format: Options. +* BLOCK(ALIGN): Section Options. +* bug criteria: Bug Criteria. +* bug reports: Bug Reporting. +* bugs in ld: Reporting Bugs. +* BYTE(EXPRESSION): Section Data Expressions. +* C++ constructors, arranging in link: Option Commands. +* combining symbols, warnings on: Options. +* command files: Commands. +* command line: Options. +* commands, fundamental: Scripts. +* comments: Scripts. +* common allocation <1>: Option Commands. +* common allocation: Options. +* commons in output: Section Placement. +* compatibility, MRI: Options. +* CONSTRUCTORS: Option Commands. +* constructors: Options. +* constructors, arranging in link: Option Commands. +* contents of a section: Section Placement. +* crash of linker: Bug Criteria. +* CREATE_OBJECT_SYMBOLS: Section Data Expressions. +* cross reference table: Options. +* cross references: Option Commands. +* current output location: Location Counter. +* dbx: Options. +* decimal integers: Integers. +* default input format: Environment. +* DEFINED(SYMBOL): Arithmetic Functions. +* deleting local symbols: Options. +* direct output: Section Data Expressions. +* discontinuous memory: MEMORY. +* dot: Location Counter. +* dynamic linker, from command line: Options. +* dynamic symbol table: Options. +* ELF program headers: PHDRS. +* emulation: Options. +* endianness: Options. +* entry point, defaults: Entry Point. +* entry point, from command line: Options. +* ENTRY(SYMBOL): Entry Point. +* error on valid input: Bug Criteria. +* expression evaluation order: Evaluation. +* expression syntax: Expressions. +* expression, absolute: Arithmetic Functions. +* expressions in a section: Section Data Expressions. +* fatal signal: Bug Criteria. +* filename symbols: Section Data Expressions. +* files and sections, section defn: Section Placement. +* files, including in output sections: Section Placement. +* fill pattern, entire section: Section Options. +* FILL(EXPRESSION): Section Data Expressions. +* first input file: Option Commands. +* first instruction: Entry Point. +* FLOAT: Option Commands. +* FORCE_COMMON_ALLOCATION: Option Commands. +* format, output file: Option Commands. +* functions in expression language: Arithmetic Functions. +* fundamental script commands: Scripts. +* GNUTARGET <1>: Option Commands. +* GNUTARGET: Environment. +* GROUP ( FILES ): Option Commands. +* grouping input files: Option Commands. +* groups of archives: Options. +* H8/300 support: H8/300. +* header size: Arithmetic Functions. +* help: Options. +* hexadecimal integers: Integers. +* holes: Location Counter. +* holes, filling: Section Data Expressions. +* i960 support: i960. +* INCLUDE FILENAME: Option Commands. +* including a linker script: Option Commands. +* including an entire archive: Options. +* incremental link: Options. +* INPUT ( FILES ): Option Commands. +* input file format: Option Commands. +* input filename symbols: Section Data Expressions. +* input files, displaying: Options. +* input files, section defn: Section Placement. +* input format: Options. +* input sections to output section: Section Placement. +* integer notation: Integers. +* integer suffixes: Integers. +* internal object-file format: Canonical format. +* invalid input: Bug Criteria. +* K and M integer suffixes: Integers. +* l =: MEMORY. +* L, deleting symbols beginning: Options. +* layout of output file: Scripts. +* lazy evaluation: Evaluation. +* len =: MEMORY. +* LENGTH =: MEMORY. +* link map: Options. +* link-time runtime library search path: Options. +* linker crash: Bug Criteria. +* little-endian objects: Options. +* load address, specifying: Section Options. +* LOADADDR(SECTION): Arithmetic Functions. +* loading, preventing: Section Options. +* local symbols, deleting: Options. +* location counter: Location Counter. +* LONG(EXPRESSION): Section Data Expressions. +* M and K integer suffixes: Integers. +* machine architecture, output: Option Commands. +* machine dependencies: Machine Dependent. +* MAX: Arithmetic Functions. +* MEMORY: MEMORY. +* memory region attributes: MEMORY. +* memory regions and sections: Section Options. +* memory usage: Options. +* MIN: Arithmetic Functions. +* MIPS embedded PIC code: Options. +* MRI compatibility: MRI. +* names: Symbols. +* naming memory regions: MEMORY. +* naming output sections: Section Definition. +* naming the output file <1>: Option Commands. +* naming the output file: Options. +* negative integers: Integers. +* NEXT(EXP): Arithmetic Functions. +* NMAGIC: Options. +* NOCROSSREFS ( SECTIONS ): Option Commands. +* NOFLOAT: Option Commands. +* NOLOAD: Section Options. +* Non constant expression: Assignment. +* o =: MEMORY. +* objdump -i: BFD. +* object file management: BFD. +* object files: Options. +* object formats available: BFD. +* object size: Options. +* octal integers: Integers. +* OMAGIC: Options. +* opening object files: BFD outline. +* Operators for arithmetic: Operators. +* options: Options. +* org =: MEMORY. +* ORIGIN =: MEMORY. +* OUTPUT ( FILENAME ): Option Commands. +* output file after errors: Options. +* output file layout: Scripts. +* OUTPUT_ARCH ( BFDNAME ): Option Commands. +* OUTPUT_FORMAT ( BFDNAME ): Option Commands. +* OVERLAY: Overlays. +* overlays: Overlays. +* partial link: Options. +* path for libraries: Option Commands. +* PHDRS: PHDRS. +* precedence in expressions: Operators. +* prevent unnecessary loading: Section Options. +* program headers: PHDRS. +* program headers and sections: Section Options. +* provide: Assignment. +* QUAD(EXPRESSION): Section Data Expressions. +* quoted symbol names: Symbols. +* read-only text: Options. +* read/write from cmd line: Options. +* regions of memory: MEMORY. +* relaxing addressing modes: Options. +* relaxing on H8/300: H8/300. +* relaxing on i960: i960. +* relocatable and absolute symbols: Assignment. +* relocatable output: Options. +* reporting bugs in ld: Reporting Bugs. +* requirements for BFD: BFD. +* retaining specified symbols: Options. +* rounding up location counter: Arithmetic Functions. +* runtime library name: Options. +* runtime library search path: Options. +* scaled integers: Integers. +* script files: Options. +* search directory, from cmd line: Options. +* search path, libraries: Option Commands. +* SEARCH_DIR ( PATH ): Option Commands. +* section address <1>: Arithmetic Functions. +* section address: Section Options. +* section alignment: Section Options. +* section alignment, warnings on: Options. +* section definition: Section Definition. +* section defn, full syntax: Section Options. +* section fill pattern: Section Options. +* section load address: Arithmetic Functions. +* section size: Arithmetic Functions. +* section start: Section Options. +* section, assigning to memory region: Section Options. +* section, assigning to program header: Section Options. +* SECTIONS: SECTIONS. +* segment origins, cmd line: Options. +* semicolon: Assignment. +* shared libraries: Options. +* SHORT(EXPRESSION): Section Data Expressions. +* SIZEOF(SECTION): Arithmetic Functions. +* sizeof_headers: Arithmetic Functions. +* specify load address: Section Options. +* standard Unix system: Options. +* start address, section: Section Options. +* start of execution: Entry Point. +* STARTUP ( FILENAME ): Option Commands. +* strip all symbols: Options. +* strip debugger symbols: Options. +* stripping all but some symbols: Options. +* suffixes for integers: Integers. +* symbol defaults: Arithmetic Functions. +* symbol definition, scripts: Assignment. +* symbol names: Symbols. +* symbol tracing: Options. +* symbol versions: Version Script. +* symbol-only input: Options. +* symbols, from command line: Options. +* symbols, relocatable and absolute: Assignment. +* symbols, retaining selectively: Options. +* synthesizing linker: Options. +* synthesizing on H8/300: H8/300. +* TARGET ( FORMAT ): Option Commands. +* traditional format: Options. +* unallocated address, next: Arithmetic Functions. +* undefined symbol: Options. +* undefined symbols, warnings on: Options. +* uninitialized data: Section Placement. +* unspecified memory: Section Data Expressions. +* usage: Options. +* variables, defining: Assignment. +* verbose: Options. +* version: Options. +* VERSION {script text}: Version Script. +* version script: Version Script. +* version script, symbol versions: Options. +* versions of symbols: Version Script. +* warnings, on combining symbols: Options. +* warnings, on section alignment: Options. +* warnings, on undefined symbols: Options. +* what is this?: Overview. + + diff -urN binutils-2.7/ld/ld.texinfo binutils-2.8/ld/ld.texinfo --- binutils-2.7/ld/ld.texinfo Thu Jul 4 12:24:30 1996 +++ binutils-2.8/ld/ld.texinfo Wed Apr 30 12:57:48 1997 @@ -17,7 +17,7 @@ @ifinfo This file documents the @sc{gnu} linker LD. -Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -64,7 +64,7 @@ @end tex @vskip 0pt plus 1filll -Copyright @copyright{} 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -109,6 +109,7 @@ @end ifclear @c Following blank line required for remaining bug in makeinfo conds/menus +* Reporting Bugs:: Reporting Bugs * MRI:: MRI Compatible Script Files * Index:: Index @end menu @@ -201,7 +202,12 @@ linker script or the one specified by using @samp{-T}). This feature permits the linker to link against a file which appears to be an object or an archive, but actually merely defines some symbol values, or uses -@code{INPUT} or @code{GROUP} to load other objects. @xref{Commands}. +@code{INPUT} or @code{GROUP} to load other objects. Note that +specifying a script in this way should only be used to augment the main +linker script; if you want to use some command that logically can only +appear once, such as the @code{SECTIONS} or @code{MEMORY} command, you +must replace the default linker script using the @samp{-T} option. +@xref{Commands}. For options whose names are a single letter, option arguments must either follow the option letter without intervening @@ -210,7 +216,7 @@ For options whose names are multiple letters, either one dash or two can precede the option name; for example, @samp{--oformat} and -@samp{-oformat} are equivalent. Arguments to multiple-letter options +@samp{--oformat} are equivalent. Arguments to multiple-letter options must either be separated from the option name by an equals sign, or be given as separate arguments immediately following the option that requires them. For example, @samp{--oformat srec} and @@ -318,27 +324,60 @@ @cindex dynamic symbol table @kindex -E -@kindex -export-dynamic +@kindex --export-dynamic @item -E -@itemx -export-dynamic +@itemx --export-dynamic When creating a dynamically linked executable, add all symbols to the dynamic symbol table. Normally, the dynamic symbol table contains only symbols which are used by a dynamic object. This option is needed for some uses of @code{dlopen}. -@ifclear SingleFormat +@kindex -f +@kindex --auxiliary +@item -f +@itemx --auxiliary @var{name} +When creating an ELF shared object, set the internal DT_AUXILIARY field +to the specified name. This tells the dynamic linker that the symbol +table of the shared object should be used as an auxiliary filter on the +symbol table of the shared object @var{name}. + +If you later link a program against this filter object, then, when you +run the program, the dynamic linker will see the DT_AUXILIARY field. If +the dynamic linker resolves any symbols from the filter object, it will +first check whether there is a definition in the shared object +@var{name}. If there is one, it will be used instead of the definition +in the filter object. The shared object @var{name} need not exist. +Thus the shared object @var{name} may be used to provide an alternative +implementation of certain functions, perhaps for debugging or for +machine specific performance. + +This option may be specified more than once. The DT_AUXILIARY entries +will be created in the order in which they appear on the command line. + @kindex -F -@item -F -@itemx -F@var{format} -Ignored. Some older linkers used this option throughout a compilation +@kindex --filter +@item -F @var{name} +@itemx --filter @var{name} +When creating an ELF shared object, set the internal DT_FILTER field to +the specified name. This tells the dynamic linker that the symbol table +of the shared object which is being created should be used as a filter +on the symbol table of the shared object @var{name}. + +If you later link a program against this filter object, then, when you +run the program, the dynamic linker will see the DT_FILTER field. The +dynamic linker will resolve symbols according to the symbol table of the +filter object as usual, but it will actually link to the definitions +found in the shared object @var{name}. Thus the filter object can be +used to select a subset of the symbols provided by the object +@var{name}. + +Some older linkers used the @code{-F} option throughout a compilation toolchain for specifying object-file format for both input and output -object files. The mechanisms @code{ld} uses for this purpose (the -@samp{-b} or @samp{-format} options for input files, @samp{-oformat} -option or the @code{TARGET} command in linker scripts for output files, -the @code{GNUTARGET} environment variable) are more flexible, but -@code{ld} accepts the @samp{-F} option for compatibility with scripts -written to call the old linker. -@end ifclear +object files. The @sc{gnu} linker uses other mechanisms for this +purpose: the @code{-b}, @code{--format}, @code{--oformat} options, the +@code{TARGET} command in linker scripts, and the @code{GNUTARGET} +environment variable. The @sc{gnu} linker will ignore the @code{-F} +option when not creating an ELF shared object. @kindex --force-exe-suffix @item --force-exe-suffix @@ -389,8 +428,32 @@ Add archive file @var{archive} to the list of files to link. This option may be used any number of times. @code{ld} will search its path-list for occurrences of @code{lib@var{archive}.a} for every -@var{archive} specified. File extensions other than @code{.a} may be -used on certain systems. +@var{archive} specified. + +On systems which support shared libraries, @code{ld} may also search for +libraries with extensions other than @code{.a}. Specifically, on ELF +and SunOS systems, @code{ld} will search a directory for a library with +an extension of @code{.so} before searching for one with an extension of +@code{.a}. By convention, a @code{.so} extension indicates a shared +library. + +The linker will search an archive only once, at the location where it is +specified on the command line. If the archive defines a symbol which +was undefined in some object which appeared before the archive on the +command line, the linker will include the appropriate file(s) from the +archive. However, an undefined symbol in an object appearing later on +the command line will not cause the linker to search the archive again. + +See the @code{-(} option for a way to force the linker to search +archives multiple times. + +You may list the same archive multiple times on the command line. + +@ifset GENERIC +This type of archive searching is standard for Unix linkers. However, +if you are using @code{ld} on AIX, note that it is different from the +behaviour of the AIX linker. +@end ifset @cindex search directory, from cmd line @kindex -L@var{dir} @@ -518,11 +581,14 @@ @item -T @var{commandfile} @itemx --script=@var{commandfile} Read link commands from the file @var{commandfile}. These commands -replace @code{ld}'s default link script (rather than adding -to it), so @var{commandfile} must specify everything necessary to describe -the target format. @xref{Commands}. If @var{commandfile} does not -exist, @code{ld} looks for it in the directories specified by any -preceding @samp{-L} options. Multiple @samp{-T} options accumulate. +replace @code{ld}'s default link script (rather than adding to it), so +@var{commandfile} must specify everything necessary to describe the +target format. You must use this option if you want to use a command +which can only appear once in a linker script, such as the +@code{SECTIONS} or @code{MEMORY} command. @xref{Commands}. If +@var{commandfile} does not exist, @code{ld} looks for it in the +directories specified by any preceding @samp{-L} options. Multiple +@samp{-T} options accumulate. @kindex -u @var{symbol} @kindex --undefined=@var{symbol} @@ -690,8 +756,8 @@ Link little-endian objects. This affects the default output format. @cindex MIPS embedded PIC code -@kindex -embedded-relocs -@item -embedded-relocs +@kindex --embedded-relocs +@item --embedded-relocs This option is only meaningful when linking MIPS embedded PIC code, generated by the -membedded-pic option to the @sc{gnu} compiler and assembler. It causes the linker to create a table which may be used at @@ -734,11 +800,11 @@ when it issues any error whatsoever. @ifclear SingleFormat -@kindex -oformat -@item -oformat @var{output-format} +@kindex --oformat +@item --oformat @var{output-format} @code{ld} may be configured to support more than one kind of object file. If your @code{ld} is configured this way, you can use the -@samp{-oformat} option to specify the binary format for the output +@samp{--oformat} option to specify the binary format for the output object file. Even when @code{ld} is configured to support alternative object formats, you don't usually need to specify this, as @code{ld} should be configured to produce as a default output format the most @@ -778,8 +844,8 @@ instructions in the output object file. @ifset GENERIC -On platforms where this is not supported, @samp{-relax} is accepted, but -ignored. +On platforms where this is not supported, @samp{--relax} is accepted, +but ignored. @end ifset @cindex retaining specified symbols @@ -795,10 +861,10 @@ where a large global symbol table is accumulated gradually, to conserve run-time memory. -@samp{-retain-symbols-file} does @emph{not} discard undefined symbols, +@samp{--retain-symbols-file} does @emph{not} discard undefined symbols, or symbols needed for relocations. -You may only specify @samp{-retain-symbols-file} once in the command +You may only specify @samp{--retain-symbols-file} once in the command line. It overrides @samp{-s} and @samp{-S}. @ifset GENERIC @@ -915,9 +981,9 @@ Compute and display statistics about the operation of the linker, such as execution time and memory usage. -@kindex -traditional-format +@kindex --traditional-format @cindex traditional format -@item -traditional-format +@item --traditional-format For some targets, the output of @code{ld} is different in some ways from the output of some existing linker. This switch requests @code{ld} to use the traditional format instead. @@ -927,7 +993,7 @@ symbol string table. This can reduce the size of an output file with full debugging information by over 30 percent. Unfortunately, the SunOS @code{dbx} program can not read the resulting program (@code{gdb} has no -trouble). The @samp{-traditional-format} switch tells @code{ld} to not +trouble). The @samp{--traditional-format} switch tells @code{ld} to not combine duplicate entries. @kindex -Tbss @var{org} @@ -962,10 +1028,19 @@ supported. Display which input files can and cannot be opened. Display the linker script if using a default builtin script. -@kindex -warn-comon +@kindex --version-script=@var{version-scriptfile} +@cindex version script, symbol versions +@itemx --version-script=@var{version-scriptfile} +Specify the name of a version script to the linker. This is typically +used when creating shared libraries to specify additional information +about the version heirarchy for the library being created. This option +is only meaningful on ELF platforms which support shared libraries. +@xref{Version Script}. + +@kindex --warn-comon @cindex warnings, on combining symbols @cindex combining symbols, warnings on -@item -warn-common +@item --warn-common Warn when a common symbol is combined with another common symbol or with a symbol definition. Unix linkers allow this somewhat sloppy practice, but linkers on some other operating systems do not. This option allows @@ -994,11 +1069,11 @@ a definition of the same variable. @end table -The @samp{-warn-common} option can produce five kinds of warnings. Each -warning consists of a pair of lines: the first describes the symbol just -encountered, and the second describes the previous symbol encountered -with the same name. One or both of the two symbols will be a common -symbol. +The @samp{--warn-common} option can produce five kinds of warnings. +Each warning consists of a pair of lines: the first describes the symbol +just encountered, and the second describes the previous symbol +encountered with the same name. One or both of the two symbols will be +a common symbol. @enumerate @item @@ -1047,14 +1122,14 @@ @end smallexample @end enumerate -@kindex -warn-constructors -@item -warn-constructors +@kindex --warn-constructors +@item --warn-constructors Warn if any global constructors are used. This is only useful for a few object file formats. For formats like COFF or ELF, the linker can not detect the use of global constructors. -@kindex -warn-multiple-gp -@item -warn-multiple-gp +@kindex --warn-multiple-gp +@item --warn-multiple-gp Warn if multiple global pointer values are required in the output file. This is only meaningful for certain processors, such as the Alpha. Specifically, some processors put large-valued constants in a special @@ -1067,13 +1142,23 @@ values in order to be able to address all possible constants. This option causes a warning to be issued whenever this case occurs. -@kindex -warn-once +@kindex --warn-once @cindex warnings, on undefined symbols @cindex undefined symbols, warnings on -@item -warn-once +@item --warn-once Only warn once for each undefined symbol, rather than once per module which refers to it. +@kindex --warn-section-align +@cindex warnings, on section alignment +@cindex section alignment, warnings on +@item --warn-section-align +Warn if the address of an output section is changed because of +alignment. Typically, the alignment will be set by an input section. +The address will only be changed if it not explicitly specified; that +is, if the @code{SECTIONS} command does not specify a start address for +the section (@pxref{SECTIONS}). + @kindex --whole-archive @cindex including an entire archive @item --whole-archive @@ -1130,16 +1215,16 @@ @kindex GNUTARGET @cindex default input format @code{GNUTARGET} determines the input-file object format if you don't -use @samp{-b} (or its synonym @samp{-format}). Its value should be one +use @samp{-b} (or its synonym @samp{--format}). Its value should be one of the BFD names for an input format (@pxref{BFD}). If there is no @code{GNUTARGET} in the environment, @code{ld} uses the natural format -of the target. If @code{GNUTARGET} is set to @code{default} then BFD attempts to discover the -input format by examining binary input files; this method often -succeeds, but there are potential ambiguities, since there is no method -of ensuring that the magic number used to specify object-file formats is -unique. However, the configuration procedure for BFD on each system -places the conventional format for that system first in the search-list, -so ambiguities are resolved in favor of convention. +of the target. If @code{GNUTARGET} is set to @code{default} then BFD +attempts to discover the input format by examining binary input files; +this method often succeeds, but there are potential ambiguities, since +there is no method of ensuring that the magic number used to specify +object-file formats is unique. However, the configuration procedure for +BFD on each system places the conventional format for that system first +in the search-list, so ambiguities are resolved in favor of convention. @end ifset @node Commands @@ -1162,10 +1247,16 @@ placement of common blocks @end itemize -You may supply a command file (also known as a link script) to the +You may supply a command file (also known as a linker script) to the linker either explicitly through the @samp{-T} option, or implicitly as -an ordinary file. If the linker opens a file which it cannot recognize -as a supported object or archive format, it reports an error. +an ordinary file. Normally you should use the @samp{-T} option. An +implicit linker script should only be used when you want to augment, +rather than replace, the default linker script; typically an implicit +linker script would consist only of @code{INPUT} or @code{GROUP} +commands. + +If the linker opens a file which it cannot recognize as a supported +object or archive format, nor as a linker script, it reports an error. @menu * Scripts:: Linker Scripts @@ -1174,6 +1265,7 @@ * SECTIONS:: SECTIONS Command * PHDRS:: PHDRS Command * Entry Point:: The Entry Point +* Version Script:: Version Script * Option Commands:: Option Commands @end menu @@ -1388,7 +1480,7 @@ @end ifinfo @tex \vskip \baselineskip -%"lispnarrowing" is the extra indent used generally for @smallexample +%"lispnarrowing" is the extra indent used generally for smallexample \hskip\lispnarrowing\vbox{\offinterlineskip \hrule \halign @@ -1582,6 +1674,14 @@ @end group @end smallexample +@kindex LOADADDR(@var{section}) +@cindex section load address +@item LOADADDR(@var{section}) +Return the absolute load address of the named @var{section}. This is +normally the same as @code{ADDR}, but it may be different if the +@code{AT} keyword is used in the section definition (@pxref{Section +Options}). + @kindex ALIGN(@var{exp}) @cindex rounding up location counter @item ALIGN(@var{exp}) @@ -1674,6 +1774,14 @@ as the start address of the first section, if you choose, to facilitate paging. +@kindex MAX +@item MAX(@var{exp1}, @var{exp2}) +Returns the maximum of @var{exp1} and @var{exp2}. + +@kindex MIN +@item MIN(@var{exp1}, @var{exp2}) +Returns the minimum of @var{exp1} and @var{exp2}. + @end table @node Semicolons @@ -1814,6 +1922,7 @@ * Section Placement:: Section Placement * Section Data Expressions:: Section Data Expressions * Section Options:: Optional Section Attributes +* Overlays:: Overlays @end menu @node Section Definition @@ -1877,7 +1986,7 @@ The @var{contents} of a section definition may include any of the following kinds of statement. You can include as many of these as you like in a single section definition, separated from one another by -whitespace. +whitespace. @table @code @kindex @var{filename} @@ -1962,8 +2071,30 @@ input file's format. @end table -For example, the following command script arranges the output file into -three consecutive sections, named @code{.text}, @code{.data}, and +In any place where you may use a specific file or section name, you may +also use a wildcard pattern. The linker handles wildcards much as the +Unix shell does. A @samp{*} character matches any number of characters. +A @samp{?} character matches any single character. The sequence +@samp{[@var{chars}]} will match a single instance of any of the +@var{chars}; the @samp{-} character may be used to specify a range of +characters, as in @samp{[a-z]} to match any lower case letter. A +@samp{\} character may be used to quote the following character. + +When a file name is matched with a wildcard, the wildcard characters +will not match a @samp{/} character (used to separate directory names on +Unix). A pattern consisting of a single @samp{*} character is an +exception; it will always match any file name. In a section name, the +wildcard characters will match a @samp{/} character. + +Wildcards only match files which are explicitly specified on the command +line. The linker does not search directories to expand wildcards. +However, if you specify a simple file name---a name with no wildcard +characters---in a linker script, and the file name is not also specified +on the command line, the linker will attempt to open the file as though +it appeared on the command line. + +In the following example, the command script arranges the output file +into three consecutive sections, named @code{.text}, @code{.data}, and @code{.bss}, taking the input for each from the correspondingly named sections of all the input files: @@ -2008,6 +2139,24 @@ @end group @end smallexample +This example shows how wildcard patterns might be used to partition +files. All @code{.text} sections are placed in @code{.text}, and all +@code{.bss} sections are placed in @code{.bss}. For all files beginning +with an upper case character, the @code{.data} section is placed into +@code{.DATA}; for all other files, the @code{.data} section is placed +into @code{.data}. + +@smallexample +@group +SECTIONS @{ + .text : @{ *(.text) @} + .DATA : @{ [A-Z]*(.data) @} + .data : @{ *(.data) @} + .bss : @{ *(.bss) @} +@} +@end group +@end smallexample + @node Section Data Expressions @subsection Section Data Expressions @@ -2303,11 +2452,115 @@ @end table +@node Overlays +@subsection Overlays +@kindex OVERLAY +@cindex overlays + +The @code{OVERLAY} command provides an easy way to describe sections +which are to be loaded as part of a single memory image but are to be +run at the same memory address. At run time, some sort of overlay +manager will copy the overlaid sections in and out of the runtime memory +address as required, perhaps by simply manipulating addressing bits. +This approach can be useful, for example, when a certain region of +memory is faster than another. + +The @code{OVERLAY} command is used within a @code{SECTIONS} command. It +appears as follows: +@smallexample +@group + OVERLAY @var{start} : [ NOCROSSREFS ] AT ( @var{ldaddr} ) + @{ + @var{secname1} @{ @var{contents} @} :@var{phdr} =@var{fill} + @var{secname2} @{ @var{contents} @} :@var{phdr} =@var{fill} + @dots{} + @} >@var{region} :@var{phdr} =@var{fill} +@end group +@end smallexample + +Everything is optional except @code{OVERLAY} (a keyword), and each +section must have a name (@var{secname1} and @var{secname2} above). The +section definitions within the @code{OVERLAY} construct are identical to +those within the general @code{SECTIONS} contruct (@pxref{SECTIONS}), +except that no addresses and no memory regions may be defined for +sections within an @code{OVERLAY}. + +The sections are all defined with the same starting address. The load +addresses of the sections are arranged such that they are consecutive in +memory starting at the load address used for the @code{OVERLAY} as a +whole (as with normal section definitions, the load address is optional, +and defaults to the start address; the start address is also optional, +and defaults to @code{.}). + +If the @code{NOCROSSREFS} keyword is used, and there any references +among the sections, the linker will report an error. Since the sections +all run at the same address, it normally does not make sense for one +section to refer directly to another. @xref{Option Commands, +NOCROSSREFS}. + +For each section within the @code{OVERLAY}, the linker automatically +defines two symbols. The symbol @code{__load_start_@var{secname}} is +defined as the starting load address of the section. The symbol +@code{__load_stop_@var{secname}} is defined as the final load address of +the section. Any characters within @var{secname} which are not legal +within C identifiers are removed. C (or assembler) code may use these +symbols to move the overlaid sections around as necessary. + +At the end of the overlay, the value of @code{.} is set to the start +address of the overlay plus the size of the largest section. + +Here is an example. Remember that this would appear inside a +@code{SECTIONS} construct. + +@smallexample +@group + OVERLAY 0x1000 : AT (0x4000) + @{ + .text0 @{ o1/*.o(.text) @} + .text1 @{ o2/*.o(.text) @} + @} +@end group +@end smallexample + +This will define both @code{.text0} and @code{.text1} to start at +address 0x1000. @code{.text0} will be loaded at address 0x4000, and +@code{.text1} will be loaded immediately after @code{.text0}. The +following symbols will be defined: @code{__load_start_text0}, +@code{__load_stop_text0}, @code{__load_start_text1}, +@code{__load_stop_text1}. + +C code to copy overlay @code{.text1} into the overlay area might look +like the following. + +@smallexample +@group + extern char __load_start_text1, __load_stop_text1; + memcpy ((char *) 0x1000, &__load_start_text1, + &__load_stop_text1 - &__load_start_text1); +@end group +@end smallexample + +Note that the @code{OVERLAY} command is just syntactic sugar, since +everything it does can be done using the more basic commands. The above +example could have been written identically as follows. + +@smallexample +@group + .text0 0x1000 : AT (0x4000) @{ o1/*.o(.text) @} + __load_start_text0 = LOADADDR (.text0); + __load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0); + .text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) @{ o2/*.o(.text) @} + __load_start_text1 = LOADADDR (.text1); + __load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1); + . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1)); +@end group +@end smallexample + @node PHDRS @section ELF Program Headers @kindex PHDRS -@kindex program headers -@kindex ELF program headers +@cindex program headers +@cindex ELF program headers The ELF object file format uses @dfn{program headers}, which are read by the system loader and describe how the program should be loaded into @@ -2494,6 +2747,148 @@ start = other_symbol ; @end smallexample +@node Version Script +@section Version Script +@kindex VERSION @{script text@} +@cindex symbol versions +@cindex version script +@cindex versions of symbols +The linker command script includes a command specifically for +specifying a version script, and is only meaningful for ELF platforms +that support shared libraries. A version script can be +build directly into the linker script that you are using, or you +can supply the version script as just another input file to the linker +at the time that you link. The command script syntax is: +@smallexample +VERSION @{ version script contents @} +@end smallexample +The version script can also be specified to the linker by means of the +@samp{--version-script} linker command line option. +Version scripts are only meaningful when creating shared libraries. + +The format of the version script itself is identical to that used by +Sun's linker in Solaris 2.5. Versioning is done by defining a tree of +version nodes with the names and interdependencies specified in the +version script. The version script can specify which symbols are bound +to which version nodes, and it can reduce a specified set of symbols to +local scope so that they are not globally visible outside of the shared +library. + +The easiest way to demonstrate the version script language is with a few +examples. + +@smallexample +VERS_1.1 @{ + global: + foo1; + local: + old*; + original*; + new*; +@}; + +VERS_1.2 @{ + foo2; +@} VERS_1.1; + +VERS_2.0 @{ + bar1; bar2; +@} VERS_1.2; +@end smallexample + +In this example, three version nodes are defined. @samp{VERS_1.1} is the +first version node defined, and has no other dependencies. The symbol +@samp{foo1} is bound to this version node, and a number of symbols +that have appeared within various object files are reduced in scope to +local so that they are not visible outside of the shared library. + +Next, the node @samp{VERS_1.2} is defined. It depends upon +@samp{VERS_1.1}. The symbol @samp{foo2} is bound to this version node. + +Finally, the node @samp{VERS_2.0} is defined. It depends upon +@samp{VERS_1.2}. The symbols @samp{bar1} and @samp{bar2} are bound to +this version node. + +Symbols defined in the library which aren't specifically bound to a +version node are effectively bound to an unspecified base version of the +library. It is possible to bind all otherwise unspecified symbols to a +given version node using @samp{global: *} somewhere in the version +script. + +Lexically the names of the version nodes have no specific meaning other +than what they might suggest to the person reading them. The @samp{2.0} +version could just as well have appeared in between @samp{1.1} and +@samp{1.2}. However, this would be a confusing way to write a version +script. + +When you link an application against a shared library that has versioned +symbols, the application itself knows which version of each symbol it requires, +and it also knows which version nodes it needs from each shared library it is +linked against. Thus at runtime, the dynamic loader can make a quick check to +make sure that the libraries you have linked against do in fact supply all +of the version nodes that the application will need to resolve all of the +dynamic symbols. In this way it is possible for the dynamic linker to know +with certainty that all external symbols that it needs will be resolvable +without having to search for each symbol reference. + +The symbol versioning is in effect a much more sophisticated way of +doing minor version checking that SunOS does. The fundamental problem +that is being addressed here is that typically references to external +functions are bound on an as-needed basis, and are not all bound when +the application starts up. If a shared library is out of date, a +required interface may be missing; when the application tries to use +that interface, it may suddenly and unexpectedly fail. With symbol +versioning, the user will get a warning when they start their program if +the libraries being used with the application are too old. + +There are several GNU extensions to Sun's versioning approach. The +first of these is the ability to bind a symbol to a version node in the +source file where the symbol is defined instead of in the versioning +script. This was done mainly to reduce the burden on the library +maintainer. This can be done by putting something like: + +@smallexample +__asm__(".symver original_foo,foo@@VERS_1.1"); +@end smallexample + +in the C source file. This renamed the function @samp{original_foo} to +be an alias for @samp{foo} bound to the version node @samp{VERS_1.1}. +The @samp{local:} directive can be used to prevent the symbol +@samp{original_foo} from being exported. + +The second GNU extension is to allow multiple versions of the same function +to appear in a given shared library. In this way an incompatible change to +an interface can take place without increasing the major version number of +the shared library, while still allowing applications linked against the old +interface to continue to function. + +This can only be accomplished by using multiple @samp{.symver} +directives in the assembler. An example of this would be: + +@smallexample +__asm__(".symver original_foo,foo@@"); +__asm__(".symver old_foo,foo@@VERS_1.1"); +__asm__(".symver old_foo1,foo@@VERS_1.2"); +__asm__(".symver new_foo,foo@@@@VERS_2.0"); +@end smallexample + +In this example, @samp{foo@@} represents the symbol @samp{foo} bound to the +unspecified base version of the symbol. The source file that contains this +example would define 4 C functions: @samp{original_foo}, @samp{old_foo}, +@samp{old_foo1}, and @samp{new_foo}. + +When you have multiple definitions of a given symbol, there needs to be +some way to specify a default version to which external references to +this symbol will be bound. This can be accomplished with the +@samp{foo@@@@VERS_2.0} type of @samp{.symver} directive. Only one version of +a symbol can be declared 'default' in this manner - otherwise you would +effectively have multiple definitions of the same symbol. + +If you wish to bind a reference to a specific version of the symbol +within the shared library, you can use the aliases of convenience +(i.e. @samp{old_foo}), or you can use the @samp{.symver} directive to +specifically bind to an external version of the function in question. + @node Option Commands @section Option Commands The command language includes a number of other commands that you can @@ -2568,6 +2963,14 @@ to make @code{ld} assign space to common symbols even if a relocatable output file is specified (@samp{-r}). +@kindex INCLUDE @var{filename} +@cindex including a linker script +@item INCLUDE @var{filename} +Include the linker script @var{filename} at this point. The file will +be searched for in the current directory, and in any directory specified +with the @code{-L} option. You can nest calls to @code{INCLUDE} up to +10 levels deep. + @kindex INPUT ( @var{files} ) @cindex binary input files @item INPUT ( @var{file}, @var{file}, @dots{} ) @@ -2627,9 +3030,9 @@ you can use this command to specify a particular output format. @var{bfdname} is one of the names used by the BFD back-end routines (@pxref{BFD}). The effect is identical to the effect of the -@samp{-oformat} command-line option. This selection affects only -the output file; the related command @code{TARGET} affects primarily -input files. +@samp{--oformat} command-line option. This selection affects only the +output file; the related command @code{TARGET} affects primarily input +files. @end ifclear @kindex SEARCH_DIR ( @var{path} ) @@ -2652,7 +3055,7 @@ @item TARGET ( @var{format} ) When @code{ld} is configured to support multiple object code formats, you can use this command to change the input-file object code format -(like the command-line option @samp{-b} or its synonym @samp{-format}). +(like the command-line option @samp{-b} or its synonym @samp{--format}). The argument @var{format} is one of the strings used by BFD to name binary formats. If @code{TARGET} is specified but @code{OUTPUT_FORMAT} is not, the last @code{TARGET} argument is also used as the default @@ -2664,6 +3067,24 @@ output file format. If that variable is also absent, @code{ld} uses the default format configured for your machine in the BFD libraries. @end ifclear + +@cindex cross references +@kindex NOCROSSREFS ( @var{sections} ) +@item NOCROSSREFS ( @var{section} @var{section} @dots{} ) +This command may be used to tell @code{ld} to issue an error about any +references among certain sections. + +In certain types of programs, particularly on embedded systems, when one +section is loaded into memory, another section will not be. Any direct +references between the two sections would be errors. For example, it +would be an error if code in one section called a function defined in +the other section. + +The @code{NOCROSSREFS} command takes a list of section names. If +@code{ld} detects any cross references between the sections, it reports +an error and returns a non-zero exit status. The @code{NOCROSSREFS} +command uses output section names, defined in the @code{SECTIONS} +command. It does not use the names of input sections. @end table @ifset GENERIC @@ -2692,7 +3113,7 @@ @cindex H8/300 support For the H8/300, @code{ld} can perform these global optimizations when -you specify the @samp{-relax} command-line option. +you specify the @samp{--relax} command-line option. @table @emph @cindex relaxing on H8/300 @@ -2770,12 +3191,12 @@ use will add another pair of name variants to search for when @w{@samp{-l}} specifies a library. -@cindex @code{-relax} on i960 +@cindex @code{--relax} on i960 @cindex relaxing on i960 -@code{ld} supports the @samp{-relax} option for the i960 family. If you -specify @samp{-relax}, @code{ld} finds all @code{balx} and @code{calx} -instructions whose targets are within 24 bits, and turns them into -24-bit program-counter relative @code{bal} and @code{cal} +@code{ld} supports the @samp{--relax} option for the i960 family. If +you specify @samp{--relax}, @code{ld} finds all @code{balx} and +@code{calx} instructions whose targets are within 24 bits, and turns +them into 24-bit program-counter relative @code{bal} and @code{cal} instructions, respectively. @code{ld} also turns @code{cal} instructions into @code{bal} instructions when it determines that the target subroutine is a leaf routine (that is, the target subroutine does @@ -2829,6 +3250,216 @@ @include bfdsumm.texi @end ifclear +@node Reporting Bugs +@chapter Reporting Bugs +@cindex bugs in @code{ld} +@cindex reporting bugs in @code{ld} + +Your bug reports play an essential role in making @code{ld} reliable. + +Reporting a bug may help you by bringing a solution to your problem, or +it may not. But in any case the principal function of a bug report is +to help the entire community by making the next version of @code{ld} +work better. Bug reports are your contribution to the maintenance of +@code{ld}. + +In order for a bug report to serve its purpose, you must include the +information that enables us to fix the bug. + +@menu +* Bug Criteria:: Have you found a bug? +* Bug Reporting:: How to report bugs +@end menu + +@node Bug Criteria +@section Have you found a bug? +@cindex bug criteria + +If you are not sure whether you have found a bug, here are some guidelines: + +@itemize @bullet +@cindex fatal signal +@cindex linker crash +@cindex crash of linker +@item +If the linker gets a fatal signal, for any input whatever, that is a +@code{ld} bug. Reliable linkers never crash. + +@cindex error on valid input +@item +If @code{ld} produces an error message for valid input, that is a bug. + +@cindex invalid input +@item +If @code{ld} does not produce an error message for invalid input, that +may be a bug. In the general case, the linker can not verify that +object files are correct. + +@item +If you are an experienced user of linkers, your suggestions for +improvement of @code{ld} are welcome in any case. +@end itemize + +@node Bug Reporting +@section How to report bugs +@cindex bug reports +@cindex @code{ld} bugs, reporting + +A number of companies and individuals offer support for @sc{gnu} +products. If you obtained @code{ld} from a support organization, we +recommend you contact that organization first. + +You can find contact information for many support companies and +individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs +distribution. + +In any event, we also recommend that you send bug reports for @code{ld} +to @samp{bug-gnu-utils@@prep.ai.mit.edu}. + +The fundamental principle of reporting bugs usefully is this: +@strong{report all the facts}. If you are not sure whether to state a +fact or leave it out, state it! + +Often people omit facts because they think they know what causes the +problem and assume that some details do not matter. Thus, you might +assume that the name of a symbol you use in an example does not matter. +Well, probably it does not, but one cannot be sure. Perhaps the bug is +a stray memory reference which happens to fetch from the location where +that name is stored in memory; perhaps, if the name were different, the +contents of that location would fool the linker into doing the right +thing despite the bug. Play it safe and give a specific, complete +example. That is the easiest thing for you to do, and the most helpful. + +Keep in mind that the purpose of a bug report is to enable us to fix the bug if +it is new to us. Therefore, always write your bug reports on the assumption +that the bug has not been reported previously. + +Sometimes people give a few sketchy facts and ask, ``Does this ring a +bell?'' Those bug reports are useless, and we urge everyone to +@emph{refuse to respond to them} except to chide the sender to report +bugs properly. + +To enable us to fix the bug, you should include all these things: + +@itemize @bullet +@item +The version of @code{ld}. @code{ld} announces it if you start it with +the @samp{--version} argument. + +Without this, we will not know whether there is any point in looking for +the bug in the current version of @code{ld}. + +@item +Any patches you may have applied to the @code{ld} source, including any +patches made to the @code{BFD} library. + +@item +The type of machine you are using, and the operating system name and +version number. + +@item +What compiler (and its version) was used to compile @code{ld}---e.g. +``@code{gcc-2.7}''. + +@item +The command arguments you gave the linker to link your example and +observe the bug. To guarantee you will not omit something important, +list them all. A copy of the Makefile (or the output from make) is +sufficient. + +If we were to try to guess the arguments, we would probably guess wrong +and then we might not encounter the bug. + +@item +A complete input file, or set of input files, that will reproduce the +bug. It is generally most helpful to send the actual object files, +uuencoded if necessary to get them through the mail system. Making them +available for anonymous FTP is not as good, but may be the only +reasonable choice for large object files. + +If the source files were assembled using @code{gas} or compiled using +@code{gcc}, then it may be OK to send the source files rather than the +object files. In this case, be sure to say exactly what version of +@code{gas} or @code{gcc} was used to produce the object files. Also say +how @code{gas} or @code{gcc} were configured. + +@item +A description of what behavior you observe that you believe is +incorrect. For example, ``It gets a fatal signal.'' + +Of course, if the bug is that @code{ld} gets a fatal signal, then we +will certainly notice it. But if the bug is incorrect output, we might +not notice unless it is glaringly wrong. You might as well not give us +a chance to make a mistake. + +Even if the problem you experience is a fatal signal, you should still +say so explicitly. Suppose something strange is going on, such as, your +copy of @code{ld} is out of synch, or you have encountered a bug in the +C library on your system. (This has happened!) Your copy might crash +and ours would not. If you told us to expect a crash, then when ours +fails to crash, we would know that the bug was not happening for us. If +you had not told us to expect a crash, then we would not be able to draw +any conclusion from our observations. + +@item +If you wish to suggest changes to the @code{ld} source, send us context +diffs, as generated by @code{diff} with the @samp{-u}, @samp{-c}, or +@samp{-p} option. Always send diffs from the old file to the new file. +If you even discuss something in the @code{ld} source, refer to it by +context, not by line number. + +The line numbers in our development sources will not match those in your +sources. Your line numbers would convey no useful information to us. +@end itemize + +Here are some things that are not necessary: + +@itemize @bullet +@item +A description of the envelope of the bug. + +Often people who encounter a bug spend a lot of time investigating +which changes to the input file will make the bug go away and which +changes will not affect it. + +This is often time consuming and not very useful, because the way we +will find the bug is by running a single example under the debugger +with breakpoints, not by pure deduction from a series of examples. +We recommend that you save your time for something else. + +Of course, if you can find a simpler example to report @emph{instead} +of the original one, that is a convenience for us. Errors in the +output will be easier to spot, running under the debugger will take +less time, and so on. + +However, simplification is not vital; if you do not want to do this, +report the bug anyway and send us the entire test case you used. + +@item +A patch for the bug. + +A patch for the bug does help us if it is a good one. But do not omit +the necessary information, such as the test case, on the assumption that +a patch is all we need. We might see problems with your patch and decide +to fix the problem another way, or we might not understand it at all. + +Sometimes with a program as complicated as @code{ld} it is very hard to +construct an example that will make the program follow a certain path +through the code. If you do not send us the example, we will not be +able to construct one, so we will not be able to verify that the bug is +fixed. + +And if we cannot understand what bug you are trying to fix, or why your +patch should be an improvement, we will not install it. A test case will +help us to understand. + +@item +A guess about what the bug is or what it depends on. + +Such guesses are usually wrong. Even we cannot guess right about such +things without first using the debugger to find the facts. +@end itemize + @node MRI @appendix MRI Compatible Script Files @cindex MRI compatibility @@ -2961,7 +3592,6 @@ If you have more than one @code{SECT} statement for the same @var{secname}, only the @emph{first} sets the start address. @end table - @node Index @unnumbered Index diff -urN binutils-2.7/ld/ldcref.c binutils-2.8/ld/ldcref.c --- binutils-2.7/ld/ldcref.c Thu Jul 4 12:24:30 1996 +++ binutils-2.8/ld/ldcref.c Wed Apr 30 12:57:48 1997 @@ -18,7 +18,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* This file holds routines that manage the cross reference table. */ +/* This file holds routines that manage the cross reference table. + The table is used to generate cross reference reports. It is also + used to implement the NOCROSSREFS command in the linker script. */ #include "bfd.h" #include "sysdep.h" @@ -28,6 +30,8 @@ #include "ld.h" #include "ldmain.h" #include "ldmisc.h" +#include "ldexp.h" +#include "ldlang.h" /* We keep an instance of this structure for each reference to a symbol from a given object. */ @@ -71,6 +75,11 @@ static boolean cref_fill_array PARAMS ((struct cref_hash_entry *, PTR)); static int cref_sort_array PARAMS ((const PTR, const PTR)); static void output_one_cref PARAMS ((FILE *, struct cref_hash_entry *)); +static boolean check_nocrossref PARAMS ((struct cref_hash_entry *, PTR)); +static void check_refs + PARAMS ((struct cref_hash_entry *, struct bfd_link_hash_entry *, + struct lang_nocrossrefs *)); +static void check_reloc_refs PARAMS ((bfd *, asection *, PTR)); /* Look up an entry in the cref hash table. */ @@ -280,7 +289,8 @@ { if (hl->u.def.section->output_section == NULL) return; - if ((hl->u.def.section->owner->flags & DYNAMIC) != 0) + if (hl->u.def.section->owner != NULL + && (hl->u.def.section->owner->flags & DYNAMIC) != 0) { for (r = h->refs; r != NULL; r = r->next) if ((r->abfd->flags & DYNAMIC) == 0) @@ -323,4 +333,215 @@ } ASSERT (len == 0); +} + +/* Check for prohibited cross references. */ + +void +check_nocrossrefs () +{ + if (! cref_initialized) + return; + + cref_hash_traverse (&cref_table, check_nocrossref, (PTR) NULL); +} + +/* Check one symbol to see if it is a prohibited cross reference. */ + +/*ARGSUSED*/ +static boolean +check_nocrossref (h, ignore) + struct cref_hash_entry *h; + PTR ignore; +{ + struct bfd_link_hash_entry *hl; + asection *defsec; + const char *defsecname; + struct lang_nocrossrefs *ncrs; + struct lang_nocrossref *ncr; + + hl = bfd_link_hash_lookup (link_info.hash, h->root.string, false, + false, true); + if (hl == NULL) + { + einfo ("%P: symbol `%T' missing from main hash table\n", + h->root.string); + return true; + } + + if (hl->type != bfd_link_hash_defined + && hl->type != bfd_link_hash_defweak) + return true; + + defsec = hl->u.def.section->output_section; + if (defsec == NULL) + return true; + defsecname = bfd_get_section_name (defsec->owner, defsec); + + for (ncrs = nocrossref_list; ncrs != NULL; ncrs = ncrs->next) + for (ncr = ncrs->list; ncr != NULL; ncr = ncr->next) + if (strcmp (ncr->name, defsecname) == 0) + check_refs (h, hl, ncrs); + + return true; +} + +/* The struct is used to pass information from check_refs to + check_reloc_refs through bfd_map_over_sections. */ + +struct check_refs_info +{ + struct cref_hash_entry *h; + asection *defsec; + struct lang_nocrossrefs *ncrs; + asymbol **asymbols; + boolean same; +}; + +/* This function is called for each symbol defined in a section which + prohibits cross references. We need to look through all references + to this symbol, and ensure that the references are not from + prohibited sections. */ + +static void +check_refs (h, hl, ncrs) + struct cref_hash_entry *h; + struct bfd_link_hash_entry *hl; + struct lang_nocrossrefs *ncrs; +{ + struct cref_ref *ref; + + for (ref = h->refs; ref != NULL; ref = ref->next) + { + lang_input_statement_type *li; + asymbol **asymbols; + struct check_refs_info info; + + /* We need to look through the relocations for this BFD, to see + if any of the relocations which refer to this symbol are from + a prohibited section. Note that we need to do this even for + the BFD in which the symbol is defined, since even a single + BFD might contain a prohibited cross reference; for this + case, we set the SAME field in INFO, which will cause + CHECK_RELOCS_REFS to check for relocations against the + section as well as against the symbol. */ + + li = (lang_input_statement_type *) ref->abfd->usrdata; + if (li != NULL && li->asymbols != NULL) + asymbols = li->asymbols; + else + { + long symsize; + long symbol_count; + + symsize = bfd_get_symtab_upper_bound (ref->abfd); + if (symsize < 0) + einfo ("%B%F: could not read symbols; %E\n", ref->abfd); + asymbols = (asymbol **) xmalloc (symsize); + symbol_count = bfd_canonicalize_symtab (ref->abfd, asymbols); + if (symbol_count < 0) + einfo ("%B%F: could not read symbols: %E\n", ref->abfd); + if (li != NULL) + { + li->asymbols = asymbols; + li->symbol_count = symbol_count; + } + } + + info.h = h; + info.defsec = hl->u.def.section; + info.ncrs = ncrs; + info.asymbols = asymbols; + if (ref->abfd == hl->u.def.section->owner) + info.same = true; + else + info.same = false; + bfd_map_over_sections (ref->abfd, check_reloc_refs, (PTR) &info); + + if (li == NULL) + free (asymbols); + } +} + +/* This is called via bfd_map_over_sections. INFO->H is a symbol + defined in INFO->DEFSECNAME. If this section maps into any of the + sections listed in INFO->NCRS, other than INFO->DEFSECNAME, then we + look through the relocations. If any of the relocations are to + INFO->H, then we report a prohibited cross reference error. */ + +static void +check_reloc_refs (abfd, sec, iarg) + bfd *abfd; + asection *sec; + PTR iarg; +{ + struct check_refs_info *info = (struct check_refs_info *) iarg; + asection *outsec; + const char *outsecname; + asection *outdefsec; + const char *outdefsecname; + struct lang_nocrossref *ncr; + const char *symname; + long relsize; + arelent **relpp; + long relcount; + arelent **p, **pend; + + outsec = sec->output_section; + outsecname = bfd_get_section_name (outsec->owner, outsec); + + outdefsec = info->defsec->output_section; + outdefsecname = bfd_get_section_name (outdefsec->owner, outdefsec); + + /* The section where the symbol is defined is permitted. */ + if (strcmp (outsecname, outdefsecname) == 0) + return; + + for (ncr = info->ncrs->list; ncr != NULL; ncr = ncr->next) + if (strcmp (outsecname, ncr->name) == 0) + break; + + if (ncr == NULL) + return; + + /* This section is one for which cross references are prohibited. + Look through the relocations, and see if any of them are to + INFO->H. */ + + symname = info->h->root.string; + + relsize = bfd_get_reloc_upper_bound (abfd, sec); + if (relsize < 0) + einfo ("%B%F: could not read relocs: %E\n", abfd); + if (relsize == 0) + return; + + relpp = (arelent **) xmalloc (relsize); + relcount = bfd_canonicalize_reloc (abfd, sec, relpp, info->asymbols); + if (relcount < 0) + einfo ("%B%F: could not read relocs: %E\n", abfd); + + p = relpp; + pend = p + relcount; + for (; p < pend && *p != NULL; p++) + { + arelent *q = *p; + + if (q->sym_ptr_ptr != NULL + && *q->sym_ptr_ptr != NULL + && (strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), symname) == 0 + || (info->same + && bfd_get_section (*q->sym_ptr_ptr) == info->defsec))) + { + /* We found a reloc for the symbol. The symbol is defined + in OUTSECNAME. This reloc is from a section which is + mapped into a section from which references to OUTSECNAME + are prohibited. We must report an error. */ + einfo ("%X%C: prohibited cross reference from %s to `%T' in %s\n", + abfd, sec, q->address, outsecname, + bfd_asymbol_name (*q->sym_ptr_ptr), outdefsecname); + } + } + + free (relpp); } diff -urN binutils-2.7/ld/ldemul.c binutils-2.8/ld/ldemul.c --- binutils-2.7/ld/ldemul.c Thu Jul 4 12:24:30 1996 +++ binutils-2.8/ld/ldemul.c Wed Apr 30 12:57:49 1997 @@ -1,5 +1,5 @@ /* ldemul.c -- clearing house for ld emulation states - Copyright (C) 1991, 1993 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -167,7 +167,7 @@ char * ldemul_default_target() { - char *from_outside = (char *) getenv(TARGET_ENVIRON); + char *from_outside = getenv (TARGET_ENVIRON); if (from_outside != (char *)NULL) return from_outside; return ld_emulation->target_name; diff -urN binutils-2.7/ld/ldemul.h binutils-2.8/ld/ldemul.h --- binutils-2.7/ld/ldemul.h Thu Jul 4 12:24:30 1996 +++ binutils-2.8/ld/ldemul.h Wed Apr 30 12:57:49 1997 @@ -1,6 +1,5 @@ /* ld-emul.h - Linker emulation header file - - Copyright 1991, 1992 Free Software Foundation, Inc. + Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -32,7 +31,7 @@ extern void ldemul_set_output_arch PARAMS ((void)); extern char *ldemul_choose_target PARAMS ((void)); extern void ldemul_choose_mode PARAMS ((char *)); -extern void ldemul_list_emulations PARAMS ((/* FILE * */)); +extern void ldemul_list_emulations PARAMS ((FILE *)); extern char *ldemul_get_script PARAMS ((int *isfile)); extern void ldemul_finish PARAMS ((void)); extern void ldemul_set_symbols PARAMS ((void)); diff -urN binutils-2.7/ld/ldexp.c binutils-2.8/ld/ldexp.c --- binutils-2.7/ld/ldexp.c Thu Jul 4 12:24:31 1996 +++ binutils-2.8/ld/ldexp.c Wed Apr 30 12:57:49 1997 @@ -99,6 +99,7 @@ { NEXT,"NEXT" }, { SIZEOF,"SIZEOF" }, { ADDR,"ADDR" }, + { LOADADDR,"LOADADDR" }, { MEMORY,"MEMORY" }, { DEFINED,"DEFINED" }, { TARGET_K,"TARGET" }, @@ -294,6 +295,16 @@ BOP(ANDAND,&&); BOP(OROR,||); + case MAX: + if (result.value < other.value) + result = other; + break; + + case MIN: + if (result.value > other.value) + result = other; + break; + default: FAIL(); } @@ -410,6 +421,25 @@ else result = invalid (); break; + + case LOADADDR: + if (allocation_done != lang_first_phase_enum) + { + lang_output_section_statement_type *os; + + os = lang_output_section_find (tree->name.name); + check (os, tree->name.name, "LOADADDR"); + if (os->load_base == NULL) + result = new_rel (0, os); + else + result = exp_fold_tree_no_dot (os->load_base, + abs_output_section, + allocation_done); + } + else + result = invalid (); + break; + case SIZEOF: if (allocation_done != lang_first_phase_enum) { diff -urN binutils-2.7/ld/ldgram.c binutils-2.8/ld/ldgram.c --- binutils-2.7/ld/ldgram.c Mon Jul 15 12:23:10 1996 +++ binutils-2.8/ld/ldgram.c Wed Apr 30 13:15:14 1997 @@ -51,46 +51,56 @@ #define SEARCH_DIR 302 #define MAP 303 #define ENTRY 304 -#define SIZEOF 305 -#define NEXT 306 +#define NEXT 305 +#define SIZEOF 306 #define ADDR 307 -#define STARTUP 308 -#define HLL 309 -#define SYSLIB 310 -#define FLOAT 311 -#define NOFLOAT 312 -#define ORIGIN 313 -#define FILL 314 -#define LENGTH 315 -#define CREATE_OBJECT_SYMBOLS 316 -#define INPUT 317 -#define GROUP 318 -#define OUTPUT 319 -#define CONSTRUCTORS 320 -#define ALIGNMOD 321 -#define AT 322 -#define PROVIDE 323 -#define CHIP 324 -#define LIST 325 -#define SECT 326 -#define ABSOLUTE 327 -#define LOAD 328 -#define NEWLINE 329 -#define ENDWORD 330 -#define ORDER 331 -#define NAMEWORD 332 -#define FORMAT 333 -#define PUBLIC 334 -#define BASE 335 -#define ALIAS 336 -#define TRUNCATE 337 -#define REL 338 -#define INPUT_SCRIPT 339 -#define INPUT_MRI_SCRIPT 340 -#define INPUT_DEFSYM 341 -#define CASE 342 -#define EXTERN 343 -#define START 344 +#define LOADADDR 308 +#define MAX 309 +#define MIN 310 +#define STARTUP 311 +#define HLL 312 +#define SYSLIB 313 +#define FLOAT 314 +#define NOFLOAT 315 +#define NOCROSSREFS 316 +#define ORIGIN 317 +#define FILL 318 +#define LENGTH 319 +#define CREATE_OBJECT_SYMBOLS 320 +#define INPUT 321 +#define GROUP 322 +#define OUTPUT 323 +#define CONSTRUCTORS 324 +#define ALIGNMOD 325 +#define AT 326 +#define PROVIDE 327 +#define CHIP 328 +#define LIST 329 +#define SECT 330 +#define ABSOLUTE 331 +#define LOAD 332 +#define NEWLINE 333 +#define ENDWORD 334 +#define ORDER 335 +#define NAMEWORD 336 +#define FORMAT 337 +#define PUBLIC 338 +#define BASE 339 +#define ALIAS 340 +#define TRUNCATE 341 +#define REL 342 +#define INPUT_SCRIPT 343 +#define INPUT_MRI_SCRIPT 344 +#define INPUT_DEFSYM 345 +#define CASE 346 +#define EXTERN 347 +#define START 348 +#define VERS_TAG 349 +#define VERS_IDENTIFIER 350 +#define GLOBAL 351 +#define LOCAL 352 +#define VERSION 353 +#define INPUT_VERSION_SCRIPT 354 #line 21 "./ldgram.y" @@ -151,6 +161,11 @@ union etree_union *at; union etree_union *flags; } phdr; + struct lang_nocrossref *nocrossref; + struct lang_output_section_phdr_list *section_phdr; + struct bfd_elf_version_deps *deflist; + struct bfd_elf_version_expr *versyms; + struct bfd_elf_version_tree *versnode; } YYSTYPE; #ifndef YYLTYPE @@ -179,26 +194,26 @@ -#define YYFINAL 440 +#define YYFINAL 540 #define YYFLAG -32768 -#define YYNTBASE 113 +#define YYNTBASE 123 -#define YYTRANSLATE(x) ((unsigned)(x) <= 344 ? yytranslate[x] : 189) +#define YYTRANSLATE(x) ((unsigned)(x) <= 354 ? yytranslate[x] : 221) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 111, 2, 2, 2, 34, 21, 2, 37, - 108, 32, 30, 106, 31, 2, 33, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 16, 107, 24, + 2, 2, 121, 2, 2, 2, 34, 21, 2, 37, + 118, 32, 30, 116, 31, 2, 33, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 16, 117, 24, 10, 25, 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 109, 2, 110, 20, 2, 2, 2, 2, 2, 2, + 119, 2, 120, 20, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 47, 19, 48, 112, 2, 2, 2, 2, + 2, 2, 47, 19, 48, 122, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -220,139 +235,167 @@ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105 + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, - 0, 3, 6, 9, 11, 12, 17, 18, 21, 25, - 26, 29, 34, 36, 38, 41, 43, 48, 53, 57, - 60, 65, 69, 74, 79, 84, 89, 94, 97, 100, - 103, 108, 113, 116, 119, 122, 125, 126, 132, 135, - 136, 140, 143, 144, 146, 150, 152, 156, 157, 159, - 163, 165, 169, 170, 173, 176, 177, 179, 181, 183, - 185, 187, 189, 191, 193, 195, 200, 205, 210, 215, - 224, 229, 231, 236, 237, 243, 248, 249, 255, 257, - 261, 264, 266, 270, 273, 278, 281, 284, 285, 290, - 293, 295, 299, 301, 302, 307, 308, 314, 315, 321, - 324, 326, 328, 330, 332, 337, 342, 345, 347, 348, - 350, 352, 354, 356, 358, 361, 362, 364, 366, 368, - 370, 372, 374, 376, 378, 380, 382, 386, 390, 397, - 399, 400, 406, 409, 413, 414, 415, 423, 427, 431, - 435, 436, 441, 446, 450, 454, 456, 461, 465, 466, - 468, 470, 471, 474, 477, 481, 486, 489, 492, 495, - 499, 503, 507, 511, 515, 519, 523, 527, 531, 535, - 539, 543, 547, 551, 555, 559, 565, 569, 573, 578, - 580, 582, 587, 592, 597, 602, 607, 609, 614, 615, - 616, 617, 618, 619, 620, 636, 637, 638, 646, 648, - 650, 652, 654, 656, 660, 661, 665, 668, 675, 686, - 689, 690, 691, 695, 700, 701, 704, 705, 706, 713, - 715, 716, 720, 726, 727 + 0, 3, 6, 9, 12, 14, 15, 20, 21, 24, + 28, 29, 32, 37, 39, 41, 44, 46, 51, 56, + 60, 63, 68, 72, 77, 82, 87, 92, 97, 100, + 103, 106, 111, 116, 119, 122, 125, 128, 129, 135, + 138, 139, 143, 146, 147, 149, 153, 155, 159, 160, + 162, 166, 168, 172, 173, 176, 179, 180, 182, 184, + 186, 188, 190, 192, 194, 196, 198, 200, 205, 210, + 215, 220, 229, 234, 236, 241, 242, 248, 253, 254, + 260, 265, 267, 271, 274, 276, 280, 283, 288, 291, + 294, 295, 300, 303, 305, 307, 309, 313, 317, 321, + 323, 324, 329, 330, 336, 337, 343, 344, 350, 353, + 355, 357, 359, 361, 366, 371, 374, 376, 377, 379, + 381, 383, 385, 387, 390, 391, 393, 395, 397, 399, + 401, 403, 405, 407, 409, 411, 415, 419, 426, 428, + 429, 435, 438, 442, 443, 444, 452, 456, 460, 464, + 465, 470, 475, 479, 483, 485, 490, 494, 495, 497, + 499, 500, 503, 507, 508, 511, 514, 518, 523, 526, + 529, 532, 536, 540, 544, 548, 552, 556, 560, 564, + 568, 572, 576, 580, 584, 588, 592, 596, 602, 606, + 610, 615, 617, 619, 624, 629, 634, 639, 644, 649, + 651, 658, 665, 670, 671, 672, 673, 674, 675, 676, + 692, 693, 694, 695, 696, 697, 714, 715, 716, 724, + 726, 728, 730, 732, 734, 738, 739, 743, 746, 753, + 764, 767, 769, 770, 772, 775, 776, 777, 781, 782, + 783, 784, 785, 797, 802, 803, 806, 807, 808, 815, + 817, 818, 822, 828, 829, 833, 834, 837, 838, 844, + 846, 849, 855, 862, 864, 867, 868, 871, 876, 881, + 890, 892 }; -static const short yyrhs[] = { 100, - 127, 0, 101, 117, 0, 102, 115, 0, 4, 0, - 0, 116, 4, 10, 166, 0, 0, 118, 119, 0, - 119, 120, 90, 0, 0, 85, 166, 0, 85, 166, - 106, 166, 0, 4, 0, 86, 0, 92, 122, 0, - 91, 0, 95, 4, 10, 166, 0, 95, 4, 106, - 166, 0, 95, 4, 166, 0, 94, 4, 0, 87, - 4, 106, 166, 0, 87, 4, 166, 0, 87, 4, - 10, 166, 0, 38, 4, 10, 166, 0, 38, 4, - 106, 166, 0, 82, 4, 10, 166, 0, 82, 4, - 106, 166, 0, 88, 124, 0, 89, 123, 0, 93, - 4, 0, 97, 4, 106, 4, 0, 97, 4, 106, - 3, 0, 96, 166, 0, 98, 3, 0, 103, 125, - 0, 104, 126, 0, 0, 53, 114, 121, 119, 36, - 0, 105, 4, 0, 0, 122, 106, 4, 0, 122, - 4, 0, 0, 4, 0, 123, 106, 4, 0, 4, - 0, 124, 106, 4, 0, 0, 4, 0, 125, 106, - 4, 0, 4, 0, 126, 106, 4, 0, 0, 128, - 129, 0, 129, 130, 0, 0, 151, 0, 134, 0, - 181, 0, 158, 0, 159, 0, 161, 0, 163, 0, - 136, 0, 107, 0, 62, 37, 4, 108, 0, 63, - 37, 114, 108, 0, 80, 37, 114, 108, 0, 50, - 37, 4, 108, 0, 50, 37, 4, 106, 4, 106, - 4, 108, 0, 52, 37, 4, 108, 0, 51, 0, - 78, 37, 133, 108, 0, 0, 79, 131, 37, 133, - 108, 0, 64, 37, 114, 108, 0, 0, 53, 114, - 132, 129, 36, 0, 4, 0, 133, 106, 4, 0, - 133, 4, 0, 5, 0, 133, 106, 5, 0, 133, - 5, 0, 45, 47, 135, 48, 0, 135, 168, 0, - 135, 136, 0, 0, 65, 37, 4, 108, 0, 149, - 148, 0, 4, 0, 137, 150, 4, 0, 4, 0, - 0, 109, 139, 137, 110, 0, 0, 4, 140, 37, - 137, 108, 0, 0, 32, 141, 37, 137, 108, 0, - 149, 148, 0, 77, 0, 107, 0, 81, 0, 138, - 0, 145, 37, 166, 108, 0, 75, 37, 166, 108, - 0, 143, 142, 0, 142, 0, 0, 143, 0, 41, - 0, 42, 0, 43, 0, 44, 0, 10, 164, 0, - 0, 6, 0, 7, 0, 8, 0, 9, 0, 11, - 0, 12, 0, 13, 0, 14, 0, 107, 0, 106, - 0, 4, 10, 164, 0, 4, 147, 164, 0, 84, - 37, 4, 10, 164, 108, 0, 106, 0, 0, 54, - 47, 153, 152, 48, 0, 152, 153, 0, 152, 106, - 153, 0, 0, 0, 4, 154, 157, 16, 155, 150, - 156, 0, 74, 10, 164, 0, 76, 10, 164, 0, - 37, 4, 108, 0, 0, 69, 37, 114, 108, 0, - 70, 37, 160, 108, 0, 70, 37, 108, 0, 160, - 150, 114, 0, 114, 0, 71, 37, 162, 108, 0, - 162, 150, 114, 0, 0, 72, 0, 73, 0, 0, - 165, 166, 0, 31, 166, 0, 37, 166, 108, 0, - 67, 37, 166, 108, 0, 111, 166, 0, 30, 166, - 0, 112, 166, 0, 166, 32, 166, 0, 166, 33, - 166, 0, 166, 34, 166, 0, 166, 30, 166, 0, - 166, 31, 166, 0, 166, 28, 166, 0, 166, 29, - 166, 0, 166, 22, 166, 0, 166, 23, 166, 0, - 166, 26, 166, 0, 166, 27, 166, 0, 166, 24, - 166, 0, 166, 25, 166, 0, 166, 21, 166, 0, - 166, 20, 166, 0, 166, 19, 166, 0, 166, 15, - 166, 16, 166, 0, 166, 18, 166, 0, 166, 17, - 166, 0, 61, 37, 4, 108, 0, 3, 0, 49, - 0, 66, 37, 4, 108, 0, 68, 37, 4, 108, - 0, 88, 37, 166, 108, 0, 38, 37, 166, 108, - 0, 39, 37, 166, 108, 0, 4, 0, 83, 37, - 166, 108, 0, 0, 0, 0, 0, 0, 0, 4, - 169, 178, 167, 170, 47, 171, 144, 48, 172, 179, - 180, 146, 173, 150, 0, 0, 0, 79, 174, 178, - 175, 47, 135, 48, 0, 56, 0, 57, 0, 58, - 0, 59, 0, 60, 0, 37, 176, 108, 0, 0, - 166, 177, 16, 0, 177, 16, 0, 40, 37, 166, - 108, 177, 16, 0, 40, 37, 166, 108, 39, 37, - 166, 108, 177, 16, 0, 25, 4, 0, 0, 0, - 180, 16, 4, 0, 46, 47, 182, 48, 0, 0, - 182, 183, 0, 0, 0, 4, 184, 186, 187, 185, - 107, 0, 166, 0, 0, 4, 188, 187, 0, 83, - 37, 166, 108, 187, 0, 0, 37, 166, 108, 0 +static const short yyrhs[] = { 104, + 137, 0, 105, 127, 0, 115, 212, 0, 106, 125, + 0, 4, 0, 0, 126, 4, 10, 178, 0, 0, + 128, 129, 0, 129, 130, 94, 0, 0, 89, 178, + 0, 89, 178, 116, 178, 0, 4, 0, 90, 0, + 96, 132, 0, 95, 0, 99, 4, 10, 178, 0, + 99, 4, 116, 178, 0, 99, 4, 178, 0, 98, + 4, 0, 91, 4, 116, 178, 0, 91, 4, 178, + 0, 91, 4, 10, 178, 0, 38, 4, 10, 178, + 0, 38, 4, 116, 178, 0, 86, 4, 10, 178, + 0, 86, 4, 116, 178, 0, 92, 134, 0, 93, + 133, 0, 97, 4, 0, 101, 4, 116, 4, 0, + 101, 4, 116, 3, 0, 100, 178, 0, 102, 3, + 0, 107, 135, 0, 108, 136, 0, 0, 53, 124, + 131, 129, 36, 0, 109, 4, 0, 0, 132, 116, + 4, 0, 132, 4, 0, 0, 4, 0, 133, 116, + 4, 0, 4, 0, 134, 116, 4, 0, 0, 4, + 0, 135, 116, 4, 0, 4, 0, 136, 116, 4, + 0, 0, 138, 139, 0, 139, 140, 0, 0, 162, + 0, 144, 0, 204, 0, 169, 0, 170, 0, 172, + 0, 174, 0, 146, 0, 214, 0, 117, 0, 62, + 37, 4, 118, 0, 63, 37, 124, 118, 0, 84, + 37, 124, 118, 0, 50, 37, 4, 118, 0, 50, + 37, 4, 116, 4, 116, 4, 118, 0, 52, 37, + 4, 118, 0, 51, 0, 82, 37, 143, 118, 0, + 0, 83, 141, 37, 143, 118, 0, 64, 37, 124, + 118, 0, 0, 53, 124, 142, 139, 36, 0, 77, + 37, 175, 118, 0, 4, 0, 143, 116, 4, 0, + 143, 4, 0, 5, 0, 143, 116, 5, 0, 143, + 5, 0, 45, 47, 145, 48, 0, 145, 180, 0, + 145, 146, 0, 0, 65, 37, 4, 118, 0, 160, + 159, 0, 4, 0, 32, 0, 15, 0, 147, 161, + 4, 0, 147, 161, 32, 0, 147, 161, 15, 0, + 4, 0, 0, 119, 149, 147, 120, 0, 0, 4, + 150, 37, 147, 118, 0, 0, 15, 151, 37, 147, + 118, 0, 0, 32, 152, 37, 147, 118, 0, 160, + 159, 0, 81, 0, 117, 0, 85, 0, 148, 0, + 156, 37, 176, 118, 0, 79, 37, 176, 118, 0, + 154, 153, 0, 153, 0, 0, 154, 0, 41, 0, + 42, 0, 43, 0, 44, 0, 10, 176, 0, 0, + 6, 0, 7, 0, 8, 0, 9, 0, 11, 0, + 12, 0, 13, 0, 14, 0, 117, 0, 116, 0, + 4, 10, 176, 0, 4, 158, 176, 0, 88, 37, + 4, 10, 176, 118, 0, 116, 0, 0, 54, 47, + 164, 163, 48, 0, 163, 164, 0, 163, 116, 164, + 0, 0, 0, 4, 165, 168, 16, 166, 161, 167, + 0, 78, 10, 176, 0, 80, 10, 176, 0, 37, + 4, 118, 0, 0, 72, 37, 124, 118, 0, 73, + 37, 171, 118, 0, 73, 37, 118, 0, 171, 161, + 124, 0, 124, 0, 74, 37, 173, 118, 0, 173, + 161, 124, 0, 0, 75, 0, 76, 0, 0, 4, + 175, 0, 4, 116, 175, 0, 0, 177, 178, 0, + 31, 178, 0, 37, 178, 118, 0, 66, 37, 178, + 118, 0, 121, 178, 0, 30, 178, 0, 122, 178, + 0, 178, 32, 178, 0, 178, 33, 178, 0, 178, + 34, 178, 0, 178, 30, 178, 0, 178, 31, 178, + 0, 178, 28, 178, 0, 178, 29, 178, 0, 178, + 22, 178, 0, 178, 23, 178, 0, 178, 26, 178, + 0, 178, 27, 178, 0, 178, 24, 178, 0, 178, + 25, 178, 0, 178, 21, 178, 0, 178, 20, 178, + 0, 178, 19, 178, 0, 178, 15, 178, 16, 178, + 0, 178, 18, 178, 0, 178, 17, 178, 0, 61, + 37, 4, 118, 0, 3, 0, 49, 0, 67, 37, + 4, 118, 0, 68, 37, 4, 118, 0, 69, 37, + 4, 118, 0, 92, 37, 178, 118, 0, 38, 37, + 178, 118, 0, 39, 37, 178, 118, 0, 4, 0, + 70, 37, 178, 116, 178, 118, 0, 71, 37, 178, + 116, 178, 118, 0, 87, 37, 178, 118, 0, 0, + 0, 0, 0, 0, 0, 4, 181, 195, 179, 182, + 47, 183, 155, 48, 184, 198, 199, 157, 185, 161, + 0, 0, 0, 0, 0, 0, 60, 186, 196, 197, + 179, 187, 47, 188, 200, 48, 189, 198, 199, 157, + 190, 161, 0, 0, 0, 83, 191, 195, 192, 47, + 145, 48, 0, 56, 0, 57, 0, 58, 0, 59, + 0, 60, 0, 37, 193, 118, 0, 0, 178, 194, + 16, 0, 194, 16, 0, 40, 37, 178, 118, 194, + 16, 0, 40, 37, 178, 118, 39, 37, 178, 118, + 194, 16, 0, 178, 16, 0, 16, 0, 0, 77, + 0, 25, 4, 0, 0, 0, 199, 16, 4, 0, + 0, 0, 0, 0, 200, 4, 201, 47, 155, 48, + 202, 199, 157, 203, 161, 0, 46, 47, 205, 48, + 0, 0, 205, 206, 0, 0, 0, 4, 207, 209, + 210, 208, 117, 0, 178, 0, 0, 4, 211, 210, + 0, 87, 37, 178, 118, 210, 0, 0, 37, 178, + 118, 0, 0, 213, 216, 0, 0, 215, 114, 47, + 216, 48, 0, 217, 0, 216, 217, 0, 110, 47, + 219, 48, 117, 0, 110, 47, 219, 48, 218, 117, + 0, 110, 0, 218, 110, 0, 0, 220, 117, 0, + 112, 16, 220, 117, 0, 113, 16, 220, 117, 0, + 112, 16, 220, 117, 113, 16, 220, 117, 0, 111, + 0, 220, 117, 111, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 127, 129, 130, 134, 137, 139, 146, 152, 159, 161, - 164, 166, 167, 170, 173, 174, 175, 177, 179, 181, - 183, 185, 187, 189, 191, 193, 195, 197, 198, 199, - 201, 203, 205, 207, 209, 210, 211, 212, 213, 215, - 218, 220, 221, 224, 227, 230, 233, 237, 239, 240, - 243, 246, 250, 255, 261, 263, 268, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 280, 282, 284, 287, - 289, 291, 293, 294, 296, 298, 300, 301, 304, 308, - 311, 314, 317, 320, 325, 329, 331, 332, 335, 338, - 341, 344, 348, 353, 358, 359, 363, 364, 368, 371, - 373, 377, 378, 383, 384, 389, 399, 401, 404, 406, - 409, 412, 414, 416, 420, 428, 433, 436, 438, 440, - 442, 444, 446, 448, 453, 453, 457, 462, 470, 477, - 478, 481, 485, 487, 488, 492, 494, 497, 503, 512, - 517, 521, 526, 528, 532, 535, 540, 542, 545, 548, - 551, 556, 558, 561, 564, 566, 568, 570, 572, 575, - 577, 579, 581, 583, 585, 587, 589, 591, 593, 595, - 597, 599, 601, 603, 605, 607, 609, 611, 613, 615, - 617, 620, 622, 624, 626, 628, 630, 635, 637, 640, - 642, 644, 650, 650, 656, 656, 662, 666, 669, 671, - 672, 673, 674, 677, 679, 682, 684, 685, 690, 694, - 697, 700, 702, 708, 712, 714, 717, 719, 721, 727, - 757, 762, 774, 781, 786 + 142, 144, 145, 146, 150, 153, 155, 162, 168, 175, + 177, 180, 182, 183, 186, 189, 190, 191, 193, 195, + 197, 199, 201, 203, 205, 207, 209, 211, 213, 214, + 215, 217, 219, 221, 223, 225, 226, 227, 228, 229, + 231, 234, 236, 237, 240, 243, 246, 249, 253, 255, + 256, 259, 262, 266, 271, 277, 279, 284, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 297, 299, + 301, 304, 306, 308, 310, 311, 313, 315, 317, 318, + 319, 325, 329, 332, 335, 338, 341, 346, 350, 352, + 353, 356, 359, 364, 367, 369, 371, 373, 375, 379, + 384, 389, 390, 394, 395, 401, 402, 406, 409, 411, + 415, 416, 421, 422, 427, 437, 439, 442, 444, 447, + 450, 452, 454, 458, 466, 471, 474, 476, 478, 480, + 482, 484, 486, 491, 491, 495, 500, 508, 515, 516, + 519, 523, 525, 526, 530, 532, 535, 541, 550, 555, + 559, 564, 566, 570, 573, 578, 580, 583, 586, 589, + 593, 598, 607, 618, 620, 623, 626, 628, 630, 632, + 634, 637, 639, 641, 643, 645, 647, 649, 651, 653, + 655, 657, 659, 661, 663, 665, 667, 669, 671, 673, + 675, 677, 679, 682, 684, 686, 688, 690, 692, 694, + 696, 698, 703, 705, 708, 710, 712, 718, 719, 725, + 725, 727, 730, 734, 736, 742, 742, 748, 752, 755, + 757, 758, 759, 760, 763, 765, 768, 770, 771, 776, + 780, 782, 785, 788, 792, 795, 798, 803, 816, 818, + 824, 826, 832, 834, 838, 840, 843, 845, 847, 853, + 883, 888, 900, 907, 912, 920, 926, 934, 938, 944, + 946, 949, 954, 960, 965, 971, 976, 980, 984, 988, + 994, 999 }; static const char * const yytname[] = { "$","error","$undefined.","INT","NAME", @@ -362,394 +405,471 @@ "BLOCK","BIND","QUAD","LONG","SHORT","BYTE","SECTIONS","PHDRS","'{'","'}'","SIZEOF_HEADERS", "OUTPUT_FORMAT","FORCE_COMMON_ALLOCATION","OUTPUT_ARCH","INCLUDE","MEMORY","DEFSYMEND", "NOLOAD","DSECT","COPY","INFO","OVERLAY","DEFINED","TARGET_K","SEARCH_DIR","MAP", -"ENTRY","SIZEOF","NEXT","ADDR","STARTUP","HLL","SYSLIB","FLOAT","NOFLOAT","ORIGIN", -"FILL","LENGTH","CREATE_OBJECT_SYMBOLS","INPUT","GROUP","OUTPUT","CONSTRUCTORS", -"ALIGNMOD","AT","PROVIDE","CHIP","LIST","SECT","ABSOLUTE","LOAD","NEWLINE","ENDWORD", -"ORDER","NAMEWORD","FORMAT","PUBLIC","BASE","ALIAS","TRUNCATE","REL","INPUT_SCRIPT", -"INPUT_MRI_SCRIPT","INPUT_DEFSYM","CASE","EXTERN","START","','","';'","')'", -"'['","']'","'!'","'~'","file","filename","defsym_expr","@1","mri_script_file", -"@2","mri_script_lines","mri_script_command","@3","ordernamelist","mri_load_name_list", -"mri_abs_name_list","casesymlist","extern_name_list","script_file","@4","ifile_list", -"ifile_p1","@5","@6","input_list","sections","sec_or_group_p1","statement_anywhere", -"file_NAME_list","input_section_spec","@7","@8","@9","statement","statement_list", -"statement_list_opt","length","fill_opt","assign_op","end","assignment","opt_comma", -"memory","memory_spec_list","memory_spec","@10","origin_spec","length_spec", -"attributes_opt","startup","high_level_library","high_level_library_NAME_list", -"low_level_library","low_level_library_NAME_list","floating_point_support","mustbe_exp", -"@11","exp","opt_at","section","@12","@13","@14","@15","@16","@17","@18","type", -"atype","opt_exp_with_type","memspec_opt","phdr_opt","phdrs","phdr_list","phdr", -"@19","@20","phdr_type","phdr_qualifiers","phdr_val","" +"ENTRY","NEXT","SIZEOF","ADDR","LOADADDR","MAX","MIN","STARTUP","HLL","SYSLIB", +"FLOAT","NOFLOAT","NOCROSSREFS","ORIGIN","FILL","LENGTH","CREATE_OBJECT_SYMBOLS", +"INPUT","GROUP","OUTPUT","CONSTRUCTORS","ALIGNMOD","AT","PROVIDE","CHIP","LIST", +"SECT","ABSOLUTE","LOAD","NEWLINE","ENDWORD","ORDER","NAMEWORD","FORMAT","PUBLIC", +"BASE","ALIAS","TRUNCATE","REL","INPUT_SCRIPT","INPUT_MRI_SCRIPT","INPUT_DEFSYM", +"CASE","EXTERN","START","VERS_TAG","VERS_IDENTIFIER","GLOBAL","LOCAL","VERSION", +"INPUT_VERSION_SCRIPT","','","';'","')'","'['","']'","'!'","'~'","file","filename", +"defsym_expr","@1","mri_script_file","@2","mri_script_lines","mri_script_command", +"@3","ordernamelist","mri_load_name_list","mri_abs_name_list","casesymlist", +"extern_name_list","script_file","@4","ifile_list","ifile_p1","@5","@6","input_list", +"sections","sec_or_group_p1","statement_anywhere","file_NAME_list","input_section_spec", +"@7","@8","@9","@10","statement","statement_list","statement_list_opt","length", +"fill_opt","assign_op","end","assignment","opt_comma","memory","memory_spec_list", +"memory_spec","@11","origin_spec","length_spec","attributes_opt","startup","high_level_library", +"high_level_library_NAME_list","low_level_library","low_level_library_NAME_list", +"floating_point_support","nocrossref_list","mustbe_exp","@12","exp","opt_at", +"section","@13","@14","@15","@16","@17","@18","@19","@20","@21","@22","@23", +"@24","type","atype","opt_exp_with_type","opt_exp_without_type","opt_nocrossrefs", +"memspec_opt","phdr_opt","overlay_section","@25","@26","@27","phdrs","phdr_list", +"phdr","@28","@29","phdr_type","phdr_qualifiers","phdr_val","version_script_file", +"@30","version","@31","vers_nodes","vers_node","verdep","vers_tag","vers_defns", +"" }; #endif static const short yyr1[] = { 0, - 113, 113, 113, 114, 116, 115, 118, 117, 119, 119, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 121, 120, 120, 120, - 122, 122, 122, 123, 123, 124, 124, 125, 125, 125, - 126, 126, 128, 127, 129, 129, 130, 130, 130, 130, + 123, 123, 123, 123, 124, 126, 125, 128, 127, 129, + 129, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 131, 130, 130, 132, 130, 133, 133, - 133, 133, 133, 133, 134, 135, 135, 135, 136, 136, - 137, 137, 138, 139, 138, 140, 138, 141, 138, 142, - 142, 142, 142, 142, 142, 142, 143, 143, 144, 144, - 145, 145, 145, 145, 146, 146, 147, 147, 147, 147, - 147, 147, 147, 147, 148, 148, 149, 149, 149, 150, - 150, 151, 152, 152, 152, 154, 153, 155, 156, 157, - 157, 158, 159, 159, 160, 160, 161, 162, 162, 163, - 163, 165, 164, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 167, 167, 169, - 170, 171, 172, 173, 168, 174, 175, 168, 176, 176, - 176, 176, 176, 177, 177, 178, 178, 178, 178, 179, - 179, 180, 180, 181, 182, 182, 184, 185, 183, 186, - 187, 187, 187, 188, 188 + 130, 130, 130, 130, 130, 130, 130, 131, 130, 130, + 130, 132, 132, 132, 133, 133, 134, 134, 135, 135, + 135, 136, 136, 138, 137, 139, 139, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 141, 140, 140, 142, 140, + 140, 143, 143, 143, 143, 143, 143, 144, 145, 145, + 145, 146, 146, 147, 147, 147, 147, 147, 147, 148, + 149, 148, 150, 148, 151, 148, 152, 148, 153, 153, + 153, 153, 153, 153, 153, 154, 154, 155, 155, 156, + 156, 156, 156, 157, 157, 158, 158, 158, 158, 158, + 158, 158, 158, 159, 159, 160, 160, 160, 161, 161, + 162, 163, 163, 163, 165, 164, 166, 167, 168, 168, + 169, 170, 170, 171, 171, 172, 173, 173, 174, 174, + 175, 175, 175, 177, 176, 178, 178, 178, 178, 178, + 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, + 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, + 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, + 178, 178, 179, 179, 181, 182, 183, 184, 185, 180, + 186, 187, 188, 189, 190, 180, 191, 192, 180, 193, + 193, 193, 193, 193, 194, 194, 195, 195, 195, 195, + 196, 196, 197, 197, 198, 198, 199, 199, 200, 201, + 202, 203, 200, 204, 205, 205, 207, 208, 206, 209, + 210, 210, 210, 211, 211, 213, 212, 215, 214, 216, + 216, 217, 217, 218, 218, 219, 219, 219, 219, 219, + 220, 220 }; static const short yyr2[] = { 0, - 2, 2, 2, 1, 0, 4, 0, 2, 3, 0, - 2, 4, 1, 1, 2, 1, 4, 4, 3, 2, - 4, 3, 4, 4, 4, 4, 4, 2, 2, 2, - 4, 4, 2, 2, 2, 2, 0, 5, 2, 0, - 3, 2, 0, 1, 3, 1, 3, 0, 1, 3, - 1, 3, 0, 2, 2, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 4, 4, 4, 4, 8, - 4, 1, 4, 0, 5, 4, 0, 5, 1, 3, - 2, 1, 3, 2, 4, 2, 2, 0, 4, 2, - 1, 3, 1, 0, 4, 0, 5, 0, 5, 2, - 1, 1, 1, 1, 4, 4, 2, 1, 0, 1, - 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 3, 6, 1, - 0, 5, 2, 3, 0, 0, 7, 3, 3, 3, - 0, 4, 4, 3, 3, 1, 4, 3, 0, 1, - 1, 0, 2, 2, 3, 4, 2, 2, 2, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 5, 3, 3, 4, 1, - 1, 4, 4, 4, 4, 4, 1, 4, 0, 0, - 0, 0, 0, 0, 15, 0, 0, 7, 1, 1, - 1, 1, 1, 3, 0, 3, 2, 6, 10, 2, - 0, 0, 3, 4, 0, 2, 0, 0, 6, 1, - 0, 3, 5, 0, 3 + 2, 2, 2, 2, 1, 0, 4, 0, 2, 3, + 0, 2, 4, 1, 1, 2, 1, 4, 4, 3, + 2, 4, 3, 4, 4, 4, 4, 4, 2, 2, + 2, 4, 4, 2, 2, 2, 2, 0, 5, 2, + 0, 3, 2, 0, 1, 3, 1, 3, 0, 1, + 3, 1, 3, 0, 2, 2, 0, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, + 4, 8, 4, 1, 4, 0, 5, 4, 0, 5, + 4, 1, 3, 2, 1, 3, 2, 4, 2, 2, + 0, 4, 2, 1, 1, 1, 3, 3, 3, 1, + 0, 4, 0, 5, 0, 5, 0, 5, 2, 1, + 1, 1, 1, 4, 4, 2, 1, 0, 1, 1, + 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 3, 6, 1, 0, + 5, 2, 3, 0, 0, 7, 3, 3, 3, 0, + 4, 4, 3, 3, 1, 4, 3, 0, 1, 1, + 0, 2, 3, 0, 2, 2, 3, 4, 2, 2, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, + 4, 1, 1, 4, 4, 4, 4, 4, 4, 1, + 6, 6, 4, 0, 0, 0, 0, 0, 0, 15, + 0, 0, 0, 0, 0, 16, 0, 0, 7, 1, + 1, 1, 1, 1, 3, 0, 3, 2, 6, 10, + 2, 1, 0, 1, 2, 0, 0, 3, 0, 0, + 0, 0, 11, 4, 0, 2, 0, 0, 6, 1, + 0, 3, 5, 0, 3, 0, 2, 0, 5, 1, + 2, 5, 6, 1, 2, 0, 2, 4, 4, 8, + 1, 3 }; static const short yydefact[] = { 0, - 53, 7, 5, 1, 56, 2, 10, 3, 0, 54, - 8, 0, 0, 0, 0, 0, 72, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 150, 151, 0, - 74, 0, 0, 65, 55, 58, 64, 0, 57, 60, - 61, 62, 63, 59, 13, 0, 0, 0, 0, 14, - 0, 0, 0, 16, 43, 0, 0, 0, 0, 0, - 0, 48, 0, 0, 0, 0, 117, 118, 119, 120, - 152, 121, 122, 123, 124, 152, 88, 215, 0, 0, - 4, 77, 0, 0, 0, 0, 0, 0, 0, 149, - 0, 0, 0, 0, 126, 125, 90, 0, 37, 0, - 180, 187, 0, 0, 0, 0, 0, 181, 0, 0, - 0, 0, 0, 0, 0, 11, 0, 46, 28, 44, - 29, 15, 30, 20, 0, 33, 0, 34, 49, 35, - 51, 36, 39, 9, 6, 127, 0, 128, 0, 0, - 0, 0, 56, 136, 135, 0, 0, 0, 0, 0, - 144, 146, 131, 131, 79, 82, 0, 0, 0, 0, - 0, 0, 10, 0, 0, 158, 154, 0, 0, 0, - 0, 0, 0, 0, 0, 157, 159, 0, 0, 0, + 54, 8, 6, 256, 1, 57, 2, 11, 4, 0, + 3, 0, 55, 9, 0, 0, 257, 260, 0, 0, + 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 159, 160, 0, 0, 76, 0, 0, + 67, 56, 59, 65, 0, 58, 61, 62, 63, 64, + 60, 66, 0, 14, 0, 0, 0, 0, 15, 0, + 0, 0, 17, 44, 0, 0, 0, 0, 0, 0, + 49, 0, 0, 0, 0, 266, 261, 126, 127, 128, + 129, 164, 130, 131, 132, 133, 164, 91, 245, 0, + 0, 5, 79, 0, 0, 0, 0, 0, 0, 0, + 158, 161, 0, 0, 0, 0, 135, 134, 93, 0, + 0, 38, 0, 192, 200, 0, 0, 0, 0, 0, + 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 12, 0, 47, 29, 45, 30, 16, 31, 21, + 0, 34, 0, 35, 50, 36, 52, 37, 40, 10, + 7, 271, 0, 0, 0, 0, 136, 0, 137, 0, + 0, 0, 0, 57, 145, 144, 0, 0, 0, 0, + 0, 153, 155, 140, 140, 161, 0, 82, 85, 0, + 0, 0, 0, 0, 0, 0, 11, 0, 0, 170, + 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 169, 171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, - 0, 0, 42, 0, 0, 0, 19, 0, 0, 0, - 153, 190, 85, 196, 87, 86, 217, 214, 216, 0, - 69, 71, 0, 141, 0, 66, 67, 76, 89, 142, - 130, 143, 0, 147, 0, 81, 84, 0, 73, 0, - 68, 152, 24, 25, 40, 26, 27, 155, 0, 0, - 0, 0, 0, 0, 0, 0, 178, 177, 175, 174, - 173, 167, 168, 171, 172, 169, 170, 165, 166, 163, - 164, 160, 161, 162, 12, 23, 21, 47, 45, 41, - 17, 18, 32, 31, 50, 52, 205, 205, 0, 0, - 78, 0, 0, 132, 0, 133, 145, 148, 80, 83, - 75, 0, 38, 185, 186, 179, 182, 156, 183, 184, - 0, 0, 0, 205, 0, 189, 197, 220, 221, 0, - 0, 0, 134, 129, 176, 199, 200, 201, 202, 203, - 0, 0, 0, 0, 207, 0, 191, 0, 224, 0, - 218, 0, 140, 0, 131, 204, 0, 206, 0, 0, - 88, 0, 221, 0, 0, 70, 152, 0, 205, 0, - 192, 0, 0, 222, 0, 219, 138, 0, 137, 0, - 0, 188, 109, 198, 225, 221, 152, 0, 208, 93, - 98, 111, 112, 113, 114, 0, 101, 103, 102, 94, - 104, 108, 110, 0, 0, 0, 223, 139, 0, 0, - 0, 0, 0, 107, 193, 0, 100, 205, 0, 0, - 0, 91, 131, 211, 0, 0, 131, 131, 106, 95, - 0, 0, 212, 105, 209, 97, 99, 92, 210, 116, - 152, 0, 194, 115, 213, 131, 195, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 23, 0, 0, 43, + 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, + 267, 165, 205, 88, 211, 217, 90, 89, 247, 244, + 246, 0, 71, 73, 258, 150, 0, 68, 69, 78, + 92, 151, 139, 152, 0, 156, 0, 161, 162, 81, + 84, 87, 0, 75, 0, 70, 164, 0, 25, 26, + 41, 27, 28, 167, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 190, 189, 187, 186, 185, + 179, 180, 183, 184, 181, 182, 177, 178, 175, 176, + 172, 173, 174, 13, 24, 22, 48, 46, 42, 18, + 19, 33, 32, 51, 53, 0, 0, 264, 262, 0, + 272, 226, 0, 226, 0, 0, 80, 0, 0, 141, + 0, 142, 154, 157, 163, 83, 86, 77, 0, 259, + 39, 198, 199, 191, 168, 194, 195, 196, 0, 0, + 197, 0, 268, 269, 265, 263, 0, 0, 226, 0, + 204, 232, 0, 233, 218, 250, 251, 0, 0, 0, + 143, 138, 0, 0, 188, 0, 220, 221, 222, 223, + 224, 0, 0, 0, 0, 228, 0, 206, 231, 234, + 204, 0, 254, 0, 248, 0, 149, 0, 140, 201, + 202, 0, 225, 0, 227, 0, 0, 212, 91, 0, + 251, 0, 0, 72, 164, 0, 0, 226, 0, 207, + 0, 0, 0, 252, 0, 249, 147, 0, 146, 270, + 0, 0, 203, 118, 213, 219, 255, 251, 164, 0, + 229, 100, 105, 107, 120, 121, 122, 123, 0, 110, + 112, 111, 101, 113, 117, 119, 0, 0, 0, 239, + 253, 148, 0, 0, 0, 0, 164, 0, 116, 208, + 164, 109, 0, 226, 0, 0, 0, 0, 94, 96, + 95, 140, 236, 0, 240, 214, 0, 140, 140, 140, + 115, 102, 0, 0, 237, 114, 0, 236, 230, 104, + 106, 108, 97, 99, 98, 235, 125, 118, 237, 164, + 0, 209, 0, 125, 124, 238, 140, 241, 215, 210, + 237, 140, 125, 216, 242, 140, 243, 0, 0, 0 }; -static const short yydefgoto[] = { 438, - 82, 8, 9, 6, 7, 11, 65, 163, 122, 121, - 119, 130, 132, 4, 5, 10, 35, 92, 143, 157, - 36, 139, 37, 413, 391, 403, 400, 401, 392, 393, - 394, 395, 433, 76, 97, 38, 421, 39, 225, 145, - 224, 345, 369, 293, 40, 41, 153, 42, 154, 43, - 136, 137, 168, 337, 216, 287, 350, 373, 414, 436, - 288, 338, 331, 315, 316, 423, 430, 44, 140, 219, - 289, 355, 319, 341, 353 +static const short yydefgoto[] = { 538, + 93, 9, 10, 7, 8, 14, 74, 187, 138, 137, + 135, 146, 148, 5, 6, 13, 42, 104, 164, 180, + 43, 160, 44, 492, 464, 478, 474, 475, 476, 465, + 466, 467, 468, 522, 87, 109, 45, 503, 46, 257, + 166, 256, 409, 439, 339, 47, 48, 174, 49, 175, + 50, 177, 157, 158, 192, 398, 248, 332, 417, 444, + 493, 527, 333, 431, 470, 508, 532, 334, 402, 392, + 370, 371, 374, 401, 505, 517, 483, 507, 531, 536, + 51, 161, 251, 335, 423, 377, 405, 421, 11, 12, + 52, 53, 17, 18, 330, 155, 156 }; -static const short yypact[] = { -27, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 34, 381, - 386, 53, 352, 24, 33, 56,-32768, 66, 86, 62, - 81, 91, 118, 129, 138, 143, 144,-32768,-32768, 145, --32768, 151, 152,-32768,-32768,-32768,-32768, -9,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 173, 86, 188, 240,-32768, - 191, 192, 199,-32768,-32768, 208, 209, 217, 240, 218, - 220, 221, 222, 224, 134, 240,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 228, 229, --32768,-32768, 230, 231, 86, 86, 238, 86, 52,-32768, - 97, 212, 86, 241,-32768,-32768,-32768, -2,-32768, 1, --32768,-32768, 240, 240, 240, 213, 215,-32768, 216, 226, - 232, 235, 236, 240, 240, 778, 11,-32768, 155,-32768, - 168, 8,-32768,-32768, 180, 868, 169,-32768,-32768, 174, --32768, 175,-32768,-32768, 868,-32768, 240,-32768, 16, 14, - -71, 146,-32768,-32768,-32768, 147, 176, 179, 182, 189, --32768,-32768, -47, -39,-32768,-32768, 2, 97, 190, 289, - 240, 240,-32768, 240, 240,-32768,-32768, 502, 240, 240, - 300, 305, 240, 306, 240,-32768,-32768, 240, 240, 240, - 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, - 240, 240, 240, 240, 240, 240, 240, 240, 240, 868, - 307, 308,-32768, 309, 240, 240, 868, 102, 310, 312, - 868, 352,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 313, --32768,-32768, 341, 281, 5,-32768,-32768,-32768,-32768,-32768, --32768,-32768, 86,-32768, 86,-32768,-32768, 149,-32768, 19, --32768,-32768, 868, 868, 411, 868, 868,-32768, 522, 542, - 211, 214, 562, 219, 594, 840, 818, 884, 899, 913, - 926, 573, 573, 140, 140, 140, 140, 131, 131, 50, - 50,-32768,-32768,-32768, 868, 868, 868,-32768,-32768,-32768, - 868, 868,-32768,-32768,-32768,-32768, 227, 227, 240, 225, --32768, 316, 314,-32768, 230,-32768,-32768,-32768,-32768,-32768, --32768, 233,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 240, 148, 284, 798, 321, 242,-32768, 868, 9, 319, - 234, 252,-32768,-32768, 868,-32768,-32768,-32768,-32768,-32768, - 239, 240, 142, 324,-32768, 295,-32768, 296, 311, 317, --32768, 247,-32768, 334, 243,-32768, 614,-32768, 240, 299, --32768, 240, 9, 240, 261,-32768,-32768, 274, 48, 634, --32768, 172, 654,-32768, 686,-32768,-32768, 360,-32768, 335, - 355,-32768, 292,-32768,-32768, 9,-32768, 240,-32768, 20, --32768,-32768,-32768,-32768,-32768, 337,-32768,-32768,-32768,-32768, --32768,-32768, 292, 327, 342, -9,-32768,-32768, 706, 343, - 344, 240, 374,-32768,-32768, 240,-32768, 345, 374, 374, - 726,-32768, -70, 358, 746, 368, -17, -12,-32768,-32768, - 384, 385,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 42, --32768, 392,-32768,-32768,-32768, 243,-32768, 397, 398,-32768 +static const short yypact[] = { -23, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 74, +-32768, -14, 462, 524, 90, 64, -14,-32768, 1135, 67, + 87, 103,-32768, 105, 142, 136, 169, 173, 188, 199, + 201, 211, 212,-32768,-32768, 213, 215,-32768, 216, 217, +-32768,-32768,-32768,-32768, 85,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, 78,-32768, 251, 142, 258, 411,-32768, 260, + 270, 276,-32768,-32768, 277, 279, 280, 411, 281, 285, + 287, 288, 289, 195, 411, -9,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 290, + 293,-32768,-32768, 294, 295, 142, 142, 296, 142, 12, +-32768, 297, 214, 267, 142, 304,-32768,-32768,-32768, 262, + 7,-32768, 9,-32768,-32768, 411, 411, 411, 273, 278, +-32768, 291, 292, 298, 300, 302, 303, 306, 311, 411, + 411, 890, 174,-32768, 200,-32768, 202, 6,-32768,-32768, + 190, 990, 209,-32768,-32768, 210,-32768, 218,-32768,-32768, + 990,-32768, 301, 314, 308, 224,-32768, 411,-32768, 143, + 20, -75, 243,-32768,-32768,-32768, 248, 249, 250, 252, + 253,-32768,-32768, -41, 91, 11, 256,-32768,-32768, 8, + 214, 264, 317, -14, 411, 411,-32768, 411, 411,-32768, +-32768, 646, 411, 411, 327, 411, 329, 353, 365, 411, + 411, 411,-32768,-32768, 411, 411, 411, 411, 411, 411, + 411, 411, 411, 411, 411, 411, 411, 411, 411, 411, + 411, 411, 411, 411, 411, 411, 990, 372, 373,-32768, + 374, 411, 411, 990, 230, 379, 380, 274, 274, -59, + 275, 990, 1135,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, 383,-32768,-32768, 518, 351, 22,-32768,-32768,-32768, +-32768,-32768,-32768,-32768, 142,-32768, 142, 297,-32768,-32768, +-32768,-32768, 242,-32768, 17,-32768,-32768, -25, 990, 990, + 551, 990, 990,-32768, 666, 686, 271, 706, 282, 284, + 299, 910, 930, 726, 1032, 1009, 1068, 970, 1082, 1095, + 1106, 1106, 239, 239, 239, 239, 155, 155, 140, 140, +-32768,-32768,-32768, 990, 990, 990,-32768,-32768,-32768, 990, + 990,-32768,-32768,-32768,-32768, 305, 307,-32768,-32768, -54, +-32768, 283, 342, 283, 411, 309,-32768, 388, 381,-32768, + 294,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 310,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 411, 411, +-32768, 411, -49, 275,-32768,-32768, 49, 358, 952, 382, + 312,-32768, 1052, 319,-32768, 990, 10, 397, 313, 328, +-32768,-32768, 748, 768, 990, 391,-32768,-32768,-32768,-32768, +-32768, 318, 411, 139, 402,-32768, 384,-32768,-32768,-32768, + 312, 376, 389, 392,-32768, 320,-32768, 409, 316,-32768, +-32768, 274,-32768, 788,-32768, 411, 390,-32768,-32768, 411, + 10, 411, 322,-32768,-32768, 340, 323, 54, 808,-32768, + 396, 259, 828,-32768, 850,-32768,-32768, 420,-32768, 275, + 398, 429,-32768, 412,-32768,-32768,-32768, 10,-32768, 411, +-32768, 24,-32768,-32768,-32768,-32768,-32768,-32768, 410,-32768, +-32768,-32768,-32768,-32768,-32768, 412, 403, 415, 85,-32768, +-32768,-32768, 870, 421, 422, 424,-32768, 35,-32768,-32768, +-32768,-32768, 23, 425, 35, 35, 35, 339,-32768,-32768, +-32768, -26, 440, 349,-32768,-32768, 430, 99, 106, 114, +-32768,-32768, 40, 464,-32768,-32768, 423, 440,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768, 79, 412,-32768,-32768, + 465,-32768, 426, 79,-32768,-32768, 316,-32768,-32768,-32768, +-32768, 316, 79,-32768,-32768, 316,-32768, 471, 473,-32768 }; static const short yypgoto[] = {-32768, - -42,-32768,-32768,-32768,-32768, 237,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 259,-32768,-32768,-32768, 249, --32768, 57, -135, -251,-32768,-32768,-32768,-32768, 23,-32768, --32768,-32768,-32768,-32768, 13, -354, -151,-32768,-32768, -209, + -51,-32768,-32768,-32768,-32768, 315,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768, 321,-32768,-32768,-32768, 324, +-32768, 56, -153, -306,-32768,-32768,-32768,-32768,-32768, 18, +-32768, -42,-32768, -467,-32768, 14, -419, -172,-32768,-32768, + -228,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, -156, -87,-32768, -57, 86,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -75,-32768, -49,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768, -289, 130,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768, -331,-32768 + -363, 152,-32768,-32768, -20, -491,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768, -379,-32768,-32768,-32768, +-32768,-32768, 325, -13,-32768,-32768, -230 }; -#define YYLAST 960 +#define YYLAST 1149 -static const short yytable[] = { 116, - 138, 233, 235, 215, 99, 236, 237, 161, 144, 126, - 164, 203, 339, 101, 102, 296, 135, 217, 396, 212, - 198, 364, 236, 237, 334, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 220, 231, 221, 12, 396, 420, - 103, 104, 147, 148, 397, 150, 152, 105, 106, 107, - 159, 431, 294, 166, 167, 81, -96, 432, 231, 108, - 232, 218, 66, 213, 176, 177, 231, 200, 234, 371, - 77, 109, 1, 2, 3, 207, 110, 111, 112, 78, - 24, 194, 195, 196, 333, 323, 370, 211, 231, 81, - 426, 340, 79, 231, 214, 427, 95, 96, 113, 33, - 155, 156, 80, 162, 283, 284, 165, 238, 83, 239, - 295, 243, 244, 204, 246, 247, 199, 84, 416, 249, - 250, 114, 115, 253, 238, 255, 301, 85, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 101, 102, 299, 300, 86, 281, 282, 417, 418, 151, - 192, 193, 194, 195, 196, 87, 302, 190, 191, 192, - 193, 194, 195, 196, 88, 212, 98, 103, 104, 89, - 90, 91, 101, 102, 105, 106, 107, 93, 94, 205, - 297, 100, 298, 358, 117, 118, 108, 326, 327, 328, - 329, 330, 120, 326, 327, 328, 329, 330, 109, 103, - 104, 123, 124, 110, 111, 112, 105, 106, 107, 374, - 125, 127, 128, 134, 129, 131, 215, 133, 108, 101, - 102, 141, 142, 144, 146, 113, 24, 314, 314, 318, - 109, 149, 101, 102, 160, 110, 111, 112, 158, 169, - 214, 170, 171, 222, 226, 33, 103, 104, 114, 115, - 201, 325, 172, 312, 106, 107, 313, 113, 173, 103, - 104, 174, 175, 202, 208, 108, 105, 106, 107, 209, - 210, 367, 347, 227, 437, 206, 228, 109, 108, 229, - 114, 115, 110, 111, 112, 380, 230, 241, 242, 360, - 109, 398, 363, 251, 365, 110, 111, 112, 252, 254, - 278, 279, 280, 285, 113, 286, 290, 292, 306, 321, - 332, 307, 342, 381, 336, 344, 309, 113, 399, 322, - 320, 349, 382, 383, 384, 385, 335, 114, 115, 348, - 324, 343, 351, 357, 13, 361, 346, 352, 231, 368, - 114, 115, 411, 354, 356, 434, 415, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 386, 366, 387, 377, - 379, 378, 388, 402, 405, 33, 291, 412, 406, 409, - 410, 333, 422, 425, 13, 14, 15, 428, 429, 45, - 16, 17, 18, 19, 20, 435, 439, 440, 389, 245, - 390, 223, 21, 22, 23, 24, 240, 362, 407, 25, - 26, 27, 28, 29, 45, 404, 0, 317, 30, 31, - 32, 0, 0, 46, 33, 14, 15, 0, 0, 0, - 16, 17, 18, 19, 20, 0, 0, 0, 47, 0, - 0, 0, 21, 22, 23, 24, 303, 34, 46, 25, - 26, 27, 28, 29, 0, 0, 0, 0, 30, 31, - 32, 0, 0, 47, 33, 0, 0, 48, 0, 0, - 49, 50, 51, 52, 53, -40, 54, 55, 56, 57, - 58, 59, 60, 61, 0, 0, 0, 34, 62, 63, - 64, 0, 48, 0, 0, 49, 50, 51, 52, 53, - 0, 54, 55, 56, 57, 58, 59, 60, 61, 0, - 0, 0, 0, 62, 63, 64, 178, 0, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 178, 0, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 178, 0, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 178, 0, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 0, 178, 248, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 178, 304, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 178, 305, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 178, 308, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 178, 310, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 178, 359, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 178, 372, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 178, 375, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 178, 376, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 178, 408, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 0, 419, 333, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 0, 424, 178, 311, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 0, 0, 0, 0, 0, 0, - 0, 0, 178, 197, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196 +static const short yytable[] = { 159, + 132, 265, 267, 77, 112, 395, 247, 326, 327, 230, + 142, 271, 272, 403, 176, 92, 185, 151, 188, 269, + 271, 272, 350, 249, 469, 165, 495, 524, 342, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 489, 533, + 252, 434, 253, 513, 168, 169, 469, 171, 173, 490, + 328, 114, 115, 182, 514, 365, 529, 329, 190, 191, + -103, 331, 366, 386, 442, 535, 491, 250, 471, 340, + 496, 515, 203, 204, 263, 227, 264, 15, 116, 117, + 1, 2, 3, 234, 16, 118, 119, 120, 520, 263, + 394, 4, 441, 502, 521, 16, 404, 121, 469, 75, + 242, 152, 153, 154, 387, 388, 389, 390, 391, 122, + 76, 345, 381, 88, 123, 124, 125, 126, 127, 128, + 497, 231, 186, 273, 189, 274, 268, 279, 280, 172, + 282, 283, 273, 89, 348, 285, 286, 341, 288, 90, + 129, 91, 292, 293, 294, 92, 243, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 130, + 131, 221, 222, 223, 320, 321, 114, 115, 498, 499, + 500, 427, 94, 225, 219, 220, 221, 222, 223, 349, + 244, 110, 114, 115, 387, 388, 389, 390, 391, 232, + 107, 108, 245, 116, 117, 95, 263, 30, 266, 96, + 118, 119, 120, 343, 263, 344, 510, 178, 179, 116, + 117, 263, 121, 511, 97, 246, 118, 119, 120, 263, + 40, 512, 322, 323, 122, 98, 426, 99, 121, 123, + 124, 125, 126, 127, 128, 346, 347, 100, 101, 102, + 122, 103, 105, 106, 111, 123, 124, 125, 126, 127, + 128, 113, 243, 133, 77, 129, 217, 218, 219, 220, + 221, 222, 223, 134, 369, 373, 369, 376, 247, 136, + 139, 129, 140, 141, 143, 114, 115, 144, 150, 226, + 145, 147, 149, 162, 130, 131, 163, 165, 167, 170, + 176, 383, 384, 181, 385, 233, 446, 183, 184, 193, + 130, 131, 116, 117, 194, 228, 238, 229, 245, 367, + 119, 120, 368, 30, 235, 236, 277, 195, 196, 239, + 287, 121, 289, 237, 197, 414, 198, 437, 199, 200, + 241, 246, 201, 122, 114, 115, 40, 202, 123, 124, + 125, 126, 127, 128, 530, 240, 290, 372, 429, 534, + 254, 472, 433, 537, 435, 258, 259, 260, 291, 261, + 262, 116, 117, 270, 129, 317, 318, 319, 118, 119, + 120, 276, 324, 325, 152, 331, 336, 338, 354, 488, + 121, 379, 473, 494, 393, 400, 380, 396, 397, 356, + 406, 357, 122, 130, 131, 408, 412, 123, 124, 125, + 126, 127, 128, 114, 115, 452, 358, 415, 425, 438, + 416, 363, 419, 364, 378, 420, 453, 382, 422, 449, + 407, 263, 525, 129, 450, 413, 430, 424, 436, 440, + 116, 117, 445, 454, 451, 509, 477, 118, 119, 120, + 480, 481, 455, 456, 457, 458, 501, 485, 486, 121, + 487, 394, 130, 131, 504, 19, 506, 516, 526, 518, + 539, 122, 540, 528, 432, 523, 123, 124, 125, 126, + 127, 128, 482, 479, 255, 375, 418, 519, 0, 0, + 459, 0, 460, 0, 0, 0, 461, 0, 0, 40, + 0, 281, 129, 0, 275, 0, 20, 21, 278, 0, + 0, 22, 23, 24, 25, 26, 0, 0, 0, 0, + 0, 19, 0, 27, 28, 29, 30, 54, 462, 0, + 463, 130, 131, 31, 32, 33, 34, 35, 36, 0, + 0, 0, 0, 37, 38, 39, 0, 0, 0, 40, + 0, 0, 0, 337, 54, 0, 0, 0, 0, 0, + 0, 55, 20, 21, 0, 0, 0, 22, 23, 24, + 25, 26, 0, 0, 0, -258, 56, 0, 41, 27, + 28, 29, 30, 0, 0, 0, 351, 0, 55, 31, + 32, 33, 34, 35, 36, 0, 0, 0, 0, 37, + 38, 39, 0, 56, 0, 40, 0, 0, 0, 57, + 0, 0, 58, 59, 60, 61, 62, -41, 63, 64, + 65, 66, 67, 68, 69, 70, 0, 0, 0, 0, + 71, 72, 73, 0, 41, 0, 57, 0, 0, 58, + 59, 60, 61, 62, 0, 63, 64, 65, 66, 67, + 68, 69, 70, 0, 0, 0, 0, 71, 72, 73, + 205, 0, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 205, 0, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 205, 0, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 205, 0, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 205, 0, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 0, 0, 205, 284, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 205, 352, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 205, 353, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 205, 355, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 205, 361, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 0, 0, 205, 410, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 205, 411, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 205, 428, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 205, 443, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 205, 447, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 0, 0, 205, 448, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 0, 484, 394, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 205, 224, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 0, 359, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, + 221, 222, 223, 0, 0, 360, 205, 362, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 205, 399, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 78, 79, 80, 81, 82, 83, 84, 85, 86 }; -static const short yycheck[] = { 49, - 76, 153, 154, 139, 47, 4, 5, 10, 4, 59, - 10, 4, 4, 3, 4, 225, 66, 4, 373, 4, - 10, 353, 4, 5, 314, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 106, 106, 108, 4, 393, 110, - 30, 31, 85, 86, 376, 88, 89, 37, 38, 39, - 93, 10, 48, 103, 104, 4, 37, 16, 106, 49, - 108, 48, 10, 48, 114, 115, 106, 117, 108, 359, - 47, 61, 100, 101, 102, 125, 66, 67, 68, 47, - 65, 32, 33, 34, 37, 295, 39, 137, 106, 4, - 108, 83, 37, 106, 79, 108, 106, 107, 88, 84, - 4, 5, 37, 106, 3, 4, 106, 106, 47, 108, - 106, 161, 162, 106, 164, 165, 106, 37, 408, 169, - 170, 111, 112, 173, 106, 175, 108, 37, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 3, 4, 4, 5, 37, 205, 206, 409, 410, 108, - 30, 31, 32, 33, 34, 37, 242, 28, 29, 30, - 31, 32, 33, 34, 37, 4, 4, 30, 31, 37, - 37, 37, 3, 4, 37, 38, 39, 37, 37, 10, - 233, 4, 235, 345, 4, 4, 49, 56, 57, 58, - 59, 60, 4, 56, 57, 58, 59, 60, 61, 30, - 31, 4, 4, 66, 67, 68, 37, 38, 39, 48, - 4, 4, 3, 90, 4, 4, 362, 4, 49, 3, - 4, 4, 4, 4, 4, 88, 65, 287, 288, 289, - 61, 4, 3, 4, 4, 66, 67, 68, 37, 37, - 79, 37, 37, 108, 108, 84, 30, 31, 111, 112, - 106, 311, 37, 37, 38, 39, 40, 88, 37, 30, - 31, 37, 37, 106, 106, 49, 37, 38, 39, 106, - 106, 357, 332, 108, 436, 106, 108, 61, 49, 108, - 111, 112, 66, 67, 68, 4, 108, 108, 10, 349, - 61, 377, 352, 4, 354, 66, 67, 68, 4, 4, - 4, 4, 4, 4, 88, 4, 4, 37, 108, 4, - 37, 108, 4, 32, 83, 74, 108, 88, 378, 16, - 106, 37, 41, 42, 43, 44, 16, 111, 112, 16, - 108, 108, 47, 10, 4, 47, 108, 37, 106, 76, - 111, 112, 402, 37, 108, 431, 406, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 75, 107, 77, 10, - 16, 37, 81, 37, 48, 84, 36, 4, 37, 37, - 37, 37, 25, 16, 4, 45, 46, 4, 4, 4, - 50, 51, 52, 53, 54, 4, 0, 0, 107, 163, - 109, 143, 62, 63, 64, 65, 158, 351, 396, 69, - 70, 71, 72, 73, 4, 393, -1, 288, 78, 79, - 80, -1, -1, 38, 84, 45, 46, -1, -1, -1, - 50, 51, 52, 53, 54, -1, -1, -1, 53, -1, - -1, -1, 62, 63, 64, 65, 36, 107, 38, 69, - 70, 71, 72, 73, -1, -1, -1, -1, 78, 79, - 80, -1, -1, 53, 84, -1, -1, 82, -1, -1, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, -1, -1, -1, 107, 103, 104, - 105, -1, 82, -1, -1, 85, 86, 87, 88, 89, - -1, 91, 92, 93, 94, 95, 96, 97, 98, -1, - -1, -1, -1, 103, 104, 105, 15, -1, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 15, -1, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 15, -1, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 15, -1, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, -1, 15, 108, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 15, 108, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 15, 108, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 15, 108, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 15, 108, 17, 18, 19, 20, 21, 22, 23, 24, +static const short yycheck[] = { 87, + 58, 174, 175, 17, 56, 369, 160, 238, 239, 4, + 68, 4, 5, 4, 4, 4, 10, 75, 10, 176, + 4, 5, 48, 4, 444, 4, 4, 519, 257, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 4, 531, + 116, 421, 118, 4, 96, 97, 466, 99, 100, 15, + 110, 3, 4, 105, 15, 110, 524, 117, 116, 117, + 37, 111, 117, 113, 428, 533, 32, 48, 448, 48, + 48, 32, 130, 131, 116, 133, 118, 4, 30, 31, + 104, 105, 106, 141, 110, 37, 38, 39, 10, 116, + 37, 115, 39, 120, 16, 110, 87, 49, 518, 10, + 158, 111, 112, 113, 56, 57, 58, 59, 60, 61, + 47, 268, 341, 47, 66, 67, 68, 69, 70, 71, + 484, 116, 116, 116, 116, 118, 116, 185, 186, 118, + 188, 189, 116, 47, 118, 193, 194, 116, 196, 37, + 92, 37, 200, 201, 202, 4, 4, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 121, + 122, 32, 33, 34, 232, 233, 3, 4, 485, 486, + 487, 412, 47, 10, 30, 31, 32, 33, 34, 277, + 48, 114, 3, 4, 56, 57, 58, 59, 60, 10, + 116, 117, 60, 30, 31, 37, 116, 65, 118, 37, + 37, 38, 39, 265, 116, 267, 118, 4, 5, 30, + 31, 116, 49, 118, 37, 83, 37, 38, 39, 116, + 88, 118, 3, 4, 61, 37, 409, 37, 49, 66, + 67, 68, 69, 70, 71, 4, 5, 37, 37, 37, + 61, 37, 37, 37, 4, 66, 67, 68, 69, 70, + 71, 4, 4, 4, 278, 92, 28, 29, 30, 31, + 32, 33, 34, 4, 332, 333, 334, 335, 432, 4, + 4, 92, 4, 4, 4, 3, 4, 3, 94, 116, + 4, 4, 4, 4, 121, 122, 4, 4, 4, 4, + 4, 359, 360, 37, 362, 116, 48, 4, 47, 37, + 121, 122, 30, 31, 37, 116, 16, 116, 60, 37, + 38, 39, 40, 65, 116, 116, 10, 37, 37, 16, + 4, 49, 4, 116, 37, 393, 37, 425, 37, 37, + 117, 83, 37, 61, 3, 4, 88, 37, 66, 67, + 68, 69, 70, 71, 527, 48, 4, 16, 416, 532, + 118, 449, 420, 536, 422, 118, 118, 118, 4, 118, + 118, 30, 31, 118, 92, 4, 4, 4, 37, 38, + 39, 118, 4, 4, 111, 111, 4, 37, 118, 477, + 49, 4, 450, 481, 37, 77, 16, 16, 87, 118, + 4, 118, 61, 121, 122, 78, 16, 66, 67, 68, + 69, 70, 71, 3, 4, 4, 118, 16, 10, 80, + 37, 117, 47, 117, 116, 37, 15, 118, 37, 10, + 118, 116, 520, 92, 37, 118, 47, 118, 117, 117, + 30, 31, 47, 32, 16, 16, 37, 37, 38, 39, + 48, 37, 41, 42, 43, 44, 118, 37, 37, 49, + 37, 37, 121, 122, 25, 4, 118, 4, 4, 47, + 0, 61, 0, 48, 419, 518, 66, 67, 68, 69, + 70, 71, 469, 466, 164, 334, 401, 508, -1, -1, + 79, -1, 81, -1, -1, -1, 85, -1, -1, 88, + -1, 187, 92, -1, 181, -1, 45, 46, 184, -1, + -1, 50, 51, 52, 53, 54, -1, -1, -1, -1, + -1, 4, -1, 62, 63, 64, 65, 4, 117, -1, + 119, 121, 122, 72, 73, 74, 75, 76, 77, -1, + -1, -1, -1, 82, 83, 84, -1, -1, -1, 88, + -1, -1, -1, 36, 4, -1, -1, -1, -1, -1, + -1, 38, 45, 46, -1, -1, -1, 50, 51, 52, + 53, 54, -1, -1, -1, 114, 53, -1, 117, 62, + 63, 64, 65, -1, -1, -1, 36, -1, 38, 72, + 73, 74, 75, 76, 77, -1, -1, -1, -1, 82, + 83, 84, -1, 53, -1, 88, -1, -1, -1, 86, + -1, -1, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, + 107, 108, 109, -1, 117, -1, 86, -1, -1, 89, + 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, + 100, 101, 102, -1, -1, -1, -1, 107, 108, 109, + 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 15, 108, 17, 18, 19, 20, 21, 22, 23, 24, + 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 15, 108, 17, 18, 19, 20, 21, 22, 23, 24, + 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 15, 108, 17, 18, 19, 20, 21, 22, 23, 24, + 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 15, 108, 17, 18, 19, 20, 21, 22, + 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + -1, -1, 15, 118, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 15, 108, 17, 18, 19, 20, 21, 22, + 33, 34, 15, 118, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, 108, 37, 18, 19, 20, 21, 22, + 33, 34, 15, 118, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, 108, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, - -1, -1, 15, 106, 17, 18, 19, 20, 21, 22, + 33, 34, 15, 118, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 20, 21, + 33, 34, 15, 118, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, -1, -1, 15, 118, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 15, 118, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 15, 118, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 15, 118, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 15, 118, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, -1, -1, 15, 118, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, -1, 118, 37, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 15, 116, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, -1, 116, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 + 32, 33, 34, -1, -1, 116, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 6, 7, 8, 9, 10, 11, 12, 13, 14 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/unsupported/share/bison.simple" @@ -1243,296 +1363,324 @@ switch (yyn) { -case 5: -#line 138 "./ldgram.y" +case 6: +#line 154 "./ldgram.y" { ldlex_defsym(); ; break;} -case 6: -#line 140 "./ldgram.y" +case 7: +#line 156 "./ldgram.y" { ldlex_popstate(); lang_add_assignment(exp_assop(yyvsp[-1].token,yyvsp[-2].name,yyvsp[0].etree)); ; break;} -case 7: -#line 147 "./ldgram.y" +case 8: +#line 163 "./ldgram.y" { ldlex_mri_script (); PUSH_ERROR ("MRI style script"); ; break;} -case 8: -#line 152 "./ldgram.y" +case 9: +#line 168 "./ldgram.y" { ldlex_popstate (); mri_draw_tree (); POP_ERROR (); ; break;} -case 13: -#line 167 "./ldgram.y" +case 14: +#line 183 "./ldgram.y" { einfo("%P%F: unrecognised keyword in MRI style script '%s'\n",yyvsp[0].name); ; break;} -case 14: -#line 170 "./ldgram.y" +case 15: +#line 186 "./ldgram.y" { config.map_filename = "-"; ; break;} -case 17: -#line 176 "./ldgram.y" -{ mri_public(yyvsp[-2].name, yyvsp[0].etree); ; - break;} case 18: -#line 178 "./ldgram.y" +#line 192 "./ldgram.y" { mri_public(yyvsp[-2].name, yyvsp[0].etree); ; break;} case 19: -#line 180 "./ldgram.y" -{ mri_public(yyvsp[-1].name, yyvsp[0].etree); ; +#line 194 "./ldgram.y" +{ mri_public(yyvsp[-2].name, yyvsp[0].etree); ; break;} case 20: -#line 182 "./ldgram.y" -{ mri_format(yyvsp[0].name); ; +#line 196 "./ldgram.y" +{ mri_public(yyvsp[-1].name, yyvsp[0].etree); ; break;} case 21: -#line 184 "./ldgram.y" -{ mri_output_section(yyvsp[-2].name, yyvsp[0].etree);; +#line 198 "./ldgram.y" +{ mri_format(yyvsp[0].name); ; break;} case 22: -#line 186 "./ldgram.y" -{ mri_output_section(yyvsp[-1].name, yyvsp[0].etree);; +#line 200 "./ldgram.y" +{ mri_output_section(yyvsp[-2].name, yyvsp[0].etree);; break;} case 23: -#line 188 "./ldgram.y" -{ mri_output_section(yyvsp[-2].name, yyvsp[0].etree);; +#line 202 "./ldgram.y" +{ mri_output_section(yyvsp[-1].name, yyvsp[0].etree);; break;} case 24: -#line 190 "./ldgram.y" -{ mri_align(yyvsp[-2].name,yyvsp[0].etree); ; +#line 204 "./ldgram.y" +{ mri_output_section(yyvsp[-2].name, yyvsp[0].etree);; break;} case 25: -#line 192 "./ldgram.y" +#line 206 "./ldgram.y" { mri_align(yyvsp[-2].name,yyvsp[0].etree); ; break;} case 26: -#line 194 "./ldgram.y" -{ mri_alignmod(yyvsp[-2].name,yyvsp[0].etree); ; +#line 208 "./ldgram.y" +{ mri_align(yyvsp[-2].name,yyvsp[0].etree); ; break;} case 27: -#line 196 "./ldgram.y" +#line 210 "./ldgram.y" { mri_alignmod(yyvsp[-2].name,yyvsp[0].etree); ; break;} -case 30: -#line 200 "./ldgram.y" -{ mri_name(yyvsp[0].name); ; +case 28: +#line 212 "./ldgram.y" +{ mri_alignmod(yyvsp[-2].name,yyvsp[0].etree); ; break;} case 31: -#line 202 "./ldgram.y" -{ mri_alias(yyvsp[-2].name,yyvsp[0].name,0);; +#line 216 "./ldgram.y" +{ mri_name(yyvsp[0].name); ; break;} case 32: -#line 204 "./ldgram.y" -{ mri_alias(yyvsp[-2].name,0,(int) yyvsp[0].integer);; +#line 218 "./ldgram.y" +{ mri_alias(yyvsp[-2].name,yyvsp[0].name,0);; break;} case 33: -#line 206 "./ldgram.y" -{ mri_base(yyvsp[0].etree); ; +#line 220 "./ldgram.y" +{ mri_alias(yyvsp[-2].name,0,(int) yyvsp[0].integer);; break;} case 34: -#line 208 "./ldgram.y" +#line 222 "./ldgram.y" +{ mri_base(yyvsp[0].etree); ; + break;} +case 35: +#line 224 "./ldgram.y" { mri_truncate((unsigned int) yyvsp[0].integer); ; break;} -case 37: -#line 212 "./ldgram.y" +case 38: +#line 228 "./ldgram.y" { ldfile_open_command_file (yyvsp[0].name); ; break;} -case 39: -#line 214 "./ldgram.y" +case 40: +#line 230 "./ldgram.y" { lang_add_entry (yyvsp[0].name, false); ; break;} -case 41: -#line 219 "./ldgram.y" -{ mri_order(yyvsp[0].name); ; - break;} case 42: -#line 220 "./ldgram.y" +#line 235 "./ldgram.y" { mri_order(yyvsp[0].name); ; break;} -case 44: -#line 226 "./ldgram.y" -{ mri_load(yyvsp[0].name); ; +case 43: +#line 236 "./ldgram.y" +{ mri_order(yyvsp[0].name); ; break;} case 45: -#line 227 "./ldgram.y" +#line 242 "./ldgram.y" { mri_load(yyvsp[0].name); ; break;} case 46: -#line 232 "./ldgram.y" -{ mri_only_load(yyvsp[0].name); ; +#line 243 "./ldgram.y" +{ mri_load(yyvsp[0].name); ; break;} case 47: -#line 234 "./ldgram.y" +#line 248 "./ldgram.y" { mri_only_load(yyvsp[0].name); ; break;} case 48: -#line 238 "./ldgram.y" -{ yyval.name = NULL; ; +#line 250 "./ldgram.y" +{ mri_only_load(yyvsp[0].name); ; break;} -case 51: -#line 245 "./ldgram.y" -{ ldlang_add_undef (yyvsp[0].name); ; +case 49: +#line 254 "./ldgram.y" +{ yyval.name = NULL; ; break;} case 52: -#line 247 "./ldgram.y" +#line 261 "./ldgram.y" { ldlang_add_undef (yyvsp[0].name); ; break;} case 53: -#line 251 "./ldgram.y" +#line 263 "./ldgram.y" +{ ldlang_add_undef (yyvsp[0].name); ; + break;} +case 54: +#line 267 "./ldgram.y" { ldlex_both(); ; break;} -case 54: -#line 255 "./ldgram.y" +case 55: +#line 271 "./ldgram.y" { ldlex_popstate(); ; break;} -case 66: -#line 279 "./ldgram.y" +case 68: +#line 296 "./ldgram.y" { lang_add_target(yyvsp[-1].name); ; break;} -case 67: -#line 281 "./ldgram.y" +case 69: +#line 298 "./ldgram.y" { ldfile_add_library_path (yyvsp[-1].name, false); ; break;} -case 68: -#line 283 "./ldgram.y" +case 70: +#line 300 "./ldgram.y" { lang_add_output(yyvsp[-1].name, 1); ; break;} -case 69: -#line 285 "./ldgram.y" +case 71: +#line 302 "./ldgram.y" { lang_add_output_format (yyvsp[-1].name, (char *) NULL, (char *) NULL, 1); ; break;} -case 70: -#line 288 "./ldgram.y" +case 72: +#line 305 "./ldgram.y" { lang_add_output_format (yyvsp[-5].name, yyvsp[-3].name, yyvsp[-1].name, 1); ; break;} -case 71: -#line 290 "./ldgram.y" +case 73: +#line 307 "./ldgram.y" { ldfile_set_output_arch(yyvsp[-1].name); ; break;} -case 72: -#line 292 "./ldgram.y" +case 74: +#line 309 "./ldgram.y" { command_line.force_common_definition = true ; ; break;} -case 74: -#line 295 "./ldgram.y" +case 76: +#line 312 "./ldgram.y" { lang_enter_group (); ; break;} -case 75: -#line 297 "./ldgram.y" +case 77: +#line 314 "./ldgram.y" { lang_leave_group (); ; break;} -case 76: -#line 299 "./ldgram.y" +case 78: +#line 316 "./ldgram.y" { lang_add_map(yyvsp[-1].name); ; break;} -case 77: -#line 301 "./ldgram.y" +case 79: +#line 318 "./ldgram.y" { ldfile_open_command_file(yyvsp[0].name); ; break;} -case 79: -#line 306 "./ldgram.y" +case 81: +#line 320 "./ldgram.y" +{ + lang_add_nocrossref (yyvsp[-1].nocrossref); + ; + break;} +case 82: +#line 327 "./ldgram.y" { lang_add_input_file(yyvsp[0].name,lang_input_file_is_search_file_enum, (char *)NULL); ; break;} -case 80: -#line 309 "./ldgram.y" +case 83: +#line 330 "./ldgram.y" { lang_add_input_file(yyvsp[0].name,lang_input_file_is_search_file_enum, (char *)NULL); ; break;} -case 81: -#line 312 "./ldgram.y" +case 84: +#line 333 "./ldgram.y" { lang_add_input_file(yyvsp[0].name,lang_input_file_is_search_file_enum, (char *)NULL); ; break;} -case 82: -#line 315 "./ldgram.y" +case 85: +#line 336 "./ldgram.y" { lang_add_input_file(yyvsp[0].name,lang_input_file_is_l_enum, (char *)NULL); ; break;} -case 83: -#line 318 "./ldgram.y" +case 86: +#line 339 "./ldgram.y" { lang_add_input_file(yyvsp[0].name,lang_input_file_is_l_enum, (char *)NULL); ; break;} -case 84: -#line 321 "./ldgram.y" +case 87: +#line 342 "./ldgram.y" { lang_add_input_file(yyvsp[0].name,lang_input_file_is_l_enum, (char *)NULL); ; break;} -case 89: -#line 337 "./ldgram.y" +case 92: +#line 358 "./ldgram.y" { lang_add_entry (yyvsp[-1].name, false); ; break;} -case 91: -#line 343 "./ldgram.y" -{ lang_add_wild(yyvsp[0].name, current_file); ; +case 94: +#line 366 "./ldgram.y" +{ lang_add_wild (yyvsp[0].name, current_file); ; break;} -case 92: -#line 345 "./ldgram.y" -{ lang_add_wild(yyvsp[0].name, current_file); ; +case 95: +#line 368 "./ldgram.y" +{ lang_add_wild ("*", current_file); ; break;} -case 93: -#line 350 "./ldgram.y" +case 96: +#line 370 "./ldgram.y" +{ lang_add_wild ("?", current_file); ; + break;} +case 97: +#line 372 "./ldgram.y" +{ lang_add_wild (yyvsp[0].name, current_file); ; + break;} +case 98: +#line 374 "./ldgram.y" +{ lang_add_wild ("*", current_file); ; + break;} +case 99: +#line 376 "./ldgram.y" +{ lang_add_wild ("?", current_file); ; + break;} +case 100: +#line 381 "./ldgram.y" { lang_add_wild((char *)NULL, yyvsp[0].name); ; break;} -case 94: -#line 354 "./ldgram.y" +case 101: +#line 385 "./ldgram.y" { current_file = (char *)NULL; ; break;} -case 96: -#line 360 "./ldgram.y" +case 103: +#line 391 "./ldgram.y" { - current_file =yyvsp[0].name; + current_file = yyvsp[0].name; ; break;} -case 98: -#line 365 "./ldgram.y" +case 105: +#line 398 "./ldgram.y" +{ + current_file = "?"; + ; + break;} +case 107: +#line 403 "./ldgram.y" { current_file = (char *)NULL; ; break;} -case 101: -#line 374 "./ldgram.y" +case 110: +#line 412 "./ldgram.y" { lang_add_attribute(lang_object_symbols_statement_enum); ; break;} -case 103: -#line 379 "./ldgram.y" +case 112: +#line 417 "./ldgram.y" { lang_add_attribute(lang_constructors_statement_enum); ; break;} -case 105: -#line 385 "./ldgram.y" +case 114: +#line 423 "./ldgram.y" { lang_add_data((int) yyvsp[-3].integer,yyvsp[-1].etree); ; break;} -case 106: -#line 390 "./ldgram.y" +case 115: +#line 428 "./ldgram.y" { lang_add_fill (exp_get_value_int(yyvsp[-1].etree, @@ -1541,24 +1689,24 @@ lang_first_phase_enum)); ; break;} -case 111: -#line 411 "./ldgram.y" +case 120: +#line 449 "./ldgram.y" { yyval.integer = yyvsp[0].token; ; break;} -case 112: -#line 413 "./ldgram.y" +case 121: +#line 451 "./ldgram.y" { yyval.integer = yyvsp[0].token; ; break;} -case 113: -#line 415 "./ldgram.y" +case 122: +#line 453 "./ldgram.y" { yyval.integer = yyvsp[0].token; ; break;} -case 114: -#line 417 "./ldgram.y" +case 123: +#line 455 "./ldgram.y" { yyval.integer = yyvsp[0].token; ; break;} -case 115: -#line 422 "./ldgram.y" +case 124: +#line 460 "./ldgram.y" { yyval.integer = exp_get_value_int(yyvsp[0].etree, 0, @@ -1566,50 +1714,50 @@ lang_first_phase_enum); ; break;} -case 116: -#line 428 "./ldgram.y" +case 125: +#line 466 "./ldgram.y" { yyval.integer = 0; ; break;} -case 117: -#line 435 "./ldgram.y" +case 126: +#line 473 "./ldgram.y" { yyval.token = '+'; ; break;} -case 118: -#line 437 "./ldgram.y" +case 127: +#line 475 "./ldgram.y" { yyval.token = '-'; ; break;} -case 119: -#line 439 "./ldgram.y" +case 128: +#line 477 "./ldgram.y" { yyval.token = '*'; ; break;} -case 120: -#line 441 "./ldgram.y" +case 129: +#line 479 "./ldgram.y" { yyval.token = '/'; ; break;} -case 121: -#line 443 "./ldgram.y" +case 130: +#line 481 "./ldgram.y" { yyval.token = LSHIFT; ; break;} -case 122: -#line 445 "./ldgram.y" +case 131: +#line 483 "./ldgram.y" { yyval.token = RSHIFT; ; break;} -case 123: -#line 447 "./ldgram.y" +case 132: +#line 485 "./ldgram.y" { yyval.token = '&'; ; break;} -case 124: -#line 449 "./ldgram.y" +case 133: +#line 487 "./ldgram.y" { yyval.token = '|'; ; break;} -case 127: -#line 459 "./ldgram.y" +case 136: +#line 497 "./ldgram.y" { lang_add_assignment (exp_assop (yyvsp[-1].token, yyvsp[-2].name, yyvsp[0].etree)); ; break;} -case 128: -#line 463 "./ldgram.y" +case 137: +#line 501 "./ldgram.y" { lang_add_assignment (exp_assop ('=', yyvsp[-2].name, exp_binop (yyvsp[-1].token, @@ -1618,326 +1766,438 @@ yyvsp[0].etree))); ; break;} -case 129: -#line 471 "./ldgram.y" +case 138: +#line 509 "./ldgram.y" { lang_add_assignment (exp_provide (yyvsp[-3].name, yyvsp[-1].etree)); ; break;} -case 136: -#line 493 "./ldgram.y" +case 145: +#line 531 "./ldgram.y" { region = lang_memory_region_lookup(yyvsp[0].name); ; break;} -case 138: -#line 499 "./ldgram.y" +case 147: +#line 537 "./ldgram.y" { region->current = region->origin = exp_get_vma(yyvsp[0].etree, 0L,"origin", lang_first_phase_enum); ; break;} -case 139: -#line 505 "./ldgram.y" +case 148: +#line 543 "./ldgram.y" { region->length = exp_get_vma(yyvsp[0].etree, ~((bfd_vma)0), "length", lang_first_phase_enum); ; break;} -case 140: -#line 514 "./ldgram.y" +case 149: +#line 552 "./ldgram.y" { lang_set_flags(®ion->flags, yyvsp[-1].name); ; break;} -case 142: -#line 523 "./ldgram.y" +case 151: +#line 561 "./ldgram.y" { lang_startup(yyvsp[-1].name); ; break;} -case 144: -#line 529 "./ldgram.y" +case 153: +#line 567 "./ldgram.y" { ldemul_hll((char *)NULL); ; break;} -case 145: -#line 534 "./ldgram.y" +case 154: +#line 572 "./ldgram.y" { ldemul_hll(yyvsp[0].name); ; break;} -case 146: -#line 536 "./ldgram.y" +case 155: +#line 574 "./ldgram.y" { ldemul_hll(yyvsp[0].name); ; break;} -case 148: -#line 544 "./ldgram.y" +case 157: +#line 582 "./ldgram.y" { ldemul_syslib(yyvsp[0].name); ; break;} -case 150: -#line 550 "./ldgram.y" +case 159: +#line 588 "./ldgram.y" { lang_float(true); ; break;} -case 151: -#line 552 "./ldgram.y" +case 160: +#line 590 "./ldgram.y" { lang_float(false); ; break;} -case 152: -#line 556 "./ldgram.y" +case 161: +#line 595 "./ldgram.y" +{ + yyval.nocrossref = NULL; + ; + break;} +case 162: +#line 599 "./ldgram.y" +{ + struct lang_nocrossref *n; + + n = (struct lang_nocrossref *) xmalloc (sizeof *n); + n->name = yyvsp[-1].name; + n->next = yyvsp[0].nocrossref; + yyval.nocrossref = n; + ; + break;} +case 163: +#line 608 "./ldgram.y" +{ + struct lang_nocrossref *n; + + n = (struct lang_nocrossref *) xmalloc (sizeof *n); + n->name = yyvsp[-2].name; + n->next = yyvsp[0].nocrossref; + yyval.nocrossref = n; + ; + break;} +case 164: +#line 618 "./ldgram.y" { ldlex_expression(); ; break;} -case 153: -#line 558 "./ldgram.y" +case 165: +#line 620 "./ldgram.y" { ldlex_popstate(); yyval.etree=yyvsp[0].etree;; break;} -case 154: -#line 563 "./ldgram.y" +case 166: +#line 625 "./ldgram.y" { yyval.etree = exp_unop('-', yyvsp[0].etree); ; break;} -case 155: -#line 565 "./ldgram.y" +case 167: +#line 627 "./ldgram.y" { yyval.etree = yyvsp[-1].etree; ; break;} -case 156: -#line 567 "./ldgram.y" +case 168: +#line 629 "./ldgram.y" { yyval.etree = exp_unop((int) yyvsp[-3].integer,yyvsp[-1].etree); ; break;} -case 157: -#line 569 "./ldgram.y" +case 169: +#line 631 "./ldgram.y" { yyval.etree = exp_unop('!', yyvsp[0].etree); ; break;} -case 158: -#line 571 "./ldgram.y" +case 170: +#line 633 "./ldgram.y" { yyval.etree = yyvsp[0].etree; ; break;} -case 159: -#line 573 "./ldgram.y" +case 171: +#line 635 "./ldgram.y" { yyval.etree = exp_unop('~', yyvsp[0].etree);; break;} -case 160: -#line 576 "./ldgram.y" +case 172: +#line 638 "./ldgram.y" { yyval.etree = exp_binop('*', yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 161: -#line 578 "./ldgram.y" +case 173: +#line 640 "./ldgram.y" { yyval.etree = exp_binop('/', yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 162: -#line 580 "./ldgram.y" +case 174: +#line 642 "./ldgram.y" { yyval.etree = exp_binop('%', yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 163: -#line 582 "./ldgram.y" +case 175: +#line 644 "./ldgram.y" { yyval.etree = exp_binop('+', yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 164: -#line 584 "./ldgram.y" +case 176: +#line 646 "./ldgram.y" { yyval.etree = exp_binop('-' , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 165: -#line 586 "./ldgram.y" +case 177: +#line 648 "./ldgram.y" { yyval.etree = exp_binop(LSHIFT , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 166: -#line 588 "./ldgram.y" +case 178: +#line 650 "./ldgram.y" { yyval.etree = exp_binop(RSHIFT , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 167: -#line 590 "./ldgram.y" +case 179: +#line 652 "./ldgram.y" { yyval.etree = exp_binop(EQ , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 168: -#line 592 "./ldgram.y" +case 180: +#line 654 "./ldgram.y" { yyval.etree = exp_binop(NE , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 169: -#line 594 "./ldgram.y" +case 181: +#line 656 "./ldgram.y" { yyval.etree = exp_binop(LE , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 170: -#line 596 "./ldgram.y" +case 182: +#line 658 "./ldgram.y" { yyval.etree = exp_binop(GE , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 171: -#line 598 "./ldgram.y" +case 183: +#line 660 "./ldgram.y" { yyval.etree = exp_binop('<' , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 172: -#line 600 "./ldgram.y" +case 184: +#line 662 "./ldgram.y" { yyval.etree = exp_binop('>' , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 173: -#line 602 "./ldgram.y" +case 185: +#line 664 "./ldgram.y" { yyval.etree = exp_binop('&' , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 174: -#line 604 "./ldgram.y" +case 186: +#line 666 "./ldgram.y" { yyval.etree = exp_binop('^' , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 175: -#line 606 "./ldgram.y" +case 187: +#line 668 "./ldgram.y" { yyval.etree = exp_binop('|' , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 176: -#line 608 "./ldgram.y" +case 188: +#line 670 "./ldgram.y" { yyval.etree = exp_trinop('?' , yyvsp[-4].etree, yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 177: -#line 610 "./ldgram.y" +case 189: +#line 672 "./ldgram.y" { yyval.etree = exp_binop(ANDAND , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 178: -#line 612 "./ldgram.y" +case 190: +#line 674 "./ldgram.y" { yyval.etree = exp_binop(OROR , yyvsp[-2].etree, yyvsp[0].etree); ; break;} -case 179: -#line 614 "./ldgram.y" +case 191: +#line 676 "./ldgram.y" { yyval.etree = exp_nameop(DEFINED, yyvsp[-1].name); ; break;} -case 180: -#line 616 "./ldgram.y" +case 192: +#line 678 "./ldgram.y" { yyval.etree = exp_intop(yyvsp[0].integer); ; break;} -case 181: -#line 618 "./ldgram.y" +case 193: +#line 680 "./ldgram.y" { yyval.etree = exp_nameop(SIZEOF_HEADERS,0); ; break;} -case 182: -#line 621 "./ldgram.y" +case 194: +#line 683 "./ldgram.y" { yyval.etree = exp_nameop(SIZEOF,yyvsp[-1].name); ; break;} -case 183: -#line 623 "./ldgram.y" +case 195: +#line 685 "./ldgram.y" { yyval.etree = exp_nameop(ADDR,yyvsp[-1].name); ; break;} -case 184: -#line 625 "./ldgram.y" +case 196: +#line 687 "./ldgram.y" +{ yyval.etree = exp_nameop(LOADADDR,yyvsp[-1].name); ; + break;} +case 197: +#line 689 "./ldgram.y" { yyval.etree = exp_unop(ABSOLUTE, yyvsp[-1].etree); ; break;} -case 185: -#line 627 "./ldgram.y" +case 198: +#line 691 "./ldgram.y" { yyval.etree = exp_unop(ALIGN_K,yyvsp[-1].etree); ; break;} -case 186: -#line 629 "./ldgram.y" +case 199: +#line 693 "./ldgram.y" { yyval.etree = exp_unop(ALIGN_K,yyvsp[-1].etree); ; break;} -case 187: -#line 631 "./ldgram.y" +case 200: +#line 695 "./ldgram.y" { yyval.etree = exp_nameop(NAME,yyvsp[0].name); ; break;} -case 188: -#line 636 "./ldgram.y" +case 201: +#line 697 "./ldgram.y" +{ yyval.etree = exp_binop (MAX, yyvsp[-3].etree, yyvsp[-1].etree ); ; + break;} +case 202: +#line 699 "./ldgram.y" +{ yyval.etree = exp_binop (MIN, yyvsp[-3].etree, yyvsp[-1].etree ); ; + break;} +case 203: +#line 704 "./ldgram.y" { yyval.etree = yyvsp[-1].etree; ; break;} -case 189: -#line 637 "./ldgram.y" +case 204: +#line 705 "./ldgram.y" { yyval.etree = 0; ; break;} -case 190: -#line 640 "./ldgram.y" +case 205: +#line 708 "./ldgram.y" { ldlex_expression(); ; break;} -case 191: -#line 642 "./ldgram.y" -{ ldlex_popstate(); ; +case 206: +#line 710 "./ldgram.y" +{ ldlex_popstate (); ldlex_script (); ; break;} -case 192: -#line 644 "./ldgram.y" +case 207: +#line 712 "./ldgram.y" { lang_enter_output_section_statement(yyvsp[-5].name, yyvsp[-3].etree, sectype, 0, 0, 0, yyvsp[-2].etree); ; break;} -case 193: -#line 650 "./ldgram.y" -{ldlex_expression();; +case 208: +#line 718 "./ldgram.y" +{ ldlex_popstate (); ldlex_expression (); ; break;} -case 194: -#line 651 "./ldgram.y" +case 209: +#line 720 "./ldgram.y" { - ldlex_popstate(); - lang_leave_output_section_statement(yyvsp[0].integer, yyvsp[-2].name); + ldlex_popstate (); + lang_leave_output_section_statement (yyvsp[0].integer, yyvsp[-2].name, yyvsp[-1].section_phdr); ; break;} -case 196: -#line 660 "./ldgram.y" +case 211: +#line 726 "./ldgram.y" { ldlex_expression (); ; break;} -case 197: -#line 662 "./ldgram.y" +case 212: +#line 728 "./ldgram.y" +{ ldlex_popstate (); ldlex_script (); ; + break;} +case 213: +#line 730 "./ldgram.y" +{ + lang_enter_overlay (yyvsp[-4].etree, yyvsp[-2].etree, (int) yyvsp[-3].integer); + ; + break;} +case 214: +#line 735 "./ldgram.y" +{ ldlex_popstate (); ldlex_expression (); ; + break;} +case 215: +#line 737 "./ldgram.y" +{ + ldlex_popstate (); + lang_leave_overlay (yyvsp[0].integer, yyvsp[-2].name, yyvsp[-1].section_phdr); + ; + break;} +case 217: +#line 746 "./ldgram.y" +{ ldlex_expression (); ; + break;} +case 218: +#line 748 "./ldgram.y" { ldlex_popstate (); lang_add_assignment (exp_assop ('=', ".", yyvsp[0].etree)); ; break;} -case 199: -#line 670 "./ldgram.y" +case 220: +#line 756 "./ldgram.y" { sectype = noload_section; ; break;} -case 200: -#line 671 "./ldgram.y" +case 221: +#line 757 "./ldgram.y" { sectype = dsect_section; ; break;} -case 201: -#line 672 "./ldgram.y" +case 222: +#line 758 "./ldgram.y" { sectype = copy_section; ; break;} -case 202: -#line 673 "./ldgram.y" +case 223: +#line 759 "./ldgram.y" { sectype = info_section; ; break;} -case 203: -#line 674 "./ldgram.y" +case 224: +#line 760 "./ldgram.y" { sectype = overlay_section; ; break;} -case 205: -#line 679 "./ldgram.y" +case 226: +#line 765 "./ldgram.y" { sectype = normal_section; ; break;} -case 206: -#line 683 "./ldgram.y" +case 227: +#line 769 "./ldgram.y" { yyval.etree = yyvsp[-2].etree; ; break;} -case 207: -#line 684 "./ldgram.y" +case 228: +#line 770 "./ldgram.y" { yyval.etree = (etree_type *)NULL; ; break;} -case 208: -#line 689 "./ldgram.y" +case 229: +#line 775 "./ldgram.y" { yyval.etree = yyvsp[-3].etree; ; break;} -case 209: -#line 691 "./ldgram.y" +case 230: +#line 777 "./ldgram.y" { yyval.etree = yyvsp[-7].etree; ; break;} -case 210: -#line 696 "./ldgram.y" +case 231: +#line 781 "./ldgram.y" +{ yyval.etree = yyvsp[-1].etree; ; + break;} +case 232: +#line 782 "./ldgram.y" +{ yyval.etree = (etree_type *) NULL; ; + break;} +case 233: +#line 787 "./ldgram.y" +{ yyval.integer = 0; ; + break;} +case 234: +#line 789 "./ldgram.y" +{ yyval.integer = 1; ; + break;} +case 235: +#line 794 "./ldgram.y" { yyval.name = yyvsp[0].name; ; break;} -case 211: -#line 697 "./ldgram.y" +case 236: +#line 795 "./ldgram.y" { yyval.name = "*default*"; ; break;} -case 213: -#line 703 "./ldgram.y" +case 237: +#line 800 "./ldgram.y" { - lang_section_in_phdr (yyvsp[0].name); + yyval.section_phdr = NULL; ; break;} -case 217: -#line 718 "./ldgram.y" +case 238: +#line 804 "./ldgram.y" +{ + struct lang_output_section_phdr_list *n; + + n = ((struct lang_output_section_phdr_list *) + xmalloc (sizeof *n)); + n->name = yyvsp[0].name; + n->used = false; + n->next = yyvsp[-2].section_phdr; + yyval.section_phdr = n; + ; + break;} +case 240: +#line 820 "./ldgram.y" +{ + ldlex_script (); + lang_enter_overlay_section (yyvsp[0].name); + ; + break;} +case 241: +#line 825 "./ldgram.y" +{ ldlex_popstate (); ldlex_expression (); ; + break;} +case 242: +#line 827 "./ldgram.y" +{ + ldlex_popstate (); + lang_leave_overlay_section (yyvsp[0].integer, yyvsp[-1].section_phdr); + ; + break;} +case 247: +#line 844 "./ldgram.y" { ldlex_expression (); ; break;} -case 218: -#line 719 "./ldgram.y" +case 248: +#line 845 "./ldgram.y" { ldlex_popstate (); ; break;} -case 219: -#line 721 "./ldgram.y" +case 249: +#line 847 "./ldgram.y" { lang_new_phdr (yyvsp[-5].name, yyvsp[-3].etree, yyvsp[-2].phdr.filehdr, yyvsp[-2].phdr.phdrs, yyvsp[-2].phdr.at, yyvsp[-2].phdr.flags); ; break;} -case 220: -#line 729 "./ldgram.y" +case 250: +#line 855 "./ldgram.y" { yyval.etree = yyvsp[0].etree; @@ -1965,14 +2225,14 @@ } ; break;} -case 221: -#line 759 "./ldgram.y" +case 251: +#line 885 "./ldgram.y" { memset (&yyval.phdr, 0, sizeof (struct phdr_info)); ; break;} -case 222: -#line 763 "./ldgram.y" +case 252: +#line 889 "./ldgram.y" { yyval.phdr = yyvsp[0].phdr; if (strcmp (yyvsp[-2].name, "FILEHDR") == 0 && yyvsp[-1].etree == NULL) @@ -1985,25 +2245,117 @@ einfo ("%X%P:%S: PHDRS syntax error at `%s'\n", yyvsp[-2].name); ; break;} -case 223: -#line 775 "./ldgram.y" +case 253: +#line 901 "./ldgram.y" { yyval.phdr = yyvsp[0].phdr; yyval.phdr.at = yyvsp[-2].etree; ; break;} -case 224: -#line 783 "./ldgram.y" +case 254: +#line 909 "./ldgram.y" { yyval.etree = NULL; ; break;} -case 225: -#line 787 "./ldgram.y" +case 255: +#line 913 "./ldgram.y" { yyval.etree = yyvsp[-1].etree; ; break;} +case 256: +#line 921 "./ldgram.y" +{ + ldlex_version_file (); + PUSH_ERROR ("VERSION script"); + ; + break;} +case 257: +#line 926 "./ldgram.y" +{ + ldlex_popstate (); + POP_ERROR (); + ; + break;} +case 258: +#line 935 "./ldgram.y" +{ + ldlex_version_script (); + ; + break;} +case 259: +#line 939 "./ldgram.y" +{ + ldlex_popstate (); + ; + break;} +case 262: +#line 951 "./ldgram.y" +{ + lang_register_vers_node (yyvsp[-4].name, yyvsp[-2].versnode, NULL); + ; + break;} +case 263: +#line 955 "./ldgram.y" +{ + lang_register_vers_node (yyvsp[-5].name, yyvsp[-3].versnode, yyvsp[-1].deflist); + ; + break;} +case 264: +#line 962 "./ldgram.y" +{ + yyval.deflist = lang_add_vers_depend (NULL, yyvsp[0].name); + ; + break;} +case 265: +#line 966 "./ldgram.y" +{ + yyval.deflist = lang_add_vers_depend (yyvsp[-1].deflist, yyvsp[0].name); + ; + break;} +case 266: +#line 973 "./ldgram.y" +{ + yyval.versnode = lang_new_vers_node (NULL, NULL); + ; + break;} +case 267: +#line 977 "./ldgram.y" +{ + yyval.versnode = lang_new_vers_node (yyvsp[-1].versyms, NULL); + ; + break;} +case 268: +#line 981 "./ldgram.y" +{ + yyval.versnode = lang_new_vers_node (yyvsp[-1].versyms, NULL); + ; + break;} +case 269: +#line 985 "./ldgram.y" +{ + yyval.versnode = lang_new_vers_node (NULL, yyvsp[-1].versyms); + ; + break;} +case 270: +#line 989 "./ldgram.y" +{ + yyval.versnode = lang_new_vers_node (yyvsp[-5].versyms, yyvsp[-1].versyms); + ; + break;} +case 271: +#line 996 "./ldgram.y" +{ + yyval.versyms = lang_new_vers_regex (NULL, yyvsp[0].name); + ; + break;} +case 272: +#line 1000 "./ldgram.y" +{ + yyval.versyms = lang_new_vers_regex (yyvsp[-2].versyms, yyvsp[0].name); + ; + break;} } /* the action file gets copied in in place of this dollarsign */ #line 487 "/usr/unsupported/share/bison.simple" @@ -2202,7 +2554,7 @@ yystate = yyn; goto yynewstate; } -#line 792 "./ldgram.y" +#line 1005 "./ldgram.y" void yyerror(arg) diff -urN binutils-2.7/ld/ldgram.h binutils-2.8/ld/ldgram.h --- binutils-2.7/ld/ldgram.h Mon Jul 15 12:23:10 1996 +++ binutils-2.8/ld/ldgram.h Wed Apr 30 13:15:14 1997 @@ -10,6 +10,11 @@ union etree_union *at; union etree_union *flags; } phdr; + struct lang_nocrossref *nocrossref; + struct lang_output_section_phdr_list *section_phdr; + struct bfd_elf_version_deps *deflist; + struct bfd_elf_version_expr *versyms; + struct bfd_elf_version_tree *versnode; } YYSTYPE; #define INT 258 #define NAME 259 @@ -58,46 +63,56 @@ #define SEARCH_DIR 302 #define MAP 303 #define ENTRY 304 -#define SIZEOF 305 -#define NEXT 306 +#define NEXT 305 +#define SIZEOF 306 #define ADDR 307 -#define STARTUP 308 -#define HLL 309 -#define SYSLIB 310 -#define FLOAT 311 -#define NOFLOAT 312 -#define ORIGIN 313 -#define FILL 314 -#define LENGTH 315 -#define CREATE_OBJECT_SYMBOLS 316 -#define INPUT 317 -#define GROUP 318 -#define OUTPUT 319 -#define CONSTRUCTORS 320 -#define ALIGNMOD 321 -#define AT 322 -#define PROVIDE 323 -#define CHIP 324 -#define LIST 325 -#define SECT 326 -#define ABSOLUTE 327 -#define LOAD 328 -#define NEWLINE 329 -#define ENDWORD 330 -#define ORDER 331 -#define NAMEWORD 332 -#define FORMAT 333 -#define PUBLIC 334 -#define BASE 335 -#define ALIAS 336 -#define TRUNCATE 337 -#define REL 338 -#define INPUT_SCRIPT 339 -#define INPUT_MRI_SCRIPT 340 -#define INPUT_DEFSYM 341 -#define CASE 342 -#define EXTERN 343 -#define START 344 +#define LOADADDR 308 +#define MAX 309 +#define MIN 310 +#define STARTUP 311 +#define HLL 312 +#define SYSLIB 313 +#define FLOAT 314 +#define NOFLOAT 315 +#define NOCROSSREFS 316 +#define ORIGIN 317 +#define FILL 318 +#define LENGTH 319 +#define CREATE_OBJECT_SYMBOLS 320 +#define INPUT 321 +#define GROUP 322 +#define OUTPUT 323 +#define CONSTRUCTORS 324 +#define ALIGNMOD 325 +#define AT 326 +#define PROVIDE 327 +#define CHIP 328 +#define LIST 329 +#define SECT 330 +#define ABSOLUTE 331 +#define LOAD 332 +#define NEWLINE 333 +#define ENDWORD 334 +#define ORDER 335 +#define NAMEWORD 336 +#define FORMAT 337 +#define PUBLIC 338 +#define BASE 339 +#define ALIAS 340 +#define TRUNCATE 341 +#define REL 342 +#define INPUT_SCRIPT 343 +#define INPUT_MRI_SCRIPT 344 +#define INPUT_DEFSYM 345 +#define CASE 346 +#define EXTERN 347 +#define START 348 +#define VERS_TAG 349 +#define VERS_IDENTIFIER 350 +#define GLOBAL 351 +#define LOCAL 352 +#define VERSION 353 +#define INPUT_VERSION_SCRIPT 354 extern YYSTYPE yylval; diff -urN binutils-2.7/ld/ldgram.y binutils-2.8/ld/ldgram.y --- binutils-2.7/ld/ldgram.y Thu Jul 4 12:24:34 1996 +++ binutils-2.8/ld/ldgram.y Wed Apr 30 12:57:51 1997 @@ -1,5 +1,5 @@ /* A YACC grammer to parse a superset of the AT&T linker scripting languaue. - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com). This file is part of GNU ld. @@ -75,15 +75,24 @@ union etree_union *at; union etree_union *flags; } phdr; + struct lang_nocrossref *nocrossref; + struct lang_output_section_phdr_list *section_phdr; + struct bfd_elf_version_deps *deflist; + struct bfd_elf_version_expr *versyms; + struct bfd_elf_version_tree *versnode; } %type exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val +%type opt_exp_without_type %type fill_opt %type memspec_opt casesymlist %token INT %token NAME LNAME -%type length +%type length %type phdr_qualifiers +%type nocrossref_list +%type phdr_opt +%type opt_nocrossrefs %right PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ %right '?' ':' @@ -111,8 +120,9 @@ %token MEMORY DEFSYMEND %token NOLOAD DSECT COPY INFO OVERLAY %token NAME LNAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY -%token SIZEOF NEXT ADDR -%token STARTUP HLL SYSLIB FLOAT NOFLOAT +%token NEXT +%token SIZEOF ADDR LOADADDR MAX MIN +%token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS %token ORIGIN FILL %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS %token ALIGNMOD AT PROVIDE @@ -121,12 +131,18 @@ %token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD %token FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE REL %token INPUT_SCRIPT INPUT_MRI_SCRIPT INPUT_DEFSYM CASE EXTERN START +%token VERS_TAG VERS_IDENTIFIER +%token GLOBAL LOCAL VERSION INPUT_VERSION_SCRIPT +%type vers_defns +%type vers_tag +%type verdep %% file: INPUT_SCRIPT script_file | INPUT_MRI_SCRIPT mri_script_file + | INPUT_VERSION_SCRIPT version_script_file | INPUT_DEFSYM defsym_expr ; @@ -274,6 +290,7 @@ | low_level_library | floating_point_support | statement_anywhere + | version | ';' | TARGET_K '(' NAME ')' { lang_add_target($3); } @@ -299,6 +316,10 @@ { lang_add_map($3); } | INCLUDE filename { ldfile_open_command_file($2); } ifile_list END + | NOCROSSREFS '(' nocrossref_list ')' + { + lang_add_nocrossref ($3); + } ; input_list: @@ -338,11 +359,21 @@ | assignment end ; +/* The '*' and '?' cases are there because the lexer returns them as + separate tokens rather than as NAME. */ file_NAME_list: NAME - { lang_add_wild($1, current_file); } + { lang_add_wild ($1, current_file); } + | '*' + { lang_add_wild ("*", current_file); } + | '?' + { lang_add_wild ("?", current_file); } | file_NAME_list opt_comma NAME - { lang_add_wild($3, current_file); } + { lang_add_wild ($3, current_file); } + | file_NAME_list opt_comma '*' + { lang_add_wild ("*", current_file); } + | file_NAME_list opt_comma '?' + { lang_add_wild ("?", current_file); } ; input_section_spec: @@ -358,7 +389,14 @@ ']' | NAME { - current_file =$1; + current_file = $1; + } + '(' file_NAME_list ')' + | '?' + /* This case is needed because the lexer returns a + single question mark as '?' rather than NAME. */ + { + current_file = "?"; } '(' file_NAME_list ')' | '*' @@ -381,12 +419,12 @@ lang_add_attribute(lang_constructors_statement_enum); } | input_section_spec - | length '(' exp ')' + | length '(' mustbe_exp ')' { lang_add_data((int) $1,$3); } - | FILL '(' exp ')' + | FILL '(' mustbe_exp ')' { lang_add_fill (exp_get_value_int($3, @@ -552,6 +590,30 @@ { lang_float(false); } ; +nocrossref_list: + /* empty */ + { + $$ = NULL; + } + | NAME nocrossref_list + { + struct lang_nocrossref *n; + + n = (struct lang_nocrossref *) xmalloc (sizeof *n); + n->name = $1; + n->next = $2; + $$ = n; + } + | NAME ',' nocrossref_list + { + struct lang_nocrossref *n; + + n = (struct lang_nocrossref *) xmalloc (sizeof *n); + n->name = $1; + n->next = $3; + $$ = n; + } + ; mustbe_exp: { ldlex_expression(); } exp @@ -621,6 +683,8 @@ { $$ = exp_nameop(SIZEOF,$3); } | ADDR '(' NAME ')' { $$ = exp_nameop(ADDR,$3); } + | LOADADDR '(' NAME ')' + { $$ = exp_nameop(LOADADDR,$3); } | ABSOLUTE '(' exp ')' { $$ = exp_unop(ABSOLUTE, $3); } | ALIGN_K '(' exp ')' @@ -629,6 +693,10 @@ { $$ = exp_unop(ALIGN_K,$3); } | NAME { $$ = exp_nameop(NAME,$1); } + | MAX '(' exp ',' exp ')' + { $$ = exp_binop (MAX, $3, $5 ); } + | MIN '(' exp ',' exp ')' + { $$ = exp_binop (MIN, $3, $5 ); } ; @@ -639,7 +707,7 @@ section: NAME { ldlex_expression(); } opt_exp_with_type - opt_at { ldlex_popstate(); } + opt_at { ldlex_popstate (); ldlex_script (); } '{' { lang_enter_output_section_statement($1, $3, @@ -647,12 +715,30 @@ 0, 0, 0, $4); } statement_list_opt - '}' {ldlex_expression();} memspec_opt phdr_opt fill_opt + '}' { ldlex_popstate (); ldlex_expression (); } + memspec_opt phdr_opt fill_opt { - ldlex_popstate(); - lang_leave_output_section_statement($13, $11); + ldlex_popstate (); + lang_leave_output_section_statement ($13, $11, $12); } opt_comma + | OVERLAY + { ldlex_expression (); } + opt_exp_without_type opt_nocrossrefs opt_at + { ldlex_popstate (); ldlex_script (); } + '{' + { + lang_enter_overlay ($3, $5, (int) $4); + } + overlay_section + '}' + { ldlex_popstate (); ldlex_expression (); } + memspec_opt phdr_opt fill_opt + { + ldlex_popstate (); + lang_leave_overlay ($14, $12, $13); + } + opt_comma | /* The GROUP case is just enough to support the gcc svr3.ifile script. It is not intended to be full support. I'm not even sure what GROUP is supposed @@ -691,6 +777,18 @@ { $$ = $3; } ; +opt_exp_without_type: + exp ':' { $$ = $1; } + | ':' { $$ = (etree_type *) NULL; } + ; + +opt_nocrossrefs: + /* empty */ + { $$ = 0; } + | NOCROSSREFS + { $$ = 1; } + ; + memspec_opt: '>' NAME { $$ = $2; } @@ -699,12 +797,40 @@ phdr_opt: /* empty */ + { + $$ = NULL; + } | phdr_opt ':' NAME { - lang_section_in_phdr ($3); + struct lang_output_section_phdr_list *n; + + n = ((struct lang_output_section_phdr_list *) + xmalloc (sizeof *n)); + n->name = $3; + n->used = false; + n->next = $1; + $$ = n; } ; +overlay_section: + /* empty */ + | overlay_section + NAME + { + ldlex_script (); + lang_enter_overlay_section ($2); + } + '{' statement_list_opt '}' + { ldlex_popstate (); ldlex_expression (); } + phdr_opt fill_opt + { + ldlex_popstate (); + lang_leave_overlay_section ($9, $8); + } + opt_comma + ; + phdrs: PHDRS '{' phdr_list '}' ; @@ -786,6 +912,93 @@ | '(' exp ')' { $$ = $2; + } + ; + +/* This syntax is used within an external version script file. */ + +version_script_file: + { + ldlex_version_file (); + PUSH_ERROR ("VERSION script"); + } + vers_nodes + { + ldlex_popstate (); + POP_ERROR (); + } + ; + +/* This is used within a normal linker script file. */ + +version: + { + ldlex_version_script (); + } + VERSION '{' vers_nodes '}' + { + ldlex_popstate (); + } + ; + +vers_nodes: + vers_node + | vers_nodes vers_node + ; + +vers_node: + VERS_TAG '{' vers_tag '}' ';' + { + lang_register_vers_node ($1, $3, NULL); + } + | VERS_TAG '{' vers_tag '}' verdep ';' + { + lang_register_vers_node ($1, $3, $5); + } + ; + +verdep: + VERS_TAG + { + $$ = lang_add_vers_depend (NULL, $1); + } + | verdep VERS_TAG + { + $$ = lang_add_vers_depend ($1, $2); + } + ; + +vers_tag: + /* empty */ + { + $$ = lang_new_vers_node (NULL, NULL); + } + | vers_defns ';' + { + $$ = lang_new_vers_node ($1, NULL); + } + | GLOBAL ':' vers_defns ';' + { + $$ = lang_new_vers_node ($3, NULL); + } + | LOCAL ':' vers_defns ';' + { + $$ = lang_new_vers_node (NULL, $3); + } + | GLOBAL ':' vers_defns ';' LOCAL ':' vers_defns ';' + { + $$ = lang_new_vers_node ($3, $7); + } + ; + +vers_defns: + VERS_IDENTIFIER + { + $$ = lang_new_vers_regex (NULL, $1); + } + | vers_defns ';' VERS_IDENTIFIER + { + $$ = lang_new_vers_regex ($1, $3); } ; diff -urN binutils-2.7/ld/ldint.texinfo binutils-2.8/ld/ldint.texinfo --- binutils-2.7/ld/ldint.texinfo Thu Jul 4 12:24:34 1996 +++ binutils-2.8/ld/ldint.texinfo Wed Apr 30 12:57:51 1997 @@ -12,7 +12,7 @@ @ifinfo This file documents the internals of the GNU linker ld. -Copyright (C) 1992 Free Software Foundation, Inc. +Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. Contributed by Cygnus Support. Permission is granted to make and distribute verbatim copies of @@ -37,13 +37,13 @@ @settitle GNU Linker Internals @titlepage @title{A guide to the internals of the GNU linker} -@author Per Bothner, Steve Chamberlain +@author Per Bothner, Steve Chamberlain, Ian Lance Taylor @author Cygnus Support @page @tex \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ -\xdef\manvers{\$Revision: 1.8 $} % For use in headers, footers too +\xdef\manvers{\$Revision: 1.10 $} % For use in headers, footers too {\parskip=0pt \hfill Cygnus Support\par \hfill \manvers\par @@ -52,7 +52,7 @@ @end tex @vskip 0pt plus 1filll -Copyright @copyright{} 1992 Free Software Foundation, Inc. +Copyright @copyright{} 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -61,7 +61,8 @@ @end titlepage @end iftex -@node Top, README, (dir), (dir) +@node Top +@top This file documents the internals of the GNU linker @code{ld}. It is a collection of miscellaneous information with little form at this point. @@ -71,233 +72,341 @@ @menu * README:: The README File * Emulations:: How linker emulations are generated -* Porting:: Porting the linker @end menu -@node README, Emulations, Top, Top +@node README @chapter The @file{README} File Check the @file{README} file; it often has useful information that does not appear anywhere else in the directory. -@node Emulations, Porting, README, Top +@node Emulations @chapter How linker emulations are generated -The linker is controlled by linker scripts written in a linker -control language. A linker emulation gives the personality of -the linker, and is mainly defined by certain linker scripts. -If you want to understand how these scripts are generated, -the main file to look at is the @file{genscripts.sh} shell script, -which is invoked by the @file{Makefile} for each ``emulation'' -to generate a set of 5 linker scripts. - -For example, for the sun3 emulation used by ld68k, @file{genscripts.sh} -sources the file @file{emulparams/sun3.sh}, which sets the emulation -parameters, and specifies that the format is a.out, and to use -@file{scripttempl/aout.sc} to generate the linker scripts. - -@code{genscripts.sh} generates 5 different linker scripts, one for each -of the @code{ld} options @samp{-z} (default), @samp{-n}, @samp{-N}, -@samp{-r} and @samp{-Ur}, where each script is slightly different and is -generated using the template in @file{scripttempl/aout.sc} (for the sun3). - -@node Porting, , Emulations, Top -@chapter Porting the linker - -Before porting @code{ld} itself, you will need to port the BFD library; -see @file{../bfd/PORTING}. - -The @dfn{host} is the system a tool runs @emph{on}. -The @dfn{target} is the system a tool runs @emph{for}; i.e., -a tool can read and write the binaries of the target. -Most often, host==target, but @code{ld} supports cross-linking -(and to some extent the same @code{ld} binary can be used a linker -for multiple target architectures). +Each linker target has an @dfn{emulation}. The emulation includes the +default linker script, and certain emulations also modify certain types +of linker behaviour. + +Emulations are created during the build process by the shell script +@file{genscripts.sh}. + +The @file{genscripts.sh} script starts by reading a file in the +@file{emulparams} directory. This is a shell script which sets various +shell variables used by @file{genscripts.sh} and the other shell scripts +it invokes. + +The @file{genscripts.sh} script will invoke a shell script in the +@file{scripttempl} directory in order to create default linker scripts +written in the linker command language. The @file{scripttempl} script +will be invoked 5 (or, in some cases, 6) times, with different +assignments to shell variables, to create different default scripts. +The choice of script is made based on the command line options. + +After creating the scripts, @file{genscripts.sh} will invoke yet another +shell script, this time in the @file{emultempl} directory. That shell +script will create the emulation source file, which contains C code. +This C code permits the linker emulation to override various linker +behaviours. Most targets use the generic emulation code, which is in +@file{emultempl/generic.em}. + +To summarize, @file{genscripts.sh} reads three shell scripts: an +emulation parameters script in the @file{emulparams} directory, a linker +script generation script in the @file{scripttempl} directory, and an +emulation source file generation script in the @file{emultempl} +directory. + +For example, the Sun 4 linker sets up variables in +@file{emulparams/sun4.sh}, creates linker scripts using +@file{scripttempl/aout.sc}, and creates the emulation code using +@file{emultempl/sunos.em}. + +Note that the linker can support several emulations simultaneously, +depending upon how it is configured. An emulation can be selected with +the @code{-m} option. The @code{-V} option will list all supported +emulations. @menu -* New host:: Porting to a new host -* New target:: Porting to a new target -* New emulation:: Porting to a new emulation target -* Emulation script:: Writing @var{emulation}.sh -* Linker scripts:: Writing a new @var{script}.sc -* -n and -N options:: Handling -n and -N style binaries in your linker script +* emulation parameters:: @file{emulparams} scripts +* linker scripts:: @file{scripttempl} scripts +* linker emulations:: @file{emultempl} scripts @end menu -@node New host, New target, , Porting -@section Porting to a new host +@node emulation parameters +@section @file{emulparams} scripts -Pick a name for your host. Call that @var{host-type}. -You need to create the file @file{config/@var{host-type}.mh}. +Each target selects a particular file in the @file{emulparams} directory +by setting the shell variable @code{targ_emul} in @file{configure.tgt}. +This shell variable is used by the @file{configure} script to control +building an emulation source file. + +Certain conventions are enforced. Suppose the @code{targ_emul} variable +is set to @var{emul} in @file{configure.tgt}. The name of the emulation +shell script will be @file{emulparams/@var{emul}.sh}. The +@file{Makefile} must have a target named @file{e@var{emul}.c}; this +target must depend upon @file{emulparams/@var{emul}.sh}, as well as the +appropriate scripts in the @file{scripttempl} and @file{emultempl} +directories. The @file{Makefile} target must invoke @code{GENSCRIPTS} +with two arguments: @var{emul}, and the value of the make variable +@code{tdir_@var{emul}}. The value of the latter variable will be set by +the @file{configure} script, and is used to set the default target +directory to search. + +By convention, the @file{emulparams/@var{emul}.sh} shell script should +only set shell variables. It may set shell variables which are to be +interpreted by the @file{scripttempl} and the @file{emultempl} scripts. +Certain shell variables are interpreted directly by the +@file{genscripts.sh} script. + +Here is a list of shell variables interpreted by @file{genscripts.sh}, +as well as some conventional shell variables interpreted by the +@file{scripttempl} and @file{emultempl} scripts. -@node New target, New emulation, New host, Porting -@section Porting to a new target - -Pick a name for your target. Call that @var{target}. -You need to create at least @file{config/@var{target}.mt}. -It should contain - -@example -EMUL=@var{emulation} -@end example - -An @dfn{emulation} controls the ``personality'' of @code{ld}, -such as the default linker script. Usually, the -@var{emulation} will have the same name as the @var{target}, -and you will need to create a new @var{emulation} (see below). - -You also need to edit @file{Makefile.in} and possibly @file{configure.in}. -To see how to do that, search for existing examples (e.g., @code{sun3}, -@code{sun4}, @code{hp300bsd}). - -@node New emulation, Emulation script, New target, Porting -@section Porting to a new emulation target - -Pick a name for your target. Call that @var{emulation}. -Usually, @var{emulation} and @var{target} are the same. -You need to create at least @file{emulparams/@var{emulation}.sh}. -You also need to edit @file{Makefile.in}. -To see how to do that, search for existing examples. - -The file @file{emulparams/@var{emulation}.sh} defines a set of -parameters that are used to generate the emulation. Its syntax is that -of a Bourne shell script. It is ``sourced'' by @file{genscripts.sh}. - -@node Emulation script, Linker scripts, New emulation, Porting -@section Writing @file{@var{emulation}.sh} - -Usually, @file{@var{emulation}.sh} contains: -@example -EMULATION_NAME=@var{emulation} -SCRIPT_NAME=@var{script} -OUTPUT_FORMAT="@var{target-name}" -TEXT_START_ADDR=@var{text-start-addr} -TARGET_PAGE_SIZE=@var{page-size} -SEGMENT_SIZE=@var{segment-size} # If different from TARGET_PAGE_SIZE. -ARCH=@var{arch} -@end example - -Here: @table @code -@item @var{target-name} -Matches the @code{filename} field of the @code{bfd_target} you want -to use. (This is a string, and currently the first field.) -For an a.out target, @var{target-name} matches the @code{TARGETNAME} -defined in @file{../bfd/@var{target}.c}. - -@item @var{arch} -The architecture: e.g., @code{m68k}, @code{sparc}, @dots{}. - -@item @var{script} -The file @file{scripttempl/@var{script}.sc} is a shell script which, -when evaluated (by @file{genscripts.sh}), writes a linker script file to -standard output. You may need to write a new script. If you use the -a.out format or something similar, you can probably set -@example -SCRIPT_NAME=aout -@end example - -@item @var{text-start-addr} -@itemx @var{page-size} -@itemx @var{segment-size} -These set the shell variables @code{TEXT_START_ADDR}, @code{TARGET_PAGE_SIZE}, -and @code{SEGMENT_SIZE} for use by @file{scripttempl/@var{script}.sc}. -If @code{SEGMENT_SIZE} is not defined, it defaults to @code{TARGET_PAGE_SIZE}, -if that is defined. If your script doesn't use these variables, you -don't have to define them. For emulations using a.out files, you can -get these values from @file{../bfd/@var{target}.c}. +@item SCRIPT_NAME +This is the name of the @file{scripttempl} script to use. If +@code{SCRIPT_NAME} is set to @var{script}, @file{genscripts.sh} will use +the script @file{scriptteml/@var{script}.sc}. + +@item TEMPLATE_NAME +This is the name of the @file{emultemlp} script to use. If +@code{TEMPLATE_NAME} is set to @var{template}, @file{genscripts.sh} will +use the script @file{emultempl/@var{template}.em}. If this variable is +not set, the default value is @samp{generic}. + +@item GENERATE_SHLIB_SCRIPT +If this is set to a nonempty string, @file{genscripts.sh} will invoke +the @file{scripttempl} script an extra time to create a shared library +script. @ref{linker scripts}. + +@item OUTPUT_FORMAT +This is normally set to indicate the BFD output format use (e.g., +@samp{"a.out-sunos-big"}. The @file{scripttempl} script will normally +use it in an @code{OUTPUT_FORMAT} expression in the linker script. + +@item ARCH +This is normally set to indicate the architecture to use (e.g., +@samp{sparc}). The @file{scripttempl} script will normally use it in an +@code{OUTPUT_ARCH} expression in the linker script. + +@item ENTRY +Some @file{scripttempl} scripts use this to set the entry address, in an +@code{ENTRY} expression in the linker script. + +@item TEXT_START_ADDR +Some @file{scripttempl} scripts use this to set the start address of the +@samp{.text} section. + +@item NONPAGED_TEXT_START_ADDR +If this is defined, the @file{genscripts.sh} script sets +@code{TEXT_START_ADDR} to its value before running the +@file{scripttempl} script for the @code{-n} and @code{-N} options +(@pxref{linker scripts}). + +@item SEGMENT_SIZE +The @file{genscripts.sh} script uses this to set the default value of +@code{DATA_ALIGNMENT} when running the @file{scripttempl} script. + +@item TARGET_PAGE_SIZE +If @code{SEGMENT_SIZE} is not defined, the @file{genscripts.sh} script +uses this to define it. @end table -In some cases, you may need more more definitions. -For example, if you can't use @file{emultempl/generic.em}, -you may need to add: -@example -TEMPLATE_NAME=@var{emulation} -@end example -and write your own @file{emultempl/@var{emulation}.em} file. +@node linker scripts +@section @file{scripttempl} scripts -@node Linker scripts, -n and -N options, Emulation script, Porting -@section Writing a new linker script @file{scripttempl/@var{script}.sc} +Each linker target uses a @file{scripttempl} script to generate the +default linker scripts. The name of the @file{scripttempl} script is +set by the @code{SCRIPT_NAME} variable in the @file{emulparams} script. +If @code{SCRIPT_NAME} is set to @var{script}, @code{genscripts.sh} will +invoke @file{scripttempl/@var{script}.sc}. + +The @file{genscripts.sh} script will invoke the @file{scripttempl} +script 5 or 6 times. Each time it will set the shell variable +@code{LD_FLAG} to a different value. When the linker is run, the +options used will direct it to select a particular script. (Script +selection is controlled by the @code{get_script} emulation entry point; +this describes the conventional behaviour). + +The @file{scripttempl} script should just write a linker script, written +in the linker command language, to standard output. If the emulation +name--the name of the @file{emulparams} file without the @file{.sc} +extension--is @var{emul}, then the output will be directed to +@file{ldscripts/@var{emul}.@var{extension}} in the build directory, +where @var{extension} changes each time the @file{scripttempl} script is +invoked. -You may need to write a new script file for your emulation. +Here is the list of values assigned to @code{LD_FLAG}. -Your script can use the shell variable @code{LD_FLAG}, which has the value: @table @code -@item LD_FLAG= -when building a script to be used by default -@item LD_FLAG=n -when building a script to be used for @samp{ld -n} -@item LD_FLAG=N -when building a script to be used for @samp{ld -N} -@item LD_FLAG=r -when building a script to be used for @samp{ld -r} -@item LD_FLAG=u -when building a script to be used for @samp{ld -Ur} +@item (empty) +The script generated is used by default (when none of the following +cases apply). The output has an extension of @file{.x}. +@item n +The script generated is used when the linker is invoked with the +@code{-n} option. The output has an extension of @file{.xn}. +@item N +The script generated is used when the linker is invoked with the +@code{-N} option. The output has an extension of @file{.xbn}. +@item r +The script generated is used when the linker is invoked with the +@code{-r} option. The output has an extension of @file{.xr}. +@item u +The script generated is used when the linker is invoked with the +@code{-Ur} option. The output has an extension of @file{.xu}. +@item shared +The @file{scripttempl} script is only invoked with @code{LD_FLAG} set to +this value if @code{GENERATE_SHLIB_SCRIPT} is defined in the +@file{emulparams} file. The @file{emultempl} script must arrange to use +this script at the appropriate time, normally when the linker is invoked +with the @code{-shared} option. The output has an extension of +@file{.xs}. @end table -The variable @code{RELOCATING} is only set if relocation is happening -(i.e., unless the linker is invoked with @samp{-r}). -Thus your script should has an action @code{@var{ACTION}} -that should only be done when relocating, -express that as: -@example -$@{RELOCATING+ ACTION@} -@end example -This is the case for most assignments, which should look like: -@example -$@{RELOCATING+ _end = .@} -@end example - -Also, you should assign absolute addresses to sections only -when relocating, so: -@example -.text $@{RELOCATING+ $@{TEXT_START_ADDR@}@}: -@end example - -The form: -@example - .section @{ ... @} > section -@end example -should be: -@example - .section @{ ... @} > $@{RELOCATING+ section@} -@end example - -@code{RELOCATING} is set except when @code{LD_FLAG=r} or @code{LD_FLAG=u}. -@code{CONSTRUCTING} is set except when @code{LD_FLAG=u}. - -Alignment of the data segments is controlled by the variables -@code{DATA_ALIGNMENT_} (note trailing underscore), -@code{DATA_ALIGNMENT_n}, @code{DATA_ALIGNMENT_N}, -@code{DATA_ALIGNMENT_r}, or @code{DATA_ALIGNMENT_u} depending on the -value of @code{LD_FLAGS}. Normally, the default value works (this is -@code{"ALIGN($@{SEGMENT_SIZE@})"} for the @samp{_n}, and @samp{__} -(default) variants; @code{"."} for the @samp{_N}, variant; and @code{""} -for the @samp{_r} and @samp{_u} variants). - -@node -n and -N options, , Linker scripts, Porting -@section Handling @samp{-n} and @samp{-N} style binaries in your linker script - -The @samp{-n} linker option requests the linker to create a binary -with a write-protected text segment, but not demand-pagable (@code{NMAGIC}). -SunOS starts the text segment for demand-paged binaries at 0x2020 -and other binaries at 0x2000, since the exec header (0x20 bytes) -is paged in with the text. Some other Unix variants do the same. +Besides the shell variables set by the @file{emulparams} script, and the +@code{LD_FLAG} variable, the @file{genscripts.sh} script will set +certain variables for each run of the @file{scripttempl} script. -In that case, the @file{emulparams/@var{emulation}.sh} should define: @table @code -@item NONPAGED_TEXT_START_ADDR -The text start address to use when linking with @samp{-n} or @samp{-N} options. +@item RELOCATING +This will be set to a non-empty string when the linker is doing a final +relocation (e.g., all scripts other than @code{-r} and @code{-Ur}). + +@item CONSTRUCTING +This will be set to a non-empty string when the linker is building +global constructor and destructor tables (e.g., all scripts other than +@code{-r}). + +@item DATA_ALIGNMENT +This will be set to an @code{ALIGN} expression when the output should be +page aligned, or to @samp{.} when generating the @code{-N} script. + +@item CREATE_SHLIB +This will be set to a non-empty string when generating a @code{-shared} +script. @end table -For example, on a sun4: -@example -TEXT_START_ADDR=0x2020 -NONPAGED_TEXT_START_ADDR=0x2000 -@end example - -The @samp{-N} linker option creates a binary with a non-write-protected -text segment (@code{NMAGIC}). This is like @samp{-n}, except that the -data segment needs not be page-aligned. +The conventional way to write a @file{scripttempl} script is to first +set a few shell variables, and then write out a linker script using +@code{cat} with a here document. The linker script will use variable +substitutions, based on the above variables and those set in the +@file{emulparams} script, to control its behaviour. + +When there are parts of the @file{scripttempl} script which should only +be run when doing a final relocation, they should be enclosed within a +variable substitution based on @code{RELOCATING}. For example, on many +targets special symbols such as @code{_end} should be defined when doing +a final link. Naturally, those symbols should not be defined when doing +a relocateable link using @code{-r}. The @file{scripttempl} script +could use a construct like this to define those symbols: +@smallexample + $@{RELOCATING+ _end = .;@} +@end smallexample +This will do the symbol assignment only if the @code{RELOCATING} +variable is defined. + +The basic job of the linker script is to put the sections in the correct +order, and at the correct memory addresses. For some targets, the +linker script may have to do some other operations. + +For example, on most MIPS platforms, the linker is responsible for +defining the special symbol @code{_gp}, used to initialize the +@code{$gp} register. It must be set to the start of the small data +section plus @code{0x8000}. Naturally, it should only be defined when +doing a final relocation. This will typically be done like this: +@smallexample + $@{RELOCATING+ _gp = ALIGN(16) + 0x8000;@} +@end smallexample +This line would appear just before the sections which compose the small +data section (@samp{.sdata}, @samp{.sbss}). All those sections would be +contiguous in memory. + +Many COFF systems build constructor tables in the linker script. The +compiler will arrange to output the address of each global constructor +in a @samp{.ctor} section, and the address of each global destructor in +a @samp{.dtor} section (this is done by defining +@code{ASM_OUTPUT_CONSTRUCTOR} and @code{ASM_OUTPUT_DESTRUCTOR} in the +@code{gcc} configuration files). The @code{gcc} runtime support +routines expect the constructor table to be named @code{__CTOR_LIST__}. +They expect it to be a list of words, with the first word being the +count of the number of entries. There should be a trailing zero word. +(Actually, the count may be -1 if the trailing word is present, and the +trailing word may be omitted if the count is correct, but, as the +@code{gcc} behaviour has changed slightly over the years, it is safest +to provide both). Here is a typical way that might be handled in a +@file{scripttempl} file. +@smallexample + $@{CONSTRUCTING+ __CTOR_LIST__ = .;@} + $@{CONSTRUCTING+ LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)@} + $@{CONSTRUCTING+ *(.ctors)@} + $@{CONSTRUCTING+ LONG(0)@} + $@{CONSTRUCTING+ __CTOR_END__ = .;@} + $@{CONSTRUCTING+ __DTOR_LIST__ = .;@} + $@{CONSTRUCTING+ LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)@} + $@{CONSTRUCTING+ *(.dtors)@} + $@{CONSTRUCTING+ LONG(0)@} + $@{CONSTRUCTING+ __DTOR_END__ = .;@} +@end smallexample +The use of @code{CONSTRUCTING} ensures that these linker script commands +will only appear when the linker is supposed to be building the +constructor and destructor tables. This example is written for a target +which uses 4 byte pointers. + +Embedded systems often need to set a stack address. This is normally +best done by using the @code{PROVIDE} construct with a default stack +address. This permits the user to easily override the stack address +using the @code{--defsym} option. Here is an example: +@smallexample + $@{RELOCATING+ PROVIDE (__stack = 0x80000000);@} +@end smallexample +The value of the symbol @code{__stack} would then be used in the startup +code to initialize the stack pointer. + +@node linker emulations +@section @file{emultempl} scripts + +Each linker target uses an @file{emultempl} script to generate the +emulation code. The name of the @file{emultempl} script is set by the +@code{TEMPLATE_NAME} variable in the @file{emulparams} script. If the +@code{TEMPLATE_NAME} variable is not set, the default is +@samp{generic}. If the value of @code{TEMPLATE_NAME} is @var{template}, +@file{genscripts.sh} will use @file{emultempl/@var{template}.em}. + +Most targets use the generic @file{emultempl} script, +@file{emultempl/generic.em}. A different @file{emultempl} script is +only needed if the linker must support unusual actions, such as linking +against shared libraries. + +The @file{emultempl} script is normally written as a simple invocation +of @code{cat} with a here document. The document will use a few +variable substitutions. Typically each function names uses a +substitution involving @code{EMULATION_NAME}, for ease of debugging when +the linker supports multiple emulations. + +Every function and variable in the emitted file should be static. The +only globally visible object must be named +@code{ld_@var{EMULATION_NAME}_emulation}, where @var{EMULATION_NAME} is +the name of the emulation set in @file{configure.tgt} (this is also the +name of the @file{emulparams} file without the @file{.sh} extension). +The @file{genscripts.sh} script will set the shell variable +@code{EMULATION_NAME} before invoking the @file{emultempl} script. + +The @code{ld_@var{EMULATION_NAME}_emulation} variable must be a +@code{struct ld_emulation_xfer_struct}, as defined in @file{ldemul.h}. +It defines a set of function pointers which are invoked by the linker, +as well as strings for the emulation name (normally set from the shell +variable @code{EMULATION_NAME} and the default BFD target name (normally +set from the shell variable @code{OUTPUT_FORMAT} which is normally set +by the @file{emulparams} file). + +The @file{genscripts.sh} script will set the shell variable +@code{COMPILE_IN} when it invokes the @file{emultempl} script for the +default emulation. In this case, the @file{emultempl} script should +include the linker scripts directly, and return them from the +@code{get_scripts} entry point. When the emulation is not the default, +the @code{get_scripts} entry point should just return a file name. See +@file{emultempl/generic.em} for an example of how this is done. + +At some point, the linker emulation entry points should be documented. @contents @bye diff -urN binutils-2.7/ld/ldlang.c binutils-2.8/ld/ldlang.c --- binutils-2.7/ld/ldlang.c Thu Jul 4 12:24:37 1996 +++ binutils-2.8/ld/ldlang.c Wed Apr 30 12:57:52 1997 @@ -1,5 +1,5 @@ /* Linker command language support. - Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -14,12 +14,14 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GLD; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +along with GLD; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" #include "libiberty.h" +#include "obstack.h" #include "bfdlink.h" #include "ld.h" @@ -32,6 +34,9 @@ #include "ldmisc.h" #include "ldctor.h" #include "ldfile.h" +#include "fnmatch.h" + +#include /* FORWARDS */ static lang_statement_union_type *new_statement PARAMS ((enum statement_enum, @@ -66,6 +71,7 @@ static void init_os PARAMS ((lang_output_section_statement_type *s)); static void exp_init_os PARAMS ((etree_type *)); static void section_already_linked PARAMS ((bfd *, asection *, PTR)); +static boolean wildcardp PARAMS ((const char *)); static void wild_section PARAMS ((lang_wild_statement_type *ptr, const char *section, lang_input_statement_type *file, @@ -73,6 +79,9 @@ static lang_input_statement_type *lookup_name PARAMS ((const char *name)); static void load_symbols PARAMS ((lang_input_statement_type *entry, lang_statement_list_type *)); +static void wild_file PARAMS ((lang_wild_statement_type *, const char *, + lang_input_statement_type *, + lang_output_section_statement_type *)); static void wild PARAMS ((lang_wild_statement_type *s, const char *section, const char *file, const char *target, @@ -93,6 +102,7 @@ PARAMS ((lang_assignment_statement_type *assignment, lang_output_section_statement_type *output_section)); static void print_input_statement PARAMS ((lang_input_statement_type *statm)); +static boolean print_one_symbol PARAMS ((struct bfd_link_hash_entry *, PTR)); static void print_input_section PARAMS ((lang_input_section_type *in)); static void print_fill_statement PARAMS ((lang_fill_statement_type *fill)); static void print_data_statement PARAMS ((lang_data_statement_type *data)); @@ -137,6 +147,7 @@ boolean had_output_filename = false; boolean lang_float_flag = false; boolean delete_output_file_on_failure = false; +struct lang_nocrossrefs *nocrossref_list; etree_type *base; /* Relocation base - or null */ @@ -612,6 +623,7 @@ switch (exp->type.node_code) { case ADDR: + case LOADADDR: case SIZEOF: { lang_output_section_statement_type *os; @@ -637,11 +649,12 @@ /*ARGSUSED*/ static void -section_already_linked (abfd, sec, ignore) +section_already_linked (abfd, sec, data) bfd *abfd; asection *sec; - PTR ignore; + PTR data; { + lang_input_statement_type *entry = (lang_input_statement_type *) data; struct sec_link_once { struct sec_link_once *next; @@ -652,6 +665,15 @@ const char *name; struct sec_link_once *l; + /* If we are only reading symbols from this object, then we want to + discard all sections. */ + if (entry->just_syms_flag) + { + sec->output_section = bfd_abs_section_ptr; + sec->output_offset = sec->vma; + return; + } + flags = bfd_get_section_flags (abfd, sec); if ((flags & SEC_LINK_ONCE) == 0) @@ -715,6 +737,23 @@ explicit actions, like foo.o(.text), bar.o(.text) and foo.o(.text, .data). */ +/* Return true if the PATTERN argument is a wildcard pattern. */ + +static boolean +wildcardp (pattern) + const char *pattern; +{ + const char *s; + + for (s = pattern; *s != '\0'; ++s) + if (*s == '?' + || *s == '\\' + || *s == '*' + || *s == '[') + return true; + return false; +} + /* Add SECTION to the output section OUTPUT. Do this by creating a lang_input_section statement which is placed at PTR. FILE is the input file which holds SECTION. */ @@ -830,9 +869,17 @@ if (file->just_syms_flag == false) { register asection *s; + boolean wildcard; + + if (section == NULL) + wildcard = false; + else + wildcard = wildcardp (section); for (s = file->the_bfd->sections; s != NULL; s = s->next) { + boolean match; + /* Attach all sections named SECTION. If SECTION is NULL, then attach all sections. @@ -841,9 +888,19 @@ section. I did not understand that, and I took it out. --ian@cygnus.com. */ - if (section == NULL - || strcmp (bfd_get_section_name (file->the_bfd, s), - section) == 0) + if (section == NULL) + match = true; + else + { + const char *name; + + name = bfd_get_section_name (file->the_bfd, s); + if (wildcard) + match = fnmatch (section, name, 0) == 0 ? true : false; + else + match = strcmp (section, name) == 0 ? true : false; + } + if (match) wild_doit (&ptr->children, s, output, file); } } @@ -994,6 +1051,44 @@ entry->loaded = true; } +/* Handle a wild statement for a single file F. */ + +static void +wild_file (s, section, f, output) + lang_wild_statement_type *s; + const char *section; + lang_input_statement_type *f; + lang_output_section_statement_type *output; +{ + if (f->the_bfd == NULL + || ! bfd_check_format (f->the_bfd, bfd_archive)) + wild_section (s, section, f, output); + else + { + bfd *member; + + /* This is an archive file. We must map each member of the + archive separately. */ + member = bfd_openr_next_archived_file (f->the_bfd, (bfd *) NULL); + while (member != NULL) + { + /* When lookup_name is called, it will call the add_symbols + entry point for the archive. For each element of the + archive which is included, BFD will call ldlang_add_file, + which will set the usrdata field of the member to the + lang_input_statement. */ + if (member->usrdata != NULL) + { + wild_section (s, section, + (lang_input_statement_type *) member->usrdata, + output); + } + + member = bfd_openr_next_archived_file (f->the_bfd, member); + } + } +} + /* Handle a wild statement. SECTION or FILE or both may be NULL, indicating that it is a wildcard. Separate lang_input_section statements are created for each part of the expansion; they are @@ -1016,40 +1111,24 @@ f != (lang_input_statement_type *) NULL; f = (lang_input_statement_type *) f->next) { - wild_section (s, section, f, output); + wild_file (s, section, f, output); + } + } + else if (wildcardp (file)) + { + for (f = (lang_input_statement_type *) file_chain.head; + f != (lang_input_statement_type *) NULL; + f = (lang_input_statement_type *) f->next) + { + if (fnmatch (file, f->filename, FNM_FILE_NAME) == 0) + wild_file (s, section, f, output); } } else { /* Perform the iteration over a single file */ f = lookup_name (file); - if (f->the_bfd == NULL - || ! bfd_check_format (f->the_bfd, bfd_archive)) - wild_section (s, section, f, output); - else - { - bfd *member; - - /* This is an archive file. We must map each member of the - archive separately. */ - member = bfd_openr_next_archived_file (f->the_bfd, (bfd *) NULL); - while (member != NULL) - { - /* When lookup_name is called, it will call the - add_symbols entry point for the archive. For each - element of the archive which is included, BFD will - call ldlang_add_file, which will set the usrdata - field of the member to the lang_input_statement. */ - if (member->usrdata != NULL) - { - wild_section (s, section, - (lang_input_statement_type *) member->usrdata, - output); - } - - member = bfd_openr_next_archived_file (f->the_bfd, member); - } - } + wild_file (s, section, f, output); } if (section != (char *) NULL @@ -1161,7 +1240,8 @@ break; case lang_wild_statement_enum: /* Maybe we should load the file's symbols */ - if (s->wild_statement.filename) + if (s->wild_statement.filename + && ! wildcardp (s->wild_statement.filename)) (void) lookup_name (s->wild_statement.filename); open_input_bfds (s->wild_statement.children.head, force); break; @@ -1996,7 +2076,15 @@ } dot = os->region->current; if (os->section_alignment == -1) - dot = align_power (dot, os->bfd_section->alignment_power); + { + bfd_vma olddot; + + olddot = dot; + dot = align_power (dot, os->bfd_section->alignment_power); + if (dot != olddot && config.warn_section_align) + einfo ("%P: warning: changing start of section %s by %u bytes\n", + os->name, (unsigned int) (dot - olddot)); + } } else { @@ -2011,7 +2099,7 @@ einfo ("%F%S: non constant address expression for section %s\n", os->name); } - dot = r.value; + dot = r.value + r.section->bfd_section->vma; } /* The section starts here */ /* First, align to what the section needs */ @@ -2601,8 +2689,10 @@ /* Increase the size of the section. */ section->_raw_size += size; - /* Make sure the section is allocated in memory. */ + /* Make sure the section is allocated in memory, and make sure that + it is no longer a common section. */ section->flags |= SEC_ALLOC; + section->flags &= ~ SEC_IS_COMMON; if (config.map_file != NULL) { @@ -2691,11 +2781,11 @@ } else if (strcmp (s->name, "COMMON") == 0) { - /* This is a lonely common section which must - have come from an archive. We attatch to the - section with the wildcard */ + /* This is a lonely common section which must have + come from an archive. We attach to the section + with the wildcard. */ if (! link_info.relocateable - && ! command_line.force_common_definition) + || command_line.force_common_definition) { if (default_common_section == NULL) { @@ -2860,7 +2950,7 @@ each backend which might set the SEC_LINK_ONCE flag. If we do this, we should probably handle SEC_EXCLUDE in the same way. */ - bfd_map_over_sections (entry->the_bfd, section_already_linked, (PTR) NULL); + bfd_map_over_sections (entry->the_bfd, section_already_linked, (PTR) entry); } void @@ -2993,6 +3083,13 @@ ldemul_after_open (); + /* Make sure that we're not mixing architectures. We call this + after all the input files have been opened, but before we do any + other processing, so that any operations merge_private_bfd_data + does on the output file will be known during the rest of the + link. */ + lang_check (); + /* Build all sets based on the information gathered from the input files. */ ldctor_build_sets (); @@ -3000,14 +3097,14 @@ /* Size up the common data */ lang_common (); - /* Run through the contours of the script and attatch input sections + /* Run through the contours of the script and attach input sections to the correct output sections */ map_input_to_output_sections (statement_list.head, (char *) NULL, (lang_output_section_statement_type *) NULL); - /* Find any sections not attatched explicitly and handle them */ + /* Find any sections not attached explicitly and handle them */ lang_place_orphans (); ldemul_before_allocation (); @@ -3068,10 +3165,6 @@ abs_output_section, (fill_type) 0, (bfd_vma) 0); - /* Make sure that we're not mixing architectures */ - - lang_check (); - /* Final stuffs */ ldemul_finish (); @@ -3273,12 +3366,14 @@ } void -lang_leave_output_section_statement (fill, memspec) +lang_leave_output_section_statement (fill, memspec, phdrs) bfd_vma fill; - CONST char *memspec; + const char *memspec; + struct lang_output_section_phdr_list *phdrs; { current_section->fill = fill; current_section->region = lang_memory_region_lookup (memspec); + current_section->phdrs = phdrs; stat_ptr = &statement_list; } @@ -3436,22 +3531,6 @@ *pp = n; } -/* Record that a section should be placed in a phdr. */ - -void -lang_section_in_phdr (name) - const char *name; -{ - struct lang_output_section_phdr_list *n; - - n = ((struct lang_output_section_phdr_list *) - stat_alloc (sizeof (struct lang_output_section_phdr_list))); - n->name = name; - n->used = false; - n->next = current_section->phdrs; - current_section->phdrs = n; -} - /* Record the program header information in the output BFD. FIXME: We should not be calling an ELF specific function here. */ @@ -3465,7 +3544,7 @@ lang_statement_union_type *u; alc = 10; - secs = xmalloc (alc * sizeof (asection *)); + secs = (asection **) xmalloc (alc * sizeof (asection *)); last = NULL; for (l = lang_phdr_list; l != NULL; l = l->next) { @@ -3505,7 +3584,8 @@ if (c >= alc) { alc *= 2; - secs = xrealloc (secs, alc * sizeof (asection *)); + secs = ((asection **) + xrealloc (secs, alc * sizeof (asection *))); } secs[c] = os->bfd_section; ++c; @@ -3553,4 +3633,346 @@ einfo ("%X%P: section `%s' assigned to non-existent phdr `%s'\n", u->output_section_statement.name, pl->name); } +} + +/* Record a list of sections which may not be cross referenced. */ + +void +lang_add_nocrossref (l) + struct lang_nocrossref *l; +{ + struct lang_nocrossrefs *n; + + n = (struct lang_nocrossrefs *) xmalloc (sizeof *n); + n->next = nocrossref_list; + n->list = l; + nocrossref_list = n; + + /* Set notice_all so that we get informed about all symbols. */ + link_info.notice_all = true; +} + +/* Overlay handling. We handle overlays with some static variables. */ + +/* The overlay virtual address. */ +static etree_type *overlay_vma; + +/* The overlay load address. */ +static etree_type *overlay_lma; + +/* Whether nocrossrefs is set for this overlay. */ +static int overlay_nocrossrefs; + +/* An expression for the maximum section size seen so far. */ +static etree_type *overlay_max; + +/* A list of all the sections in this overlay. */ + +struct overlay_list +{ + struct overlay_list *next; + lang_output_section_statement_type *os; +}; + +static struct overlay_list *overlay_list; + +/* Start handling an overlay. */ + +void +lang_enter_overlay (vma_expr, lma_expr, nocrossrefs) + etree_type *vma_expr; + etree_type *lma_expr; + int nocrossrefs; +{ + /* The grammar should prevent nested overlays from occurring. */ + ASSERT (overlay_vma == NULL + && overlay_lma == NULL + && overlay_list == NULL + && overlay_max == NULL); + + overlay_vma = vma_expr; + overlay_lma = lma_expr; + overlay_nocrossrefs = nocrossrefs; +} + +/* Start a section in an overlay. We handle this by calling + lang_enter_output_section_statement with the correct VMA and LMA. */ + +void +lang_enter_overlay_section (name) + const char *name; +{ + struct overlay_list *n; + etree_type *size; + + lang_enter_output_section_statement (name, overlay_vma, normal_section, + 0, 0, 0, overlay_lma); + + /* If this is the first section, then base the VMA and LMA of future + sections on this one. This will work correctly even if `.' is + used in the addresses. */ + if (overlay_list == NULL) + { + overlay_vma = exp_nameop (ADDR, name); + overlay_lma = exp_nameop (LOADADDR, name); + } + + /* Remember the section. */ + n = (struct overlay_list *) xmalloc (sizeof *n); + n->os = current_section; + n->next = overlay_list; + overlay_list = n; + + size = exp_nameop (SIZEOF, name); + + /* Adjust the LMA for the next section. */ + overlay_lma = exp_binop ('+', overlay_lma, size); + + /* Arrange to work out the maximum section end address. */ + if (overlay_max == NULL) + overlay_max = size; + else + overlay_max = exp_binop (MAX, overlay_max, size); +} + +/* Finish a section in an overlay. There isn't any special to do + here. */ + +void +lang_leave_overlay_section (fill, phdrs) + bfd_vma fill; + struct lang_output_section_phdr_list *phdrs; +{ + const char *name; + char *clean, *s2; + const char *s1; + char *buf; + + name = current_section->name; + + lang_leave_output_section_statement (fill, "*default*", phdrs); + + /* Define the magic symbols. */ + + clean = xmalloc (strlen (name) + 1); + s2 = clean; + for (s1 = name; *s1 != '\0'; s1++) + if (isalnum (*s1) || *s1 == '_') + *s2++ = *s1; + *s2 = '\0'; + + buf = xmalloc (strlen (clean) + sizeof "__load_start_"); + sprintf (buf, "__load_start_%s", clean); + lang_add_assignment (exp_assop ('=', buf, + exp_nameop (LOADADDR, name))); + + buf = xmalloc (strlen (clean) + sizeof "__load_stop_"); + sprintf (buf, "__load_stop_%s", clean); + lang_add_assignment (exp_assop ('=', buf, + exp_binop ('+', + exp_nameop (LOADADDR, name), + exp_nameop (SIZEOF, name)))); + + free (clean); +} + +/* Finish an overlay. If there are any overlay wide settings, this + looks through all the sections in the overlay and sets them. */ + +void +lang_leave_overlay (fill, memspec, phdrs) + bfd_vma fill; + const char *memspec; + struct lang_output_section_phdr_list *phdrs; +{ + lang_memory_region_type *region; + struct overlay_list *l; + struct lang_nocrossref *nocrossref; + + if (memspec == NULL) + region = NULL; + else + region = lang_memory_region_lookup (memspec); + + nocrossref = NULL; + + l = overlay_list; + while (l != NULL) + { + struct overlay_list *next; + + if (fill != 0 && l->os->fill == 0) + l->os->fill = fill; + if (region != NULL && l->os->region == NULL) + l->os->region = region; + if (phdrs != NULL && l->os->phdrs == NULL) + l->os->phdrs = phdrs; + + if (overlay_nocrossrefs) + { + struct lang_nocrossref *nc; + + nc = (struct lang_nocrossref *) xmalloc (sizeof *nc); + nc->name = l->os->name; + nc->next = nocrossref; + nocrossref = nc; + } + + next = l->next; + free (l); + l = next; + } + + if (nocrossref != NULL) + lang_add_nocrossref (nocrossref); + + /* Update . for the end of the overlay. */ + lang_add_assignment (exp_assop ('=', ".", + exp_binop ('+', overlay_vma, overlay_max))); + + overlay_vma = NULL; + overlay_lma = NULL; + overlay_nocrossrefs = 0; + overlay_list = NULL; + overlay_max = NULL; +} + +/* Version handling. This is only useful for ELF. */ + +/* This global variable holds the version tree that we build. */ + +struct bfd_elf_version_tree *lang_elf_version_info; + +/* This is called for each variable name or match expression. */ + +struct bfd_elf_version_expr * +lang_new_vers_regex (orig, new) + struct bfd_elf_version_expr *orig; + const char *new; +{ + struct bfd_elf_version_expr *ret; + + ret = (struct bfd_elf_version_expr *) xmalloc (sizeof *ret); + ret->next = orig; + ret->match = new; + return ret; +} + +/* This is called for each set of variable names and match + expressions. */ + +struct bfd_elf_version_tree * +lang_new_vers_node (globals, locals) + struct bfd_elf_version_expr *globals; + struct bfd_elf_version_expr *locals; +{ + struct bfd_elf_version_tree *ret; + + ret = (struct bfd_elf_version_tree *) xmalloc (sizeof *ret); + ret->next = NULL; + ret->name = NULL; + ret->vernum = 0; + ret->globals = globals; + ret->locals = locals; + ret->deps = NULL; + ret->name_indx = (unsigned int) -1; + ret->used = 0; + return ret; +} + +/* This static variable keeps track of version indices. */ + +static int version_index; + +/* This is called when we know the name and dependencies of the + version. */ + +void +lang_register_vers_node (name, version, deps) + const char *name; + struct bfd_elf_version_tree *version; + struct bfd_elf_version_deps *deps; +{ + struct bfd_elf_version_tree *t, **pp; + struct bfd_elf_version_expr *e1; + + /* Make sure this node has a unique name. */ + for (t = lang_elf_version_info; t != NULL; t = t->next) + if (strcmp (t->name, name) == 0) + einfo ("%X%P: duplicate version tag `%s'\n", name); + + /* Check the global and local match names, and make sure there + aren't any duplicates. */ + + for (e1 = version->globals; e1 != NULL; e1 = e1->next) + { + for (t = lang_elf_version_info; t != NULL; t = t->next) + { + struct bfd_elf_version_expr *e2; + + for (e2 = t->globals; e2 != NULL; e2 = e2->next) + if (strcmp (e1->match, e2->match) == 0) + einfo ("%X%P: duplicate expression `%s' in version information\n", + e1->match); + + for (e2 = t->locals; e2 != NULL; e2 = e2->next) + if (strcmp (e1->match, e2->match) == 0) + einfo ("%X%P: duplicate expression `%s' in version information\n", + e1->match); + } + } + + for (e1 = version->locals; e1 != NULL; e1 = e1->next) + { + for (t = lang_elf_version_info; t != NULL; t = t->next) + { + struct bfd_elf_version_expr *e2; + + for (e2 = t->globals; e2 != NULL; e2 = e2->next) + if (strcmp (e1->match, e2->match) == 0) + einfo ("%X%P: duplicate expression `%s' in version information\n", + e1->match); + + for (e2 = t->locals; e2 != NULL; e2 = e2->next) + if (strcmp (e1->match, e2->match) == 0) + einfo ("%X%P: duplicate expression `%s' in version information\n", + e1->match); + } + } + + version->deps = deps; + version->name = name; + ++version_index; + version->vernum = version_index; + + for (pp = &lang_elf_version_info; *pp != NULL; pp = &(*pp)->next) + ; + *pp = version; +} + +/* This is called when we see a version dependency. */ + +struct bfd_elf_version_deps * +lang_add_vers_depend (list, name) + struct bfd_elf_version_deps *list; + const char *name; +{ + struct bfd_elf_version_deps *ret; + struct bfd_elf_version_tree *t; + + ret = (struct bfd_elf_version_deps *) xmalloc (sizeof *ret); + ret->next = list; + + for (t = lang_elf_version_info; t != NULL; t = t->next) + { + if (strcmp (t->name, name) == 0) + { + ret->version_needed = t; + return ret; + } + } + + einfo ("%X%P: unable to find version dependency `%s'\n", name); + + return ret; } diff -urN binutils-2.7/ld/ldlang.h binutils-2.8/ld/ldlang.h --- binutils-2.7/ld/ldlang.h Thu Jul 4 12:24:38 1996 +++ binutils-2.8/ld/ldlang.h Wed Apr 30 12:57:52 1997 @@ -1,5 +1,5 @@ /* ldlang.h - linker command language support - Copyright 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -14,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GLD; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GLD; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #ifndef LDLANG_H #define LDLANG_H @@ -343,6 +344,25 @@ etree_type *flags; }; +/* This structure is used to hold a list of sections which may not + cross reference each other. */ + +struct lang_nocrossref +{ + struct lang_nocrossref *next; + const char *name; +}; + +/* The list of nocrossref lists. */ + +struct lang_nocrossrefs +{ + struct lang_nocrossrefs *next; + struct lang_nocrossref *list; +}; + +extern struct lang_nocrossrefs *nocrossref_list; + extern lang_output_section_statement_type *abs_output_section; extern boolean lang_has_input_file; extern etree_type *base; @@ -378,8 +398,8 @@ extern void lang_add_attribute PARAMS ((enum statement_enum)); extern void lang_startup PARAMS ((const char *)); extern void lang_float PARAMS ((enum bfd_boolean)); -extern void lang_leave_output_section_statement PARAMS ((bfd_vma, - const char *)); +extern void lang_leave_output_section_statement + PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *)); extern void lang_abs_symbol_at_end_of PARAMS ((const char *, const char *)); extern void lang_abs_symbol_at_beginning_of PARAMS ((const char *, const char *)); @@ -424,6 +444,7 @@ extern void lang_for_each_statement PARAMS ((void (*func) (lang_statement_union_type *))); extern PTR stat_alloc PARAMS ((size_t size)); +extern void dprint_statement PARAMS ((lang_statement_union_type *, int)); extern bfd_vma lang_size_sections PARAMS ((lang_statement_union_type *s, lang_output_section_statement_type *output_section_statement, @@ -438,6 +459,24 @@ extern void lang_new_phdr PARAMS ((const char *, etree_type *, boolean, boolean, etree_type *, etree_type *)); -extern void lang_section_in_phdr PARAMS ((const char *)); +extern void lang_add_nocrossref PARAMS ((struct lang_nocrossref *)); +extern void lang_enter_overlay PARAMS ((etree_type *, etree_type *, int)); +extern void lang_enter_overlay_section PARAMS ((const char *)); +extern void lang_leave_overlay_section + PARAMS ((bfd_vma, struct lang_output_section_phdr_list *)); +extern void lang_leave_overlay + PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *)); + +extern struct bfd_elf_version_tree *lang_elf_version_info; + +extern struct bfd_elf_version_expr *lang_new_vers_regex + PARAMS ((struct bfd_elf_version_expr *, const char *)); +extern struct bfd_elf_version_tree *lang_new_vers_node + PARAMS ((struct bfd_elf_version_expr *, struct bfd_elf_version_expr *)); +extern struct bfd_elf_version_deps *lang_add_vers_depend + PARAMS ((struct bfd_elf_version_deps *, const char *)); +extern void lang_register_vers_node + PARAMS ((const char *, struct bfd_elf_version_tree *, + struct bfd_elf_version_deps *)); #endif diff -urN binutils-2.7/ld/ldlex.c binutils-2.8/ld/ldlex.c --- binutils-2.7/ld/ldlex.c Mon Jul 15 12:23:13 1996 +++ binutils-2.8/ld/ldlex.c Wed Apr 30 12:57:52 1997 @@ -281,111 +281,121 @@ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 146 -#define YY_END_OF_BUFFER 147 -static yyconst short int yy_accept[916] = +#define YY_NUM_RULES 163 +#define YY_END_OF_BUFFER 164 +static yyconst short int yy_accept[1007] = { 0, - 0, 0, 139, 139, 0, 0, 0, 0, 0, 0, - 0, 0, 147, 146, 144, 143, 141, 142, 32, 144, - 139, 38, 29, 44, 43, 34, 35, 28, 36, 139, - 37, 8, 8, 45, 46, 39, 40, 27, 33, 8, - 8, 8, 8, 8, 8, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 10, 9, 8, 89, - 87, 139, 42, 30, 41, 31, 145, 143, 142, 32, - 145, 137, 38, 29, 44, 43, 34, 35, 28, 36, - 137, 37, 8, 8, 45, 46, 39, 40, 27, 33, - 8, 8, 8, 8, 8, 137, 137, 137, 137, 137, - - 137, 10, 9, 8, 137, 42, 30, 41, 31, 137, - 8, 8, 8, 8, 8, 8, 8, 8, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 8, 8, - 89, 87, 4, 3, 2, 4, 5, 4, 96, 97, - 95, 136, 34, 35, 28, 36, 136, 37, 8, 8, - 45, 46, 40, 8, 8, 8, 8, 8, 8, 136, - 136, 136, 136, 136, 136, 10, 9, 8, 8, 8, - 8, 8, 136, 136, 136, 136, 136, 136, 31, 15, - 0, 140, 139, 8, 8, 26, 24, 22, 20, 21, - 1, 23, 8, 139, 18, 17, 14, 16, 19, 8, - - 8, 139, 93, 139, 139, 139, 139, 139, 8, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 8, 139, 139, 139, 25, - 13, 137, 6, 6, 20, 21, 0, 23, 8, 7, - 7, 8, 7, 14, 8, 7, 7, 7, 8, 137, - 93, 7, 137, 137, 7, 8, 137, 137, 137, 137, - 137, 137, 137, 137, 7, 137, 8, 8, 8, 0, - 8, 8, 137, 137, 137, 8, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - - 137, 137, 137, 137, 137, 137, 8, 137, 137, 4, - 4, 4, 4, 95, 95, 136, 6, 6, 98, 22, - 23, 99, 8, 7, 7, 7, 8, 136, 8, 8, - 7, 136, 7, 7, 136, 136, 136, 136, 136, 136, - 136, 136, 7, 136, 8, 8, 7, 136, 7, 7, - 136, 136, 136, 136, 136, 136, 136, 136, 11, 12, - 139, 8, 139, 139, 139, 139, 139, 139, 139, 8, - 139, 139, 139, 139, 139, 139, 74, 139, 139, 139, - 139, 139, 58, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - - 139, 90, 88, 139, 137, 138, 137, 7, 137, 137, - 137, 137, 8, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 8, 137, 137, 137, 8, 137, 137, - 137, 137, 74, 137, 137, 137, 137, 58, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 90, 88, 4, 95, 136, 136, 136, 136, 136, 136, - 100, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 118, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 139, 53, 139, - 50, 139, 80, 139, 84, 139, 139, 139, 139, 70, - - 139, 139, 139, 139, 85, 139, 139, 78, 139, 55, - 139, 139, 139, 139, 139, 139, 139, 77, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 137, 53, 137, - 50, 137, 84, 137, 137, 137, 85, 55, 137, 137, - 137, 137, 137, 137, 80, 137, 137, 137, 70, 137, - 137, 137, 137, 137, 78, 137, 137, 137, 137, 137, - 77, 137, 137, 137, 137, 137, 137, 8, 136, 136, - 136, 104, 112, 103, 136, 136, 115, 107, 110, 136, - 136, 116, 136, 136, 136, 136, 136, 122, 130, 121, - 136, 136, 133, 125, 128, 136, 136, 134, 136, 136, - - 139, 52, 49, 139, 139, 139, 83, 54, 76, 139, - 64, 139, 63, 139, 139, 139, 139, 139, 139, 139, - 92, 139, 139, 139, 79, 139, 139, 139, 139, 139, - 139, 137, 52, 49, 137, 83, 64, 137, 137, 137, - 137, 137, 137, 137, 137, 54, 76, 137, 137, 63, - 137, 137, 137, 137, 137, 92, 137, 137, 79, 137, - 137, 137, 136, 105, 102, 136, 136, 115, 115, 109, - 136, 114, 136, 136, 123, 120, 136, 136, 133, 133, - 127, 136, 132, 136, 139, 139, 139, 139, 139, 139, - 51, 47, 139, 82, 48, 62, 139, 139, 139, 139, - - 59, 139, 75, 60, 139, 139, 137, 137, 82, 137, - 137, 59, 137, 137, 137, 137, 137, 137, 51, 47, - 137, 48, 62, 137, 137, 137, 75, 60, 136, 136, - 113, 111, 108, 136, 136, 136, 131, 129, 126, 136, - 139, 139, 139, 65, 139, 91, 81, 139, 86, 94, - 139, 139, 139, 71, 139, 139, 137, 65, 86, 94, - 137, 137, 137, 137, 137, 137, 91, 81, 137, 137, - 137, 71, 136, 136, 136, 136, 136, 136, 117, 139, - 139, 139, 139, 139, 139, 69, 139, 135, 139, 117, - 137, 135, 137, 137, 137, 137, 137, 137, 137, 69, - - 117, 101, 106, 135, 119, 124, 139, 139, 139, 139, - 139, 139, 139, 139, 137, 137, 137, 137, 137, 137, - 137, 137, 139, 139, 139, 139, 139, 61, 139, 139, - 137, 137, 137, 137, 137, 137, 137, 61, 139, 139, - 139, 73, 139, 139, 139, 137, 137, 137, 137, 137, - 73, 137, 67, 139, 139, 139, 139, 139, 137, 137, - 67, 137, 137, 137, 139, 139, 72, 139, 139, 137, - 137, 137, 137, 72, 139, 139, 57, 56, 57, 56, - 137, 137, 139, 139, 137, 137, 139, 139, 137, 137, - 139, 139, 137, 137, 139, 139, 137, 137, 139, 139, + 0, 0, 145, 145, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 164, 163, + 161, 149, 147, 148, 32, 161, 145, 38, 29, 44, + 43, 34, 35, 28, 36, 145, 37, 8, 8, 45, + 46, 39, 40, 27, 33, 8, 8, 8, 8, 8, + 8, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 10, 9, 8, 95, 93, 145, 42, + 30, 41, 31, 162, 149, 148, 32, 162, 143, 38, + 29, 44, 43, 34, 35, 28, 36, 143, 37, 8, + 8, 45, 46, 39, 40, 27, 33, 8, 8, 8, + + 8, 8, 143, 143, 143, 143, 143, 143, 143, 143, + 10, 9, 8, 143, 42, 30, 41, 31, 143, 8, + 8, 8, 8, 8, 8, 8, 8, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 8, 8, + 95, 93, 4, 3, 2, 4, 5, 4, 102, 103, + 101, 142, 34, 35, 28, 36, 142, 37, 8, 8, + 45, 46, 40, 33, 8, 8, 8, 8, 8, 8, + 142, 142, 142, 142, 142, 142, 10, 9, 8, 8, + 8, 8, 8, 142, 142, 142, 142, 142, 142, 31, + 160, 158, 158, 159, 155, 154, 150, 156, 157, 153, + + 153, 153, 15, 0, 146, 145, 8, 8, 26, 24, + 22, 20, 21, 1, 23, 8, 145, 18, 17, 14, + 16, 19, 8, 8, 145, 99, 145, 145, 145, 145, + 145, 8, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 8, + 145, 145, 145, 25, 13, 143, 6, 6, 22, 20, + 21, 0, 1, 23, 8, 7, 7, 8, 7, 14, + 8, 7, 7, 7, 8, 143, 99, 7, 143, 143, + 7, 8, 143, 143, 143, 143, 143, 143, 143, 143, + + 143, 143, 143, 7, 143, 8, 8, 8, 0, 8, + 8, 143, 143, 143, 8, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 8, 143, 143, + 4, 4, 4, 4, 101, 101, 142, 6, 6, 104, + 22, 23, 105, 8, 7, 7, 7, 8, 142, 8, + 8, 7, 142, 7, 7, 142, 142, 142, 142, 142, + 142, 142, 142, 7, 142, 8, 8, 7, 142, 7, + 7, 142, 142, 142, 142, 142, 142, 142, 142, 160, + 159, 154, 153, 153, 153, 11, 12, 145, 8, 145, + + 145, 145, 145, 145, 145, 145, 8, 145, 145, 145, + 145, 145, 145, 78, 145, 145, 145, 145, 145, 145, + 62, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 96, 94, 145, 143, 144, 143, 7, 143, 143, + 143, 143, 8, 143, 143, 143, 143, 56, 57, 143, + 143, 143, 143, 143, 143, 143, 143, 8, 143, 143, + 143, 8, 143, 143, 143, 143, 78, 143, 143, 143, + 143, 62, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 96, 94, 4, 101, + + 142, 142, 142, 142, 142, 142, 106, 142, 142, 142, + 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, + 142, 142, 124, 142, 142, 142, 142, 142, 142, 142, + 142, 142, 142, 153, 153, 145, 54, 145, 51, 145, + 84, 145, 90, 145, 145, 145, 145, 74, 145, 145, + 145, 145, 91, 145, 145, 145, 82, 145, 59, 145, + 145, 145, 145, 145, 145, 145, 145, 81, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 143, 54, + 143, 51, 143, 90, 143, 143, 143, 91, 143, 59, + 143, 143, 143, 143, 143, 143, 143, 84, 143, 143, + + 143, 74, 143, 143, 143, 143, 143, 82, 143, 143, + 143, 143, 143, 143, 81, 143, 143, 143, 143, 143, + 143, 143, 8, 142, 142, 142, 110, 118, 109, 142, + 142, 121, 113, 116, 142, 142, 122, 142, 142, 142, + 142, 142, 128, 136, 127, 142, 142, 139, 131, 134, + 142, 142, 140, 142, 142, 153, 153, 145, 53, 50, + 145, 145, 145, 89, 58, 80, 145, 68, 145, 67, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 98, + 145, 145, 145, 83, 145, 145, 145, 145, 145, 145, + 145, 143, 53, 50, 143, 89, 68, 143, 143, 143, + + 143, 143, 143, 143, 143, 143, 143, 58, 80, 143, + 143, 67, 143, 143, 143, 143, 143, 143, 98, 143, + 143, 83, 143, 143, 143, 143, 142, 111, 108, 142, + 142, 121, 121, 115, 142, 120, 142, 142, 129, 126, + 142, 142, 139, 139, 133, 142, 138, 142, 153, 152, + 145, 145, 145, 145, 145, 145, 52, 145, 47, 145, + 145, 88, 48, 66, 145, 145, 145, 145, 63, 145, + 79, 64, 145, 145, 145, 143, 143, 143, 143, 88, + 143, 143, 63, 143, 143, 143, 143, 143, 143, 52, + 47, 143, 48, 66, 143, 143, 143, 143, 79, 64, + + 143, 142, 142, 119, 117, 114, 142, 142, 142, 137, + 135, 132, 142, 151, 145, 145, 145, 69, 145, 97, + 145, 145, 85, 145, 87, 100, 145, 145, 145, 75, + 49, 145, 145, 143, 69, 143, 143, 92, 100, 143, + 143, 143, 143, 143, 143, 97, 85, 143, 87, 143, + 143, 75, 49, 142, 142, 142, 142, 142, 142, 123, + 145, 145, 145, 55, 145, 145, 145, 145, 73, 145, + 141, 145, 123, 55, 143, 143, 141, 143, 143, 143, + 143, 143, 143, 143, 73, 123, 107, 112, 141, 125, + 130, 145, 145, 145, 145, 145, 145, 145, 145, 145, + + 143, 143, 143, 143, 143, 143, 143, 143, 143, 145, + 145, 145, 145, 145, 145, 65, 145, 145, 143, 143, + 143, 143, 143, 143, 143, 143, 65, 145, 145, 145, + 86, 77, 145, 145, 145, 86, 143, 143, 143, 143, + 143, 77, 143, 71, 145, 145, 145, 145, 145, 143, + 143, 71, 143, 143, 143, 145, 145, 76, 145, 145, + 143, 143, 143, 143, 76, 145, 145, 61, 60, 61, + 60, 143, 143, 145, 145, 143, 143, 145, 145, 143, + 143, 145, 145, 143, 143, 145, 145, 143, 143, 145, + 145, 143, 143, 145, 145, 143, 143, 70, 145, 70, - 137, 137, 139, 139, 137, 137, 66, 139, 66, 137, - 139, 137, 68, 68, 0 + 143, 145, 143, 72, 72, 0 } ; static yyconst int yy_ec[256] = @@ -398,12 +408,12 @@ 20, 20, 20, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 17, 49, 50, 51, - 52, 17, 53, 1, 54, 1, 55, 56, 57, 58, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 1, 56, 1, 57, 58, 59, 60, - 59, 60, 61, 62, 63, 17, 64, 65, 66, 67, - 68, 69, 17, 70, 71, 72, 73, 17, 17, 74, - 17, 75, 76, 77, 78, 79, 1, 1, 1, 1, + 61, 62, 63, 64, 65, 49, 66, 67, 68, 69, + 70, 71, 49, 72, 73, 74, 75, 49, 49, 76, + 49, 77, 78, 79, 80, 81, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -420,426 +430,482 @@ 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[80] = +static yyconst int yy_meta[82] = { 0, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, - 1, 1, 1, 3, 4, 3, 5, 5, 6, 6, - 3, 1, 1, 4, 1, 1, 6, 6, 6, 6, - 6, 6, 5, 5, 5, 5, 6, 5, 6, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 3, 3, 5, 6, 6, 6, 6, 6, 6, - 5, 5, 5, 6, 5, 6, 5, 5, 5, 5, - 5, 5, 5, 6, 5, 1, 1, 1, 3 + 1, 1, 4, 5, 6, 5, 7, 3, 8, 8, + 5, 1, 1, 6, 1, 4, 8, 8, 8, 8, + 8, 8, 9, 9, 9, 9, 8, 9, 8, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 5, 3, 5, 9, 8, 8, 8, 8, + 8, 8, 9, 9, 9, 8, 9, 8, 9, 9, + 9, 9, 9, 9, 9, 8, 9, 1, 1, 1, + 3 } ; -static yyconst short int yy_base[931] = +static yyconst short int yy_base[1028] = { 0, - 0, 0, 0, 0, 79, 0, 151, 0, 219, 0, - 298, 0, 1658, 1659, 1659, 1659, 1659, 1659, 1633, 1650, - 359, 1659, 150, 1659, 1659, 1631, 1630, 0, 1629, 0, - 148, 401, 1578, 0, 1659, 139, 1627, 140, 1659, 138, - 360, 339, 351, 127, 362, 1606, 1611, 1608, 146, 142, - 157, 155, 161, 1600, 377, 1619, 0, 0, 144, 1586, - 1574, 1580, 1659, 360, 1659, 0, 1659, 1659, 1659, 1618, - 1635, 457, 1659, 375, 1659, 1659, 1616, 1615, 1659, 357, - 0, 191, 499, 1564, 1659, 1659, 190, 1613, 368, 1659, - 555, 416, 425, 452, 463, 1592, 1595, 363, 1586, 1589, - - 1597, 1659, 1659, 464, 1568, 1659, 402, 1659, 0, 611, - 404, 468, 560, 597, 502, 614, 485, 638, 1592, 1589, - 404, 374, 408, 425, 408, 1581, 650, 1600, 588, 653, - 1567, 1555, 701, 1659, 1659, 0, 1659, 743, 1659, 1659, - 1621, 791, 1599, 1598, 1659, 1597, 0, 1596, 0, 1545, - 1659, 0, 1594, 833, 468, 542, 436, 522, 567, 512, - 1590, 1572, 1568, 378, 1570, 1659, 1659, 553, 627, 636, - 620, 618, 339, 1558, 1542, 1538, 505, 1540, 0, 1659, - 1603, 1659, 0, 0, 1534, 1659, 1659, 1659, 0, 0, - 1659, 0, 0, 660, 1583, 1659, 0, 1659, 1582, 463, - - 376, 1570, 0, 1564, 1562, 1556, 560, 1570, 143, 1569, - 1553, 1560, 1556, 1552, 1554, 1556, 674, 1553, 1552, 1549, - 1551, 1540, 540, 1553, 1541, 1555, 1555, 1543, 1556, 593, - 1541, 1530, 1553, 1534, 1534, 429, 1510, 1515, 1500, 1659, - 1659, 0, 889, 1500, 1659, 1659, 0, 0, 1499, 1498, - 1659, 1659, 671, 1659, 677, 708, 738, 0, 0, 1536, - 0, 739, 1530, 1528, 1526, 751, 1536, 1525, 1533, 1515, - 1525, 1531, 1520, 1509, 758, 1484, 820, 776, 0, 0, - 836, 839, 1512, 620, 1526, 892, 1510, 1517, 1513, 1509, - 1514, 680, 1511, 1510, 1507, 1509, 651, 1512, 1500, 1515, - - 1517, 666, 1502, 1515, 1496, 1496, 893, 1472, 1477, 0, - 1463, 0, 0, 1533, 1531, 0, 946, 1460, 0, 0, - 1659, 0, 507, 673, 711, 0, 0, 1498, 786, 788, - 1497, 1501, 1484, 1485, 1483, 1500, 1487, 1495, 1496, 1494, - 1495, 1474, 797, 1457, 806, 868, 1456, 1460, 1445, 1446, - 1444, 1459, 1447, 1454, 1455, 1453, 1454, 1435, 1659, 1659, - 1466, 437, 1473, 1475, 1475, 1472, 1457, 1451, 1473, 614, - 1470, 1454, 1459, 1469, 1466, 1447, 0, 1455, 1451, 1444, - 1457, 1456, 0, 1447, 1441, 1448, 1444, 1451, 1441, 1438, - 1437, 1432, 1449, 1434, 1431, 1432, 1444, 1430, 1435, 1439, - - 1403, 0, 0, 1411, 1450, 0, 1427, 897, 1434, 1436, - 1436, 1414, 951, 1434, 1415, 1420, 1414, 1418, 1414, 1409, - 1425, 1387, 1395, 943, 1422, 1407, 1424, 903, 1406, 1411, - 1421, 1418, 0, 1404, 1389, 1397, 1391, 0, 1373, 1370, - 1371, 1329, 1326, 1339, 1324, 1321, 1322, 1321, 1326, 1330, - 0, 0, 951, 1659, 1002, 1321, 714, 1330, 1329, 1317, - 0, 1327, 1318, 1310, 1325, 1323, 1322, 1314, 1305, 1306, - 1309, 1280, 687, 1288, 1287, 1276, 0, 1285, 1277, 1270, - 1283, 1281, 1280, 1273, 1265, 1266, 1268, 1296, 0, 1293, - 0, 1295, 0, 1285, 0, 1284, 1289, 1282, 1277, 0, - - 1280, 1294, 1282, 1276, 0, 1271, 1270, 0, 1271, 0, - 1273, 1286, 1277, 1263, 1266, 1254, 1258, 0, 1263, 1256, - 1244, 1248, 1242, 1252, 1255, 1220, 1216, 1245, 0, 1242, - 0, 1244, 0, 1240, 1233, 1236, 0, 0, 1250, 1238, - 1240, 1233, 1208, 1204, 0, 1225, 1224, 1219, 0, 1222, - 1236, 1219, 1219, 1218, 0, 1219, 1221, 1226, 1213, 1214, - 0, 1229, 1222, 1210, 1209, 1219, 1222, 959, 1214, 1206, - 1210, 0, 0, 0, 1205, 1221, 1062, 0, 0, 1203, - 1211, 0, 1199, 1210, 1173, 1166, 1169, 0, 0, 0, - 1165, 1179, 1140, 0, 0, 1162, 1163, 0, 1149, 1158, - - 1167, 0, 0, 1169, 1181, 1180, 0, 0, 0, 1156, - 0, 1179, 0, 1174, 1157, 1179, 1175, 1164, 1157, 1175, - 0, 1171, 1166, 1158, 0, 1166, 1150, 1168, 1149, 1121, - 1133, 1145, 0, 0, 1160, 0, 0, 1160, 1162, 1158, - 1155, 1113, 1125, 1140, 1152, 0, 0, 1128, 1151, 0, - 1146, 1129, 1151, 1137, 1130, 0, 1141, 1133, 0, 1126, - 1144, 1125, 1123, 0, 1130, 1128, 1121, 0, 1218, 0, - 1132, 0, 1133, 1086, 0, 1092, 1090, 1084, 0, 1296, - 0, 1097, 0, 1093, 1097, 1090, 1082, 1105, 1105, 1102, - 0, 0, 1086, 0, 0, 1077, 1080, 1098, 1074, 1087, - - 1072, 1083, 0, 0, 1052, 1069, 1076, 1091, 0, 1070, - 1088, 1064, 1045, 1062, 1068, 1060, 1084, 1081, 0, 0, - 1065, 0, 1056, 1055, 1068, 1065, 0, 0, 1060, 1064, - 0, 0, 0, 1058, 1031, 1034, 0, 0, 0, 1029, - 1069, 1070, 1057, 0, 1056, 0, 0, 713, 0, 0, - 1066, 1050, 1060, 0, 1034, 1030, 1060, 0, 0, 0, - 1056, 1030, 1021, 1053, 1040, 1039, 0, 0, 723, 1049, - 1033, 0, 1045, 1040, 1034, 997, 997, 995, 0, 1007, - 1024, 1012, 1006, 1008, 1013, 0, 1016, 0, 987, 0, - 1014, 0, 985, 997, 1014, 1002, 996, 998, 1003, 0, - - 0, 0, 0, 0, 0, 0, 996, 1000, 996, 999, - 983, 982, 997, 964, 991, 961, 973, 977, 972, 979, - 956, 955, 951, 963, 952, 958, 952, 0, 954, 914, - 941, 912, 924, 930, 919, 920, 408, 0, 403, 470, - 483, 0, 517, 521, 544, 597, 578, 605, 684, 674, - 0, 698, 0, 681, 689, 698, 707, 682, 720, 695, - 0, 732, 733, 744, 737, 765, 0, 748, 723, 760, - 735, 754, 785, 0, 772, 789, 0, 0, 0, 0, - 783, 792, 782, 798, 787, 800, 802, 802, 806, 813, - 828, 837, 851, 851, 842, 858, 846, 871, 866, 864, - - 875, 868, 870, 888, 888, 899, 0, 895, 0, 896, - 910, 911, 0, 0, 1659, 1374, 1380, 1384, 1388, 946, - 1390, 1396, 1400, 1406, 1412, 1416, 1422, 1428, 1434, 1440 + 0, 0, 0, 0, 81, 0, 155, 0, 225, 0, + 306, 0, 386, 392, 470, 551, 632, 713, 1949, 1950, + 1950, 1950, 1950, 1950, 1924, 1941, 776, 1950, 154, 1950, + 1950, 1922, 1921, 0, 1920, 0, 152, 820, 1867, 0, + 1950, 143, 1918, 144, 0, 142, 362, 357, 360, 131, + 368, 1897, 1902, 1899, 150, 146, 161, 161, 176, 1891, + 373, 1903, 1890, 0, 0, 148, 1851, 1831, 1831, 1950, + 368, 1950, 0, 1950, 1950, 1950, 1868, 1885, 878, 1950, + 392, 1950, 1950, 1866, 1854, 1950, 386, 0, 398, 922, + 1793, 1950, 1950, 391, 1836, 393, 1950, 980, 393, 399, + + 404, 413, 1811, 1813, 1798, 184, 389, 1790, 1793, 1795, + 1950, 1950, 469, 1708, 1950, 388, 1950, 0, 1038, 463, + 464, 732, 549, 626, 744, 479, 560, 1734, 1731, 415, + 427, 424, 413, 434, 1723, 475, 1742, 1737, 639, 640, + 1706, 1694, 1082, 1950, 1950, 0, 1950, 1126, 1950, 1950, + 1762, 1176, 1740, 1739, 1950, 1738, 0, 1737, 0, 1684, + 1950, 0, 1735, 1950, 1220, 484, 508, 476, 552, 500, + 428, 1731, 1713, 1709, 474, 1711, 1950, 1950, 553, 555, + 634, 633, 712, 134, 1697, 1681, 1677, 533, 1679, 0, + 1748, 1950, 1950, 0, 1950, 0, 1950, 1950, 1950, 0, + + 1682, 1678, 1950, 1741, 1950, 0, 0, 1670, 1950, 1950, + 0, 0, 0, 0, 0, 0, 747, 1721, 1950, 0, + 1950, 1720, 468, 457, 1708, 0, 1702, 1700, 1694, 181, + 1708, 502, 1707, 1691, 1698, 1694, 1690, 1692, 1694, 581, + 1691, 569, 1688, 1690, 1678, 587, 1692, 1680, 1694, 1694, + 1682, 1690, 595, 1675, 1663, 1687, 1668, 1668, 1666, 509, + 1635, 1636, 1616, 1950, 1950, 0, 1278, 1616, 1950, 1950, + 1950, 0, 1950, 0, 1615, 1614, 1950, 1950, 706, 1950, + 636, 711, 771, 0, 0, 1654, 0, 786, 1648, 1646, + 1644, 826, 1654, 1643, 1651, 1655, 1631, 1640, 1629, 479, + + 1647, 1636, 1624, 838, 1598, 807, 823, 0, 0, 824, + 894, 1628, 633, 1642, 880, 1626, 1633, 1629, 1625, 1630, + 651, 1627, 581, 618, 1627, 652, 1630, 1618, 1632, 1632, + 1634, 674, 1619, 1632, 1613, 1613, 1612, 848, 1586, 1591, + 0, 1577, 0, 0, 1649, 1647, 0, 1336, 1574, 0, + 0, 1950, 0, 714, 716, 720, 0, 0, 1614, 783, + 887, 1613, 1617, 1600, 1601, 1599, 1616, 1598, 1606, 1607, + 1605, 1606, 1585, 749, 1565, 792, 892, 1559, 1559, 1539, + 1540, 1538, 1553, 1541, 1548, 1549, 1547, 1548, 1529, 1601, + 0, 0, 0, 1532, 1542, 1950, 1950, 1559, 645, 1566, + + 1568, 1568, 1565, 1550, 1543, 1566, 390, 1563, 1547, 1552, + 1562, 1559, 1540, 0, 1548, 1544, 1537, 1550, 1552, 1548, + 0, 1539, 1533, 1534, 1539, 1535, 1542, 1532, 1529, 1528, + 1523, 1540, 1525, 1522, 1523, 1535, 1521, 1526, 1530, 1512, + 1486, 0, 0, 1494, 1535, 0, 1512, 947, 1519, 1520, + 1515, 1488, 959, 1504, 1485, 1490, 1500, 0, 0, 1483, + 1484, 1486, 1482, 1477, 1493, 1453, 1461, 983, 1490, 1475, + 1492, 908, 1474, 1479, 1489, 1486, 0, 1476, 1466, 1479, + 1478, 0, 1469, 1471, 1475, 1465, 1462, 1461, 1474, 1459, + 1456, 1457, 1456, 1461, 1465, 1452, 0, 0, 889, 1950, + + 1394, 1455, 510, 1464, 1463, 1451, 0, 1461, 1452, 1444, + 1459, 1457, 1456, 1448, 1439, 1440, 1443, 1407, 690, 1415, + 1414, 1403, 0, 1412, 1404, 1396, 1404, 1398, 1389, 1382, + 1374, 1375, 1377, 1387, 1387, 1405, 0, 1402, 0, 1404, + 0, 1394, 0, 1393, 1398, 1391, 1385, 0, 1389, 1403, + 1391, 1385, 0, 1385, 1384, 1402, 0, 1384, 0, 1386, + 1379, 1392, 1383, 1370, 1378, 1370, 1376, 0, 1381, 1374, + 1362, 1366, 1360, 1370, 1372, 1366, 1333, 1329, 1354, 0, + 1351, 0, 1353, 0, 1349, 1342, 1345, 0, 1359, 0, + 1344, 1357, 1345, 1347, 1340, 1313, 1309, 0, 1332, 1331, + + 1325, 0, 1328, 1341, 1324, 1324, 1323, 0, 1318, 1320, + 1325, 1312, 1320, 1312, 0, 1324, 1317, 1305, 1304, 1314, + 1317, 1312, 967, 1307, 1298, 1302, 0, 0, 0, 1297, + 1307, 1456, 0, 0, 1289, 1297, 0, 1285, 1301, 1262, + 1255, 1258, 0, 0, 0, 1254, 1268, 1536, 0, 0, + 1252, 1258, 0, 1248, 1262, 1263, 1252, 1271, 0, 0, + 1272, 1283, 1282, 0, 0, 0, 1256, 0, 1281, 0, + 1270, 1273, 1251, 1256, 1273, 1269, 1255, 1248, 1266, 0, + 1262, 1257, 1248, 0, 1255, 1238, 1255, 1230, 1234, 1199, + 1211, 1225, 0, 0, 1240, 0, 0, 1239, 1223, 1237, + + 1239, 1235, 1232, 1188, 1200, 1216, 1225, 0, 0, 1199, + 1223, 0, 1212, 1194, 1217, 1203, 1196, 1214, 0, 1198, + 1190, 0, 1183, 1201, 1182, 1186, 1179, 0, 1186, 1184, + 1177, 0, 1616, 0, 1193, 0, 1194, 1145, 0, 1151, + 1149, 1143, 0, 1696, 0, 1157, 0, 1158, 1147, 0, + 1167, 1165, 1155, 1180, 1180, 1171, 0, 1171, 0, 1155, + 1153, 0, 0, 1142, 1146, 1162, 1135, 1150, 1133, 1140, + 0, 0, 1141, 1106, 1123, 1132, 1147, 1146, 1130, 0, + 1123, 1142, 1116, 1097, 1114, 1122, 1112, 1138, 1135, 0, + 0, 1118, 0, 1106, 1110, 1104, 1119, 1110, 0, 0, + + 1111, 1104, 1108, 0, 0, 0, 1102, 1073, 1068, 0, + 0, 0, 1063, 0, 1105, 1106, 1093, 0, 1092, 0, + 1088, 1087, 0, 732, 0, 0, 1100, 1084, 1094, 0, + 0, 1066, 1062, 1094, 0, 1080, 1079, 0, 0, 1088, + 1060, 1056, 1090, 1077, 1076, 0, 0, 758, 0, 1086, + 1070, 0, 0, 1077, 1077, 1075, 118, 366, 387, 0, + 406, 531, 550, 0, 572, 570, 577, 592, 0, 609, + 0, 608, 0, 0, 657, 665, 0, 639, 658, 698, + 707, 711, 724, 738, 0, 0, 0, 0, 0, 0, + 0, 738, 752, 758, 770, 789, 775, 781, 800, 772, + + 799, 814, 788, 812, 819, 831, 842, 830, 849, 850, + 864, 859, 856, 868, 864, 0, 874, 858, 877, 893, + 869, 890, 913, 917, 930, 927, 0, 922, 939, 929, + 0, 0, 943, 940, 912, 0, 947, 934, 951, 972, + 963, 0, 986, 0, 969, 960, 977, 980, 953, 984, + 957, 0, 985, 976, 988, 980, 1016, 0, 1000, 974, + 1007, 980, 998, 1028, 0, 1014, 1022, 0, 0, 0, + 0, 1016, 1024, 1012, 1026, 1020, 1034, 1034, 1033, 1036, + 1035, 1049, 1049, 1051, 1051, 1040, 1055, 1042, 1057, 1047, + 1040, 1049, 1042, 1044, 1055, 1046, 1057, 0, 1052, 0, + + 1053, 1063, 1064, 0, 0, 1950, 1776, 1785, 1794, 1803, + 1812, 1819, 1826, 1097, 1833, 1842, 1849, 1858, 1867, 1876, + 1879, 1885, 1892, 1901, 1910, 1919, 1928 } ; -static yyconst short int yy_def[931] = +static yyconst short int yy_def[1028] = { 0, - 916, 916, 915, 3, 915, 5, 5, 7, 915, 9, - 915, 11, 915, 915, 915, 915, 915, 915, 915, 917, - 918, 915, 915, 915, 915, 915, 918, 918, 918, 918, - 918, 918, 32, 918, 915, 915, 918, 915, 915, 32, - 32, 32, 32, 32, 32, 918, 918, 918, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 32, 918, - 918, 918, 915, 915, 915, 918, 915, 915, 915, 915, - 917, 919, 915, 915, 915, 915, 915, 915, 915, 915, - 919, 919, 915, 83, 915, 915, 915, 915, 915, 915, - 919, 91, 91, 91, 91, 919, 919, 919, 919, 919, - - 919, 915, 915, 91, 919, 915, 915, 915, 919, 919, - 920, 920, 110, 110, 110, 110, 110, 110, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 110, 110, - 919, 919, 921, 915, 915, 921, 915, 921, 915, 915, - 922, 923, 924, 915, 915, 915, 923, 923, 83, 83, - 915, 925, 915, 923, 154, 154, 154, 154, 154, 923, - 923, 923, 923, 923, 923, 915, 915, 154, 154, 154, - 154, 154, 923, 923, 923, 923, 923, 923, 923, 915, - 917, 915, 918, 32, 32, 915, 915, 915, 918, 918, - 915, 918, 918, 32, 915, 915, 918, 915, 915, 32, - - 32, 918, 918, 918, 918, 918, 918, 918, 32, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - 918, 918, 918, 918, 918, 32, 918, 918, 918, 915, - 915, 919, 919, 243, 915, 915, 926, 919, 83, 83, - 915, 915, 112, 915, 91, 91, 91, 919, 919, 919, - 919, 91, 919, 919, 919, 91, 919, 919, 919, 919, - 919, 919, 919, 919, 91, 919, 110, 110, 112, 253, - 110, 110, 919, 919, 919, 110, 919, 919, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, - - 919, 919, 919, 919, 919, 919, 110, 919, 919, 921, - 138, 138, 921, 922, 915, 923, 923, 317, 924, 924, - 915, 925, 154, 154, 154, 923, 923, 923, 154, 154, - 923, 923, 923, 923, 923, 923, 923, 923, 923, 923, - 923, 923, 154, 923, 154, 154, 923, 923, 923, 923, - 923, 923, 923, 923, 923, 923, 923, 923, 915, 915, - 918, 32, 918, 918, 918, 918, 918, 918, 918, 32, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - - 918, 918, 918, 918, 110, 926, 919, 91, 919, 919, - 919, 919, 91, 919, 919, 919, 919, 919, 919, 919, - 919, 919, 919, 110, 919, 919, 919, 110, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, - 919, 919, 138, 915, 923, 923, 923, 923, 923, 923, - 923, 923, 923, 923, 923, 923, 923, 923, 923, 923, - 923, 923, 923, 923, 923, 923, 923, 923, 923, 923, - 923, 923, 923, 923, 923, 923, 923, 918, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 919, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 455, 923, 923, - 923, 923, 923, 923, 923, 923, 927, 923, 923, 923, - 923, 923, 923, 923, 923, 923, 923, 923, 923, 923, - 923, 923, 928, 923, 923, 923, 923, 923, 923, 923, - - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - 918, 919, 919, 919, 919, 919, 919, 919, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, - 919, 919, 923, 923, 923, 923, 923, 929, 927, 923, - 923, 923, 923, 923, 923, 923, 923, 923, 930, 928, - 923, 923, 923, 923, 918, 918, 918, 918, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - - 918, 918, 918, 918, 918, 918, 919, 919, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 923, 923, - 923, 923, 923, 923, 923, 923, 923, 923, 923, 923, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - 918, 918, 918, 918, 918, 918, 919, 919, 919, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, - 919, 919, 923, 923, 923, 923, 923, 923, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 919, - 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, - - 923, 923, 923, 923, 923, 923, 918, 918, 918, 918, - 918, 918, 918, 918, 919, 919, 919, 919, 919, 919, - 919, 919, 918, 918, 918, 918, 918, 918, 918, 918, - 919, 919, 919, 919, 919, 919, 919, 919, 918, 918, - 918, 918, 918, 918, 918, 919, 919, 919, 919, 919, - 919, 919, 918, 918, 918, 918, 918, 918, 919, 919, - 919, 919, 919, 919, 918, 918, 918, 918, 918, 919, - 919, 919, 919, 919, 918, 918, 918, 918, 919, 919, - 919, 919, 918, 918, 919, 919, 918, 918, 919, 919, - 918, 918, 919, 919, 918, 918, 919, 919, 918, 918, - - 919, 919, 918, 918, 919, 919, 918, 918, 919, 919, - 918, 919, 918, 919, 0, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915 + 1007, 1007, 1006, 3, 1006, 5, 5, 7, 1006, 9, + 1006, 11, 1008, 1008, 1009, 1009, 1010, 1010, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1011, 1012, 1006, 1006, 1006, + 1006, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 38, 1012, + 1006, 1006, 1012, 1006, 1012, 38, 38, 38, 38, 38, + 38, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 38, 1012, 1012, 1012, 1006, + 1006, 1006, 1012, 1006, 1006, 1006, 1006, 1011, 1013, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1013, 1013, 1006, + 90, 1006, 1006, 1006, 1006, 1006, 1006, 1013, 98, 98, + + 98, 98, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1006, 1006, 98, 1013, 1006, 1006, 1006, 1013, 1013, 1014, + 1014, 119, 119, 119, 119, 119, 119, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 119, 119, + 1013, 1013, 1015, 1006, 1006, 1015, 1006, 1015, 1006, 1006, + 1016, 1017, 1018, 1006, 1006, 1006, 1017, 1017, 90, 90, + 1006, 1019, 1006, 1006, 1017, 165, 165, 165, 165, 165, + 1017, 1017, 1017, 1017, 1017, 1017, 1006, 1006, 165, 165, + 165, 165, 165, 1017, 1017, 1017, 1017, 1017, 1017, 1017, + 1006, 1006, 1006, 1020, 1006, 1021, 1006, 1006, 1006, 1022, + + 1022, 1022, 1006, 1011, 1006, 1012, 38, 38, 1006, 1006, + 1012, 1012, 1012, 1012, 1012, 1012, 38, 1006, 1006, 1012, + 1006, 1006, 38, 38, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 38, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 38, + 1012, 1012, 1012, 1006, 1006, 1013, 1013, 267, 1006, 1006, + 1006, 1023, 1006, 1013, 90, 90, 1006, 1006, 121, 1006, + 98, 98, 98, 1013, 1013, 1013, 1013, 98, 1013, 1013, + 1013, 98, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + + 1013, 1013, 1013, 98, 1013, 119, 119, 121, 279, 119, + 119, 1013, 1013, 1013, 119, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 119, 1013, 1013, + 1015, 148, 148, 1015, 1016, 1006, 1017, 1017, 348, 1018, + 1018, 1006, 1019, 165, 165, 165, 1017, 1017, 1017, 165, + 165, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, + 1017, 1017, 1017, 165, 1017, 165, 165, 1017, 1017, 1017, + 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1006, + 1020, 1021, 1022, 1022, 1022, 1006, 1006, 1012, 38, 1012, + + 1012, 1012, 1012, 1012, 1012, 1012, 38, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 119, 1023, 1013, 98, 1013, 1013, + 1013, 1013, 98, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 119, 1013, 1013, + 1013, 119, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 148, 1006, + + 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, + 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, + 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, + 1017, 1017, 1017, 1022, 1022, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 501, 1017, 1017, 1017, 1017, 1017, 1017, 1017, + 1017, 1024, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, + 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1025, 1017, 1017, + 1017, 1017, 1017, 1017, 1017, 1022, 1022, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1017, 1017, 1017, 1017, + 1017, 1026, 1024, 1017, 1017, 1017, 1017, 1017, 1017, 1017, + 1017, 1017, 1027, 1025, 1017, 1017, 1017, 1017, 1022, 1022, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + + 1013, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, + 1017, 1017, 1017, 1022, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1012, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1017, 1017, 1017, 1017, 1017, 1017, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + 1012, 1012, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1017, 1017, 1017, 1017, 1017, + 1017, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, + + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1013, 1013, + 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1012, 1012, 1012, 1012, 1012, 1012, 1013, + 1013, 1013, 1013, 1013, 1013, 1012, 1012, 1012, 1012, 1012, + 1013, 1013, 1013, 1013, 1013, 1012, 1012, 1012, 1012, 1013, + 1013, 1013, 1013, 1012, 1012, 1013, 1013, 1012, 1012, 1013, + 1013, 1012, 1012, 1013, 1013, 1012, 1012, 1013, 1013, 1012, + 1012, 1013, 1013, 1012, 1012, 1013, 1013, 1012, 1012, 1013, + + 1013, 1012, 1013, 1012, 1013, 0, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006 } ; -static yyconst short int yy_nxt[1739] = +static yyconst short int yy_nxt[2032] = { 0, - 15, 16, 17, 18, 19, 20, 15, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 30, 30, 49, 50, 51, - 52, 53, 54, 30, 55, 56, 30, 30, 30, 30, - 30, 57, 58, 30, 59, 33, 33, 33, 33, 33, - 30, 30, 30, 30, 60, 30, 30, 61, 30, 30, - 62, 30, 30, 30, 30, 63, 64, 65, 66, 67, - 68, 17, 69, 70, 71, 67, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 95, 96, 81, 97, 81, 81, 81, 81, 98, 99, - 100, 81, 81, 101, 81, 81, 81, 81, 81, 81, - 102, 103, 81, 104, 95, 95, 95, 95, 95, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 105, - 81, 81, 81, 81, 106, 107, 108, 109, 110, 186, - 191, 195, 196, 198, 199, 200, 211, 201, 220, 111, - 112, 192, 221, 187, 370, 202, 218, 113, 114, 115, - 116, 117, 118, 203, 119, 120, 219, 222, 121, 122, - 123, 124, 125, 126, 227, 127, 128, 223, 224, 236, - - 183, 225, 226, 191, 228, 129, 130, 130, 130, 130, - 130, 183, 195, 196, 248, 131, 183, 183, 132, 67, - 67, 14, 67, 67, 67, 67, 133, 67, 67, 67, - 67, 67, 134, 67, 135, 136, 136, 111, 112, 67, - 67, 67, 137, 67, 67, 138, 138, 138, 138, 138, - 138, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 67, 67, 136, 138, 138, 138, 138, 138, 138, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 67, 67, 67, 136, 15, 16, - - 139, 140, 19, 15, 141, 142, 22, 23, 24, 25, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 36, 153, 38, 39, 154, 155, 156, 157, 158, 159, - 147, 147, 147, 147, 147, 160, 147, 161, 162, 163, - 147, 147, 164, 165, 147, 147, 147, 147, 147, 166, - 167, 147, 168, 169, 170, 157, 171, 172, 147, 147, - 147, 147, 173, 147, 174, 175, 176, 147, 177, 178, - 147, 147, 147, 63, 64, 65, 179, 184, 185, 207, - 246, 209, 208, 240, 186, 185, 185, 185, 185, 185, - 185, 198, 199, 270, 204, 210, 212, 205, 187, 213, - - 295, 351, 214, 271, 296, 362, 352, 230, 340, 206, - 231, 232, 183, 185, 185, 185, 185, 185, 185, 185, - 185, 247, 233, 341, 183, 240, 234, 185, 185, 185, - 185, 185, 185, 183, 293, 183, 241, 193, 270, 193, - 252, 300, 252, 262, 294, 262, 852, 853, 297, 183, - 263, 273, 262, 264, 262, 185, 185, 185, 185, 185, - 185, 242, 242, 325, 193, 265, 193, 252, 298, 252, - 242, 299, 272, 316, 194, 243, 244, 280, 241, 262, - 489, 262, 266, 244, 244, 244, 244, 244, 244, 242, - 262, 262, 262, 262, 329, 325, 267, 242, 854, 401, - - 242, 242, 183, 278, 252, 316, 252, 361, 242, 242, - 183, 244, 244, 244, 244, 244, 244, 249, 249, 275, - 278, 259, 855, 259, 287, 249, 250, 249, 250, 249, - 249, 252, 251, 252, 325, 252, 183, 252, 259, 251, - 259, 915, 284, 856, 316, 285, 335, 251, 259, 325, - 259, 857, 336, 249, 250, 249, 250, 249, 249, 316, - 251, 332, 252, 356, 252, 259, 251, 259, 330, 325, - 333, 386, 253, 255, 255, 331, 357, 387, 278, 316, - 325, 255, 256, 255, 257, 255, 255, 281, 258, 282, - 316, 259, 260, 259, 325, 258, 259, 260, 259, 367, - - 261, 368, 858, 258, 316, 261, 278, 334, 343, 255, - 262, 255, 262, 255, 255, 278, 258, 344, 259, 394, - 259, 395, 258, 259, 259, 259, 259, 859, 258, 277, - 278, 263, 278, 259, 264, 259, 860, 278, 278, 278, - 278, 278, 278, 307, 286, 325, 283, 325, 497, 861, - 259, 259, 259, 259, 325, 316, 278, 316, 267, 426, - 259, 412, 259, 325, 316, 278, 278, 278, 278, 278, - 278, 278, 288, 316, 259, 289, 259, 259, 290, 259, - 302, 345, 440, 303, 274, 350, 348, 183, 418, 259, - 346, 259, 445, 349, 446, 304, 183, 347, 183, 305, - - 325, 259, 378, 259, 262, 379, 262, 915, 434, 915, - 316, 416, 862, 863, 242, 380, 259, 456, 259, 311, - 312, 435, 242, 183, 864, 183, 865, 312, 312, 312, - 312, 312, 312, 183, 915, 262, 915, 262, 325, 783, - 570, 586, 866, 867, 784, 242, 571, 587, 316, 797, - 868, 869, 407, 242, 798, 312, 312, 312, 312, 312, - 312, 312, 312, 870, 871, 262, 262, 408, 262, 312, - 312, 312, 312, 312, 312, 242, 242, 872, 262, 313, - 262, 313, 413, 242, 242, 262, 873, 262, 242, 874, - 875, 876, 877, 878, 278, 242, 242, 312, 312, 312, - - 312, 312, 312, 242, 879, 880, 313, 881, 313, 317, - 318, 882, 259, 325, 259, 325, 883, 318, 318, 318, - 318, 318, 318, 316, 325, 316, 884, 885, 422, 886, - 458, 887, 459, 325, 316, 888, 889, 890, 278, 259, - 891, 259, 892, 316, 893, 318, 318, 318, 318, 318, - 318, 323, 323, 894, 278, 895, 259, 278, 259, 323, - 324, 323, 325, 323, 323, 896, 326, 472, 424, 327, - 328, 327, 259, 326, 259, 259, 474, 259, 897, 898, - 407, 326, 899, 259, 900, 259, 901, 323, 325, 323, - 325, 323, 323, 405, 326, 325, 327, 902, 327, 259, - - 326, 259, 259, 903, 259, 316, 326, 244, 244, 904, - 278, 278, 905, 906, 907, 244, 244, 244, 244, 244, - 244, 278, 908, 428, 262, 259, 262, 259, 259, 259, - 259, 259, 909, 910, 242, 911, 912, 534, 475, 259, - 529, 259, 242, 244, 244, 244, 244, 244, 244, 913, - 914, 279, 259, 851, 259, 259, 259, 259, 259, 850, - 849, 278, 405, 422, 318, 318, 259, 848, 259, 847, - 846, 845, 318, 318, 318, 318, 318, 318, 262, 259, - 262, 259, 327, 844, 327, 534, 529, 310, 242, 310, - 843, 842, 841, 840, 839, 327, 242, 327, 838, 837, - - 318, 318, 318, 318, 318, 318, 259, 836, 259, 327, - 835, 327, 834, 833, 310, 832, 310, 831, 830, 455, - 568, 568, 327, 829, 327, 828, 827, 826, 568, 568, - 568, 568, 568, 568, 825, 824, 823, 822, 821, 820, - 819, 818, 817, 816, 815, 814, 813, 812, 811, 810, - 809, 808, 807, 806, 805, 804, 568, 568, 568, 568, - 568, 568, 668, 668, 803, 668, 668, 668, 668, 802, - 668, 668, 668, 668, 668, 801, 668, 800, 799, 796, - 795, 794, 793, 668, 668, 668, 668, 668, 792, 791, - 790, 789, 788, 787, 786, 785, 782, 781, 780, 779, - - 778, 777, 776, 775, 774, 773, 772, 771, 770, 769, - 768, 767, 766, 765, 764, 763, 762, 761, 760, 759, - 758, 757, 756, 755, 754, 753, 752, 751, 750, 749, - 748, 747, 746, 745, 744, 743, 742, 668, 668, 668, - 679, 679, 741, 679, 679, 679, 679, 740, 679, 679, - 679, 679, 679, 739, 679, 738, 737, 736, 735, 734, - 733, 679, 679, 679, 679, 679, 732, 731, 730, 729, - 728, 727, 726, 725, 724, 723, 722, 721, 720, 719, - 718, 717, 716, 715, 714, 713, 712, 711, 710, 709, - 708, 707, 706, 705, 704, 703, 702, 701, 700, 699, - - 698, 697, 696, 695, 694, 693, 692, 691, 690, 689, - 688, 687, 686, 685, 684, 679, 679, 679, 668, 668, - 683, 668, 668, 668, 668, 682, 668, 668, 668, 668, - 668, 681, 668, 678, 677, 676, 675, 674, 673, 668, - 668, 668, 668, 668, 672, 671, 670, 667, 666, 665, - 664, 663, 662, 661, 660, 659, 658, 657, 656, 655, - 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, - 644, 643, 642, 641, 640, 639, 638, 637, 636, 635, - 634, 633, 632, 631, 630, 629, 628, 627, 626, 625, - 624, 623, 622, 668, 668, 668, 679, 679, 621, 679, - - 679, 679, 679, 620, 679, 679, 679, 679, 679, 619, - 679, 618, 617, 616, 615, 614, 613, 679, 679, 679, - 679, 679, 612, 611, 610, 609, 608, 607, 606, 605, - 604, 603, 602, 601, 600, 599, 598, 597, 596, 595, - 594, 593, 592, 591, 590, 589, 588, 585, 584, 583, - 582, 581, 580, 579, 578, 577, 576, 575, 574, 573, - 572, 569, 567, 566, 565, 564, 563, 562, 561, 560, - 559, 679, 679, 679, 14, 14, 14, 14, 14, 14, - 181, 181, 181, 181, 181, 181, 183, 183, 183, 183, - 242, 242, 242, 242, 310, 310, 314, 314, 314, 314, - - 314, 314, 316, 558, 316, 316, 319, 557, 319, 319, - 319, 319, 322, 556, 322, 322, 322, 322, 406, 406, - 406, 406, 669, 555, 669, 669, 669, 669, 680, 554, - 680, 680, 680, 680, 668, 553, 668, 668, 668, 668, - 679, 552, 679, 679, 679, 679, 551, 550, 549, 548, - 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, - 537, 536, 535, 533, 532, 531, 530, 528, 278, 527, - 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, - 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, - 506, 505, 504, 503, 502, 501, 500, 499, 498, 496, - - 495, 494, 493, 492, 491, 490, 488, 487, 486, 485, - 484, 483, 482, 481, 480, 479, 478, 477, 476, 473, - 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, - 461, 460, 457, 316, 454, 315, 453, 452, 451, 450, - 449, 448, 447, 444, 443, 442, 441, 439, 438, 437, - 436, 433, 432, 431, 430, 429, 427, 425, 423, 421, - 420, 419, 418, 417, 416, 415, 414, 412, 411, 410, - 409, 251, 251, 242, 404, 403, 402, 400, 399, 398, - 397, 396, 393, 392, 391, 390, 389, 388, 385, 384, - 383, 382, 381, 377, 376, 375, 374, 373, 372, 371, - - 369, 366, 365, 364, 363, 360, 359, 183, 182, 358, - 355, 354, 353, 342, 339, 338, 337, 254, 251, 321, - 246, 245, 320, 315, 309, 308, 306, 301, 292, 291, - 276, 274, 273, 272, 269, 268, 254, 251, 245, 188, - 182, 180, 239, 238, 237, 235, 229, 217, 216, 215, - 197, 183, 190, 189, 188, 182, 180, 915, 13, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915 + 21, 22, 23, 24, 25, 26, 21, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 36, 36, 55, 56, 57, + 58, 59, 60, 36, 61, 62, 36, 63, 36, 36, + 36, 36, 64, 36, 65, 36, 66, 39, 39, 39, + 39, 39, 36, 36, 36, 36, 67, 36, 36, 68, + 36, 36, 69, 36, 36, 36, 36, 70, 71, 72, + 73, 74, 75, 23, 76, 77, 78, 74, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 102, 103, 88, 104, 88, 88, 105, 106, + 107, 108, 109, 88, 88, 110, 88, 88, 88, 88, + 88, 88, 88, 111, 88, 112, 88, 113, 102, 102, + 102, 102, 102, 88, 88, 88, 88, 88, 88, 88, + 88, 88, 88, 114, 88, 88, 88, 88, 115, 116, + 117, 118, 119, 209, 214, 218, 219, 221, 222, 223, + 234, 224, 243, 120, 121, 215, 244, 210, 889, 225, + 241, 122, 123, 124, 125, 126, 127, 226, 128, 129, + 242, 245, 130, 131, 132, 133, 134, 135, 382, 136, + + 137, 246, 138, 383, 247, 260, 206, 248, 249, 250, + 297, 139, 140, 140, 140, 140, 140, 206, 298, 251, + 404, 141, 405, 206, 142, 74, 74, 20, 74, 74, + 74, 74, 143, 74, 74, 74, 74, 74, 144, 74, + 145, 146, 146, 120, 121, 74, 74, 74, 147, 74, + 74, 148, 148, 148, 148, 148, 148, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 74, 146, 74, + 146, 148, 148, 148, 148, 148, 148, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + + 146, 146, 74, 74, 74, 146, 21, 22, 149, 150, + 25, 21, 151, 152, 28, 29, 30, 31, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 42, 163, + 44, 164, 165, 166, 167, 168, 169, 170, 157, 157, + 157, 157, 157, 171, 157, 172, 173, 174, 157, 157, + 175, 176, 157, 157, 157, 157, 157, 157, 177, 157, + 178, 157, 179, 180, 181, 168, 182, 183, 157, 157, + 157, 157, 184, 157, 185, 186, 187, 157, 188, 189, + 157, 157, 157, 70, 71, 72, 190, 191, 192, 193, + 232, 264, 194, 191, 192, 193, 227, 230, 194, 228, + + 231, 209, 235, 253, 233, 236, 254, 255, 237, 271, + 273, 264, 229, 218, 219, 210, 221, 222, 256, 299, + 288, 274, 288, 257, 545, 890, 288, 289, 288, 300, + 290, 288, 206, 288, 292, 206, 266, 206, 266, 291, + 288, 266, 288, 206, 266, 322, 265, 891, 293, 266, + 266, 892, 272, 324, 299, 323, 327, 325, 266, 328, + 329, 298, 366, 195, 326, 206, 265, 330, 367, 195, + 21, 191, 192, 193, 21, 21, 194, 302, 21, 21, + 21, 21, 21, 21, 197, 21, 399, 21, 21, 21, + 197, 197, 21, 21, 21, 21, 288, 307, 288, 278, + + 278, 278, 278, 356, 371, 332, 266, 461, 333, 303, + 360, 356, 398, 347, 266, 285, 462, 285, 316, 372, + 334, 347, 21, 21, 21, 335, 304, 356, 278, 278, + 278, 278, 206, 407, 361, 356, 625, 347, 309, 1006, + 365, 362, 626, 206, 285, 347, 285, 198, 21, 199, + 21, 21, 191, 192, 193, 21, 21, 194, 893, 21, + 21, 21, 21, 21, 21, 197, 21, 307, 21, 21, + 21, 197, 197, 21, 21, 21, 21, 206, 307, 356, + 356, 441, 356, 289, 206, 285, 290, 285, 894, 347, + 347, 363, 347, 387, 317, 419, 285, 318, 285, 312, + + 319, 364, 895, 21, 21, 21, 388, 457, 420, 415, + 374, 376, 416, 896, 285, 424, 285, 897, 425, 375, + 481, 433, 417, 434, 426, 285, 898, 285, 198, 21, + 199, 21, 21, 191, 192, 193, 21, 21, 194, 899, + 21, 21, 21, 21, 307, 21, 197, 21, 21, 21, + 21, 21, 197, 197, 21, 21, 21, 307, 307, 482, + 356, 356, 285, 288, 285, 288, 313, 458, 900, 314, + 347, 347, 470, 266, 452, 285, 285, 285, 285, 478, + 461, 266, 456, 484, 21, 21, 21, 901, 537, 462, + 377, 285, 479, 285, 201, 902, 338, 378, 202, 903, + + 490, 379, 491, 904, 285, 285, 285, 285, 380, 21, + 21, 199, 21, 21, 191, 192, 193, 21, 21, 194, + 206, 21, 21, 21, 21, 905, 21, 197, 21, 21, + 21, 21, 21, 197, 197, 21, 21, 21, 288, 356, + 288, 356, 1006, 356, 1006, 906, 641, 356, 266, 347, + 307, 347, 642, 347, 907, 447, 266, 347, 866, 310, + 502, 311, 307, 867, 908, 21, 21, 21, 285, 286, + 285, 1006, 909, 1006, 315, 201, 356, 287, 910, 202, + 285, 381, 285, 206, 882, 206, 347, 911, 293, 883, + 21, 21, 199, 21, 207, 208, 912, 285, 288, 285, + + 448, 913, 208, 208, 208, 208, 208, 208, 266, 285, + 356, 285, 206, 288, 206, 288, 266, 914, 915, 356, + 347, 518, 206, 266, 916, 307, 917, 504, 918, 347, + 919, 266, 208, 208, 208, 208, 208, 208, 208, 208, + 920, 307, 307, 285, 921, 285, 208, 208, 208, 208, + 208, 208, 922, 288, 923, 288, 216, 453, 216, 285, + 285, 285, 285, 266, 520, 288, 307, 288, 447, 924, + 925, 266, 285, 926, 285, 266, 208, 208, 208, 208, + 208, 208, 445, 266, 285, 216, 285, 216, 285, 285, + 285, 285, 927, 928, 929, 217, 267, 268, 307, 930, + + 931, 932, 933, 934, 268, 268, 268, 268, 268, 268, + 466, 472, 307, 285, 356, 285, 285, 935, 285, 356, + 466, 936, 937, 468, 347, 341, 307, 341, 938, 347, + 285, 505, 285, 939, 268, 268, 268, 268, 268, 268, + 275, 275, 585, 940, 285, 285, 285, 285, 275, 276, + 275, 276, 275, 275, 341, 277, 341, 941, 278, 285, + 278, 285, 277, 942, 521, 943, 944, 945, 946, 947, + 948, 277, 949, 285, 288, 285, 288, 950, 275, 276, + 275, 276, 275, 275, 266, 277, 288, 278, 288, 278, + 580, 277, 266, 585, 951, 952, 266, 279, 281, 281, + + 953, 307, 954, 358, 266, 358, 281, 282, 281, 283, + 281, 281, 955, 284, 956, 957, 285, 286, 285, 285, + 284, 285, 958, 959, 960, 287, 580, 961, 962, 284, + 963, 964, 358, 965, 358, 966, 281, 288, 281, 288, + 281, 281, 967, 284, 968, 285, 969, 285, 285, 284, + 285, 970, 971, 972, 973, 284, 306, 307, 974, 975, + 976, 977, 978, 979, 307, 307, 307, 307, 307, 307, + 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, + 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, + 1000, 1001, 1002, 1003, 307, 307, 307, 307, 307, 307, + + 342, 343, 1004, 1005, 308, 888, 887, 886, 343, 343, + 343, 343, 343, 343, 885, 884, 881, 880, 879, 878, + 877, 876, 875, 874, 873, 872, 871, 870, 869, 868, + 865, 864, 863, 862, 861, 860, 859, 858, 343, 343, + 343, 343, 343, 343, 343, 343, 857, 856, 855, 854, + 853, 852, 343, 343, 343, 343, 343, 343, 851, 850, + 849, 848, 344, 847, 344, 846, 845, 844, 843, 842, + 841, 840, 839, 838, 837, 836, 835, 834, 833, 832, + 831, 830, 343, 343, 343, 343, 343, 343, 829, 828, + 827, 344, 826, 344, 348, 349, 825, 824, 823, 822, + + 821, 820, 349, 349, 349, 349, 349, 349, 819, 818, + 817, 816, 815, 814, 813, 812, 811, 810, 809, 808, + 807, 806, 805, 804, 803, 802, 801, 800, 799, 798, + 797, 796, 349, 349, 349, 349, 349, 349, 354, 354, + 795, 794, 793, 792, 791, 790, 354, 355, 354, 356, + 354, 354, 789, 357, 788, 787, 358, 359, 358, 786, + 357, 785, 784, 783, 782, 781, 780, 779, 778, 357, + 777, 776, 775, 774, 773, 772, 354, 356, 354, 356, + 354, 354, 771, 357, 770, 358, 769, 358, 768, 357, + 767, 766, 765, 764, 763, 357, 268, 268, 762, 761, + + 760, 759, 758, 757, 268, 268, 268, 268, 268, 268, + 756, 755, 754, 753, 285, 752, 285, 751, 750, 749, + 748, 747, 746, 745, 742, 741, 740, 739, 738, 737, + 736, 735, 734, 731, 268, 268, 268, 268, 268, 268, + 730, 729, 728, 285, 727, 285, 726, 725, 724, 723, + 722, 721, 720, 445, 349, 349, 719, 718, 717, 716, + 715, 714, 349, 349, 349, 349, 349, 349, 713, 712, + 711, 710, 358, 709, 358, 708, 707, 706, 705, 704, + 703, 702, 701, 700, 699, 698, 697, 696, 695, 694, + 693, 692, 349, 349, 349, 349, 349, 349, 691, 690, + + 689, 358, 688, 358, 687, 686, 685, 684, 683, 682, + 681, 501, 623, 623, 680, 679, 678, 677, 676, 675, + 623, 623, 623, 623, 623, 623, 674, 673, 672, 671, + 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, + 660, 659, 658, 657, 656, 655, 654, 653, 652, 651, + 623, 623, 623, 623, 623, 623, 732, 732, 650, 732, + 732, 732, 732, 649, 732, 732, 732, 732, 732, 648, + 732, 647, 646, 645, 644, 643, 640, 732, 732, 732, + 732, 732, 639, 638, 637, 636, 635, 634, 633, 632, + 631, 630, 629, 628, 627, 624, 622, 621, 620, 619, + + 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, + 608, 607, 606, 605, 604, 603, 602, 601, 600, 599, + 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, + 588, 587, 586, 732, 732, 732, 743, 743, 584, 743, + 743, 743, 743, 583, 743, 743, 743, 743, 743, 582, + 743, 581, 579, 307, 578, 577, 576, 743, 743, 743, + 743, 743, 575, 574, 573, 572, 571, 570, 569, 568, + 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, + 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, + 547, 546, 544, 543, 542, 541, 540, 539, 538, 536, + + 535, 534, 390, 533, 532, 531, 530, 529, 528, 527, + 526, 525, 524, 743, 743, 743, 732, 732, 523, 732, + 732, 732, 732, 522, 732, 732, 732, 732, 732, 519, + 732, 517, 516, 515, 514, 513, 512, 732, 732, 732, + 732, 732, 511, 510, 509, 508, 507, 506, 503, 347, + 500, 346, 499, 498, 497, 496, 495, 494, 493, 492, + 489, 488, 487, 486, 485, 483, 480, 477, 476, 475, + 474, 473, 471, 469, 467, 465, 464, 463, 460, 459, + 458, 457, 456, 455, 454, 452, 451, 450, 449, 277, + 277, 266, 444, 732, 732, 732, 743, 743, 443, 743, + + 743, 743, 743, 442, 743, 743, 743, 743, 743, 440, + 743, 439, 438, 437, 436, 435, 432, 743, 743, 743, + 743, 743, 431, 430, 429, 428, 427, 423, 422, 421, + 418, 414, 413, 412, 411, 410, 409, 408, 406, 403, + 402, 401, 400, 397, 396, 206, 205, 395, 394, 390, + 389, 386, 385, 384, 373, 370, 369, 368, 280, 277, + 352, 271, 270, 351, 346, 340, 339, 337, 336, 331, + 321, 320, 305, 743, 743, 743, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 196, 196, 196, 196, 196, 196, + + 196, 196, 196, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 204, 204, 204, 204, 204, 204, 204, 204, + 204, 206, 206, 206, 206, 206, 206, 206, 266, 303, + 266, 266, 266, 266, 266, 341, 302, 301, 296, 341, + 341, 341, 345, 345, 345, 345, 345, 345, 345, 345, + 345, 347, 295, 347, 294, 347, 347, 347, 350, 280, + 350, 350, 350, 350, 350, 350, 350, 353, 277, 353, + 353, 353, 353, 353, 353, 353, 391, 270, 391, 391, + 391, 391, 391, 391, 391, 392, 392, 392, 393, 269, + 205, 203, 393, 393, 446, 263, 446, 446, 446, 446, + + 446, 733, 262, 733, 733, 733, 733, 733, 733, 733, + 744, 261, 744, 744, 744, 744, 744, 744, 744, 732, + 259, 732, 732, 732, 732, 732, 732, 732, 743, 258, + 743, 743, 743, 743, 743, 743, 743, 252, 240, 239, + 238, 220, 206, 213, 212, 211, 205, 203, 1006, 19, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006 } ; -static yyconst short int yy_chk[1739] = +static yyconst short int yy_chk[2032] = { 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, @@ -848,8 +914,8 @@ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, @@ -857,14 +923,15 @@ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 7, 23, - 31, 36, 36, 38, 38, 40, 44, 40, 50, 7, - 7, 31, 50, 23, 209, 40, 49, 7, 7, 7, - 7, 7, 7, 40, 7, 7, 49, 51, 7, 7, - 7, 7, 7, 7, 53, 7, 7, 51, 52, 59, - - 44, 52, 52, 82, 53, 7, 7, 7, 7, 7, - 7, 40, 87, 87, 82, 7, 209, 59, 7, 9, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 7, 29, 37, 42, 42, 44, 44, 46, + 50, 46, 56, 7, 7, 37, 56, 29, 857, 46, + 55, 7, 7, 7, 7, 7, 7, 46, 7, 7, + 55, 57, 7, 7, 7, 7, 7, 7, 184, 7, + + 7, 57, 7, 184, 58, 66, 50, 58, 58, 59, + 106, 7, 7, 7, 7, 7, 7, 46, 106, 59, + 230, 7, 230, 66, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, @@ -872,8 +939,8 @@ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 11, 11, + 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, @@ -881,157 +948,189 @@ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 21, 21, 42, - 80, 43, 42, 64, 74, 21, 21, 21, 21, 21, - 21, 89, 89, 98, 41, 43, 45, 41, 74, 45, - - 122, 173, 45, 98, 122, 201, 173, 55, 164, 41, - 55, 55, 42, 21, 21, 21, 21, 21, 21, 32, - 32, 80, 55, 164, 43, 107, 55, 32, 32, 32, - 32, 32, 32, 41, 121, 45, 64, 32, 123, 32, - 111, 125, 111, 92, 121, 92, 837, 839, 123, 201, - 92, 125, 93, 92, 93, 32, 32, 32, 32, 32, - 32, 92, 93, 157, 32, 93, 32, 111, 124, 111, - 93, 124, 124, 157, 32, 72, 72, 111, 107, 94, - 362, 94, 94, 72, 72, 72, 72, 72, 72, 94, - 95, 104, 95, 104, 155, 155, 94, 94, 840, 236, - - 95, 104, 236, 117, 112, 155, 112, 200, 95, 104, - 362, 72, 72, 72, 72, 72, 72, 83, 83, 104, - 115, 117, 841, 117, 117, 83, 83, 83, 83, 83, - 83, 112, 83, 112, 323, 83, 200, 83, 115, 83, - 115, 112, 115, 843, 323, 115, 160, 83, 117, 158, - 117, 844, 160, 83, 83, 83, 83, 83, 83, 158, - 83, 158, 83, 177, 83, 115, 83, 115, 156, 156, - 158, 223, 83, 91, 91, 156, 177, 223, 113, 156, - 168, 91, 91, 91, 91, 91, 91, 113, 91, 113, - 168, 91, 91, 91, 159, 91, 113, 113, 113, 207, - - 91, 207, 845, 91, 159, 113, 129, 159, 168, 91, - 91, 91, 91, 91, 91, 114, 91, 168, 91, 230, - 91, 230, 91, 113, 129, 113, 129, 846, 91, 110, - 110, 114, 116, 114, 114, 114, 847, 110, 110, 110, - 110, 110, 110, 129, 116, 172, 114, 171, 370, 848, - 116, 129, 116, 129, 169, 172, 118, 171, 116, 284, - 114, 284, 114, 170, 169, 110, 110, 110, 110, 110, - 110, 130, 118, 170, 118, 118, 118, 116, 118, 116, - 127, 169, 297, 127, 127, 172, 171, 370, 297, 130, - 170, 130, 302, 171, 302, 127, 194, 170, 194, 127, - - 324, 118, 217, 118, 255, 217, 255, 253, 292, 253, - 324, 292, 849, 850, 255, 217, 130, 324, 130, 133, - 133, 292, 255, 194, 852, 194, 854, 133, 133, 133, - 133, 133, 133, 194, 253, 256, 253, 256, 325, 748, - 457, 473, 855, 856, 748, 256, 457, 473, 325, 769, - 857, 858, 256, 256, 769, 133, 133, 133, 133, 133, - 133, 138, 138, 859, 860, 257, 262, 257, 262, 138, - 138, 138, 138, 138, 138, 257, 262, 862, 266, 138, - 266, 138, 266, 257, 262, 275, 863, 275, 266, 864, - 865, 866, 868, 869, 278, 275, 266, 138, 138, 138, - - 138, 138, 138, 275, 870, 871, 138, 872, 138, 142, - 142, 873, 278, 329, 278, 330, 875, 142, 142, 142, - 142, 142, 142, 329, 343, 330, 876, 881, 275, 882, - 329, 883, 330, 345, 343, 884, 885, 886, 277, 278, - 887, 278, 888, 345, 889, 142, 142, 142, 142, 142, - 142, 154, 154, 890, 281, 891, 277, 282, 277, 154, - 154, 154, 154, 154, 154, 892, 154, 343, 282, 154, - 154, 154, 281, 154, 281, 282, 345, 282, 893, 894, - 281, 154, 895, 277, 896, 277, 897, 154, 154, 154, - 154, 154, 154, 277, 154, 346, 154, 898, 154, 281, - - 154, 281, 282, 899, 282, 346, 154, 243, 243, 900, - 286, 307, 901, 902, 903, 243, 243, 243, 243, 243, - 243, 428, 904, 286, 408, 243, 408, 243, 286, 307, - 286, 307, 905, 906, 408, 908, 910, 428, 346, 428, - 408, 428, 408, 243, 243, 243, 243, 243, 243, 911, - 912, 920, 243, 836, 243, 286, 307, 286, 307, 835, - 834, 424, 243, 307, 317, 317, 428, 833, 428, 832, - 831, 830, 317, 317, 317, 317, 317, 317, 413, 424, - 413, 424, 317, 829, 317, 413, 424, 453, 413, 453, - 827, 826, 825, 824, 823, 568, 413, 568, 822, 821, - - 317, 317, 317, 317, 317, 317, 424, 820, 424, 317, - 819, 317, 818, 817, 453, 816, 453, 815, 814, 317, - 455, 455, 568, 813, 568, 812, 811, 810, 455, 455, - 455, 455, 455, 455, 809, 808, 807, 799, 798, 797, - 796, 795, 794, 793, 791, 789, 787, 785, 784, 783, - 782, 781, 780, 778, 777, 776, 455, 455, 455, 455, - 455, 455, 577, 577, 775, 577, 577, 577, 577, 774, - 577, 577, 577, 577, 577, 773, 577, 771, 770, 766, - 765, 764, 763, 577, 577, 577, 577, 577, 762, 761, - 757, 756, 755, 753, 752, 751, 745, 743, 742, 741, - - 740, 736, 735, 734, 730, 729, 726, 725, 724, 723, - 721, 718, 717, 716, 715, 714, 713, 712, 711, 710, - 708, 707, 706, 705, 702, 701, 700, 699, 698, 697, - 696, 693, 690, 689, 688, 687, 686, 577, 577, 577, - 593, 593, 685, 593, 593, 593, 593, 684, 593, 593, - 593, 593, 593, 682, 593, 678, 677, 676, 674, 673, - 671, 593, 593, 593, 593, 593, 667, 666, 665, 663, - 662, 661, 660, 658, 657, 655, 654, 653, 652, 651, - 649, 648, 645, 644, 643, 642, 641, 640, 639, 638, - 635, 632, 631, 630, 629, 628, 627, 626, 624, 623, - - 622, 620, 619, 618, 617, 616, 615, 614, 612, 610, - 606, 605, 604, 601, 600, 593, 593, 593, 669, 669, - 599, 669, 669, 669, 669, 597, 669, 669, 669, 669, - 669, 596, 669, 592, 591, 587, 586, 585, 584, 669, - 669, 669, 669, 669, 583, 581, 580, 576, 575, 571, - 570, 569, 567, 566, 565, 564, 563, 562, 560, 559, - 558, 557, 556, 554, 553, 552, 551, 550, 548, 547, - 546, 544, 543, 542, 541, 540, 539, 536, 535, 534, - 532, 530, 528, 527, 526, 525, 524, 523, 522, 521, - 520, 519, 517, 669, 669, 669, 680, 680, 516, 680, - - 680, 680, 680, 515, 680, 680, 680, 680, 680, 514, - 680, 513, 512, 511, 509, 507, 506, 680, 680, 680, - 680, 680, 504, 503, 502, 501, 499, 498, 497, 496, - 494, 492, 490, 488, 487, 486, 485, 484, 483, 482, - 481, 480, 479, 478, 476, 475, 474, 472, 471, 470, - 469, 468, 467, 466, 465, 464, 463, 462, 460, 459, - 458, 456, 450, 449, 448, 447, 446, 445, 444, 443, - 442, 680, 680, 680, 916, 916, 916, 916, 916, 916, - 917, 917, 917, 917, 917, 917, 918, 918, 918, 918, - 919, 919, 919, 919, 921, 921, 922, 922, 922, 922, - - 922, 922, 923, 441, 923, 923, 924, 440, 924, 924, - 924, 924, 925, 439, 925, 925, 925, 925, 926, 926, - 926, 926, 927, 437, 927, 927, 927, 927, 928, 436, - 928, 928, 928, 928, 929, 435, 929, 929, 929, 929, - 930, 434, 930, 930, 930, 930, 432, 431, 430, 429, - 427, 426, 425, 423, 422, 421, 420, 419, 418, 417, - 416, 415, 414, 412, 411, 410, 409, 407, 405, 404, - 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, - 391, 390, 389, 388, 387, 386, 385, 384, 382, 381, - 380, 379, 378, 376, 375, 374, 373, 372, 371, 369, - - 368, 367, 366, 365, 364, 363, 361, 358, 357, 356, - 355, 354, 353, 352, 351, 350, 349, 348, 347, 344, - 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, - 332, 331, 328, 318, 315, 314, 311, 309, 308, 306, - 305, 304, 303, 301, 300, 299, 298, 296, 295, 294, - 293, 291, 290, 289, 288, 287, 285, 283, 276, 274, - 273, 272, 271, 270, 269, 268, 267, 265, 264, 263, - 260, 250, 249, 244, 239, 238, 237, 235, 234, 233, - 232, 231, 229, 228, 227, 226, 225, 224, 222, 221, - 220, 219, 218, 216, 215, 214, 213, 212, 211, 210, - - 208, 206, 205, 204, 202, 199, 195, 185, 181, 178, - 176, 175, 174, 165, 163, 162, 161, 153, 150, 148, - 146, 144, 143, 141, 132, 131, 128, 126, 120, 119, - 105, 101, 100, 99, 97, 96, 88, 84, 78, 77, - 71, 70, 62, 61, 60, 56, 54, 48, 47, 46, - 37, 33, 29, 27, 26, 20, 19, 13, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 915, 915, 915, 915, 915 + 11, 11, 11, 11, 11, 11, 11, 13, 13, 13, + 49, 71, 13, 14, 14, 14, 47, 48, 14, 47, + + 48, 81, 51, 61, 49, 51, 61, 61, 51, 87, + 89, 116, 47, 94, 94, 81, 96, 96, 61, 107, + 99, 89, 99, 61, 407, 858, 100, 99, 100, 107, + 99, 101, 48, 101, 101, 49, 100, 47, 99, 100, + 102, 101, 102, 51, 100, 130, 71, 859, 101, 101, + 102, 861, 87, 131, 132, 130, 133, 131, 102, 133, + 133, 131, 171, 13, 132, 407, 116, 134, 171, 14, + 15, 15, 15, 15, 15, 15, 15, 134, 15, 15, + 15, 15, 15, 15, 15, 15, 224, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 113, 126, 113, 120, + + 121, 120, 121, 168, 175, 136, 113, 300, 136, 136, + 166, 166, 223, 168, 113, 126, 300, 126, 126, 175, + 136, 166, 15, 15, 15, 136, 113, 170, 120, 121, + 120, 121, 224, 232, 167, 167, 503, 170, 120, 121, + 170, 167, 503, 223, 126, 167, 126, 15, 15, 15, + 15, 16, 16, 16, 16, 16, 16, 16, 862, 16, + 16, 16, 16, 16, 16, 16, 16, 123, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 232, 127, 169, + 179, 260, 180, 123, 260, 123, 123, 123, 863, 169, + 179, 169, 180, 188, 127, 242, 127, 127, 127, 123, + + 127, 169, 865, 16, 16, 16, 188, 323, 242, 240, + 179, 180, 240, 866, 123, 246, 123, 867, 246, 179, + 323, 253, 240, 253, 246, 127, 868, 127, 16, 16, + 16, 16, 17, 17, 17, 17, 17, 17, 17, 870, + 17, 17, 17, 17, 124, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 139, 140, 324, + 182, 181, 124, 281, 124, 281, 124, 324, 872, 124, + 182, 181, 313, 281, 313, 139, 140, 139, 140, 321, + 326, 281, 321, 326, 17, 17, 17, 875, 399, 326, + 181, 124, 321, 124, 17, 876, 139, 181, 17, 878, + + 332, 182, 332, 879, 139, 140, 139, 140, 182, 17, + 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, + 399, 18, 18, 18, 18, 880, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 282, 183, + 282, 354, 279, 355, 279, 881, 519, 356, 282, 183, + 122, 354, 519, 355, 882, 282, 282, 356, 824, 122, + 355, 122, 125, 824, 883, 18, 18, 18, 122, 122, + 122, 279, 884, 279, 125, 18, 374, 122, 892, 18, + 125, 183, 125, 217, 848, 217, 374, 893, 125, 848, + 18, 18, 18, 18, 27, 27, 894, 122, 283, 122, + + 283, 895, 27, 27, 27, 27, 27, 27, 283, 125, + 360, 125, 217, 288, 217, 288, 283, 896, 897, 376, + 360, 374, 217, 288, 898, 306, 899, 360, 900, 376, + 901, 288, 27, 27, 27, 27, 27, 27, 38, 38, + 902, 307, 310, 306, 903, 306, 38, 38, 38, 38, + 38, 38, 904, 292, 905, 292, 38, 292, 38, 307, + 310, 307, 310, 292, 376, 304, 338, 304, 310, 906, + 907, 292, 306, 908, 306, 304, 38, 38, 38, 38, + 38, 38, 306, 304, 338, 38, 338, 38, 307, 310, + 307, 310, 909, 910, 911, 38, 79, 79, 315, 912, + + 913, 914, 915, 917, 79, 79, 79, 79, 79, 79, + 304, 315, 311, 338, 361, 338, 315, 918, 315, 377, + 338, 919, 920, 311, 361, 499, 472, 499, 921, 377, + 311, 361, 311, 922, 79, 79, 79, 79, 79, 79, + 90, 90, 472, 923, 472, 315, 472, 315, 90, 90, + 90, 90, 90, 90, 499, 90, 499, 924, 90, 311, + 90, 311, 90, 925, 377, 926, 928, 929, 930, 933, + 934, 90, 935, 472, 448, 472, 448, 937, 90, 90, + 90, 90, 90, 90, 448, 90, 453, 90, 453, 90, + 448, 90, 448, 453, 938, 939, 453, 90, 98, 98, + + 940, 468, 941, 623, 453, 623, 98, 98, 98, 98, + 98, 98, 943, 98, 945, 946, 98, 98, 98, 468, + 98, 468, 947, 948, 949, 98, 468, 950, 951, 98, + 953, 954, 623, 955, 623, 956, 98, 98, 98, 98, + 98, 98, 957, 98, 959, 98, 960, 98, 468, 98, + 468, 961, 962, 963, 964, 98, 119, 119, 966, 967, + 972, 973, 974, 975, 119, 119, 119, 119, 119, 119, + 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, + 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, + 996, 997, 999, 1001, 119, 119, 119, 119, 119, 119, + + 143, 143, 1002, 1003, 1014, 856, 855, 854, 143, 143, + 143, 143, 143, 143, 851, 850, 845, 844, 843, 842, + 841, 840, 837, 836, 834, 833, 832, 829, 828, 827, + 822, 821, 819, 817, 816, 815, 813, 809, 143, 143, + 143, 143, 143, 143, 148, 148, 808, 807, 803, 802, + 801, 798, 148, 148, 148, 148, 148, 148, 797, 796, + 795, 794, 148, 792, 148, 789, 788, 787, 786, 785, + 784, 783, 782, 781, 779, 778, 777, 776, 775, 774, + 773, 770, 148, 148, 148, 148, 148, 148, 769, 768, + 767, 148, 766, 148, 152, 152, 765, 764, 761, 760, + + 758, 756, 152, 152, 152, 152, 152, 152, 755, 754, + 753, 752, 751, 749, 748, 746, 742, 741, 740, 738, + 737, 735, 731, 730, 729, 727, 726, 725, 724, 723, + 721, 720, 152, 152, 152, 152, 152, 152, 165, 165, + 718, 717, 716, 715, 714, 713, 165, 165, 165, 165, + 165, 165, 711, 165, 710, 707, 165, 165, 165, 706, + 165, 705, 704, 703, 702, 701, 700, 699, 698, 165, + 695, 692, 691, 690, 689, 688, 165, 165, 165, 165, + 165, 165, 687, 165, 686, 165, 685, 165, 683, 165, + 682, 681, 679, 678, 677, 165, 267, 267, 676, 675, + + 674, 673, 672, 671, 267, 267, 267, 267, 267, 267, + 669, 667, 663, 662, 267, 661, 267, 658, 657, 656, + 655, 654, 652, 651, 647, 646, 642, 641, 640, 639, + 638, 636, 635, 631, 267, 267, 267, 267, 267, 267, + 630, 626, 625, 267, 624, 267, 622, 621, 620, 619, + 618, 617, 616, 267, 348, 348, 614, 613, 612, 611, + 610, 609, 348, 348, 348, 348, 348, 348, 607, 606, + 605, 604, 348, 603, 348, 601, 600, 599, 597, 596, + 595, 594, 593, 592, 591, 589, 587, 586, 585, 583, + 581, 579, 348, 348, 348, 348, 348, 348, 578, 577, + + 576, 348, 575, 348, 574, 573, 572, 571, 570, 569, + 567, 348, 501, 501, 566, 565, 564, 563, 562, 561, + 501, 501, 501, 501, 501, 501, 560, 558, 556, 555, + 554, 552, 551, 550, 549, 547, 546, 545, 544, 542, + 540, 538, 536, 535, 534, 533, 532, 531, 530, 529, + 501, 501, 501, 501, 501, 501, 632, 632, 528, 632, + 632, 632, 632, 527, 632, 632, 632, 632, 632, 526, + 632, 525, 524, 522, 521, 520, 518, 632, 632, 632, + 632, 632, 517, 516, 515, 514, 513, 512, 511, 510, + 509, 508, 506, 505, 504, 502, 496, 495, 494, 493, + + 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, + 481, 480, 479, 478, 476, 475, 474, 473, 471, 470, + 469, 467, 466, 465, 464, 463, 462, 461, 460, 457, + 456, 455, 454, 632, 632, 632, 648, 648, 452, 648, + 648, 648, 648, 451, 648, 648, 648, 648, 648, 450, + 648, 449, 447, 445, 444, 441, 440, 648, 648, 648, + 648, 648, 439, 438, 437, 436, 435, 434, 433, 432, + 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, + 420, 419, 418, 417, 416, 415, 413, 412, 411, 410, + 409, 408, 406, 405, 404, 403, 402, 401, 400, 398, + + 395, 394, 390, 389, 388, 387, 386, 385, 384, 383, + 382, 381, 380, 648, 648, 648, 733, 733, 379, 733, + 733, 733, 733, 378, 733, 733, 733, 733, 733, 375, + 733, 373, 372, 371, 370, 369, 368, 733, 733, 733, + 733, 733, 367, 366, 365, 364, 363, 362, 359, 349, + 346, 345, 342, 340, 339, 337, 336, 335, 334, 333, + 331, 330, 329, 328, 327, 325, 322, 320, 319, 318, + 317, 316, 314, 312, 305, 303, 302, 301, 299, 298, + 297, 296, 295, 294, 293, 291, 290, 289, 286, 276, + 275, 268, 263, 733, 733, 733, 744, 744, 262, 744, + + 744, 744, 744, 261, 744, 744, 744, 744, 744, 259, + 744, 258, 257, 256, 255, 254, 252, 744, 744, 744, + 744, 744, 251, 250, 249, 248, 247, 245, 244, 243, + 241, 239, 238, 237, 236, 235, 234, 233, 231, 229, + 228, 227, 225, 222, 218, 208, 204, 202, 201, 191, + 189, 187, 186, 185, 176, 174, 173, 172, 163, 160, + 158, 156, 154, 153, 151, 142, 141, 138, 137, 135, + 129, 128, 114, 744, 744, 744, 1007, 1007, 1007, 1007, + 1007, 1007, 1007, 1007, 1007, 1008, 1008, 1008, 1008, 1008, + 1008, 1008, 1008, 1008, 1009, 1009, 1009, 1009, 1009, 1009, + + 1009, 1009, 1009, 1010, 1010, 1010, 1010, 1010, 1010, 1010, + 1010, 1010, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, + 1011, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1013, 110, + 1013, 1013, 1013, 1013, 1013, 1015, 109, 108, 105, 1015, + 1015, 1015, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, + 1016, 1017, 104, 1017, 103, 1017, 1017, 1017, 1018, 95, + 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1019, 91, 1019, + 1019, 1019, 1019, 1019, 1019, 1019, 1020, 85, 1020, 1020, + 1020, 1020, 1020, 1020, 1020, 1021, 1021, 1021, 1022, 84, + 78, 77, 1022, 1022, 1023, 69, 1023, 1023, 1023, 1023, + + 1023, 1024, 68, 1024, 1024, 1024, 1024, 1024, 1024, 1024, + 1025, 67, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1026, + 63, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1027, 62, + 1027, 1027, 1027, 1027, 1027, 1027, 1027, 60, 54, 53, + 52, 43, 39, 35, 33, 32, 26, 25, 19, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1006 } ; static yy_state_type yy_last_accepting_state; @@ -1048,7 +1147,7 @@ #define INITIAL 0 #line 2 "./ldlex.l" -/* Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -1137,6 +1236,9 @@ BOTH either EXPRESSION or SCRIPT DEFSYMEXP in an argument to -defsym MRI in an MRI script + VERS_START starting a Sun style mapfile + VERS_SCRIPT a Sun style mapfile + VERS_NODE a node within a Sun style mapfile */ #define RTOKEN(x) { yylval.token = x; return x; } @@ -1154,7 +1256,13 @@ #define MRI 5 -#line 1158 "lex.yy.c" +#define VERS_START 6 + +#define VERS_SCRIPT 7 + +#define VERS_NODE 8 + +#line 1266 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1301,7 +1409,7 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 120 "./ldlex.l" +#line 128 "./ldlex.l" if (parser_input != input_selected) @@ -1313,12 +1421,13 @@ { case input_script: return INPUT_SCRIPT; break; case input_mri_script: return INPUT_MRI_SCRIPT; break; + case input_version_script: return INPUT_VERSION_SCRIPT; break; case input_defsym: return INPUT_DEFSYM; break; default: abort (); } } -#line 1322 "lex.yy.c" +#line 1431 "lex.yy.c" if ( yy_init ) { @@ -1369,13 +1478,13 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 916 ) + if ( yy_current_state >= 1007 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 1659 ); + while ( yy_base[yy_current_state] != 1950 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1403,32 +1512,32 @@ case 1: YY_RULE_SETUP -#line 136 "./ldlex.l" +#line 145 "./ldlex.l" { comment(); } YY_BREAK case 2: YY_RULE_SETUP -#line 139 "./ldlex.l" +#line 148 "./ldlex.l" { RTOKEN('-');} YY_BREAK case 3: YY_RULE_SETUP -#line 140 "./ldlex.l" +#line 149 "./ldlex.l" { RTOKEN('+');} YY_BREAK case 4: YY_RULE_SETUP -#line 141 "./ldlex.l" +#line 150 "./ldlex.l" { yylval.name = buystring(yytext); return NAME; } YY_BREAK case 5: YY_RULE_SETUP -#line 142 "./ldlex.l" +#line 151 "./ldlex.l" { RTOKEN('='); } YY_BREAK case 6: YY_RULE_SETUP -#line 144 "./ldlex.l" +#line 153 "./ldlex.l" { yylval.integer = bfd_scan_vma (yytext+1, 0,16); return INT; @@ -1436,7 +1545,7 @@ YY_BREAK case 7: YY_RULE_SETUP -#line 149 "./ldlex.l" +#line 158 "./ldlex.l" { int ibase ; switch (yytext[yyleng-1]) { @@ -1464,7 +1573,7 @@ YY_BREAK case 8: YY_RULE_SETUP -#line 173 "./ldlex.l" +#line 182 "./ldlex.l" { yylval.integer = bfd_scan_vma (yytext, 0, hex_mode); @@ -1481,674 +1590,702 @@ YY_BREAK case 9: YY_RULE_SETUP -#line 186 "./ldlex.l" +#line 195 "./ldlex.l" { RTOKEN(']');} YY_BREAK case 10: YY_RULE_SETUP -#line 187 "./ldlex.l" +#line 196 "./ldlex.l" { RTOKEN('[');} YY_BREAK case 11: YY_RULE_SETUP -#line 188 "./ldlex.l" +#line 197 "./ldlex.l" { RTOKEN(LSHIFTEQ);} YY_BREAK case 12: YY_RULE_SETUP -#line 189 "./ldlex.l" +#line 198 "./ldlex.l" { RTOKEN(RSHIFTEQ);} YY_BREAK case 13: YY_RULE_SETUP -#line 190 "./ldlex.l" +#line 199 "./ldlex.l" { RTOKEN(OROR);} YY_BREAK case 14: YY_RULE_SETUP -#line 191 "./ldlex.l" +#line 200 "./ldlex.l" { RTOKEN(EQ);} YY_BREAK case 15: YY_RULE_SETUP -#line 192 "./ldlex.l" +#line 201 "./ldlex.l" { RTOKEN(NE);} YY_BREAK case 16: YY_RULE_SETUP -#line 193 "./ldlex.l" +#line 202 "./ldlex.l" { RTOKEN(GE);} YY_BREAK case 17: YY_RULE_SETUP -#line 194 "./ldlex.l" +#line 203 "./ldlex.l" { RTOKEN(LE);} YY_BREAK case 18: YY_RULE_SETUP -#line 195 "./ldlex.l" +#line 204 "./ldlex.l" { RTOKEN(LSHIFT);} YY_BREAK case 19: YY_RULE_SETUP -#line 196 "./ldlex.l" +#line 205 "./ldlex.l" { RTOKEN(RSHIFT);} YY_BREAK case 20: YY_RULE_SETUP -#line 197 "./ldlex.l" +#line 206 "./ldlex.l" { RTOKEN(PLUSEQ);} YY_BREAK case 21: YY_RULE_SETUP -#line 198 "./ldlex.l" +#line 207 "./ldlex.l" { RTOKEN(MINUSEQ);} YY_BREAK case 22: YY_RULE_SETUP -#line 199 "./ldlex.l" +#line 208 "./ldlex.l" { RTOKEN(MULTEQ);} YY_BREAK case 23: YY_RULE_SETUP -#line 200 "./ldlex.l" +#line 209 "./ldlex.l" { RTOKEN(DIVEQ);} YY_BREAK case 24: YY_RULE_SETUP -#line 201 "./ldlex.l" +#line 210 "./ldlex.l" { RTOKEN(ANDEQ);} YY_BREAK case 25: YY_RULE_SETUP -#line 202 "./ldlex.l" +#line 211 "./ldlex.l" { RTOKEN(OREQ);} YY_BREAK case 26: YY_RULE_SETUP -#line 203 "./ldlex.l" +#line 212 "./ldlex.l" { RTOKEN(ANDAND);} YY_BREAK case 27: YY_RULE_SETUP -#line 204 "./ldlex.l" +#line 213 "./ldlex.l" { RTOKEN('>');} YY_BREAK case 28: YY_RULE_SETUP -#line 205 "./ldlex.l" +#line 214 "./ldlex.l" { RTOKEN(',');} YY_BREAK case 29: YY_RULE_SETUP -#line 206 "./ldlex.l" +#line 215 "./ldlex.l" { RTOKEN('&');} YY_BREAK case 30: YY_RULE_SETUP -#line 207 "./ldlex.l" +#line 216 "./ldlex.l" { RTOKEN('|');} YY_BREAK case 31: YY_RULE_SETUP -#line 208 "./ldlex.l" +#line 217 "./ldlex.l" { RTOKEN('~');} YY_BREAK case 32: YY_RULE_SETUP -#line 209 "./ldlex.l" +#line 218 "./ldlex.l" { RTOKEN('!');} YY_BREAK case 33: YY_RULE_SETUP -#line 210 "./ldlex.l" +#line 219 "./ldlex.l" { RTOKEN('?');} YY_BREAK case 34: YY_RULE_SETUP -#line 211 "./ldlex.l" +#line 220 "./ldlex.l" { RTOKEN('*');} YY_BREAK case 35: YY_RULE_SETUP -#line 212 "./ldlex.l" +#line 221 "./ldlex.l" { RTOKEN('+');} YY_BREAK case 36: YY_RULE_SETUP -#line 213 "./ldlex.l" +#line 222 "./ldlex.l" { RTOKEN('-');} YY_BREAK case 37: YY_RULE_SETUP -#line 214 "./ldlex.l" +#line 223 "./ldlex.l" { RTOKEN('/');} YY_BREAK case 38: YY_RULE_SETUP -#line 215 "./ldlex.l" +#line 224 "./ldlex.l" { RTOKEN('%');} YY_BREAK case 39: YY_RULE_SETUP -#line 216 "./ldlex.l" +#line 225 "./ldlex.l" { RTOKEN('<');} YY_BREAK case 40: YY_RULE_SETUP -#line 217 "./ldlex.l" +#line 226 "./ldlex.l" { RTOKEN('=');} YY_BREAK case 41: YY_RULE_SETUP -#line 218 "./ldlex.l" +#line 227 "./ldlex.l" { RTOKEN('}') ; } YY_BREAK case 42: YY_RULE_SETUP -#line 219 "./ldlex.l" +#line 228 "./ldlex.l" { RTOKEN('{'); } YY_BREAK case 43: YY_RULE_SETUP -#line 220 "./ldlex.l" +#line 229 "./ldlex.l" { RTOKEN(')');} YY_BREAK case 44: YY_RULE_SETUP -#line 221 "./ldlex.l" +#line 230 "./ldlex.l" { RTOKEN('(');} YY_BREAK case 45: YY_RULE_SETUP -#line 222 "./ldlex.l" +#line 231 "./ldlex.l" { RTOKEN(':'); } YY_BREAK case 46: YY_RULE_SETUP -#line 223 "./ldlex.l" +#line 232 "./ldlex.l" { RTOKEN(';');} YY_BREAK case 47: YY_RULE_SETUP -#line 224 "./ldlex.l" +#line 233 "./ldlex.l" { RTOKEN(MEMORY);} YY_BREAK case 48: YY_RULE_SETUP -#line 225 "./ldlex.l" +#line 234 "./ldlex.l" { RTOKEN(ORIGIN);} YY_BREAK case 49: YY_RULE_SETUP -#line 226 "./ldlex.l" -{ RTOKEN(BLOCK);} +#line 235 "./ldlex.l" +{ RTOKEN(VERSION);} YY_BREAK case 50: YY_RULE_SETUP -#line 227 "./ldlex.l" -{ RTOKEN(BIND);} +#line 236 "./ldlex.l" +{ RTOKEN(BLOCK);} YY_BREAK case 51: YY_RULE_SETUP -#line 228 "./ldlex.l" -{ RTOKEN(LENGTH);} +#line 237 "./ldlex.l" +{ RTOKEN(BIND);} YY_BREAK case 52: YY_RULE_SETUP -#line 229 "./ldlex.l" -{ RTOKEN(ALIGN_K);} +#line 238 "./ldlex.l" +{ RTOKEN(LENGTH);} YY_BREAK case 53: YY_RULE_SETUP -#line 230 "./ldlex.l" -{ RTOKEN(ADDR);} +#line 239 "./ldlex.l" +{ RTOKEN(ALIGN_K);} YY_BREAK case 54: YY_RULE_SETUP -#line 231 "./ldlex.l" -{ RTOKEN(ENTRY);} +#line 240 "./ldlex.l" +{ RTOKEN(ADDR);} YY_BREAK case 55: YY_RULE_SETUP -#line 232 "./ldlex.l" -{ RTOKEN(NEXT);} +#line 241 "./ldlex.l" +{ RTOKEN(LOADADDR);} YY_BREAK case 56: YY_RULE_SETUP -#line 233 "./ldlex.l" -{ RTOKEN(SIZEOF_HEADERS);} +#line 242 "./ldlex.l" +{ RTOKEN(MAX); } YY_BREAK case 57: YY_RULE_SETUP -#line 234 "./ldlex.l" -{ RTOKEN(SIZEOF_HEADERS);} +#line 243 "./ldlex.l" +{ RTOKEN(MIN); } YY_BREAK case 58: YY_RULE_SETUP -#line 235 "./ldlex.l" -{ RTOKEN(MAP);} +#line 244 "./ldlex.l" +{ RTOKEN(ENTRY);} YY_BREAK case 59: YY_RULE_SETUP -#line 236 "./ldlex.l" -{ RTOKEN(SIZEOF);} +#line 245 "./ldlex.l" +{ RTOKEN(NEXT);} YY_BREAK case 60: YY_RULE_SETUP -#line 237 "./ldlex.l" -{ RTOKEN(TARGET_K);} +#line 246 "./ldlex.l" +{ RTOKEN(SIZEOF_HEADERS);} YY_BREAK case 61: YY_RULE_SETUP -#line 238 "./ldlex.l" -{ RTOKEN(SEARCH_DIR);} +#line 247 "./ldlex.l" +{ RTOKEN(SIZEOF_HEADERS);} YY_BREAK case 62: YY_RULE_SETUP -#line 239 "./ldlex.l" -{ RTOKEN(OUTPUT);} +#line 248 "./ldlex.l" +{ RTOKEN(MAP);} YY_BREAK case 63: YY_RULE_SETUP -#line 240 "./ldlex.l" -{ RTOKEN(INPUT);} +#line 249 "./ldlex.l" +{ RTOKEN(SIZEOF);} YY_BREAK case 64: YY_RULE_SETUP -#line 241 "./ldlex.l" -{ RTOKEN(GROUP);} +#line 250 "./ldlex.l" +{ RTOKEN(TARGET_K);} YY_BREAK case 65: YY_RULE_SETUP -#line 242 "./ldlex.l" -{ RTOKEN(DEFINED);} +#line 251 "./ldlex.l" +{ RTOKEN(SEARCH_DIR);} YY_BREAK case 66: YY_RULE_SETUP -#line 243 "./ldlex.l" -{ RTOKEN(CREATE_OBJECT_SYMBOLS);} +#line 252 "./ldlex.l" +{ RTOKEN(OUTPUT);} YY_BREAK case 67: YY_RULE_SETUP -#line 244 "./ldlex.l" -{ RTOKEN( CONSTRUCTORS);} +#line 253 "./ldlex.l" +{ RTOKEN(INPUT);} YY_BREAK case 68: YY_RULE_SETUP -#line 245 "./ldlex.l" -{ RTOKEN(FORCE_COMMON_ALLOCATION);} +#line 254 "./ldlex.l" +{ RTOKEN(GROUP);} YY_BREAK case 69: YY_RULE_SETUP -#line 246 "./ldlex.l" -{ RTOKEN(SECTIONS);} +#line 255 "./ldlex.l" +{ RTOKEN(DEFINED);} YY_BREAK case 70: YY_RULE_SETUP -#line 247 "./ldlex.l" -{ RTOKEN(FILL);} +#line 256 "./ldlex.l" +{ RTOKEN(CREATE_OBJECT_SYMBOLS);} YY_BREAK case 71: YY_RULE_SETUP -#line 248 "./ldlex.l" -{ RTOKEN(STARTUP);} +#line 257 "./ldlex.l" +{ RTOKEN( CONSTRUCTORS);} YY_BREAK case 72: YY_RULE_SETUP -#line 249 "./ldlex.l" -{ RTOKEN(OUTPUT_FORMAT);} +#line 258 "./ldlex.l" +{ RTOKEN(FORCE_COMMON_ALLOCATION);} YY_BREAK case 73: YY_RULE_SETUP -#line 250 "./ldlex.l" -{ RTOKEN( OUTPUT_ARCH);} +#line 259 "./ldlex.l" +{ RTOKEN(SECTIONS);} YY_BREAK case 74: YY_RULE_SETUP -#line 251 "./ldlex.l" -{ RTOKEN(HLL);} +#line 260 "./ldlex.l" +{ RTOKEN(FILL);} YY_BREAK case 75: YY_RULE_SETUP -#line 252 "./ldlex.l" -{ RTOKEN(SYSLIB);} +#line 261 "./ldlex.l" +{ RTOKEN(STARTUP);} YY_BREAK case 76: YY_RULE_SETUP -#line 253 "./ldlex.l" -{ RTOKEN(FLOAT);} +#line 262 "./ldlex.l" +{ RTOKEN(OUTPUT_FORMAT);} YY_BREAK case 77: YY_RULE_SETUP -#line 254 "./ldlex.l" -{ RTOKEN( QUAD);} +#line 263 "./ldlex.l" +{ RTOKEN( OUTPUT_ARCH);} YY_BREAK case 78: YY_RULE_SETUP -#line 255 "./ldlex.l" -{ RTOKEN( LONG);} +#line 264 "./ldlex.l" +{ RTOKEN(HLL);} YY_BREAK case 79: YY_RULE_SETUP -#line 256 "./ldlex.l" -{ RTOKEN( SHORT);} +#line 265 "./ldlex.l" +{ RTOKEN(SYSLIB);} YY_BREAK case 80: YY_RULE_SETUP -#line 257 "./ldlex.l" -{ RTOKEN( BYTE);} +#line 266 "./ldlex.l" +{ RTOKEN(FLOAT);} YY_BREAK case 81: YY_RULE_SETUP -#line 258 "./ldlex.l" -{ RTOKEN(NOFLOAT);} +#line 267 "./ldlex.l" +{ RTOKEN( QUAD);} YY_BREAK case 82: YY_RULE_SETUP -#line 259 "./ldlex.l" -{ RTOKEN(NOLOAD);} +#line 268 "./ldlex.l" +{ RTOKEN( LONG);} YY_BREAK case 83: YY_RULE_SETUP -#line 260 "./ldlex.l" -{ RTOKEN(DSECT);} +#line 269 "./ldlex.l" +{ RTOKEN( SHORT);} YY_BREAK case 84: YY_RULE_SETUP -#line 261 "./ldlex.l" -{ RTOKEN(COPY);} +#line 270 "./ldlex.l" +{ RTOKEN( BYTE);} YY_BREAK case 85: YY_RULE_SETUP -#line 262 "./ldlex.l" -{ RTOKEN(INFO);} +#line 271 "./ldlex.l" +{ RTOKEN(NOFLOAT);} YY_BREAK case 86: YY_RULE_SETUP -#line 263 "./ldlex.l" -{ RTOKEN(OVERLAY);} +#line 272 "./ldlex.l" +{ RTOKEN(NOCROSSREFS);} YY_BREAK case 87: YY_RULE_SETUP -#line 264 "./ldlex.l" -{ RTOKEN(ORIGIN);} +#line 273 "./ldlex.l" +{ RTOKEN(OVERLAY); } YY_BREAK case 88: YY_RULE_SETUP -#line 265 "./ldlex.l" -{ RTOKEN(ORIGIN);} +#line 274 "./ldlex.l" +{ RTOKEN(NOLOAD);} YY_BREAK case 89: YY_RULE_SETUP -#line 266 "./ldlex.l" -{ RTOKEN( LENGTH);} +#line 275 "./ldlex.l" +{ RTOKEN(DSECT);} YY_BREAK case 90: YY_RULE_SETUP -#line 267 "./ldlex.l" -{ RTOKEN( LENGTH);} +#line 276 "./ldlex.l" +{ RTOKEN(COPY);} YY_BREAK case 91: YY_RULE_SETUP -#line 268 "./ldlex.l" -{ RTOKEN(INCLUDE);} +#line 277 "./ldlex.l" +{ RTOKEN(INFO);} YY_BREAK case 92: YY_RULE_SETUP -#line 269 "./ldlex.l" -{ RTOKEN (PHDRS); } +#line 278 "./ldlex.l" +{ RTOKEN(OVERLAY);} YY_BREAK case 93: YY_RULE_SETUP -#line 270 "./ldlex.l" -{ RTOKEN(AT);} +#line 279 "./ldlex.l" +{ RTOKEN(ORIGIN);} YY_BREAK case 94: YY_RULE_SETUP -#line 271 "./ldlex.l" -{ RTOKEN(PROVIDE); } +#line 280 "./ldlex.l" +{ RTOKEN(ORIGIN);} YY_BREAK case 95: YY_RULE_SETUP -#line 272 "./ldlex.l" -{ ++ lineno; } +#line 281 "./ldlex.l" +{ RTOKEN( LENGTH);} YY_BREAK case 96: YY_RULE_SETUP -#line 273 "./ldlex.l" -{ ++ lineno; RTOKEN(NEWLINE); } +#line 282 "./ldlex.l" +{ RTOKEN( LENGTH);} YY_BREAK case 97: YY_RULE_SETUP -#line 274 "./ldlex.l" -{ ++ lineno; RTOKEN(NEWLINE); } +#line 283 "./ldlex.l" +{ RTOKEN(INCLUDE);} YY_BREAK case 98: YY_RULE_SETUP -#line 275 "./ldlex.l" -{ /* Mri comment line */ } +#line 284 "./ldlex.l" +{ RTOKEN (PHDRS); } YY_BREAK case 99: YY_RULE_SETUP -#line 276 "./ldlex.l" -{ /* Mri comment line */ } +#line 285 "./ldlex.l" +{ RTOKEN(AT);} YY_BREAK case 100: YY_RULE_SETUP -#line 277 "./ldlex.l" -{ RTOKEN(ENDWORD); } +#line 286 "./ldlex.l" +{ RTOKEN(PROVIDE); } YY_BREAK case 101: YY_RULE_SETUP -#line 278 "./ldlex.l" -{ RTOKEN(ALIGNMOD);} +#line 287 "./ldlex.l" +{ ++ lineno; } YY_BREAK case 102: YY_RULE_SETUP -#line 279 "./ldlex.l" -{ RTOKEN(ALIGN_K);} +#line 288 "./ldlex.l" +{ ++ lineno; RTOKEN(NEWLINE); } YY_BREAK case 103: YY_RULE_SETUP -#line 280 "./ldlex.l" -{ RTOKEN(CHIP); } +#line 289 "./ldlex.l" +{ ++ lineno; RTOKEN(NEWLINE); } YY_BREAK case 104: YY_RULE_SETUP -#line 281 "./ldlex.l" -{ RTOKEN(BASE); } +#line 290 "./ldlex.l" +{ /* Mri comment line */ } YY_BREAK case 105: YY_RULE_SETUP -#line 282 "./ldlex.l" -{ RTOKEN(ALIAS); } +#line 291 "./ldlex.l" +{ /* Mri comment line */ } YY_BREAK case 106: YY_RULE_SETUP -#line 283 "./ldlex.l" -{ RTOKEN(TRUNCATE); } +#line 292 "./ldlex.l" +{ RTOKEN(ENDWORD); } YY_BREAK case 107: YY_RULE_SETUP -#line 284 "./ldlex.l" -{ RTOKEN(LOAD); } +#line 293 "./ldlex.l" +{ RTOKEN(ALIGNMOD);} YY_BREAK case 108: YY_RULE_SETUP -#line 285 "./ldlex.l" -{ RTOKEN(PUBLIC); } +#line 294 "./ldlex.l" +{ RTOKEN(ALIGN_K);} YY_BREAK case 109: YY_RULE_SETUP -#line 286 "./ldlex.l" -{ RTOKEN(ORDER); } +#line 295 "./ldlex.l" +{ RTOKEN(CHIP); } YY_BREAK case 110: YY_RULE_SETUP -#line 287 "./ldlex.l" -{ RTOKEN(NAMEWORD); } +#line 296 "./ldlex.l" +{ RTOKEN(BASE); } YY_BREAK case 111: YY_RULE_SETUP -#line 288 "./ldlex.l" -{ RTOKEN(FORMAT); } +#line 297 "./ldlex.l" +{ RTOKEN(ALIAS); } YY_BREAK case 112: YY_RULE_SETUP -#line 289 "./ldlex.l" -{ RTOKEN(CASE); } +#line 298 "./ldlex.l" +{ RTOKEN(TRUNCATE); } YY_BREAK case 113: YY_RULE_SETUP -#line 290 "./ldlex.l" -{ RTOKEN(EXTERN); } +#line 299 "./ldlex.l" +{ RTOKEN(LOAD); } YY_BREAK case 114: YY_RULE_SETUP -#line 291 "./ldlex.l" -{ RTOKEN(START); } +#line 300 "./ldlex.l" +{ RTOKEN(PUBLIC); } YY_BREAK case 115: YY_RULE_SETUP -#line 292 "./ldlex.l" -{ RTOKEN(LIST); /* LIST and ignore to end of line */ } +#line 301 "./ldlex.l" +{ RTOKEN(ORDER); } YY_BREAK case 116: YY_RULE_SETUP -#line 293 "./ldlex.l" -{ RTOKEN(SECT); } +#line 302 "./ldlex.l" +{ RTOKEN(NAMEWORD); } YY_BREAK case 117: YY_RULE_SETUP -#line 294 "./ldlex.l" -{ RTOKEN(ABSOLUTE); } +#line 303 "./ldlex.l" +{ RTOKEN(FORMAT); } YY_BREAK case 118: YY_RULE_SETUP -#line 295 "./ldlex.l" -{ RTOKEN(ENDWORD); } +#line 304 "./ldlex.l" +{ RTOKEN(CASE); } YY_BREAK case 119: YY_RULE_SETUP -#line 296 "./ldlex.l" -{ RTOKEN(ALIGNMOD);} +#line 305 "./ldlex.l" +{ RTOKEN(EXTERN); } YY_BREAK case 120: YY_RULE_SETUP -#line 297 "./ldlex.l" -{ RTOKEN(ALIGN_K);} +#line 306 "./ldlex.l" +{ RTOKEN(START); } YY_BREAK case 121: YY_RULE_SETUP -#line 298 "./ldlex.l" -{ RTOKEN(CHIP); } +#line 307 "./ldlex.l" +{ RTOKEN(LIST); /* LIST and ignore to end of line */ } YY_BREAK case 122: YY_RULE_SETUP -#line 299 "./ldlex.l" -{ RTOKEN(BASE); } +#line 308 "./ldlex.l" +{ RTOKEN(SECT); } YY_BREAK case 123: YY_RULE_SETUP -#line 300 "./ldlex.l" -{ RTOKEN(ALIAS); } +#line 309 "./ldlex.l" +{ RTOKEN(ABSOLUTE); } YY_BREAK case 124: YY_RULE_SETUP -#line 301 "./ldlex.l" -{ RTOKEN(TRUNCATE); } +#line 310 "./ldlex.l" +{ RTOKEN(ENDWORD); } YY_BREAK case 125: YY_RULE_SETUP -#line 302 "./ldlex.l" -{ RTOKEN(LOAD); } +#line 311 "./ldlex.l" +{ RTOKEN(ALIGNMOD);} YY_BREAK case 126: YY_RULE_SETUP -#line 303 "./ldlex.l" -{ RTOKEN(PUBLIC); } +#line 312 "./ldlex.l" +{ RTOKEN(ALIGN_K);} YY_BREAK case 127: YY_RULE_SETUP -#line 304 "./ldlex.l" -{ RTOKEN(ORDER); } +#line 313 "./ldlex.l" +{ RTOKEN(CHIP); } YY_BREAK case 128: YY_RULE_SETUP -#line 305 "./ldlex.l" -{ RTOKEN(NAMEWORD); } +#line 314 "./ldlex.l" +{ RTOKEN(BASE); } YY_BREAK case 129: YY_RULE_SETUP -#line 306 "./ldlex.l" -{ RTOKEN(FORMAT); } +#line 315 "./ldlex.l" +{ RTOKEN(ALIAS); } YY_BREAK case 130: YY_RULE_SETUP -#line 307 "./ldlex.l" -{ RTOKEN(CASE); } +#line 316 "./ldlex.l" +{ RTOKEN(TRUNCATE); } YY_BREAK case 131: YY_RULE_SETUP -#line 308 "./ldlex.l" -{ RTOKEN(EXTERN); } +#line 317 "./ldlex.l" +{ RTOKEN(LOAD); } YY_BREAK case 132: YY_RULE_SETUP -#line 309 "./ldlex.l" -{ RTOKEN(START); } +#line 318 "./ldlex.l" +{ RTOKEN(PUBLIC); } YY_BREAK case 133: YY_RULE_SETUP -#line 310 "./ldlex.l" -{ RTOKEN(LIST); /* LIST and ignore to end of line */ } +#line 319 "./ldlex.l" +{ RTOKEN(ORDER); } YY_BREAK case 134: YY_RULE_SETUP -#line 311 "./ldlex.l" -{ RTOKEN(SECT); } +#line 320 "./ldlex.l" +{ RTOKEN(NAMEWORD); } YY_BREAK case 135: YY_RULE_SETUP -#line 312 "./ldlex.l" -{ RTOKEN(ABSOLUTE); } +#line 321 "./ldlex.l" +{ RTOKEN(FORMAT); } YY_BREAK case 136: YY_RULE_SETUP -#line 314 "./ldlex.l" +#line 322 "./ldlex.l" +{ RTOKEN(CASE); } + YY_BREAK +case 137: +YY_RULE_SETUP +#line 323 "./ldlex.l" +{ RTOKEN(EXTERN); } + YY_BREAK +case 138: +YY_RULE_SETUP +#line 324 "./ldlex.l" +{ RTOKEN(START); } + YY_BREAK +case 139: +YY_RULE_SETUP +#line 325 "./ldlex.l" +{ RTOKEN(LIST); /* LIST and ignore to end of line */ } + YY_BREAK +case 140: +YY_RULE_SETUP +#line 326 "./ldlex.l" +{ RTOKEN(SECT); } + YY_BREAK +case 141: +YY_RULE_SETUP +#line 327 "./ldlex.l" +{ RTOKEN(ABSOLUTE); } + YY_BREAK +case 142: +YY_RULE_SETUP +#line 329 "./ldlex.l" { /* Filename without commas, needed to parse mri stuff */ yylval.name = buystring(yytext); return NAME; } YY_BREAK -case 137: +case 143: YY_RULE_SETUP -#line 321 "./ldlex.l" +#line 336 "./ldlex.l" { yylval.name = buystring(yytext); return NAME; } YY_BREAK -case 138: +case 144: YY_RULE_SETUP -#line 325 "./ldlex.l" +#line 340 "./ldlex.l" { yylval.name = buystring (yytext + 2); return LNAME; } YY_BREAK -case 139: +case 145: YY_RULE_SETUP -#line 329 "./ldlex.l" -{ yylval.name = buystring(yytext); - return NAME; - } +#line 344 "./ldlex.l" +{ yylval.name = buystring(yytext); return NAME; } YY_BREAK -case 140: +case 146: YY_RULE_SETUP -#line 333 "./ldlex.l" +#line 346 "./ldlex.l" { /* No matter the state, quotes give what's inside */ @@ -2157,28 +2294,88 @@ return NAME; } YY_BREAK -case 141: +case 147: YY_RULE_SETUP -#line 340 "./ldlex.l" +#line 353 "./ldlex.l" { lineno++;} YY_BREAK -case 142: +case 148: YY_RULE_SETUP -#line 341 "./ldlex.l" +#line 354 "./ldlex.l" { lineno++;} YY_BREAK -case 143: +case 149: YY_RULE_SETUP -#line 342 "./ldlex.l" +#line 355 "./ldlex.l" YY_BREAK +case 150: +YY_RULE_SETUP +#line 357 "./ldlex.l" +{ return *yytext; } + YY_BREAK +case 151: +YY_RULE_SETUP +#line 359 "./ldlex.l" +{ RTOKEN(GLOBAL); } + YY_BREAK +case 152: +YY_RULE_SETUP +#line 361 "./ldlex.l" +{ RTOKEN(LOCAL); } + YY_BREAK +case 153: +YY_RULE_SETUP +#line 363 "./ldlex.l" +{ yylval.name = buystring (yytext); + return VERS_IDENTIFIER; } + YY_BREAK +case 154: +YY_RULE_SETUP +#line 366 "./ldlex.l" +{ yylval.name = buystring (yytext); + return VERS_TAG; } + YY_BREAK +case 155: +YY_RULE_SETUP +#line 369 "./ldlex.l" +{ BEGIN(VERS_SCRIPT); return *yytext; } + YY_BREAK +case 156: +YY_RULE_SETUP +#line 371 "./ldlex.l" +{ BEGIN(VERS_NODE); return *yytext; } + YY_BREAK +case 157: +YY_RULE_SETUP +#line 372 "./ldlex.l" +{ BEGIN(VERS_SCRIPT); return *yytext; } + YY_BREAK +case 158: +YY_RULE_SETUP +#line 374 "./ldlex.l" +{ lineno++; } + YY_BREAK +case 159: +YY_RULE_SETUP +#line 376 "./ldlex.l" +{ /* Eat up comments */ } + YY_BREAK +case 160: +YY_RULE_SETUP +#line 378 "./ldlex.l" +{ /* Eat up whitespace */ } + YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(SCRIPT): case YY_STATE_EOF(EXPRESSION): case YY_STATE_EOF(BOTH): case YY_STATE_EOF(DEFSYMEXP): case YY_STATE_EOF(MRI): -#line 344 "./ldlex.l" +case YY_STATE_EOF(VERS_START): +case YY_STATE_EOF(VERS_SCRIPT): +case YY_STATE_EOF(VERS_NODE): +#line 380 "./ldlex.l" { include_stack_ptr--; @@ -2198,22 +2395,22 @@ return END; } YY_BREAK -case 144: +case 161: YY_RULE_SETUP -#line 363 "./ldlex.l" +#line 399 "./ldlex.l" lex_warn_invalid(" in script", yytext); YY_BREAK -case 145: +case 162: YY_RULE_SETUP -#line 364 "./ldlex.l" +#line 400 "./ldlex.l" lex_warn_invalid(" in expression", yytext); YY_BREAK -case 146: +case 163: YY_RULE_SETUP -#line 366 "./ldlex.l" +#line 402 "./ldlex.l" ECHO; YY_BREAK -#line 2217 "lex.yy.c" +#line 2414 "lex.yy.c" case YY_END_OF_BUFFER: { @@ -2500,7 +2697,7 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 916 ) + if ( yy_current_state >= 1007 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2535,11 +2732,11 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 916 ) + if ( yy_current_state >= 1007 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 915); + yy_is_jam = (yy_current_state == 1006); return yy_is_jam ? 0 : yy_current_state; } @@ -3071,7 +3268,7 @@ return 0; } #endif -#line 366 "./ldlex.l" +#line 402 "./ldlex.l" @@ -3175,6 +3372,20 @@ { *(state_stack_p)++ = yy_start; BEGIN (MRI); +} + +void +ldlex_version_script () +{ + *(state_stack_p)++ = yy_start; + BEGIN (VERS_START); +} + +void +ldlex_version_file () +{ + *(state_stack_p)++ = yy_start; + BEGIN (VERS_SCRIPT); } void diff -urN binutils-2.7/ld/ldlex.h binutils-2.8/ld/ldlex.h --- binutils-2.7/ld/ldlex.h Thu Jul 4 12:24:38 1996 +++ binutils-2.8/ld/ldlex.h Wed Apr 30 12:57:52 1997 @@ -1,5 +1,5 @@ /* ldlex.h - - Copyright 1991, 1992 Free Software Foundation, Inc. + Copyright 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -27,6 +27,7 @@ input_selected, /* We've set the initial state. */ input_script, input_mri_script, + input_version_script, input_defsym } input_type; @@ -42,6 +43,8 @@ extern void lex_redirect PARAMS ((const char *)); extern void ldlex_script PARAMS ((void)); extern void ldlex_mri_script PARAMS ((void)); +extern void ldlex_version_script PARAMS ((void)); +extern void ldlex_version_file PARAMS ((void)); extern void ldlex_defsym PARAMS ((void)); extern void ldlex_expression PARAMS ((void)); extern void ldlex_both PARAMS ((void)); diff -urN binutils-2.7/ld/ldlex.l binutils-2.8/ld/ldlex.l --- binutils-2.7/ld/ldlex.l Thu Jul 4 12:24:38 1996 +++ binutils-2.8/ld/ldlex.l Wed Apr 30 12:57:52 1997 @@ -1,6 +1,6 @@ %{ -/* Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -89,6 +89,9 @@ BOTH either EXPRESSION or SCRIPT DEFSYMEXP in an argument to -defsym MRI in an MRI script + VERS_START starting a Sun style mapfile + VERS_SCRIPT a Sun style mapfile + VERS_NODE a node within a Sun style mapfile */ #define RTOKEN(x) { yylval.token = x; return x; } @@ -104,19 +107,24 @@ CMDFILENAMECHAR [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\-\~] CMDFILENAMECHAR1 [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\~] FILENAMECHAR1 [_a-zA-Z\/\.\\\$\_\~] -SYMBOLCHARN [_a-zA-Z\/\.\\0-9] +SYMBOLCHARN [_a-zA-Z\/\.\\\$\_\~0-9] FILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~] -FILENAME {FILENAMECHAR}+ +WILDCHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~\?\*] WHITE [ \t\n\r]+ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] +V_TAG [.$_a-zA-Z][._a-zA-Z0-9]* +V_IDENTIFIER [*?$_a-zA-Z][*?_a-zA-Z0-9]* %s SCRIPT %s EXPRESSION %s BOTH %s DEFSYMEXP %s MRI +%s VERS_START +%s VERS_SCRIPT +%s VERS_NODE %% if (parser_input != input_selected) @@ -128,6 +136,7 @@ { case input_script: return INPUT_SCRIPT; break; case input_mri_script: return INPUT_MRI_SCRIPT; break; + case input_version_script: return INPUT_VERSION_SCRIPT; break; case input_defsym: return INPUT_DEFSYM; break; default: abort (); } @@ -223,11 +232,15 @@ ";" { RTOKEN(';');} "MEMORY" { RTOKEN(MEMORY);} "ORIGIN" { RTOKEN(ORIGIN);} +"VERSION" { RTOKEN(VERSION);} "BLOCK" { RTOKEN(BLOCK);} "BIND" { RTOKEN(BIND);} "LENGTH" { RTOKEN(LENGTH);} "ALIGN" { RTOKEN(ALIGN_K);} "ADDR" { RTOKEN(ADDR);} +"LOADADDR" { RTOKEN(LOADADDR);} +"MAX" { RTOKEN(MAX); } +"MIN" { RTOKEN(MIN); } "ENTRY" { RTOKEN(ENTRY);} "NEXT" { RTOKEN(NEXT);} "sizeof_headers" { RTOKEN(SIZEOF_HEADERS);} @@ -256,6 +269,8 @@ "SHORT" { RTOKEN( SHORT);} "BYTE" { RTOKEN( BYTE);} "NOFLOAT" { RTOKEN(NOFLOAT);} +"NOCROSSREFS" { RTOKEN(NOCROSSREFS);} +"OVERLAY" { RTOKEN(OVERLAY); } "NOLOAD" { RTOKEN(NOLOAD);} "DSECT" { RTOKEN(DSECT);} "COPY" { RTOKEN(COPY);} @@ -326,9 +341,7 @@ yylval.name = buystring (yytext + 2); return LNAME; } -