diff options
Diffstat (limited to 'gas')
39 files changed, 0 insertions, 16049 deletions
diff --git a/gas/GNUmakefile-host b/gas/GNUmakefile-host deleted file mode 100755 index 386c869..0000000 --- a/gas/GNUmakefile-host +++ /dev/null @@ -1,6 +0,0 @@ -ALL := $(shell ls -d =*) - -%: - $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) $@ &&) true - -gas: diff --git a/gas/Makefile-intel b/gas/Makefile-intel deleted file mode 100755 index 54487c2..0000000 --- a/gas/Makefile-intel +++ /dev/null @@ -1,146 +0,0 @@ -#----------------------------------------------------------------------------- -# Makefile for gas960 -# -# $Id$ -#----------------------------------------------------------------------------- - -# The following two lines should be uncommented for system V (i386v). -#__i386v__#USG = -DUSG -#__i386v__#LIBS = -lmalloc -lPW - -# The following two lines should be uncommented for HP-UX -#__hp9000__#USG = -DUSG - -# The following line should be uncommented for Macintosh A/UX. -#__mac-aux__#USG = -DUSG - -#Always build with static libraries on Sun systems -#__sun3__#LDFLAGS = -Bstatic -#__sun386i__#LDFLAGS = -Bstatic -#__sun4__#LDFLAGS = -Bstatic - -# Essential under System V, harmless elsewhere -SHELL = /bin/sh - -TARG = gas960 -OPT = -g -IPATH = ../../include -CFLAGS = ${OPT} ${USG} -DI80960 -I${IPATH} - - -OBJS = app.o append.o as.o atof-generic.o bignum-copy.o expr.o \ - flonum-const.o flonum-copy.o flonum-mult.o frags.o gdb-blocks.o \ - gdb-file.o gdb-lines.o gdb-symbols.o gdb.o hash.o hex-value.o \ - input-file.o input-scrub.o messages.o obstack.o output-file.o read.o \ - strstr.o subsegs.o symbols.o version.o write.o xmalloc.o xrealloc.o - -# Note that we use the 386 floating-point support for the i80960 -I960OBJ = i960.o i960-opcode.o atof-i386.o - -gas960: ${OBJS} ${I960OBJ} VERSION - make ver960.o - ${CC} -o gas960 ${LDFLAGS} ${OBJS} ${I960OBJ} ver960.o ${LIBS} - -hash.o: hash.c - ${CC} -c ${CFLAGS} -Derror=as_fatal hash.c - -xmalloc.o: xmalloc.c - ${CC} -c ${CFLAGS} -Derror=as_fatal xmalloc.c - -xrealloc.o: xrealloc.c - ${CC} -c ${CFLAGS} -Derror=as_fatal xrealloc.c - -app.o: as.h - -as.o: ${IPATH}/b.out.h as.h read.h struc-symbol.h write.h -atof-generic.o: flonum.h -bignum-copy.o: bignum.h -expr.o: ${IPATH}/b.out.h as.h expr.h flonum.h obstack.h read.h -expr.o: struc-symbol.h symbols.h -flonum-const.o: flonum.h -flonum-copy.o: flonum.h -flonum-mult.o: flonum.h -flonum-normal.o:flonum.h -flonum-print.o: flonum.h -frags.o: ${IPATH}/b.out.h as.h frags.h obstack.h struc-symbol.h subsegs.h -gdb.o: as.h -gdb-blocks.o: as.h -gdb-lines.o: as.h frags.h obstack.h -gdb-symbols.o: ${IPATH}/b.out.h as.h struc-symbol.h -hash.o: hash.h -i960.o: as.h ${IPATH}/b.out.h expr.h flonum.h frags.h hash.h -i960.o: i960-opcode.h md.h obstack.h struc-symbol.h write.h -i960-opcode.o: i960-opcode.h -input-file.o: input-file.h -input-scrub.o: as.h input-file.h read.h -messages.o: as.h -obstack.o: obstack.h -read.o: ${IPATH}/b.out.h as.h expr.h flonum.h frags.h hash.h md.h -read.o: obstack.h read.h struc-symbol.h symbols.h -subsegs.o: ${IPATH}/b.out.h as.h frags.h obstack.h struc-symbol.h subsegs.h -subsegs.o: write.h -symbols.o: ${IPATH}/b.out.h as.h frags.h hash.h obstack.h struc-symbol.h -symbols.o: symbols.h -write.o: ${IPATH}/b.out.h as.h md.h obstack.h struc-symbol.h subsegs.h -write.o: symbols.h write.h - -flonum.h: bignum.h - -#----------------------------------------------------------------------------- -# 'STANDARD' GNU/960 TARGETS BELOW THIS POINT -# -# 'VERSION' file must be present and contain a string of the form "x.y" -#----------------------------------------------------------------------------- - -ver960.c: FORCE - rm -f ver960.c - echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c - - -# This target should be invoked before building a new release. -# 'VERSION' file must be present and contain a string of the form "x.y" -# -roll: - @V=`cat VERSION` ; \ - MAJ=`sed 's/\..*//' VERSION` ; \ - MIN=`sed 's/.*\.//' VERSION` ; \ - V=$$MAJ.`expr $$MIN + 1` ; \ - rm -f VERSION ; \ - echo $$V >VERSION ; \ - echo Version $$V - -# Dummy target to force execution of dependent targets. -# -FORCE: - -# 'G960BASE' will be defined at invocation -install: - make ${TARG} OPT=-O - strip ${TARG} - rm -f ${G960BASE}/bin/${TARG} - mv ${TARG} ${G960BASE}/bin/${TARG} - -clean: - rm -f ${TARG} *.o core - -# Target to uncomment host-specific lines in this makefile. Such lines must -# have the following string beginning in column 1: #__<hostname>__# -# Original Makefile is backed up as 'Makefile.old'. -# -# Invoke with: make make HOST=xxx -# -make: - -@if test $(HOST)x = x ; then \ - echo 'Specify "make make HOST=???"'; \ - exit 1; \ - fi ; \ - grep -s "^#The next line was generated by 'make make'" Makefile; \ - if test $$? = 0 ; then \ - echo "Makefile has already been processed with 'make make'";\ - exit 1; \ - fi ; \ - mv -f Makefile Makefile.old; \ - echo "#The next line was generated by 'make make'" >Makefile ; \ - echo "HOST=$(HOST)" >>Makefile ; \ - echo >>Makefile ; \ - sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile diff --git a/gas/Makefile.generic b/gas/Makefile.generic deleted file mode 100755 index 1bf57a3..0000000 --- a/gas/Makefile.generic +++ /dev/null @@ -1,586 +0,0 @@ -host = generic -target = generic -# Makefile for GNU Assembler -# Copyright (C) 1987, 1988, 1990, 1991 Free Software Foundation, Inc. - -#This file is part of GNU GAS. - -#GNU GAS is free software; you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation; either version 1, or (at your option) -#any later version. - -#GNU 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 GNU GAS; see the file COPYING. If not, write to -#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - -# $Id$ - -# The targets for external use include: -# all, doc, proto, install, uninstall, includes, TAGS, -# clean, cleanconfig, realclean, stage1, stage2, stage3, stage4. - -# Variables that exist for you to override. -# See below for how to change them for certain systems. - -ALLOCA = -CFLAGS = -g $(XCFLAGS) # -I$(srcdir)/../include -INTERNAL_CFLAGS = $(CROSS) -OLDCC = cc -BISON = bison -BISONFLAGS = -v -AR = ar -OLDAR_FLAGS = qc -AR_FLAGS = rc -SHELL = /bin/sh -# on sysV, define this as cp. -INSTALL = install -c -# These permit overriding just for certain files. -INSTALL_PROGRAM = $(INSTALL) -INSTALL_FILE = $(INSTALL) - -# Define this as & to perform parallel make on a Sequent. -# Note that this has some bugs, and it seems currently necessary -# to compile all the gen* files first by hand to avoid erroneous results. -P = - -# How to invoke ranlib. -RANLIB = ranlib -# Test to use to see whether ranlib exists on the system. -RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ] - -# CFLAGS for use with OLDCC, for compiling gnulib. -# NOTE: -O does not work on some Unix systems! -CCLIBFLAGS = -O - -# Version of ar to use when compiling gnulib. -OLDAR = ar - -version=`./gcc -dumpversion` - -# Directory where sources are, from where we are. -srcdir = . -# Common prefix for installation directories. -# NOTE: This directory must exist when you start installation. -prefix = /usr/local -# Directory in which to put the executable for the command `gcc' -bindir = $(prefix)/bin -# Directory in which to put the directories used by the compiler. -libdir = $(prefix)/lib -# Directory in which the compiler finds executables, libraries, etc. -libsubdir = $(libdir)/gcc/$(target)/$(version) -# Number to put in man-page filename. -manext = 1 -# Directory in which to put man pages. -mandir = $(prefix)/man/man$(manext) - -# Additional system libraries to link with. -CLIB= - -# Change this to a null string if obstacks are installed in the -# system library. -OBSTACK=obstack.o - -# Specify the rule for actually making gnulib. -GNULIB = gnulib.portable - -# Specify the rule for actually making gnulib2. -GNULIB2 = gnulib2.portable - -# List of extra C and assembler files to add to gnulib. -# Assembler files should have names ending in `.asm'. -LIBFUNCS_EXTRA = - -# Program to convert libraries. -LIBCONVERT = - -# Control whether header files are installed. -INSTALL_HEADERS=install-headers - -# Change this to empty to prevent installing limits.h -LIMITS_H = limits.h - -# Directory to link to, when using the target `maketest'. -DIR = ../gcc - -# For better debugging under COFF, define SEPARATE_AUX_OUTPUT in config.h -# and define the following variable as `aux-output2.c' in make-... -AUX_OUTPUT2 = - -# Flags to use when cross-building GCC. -# Prefix to apply to names of object files when using them -# to run on the machine we are compiling on. -HOST_PREFIX= -# Prefix to apply to names of object files when compiling them -# to run on the machine we are compiling on. -# The default for this variable is chosen to keep these rules -# out of the way of the other rules for compiling the same source files. -HOST_PREFIX_1=loser- -HOST_CC=$(CC) -HOST_CFLAGS=$(ALL_CFLAGS) -HOST_LDFLAGS=$(LDFLAGS) -HOST_CPPFLAGS=$(CPPFLAGS) - -# Choose the real default target. -ALL=bootstrap - -# End of variables for you to override. - -# 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-const.c \ - $(srcdir)/flonum-copy.c \ - $(srcdir)/flonum-mult.c \ - $(srcdir)/frags.c \ - $(srcdir)/hash.c \ - $(srcdir)/hex-value.c \ - $(srcdir)/input-file.c \ - $(srcdir)/input-scrub.c \ - $(srcdir)/messages.c \ - $(srcdir)/output-file.c \ - $(srcdir)/read.c \ - $(srcdir)/strstr.c \ - $(srcdir)/subsegs.c \ - $(srcdir)/symbols.c \ - $(srcdir)/version.c \ - $(srcdir)/write.c \ - $(srcdir)/xmalloc.c \ - $(srcdir)/xrealloc.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)/tc.h \ - $(srcdir)/obj.h \ - $(srcdir)/read.h \ - $(srcdir)/reloc.h \ - $(srcdir)/struc-symbol.h \ - $(srcdir)/subsegs.h \ - $(srcdir)/symbols.h \ - $(srcdir)/syscalls.h \ - $(srcdir)/write.h - -LINKED_HEADERS = \ - a.out.gnu.h \ - a.out.h \ - host.h \ - targ-env.h \ - targ-cpu.h \ - obj-format.h \ - atof-targ.h - -HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS) - -OBJS = \ - targ-cpu.o \ - obj-format.o \ - atof-targ.o \ - app.o \ - as.o \ - atof-generic.o \ - bignum-copy.o \ - cond.o \ - expr.o \ - flonum-const.o \ - flonum-copy.o \ - flonum-mult.o \ - frags.o \ - hash.o \ - hex-value.o \ - input-file.o \ - input-scrub.o \ - messages.o \ - output-file.o \ - read.o \ - strstr.o \ - subsegs.o \ - symbols.o \ - version.o \ - write.o \ - xmalloc.o \ - xrealloc.o - -# Definition of `all' is here so that new rules inserted by sed -# do not specify the default target. -# The real definition is under `all.internal'. - -all: $(ALL) - -# sed inserts variable overrides after the following line. -#### - -# Now figure out from those variables how to compile and link. - -# This is the variable actually used when we compile. -ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CFLAGS) - -# Even if ALLOCA is set, don't use it if compiling with GCC. -USE_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${ALLOCA}; else true; fi` -USE_HOST_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${HOST_PREFIX}${ALLOCA}; else true; fi` - -# Dependency on obstack, alloca, malloc or whatever library facilities -# are not installed in the system libraries. -# We don't use USE_ALLOCA because backquote expansion doesn't work in deps. -LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC) - -# Likewise, for use in the tools that must run on this machine -# even if we are cross-building GCC. -# We don't use USE_ALLOCA because backquote expansion doesn't work in deps. -HOST_LIBDEPS= $(HOST_PREFIX)$(OBSTACK) $(HOST_PREFIX)$(ALLOCA) $(HOST_PREFIX)$(MALLOC) - -# How to link with both our special library facilities -# and the system's installed libraries. -LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(CLIB) - -# Likewise, for use in the tools that must run on this machine -# even if we are cross-building GCC. -HOST_LIBS = $(HOST_PREFIX)$(OBSTACK) $(USE_HOST_ALLOCA) $(HOST_PREFIX)$(MALLOC) $(CLIB) - -# 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$(srcdir)/config -SUBDIR_INCLUDES = -I.. -I../$(srcdir) -I../$(srcdir)/config - -# Always use -I$(srcdir)/config when compiling. -.c.o: - $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $< - -# This tells GNU make version 3 not to export all the variables -# defined in this file into the environment. -.NOEXPORT: - -# Files to be copied away after each stage in building. -STAGE_GCC=gcc -STAGESTUFF = *.o gas - -# The files that "belong" in CONFIG_H are deliberately omitted -# because having them there would not be useful in actual practice. -# All they would do is cause complete recompilation every time -# one of the machine description files is edited. -# That may or may not be what one wants to do. -# If it is, rm *.o is an easy way to do it. -# CONFIG_H = config.h tm.h -CONFIG_H = - -gas: $(OBJS) $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gas $(OBJS) $(LIBS) - -all.internal: native -# This is what is made with the host's compiler if making a cross assembler. -native: config.status gas - -config.status: - @echo You must configure gas. Look at the INSTALL file for details. - @false - -compilations: ${OBJS} - -# Compiling object files from source files. - -# Note that dependencies on obstack.h are not written -# because that file is not part of GAS. - -app.o : app.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -as.o : as.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -atof-generic.o : atof-generic.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -bignum-copy.o : bignum-copy.c as.h host.h \ - targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -cond.o : cond.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - obstack.h -debug.o : debug.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - subsegs.h -expr.o : expr.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - obstack.h -flonum-const.o : flonum-const.c flonum.h bignum.h -flonum-copy.o : flonum-copy.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -flonum-mult.o : flonum-mult.c flonum.h bignum.h -frags.o : frags.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - subsegs.h obstack.h -hash.o : hash.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -hex-value.o : hex-value.c -input-file.o : input-file.c as.h host.h \ - targ-env.h obj-format.h targ-cpu.h \ - struc-symbol.h reloc.h write.h flonum.h bignum.h expr.h \ - frags.h hash.h read.h symbols.h tc.h obj.h input-file.h -input-scrub.o : input-scrub.c /usr/include/errno.h /usr/include/sys/errno.h \ - as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - input-file.h -messages.o : messages.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -obstack.o : obstack.c obstack.h -output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - output-file.h -read.o : read.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - obstack.h -strstr.o : strstr.c -subsegs.o : subsegs.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - subsegs.h obstack.h -symbols.o : symbols.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - obstack.h subsegs.h -version.o : version.c -write.o : write.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - subsegs.h obstack.h output-file.h -xmalloc.o : xmalloc.c -xrealloc.o : xrealloc.c -atof-targ.o : atof-targ.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h \ - symbols.h tc.h obj.h -obj-format.o : obj-format.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h \ - symbols.h tc.h obj.h obstack.h -targ-cpu.o : targ-cpu.c targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h reloc.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h \ - symbols.h tc.h obj.h obstack.h - -# Normally this target is not used; but it is used if you -# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c -# from the GNU Emacs distribution. -# Note some machines won't allow $(CC) without -S on this source file. -alloca.o: alloca.c - $(CC) $(ALL_CFLAGS) $(CPPFLAGS) -S `echo $(srcdir)/alloca.c | sed 's,^\./,,'` - as alloca.s -o alloca.o - -# Compile the libraries to be used by gen*. -# If we are not cross-building, gen* use the same .o's that cc1 will use, -# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict -# with the rules for rtl.o, alloca.o, etc. -$(HOST_PREFIX_1)alloca.o: alloca.c - rm -f $(HOST_PREFIX)alloca.c - cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c - -$(HOST_PREFIX_1)obstack.o: obstack.c - rm -f $(HOST_PREFIX)obstack.c - cp $(srcdir)/obstack.c $(HOST_PREFIX)obstack.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c - -$(HOST_PREFIX_1)malloc.o: malloc.c - rm -f $(HOST_PREFIX)malloc.c - cp $(srcdir)/malloc.c $(HOST_PREFIX)malloc.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c - -# Remake the info files. - -doc: $(srcdir)/gas.info - -$(srcdir)/gas.info: $(srcdir)/gas.texinfo - makeinfo `echo $(srcdir)/gas.texinfo | sed 's,^\./,,'` - - -# Deletion of files made during compilation. -# There are three levels of this: `clean', `cleanconfig' and `realclean'. -# `clean' deletes what you want to delete ordinarily to save space. -# This is most, but not all, of the files made by compilation. -# `cleanconfig' also deletes everything depending -# on the choice of config files. -# `realclean' also deletes everything that could be regenerated automatically. - -clean: - -rm -f $(STAGESTUFF) -# Delete the temporary source copies for cross compilation. - -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c - -rm -f $(HOST_PREFIX_1)obstack.c -# Delete the stamp files except stamp-gnulib2. - -rm -f core - -# Like clean but also delete the links made to configure gas. -cleanconfig: clean - -rm -f config.status Makefile host.h targ-env.h - -rm -f targ-cpu.h targ-cpu.c - -rm -f obj-format.h obj-format.c - -rm -f atof-targ.c - -# Get rid of every file that's generated from some other file (except INSTALL). -realclean: cleanconfig - -rm -f gas.aux gas.cps gas.fns gas.info gas.kys gas.pgs gas.tps gas.vrs - -rm -f TAGS - -rm -f gas.info* gas.?? gas.??s gas.log gas.toc gas.*aux - -rm -f *.dvi - -# Entry points `install', `includes' and `uninstall'. - -# Copy the files into directories where they will be run. -install: - $(INSTALL_PROGRAM) gas $(bindir)/as - -# Create the installation directory. -install-dir: - -mkdir $(libdir) - -mkdir $(libdir)/gcc - -mkdir $(libdir)/gcc/$(target) - -mkdir $(libdir)/gcc/$(target)/$(version) - -# Install the compiler executables built during cross compilation. -install-cross: native install-dir - -if [ -f cc1 ] ; then $(INSTALL_PROGRAM) cc1 $(libsubdir)/cc1; else true; fi - -if [ -f cc1plus ] ; then $(INSTALL_PROGRAM) cc1plus $(libsubdir)/cc1plus; else true; fi - $(INSTALL_PROGRAM) cpp $(libsubdir)/cpp - ./gcc -dumpspecs > $(libsubdir)/specs - $(INSTALL_PROGRAM) gcc $(bindir)/gcc - -# Install the man pages. -install-man: install-dir $(srcdir)/gcc.1 protoize.1 unprotoize.1 - $(INSTALL_FILE) $(srcdir)/gcc.1 $(mandir)/gcc.$(manext) - chmod a-x $(mandir)/gcc.$(manext) - $(INSTALL_FILE) $(srcdir)/protoize.1 $(mandir)/protoize.$(manext) - chmod a-x $(mandir)/protoize.$(manext) - $(INSTALL_FILE) $(srcdir)/unprotoize.1 $(mandir)/unprotoize.$(manext) - chmod a-x $(mandir)/unprotoize.$(manext) - -# Cancel installation by deleting the installed files. -uninstall: - -rm -rf $(libsubdir) - -rm -rf $(bindir)/gas - -rm -rf $(mandir)/gas.$(manext) - - -# These exist for maintenance purposes. - -tags TAGS: force - etags $(REAL_SOURCES) $(REAL_HEADERS) README Makefile config/*.[hc] - -bootstrap: gas force - $(MAKE) stage1 - $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas - $(MAKE) stage2 - $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas - for i in *.o; do cmp $$i stage2/$$i; done - -bootstrap2: force - $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas - $(MAKE) stage2 - $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas - for i in *.o; do cmp $$i stage2/$$i; done - -bootstrap3: force - $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas - for i in *.o; do cmp $$i stage2/$$i; done - -# Copy the object files from a particular stage into a subdirectory. -stage1: force - -mkdir stage1 - -mv $(STAGESTUFF) stage1 - -(cd stage1 ; ln -s gas as) - -stage2: force - -mkdir stage2 - -mv $(STAGESTUFF) stage2 - -(cd stage2 ; ln -s gas as) - - -stage3: force - -mkdir stage3 - -mv $(STAGESTUFF) $(STAGE_GCC) stage3 - -rm -f stage3/gnulib - -cp gnulib stage3 - -if $(RANLIB_TEST) ; then $(RANLIB) stage3/gnulib; else true; fi - -stage4: force - -mkdir stage4 - -mv $(STAGESTUFF) $(STAGE_GCC) stage4 - -rm -f stage4/gnulib - -cp gnulib stage4 - -if $(RANLIB_TEST) ; then $(RANLIB) stage4/gnulib; else true; fi - -# Copy just the executable files from a particular stage into a subdirectory, -# and delete the object files. Use this if you're just verifying a version -# that is pretty sure to work, and you are short of disk space. -risky-stage1: force - -mkdir stage1 - -mv cc1 cpp cccp gcc stage1 - -rm -f stage1/gnulib - -cp gnulib stage1 && $(RANLIB) stage1/gnulib - -make clean - -risky-stage2: force - -mkdir stage2 - -mv cc1 cpp cccp gcc stage2 - -rm -f stage2/gnulib - -cp gnulib stage2 && $(RANLIB) stage2/gnulib - -make clean - -risky-stage3: force - -mkdir stage3 - -mv cc1 cpp cccp gcc stage3 - -rm -f stage3/gnulib - -cp gnulib stage3 && $(RANLIB) stage3/gnulib - -make clean - -risky-stage4: force - -mkdir stage4 - -mv cc1 cpp cccp gcc stage4 - -rm -f stage4/gnulib - -cp gnulib stage4 && $(RANLIB) stage4/gnulib - -make clean - -#In GNU Make, ignore whether `stage*' exists. -.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap -.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4 - -force: - -Makefile: $(srcdir)/Makefile.in $(srcdir)/configure - $(srcdir)/configure.was -srcdir=$(srcdir) -host=$(host) $(target) diff --git a/gas/Makefile.loic b/gas/Makefile.loic deleted file mode 100755 index 4de7da1..0000000 --- a/gas/Makefile.loic +++ /dev/null @@ -1,203 +0,0 @@ -# Makefile for GAS. -# Copyright (C) 1989, 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 1, or (at your option) -# any later version. -# -# GAS is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GAS; see the file COPYING. If not, write to -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - -BINDIR = /usr/local/bin - -BINARY = gas - -# -# Add these flags to XCFLAGS below for specific use. -# -# If you machine does not have vfprintf, but does have _doprnt(), -# -DNO_VARARGS -# -# If the return-type of a signal-hander is void (instead of int), -# -DSIGTY -# -# To include the mc68851 mmu coprocessor instructions in the 68020 assembler, -# -Dm68851 -# -# If you want the 80386 assembler to correctly handle fsub/fsubr and fdiv/fdivr -# opcodes (unlike most 80386 assemblers) -# -DNON_BROKEN_WORDS -# -XCFLAGS = - -# Your favorite compiler -CC = gcc - -# Uncomment the following lines if you use USG - -INCLUDE_DIRS = -I. -COFF_OBJECTS = stack.o -CPPFLAGS = -DUSG -CFLAGS = -g $(CPPFLAGS) $(XCFLAGS) -LDFLAGS = -#LOADLIBES = -lPW - -# Uncomment the following lines if you use BSD -#INCLUDE_DIRS = -I. -#CPPFLAGS = -#CFLAGS = -g $(CPPFLAGS) $(XCFLAGS) -#LDFLAGS = -#LOADLIBES = - -CONFIG_FILES = \ - machine.c machine.h atof.c obj-format.c obj-format.h opcode.h - -OBJECTS = \ - as.o xrealloc.o xmalloc.o hash.o hex-value.o \ - atof-generic.o append.o messages.o expr.o app.o \ - frags.o input-file.o input-scrub.o output-file.o \ - subsegs.o symbols.o version.o flonum-const.o flonum-copy.o \ - flonum-mult.o strstr.o bignum-copy.o obstack.o write.o read.o \ - obj-format.o machine.o atof.o $(COFF_OBJECTS) - -SOURCES = $(OBJECTS:.o=.c) - -all : $(BINARY) - -install : all - cp $(BINARY) $(BINDIR) - -clean : - rm -f $(OBJECTS) - -clobber : clean - rm -f $(BINARY) $(CONFIG_FILES) dependencies TAGS m68k.h - -$(BINARY) : $(OBJECTS) - $(CC) -o $(BINARY) $(LDFLAGS) $(OBJECTS) $(LOADLIBES) - -TAGS : $(SOURCES) - etags $(SOURCES) *.h - -CXREF : $(SOURCES) - cxref -c $(INCLUDE_DIRS) $(SOURCES) - -stack.o: stack.c - $(CC) $(CFLAGS) -c stack.c - -atof.o: \ - flonum.h \ - bignum.h -obj-format.o: \ - as.h \ - md.h \ - aout.h \ - a.out.gnu.h \ - struc-symbol.h \ - write.h \ - append.h -read.o: \ - obj-format.h \ - a.out.gnu.h \ - as.h \ - read.h \ - md.h \ - hash.h \ - obstack.h \ - frags.h \ - flonum.h \ - bignum.h \ - struc-symbol.h \ - expr.h \ - symbols.h \ - sparc.h -write.o: \ - obj-format.h \ - a.out.gnu.h \ - as.h \ - md.h \ - subsegs.h \ - obstack.h \ - struc-symbol.h \ - write.h \ - symbols.h \ - append.h \ - sparc.h -obstack.o: \ - obstack.h -bignum-copy.o: \ - bignum.h -flonum-mult.o: \ - flonum.h \ - bignum.h -flonum-copy.o: \ - flonum.h \ - bignum.h -flonum-const.o: \ - flonum.h \ - bignum.h -symbols.o: \ - obj-format.h \ - a.out.gnu.h \ - as.h \ - hash.h \ - obstack.h \ - struc-symbol.h \ - symbols.h \ - frags.h -subsegs.o: \ - obj-format.h \ - a.out.gnu.h \ - as.h \ - subsegs.h \ - obstack.h \ - frags.h \ - struc-symbol.h \ - write.h -input-scrub.o: \ - as.h \ - read.h \ - input-file.h -input-file.o: \ - input-file.h -frags.o: \ - obj-format.h \ - a.out.gnu.h \ - as.h \ - subsegs.h \ - obstack.h \ - frags.h \ - struc-symbol.h -expr.o: \ - obj-format.h \ - a.out.gnu.h \ - as.h \ - flonum.h \ - bignum.h \ - read.h \ - struc-symbol.h \ - expr.h \ - obstack.h \ - symbols.h -messages.o: \ - as.h -atof-generic.o: \ - flonum.h \ - bignum.h -hash.o: \ - hash.h -as.o: \ - obj-format.h \ - a.out.gnu.h \ - as.h \ - struc-symbol.h \ - write.h diff --git a/gas/VERSION b/gas/VERSION deleted file mode 100755 index 5625e59..0000000 --- a/gas/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.2 diff --git a/gas/a.out.gnu.h b/gas/a.out.gnu.h deleted file mode 100755 index fe777f9..0000000 --- a/gas/a.out.gnu.h +++ /dev/null @@ -1,351 +0,0 @@ -/* This file is a.out.gnu.h - - Copyright (C) 1987-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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef __A_OUT_GNU_H__ -#define __A_OUT_GNU_H__ - -#include "aout/reloc.h" - -#define __GNU_EXEC_MACROS__ - -#ifndef __STRUCT_EXEC_OVERRIDE__ - -/* This is the layout on disk of a Unix V7, Berkeley, SunOS, Vax Ultrix - "struct exec". Don't assume that on this machine, the "struct exec" - will lay out the same sizes or alignments. */ - -struct exec_bytes { - unsigned char a_info[4]; - unsigned char a_text[4]; - unsigned char a_data[4]; - unsigned char a_bss[4]; - unsigned char a_syms[4]; - unsigned char a_entry[4]; - unsigned char a_trsize[4]; - unsigned char a_drsize[4]; -}; - -/* How big the "struct exec" is on disk */ -#define EXEC_BYTES_SIZE (8 * 4) - -/* This is the layout in memory of a "struct exec" while we process it. */ - -struct exec -{ - unsigned long a_info; /* Use macros N_MAGIC, etc for access */ - unsigned a_text; /* length of text, in bytes */ - unsigned a_data; /* length of data, in bytes */ - unsigned a_bss; /* length of uninitialized data area for file, in bytes */ - unsigned a_syms; /* length of symbol table data in file, in bytes */ - unsigned a_entry; /* start address */ - unsigned a_trsize; /* length of relocation info for text, in bytes */ - unsigned a_drsize; /* length of relocation info for data, in bytes */ -}; - -#endif /* __STRUCT_EXEC_OVERRIDE__ */ - -/* these go in the N_MACHTYPE field */ -/* These symbols could be defined by code from Suns...punt 'em */ -#undef M_UNKNOWN -#undef M_68010 -#undef M_68020 -#undef M_SPARC -enum machine_type { - M_UNKNOWN = 0, - M_68010 = 1, - M_68020 = 2, - M_SPARC = 3, - /* skip a bunch so we don't run into any of sun's numbers */ - M_386 = 100, - M_29K = 101, - M_RS6000 = 102, /* IBM RS/6000 */ - /* HP/BSD formats */ - M_HP200 = 200, /* hp200 (68010) BSD binary */ - M_HP300 = 300, /* hp300 (68020+68881) BSD binary */ - M_HPUX23 = 0x020C, /* hp200/300 HPUX binary */ -}; - -#define N_MAGIC(exec) ((exec).a_info & 0xffff) -#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) -#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) -#define N_SET_INFO(exec, magic, type, flags) \ - ((exec).a_info = ((magic) & 0xffff) \ - | (((int)(type) & 0xff) << 16) \ - | (((flags) & 0xff) << 24)) -#define N_SET_MAGIC(exec, magic) \ - ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff))) - -#define N_SET_MACHTYPE(exec, machtype) \ - ((exec).a_info = \ - ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) - -#define N_SET_FLAGS(exec, flags) \ - ((exec).a_info = \ - ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) - -/* Code indicating object file or impure executable. */ -#define OMAGIC 0407 -/* Code indicating pure executable. */ -#define NMAGIC 0410 -/* Code indicating demand-paged executable. */ -#define ZMAGIC 0413 - -/* Virtual Address of text segment from the a.out file. For OMAGIC, - (almost always "unlinked .o's" these days), should be zero. - For linked files, should reflect reality if we know it. */ - -#ifndef N_TXTADDR -#define N_TXTADDR(x) (N_MAGIC(x)==OMAGIC? 0 : TEXT_START_ADDR) -#endif - -#ifndef N_BADMAG -#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \ - && N_MAGIC(x) != NMAGIC \ - && N_MAGIC(x) != ZMAGIC) -#endif - -/* By default, segment size is constant. But on some machines, it can - be a function of the a.out header (e.g. machine type). */ -#ifndef N_SEGSIZE -#define N_SEGSIZE(x) SEGMENT_SIZE -#endif - - /* This complexity is for encapsulated COFF support */ -#ifndef _N_HDROFF -#define _N_HDROFF(x) (N_SEGSIZE(x) - sizeof (struct exec)) -#endif - -#ifndef N_TXTOFF -#define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? \ - _N_HDROFF((x)) + sizeof (struct exec) : \ - sizeof (struct exec)) -#endif - - -#ifndef N_DATOFF -#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text ) -#endif - -#ifndef N_TRELOFF -#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data ) -#endif - -#ifndef N_DRELOFF -#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) -#endif - -#ifndef N_SYMOFF -#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize ) -#endif - -#ifndef N_STROFF -#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) -#endif - -/* Address of text segment in memory after it is loaded. */ -#ifndef N_TXTADDR -#define N_TXTADDR(x) 0 -#endif - -#ifndef N_DATADDR -#define N_DATADDR(x) \ - (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) \ - : (N_SEGSIZE(x) + ((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZE(x)-1)))) -#endif - -/* Address of bss segment in memory after it is loaded. */ -#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) - -struct nlist { - union { - char *n_name; - struct nlist *n_next; - long n_strx; - } n_un; - unsigned char n_type; - char n_other; - short n_desc; - unsigned long n_value; -}; - -#define N_UNDF 0 -#define N_ABS 2 -#define N_TEXT 4 -#define N_DATA 6 -#define N_BSS 8 -#define N_COMM 0x12 /* common (visible in shared lib commons) */ -#define N_FN 0x1F /* File name of a .o file */ - -/* Note: N_EXT can only usefully be OR-ed with N_UNDF, N_ABS, N_TEXT, - N_DATA, or N_BSS. When the low-order bit of other types is set, - (e.g. N_WARNING versus N_FN), they are two different types. */ -#define N_EXT 1 -#define N_TYPE 036 -#define N_STAB 0340 - -/* The following type indicates the definition of a symbol as being - an indirect reference to another symbol. The other symbol - appears as an undefined reference, immediately following this symbol. - - Indirection is asymmetrical. The other symbol's value will be used - to satisfy requests for the indirect symbol, but not vice versa. - If the other symbol does not have a definition, libraries will - be searched to find a definition. */ - -#define N_INDR 0xa - -/* The following symbols refer to set elements. - All the N_SET[ATDB] symbols with the same name form one set. - Space is allocated for the set in the text section, and each set - element's value is stored into one word of the space. - The first word of the space is the length of the set (number of elements). - - The address of the set is made into an N_SETV symbol - whose name is the same as the name of the set. - This symbol acts like a N_DATA global symbol - in that it can satisfy undefined external references. */ - -/* These appear as input to LD, in a .o file. */ -#define N_SETA 0x14 /* Absolute set element symbol */ -#define N_SETT 0x16 /* Text set element symbol */ -#define N_SETD 0x18 /* Data set element symbol */ -#define N_SETB 0x1A /* Bss set element symbol */ - -/* This is output from LD. */ -#define N_SETV 0x1C /* Pointer to set vector in data area. */ - -/* Warning symbol. The text gives a warning message, the next symbol - in the table will be undefined. When the symbol is referenced, the - message is printed. */ - -#define N_WARNING 0x1e - -/* This structure describes a single relocation to be performed. - The text-relocation section of the file is a vector of these structures, - all of which apply to the text section. - Likewise, the data-relocation section applies to the data section. */ - -/* The following enum and struct were borrowed from SunOS's - /usr/include/sun4/a.out.h and extended to handle - other machines. It is currently used on SPARC and AMD 29000. - - reloc_ext_bytes is how it looks on disk. reloc_info_extended is - how we might process it on a native host. */ - -struct reloc_ext_bytes { - unsigned char r_address[4]; - unsigned char r_index[3]; - unsigned char r_bits[1]; - unsigned char r_addend[4]; -}; - -#define RELOC_EXT_BITS_EXTERN_BIG 0x80 -#define RELOC_EXT_BITS_EXTERN_LITTLE 0x01 - -#define RELOC_EXT_BITS_TYPE_BIG 0x1F -#define RELOC_EXT_BITS_TYPE_SH_BIG 0 -#define RELOC_EXT_BITS_TYPE_LITTLE 0xF8 -#define RELOC_EXT_BITS_TYPE_SH_LITTLE 3 - -#define RELOC_EXT_SIZE 12 /* Bytes per relocation entry */ - -struct reloc_info_extended -{ - unsigned long r_address; - unsigned int r_index:24; -# define r_symbolnum r_index - unsigned r_extern:1; - unsigned :2; - /* RS/6000 compiler does not support enum bitfield - enum reloc_type r_type:5; */ - enum reloc_type r_type; - long int r_addend; -}; - -/* The standard, old-fashioned, Berkeley compatible relocation struct */ - -struct reloc_std_bytes { - unsigned char r_address[4]; - unsigned char r_index[3]; - unsigned char r_bits[1]; -}; - -#define RELOC_STD_BITS_PCREL_BIG 0x80 -#define RELOC_STD_BITS_PCREL_LITTLE 0x01 - -#define RELOC_STD_BITS_LENGTH_BIG 0x60 -#define RELOC_STD_BITS_LENGTH_SH_BIG 5 /* To shift to units place */ -#define RELOC_STD_BITS_LENGTH_LITTLE 0x06 -#define RELOC_STD_BITS_LENGTH_SH_LITTLE 1 - -#define RELOC_STD_BITS_EXTERN_BIG 0x10 -#define RELOC_STD_BITS_EXTERN_LITTLE 0x08 - -#define RELOC_STD_BITS_BASEREL_BIG 0x08 -#define RELOC_STD_BITS_BASEREL_LITTLE 0x08 - -#define RELOC_STD_BITS_JMPTABLE_BIG 0x04 -#define RELOC_STD_BITS_JMPTABLE_LITTLE 0x04 - -#define RELOC_STD_BITS_RELATIVE_BIG 0x02 -#define RELOC_STD_BITS_RELATIVE_LITTLE 0x02 - -#define RELOC_STD_SIZE 8 /* Bytes per relocation entry */ - -#ifndef CUSTOM_RELOC_FORMAT -struct relocation_info -{ - /* Address (within segment) to be relocated. */ - int r_address; - /* The meaning of r_symbolnum depends on r_extern. */ - unsigned int r_symbolnum:24; - /* Nonzero means value is a pc-relative offset - and it should be relocated for changes in its own address - as well as for changes in the symbol or section specified. */ - unsigned int r_pcrel:1; - /* Length (as exponent of 2) of the field to be relocated. - Thus, a value of 2 indicates 1<<2 bytes. */ - unsigned int r_length:2; - /* 1 => relocate with value of symbol. - r_symbolnum is the index of the symbol - in file's the symbol table. - 0 => relocate with the address of a segment. - r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS - (the N_EXT bit may be set also, but signifies nothing). */ - unsigned int r_extern:1; - /* The next three bits are for SunOS shared libraries, and seem to - be undocumented. */ - unsigned int r_baserel:1; /* Linkage table relative */ - unsigned int r_jmptable:1; /* pc-relative to jump table */ - -#ifdef TC_NS32K -#define r_bsr r_baserel -#define r_disp r_jmptable -#endif /* TC_NS32K */ - - unsigned int r_relative:1; /* "relative relocation" */ - /* unused */ - unsigned int r_pad:1; /* Padding -- set to zero */ -}; -#endif /* CUSTOM_RELOC_FORMAT */ - -#endif /* __A_OUT_GNU_H__ */ - -/* end of a.out.gnu.h */ diff --git a/gas/config.sub b/gas/config.sub deleted file mode 100755 index dac9ab8..0000000 --- a/gas/config.sub +++ /dev/null @@ -1,446 +0,0 @@ -#!/bin/sh - -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration (e.g. a typo). - -# Please email any bugs, comments, and/or additions to this file to: -# configure@cygnus.com - -# decode aliases into canonical names - -case "$1" in -# cpu alone is a valid alias for cpu-none-none. -vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc | ns32k \ - | alliant | arm | c1 | c2 | mips | pyramid | tron | a29k \ - | romp | rs6000 | i960 | h8300) - cpu=$1 - vendor=none - os=none - ;; -altos | altos3068) - cpu=m68k - vendor=altos - os=sysv # maybe? - ;; -altosgas) - cpu=m68k - vendor=altos - os=gas - ;; -am29k) - cpu=a29k - vendor=none - os=bsd - ;; -amdahl) - cpu=580 - vendor=amdahl - os=uts - ;; -amigados) - cpu=m68k - vendor=cbm - os=amigados # Native AmigaDOS - ;; -amigaunix | amix) - cpu=m68k - vendor=cbm - os=svr4 # System V Release 4 (svr4 is an industry recognized acronym) - ;; -apollo68) - cpu=m68k - vendor=apollo - os=sysv # maybe? - ;; -balance) - cpu=ns32k - vendor=sequent - os=dynix - ;; -convex-c1) - cpu=c1 - vendor=convex - os=sysv # maybe? - ;; -convex-c2) - cpu=c2 - vendor=convex - os=sysv # maybe? - ;; -cray | ymp) - cpu=ymp - vendor=cray - os=unicos - ;; -cray2) - cpu=cray2 - vendor=cray - os=unicos - ;; -dec3100 | decstatn | decstation | decstation-3100 | pmax | pmin) - cpu=mips - vendor=dec - os=ultrix - ;; -delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - cpu=m68k - vendor=motorola - os=sysv # maybe? - ;; - -delta88) - cpu=m88k - vendor=motorola - os=m88kbcs - ;; - -gmicro) - cpu=tron - vendor=gmicro - os=sysv # maybe? - ;; - -h8300hds) - cpu=h8300 - vendor=hitachi - os=hds - ;; - -# start-sanitize-v9 -hal-32 | hal32) - cpu=sparc64 - vendor=hal - os=hal32 - ;; -hal-64 | hal64) - cpu=sparc64 - vendor=hal - os=hal64 - ;; -sparc64) - cpu=sparc64 - vendor=sun - os=v9 - ;; -sparc64-v7 | sparc64v7) - cpu=sparc64 - vendor=sun - os=v7 - ;; -# end-sanitize-v9 -hp300bsd) - cpu=m68k - vendor=hp - os=bsd - ;; -hp300hpux | hpux | hp9k3[2-9][0-9]) - cpu=m68k - vendor=hp - os=hpux - ;; -hp9k31[0-9] | hp9k2[0-9][0-9]) - cpu=m68000 - vendor=hp - os=hpux - ;; -i386sco) - cpu=i386 - vendor=sco - os=sysv # maybe? - ;; -i386v) - cpu=i386 - vendor=none - os=sysv - ;; -i386v32) - cpu=i386 - vendor=none - os=sysv32 - ;; -iris | iris4d) - cpu=mips - vendor=sgi - os=irix # maybe? - ;; - -dpx2) - vendor=bull - cpu=m68k - os=sysv - ;; -isi | isi68) - cpu=m68k - vendor=isi - os=sysv # maybe? - ;; -littlemips) - cpu=mips - vendor=little - os=bsd - ;; -magnum | m3230) - cpu=mips - vendor=mips - os=sysv # maybe? - ;; -merlin) - cpu=ns32k - vendor=utek - os=sysv # maybe? - ;; -miniframe) - cpu=m68000 - vendor=convergent - os=sysv # maybe? - ;; -mmax) - cpu=ns32k - vendor=encore - os=sysv # maybe? - ;; -news | news700 | news800 | news900) - cpu=m68k - vendor=sony - os=newsos3 # Based on bsd-4.3 - ;; -news1000) - cpu=m68030 - vendor=sony - os=newsos3 # ? - ;; -news-3600 | bigmips | risc-news) - cpu=mips - vendor=sony - os=newsos4 # Presumably? - ;; -next) - cpu=m68k - vendor=next - os=sysv # maybe? - ;; -nindy960) - cpu=i960 - vendor=intel - os=nindy - ;; -none) - cpu=none - vendor=none - os=none - ;; -np1) - cpu=np1 - vendor=gould - os=sysv # maybe? - ;; -rtpc) - cpu=romp - vendor=ibm - os=aix # maybe? - ;; -pbd) - cpu=sparc - vendor=unicom - os=sysv - ;; -pn) - cpu=pn - vendor=gould - os=sysv # maybe? - ;; -ps2) - cpu=i386 - vendor=ibm - os=sysv # maybe? - ;; -sun2) - cpu=m68000 - vendor=sun - os=sunos4 - ;; -sun2os3) - cpu=m68000 - vendor=sun - os=sunos3 - ;; -sun2os4) - cpu=m68000 - vendor=sun - os=sunos4 - ;; -sun3) - cpu=m68k - vendor=sun - os=sunos4 - ;; -sun3os3) - cpu=m68k - vendor=sun - os=sunos3 - ;; -sun3os4) - cpu=m68k - vendor=sun - os=sunos4 - ;; -sun386 | roadrunner | sun386i) - cpu=i386 - vendor=sun - os=sunos - ;; -sun4) - cpu=sparc - vendor=sun - os=sunos4 - ;; -sun4os3) - cpu=sparc - vendor=sun - os=sunos3 - ;; -sun4os4) - cpu=sparc - vendor=sun - os=sunos4 - ;; -symmetry) - cpu=i386 - vendor=sequent - os=dynix - ;; -tower | tower-32) - cpu=m68k - vendor=ncr - os=sysv # maybe? - ;; -ultra3) - cpu=a29k - vendor=nyu - os=sym1 - ;; -umax) - cpu=ns32k - vendor=encore - os=sysv # maybe? - ;; -unixpc | safari | pc7300 | 3b1 | 7300 | 7300-att | att-7300) - cpu=m68k - vendor=att - os=sysv # maybe? - ;; -vax-dec) - cpu=vax - vendor=dec - os=ultrix # maybe? - ;; -vxworks68) - cpu=m68k - vendor=wrs - os=vxworks - ;; -vxworks960) - cpu=i960 - vendor=wrs - os=vxworks - ;; -xmp) - cpu=xmp - vendor=cray - os=unicos - ;; -# not an alias. parse what we expect to be a canonical name. -*) - cpu=`echo $1 | sed 's/-.*$//'` - - if [ "${cpu}" = "$1" ] ; then - # no vendor so this is an invalid name. - echo '***' No vendor: configuration \`$1\' not recognized 1>&2 - exit 1 - else - # parse out vendor - rest=`echo $1 | sed "s/${cpu}-//"` - vendor=`echo ${rest} | sed 's/-.*$//'` - - if [ "${vendor}" = "${rest}" ] ; then - # a missing os is acceptable - os=none - else - os=`echo ${rest} | sed "s/${vendor}-//"` - fi - fi - ;; -esac - -# At this point we should have three parts of a canonical name in cpu, -# vendor, and os. - -# verify that the cpu is known. - -case "${cpu}" in -none | vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc \ - | ns32k | alliant | arm | c1 | c2 | mips | pyramid | tron \ - | a29k | romp | rs6000 | i960 | xmp | ymp | cray2 | 580 | h8300) - ;; - -# start-sanitize-v9 -sparc64) ;; -# end-sanitize-v9 - -*) - echo '***' Invalid cpu \`${cpu}\': configuration \`$1\' not recognized 1>&2 - exit 1 - ;; -esac - -# verify that the vendor is known. - -case "${vendor}" in - altos | amdahl | aout | apollo | att | bcs | bout |\ - cbm | convergent | convex | coff | cray | dec | encore |\ - gould | hitachi | intel | isi | hp | ibm | little | mips | motorola |\ - ncr | next | none | nyu | sco | sequent | sgi | sony | sun |\ - unicom | utek | wrs | bull ) ;; - -# start-sanitize-v9 -hal) ;; -# end-sanitize-v9 - -*) - echo '***' Invalid vendor \`${vendor}\': configuration \`$1\' not recognized 1>&2 - exit 1 - ;; -esac - -# verify that the os is known, if it exists. - -case "${os}" in -aix* | aout | bout | bsd* | coff | ctix* | dynix* | esix* | hpux* \ - | hds | irix* | isc* | kern | mach* | newsos* | nindy* | none \ - | osf* | sco* | sunos* | sysv* | ultrix* | unos* | v88r* \ - | vms* | vxworks* | sym[1-9]* | unicos* | uts | svr4 \ - | amigados) - ;; - -# start-sanitize-v9 -hal32 | hal64 | v7 | v9) ;; -# end-sanitize-v9 - -*) - echo '***' Invalid os \`${os}\': configuration \`$1\' not recognized 1>&2 - exit 1 - ;; -esac - -echo ${cpu}-${vendor}-${os} diff --git a/gas/config/ChangeLog b/gas/config/ChangeLog deleted file mode 100644 index f81fe41..0000000 --- a/gas/config/ChangeLog +++ /dev/null @@ -1,289 +0,0 @@ -Mon Nov 23 11:50:00 1992 Ken Raeburn (raeburn@cygnus.com) - - * obj-coff.c (obj_coff_endef): Use as_warn, not fprintf. - - * tc-m68k.c (md_assemble): Don't complain about 68000 with 68881; - could be doing emulation. - -Tue Nov 10 09:50:25 1992 Ian Lance Taylor (ian@cygnus.com) - - * tc-m68k.c (m68k_reg_parse): If REGISTER_PREFIX isn't defined, - still accept (but don't require) OPTIONAL_REGISTER_PREFIX before - the register name. - (insert_reg): put REGISTER_PREFIX before register names before - putting them in the symbol table. - * tc-m68k.h (OPTIONAL_REGISTER_PREFIX): Define to be "%", if not - M68KCOFF. - - * obj-coffbfd.c (fill_section): set STYP_NOLOAD bit for .bss - section. - - * atof-ieee.c, atof-ns32k.c, tc-*.c: made EXP_CHARS, FLT_CHARS, - comment_chars, line_comment_chars and line_seperator_chars - consistently const, and always initialized them. Included read.h. - -Thu Nov 5 17:55:41 1992 Jim Wilson (wilson@sphagnum.cygnus.com) - - * tc-sparc.c (sparc_ip): Add code to flag error if an absolute - constant will not fit in an immediate field. - (md_apply_fix, RELOC_BASE13 case): Check for relocation overflow. - -Wed Nov 4 07:50:46 1992 Ken Raeburn (raeburn@cygnus.com) - - * obj-coff.c (callj_table): Delete global variable. - (obj_emit_relocations): Define it locally here, and only if - TC_I960 is defined. - - * tc-m68k.c (m68k_reg_parse): Underscore is part of a symbol name. - (m68k_ip): Don't warn about bignum used as float bit-pattern. - - * obj-coff.c: Replaced ANSI and non-ANSI function declarations - with a single set using PARAMS macro. - - * tc-i960.c (tc_bout_fix_to_chars): Bit-field fixups want a length - of 2. - - * tc-i960.c: Missed a couple of 0->NO_RELOC conversions. - - * tc-i960.h (N_BALNAME, N_CALLNAME): Define as char-type values, - so widening works consistently. - -Fri Oct 23 14:40:38 1992 Ian Lance Taylor (ian@cygnus.com) - - * obj-coffbfd.c (write_object_file): check return value of - bfd_close_all_done. - -Tue Oct 20 13:02:25 1992 Ian Lance Taylor (ian@cygnus.com) - - * Support for i386-sysv. - obj-coffbfd.c (do_relocs_for, write_object_file): set segment - addresses to reasonable sizes. New define ZERO_BASED_SEGMENTS can - be used to set them all to zero as was done before. - (fill_section): segment addresses now set in write_object_file. - (fill_section): Don't set STYP_NOLOAD for .bss section. - (fixup_segment): 386 uses strange common symbol format. - tc-i386.c (tc_coff_fix2rtype): use R_DIR32, not R_RELLONG, for - compatibility with SVR3.2 linker. - -Mon Oct 5 09:28:57 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - fix i960+non-bfd coff bit rot. - * obj-coff.c (c_dot_file_symbol, obj_coff_ln, obj_coff_line): - support for C source listings. (obj_coff_endef): look in the right - part of the symbol for the symbol name - - * tc-m68k.c (get_num): make it work for all segments, not just the - first three. - -Tue Sep 29 12:22:52 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * obj-coffbfd.c (write_object_file): don't fixup for the z8k - * tc-z8k.c: lots of bug fixes - -Tue Sep 29 10:51:55 1992 Ian Lance Taylor (ian@cygnus.com) - - * tc-i960.h, tc-i960.c: avoid the ANSI preprocessor addition - #elif, since it is not supported by old compilers. - ho-rs6000.h, tc-m68k.c: the native RS/6000 compiler miscompiles a - couple of expressions in tc-m68k.c. - -Mon Sep 28 21:16:51 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * tc-i960.c (get_cdisp): Use NO_RELOC, not 0, in call to fix_new. - -Fri Sep 25 18:18:52 1992 Ian Lance Taylor (ian@cygnus.com) - - * tc-m68k.h: if M68KCOFF, define DOT_LABEL_PREFIX (to require - local labels to start with a .) and set REGISTER_PREFIX to %. - tc-m68k.c (m68k_reg_parse): accept REGISTER_PREFIX if defined. - -Tue Sep 22 13:02:07 1992 Sean Eric Fagan (sef@cygnus.com) - - * obj-coffbfd.c (do_relocs_for,fill_section): now allocate all - sections starting from zero, rather than making them consecutive. - This makes subsequent reloc calculations easier, esp if the object - format doesn't understand addends. (obj_coff_lcomm): (maybe temporarily) - allocate lcomm in .data rather than in .bss. It seems that some - tools can't cope with a non-zero sized bss before linkage. - -Tue Sep 22 15:10:51 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * tc-m68k.c: Replace "enum m68k_architecture" with "int" - throughout. That enum no longer means what we thought it meant. - - * tc-m68k.c (md_assemble, md_parse_option): Handle new - "-mno-688[58]1" options. - - * tc-m68k.c: Added CPU32 support. - -Fri Sep 18 08:02:18 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * tc-m68k.c (m68k_ip): An(disp) is not pc relative. - -Sun Sep 13 20:29:39 1992 Ian Lance Taylor (ian@cygnus.com) - - * obj-coffbfd.h: define WARN_SIGNED_OVERFLOW_WORD. - obj-coffbfd.c (fixup_segment): check for signed .word overflow if - WARN_SIGNED_OVERFLOW_WORD. - - * obj-coffbfd.c (fixup_segment): fixed missing parens in - expression checking for byte or word overflow. - -Fri Sep 11 10:21:04 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - Support for i386 coff - * obj-coffbfd.h : added stuff - * tc-i386.c (tc_coff_fix2rtype): new function - * tc-i386.h : new coff defines - -Wed Sep 9 11:10:24 1992 Ian Lance Taylor (ian@cygnus.com) - - * tc-m68k.c (m68k_ip, m68k_ip_op, get_num, try_moto_index): merge - Motorola and MIT syntax; gas can now assemble either type of - file. - tc-m68kmote.c, tc-m68kmote.h: removed now superfluous files. - From Steve Chamberlain: - m68kcoff.mt: for m68k COFF. - obj-coffbfd.c: (fixup_mdeps) added - (size_section) removed bad sanity check - (fill_section) added rs_machine_dependent case - (write_object_file) call fixup_mdeps - (fixup_segment) set fx_subsy to 0. - obj-coffbfd.h: define WORKING_DOT_WORD (too hard to support) and - handle m68k. - tc-m68k.c, config/tc-m68k.h: added m68k COFF support and Motorala - pseudo ops. - -Fri Aug 28 16:25:22 1992 Ian Lance Taylor (ian@cygnus.com) - - * obj-bout.h, obj-bout.c (obj_header_append, obj_symbol_to_chars), - tc-i960.c (md_ri_to_chars): Always output bout object file in - little endian byte order (used to use endianness of host). - -Tue Aug 25 15:11:08 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * z8k.c, z8k.h, z8k.mt: z8000 support stuff - -Mon Aug 24 12:45:12 1992 Ian Lance Taylor (ian@cygnus.com) - - * tc-m68k.c: use TARGET_CPU to choose default cpu type. - - * te-generic.h: default to LOCAL_LABELS_DOLLAR and LOCAL_LABELS_FB - so that we can assemble hand-written libgcc code. - -Wed Aug 19 11:20:59 1992 Ian Lance Taylor (ian@cygnus.com) - - * tc-m68k.c, tc-m68kmote.c: the cas2 instruction is supposed to be - written with indirection on the last two operands, which can be - either data or address registers. Added a new operand type 'r' - which accepts either register type. Added '(' to notend stuff in - tc-m68kmote.c to accept (a0):(a2) in cas2 instruction. - -Tue Aug 11 12:58:14 1992 Ken Raeburn (raeburn@cygnus.com) - - * sparc.mt: New file. - -Mon Aug 10 14:37:08 1992 Per Bothner (bothner@cygnus.com) - - * tc-m68k.c: ".align N" means align to N-byte boundary *only* - if TN_SUN3; otherwise align to 2**N-byte bounary. - -Thu Aug 6 12:08:42 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * config/tc-h8300.c: if a :8 is seen after an operand, fill top - two bytes of any constant with 0xff: - -Wed Aug 5 01:54:34 1992 John Gilmore (gnu at cygnus.com) - - * tc-m68k.c (try_index): Error if index scaling specified and - assembling for an older CPU than a 68020. - -Mon Jul 6 17:09:32 1992 Steve Chamberlain (sac@cygnus.com) - - * obj-coffbfd.c (fill_section): mark .lit sections as STYP_LIT - -Tue Jun 9 07:50:46 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * tc-m68k.c (m68kip): Fix typo so that only arch's >=68020 do - pcrel data stuff. (md_estimate_size_before_relax): when relaxing a - 68010 bxx into a bra+6 jmpxx, put the bytes of the jmp opcode into - the right place. (s_bss): Don't put .bss stuff into SEG_DATA, put - it into SEG_BSS - -Thu May 28 11:20:27 1992 Jim Wilson (wilson@sphagnum.cygnus.com) - - * tc-sparc.c: Use new ARCHITECTURES_CONFLICT_P macro. Mention new - -Asparclite flag. - -Mon May 4 18:56:19 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * obj-coffbfd.c: use is a synonym for section, (do_relocs_for): - calc the base of relocs correctly. - * tc-a29k.c (parse_operand): allow expressions to be in any section. - -Thu Mar 12 04:42:38 1992 K. Richard Pixley (rich@cygnus.com) - - * tc-m68k.h, te-sun3.h: moved LOCAL_LABELS_FB definition from - tc-m68k.h to te-sun3.h. - -Wed Mar 11 23:34:46 1992 K. Richard Pixley (rich@cygnus.com) - - * te-sun3.h: add LOCAL_LABELS_DOLLAR. - -Fri Feb 21 06:22:15 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * obj-aout.c: do not include stab.gnu.h if NO_LISTING. - - * tc-i860.c, a.out.gnu.h: move i860 relocs to a proper place. - - * a.out.h: removed. - -Fri Feb 21 02:17:22 1992 Minh Tran-Le (TRANLE@INTELLICORP.COM) - - * tc-i386.c: tc-i386.c: added handling of the following opcodes: - i/o opcodes - inb, inw, outb and outw. string manipulation with - att syntax - scmp, slod, smov, ssca, ssto. - -Fri Feb 21 01:53:50 1992 Minh Tran-Le (TRANLE@INTELLICORP.COM) - - * obj-coff.c: (for aix386) Moved the symbols .text, .data and .bss - to just after .file . - - In obj_crawl_symbol_chain() where it tries to put the external - symbols apart, with the condition: - (!S_IS_DEFINED(symbolP) && - !S_IS_DEBUG(symbolP) && - !SF_GET_STATICS(symbolP)) - it was moving too many symbols out. So I switch it back to the - condition: - (S_GET_STORAGE_CLASS(symbolP) == C_EXT && !SF_GET_FUNCTION(symbolP)) - - In obj_emit_relocations() added the conditional on KEEP_RELOC_INFO - so that we don't use the F_RELFLG which make the linker complain - that somebody has stripped the relocation info. - - Also, the AIX ld program require that the relocation table - is sorted by r_vaddr like the standard ATT assembler does. - - [he also changed the sizeof(struct ...)'s into the coff - style FOOSZ macros. I'm not sure this is right, but I can't - remember why. xoxorich.] - -Tue Feb 18 02:11:10 1992 K. Richard Pixley (rich at cygnus.com) - - * tc-m88k.[hc]: pulled in from hack's unfinished work. These - aren't yet integrated. - - * tc-i860.[hc]: blew off the dust. Something must still be done - about conflicting relocation types. - - * tc-ns32k.c: Replaced previous tc_aout_fix_to_chars stub with the - real thing. - - * tc-i960.c, tc-sparc.c: white space and comments only. - - * tc-a29k.h: delete duplicate macro definition. - - * new file atof-ns32k.c copied from hack's last unreleased gas. - - diff --git a/gas/config/a.out.gnu.h b/gas/config/a.out.gnu.h deleted file mode 100755 index 5f39275..0000000 --- a/gas/config/a.out.gnu.h +++ /dev/null @@ -1,431 +0,0 @@ -/* This file is a.out.gnu.h - - Copyright (C) 1987-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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef __A_OUT_GNU_H__ -#define __A_OUT_GNU_H__ - -/* There are two main flavours of a.out, one which uses the standard - relocations, and one which uses extended relocations. - - Today, the extended reloc uses are - TC_SPARC, TC_A29K - - each must define the enum reloc_type - -*/ - -#define USE_EXTENDED_RELOC (defined(TC_SPARC) || defined(TC_A29K)) - -#if defined(TC_SPARC) || defined(TC_A29K) -enum reloc_type { - RELOC_8, RELOC_16, RELOC_32, /* simple relocations */ - RELOC_DISP8, RELOC_DISP16, RELOC_DISP32, /* pc-rel displacement */ - RELOC_WDISP30, RELOC_WDISP22, - RELOC_HI22, RELOC_22, - RELOC_13, RELOC_LO10, - RELOC_SFA_BASE, RELOC_SFA_OFF13, - RELOC_BASE10, RELOC_BASE13, RELOC_BASE22, /* P.I.C. (base-relative) */ - RELOC_PC10, RELOC_PC22, /* for some sort of pc-rel P.I.C. (?) */ - RELOC_JMP_TBL, /* P.I.C. jump table */ - RELOC_SEGOFF16, /* reputedly for shared libraries somehow */ - RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE, - RELOC_11, - RELOC_WDISP2_14, - RELOC_WDISP19, - RELOC_HHI22, - RELOC_HLO10, - - /* 29K relocation types */ - RELOC_JUMPTARG, RELOC_CONST, RELOC_CONSTH, - - RELOC_WDISP14, RELOC_WDISP21, - - NO_RELOC, -}; -#endif /* TC_SPARC or TC_A29K */ - - -#define __GNU_EXEC_MACROS__ - -#ifndef __STRUCT_EXEC_OVERRIDE__ - -/* This is the layout on disk of a Unix V7, Berkeley, SunOS, Vax Ultrix - "struct exec". Don't assume that on this machine, the "struct exec" - will lay out the same sizes or alignments. */ - -struct exec_bytes { - unsigned char a_info[4]; - unsigned char a_text[4]; - unsigned char a_data[4]; - unsigned char a_bss[4]; - unsigned char a_syms[4]; - unsigned char a_entry[4]; - unsigned char a_trsize[4]; - unsigned char a_drsize[4]; -}; - -/* How big the "struct exec" is on disk */ -#define EXEC_BYTES_SIZE (8 * 4) - -/* This is the layout in memory of a "struct exec" while we process it. */ - -struct exec -{ - unsigned long a_info; /* Use macros N_MAGIC, etc for access */ - unsigned a_text; /* length of text, in bytes */ - unsigned a_data; /* length of data, in bytes */ - unsigned a_bss; /* length of uninitialized data area for file, in bytes */ - unsigned a_syms; /* length of symbol table data in file, in bytes */ - unsigned a_entry; /* start address */ - unsigned a_trsize; /* length of relocation info for text, in bytes */ - unsigned a_drsize; /* length of relocation info for data, in bytes */ -}; - -#endif /* __STRUCT_EXEC_OVERRIDE__ */ - -/* these go in the N_MACHTYPE field */ -/* These symbols could be defined by code from Suns...punt 'em */ -#undef M_UNKNOWN -#undef M_68010 -#undef M_68020 -#undef M_SPARC -enum machine_type { - M_UNKNOWN = 0, - M_68010 = 1, - M_68020 = 2, - M_SPARC = 3, - /* skip a bunch so we don't run into any of sun's numbers */ - M_386 = 100, - M_29K = 101, - M_RS6000 = 102, /* IBM RS/6000 */ - /* HP/BSD formats */ - M_HP200 = 200, /* hp200 (68010) BSD binary */ - M_HP300 = 300, /* hp300 (68020+68881) BSD binary */ - M_HPUX23 = 0x020C, /* hp200/300 HPUX binary */ -}; - -#define N_MAGIC(exec) ((exec).a_info & 0xffff) -#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) -#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) -#define N_SET_INFO(exec, magic, type, flags) \ - ((exec).a_info = ((magic) & 0xffff) \ - | (((int)(type) & 0xff) << 16) \ - | (((flags) & 0xff) << 24)) -#define N_SET_MAGIC(exec, magic) \ - ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff))) - -#define N_SET_MACHTYPE(exec, machtype) \ - ((exec).a_info = \ - ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) - -#define N_SET_FLAGS(exec, flags) \ - ((exec).a_info = \ - ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) - -/* Code indicating object file or impure executable. */ -#define OMAGIC 0407 -/* Code indicating pure executable. */ -#define NMAGIC 0410 -/* Code indicating demand-paged executable. */ -#define ZMAGIC 0413 - -/* Virtual Address of text segment from the a.out file. For OMAGIC, - (almost always "unlinked .o's" these days), should be zero. - For linked files, should reflect reality if we know it. */ - -#ifndef N_TXTADDR -#define N_TXTADDR(x) (N_MAGIC(x)==OMAGIC? 0 : TEXT_START_ADDR) -#endif - -#ifndef N_BADMAG -#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \ - && N_MAGIC(x) != NMAGIC \ - && N_MAGIC(x) != ZMAGIC) -#endif - -/* By default, segment size is constant. But on some machines, it can - be a function of the a.out header (e.g. machine type). */ -#ifndef N_SEGSIZE -#define N_SEGSIZE(x) SEGMENT_SIZE -#endif - - /* This complexity is for encapsulated COFF support */ -#ifndef _N_HDROFF -#define _N_HDROFF(x) (N_SEGSIZE(x) - sizeof (struct exec)) -#endif - -#ifndef N_TXTOFF -#define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? \ - _N_HDROFF((x)) + sizeof (struct exec) : \ - sizeof (struct exec)) -#endif - - -#ifndef N_DATOFF -#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text ) -#endif - -#ifndef N_TRELOFF -#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data ) -#endif - -#ifndef N_DRELOFF -#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) -#endif - -#ifndef N_SYMOFF -#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize ) -#endif - -#ifndef N_STROFF -#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) -#endif - -/* Address of text segment in memory after it is loaded. */ -#ifndef N_TXTADDR -#define N_TXTADDR(x) 0 -#endif - -#ifndef N_DATADDR -#define N_DATADDR(x) \ - (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) \ - : (N_SEGSIZE(x) + ((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZE(x)-1)))) -#endif - -/* Address of bss segment in memory after it is loaded. */ -#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) - -struct nlist { - union { - char *n_name; - struct nlist *n_next; - long n_strx; - } n_un; - unsigned char n_type; - char n_other; - short n_desc; - unsigned long n_value; -}; - -#define N_UNDF 0 -#define N_ABS 2 -#define N_TEXT 4 -#define N_DATA 6 -#define N_BSS 8 -#define N_COMM 0x12 /* common (visible in shared lib commons) */ -#define N_FN 0x1F /* File name of a .o file */ - -/* Note: N_EXT can only usefully be OR-ed with N_UNDF, N_ABS, N_TEXT, - N_DATA, or N_BSS. When the low-order bit of other types is set, - (e.g. N_WARNING versus N_FN), they are two different types. */ -#define N_EXT 1 -#define N_TYPE 036 -#define N_STAB 0340 - -/* The following type indicates the definition of a symbol as being - an indirect reference to another symbol. The other symbol - appears as an undefined reference, immediately following this symbol. - - Indirection is asymmetrical. The other symbol's value will be used - to satisfy requests for the indirect symbol, but not vice versa. - If the other symbol does not have a definition, libraries will - be searched to find a definition. */ - -#define N_INDR 0xa - -/* The following symbols refer to set elements. - All the N_SET[ATDB] symbols with the same name form one set. - Space is allocated for the set in the text section, and each set - element's value is stored into one word of the space. - The first word of the space is the length of the set (number of elements). - - The address of the set is made into an N_SETV symbol - whose name is the same as the name of the set. - This symbol acts like a N_DATA global symbol - in that it can satisfy undefined external references. */ - -/* These appear as input to LD, in a .o file. */ -#define N_SETA 0x14 /* Absolute set element symbol */ -#define N_SETT 0x16 /* Text set element symbol */ -#define N_SETD 0x18 /* Data set element symbol */ -#define N_SETB 0x1A /* Bss set element symbol */ - -/* This is output from LD. */ -#define N_SETV 0x1C /* Pointer to set vector in data area. */ - -/* Warning symbol. The text gives a warning message, the next symbol - in the table will be undefined. When the symbol is referenced, the - message is printed. */ - -#define N_WARNING 0x1e - -/* This structure describes a single relocation to be performed. - The text-relocation section of the file is a vector of these structures, - all of which apply to the text section. - Likewise, the data-relocation section applies to the data section. */ - -/* The following enum and struct were borrowed from SunOS's - /usr/include/sun4/a.out.h and extended to handle - other machines. It is currently used on SPARC and AMD 29000. - - reloc_ext_bytes is how it looks on disk. reloc_info_extended is - how we might process it on a native host. */ -#if USE_EXTENDED_RELOC - -struct reloc_ext_bytes { - unsigned char r_address[4]; - unsigned char r_index[3]; - unsigned char r_bits[1]; - unsigned char r_addend[4]; -}; - - -#define RELOC_EXT_BITS_EXTERN_BIG 0x80 -#define RELOC_EXT_BITS_EXTERN_LITTLE 0x01 - -#define RELOC_EXT_BITS_TYPE_BIG 0x1F -#define RELOC_EXT_BITS_TYPE_SH_BIG 0 -#define RELOC_EXT_BITS_TYPE_LITTLE 0xF8 -#define RELOC_EXT_BITS_TYPE_SH_LITTLE 3 - -#define RELOC_EXT_SIZE 12 /* Bytes per relocation entry */ - -struct reloc_info_extended -{ - unsigned long r_address; - unsigned int r_index:24; -# define r_symbolnum r_index - unsigned r_extern:1; - unsigned :2; - /* RS/6000 compiler does not support enum bitfield - enum reloc_type r_type:5; */ - enum reloc_type r_type; - long int r_addend; -}; - -#else - -/* The standard, old-fashioned, Berkeley compatible relocation struct */ - - - -#ifdef TC_I860 -/* NOTE: three bits max, see struct reloc_info_i860.r_type */ -enum i860_reloc_type { - NO_RELOC = 0, BRADDR, LOW0, LOW1, LOW2, LOW3, LOW4, SPLIT0, SPLIT1, SPLIT2, RELOC_32, -}; - -typedef enum i860_reloc_type reloc_type; - - /* NOTE: two bits max, see reloc_info_i860.r_type */ -enum highlow_type { - NO_SPEC = 0, PAIR, HIGH, HIGHADJ, -}; - - -struct reloc_info_i860 -{ - unsigned long r_address; - /* - * Using bit fields here is a bad idea because the order is not portable. :-( - */ - unsigned int r_symbolnum: 24; - unsigned int r_pcrel : 1; - unsigned int r_extern : 1; - /* combining the two field simplifies the argument passing in "new_fix()" */ - /* and is compatible with the existing Sparc #ifdef's */ - /* r_type: highlow_type - bits 5,4; reloc_type - bits 3-0 */ - unsigned int r_type : 6; - long r_addend; -}; - -#endif /* TC_I860 */ - - -struct reloc_std_bytes { - unsigned char r_address[4]; - unsigned char r_index[3]; - unsigned char r_bits[1]; -}; - -#define RELOC_STD_BITS_PCREL_BIG 0x80 -#define RELOC_STD_BITS_PCREL_LITTLE 0x01 - -#define RELOC_STD_BITS_LENGTH_BIG 0x60 -#define RELOC_STD_BITS_LENGTH_SH_BIG 5 /* To shift to units place */ -#define RELOC_STD_BITS_LENGTH_LITTLE 0x06 -#define RELOC_STD_BITS_LENGTH_SH_LITTLE 1 - -#define RELOC_STD_BITS_EXTERN_BIG 0x10 -#define RELOC_STD_BITS_EXTERN_LITTLE 0x08 - -#define RELOC_STD_BITS_BASEREL_BIG 0x08 -#define RELOC_STD_BITS_BASEREL_LITTLE 0x08 - -#define RELOC_STD_BITS_JMPTABLE_BIG 0x04 -#define RELOC_STD_BITS_JMPTABLE_LITTLE 0x04 - -#define RELOC_STD_BITS_RELATIVE_BIG 0x02 -#define RELOC_STD_BITS_RELATIVE_LITTLE 0x02 - -#define RELOC_STD_SIZE 8 /* Bytes per relocation entry */ - -#endif /* USE_EXTENDED_RELOC */ - -#ifndef CUSTOM_RELOC_FORMAT -struct relocation_info -{ - /* Address (within segment) to be relocated. */ - int r_address; - /* The meaning of r_symbolnum depends on r_extern. */ - unsigned int r_symbolnum:24; - /* Nonzero means value is a pc-relative offset - and it should be relocated for changes in its own address - as well as for changes in the symbol or section specified. */ - unsigned int r_pcrel:1; - /* Length (as exponent of 2) of the field to be relocated. - Thus, a value of 2 indicates 1<<2 bytes. */ - unsigned int r_length:2; - /* 1 => relocate with value of symbol. - r_symbolnum is the index of the symbol - in file's the symbol table. - 0 => relocate with the address of a segment. - r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS - (the N_EXT bit may be set also, but signifies nothing). */ - unsigned int r_extern:1; - /* The next three bits are for SunOS shared libraries, and seem to - be undocumented. */ - unsigned int r_baserel:1; /* Linkage table relative */ - unsigned int r_jmptable:1; /* pc-relative to jump table */ - -#ifdef TC_NS32K -#define r_bsr r_baserel -#define r_disp r_jmptable -#endif /* TC_NS32K */ - - unsigned int r_relative:1; /* "relative relocation" */ - /* unused */ - unsigned int r_pad:1; /* Padding -- set to zero */ -}; -#endif /* CUSTOM_RELOC_FORMAT */ - -#endif /* __A_OUT_GNU_H__ */ - -/* end of a.out.gnu.h */ diff --git a/gas/config/a.out.h b/gas/config/a.out.h deleted file mode 100755 index 25c6195..0000000 --- a/gas/config/a.out.h +++ /dev/null @@ -1,150 +0,0 @@ -/* This file describes the a.out file format - Copyright (C) 1987, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifdef USE_HP_INC_HDR -#include "../binutils/hp-include/a.out.h" -#else - -#ifdef USE_SYSTEM_HDR -#include "/usr/include/a.out.h" -#else - -#ifdef USE_HP_HDR -/* The `exec' structure and overall layout must be close to HP's when - we are running on an HP system, otherwise we will not be able to - execute the resulting file. */ - -struct exec -{ - unsigned short a_machtype; /* machine type */ - unsigned short a_magic; /* magic number */ - unsigned long a_spare1; - unsigned long a_spare2; - unsigned long a_text; /* length of text, in bytes */ - unsigned long a_data; /* length of data, in bytes */ - unsigned long a_bss; /* length of uninitialized data area for file, in bytes */ - unsigned long a_trsize; /* length of relocation info for text, in bytes */ - unsigned long a_drsize; /* length of relocation info for data, in bytes */ - unsigned long a_spare3; /* HP = pascal interface size */ - unsigned long a_spare4; /* HP = symbol table size */ - unsigned long a_spare5; /* HP = debug name table size */ - unsigned long a_entry; /* start address */ - unsigned long a_spare6; /* HP = source line table size */ - unsigned long a_spare7; /* HP = value table size */ - unsigned long a_syms; /* length of symbol table data in file, in bytes */ - unsigned long a_spare8; -}; - -#define N_MAGIC(exec) ((exec) . a_magic) -#define N_MACHTYPE(exec) ((exec) . a_machtype) -#define N_SET_MAGIC(exec, magic) (((exec) . a_magic) = (magic)) -#define N_SET_MACHTYPE(exec, machtype) (((exec) . a_machtype) = (machtype)) - -#define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x))) - -#define _N_BADMACH(x) \ - (((N_MACHTYPE (x)) != HP9000S200_ID) \ - && ((N_MACHTYPE (x)) != HP98x6_ID)) - -#define _N_BADMAG(x) \ - (((x).a_magic)!=OMAGIC && ((x).a_magic)!=NMAGIC && ((x).a_magic)!=ZMAGIC) - -#define HP98x6_ID 0x20A -#define HP9000S200_ID 0x20C - -#else - -/* A Generic machine. . . */ - -/* JF I'm not sure where this file came from. I put the permit.text message in - it anyway. This file came to me as part of the original VAX assembler, but had - no copyright notices in it. */ - -struct exec { - long a_magic; /* number identifies as .o file and gives type of such. */ - unsigned a_text; /* length of text, in bytes */ - unsigned a_data; /* length of data, in bytes */ - unsigned a_bss; /* length of uninitialized data area for file, in bytes */ - unsigned a_syms; /* length of symbol table data in file, in bytes */ - unsigned a_entry; /* start address */ - unsigned a_trsize; /* length of relocation info for text, in bytes */ - unsigned a_drsize; /* length of relocation info for data, in bytes */ -}; - -#define N_BADMAG(x) \ - (((x).a_magic)!=OMAGIC && ((x).a_magic)!=NMAGIC && ((x).a_magic)!=ZMAGIC) - -#endif - -/* From here down is common to both the HP and the generic machine */ -#define OMAGIC 0407 -#define NMAGIC 0410 -#define ZMAGIC 0413 - - -#define N_TXTOFF(x) \ - ((x).a_magic == ZMAGIC ? 1024 : sizeof(struct exec)) - -#define N_SYMOFF(x) \ - (N_TXTOFF(x) + (x).a_text + (x).a_data + (x).a_trsize + (x).a_drsize) - -#define N_STROFF(x) \ - (N_SYMOFF(x) + (x).a_syms) - -struct nlist { - union { - char *n_name; - struct nlist *n_next; - long n_strx; - } n_un; - char n_type; - char n_other; - short n_desc; - unsigned n_value; -}; - -#define N_UNDF 0 -#define N_ABS 2 -#define N_TEXT 4 -#define N_DATA 6 -#define N_BSS 8 -#define N_FN 31 /* JF: Someone claims this should be 31 instead of - 15. I just inherited this file; I didn't write - it. Who is right? */ - - -#define N_EXT 1 -#define N_TYPE 036 -#define N_STAB 0340 - -struct relocation_info { - int r_address; - unsigned r_symbolnum:24; - unsigned r_pcrel:1; - unsigned r_length:2; - unsigned r_extern:1; - unsigned r_bsr:1; /* OVE: used on ns32k based systems, if you want */ - unsigned r_disp:1; /* OVE: used on ns32k based systems, if you want */ - unsigned nuthin:2; -}; - -#endif -#endif - -/* end of a.out.h */ diff --git a/gas/config/coff.gnu.h b/gas/config/coff.gnu.h deleted file mode 100755 index fd21e1a..0000000 --- a/gas/config/coff.gnu.h +++ /dev/null @@ -1,783 +0,0 @@ -/* coff.gnu.h - Copyright (C) 1987, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* - * At this point I'm sure this file is right for i960 and I'm pretty sure it's - * right for a29k, although it hasn't been tested rigorously. Please feel free - * to add your own machine's description here. Without that info, it isn't - * possible to build cross development tools from elsewhere nor is it easy to - * continue to support your machines format. - * - * The TC_foo ifdef's are mine. They are what gas uses. The other ifdef's - * remain for documentation from other scavenged files. xoxorich. - */ - -/********************** FILE HEADER **********************/ - -struct filehdr { - unsigned short f_magic; /* magic number */ - unsigned short f_nscns; /* number of sections */ - long f_timdat; /* time & date stamp */ - long f_symptr; /* file pointer to symtab */ - long f_nsyms; /* number of symtab entries */ - unsigned short f_opthdr; /* sizeof(optional hdr) */ - unsigned short f_flags; /* flags */ -}; - -/* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved externel references) - * F_LNNO line nunbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) - */ -#define F_RELFLG (0x0001) -#define F_EXEC (0x0002) -#define F_LNNO (0x0004) -#define F_LSYMS (0x0008) - -#ifdef TC_I960 -#define F_AR32WR (0x0010) /* File has 32 bits per word, least - significant byte first. */ -#else /* TC_I960 */ -#define F_AR32WR (0x0100) -#endif /* TC_I960 */ - -#define F_MINMAL (0x0010) /* ??? */ -#define F_UPDATE (0x0020) /* ??? */ -#define F_SWABD (0x0040) /* ??? */ -#define F_AR16WR (0x0080) /* File has the byte ordering used by - the PDP*-11/70 processor. */ -#define F_AR32W (0x0200) /* File has 32 bits per word, most - significant byte first. */ - -/* - * Intel 80960 (I960) processor flags. - * F_I960TYPE == mask for processor type field. - */ - -#define F_I960TYPE (0xf000) -#define F_I960CORE (0x1000) -#define F_I960KB (0x2000) -#define F_I960SB (0x2000) -#define F_I960MC (0x3000) -#define F_I960XA (0x4000) -#define F_I960CA (0x5000) -#define F_I960KA (0x6000) -#define F_I960SA (0x6000) - -/* - * i80960 Magic Numbers - */ - -#define I960ROMAGIC (0x160) /* read-only text segments */ -#define I960RWMAGIC (0x161) /* read-write text segments */ - -#define I960BADMAG(x) (((x).f_magic != I960ROMAGIC) && ((x).f_magic != I960RWMAGIC)) - -#define SIPFBOMAGIC (0x17a) /* Am29000 (Byte 0 is MSB - Big Endian) */ -#define SIPRBOMAGIC (0x17b) /* Am29000 (Byte 0 is LSB - Little Endian) */ - -#define A29KBADMAG(x) (((x).f_magic != SIPFBOMAGIC) && ((x).f_magic != SIPRBOMAGIC)) - -#ifdef TE_I386AIX -# define I386MAGIC (0x175) /* Danbury AIX C compiler */ -# define I386SVMAGIC (0x14c) /* System V C Compiler */ -# define I386BADMAG(x) (((x).f_magic!=I386MAGIC) && \ - ((x).f_magic!=I386SVMAGIC)) -#else /* not TE_I386AIX */ -# define I386MAGIC 0x14c -# define I386BADMAG(x) (((x).f_magic!=I386MAGIC)) -#endif /* not TE_I386AIX */ - - -#define FILHDR struct filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - -typedef struct { - unsigned long phys_addr; - unsigned long bitarray; -} TAGBITS; - -/* These appear to be used only by exec(2). I don't know who cares - about them in a cross development environment. In any case, this - is my collection after researching the issue for a few hours. - Apparently, most have these have remained essentially unchanged - since v7 days, although a few new ones have been added. xoxorich. */ - -#define BAD0MAGIC (0401) /* (?) "lpd (UNIX/RT)" */ -#define BAD1MAGIC (0405) /* (?) overlay */ -#define OMAGIC (0407) /* old impure format. data immediately - follows text. both sections are rw. */ -#define NMAGIC (0410) /* split i&d, read-only text */ -#define A_MAGIC3 (0411) /* (?) "separated I&D" */ -#define ZMAGIC (0413) /* like NMAGIC, but demand loaded */ -#define PAGEMAGIC2 (0414) /* (?) like ZMAGIC, but address zero - explicitly unmapped. */ -#define REGMAGIC (0414) /* (?) a PAGEMAGIC2 alias? */ -#define PAGEMAGIC3 (0415) /* (?) like ZMAGIC, but address zero mapped. */ -#define A_MAGIC5 (0437) /* (?) "system overlay, separated I&D" */ -/* intended for non-unix cross development */ -#define SASMAGIC (010000) /* Single Address Space */ -#define MASMAGIC (020000) /* (?) "Multiple (separate I & D) Address Spaces" */ - -typedef struct aouthdr { - short magic; /* type of file */ - short vstamp; /* version stamp */ - unsigned long tsize; /* text size in bytes, padded to FW bdry*/ - unsigned long dsize; /* initialized data " " */ - unsigned long bsize; /* uninitialized data " " */ -#if U3B - unsigned long dum1; - unsigned long dum2; /* pad to entry point */ -#endif - unsigned long entry; /* entry pt. */ - unsigned long text_start; /* base of text used for this file */ - unsigned long data_start; /* base of data used for this file */ - /* CAREFUL: some formats omit the tagentries member. */ - unsigned long tagentries; /* number of tag entries to - follow (always zero for i960) */ -} AOUTHDR; - -/* return a pointer to the tag bits array */ - -#define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1)) - -/* compute size of a header */ - -/*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/ -#define AOUTSZ (sizeof(AOUTHDR)) - - -/********************** STORAGE CLASSES **********************/ - -#define C_EFCN -1 /* physical end of function */ -#define C_NULL 0 -#define C_AUTO 1 /* automatic variable */ -#define C_EXT 2 /* external symbol */ -#define C_STAT 3 /* static */ -#define C_REG 4 /* register variable */ -#define C_EXTDEF 5 /* external definition */ -#define C_LABEL 6 /* label */ -#define C_ULABEL 7 /* undefined label */ -#define C_MOS 8 /* member of structure */ -#define C_ARG 9 /* function argument */ -#define C_STRTAG 10 /* structure tag */ -#define C_MOU 11 /* member of union */ -#define C_UNTAG 12 /* union tag */ -#define C_TPDEF 13 /* type definition */ -#define C_USTATIC 14 /* undefined static */ -#define C_ENTAG 15 /* enumeration tag */ -#define C_MOE 16 /* member of enumeration */ -#define C_REGPARM 17 /* register parameter */ -#define C_FIELD 18 /* bit field */ - -#ifdef TC_I960 -#define C_AUTOARG 19 /* auto argument */ -#define C_LASTENT 20 /* dummy entry (end of block) */ -#endif /* TC_I960 */ - -#ifdef TC_A29K -#define C_GLBLREG 19 /* global register */ -#define C_EXTREG 20 /* external global register */ -#define C_DEFREG 21 /* ext. def. of global register */ -#define C_STARTOF 22 /* as29 $SIZEOF and $STARTOF symbols */ -#endif /* TC_A29K */ - -#define C_BLOCK 100 /* ".bb" or ".eb" */ -#define C_FCN 101 /* ".bf" or ".ef" */ -#define C_EOS 102 /* end of structure */ -#define C_FILE 103 /* file name */ -#define C_LINE 104 /* line # reformatted as symbol table entry */ -#define C_ALIAS 105 /* duplicate tag */ -#define C_HIDDEN 106 /* ext symbol in dmert public lib. like static, - used to avoid name conflicts. */ - -#ifdef TC_I960 -/* New storage classes for 80960 */ -#define C_SCALL 107 /* Procedure reachable via system call */ -/* C_LEAFPROC is obsolete. Use C_LEAFEXT or C_LEAFSTAT */ -#define C_LEAFPROC 108 /* Leaf procedure, "call" via BAL */ -#define C_LEAFEXT 108 -#define C_OPTVAR 109 /* Optimized variable */ -#define C_DEFINE 110 /* Preprocessor #define */ -#define C_PRAGMA 111 /* Advice to compiler or linker */ -#define C_SEGMENT 112 /* 80960 segment name */ -#define C_LEAFSTAT 113 /* Static leaf */ -#endif /* TC_I960 */ - -#ifdef TC_A29K -#define C_SHADOW 107 /* shadow symbol */ -#endif /* TC_A29K */ - -/********************** SECTION HEADER **********************/ - -struct scnhdr { - char s_name[8]; /* section name */ - long s_paddr; /* physical address, aliased s_nlib */ - long s_vaddr; /* virtual address */ - long s_size; /* section size */ - long s_scnptr; /* file ptr to raw data for section */ - long s_relptr; /* file ptr to relocation */ - long s_lnnoptr; /* file ptr to line numbers */ - unsigned short s_nreloc; /* number of relocation entries */ - unsigned short s_nlnno; /* number of line number entries */ - long s_flags; /* flags */ - -#ifdef TC_I960 - unsigned long s_align; /* section alignment */ -#endif /* TC_I960 */ -}; - -#define SCNHDR struct scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/* - * names of "special" sections - */ -#define _TEXT ".text" /* executable code section */ -#define _DATA ".data" /* initialized data */ -#define _BSS ".bss" /* un-initialized data */ -#define _DEBUG ".debug" /* special section used by dbx */ -#define _COMMENT ".comment" /* version info */ -#define _LIB ".lib" /* shared lib info section */ -#define _TV ".tv" - -/* - * s_flags "type" - */ - -/* - * In instances where it is necessary for a linker to - * produce an output file which contains text or data not - * based at virtual address 0, e.g. for a ROM, then the - * linker should accept address base information as command - * input and use PAD sections to skip over unused addresses. - * (at least for a29k. Maybe others.) - */ - -#define STYP_REG (0x0000) /* "regular" section: allocated, relocated, loaded */ -#define STYP_DSECT (0x0001) /* "dummy" section: not allocated, relocated, not loaded */ -#define STYP_NOLOAD (0x0002) /* "noload" section: allocated, relocated, not loaded */ -#define STYP_GROUP (0x0004) /* "grouped" section: formed of input sections */ -#define STYP_PAD (0x0008) /* "padding" section: not allocated, not relocated, loaded */ -#define STYP_COPY (0x0010) /* "copy" section: for decision function used by field update; not allocated, not relocated, - loaded; reloc & lineno entries processed normally */ -#define STYP_TEXT (0x0020) /* section contains text only */ -#define S_SHRSEG (0x0020) /* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile - will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will - update all process invocations. */ -#define STYP_DATA (0x0040) /* section contains data only */ -#define STYP_BSS (0x0080) /* section contains bss only */ -#define S_NEWFCN (0x0100) /* In a minimal file or an update file, a new function (as compared with a replaced function) */ -#define STYP_INFO (0x0200) /* comment section : not allocated not relocated, not loaded */ -#define STYP_OVER (0x0400) /* overlay section : relocated not allocated or loaded */ -#define STYP_LIB (0x0800) /* for .lib section : same as INFO */ -#define STYP_MERGE (0x2000) /* merge section -- combines with text, data or bss sections only */ -#define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions wherever padding is necessary and there is a - word of contiguous bytes beginning on a word boundary. */ - -#ifdef TC_A29K -/* NOTE: The use of STYP_BSSREG for relocation is not yet defined. */ -#define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */ -#define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */ -#define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */ -#define STYP_LIT 0x8020 /* Literal data (like STYP_TEXT) */ -#endif /* TC_A29K */ - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct lineno { - union { - long l_symndx; /* symbol index of function name, iff l_lnno == 0*/ - long l_paddr; /* (physical) address of line number */ - } l_addr; - unsigned short l_lnno; /* line number */ -#ifdef TC_I960 - /* not used on a29k */ - char padding[2]; /* force alignment */ -#endif /* TC_I960 */ -}; - -#define LINENO struct lineno -#define LINESZ sizeof(LINENO) - - -/********************** SYMBOLS **********************/ - -#define SYMNMLEN 8 /* # characters in a symbol name */ -#define FILNMLEN 14 /* # characters in a file name */ -#define DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct syment { - union { - char _n_name[SYMNMLEN]; /* old COFF version */ - struct { - long _n_zeroes; /* new == 0 */ - long _n_offset; /* offset into string table */ - } _n_n; - char *_n_nptr[2]; /* allows for overlaying */ - } _n; - long n_value; /* value of symbol */ - short n_scnum; /* section number */ - -#ifdef TC_I960 - /* This isn't yet used on the i960. In some formats this - is two bytes of padding. In others, it is missing entirely. */ - unsigned short n_flags; /* copy of flags from filhdr */ -#endif /* TC_I960 */ - -#ifdef TC_A29K - unsigned short n_type; /* type and derived type */ -#else /* TC_A29K */ - /* at least i960 uses long */ - unsigned long n_type; /* type and derived type */ -#endif /* TC_A29K */ - - char n_sclass; /* storage class */ - char n_numaux; /* number of aux. entries */ - -#ifndef TC_A29K - char pad2[2]; /* force alignment */ -#endif /* TC_A29K */ -}; - -#define SYMENT struct syment -#define SYMESZ sizeof(SYMENT) /* This had better also be sizeof(AUXENT) */ - -#define n_name _n._n_name -#define n_ptr _n._n_nptr[1] -#define n_zeroes _n._n_n._n_zeroes -#define n_offset _n._n_n._n_offset - - /* - * Relocatable symbols have number of the section in which they are defined, - * or one of the following: - */ - -#define N_SCNUM ((short) 1-65535) /* section num where symbol defined */ -#define N_UNDEF ((short)0) /* undefined symbol */ -#define N_ABS ((short)-1) /* value of symbol is absolute */ -#define N_DEBUG ((short)-2) /* debugging symbol -- symbol value is meaningless */ -#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */ -#define P_TV ((short)-4) /* indicates symbol needs transfer vector (postload) */ - -/* - * Type of a symbol, in low 4 bits of the word - */ -#define T_NULL 0 /* type not assigned */ -#define T_VOID 1 /* function argument (only used by compiler) (but now real void). */ -#define T_CHAR 2 /* character */ -#define T_SHORT 3 /* short integer */ -#define T_INT 4 /* integer */ -#define T_LONG 5 /* long integer */ -#define T_FLOAT 6 /* floating point */ -#define T_DOUBLE 7 /* double word */ -#define T_STRUCT 8 /* structure */ -#define T_UNION 9 /* union */ -#define T_ENUM 10 /* enumeration */ -#define T_MOE 11 /* member of enumeration */ -#define T_UCHAR 12 /* unsigned character */ -#define T_USHORT 13 /* unsigned short */ -#define T_UINT 14 /* unsigned integer */ -#define T_ULONG 15 /* unsigned long */ - -#ifdef TC_I960 -#define T_LNGDBL 16 /* long double */ -#endif /* TC_I960 */ - -/* - * derived types, in n_type - */ -#define DT_NON (0) /* no derived type */ -#define DT_PTR (1) /* pointer */ -#define DT_FCN (2) /* function */ -#define DT_ARY (3) /* array */ - -#ifndef TC_I960 - -#define N_BTMASK (0x0f) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -#else /* TC_I960 */ - -#define N_BTMASK (0x1f) -#define N_TMASK (0x60) -#define N_BTSHFT (5) -#define N_TSHIFT (2) - -#endif /* TC_I960 */ - -#define BTYPE(x) ((x) & N_BTMASK) - -#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) -#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) -#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) - -#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) - -union auxent { - struct { - long x_tagndx; /* str, un, or enum tag indx */ - union { - struct { - unsigned short x_lnno; /* declaration line number */ - unsigned short x_size; /* str/union/array size */ - } x_lnsz; - long x_fsize; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - long x_lnnoptr; /* ptr to fcn line # */ - long x_endndx; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - unsigned short x_dimen[DIMNUM]; - } x_ary; - } x_fcnary; - unsigned short x_tvndx; /* tv index */ - } x_sym; - - /* This was just a struct x_file with x_fname only in a29k. xoxorich. */ - union { - char x_fname[FILNMLEN]; - struct { - long x_zeroes; - long x_offset; - } x_n; - } x_file; - - struct { - long x_scnlen; /* section length */ - unsigned short x_nreloc; /* # relocation entries */ - unsigned short x_nlinno; /* # line numbers */ - } x_scn; - - struct { - long x_tvfill; /* tv fill value */ - unsigned short x_tvlen; /* length of .tv */ - - /* This field was typo'd x_tvrna on a29k. xoxorich. */ - unsigned short x_tvran[2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - -#ifdef TC_I960 - /****************************************** - * I960-specific *2nd* aux. entry formats - ******************************************/ - struct { - /* This is a very old typo that keeps getting propogated. */ -#define x_stdindx x_stindx - long x_stindx; /* sys. table entry */ - } x_sc; /* system call entry */ - - struct { - unsigned long x_balntry; /* BAL entry point */ - } x_bal; /* BAL-callable function */ - - struct { - unsigned long x_timestamp; /* time stamp */ - char x_idstring[20]; /* producer identity string */ - } x_ident; /* Producer ident info */ - - char a[sizeof(struct syment)]; /* force auxent/syment sizes to match */ -#endif /* TC_I960 */ -}; - -#define AUXENT union auxent -#define AUXESZ sizeof(AUXENT) /* This had better also be sizeof(SYMENT) */ - -#if VAX || I960 -# define _ETEXT "_etext" -#else -# define _ETEXT "etext" -#endif - -/********************** RELOCATION DIRECTIVES **********************/ - -struct reloc { - long r_vaddr; /* Virtual address of reference */ - long r_symndx; /* Index into symbol table */ - unsigned short r_type; /* Relocation type */ -#ifdef TC_I960 - /* not used for a29k */ - char pad[2]; /* Unused */ -#endif /* TC_I960 */ -}; - -#define RELOC struct reloc -#define RELSZ sizeof(RELOC) - -#define R_ABS (0x00) /* reference is absolute */ - -#ifdef TC_I960 -#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) -#endif /* TC_I960 */ - -#ifdef TC_A29K -/* - * NOTE: All the "I" forms refer to Am29000 instruction - * formats. The linker is expected to know how the numeric - * information is split and/or aligned within the - * instruction word(s). R_BYTE works for instructions, too. - * - * If the parameter to a CONSTH instruction is a relocatable - * type, two relocation records are written. The first has - * an r_type of R_IHIHALF (33 octal) and a normal r_vaddr - * and r_symndx. The second relocation record has an r_type - * of R_IHCONST (34 octal), a normal r_vaddr (which is - * redundant), and an r_symndx containing the 32-bit - * constant offset to the relocation instead of the actual - * symbol table index. This second record is always - * written, even if the constant offset is zero. The - * constant fields of the instruction are set to zero. - */ - -#define R_IREL (0x18) /* instruction relative (jmp/call) */ -#define R_IABS (0x19) /* instruction absolute (jmp/call) */ -#define R_ILOHALF (0x1a) /* instruction low half (const) */ -#define R_IHIHALF (0x1b) /* instruction high half (consth) part 1 */ -#define R_IHCONST (0x1c) /* instruction high half (consth) part 2 - constant offset of R_IHIHALF relocation */ -#define R_BYTE (0x1d) /* relocatable byte value */ -#define R_HWORD (0x1e) /* relocatable halfword value */ -#define R_WORD (0x1f) /* relocatable word value */ -#define R_IGLBLRC (0x20) /* instruction global register RC */ -#define R_IGLBLRA (0x21) /* instruction global register RA */ -#define R_IGLBLRB (0x22) /* instruction global register RB */ -#endif /* TC_A29K */ - - -#define DEFAULT_DATA_SECTION_ALIGNMENT 4 -#define DEFAULT_BSS_SECTION_ALIGNMENT 4 -#define DEFAULT_TEXT_SECTION_ALIGNMENT 16 -/* For new sections we haven't heard of before */ -#define DEFAULT_SECTION_ALIGNMENT 4 - -#if defined(TC_I386) -/* - * X86 generic - * 8-bit offset reference in 8-bits - * 8-bit offset reference in 16-bits - * 12-bit segment reference - * auxiliary relocation entry - */ -#define R_OFF8 07 -#define R_OFF16 010 -#define R_SEG12 011 -#define R_AUX 013 - -/* - * B16 and X86 generics - * 16-bit direct reference - * 16-bit "relative" reference - * 16-bit "indirect" (TV) reference - */ -#define R_DIR16 01 -#define R_REL16 02 -#define R_IND16 03 - -/* - * 3B generic - * 24-bit direct reference - * 24-bit "relative" reference - * 16-bit optimized "indirect" TV reference - * 24-bit "indirect" TV reference - * 32-bit "indirect" TV reference - */ -#define R_DIR24 04 -#define R_REL24 05 -#define R_OPT16 014 -#define R_IND24 015 -#define R_IND32 016 - -/* - * XL generics - * 10-bit direct reference - * 10-bit "relative" reference - * 32-bit "relative" reference - */ -#define R_DIR10 025 -#define R_REL10 026 -#define R_REL32 027 - -/* - * 3B and M32 generics - * 32-bit direct reference - */ -#define R_DIR32 06 - -/* - * M32 generic - * 32-bit direct reference with bytes swapped - */ -#define R_DIR32S 012 - -#endif /* TC_I386 */ - -#if defined(TE_I386AIX) - -#define UINFOSIZ 64 /* size of user info buffer */ -typedef char uinfo_t[UINFOSIZ]; - -struct env387 { - unsigned short control; - unsigned short r0; - unsigned short status; - unsigned short r1; - unsigned short tag; - unsigned short r2; - unsigned long eip; - unsigned short code_seg; - unsigned short opcode; - unsigned long operand; - unsigned short operand_seg; - unsigned short r3; - unsigned char regs[8][10]; -}; - -#define CD_NAMELEN 16 /* length of most names in this header */ -#define CORHDRSIZ 2048 /* size to which header is padded out */ -#define MAX_CORE_SEGS 32 /* maximum segments in a core dump */ -#define NUM_FREGS 1 /* # of saved FP regs */ - -/* - * These are defined such that 286 and 386 kernels can produce - * compatible dumps. - */ -#define CD_AX 0 -#define CD_BX 1 -#define CD_CX 2 -#define CD_DX 3 -#define CD_SI 4 -#define CD_DI 5 -#define CD_BP 6 -#define CD_SP 7 -#define CD_FL 8 -#define CD_IP 9 -#define CD_CS 10 -#define CD_DS 11 -#define CD_ES 12 -#define CD_FS 13 -#define CD_GS 14 -#define CD_SS 15 -#define NUM_REGS 16 - -#ifndef SPATHLEN -# define SPATHLEN 16 /* sys/param.h */ -#endif -#ifndef NSIG -# define NSIG 63 /* sys/signal.h */ -# define SIGSETSZ ((NSIG+31)/32) -typedef struct ksigmask { - unsigned long sigs[SIGSETSZ]; -} ksigmask_t; -#endif - -struct corehdr { - char cd_magic[4]; /* COR_MAGIC = "core" */ - - /* general information about the dump itself */ - struct dumpseg { /* table of contents for dump */ - long cs_type; /* seg. type; see below */ - long cs_len; /* length (in bytes) of segment */ - long cs_offset; /* offset (in dump) of segment */ - long cs_address; /* address segment had in mem */ - } cd_segs[MAX_CORE_SEGS]; - - /* general information about the process */ - char cd_comm[CD_NAMELEN]; /* command being run */ - char cd_mach[CD_NAMELEN]; /* type of machine it ran on */ - char cd_site[CD_NAMELEN]; /* name of site it ran on */ - long cd_ldtype; /* type of load module running */ - char cd_intsize; /* sizeof(int) */ - char cd_dptrsize; /* sizeof(char *) */ - char cd_tptrsize; /* sizeof(int (*)()) */ - char cd_unused; - - /* user-mode program state */ - long cd_regs[NUM_REGS]; /* user-mode general registers */ - struct env387 cd_fpregs; /* user-mode floating-point state */ - - /* kernel-mode program state */ - int (*cd_sig[NSIG])(); /* disposition of signals */ - ksigmask_t cd_sigmask; /* signals to be blocked */ - ksigmask_t cd_sigpend; /* signals currently pending */ - long cd_cursig; /* signal that caused the dump */ - - long cd_pid; /* process ID of the corpse */ - long cd_ppid; /* parent process ID of corpse */ - short cd_uid; /* process effective user ID */ - short cd_ruid; /* process real user ID */ - short cd_gid; /* process effective group ID */ - short cd_rgid; /* process real group ID */ - - uinfo_t cd_uinfo; /* buffer of user information */ - char cd_locname[32]; /* name of /local */ - char cd_uvers[CD_NAMELEN]; /* user version string */ - unsigned short cd_spath[SPATHLEN]; /* sitepath */ -}; - -#ifndef NOCHECKS -/* this will generate an error if sizeof(struct corehdr) > CORHDRSIZ */ -struct { char xxcdxx[CORHDRSIZ+1-sizeof(struct corehdr)]; }; -#endif /* ! NOCHECKS */ - -/* - * segment types (in cs_type) - * each segment in the address space appears here, whether or not it - * is actually dumped. Read/only segments will not actually be dumped. - * A segment that is not in the dump will have a cs_offset of zero. - */ -#define COR_TYPE_CODE 'x' /* process code - NOT IN DUMP */ -#define COR_TYPE_DATA 'd' /* process data segment */ -#define COR_TYPE_STACK 's' /* process stack segment */ -#define COR_TYPE_LIBCODE 'X' /* shared lib code - NOT IN DUMP*/ -#define COR_TYPE_LIBDATA 'D' /* shared lib data */ -#define COR_TYPE_READ 'r' /* other read/only - NOT IN DUMP*/ -#define COR_TYPE_WRITE 'w' /* other writeable */ -#define COR_TYPE_MSC '?' /* other, mapped in segment */ - -#endif /* TE_I386AIX */ - -/* - * Local Variables: - * comment-column: 0 - * End: - */ - -/* end of coff.gnu.h */ diff --git a/gas/config/ho-a29k.h b/gas/config/ho-a29k.h deleted file mode 100755 index 683c4f7..0000000 --- a/gas/config/ho-a29k.h +++ /dev/null @@ -1,26 +0,0 @@ -/* ho-a29k.h Host-specific header file intended for "eb" board with - HIF. - - Copyright (C) 1987, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#define HO_A29K 1 - -#include <stdlib.h> - -/* end of ho-a29k.h */ diff --git a/gas/config/ho-cygnus.h b/gas/config/ho-cygnus.h deleted file mode 100755 index ad408d2..0000000 --- a/gas/config/ho-cygnus.h +++ /dev/null @@ -1,31 +0,0 @@ -/* ho-ansi.h Host-specific header file for generic ansi environments. - Copyright (C) 1987, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#define M_ANSI 1 - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <ctype.h> - -#define sys_nerr _sys_nerr -#define sys_errlist _sys_errlist -#define bzero(s,l) (memset((s),0,(l))) - -/* end of ho-cygnus.h */ diff --git a/gas/config/mh-a29k b/gas/config/mh-a29k deleted file mode 100755 index f8de0b9..0000000 --- a/gas/config/mh-a29k +++ /dev/null @@ -1 +0,0 @@ -CC = gcc -ba29k diff --git a/gas/config/mh-cygnus b/gas/config/mh-cygnus deleted file mode 100755 index 774d205..0000000 --- a/gas/config/mh-cygnus +++ /dev/null @@ -1,8 +0,0 @@ -CC = gcc -b$(target) -Wall -nostdinc -nostdlib \ - -I$(srcdir)/../clib/ansi/include -I$(srcdir)/../os-layer/include - -CLIB = $(srcdir)/../clib/Host-$(host)/Target-$(target)/libc.a \ - $(srcdir)/../gcc/Host-sun4/Target-$(target)/gnulib - -LDFLAGS = /lib/crt0.o - diff --git a/gas/config/obj-coff-bfd.c b/gas/config/obj-coff-bfd.c deleted file mode 100755 index b2cb035..0000000 --- a/gas/config/obj-coff-bfd.c +++ /dev/null @@ -1,2114 +0,0 @@ -/* coff object file format with bfd - Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc. - -This file is part of GAS. - -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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* - - How does this releate to the rest of GAS ? - - Well, all the other files in gas are more or less a black box. It - takes care of opening files, parsing command lines, stripping blanks - etc etc. This module gets a chance to register what it wants to do by - saying that it is interested in various pseduo ops. The other big - change is write_object_file. This runs through all the data - structures that gas builds, and outputs the file in the format of our - choice. - - Hacked for BFDness by steve chamberlain - - This object module now supports the Hitachi H8/300 and the AMD 29k - - sac@cygnus.com -*/ - -#include "as.h" -#include "obstack.h" -#include "subsegs.h" -#include "frags.h" -#include "../bfd/libbfd.h" - - -/* This vector is used to turn an internal segment into a section # - suitable for insertion into a coff symbol table - */ - -const short seg_N_TYPE[] = { /* in: segT out: N_TYPE bits */ - C_ABS_SECTION, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - C_UNDEF_SECTION, /* SEG_UNKNOWN */ - C_UNDEF_SECTION, /* SEG_ABSENT */ - C_UNDEF_SECTION, /* SEG_PASS1 */ - C_UNDEF_SECTION, /* SEG_GOOF */ - C_UNDEF_SECTION, /* SEG_BIG */ - C_UNDEF_SECTION, /* SEG_DIFFERENCE */ - C_DEBUG_SECTION, /* SEG_DEBUG */ - C_NTV_SECTION, /* SEG_NTV */ - C_PTV_SECTION, /* SEG_PTV */ - C_REGISTER_SECTION, /* SEG_REGISTER */ -}; - - -int function_lineoff = -1; /* Offset in line#s where the last function - started (the odd entry for line #0) */ - -int our_lineno_number = 0; /* we use this to build pointers from .bf's - into the linetable. It should match - exactly the values that are later - assigned in text_lineno_number by - write.c. */ - -int text_lineno_number = 0; - -/* Add 4 to the real value to get the index and compensate the - negatives. This vector is used by S_GET_SEGMENT to turn a coff - section number into a segment number -*/ -static symbolS *previous_file_symbol = NULL; -void c_symbol_merge(); - -symbolS *c_section_symbol(); -bfd *abfd; -void EXFUN(bfd_as_write_hook,(struct internal_filehdr *, - bfd *abfd)); - -static void EXFUN(fixup_segment,(fixS * fixP, - segT this_segment_type)); - -static void EXFUN(fill_section,(bfd *abfd , - struct internal_filehdr *f, unsigned - long *)); - - -char *EXFUN(s_get_name,(symbolS *s)); -static symbolS *EXFUN(tag_find_or_make,(char *name)); -static symbolS* EXFUN(tag_find,(char *name)); - - -static int -EXFUN(c_line_new,( - symbolS *symbol, - long paddr, - unsigned short line_number, - fragS* frag)); - - -static void EXFUN(w_symbols, - (bfd *abfd , - char *where , - symbolS *symbol_rootP)); - - - -static void EXFUN( obj_coff_def,(int what)); -static void EXFUN( obj_coff_lcomm,(void)); -static void EXFUN( obj_coff_dim,(void)); -static void EXFUN( obj_coff_text,(void)); -static void EXFUN( obj_coff_data,(void)); -static void EXFUN( obj_coff_endef,(void)); -static void EXFUN( obj_coff_line,(void)); -static void EXFUN( obj_coff_ln,(void)); -static void EXFUN( obj_coff_scl,(void)); -static void EXFUN( obj_coff_size,(void)); -static void EXFUN( obj_coff_tag,(void)); -static void EXFUN( obj_coff_type,(void)); -static void EXFUN( obj_coff_val,(void)); -static void EXFUN( obj_coff_section,(void)); -static void EXFUN( tag_init,(void)); -static void EXFUN( tag_insert,(char *name, symbolS *symbolP)); - - -static struct hash_control *tag_hash; -static symbolS *def_symbol_in_progress = NULL; - -const pseudo_typeS obj_pseudo_table[] = { - { "def", obj_coff_def, 0 }, - { "dim", obj_coff_dim, 0 }, - { "endef", obj_coff_endef, 0 }, - { "line", obj_coff_line, 0 }, - { "ln", obj_coff_ln, 0 }, - { "scl", obj_coff_scl, 0 }, - { "size", obj_coff_size, 0 }, - { "tag", obj_coff_tag, 0 }, - { "type", obj_coff_type, 0 }, - { "val", obj_coff_val, 0 }, - { "section", obj_coff_section, 0 }, - { "text", obj_coff_text, 0 }, - { "data", obj_coff_data, 0 }, - /* we don't yet handle this. */ - { "ident", s_ignore, 0 }, - { "ABORT", s_abort, 0 }, - { "lcomm", obj_coff_lcomm, 0}, - { NULL} /* end sentinel */ -}; /* obj_pseudo_table */ - - - -/* Section stuff - - We allow more than just the standard 3 sections, infact, we allow - 10 sections, (though the usual three have to be there). - - This structure performs the mappings for us: - -*/ - -/* OBS stuff -static struct internal_scnhdr bss_section_header; -struct internal_scnhdr data_section_header; -struct internal_scnhdr text_section_header; - -const segT N_TYPE_seg [32] = -{ - -}; - -*/ - -#define N_SEG 32 -typedef struct -{ - segT seg_t; -int i; -} seg_info_type; - -seg_info_type seg_info_off_by_4[N_SEG] = -{ -{SEG_PTV, }, -{SEG_NTV, }, -{SEG_DEBUG, }, -{SEG_ABSOLUTE, }, -{SEG_UNKNOWN, }, -{SEG_E0}, -{SEG_E1}, -{SEG_E2}, -{SEG_E3}, -{SEG_E4}, -{SEG_E5}, -{SEG_E6}, -{SEG_E7}, -{SEG_E8}, -{SEG_E9}, -{15}, -{16}, -{17}, -{18}, -{19}, -{20}, -{0}, -{0}, -{0}, -{SEG_REGISTER},0,0,0,0}; - -#define SEG_INFO_FROM_SECTION_NUMBER(x) (seg_info_off_by_4[(x)+4]) -#define SEG_INFO_FROM_SEG_NUMBER(x) (seg_info_off_by_4[(x)]) - - -static relax_addressT -DEFUN(relax_align,(address, alignment), -register relax_addressT address AND -register long alignment ) -{ - relax_addressT mask; - relax_addressT new_address; - - mask = ~ ( (~0) << alignment ); - new_address = (address + mask) & (~ mask); - return (new_address - address); -} /* relax_align() */ - - -segT -DEFUN(s_get_segment,(x) , -symbolS* x) -{ - 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 DEFUN(size_section,(abfd, idx), - bfd *abfd AND - unsigned int idx) -{ - - unsigned int size = 0; - fragS *frag = segment_info[idx].frchainP->frch_root; - while (frag) { - if (frag->fr_address != size) { - printf("Out of step\n"); - size = frag->fr_address; - } - size += frag->fr_fix; - switch (frag->fr_type) { - case rs_fill: - case rs_org: - size += frag->fr_offset * frag->fr_var; - break; - case rs_align: - size += relax_align(size, frag->fr_offset); - } - frag = frag->fr_next; - } - segment_info[idx].scnhdr.s_size = size; - return size; -} - - -static unsigned int DEFUN(count_entries_in_chain,(idx), - unsigned int idx) -{ - unsigned int nrelocs; - fixS *fixup_ptr; - - /* Count the relocations */ - fixup_ptr = segment_info[idx].fix_root; - nrelocs = 0; - while (fixup_ptr != (fixS *)NULL) - { - if (TC_COUNT_RELOC(fixup_ptr)) - { - -#ifdef TC_A29K - - if (fixup_ptr->fx_r_type == RELOC_CONSTH) - nrelocs+=2; - else - nrelocs++; -#else - nrelocs++; -#endif - } - - fixup_ptr = fixup_ptr->fx_next; - } - return nrelocs; -} - -/* output all the relocations for a section */ -void DEFUN(do_relocs_for,(abfd, file_cursor), - bfd *abfd AND - unsigned long *file_cursor) -{ - unsigned int nrelocs; - - - - unsigned int idx; - - - - - for (idx = SEG_E0; idx < SEG_E9; idx++) - { - if (segment_info[idx].scnhdr.s_name[0]) - { - - struct external_reloc *ext_ptr; - struct external_reloc *external_reloc_vec; - unsigned int external_reloc_size; - unsigned int count = 0; - unsigned int base = segment_info[idx].scnhdr.s_paddr; - fixS * fix_ptr = segment_info[idx].fix_root; - nrelocs = count_entries_in_chain(idx); - external_reloc_size = nrelocs * RELSZ; - external_reloc_vec = - (struct external_reloc*)malloc(external_reloc_size); - - - - ext_ptr = external_reloc_vec; - - /* Fill in the internal coff style reloc struct from the - internal fix list */ - while (fix_ptr) - { - symbolS *symbol_ptr; - struct internal_reloc intr; - - /* Only output some of the relocations */ - if (TC_COUNT_RELOC(fix_ptr)) - { - symbolS *dot; - symbol_ptr = fix_ptr->fx_addsy; - - intr.r_type = TC_COFF_FIX2RTYPE(fix_ptr); - intr.r_vaddr = base + fix_ptr->fx_frag->fr_address + fix_ptr->fx_where ; - - - /* Turn the segment of the symbol into an offset - */ - dot = - segment_info[S_GET_SEGMENT(symbol_ptr)].dot; - - if (dot) - { - intr.r_symndx = dot->sy_number; - } - else - { - intr.r_symndx = symbol_ptr->sy_number; - } - - - (void)bfd_coff_swap_reloc_out(abfd, &intr, ext_ptr); - ext_ptr++; - -#if defined(TC_A29K) - /* The 29k has a special kludge for the high 16 bit reloc. - Two relocations are emmited, R_IHIHALF, and - R_IHCONST. The second one doesn't contain a symbol, - but uses the value for offset */ - - if (intr.r_type == R_IHIHALF) - { - /* now emit the second bit */ - intr.r_type = R_IHCONST; - intr.r_symndx = fix_ptr->fx_addnumber; - (void)bfd_coff_swap_reloc_out(abfd,&intr,ext_ptr); - ext_ptr++; - } -#endif - } - - fix_ptr = fix_ptr->fx_next; - } - - /* Write out the reloc table */ - segment_info[idx].scnhdr.s_relptr = *file_cursor; - segment_info[idx].scnhdr.s_nreloc = nrelocs; - bfd_write((PTR)external_reloc_vec, 1, external_reloc_size, abfd); - *file_cursor += external_reloc_size; - free( external_reloc_vec); - } - } -} - - -/* run through a frag chain and write out the data to go with it, fill - in the scnhdrs with the info on the file postions -*/ -static void DEFUN(fill_section,(abfd, filehdr, file_cursor), - bfd *abfd AND - struct internal_filehdr *filehdr AND - unsigned long *file_cursor) -{ - - unsigned int i; - unsigned int paddr = 0; - - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - unsigned int offset = 0; - - struct internal_scnhdr *s = &( segment_info[i].scnhdr); - - if (s->s_name[0]) - { - fragS *frag = segment_info[i].frchainP->frch_root; - char *buffer = malloc(s->s_size); - s->s_scnptr = *file_cursor; - s->s_paddr = paddr; - s->s_vaddr = paddr; - - s->s_flags = STYP_REG; - if (strcmp(s->s_name,".text")==0) - s->s_flags |= STYP_TEXT; - else if (strcmp(s->s_name,".data")==0) - s->s_flags |= STYP_DATA; - else if (strcmp(s->s_name,".bss")==0) - s->s_flags |= STYP_BSS | STYP_NOLOAD; - - while (frag) { - unsigned int fill_size; - switch (frag->fr_type) { - - case rs_fill: - case rs_align: - case rs_org: - if(frag->fr_fix) - { - memcpy(buffer + frag->fr_address, - frag->fr_literal, - frag->fr_fix); - offset += frag->fr_fix; - } - - fill_size = frag->fr_var; - if (fill_size) - { - unsigned int count ; - unsigned int off = frag->fr_fix; - for (count = frag->fr_offset; count; count--) - { - memcpy(buffer + frag->fr_address + off, - frag->fr_literal + frag->fr_fix, - fill_size); - off += fill_size; - offset += fill_size; - - } - - } - break; - default: - abort(); - } - frag = frag->fr_next; - } - - - bfd_write(buffer, s->s_size,1,abfd); - free(buffer); - - *file_cursor += s->s_size; - paddr += s->s_size; - } - } - -} - - - -/* Coff file generation & utilities */ - - -static void -DEFUN(coff_header_append,(abfd, filehdr, aouthdr), - bfd *abfd AND - struct internal_filehdr *filehdr AND - struct internal_aouthdr *aouthdr) -{ - unsigned int i; - char buffer[1000]; - char buffero[1000]; - - bfd_seek(abfd, 0, 0); -#if 0 - filehdr.f_opthdr = bfd_coff_swap_aouthdr_out(abfd, aouthdr, - buffero); -#else - filehdr->f_opthdr = 0; -#endif - i = bfd_coff_swap_filehdr_out(abfd, filehdr, buffer); - - bfd_write(buffer, i ,1, abfd); - bfd_write(buffero, filehdr->f_opthdr, 1, abfd); - - for (i = SEG_E0; i < SEG_E9; i++) - { - if (segment_info[i].scnhdr.s_name[0]) - { - unsigned int size = - bfd_coff_swap_scnhdr_out(abfd, - &(segment_info[i].scnhdr), - buffer); - bfd_write(buffer, size, 1, abfd); - } - } -} - - -char * -DEFUN(symbol_to_chars,(abfd, where, symbolP), - bfd*abfd AND - char *where AND - symbolS *symbolP) -{ - unsigned int numaux = symbolP->sy_symbol.ost_entry.n_numaux; - unsigned int i; - - /* Turn any symbols with register attributes into abs symbols */ - if (S_GET_SEGMENT(symbolP) == SEG_REGISTER) - { - S_SET_SEGMENT(symbolP, SEG_ABSOLUTE); - } - /* At the same time, relocate all symbols to their output value */ - - S_SET_VALUE(symbolP, - segment_info[S_GET_SEGMENT(symbolP)].scnhdr.s_paddr - + S_GET_VALUE(symbolP)); - - where += bfd_coff_swap_sym_out(abfd, &symbolP->sy_symbol.ost_entry, - where); - - for (i = 0; i < numaux; i++) - { - where += bfd_coff_swap_aux_out(abfd, - &symbolP->sy_symbol.ost_auxent[i], - S_GET_DATA_TYPE(symbolP), - S_GET_STORAGE_CLASS(symbolP), - where); - } - return where; - -} - - - - -void obj_symbol_new_hook(symbolP) -symbolS *symbolP; -{ - char underscore = 0; /* Symbol has leading _ */ - - /* Effective symbol */ - /* Store the pointer in the offset. */ - S_SET_ZEROES(symbolP, 0L); - S_SET_DATA_TYPE(symbolP, T_NULL); - S_SET_STORAGE_CLASS(symbolP, 0); - S_SET_NUMBER_AUXILIARY(symbolP, 0); - /* Additional information */ - symbolP->sy_symbol.ost_flags = 0; - /* Auxiliary entries */ - bzero((char*)&symbolP->sy_symbol.ost_auxent[0], AUXESZ); - -#ifdef STRIP_UNDERSCORE - /* Remove leading underscore at the beginning of the symbol. - * This is to be compatible with the standard librairies. - */ - if (*S_GET_NAME(symbolP) == '_') { - underscore = 1; - S_SET_NAME(symbolP, S_GET_NAME(symbolP) + 1); - } /* strip underscore */ -#endif /* STRIP_UNDERSCORE */ - - if (S_IS_STRING(symbolP)) - SF_SET_STRING(symbolP); - if (!underscore && S_IS_LOCAL(symbolP)) - SF_SET_LOCAL(symbolP); - - return; -} /* obj_symbol_new_hook() */ - - /* stack stuff */ -stack* stack_init(chunk_size, element_size) -unsigned long chunk_size; -unsigned long element_size; -{ - stack* st; - - if ((st = (stack*)malloc(sizeof(stack))) == (stack*)0) - return (stack*)0; - if ((st->data = malloc(chunk_size)) == (char*)0) { - free(st); - return (stack*)0; - } - st->pointer = 0; - st->size = chunk_size; - st->chunk_size = chunk_size; - st->element_size = element_size; - return st; -} /* stack_init() */ - -void stack_delete(st) -stack* st; -{ - free(st->data); - free(st); -} - -char *stack_push(st, element) -stack *st; -char *element; -{ - if (st->pointer + st->element_size >= st->size) { - st->size += st->chunk_size; - if ((st->data = xrealloc(st->data, st->size)) == (char*)0) - return (char*)0; - } - memcpy(st->data + st->pointer, element, st->element_size); - st->pointer += st->element_size; - return st->data + st->pointer; -} /* stack_push() */ - -char* stack_pop(st) -stack* st; -{ - if ((st->pointer -= st->element_size) < 0) { - st->pointer = 0; - return (char*)0; - } - - return st->data + st->pointer; -} - -char* stack_top(st) -stack* st; -{ - return st->data + st->pointer - st->element_size; -} - - -/* - * Handle .ln directives. - */ - -static void obj_coff_ln() { - if (def_symbol_in_progress != NULL) { - as_warn(".ln pseudo-op inside .def/.endef: ignored."); - demand_empty_rest_of_line(); - return; - } /* wrong context */ - - c_line_new(0, - obstack_next_free(&frags) - frag_now->fr_literal, - get_absolute_expression(), - frag_now); - - demand_empty_rest_of_line(); - return; -} /* obj_coff_line() */ - -/* - * def() - * - * Handle .def directives. - * - * One might ask : why can't we symbol_new if the symbol does not - * already exist and fill it with debug information. Because of - * the C_EFCN special symbol. It would clobber the value of the - * function symbol before we have a chance to notice that it is - * a C_EFCN. And a second reason is that the code is more clear this - * way. (at least I think it is :-). - * - */ - -#define SKIP_SEMI_COLON() while (*input_line_pointer++ != ';') -#define SKIP_WHITESPACES() while (*input_line_pointer == ' ' || \ - *input_line_pointer == '\t') \ - input_line_pointer++; - -static void -DEFUN(obj_coff_def,(what), - int what) -{ - char name_end; /* Char after the end of name */ - char *symbol_name; /* Name of the debug symbol */ - char *symbol_name_copy; /* Temporary copy of the name */ - unsigned int symbol_name_length; - /*$char* directiveP;$ */ /* Name of the pseudo opcode */ - /*$char directive[MAX_DIRECTIVE];$ */ /* Backup of the directive */ - /*$char end = 0;$ */ /* If 1, stop parsing */ - - if (def_symbol_in_progress != NULL) { - as_warn(".def pseudo-op used inside of .def/.endef: ignored."); - demand_empty_rest_of_line(); - return; - } /* if not inside .def/.endef */ - - SKIP_WHITESPACES(); - - def_symbol_in_progress = (symbolS *) obstack_alloc(¬es, sizeof(*def_symbol_in_progress)); - bzero(def_symbol_in_progress, sizeof(*def_symbol_in_progress)); - - symbol_name = input_line_pointer; - name_end = get_symbol_end(); - symbol_name_length = strlen(symbol_name); - symbol_name_copy = xmalloc(symbol_name_length + 1); - strcpy(symbol_name_copy, symbol_name); - - /* Initialize the new symbol */ -#ifdef STRIP_UNDERSCORE - S_SET_NAME(def_symbol_in_progress, (*symbol_name_copy == '_' - ? symbol_name_copy + 1 - : symbol_name_copy)); -#else /* STRIP_UNDERSCORE */ - S_SET_NAME(def_symbol_in_progress, symbol_name_copy); -#endif /* STRIP_UNDERSCORE */ - /* free(symbol_name_copy); */ - def_symbol_in_progress->sy_name_offset = ~0; - def_symbol_in_progress->sy_number = ~0; - def_symbol_in_progress->sy_frag = &zero_address_frag; - - if (S_IS_STRING(def_symbol_in_progress)) { - SF_SET_STRING(def_symbol_in_progress); - } /* "long" name */ - - *input_line_pointer = name_end; - - demand_empty_rest_of_line(); - return; -} /* obj_coff_def() */ - -unsigned int dim_index; -static void -DEFUN_VOID(obj_coff_endef) -{ - symbolS *symbolP = 0; - /* DIM BUG FIX sac@cygnus.com */ - dim_index =0; - if (def_symbol_in_progress == NULL) { - as_warn(".endef pseudo-op used outside of .def/.endef: ignored."); - demand_empty_rest_of_line(); - return; - } /* if not inside .def/.endef */ - - /* Set the section number according to storage class. */ - switch (S_GET_STORAGE_CLASS(def_symbol_in_progress)) { - case C_STRTAG: - case C_ENTAG: - case C_UNTAG: - SF_SET_TAG(def_symbol_in_progress); - /* intentional fallthrough */ - case C_FILE: - case C_TPDEF: - SF_SET_DEBUG(def_symbol_in_progress); - S_SET_SEGMENT(def_symbol_in_progress, SEG_DEBUG); - break; - - case C_EFCN: - SF_SET_LOCAL(def_symbol_in_progress); /* Do not emit this symbol. */ - /* intentional fallthrough */ - case C_BLOCK: - SF_SET_PROCESS(def_symbol_in_progress); /* Will need processing before writing */ - /* intentional fallthrough */ - case C_FCN: - S_SET_SEGMENT(def_symbol_in_progress, SEG_E0); - - if (def_symbol_in_progress->sy_symbol.ost_entry.n_name[1] == 'b') { /* .bf */ - if (function_lineoff < 0) { - fprintf(stderr, "`.bf' symbol without preceding function\n"); - } /* missing function symbol */ - SA_GET_SYM_LNNOPTR(def_symbol_in_progress) = function_lineoff; - SF_SET_PROCESS(def_symbol_in_progress); /* Will need relocating */ - function_lineoff = -1; - } - break; - -#ifdef C_AUTOARG - case C_AUTOARG: -#endif /* C_AUTOARG */ - case C_AUTO: - case C_REG: - case C_MOS: - case C_MOE: - case C_MOU: - case C_ARG: - case C_REGPARM: - case C_FIELD: - case C_EOS: - SF_SET_DEBUG(def_symbol_in_progress); - S_SET_SEGMENT(def_symbol_in_progress, SEG_ABSOLUTE); - break; - - case C_EXT: - case C_STAT: - case C_LABEL: - /* Valid but set somewhere else (s_comm, s_lcomm, colon) */ - break; - - case C_USTATIC: - case C_EXTDEF: - case C_ULABEL: - as_warn("unexpected storage class %d", S_GET_STORAGE_CLASS(def_symbol_in_progress)); - break; - } /* switch on storage class */ - - /* Now that we have built a debug symbol, try to - find if we should merge with an existing symbol - or not. If a symbol is C_EFCN or SEG_ABSOLUTE or - untagged SEG_DEBUG it never merges. */ - - /* Two cases for functions. Either debug followed - by definition or definition followed by debug. - For definition first, we will merge the debug - symbol into the definition. For debug first, the - lineno entry MUST point to the definition - function or else it will point off into space - when crawl_symbols() merges the debug - symbol into the real symbol. Therefor, let's - presume the debug symbol is a real function - reference. */ - - /* FIXME-SOON If for some reason the definition - label/symbol is never seen, this will probably - leave an undefined symbol at link time. */ - - if (S_GET_STORAGE_CLASS(def_symbol_in_progress) == C_EFCN - || (S_GET_SEGMENT(def_symbol_in_progress) == SEG_DEBUG - && !SF_GET_TAG(def_symbol_in_progress)) - || S_GET_SEGMENT(def_symbol_in_progress) == SEG_ABSOLUTE - || (symbolP = symbol_find_base(S_GET_NAME(def_symbol_in_progress), DO_NOT_STRIP)) == NULL) { - - symbol_append(def_symbol_in_progress, symbol_lastP, &symbol_rootP, &symbol_lastP); - - } else { - /* This symbol already exists, merge the - newly created symbol into the old one. - This is not mandatory. The linker can - handle duplicate symbols correctly. But I - guess that it save a *lot* of space if - the assembly file defines a lot of - symbols. [loic] */ - - /* The debug entry (def_symbol_in_progress) - is merged into the previous definition. */ - - c_symbol_merge(def_symbol_in_progress, symbolP); - /* FIXME-SOON Should *def_symbol_in_progress be free'd? xoxorich. */ - def_symbol_in_progress = symbolP; - - if (SF_GET_FUNCTION(def_symbol_in_progress) - || SF_GET_TAG(def_symbol_in_progress)) { - /* For functions, and tags, 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) { - symbol_remove(def_symbol_in_progress, &symbol_rootP, &symbol_lastP); - symbol_append(def_symbol_in_progress, symbol_lastP, &symbol_rootP, &symbol_lastP); - } /* if not already in place */ - } /* if function */ - } /* normal or mergable */ - - if (SF_GET_TAG(def_symbol_in_progress) - && symbol_find_base(S_GET_NAME(def_symbol_in_progress), DO_NOT_STRIP) == NULL) { - tag_insert(S_GET_NAME(def_symbol_in_progress), def_symbol_in_progress); - } /* If symbol is a {structure,union} tag, associate symbol to its name. */ - - if (SF_GET_FUNCTION(def_symbol_in_progress)) { - know(sizeof(def_symbol_in_progress) <= sizeof(long)); - function_lineoff - = c_line_new((long) - def_symbol_in_progress,0, 0, &zero_address_frag); - - - - SF_SET_PROCESS(def_symbol_in_progress); - - if (symbolP == NULL) { - /* That is, if this is the first - time we've seen the function... */ - symbol_table_insert(def_symbol_in_progress); - } /* definition follows debug */ - } /* Create the line number entry pointing to the function being defined */ - - def_symbol_in_progress = NULL; - demand_empty_rest_of_line(); - return; -} /* obj_coff_endef() */ - -static void -DEFUN_VOID(obj_coff_dim) -{ - register int dim_index; - - if (def_symbol_in_progress == NULL) - { - as_warn(".dim pseudo-op used outside of .def/.endef: ignored."); - demand_empty_rest_of_line(); - return; - } /* if not inside .def/.endef */ - - S_SET_NUMBER_AUXILIARY(def_symbol_in_progress, 1); - - for (dim_index = 0; dim_index < DIMNUM; dim_index++) - { - SKIP_WHITESPACES(); - SA_SET_SYM_DIMEN(def_symbol_in_progress, dim_index, get_absolute_expression()); - - switch (*input_line_pointer) - { - - case ',': - input_line_pointer++; - break; - - default: - as_warn("badly formed .dim directive ignored"); - /* intentional fallthrough */ - case '\n': - case ';': - dim_index = DIMNUM; - break; - } /* switch on following character */ - } /* for each dimension */ - - demand_empty_rest_of_line(); - return; -} /* obj_coff_dim() */ - -static void obj_coff_line() { - if (def_symbol_in_progress == NULL) { - obj_coff_ln(); - return; - } /* if it looks like a stabs style line */ - - S_SET_NUMBER_AUXILIARY(def_symbol_in_progress, 1); - SA_SET_SYM_LNNO(def_symbol_in_progress, get_absolute_expression()); - - demand_empty_rest_of_line(); - return; -} /* obj_coff_line() */ - -static void obj_coff_size() { - if (def_symbol_in_progress == NULL) { - as_warn(".size pseudo-op used outside of .def/.endef ignored."); - demand_empty_rest_of_line(); - return; - } /* if not inside .def/.endef */ - - S_SET_NUMBER_AUXILIARY(def_symbol_in_progress, 1); - SA_SET_SYM_SIZE(def_symbol_in_progress, get_absolute_expression()); - demand_empty_rest_of_line(); - return; -} /* obj_coff_size() */ - -static void obj_coff_scl() { - if (def_symbol_in_progress == NULL) { - as_warn(".scl pseudo-op used outside of .def/.endef ignored."); - demand_empty_rest_of_line(); - return; - } /* if not inside .def/.endef */ - - S_SET_STORAGE_CLASS(def_symbol_in_progress, get_absolute_expression()); - demand_empty_rest_of_line(); - return; -} /* obj_coff_scl() */ - -static void obj_coff_tag() { - char *symbol_name; - char name_end; - - if (def_symbol_in_progress == NULL) { - as_warn(".tag pseudo-op used outside of .def/.endef ignored."); - demand_empty_rest_of_line(); - return; - } /* if not inside .def/.endef */ - - S_SET_NUMBER_AUXILIARY(def_symbol_in_progress, 1); - symbol_name = input_line_pointer; - name_end = get_symbol_end(); - - /* 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, (long) tag_find_or_make(symbol_name)); - if (SA_GET_SYM_TAGNDX(def_symbol_in_progress) == 0L) { - as_warn("tag not found for .tag %s", symbol_name); - } /* not defined */ - - SF_SET_TAGGED(def_symbol_in_progress); - *input_line_pointer = name_end; - - demand_empty_rest_of_line(); - return; -} /* obj_coff_tag() */ - -static void obj_coff_type() { - if (def_symbol_in_progress == NULL) { - as_warn(".type pseudo-op used outside of .def/.endef ignored."); - demand_empty_rest_of_line(); - return; - } /* if not inside .def/.endef */ - - S_SET_DATA_TYPE(def_symbol_in_progress, get_absolute_expression()); - - if (ISFCN(S_GET_DATA_TYPE(def_symbol_in_progress)) && - S_GET_STORAGE_CLASS(def_symbol_in_progress) != C_TPDEF) { - SF_SET_FUNCTION(def_symbol_in_progress); - } /* is a function */ - - demand_empty_rest_of_line(); - return; -} /* obj_coff_type() */ - -static void obj_coff_val() { - if (def_symbol_in_progress == NULL) { - as_warn(".val pseudo-op used outside of .def/.endef ignored."); - demand_empty_rest_of_line(); - return; - } /* if not inside .def/.endef */ - - if (is_name_beginner(*input_line_pointer)) { - char *symbol_name = input_line_pointer; - char name_end = get_symbol_end(); - - if (!strcmp(symbol_name, ".")) { - def_symbol_in_progress->sy_frag = frag_now; - S_SET_VALUE(def_symbol_in_progress, obstack_next_free(&frags) - frag_now->fr_literal); - /* If the .val is != from the .def (e.g. statics) */ - } else if (strcmp(S_GET_NAME(def_symbol_in_progress), symbol_name)) { - def_symbol_in_progress->sy_forward = symbol_find_or_make(symbol_name); - - /* If the segment is undefined when the forward - reference is solved, then copy the segment id - from the forward symbol. */ - SF_SET_GET_SEGMENT(def_symbol_in_progress); - } - /* Otherwise, it is the name of a non debug symbol and its value will be calculated later. */ - *input_line_pointer = name_end; - } else { - S_SET_VALUE(def_symbol_in_progress, get_absolute_expression()); - } /* if symbol based */ - - demand_empty_rest_of_line(); - return; -} /* obj_coff_val() */ - -/* - * Maintain a list of the tagnames of the structres. - */ - -static void tag_init() { - tag_hash = hash_new(); - return ; -} /* tag_init() */ - -static void tag_insert(name, symbolP) -char *name; -symbolS *symbolP; -{ - register char * error_string; - - if (*(error_string = hash_jam(tag_hash, name, (char *)symbolP))) { - as_fatal("Inserting \"%s\" into structure table failed: %s", - name, error_string); - } - return ; -} /* tag_insert() */ - -static symbolS *tag_find_or_make(name) -char *name; -{ - symbolS *symbolP; - - if ((symbolP = tag_find(name)) == NULL) { - symbolP = symbol_new(name, - SEG_UNKNOWN, - 0, - &zero_address_frag); - - tag_insert(S_GET_NAME(symbolP), symbolP); - symbol_table_insert(symbolP); - } /* not found */ - - return(symbolP); -} /* tag_find_or_make() */ - -static symbolS *tag_find(name) -char *name; -{ -#ifdef STRIP_UNDERSCORE - if (*name == '_') name++; -#endif /* STRIP_UNDERSCORE */ - return((symbolS*)hash_find(tag_hash, name)); -} /* tag_find() */ - -void obj_read_begin_hook() { - /* These had better be the same. Usually 18 bytes. */ -#ifndef BFD_HEADERS - know(sizeof(SYMENT) == sizeof(AUXENT)); - know(SYMESZ == AUXESZ); -#endif - tag_init(); - - return; -} /* obj_read_begin_hook() */ - -/* This function runs through the symbol table and puts all the - externals onto another chain */ - -/* The chain of externals */ -symbolS *symbol_externP = NULL; -symbolS *symbol_extern_lastP = NULL; - -stack*block_stack; - symbolS *last_functionP = NULL; - symbolS *last_tagP; - - -static unsigned int DEFUN_VOID(yank_symbols) -{ - symbolS *symbolP; - unsigned int symbol_number =0; - - for (symbolP = symbol_rootP; - symbolP; - symbolP = symbolP ? symbol_next(symbolP) : symbol_rootP) { - if (!SF_GET_DEBUG(symbolP)) { - /* Debug symbols do not need all this rubbish */ - symbolS* real_symbolP; - - /* L* and C_EFCN symbols never merge. */ - if (!SF_GET_LOCAL(symbolP) - && (real_symbolP = symbol_find_base(S_GET_NAME(symbolP), DO_NOT_STRIP)) - && real_symbolP != symbolP) { - /* FIXME-SOON: where do dups come from? - Maybe tag references before definitions? xoxorich. */ - /* Move the debug data from the debug symbol to the - real symbol. Do NOT do the oposite (i.e. move from - real symbol to debug symbol and remove real symbol from the - list.) Because some pointers refer to the real symbol - whereas no pointers refer to the debug symbol. */ - c_symbol_merge(symbolP, real_symbolP); - /* Replace the current symbol by the real one */ - /* The symbols will never be the last or the first - because : 1st symbol is .file and 3 last symbols are - .text, .data, .bss */ - symbol_remove(real_symbolP, &symbol_rootP, &symbol_lastP); - symbol_insert(real_symbolP, symbolP, &symbol_rootP, &symbol_lastP); - symbol_remove(symbolP, &symbol_rootP, &symbol_lastP); - symbolP = real_symbolP; - } /* if not local but dup'd */ - - if (flagseen['R'] && (S_GET_SEGMENT(symbolP) == SEG_E1)) { - S_SET_SEGMENT(symbolP, SEG_E0); - } /* push data into text */ - - S_SET_VALUE(symbolP, - S_GET_VALUE(symbolP) + symbolP->sy_frag->fr_address); - - if (!S_IS_DEFINED(symbolP) && !SF_GET_LOCAL(symbolP)) - { - S_SET_EXTERNAL(symbolP); - } - else if (S_GET_STORAGE_CLASS(symbolP) == C_NULL) - { - if (S_GET_SEGMENT(symbolP) == SEG_E0) - { - S_SET_STORAGE_CLASS(symbolP, C_LABEL); - } - else - { - S_SET_STORAGE_CLASS(symbolP, C_STAT); - } - } - - /* Mainly to speed up if not -g */ - if (SF_GET_PROCESS(symbolP)) - { - /* Handle the nested blocks auxiliary info. */ - if (S_GET_STORAGE_CLASS(symbolP) == C_BLOCK) { - if (!strcmp(S_GET_NAME(symbolP), ".bb")) - stack_push(block_stack, (char *) &symbolP); - else { /* .eb */ - register symbolS* begin_symbolP; - begin_symbolP = *(symbolS**)stack_pop(block_stack); - if (begin_symbolP == (symbolS*)0) - as_warn("mismatched .eb"); - else - SA_SET_SYM_ENDNDX(begin_symbolP, symbol_number+2); - } - } - /* If we are able to identify the type of a function, and we - are out of a function (last_functionP == 0) then, the - function symbol will be associated with an auxiliary - entry. */ - if (last_functionP == (symbolS*)0 && - SF_GET_FUNCTION(symbolP)) { - last_functionP = symbolP; - - if (S_GET_NUMBER_AUXILIARY(symbolP) < 1) { - S_SET_NUMBER_AUXILIARY(symbolP, 1); - } /* make it at least 1 */ - - /* Clobber possible stale .dim information. */ - bzero(symbolP->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen, - sizeof(symbolP->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen)); - } - /* The C_FCN doesn't need any additional information. - I don't even know if this is needed for sdb. But the - standard assembler generates it, so... - */ - if (S_GET_STORAGE_CLASS(symbolP) == C_EFCN) { - if (last_functionP == (symbolS*)0) - as_fatal("C_EFCN symbol out of scope"); - SA_SET_SYM_FSIZE(last_functionP, - (long)(S_GET_VALUE(symbolP) - - S_GET_VALUE(last_functionP))); - SA_SET_SYM_ENDNDX(last_functionP, symbol_number); - last_functionP = (symbolS*)0; - } - } - } else if (SF_GET_TAG(symbolP)) { - /* First descriptor of a structure must point to - the first slot after the structure description. */ - last_tagP = symbolP; - - } else if (S_GET_STORAGE_CLASS(symbolP) == C_EOS) { - /* +2 take in account the current symbol */ - SA_SET_SYM_ENDNDX(last_tagP, symbol_number + 2); - } else if (S_GET_STORAGE_CLASS(symbolP) == C_FILE) { - if (S_GET_VALUE(symbolP)) { - S_SET_VALUE((symbolS *) S_GET_VALUE(symbolP), symbol_number); - S_SET_VALUE(symbolP, 0); - } /* no one points at the first .file symbol */ - } /* if debug or tag or eos or file */ - - /* 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 - if an external symbol is removed between .bb and .be. - I.e in the following case : - [20] .bb endndx = 22 - [21] foo external - [22] .be - ld will move the symbol 21 to the end of the list but - endndx will still be 22 instead of 21. */ - - - if (SF_GET_LOCAL(symbolP)) { - /* remove C_EFCN and LOCAL (L...) symbols */ - /* next pointer remains valid */ - symbol_remove(symbolP, &symbol_rootP, &symbol_lastP); - - } - else if (!S_IS_DEFINED(symbolP) - && !S_IS_DEBUG(symbolP) - && !SF_GET_STATICS(symbolP) && - S_GET_STORAGE_CLASS(symbolP) == C_EXT) - { /* C_EXT && !SF_GET_FUNCTION(symbolP)) */ - /* if external, Remove from the list */ - symbolS *hold = symbol_previous(symbolP); - - symbol_remove(symbolP, &symbol_rootP, &symbol_lastP); - symbol_clear_list_pointers(symbolP); - symbol_append(symbolP, symbol_extern_lastP, &symbol_externP, &symbol_extern_lastP); - symbolP = hold; - } else { - if (SF_GET_STRING(symbolP)) { - symbolP->sy_name_offset = string_byte_count; - string_byte_count += strlen(S_GET_NAME(symbolP)) + 1; - } else { - symbolP->sy_name_offset = 0; - } /* fix "long" names */ - - symbolP->sy_number = symbol_number; - symbol_number += 1 + S_GET_NUMBER_AUXILIARY(symbolP); - } /* if local symbol */ - } /* traverse the symbol list */ - return symbol_number; - -} - - -static unsigned int DEFUN_VOID(glue_symbols) -{ - unsigned int symbol_number = 0; - symbolS *symbolP; - for (symbolP = symbol_externP; symbol_externP;) { - symbolS *tmp = symbol_externP; - - /* append */ - symbol_remove(tmp, &symbol_externP, &symbol_extern_lastP); - symbol_append(tmp, symbol_lastP, &symbol_rootP, &symbol_lastP); - - /* and process */ - if (SF_GET_STRING(tmp)) { - tmp->sy_name_offset = string_byte_count; - string_byte_count += strlen(S_GET_NAME(tmp)) + 1; - } else { - tmp->sy_name_offset = 0; - } /* fix "long" names */ - - tmp->sy_number = symbol_number; - symbol_number += 1 + S_GET_NUMBER_AUXILIARY(tmp); - } /* append the entire extern chain */ - return symbol_number; - -} - -static unsigned int DEFUN_VOID(tie_tags) -{ - unsigned int symbol_number = 0; - - symbolS*symbolP; - for (symbolP = symbol_rootP; symbolP; symbolP = - symbol_next(symbolP)) - { - symbolP->sy_number = symbol_number; - - - - if (SF_GET_TAGGED(symbolP)) - { - SA_SET_SYM_TAGNDX - (symbolP, - ((symbolS*) SA_GET_SYM_TAGNDX(symbolP))->sy_number); - } - - symbol_number += 1 + S_GET_NUMBER_AUXILIARY(symbolP); - } - return symbol_number; - -} - -static void -DEFUN(crawl_symbols,(headers, abfd), - struct internal_filehdr *headers AND - bfd *abfd) -{ - - unsigned int i; - unsigned int ptr = 0; - - - symbolS *symbolP; - - /* Initialize the stack used to keep track of the matching .bb .be */ - - block_stack = stack_init(512, sizeof(symbolS*)); - /* JF deal with forward references first... */ - for (symbolP = symbol_rootP; - symbolP; - symbolP = symbol_next(symbolP)) - { - - if (symbolP->sy_forward) { - S_SET_VALUE(symbolP, (S_GET_VALUE(symbolP) - + S_GET_VALUE(symbolP->sy_forward) - + symbolP->sy_forward->sy_frag->fr_address)); - - if (SF_GET_GET_SEGMENT(symbolP)) { - S_SET_SEGMENT(symbolP, S_GET_SEGMENT(symbolP->sy_forward)); - } /* forward segment also */ - - symbolP->sy_forward=0; - } /* if it has a forward reference */ - } /* walk the symbol chain */ - - - /* The symbol list should be ordered according to the following sequence - * order : - * . .file symbol - * . debug entries for functions - * . 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. - */ - - 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 - */ - - - for (i = SEG_E0; i < SEG_E9; i++) - { - if (segment_info[i].scnhdr.s_name[0]) - { - segment_info[i].dot = - c_section_symbol(segment_info[i].scnhdr.s_name, - i-SEG_E0+1); - - } - } - - - /* Take all the externals out and put them into another chain */ - headers->f_nsyms = yank_symbols(); - /* Take the externals and glue them onto the end.*/ - headers->f_nsyms += glue_symbols(); - - headers->f_nsyms = tie_tags(); - know(symbol_externP == NULL); - know(symbol_extern_lastP == NULL); - - return; -} - -/* - * Find strings by crawling along symbol table chain. - */ - -void DEFUN(w_strings,(where), - char *where) -{ - symbolS *symbolP; - - /* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */ - md_number_to_chars(where, string_byte_count, sizeof(string_byte_count)); - where += sizeof(string_byte_count); - for (symbolP = symbol_rootP; - symbolP; - symbolP = symbol_next(symbolP)) - { - unsigned int size; - - if (SF_GET_STRING(symbolP)) { - size = strlen(S_GET_NAME(symbolP)) + 1; - - memcpy(where, S_GET_NAME(symbolP),size); - where += size; - - } - } - -} - - - - - -static void -DEFUN(do_linenos_for,(abfd, file_cursor), - bfd *abfd AND - unsigned long *file_cursor) -{ - unsigned int idx; - - for (idx = SEG_E0; idx < SEG_E9; idx++) - { - segment_info_type *s = segment_info + idx; - - if (s->scnhdr.s_nlnno != 0) - { - struct lineno_list *line_ptr ; - - struct external_lineno *buffer = - (struct external_lineno *)xmalloc(s->scnhdr.s_nlnno * LINESZ); - - struct external_lineno *dst= buffer; - - /* Run through the table we've built and turn it into its external - form */ - - for (line_ptr = s->lineno_list_head; - line_ptr != (struct lineno_list *)NULL; - line_ptr = line_ptr->next) - { - if (line_ptr->line.l_lnno == 0) - { - /* Turn a pointer to a symbol into the symbols' index */ - line_ptr->line.l_addr.l_symndx = - ( (symbolS *)line_ptr->line.l_addr.l_symndx)->sy_number; - } - (void) bfd_coff_swap_lineno_out(abfd, &(line_ptr->line), dst); - dst++; - } - - s->scnhdr.s_lnnoptr = *file_cursor; - - bfd_write(buffer, 1, s->scnhdr.s_nlnno* LINESZ, abfd); - free(buffer); - - *file_cursor += s->scnhdr.s_nlnno * LINESZ; - } - } -} - - -/* Now we run through the list of frag chains in a segment and - make all the subsegment frags appear at the end of the - list, as if the seg 0 was extra long */ - -static void DEFUN_VOID(remove_subsegs) -{ - unsigned int i; - - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - frchainS *head = segment_info[i].frchainP; - fragS dummy; - fragS * prev_frag = &dummy; - - while (head && head->frch_seg == i) - { - prev_frag->fr_next = head->frch_root; - prev_frag = head->frch_last; - head = head->frch_next; - } - prev_frag->fr_next = 0; - } -} - - -extern void DEFUN_VOID(write_object_file) -{ - int i; - struct frchain *frchain_ptr; - - struct internal_filehdr filehdr; - struct internal_aouthdr aouthdr; - unsigned long file_cursor; - bfd *abfd; - unsigned int addr = 0; - abfd = bfd_openw(out_file_name, TARGET_FORMAT); - - - if (abfd == 0) { - as_perror ("FATAL: Can't create %s", out_file_name); - exit(42); - } - bfd_set_format(abfd, bfd_object); - bfd_set_arch_mach(abfd, BFD_ARCH, 0); - - - - string_byte_count = 4; - - for (frchain_ptr = frchain_root; - frchain_ptr != (struct frchain *)NULL; - frchain_ptr = frchain_ptr->frch_next) { - /* Run through all the sub-segments and align them up. Also close any - open frags. We tack a .fill onto the end of the frag chain so - that any .align's size can be worked by looking at the next - frag */ - - subseg_new(frchain_ptr->frch_seg, frchain_ptr->frch_subseg); -#define SUB_SEGMENT_ALIGN 1 - frag_align(SUB_SEGMENT_ALIGN,0); - frag_wane(frag_now); - frag_now->fr_fix = 0; - know( frag_now->fr_next == NULL ); - } - - - remove_subsegs(); - - - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - relax_segment(segment_info[i].frchainP->frch_root, i); - } - - - - - - filehdr.f_nscns = 0; - - /* Find out how big the sections are */ - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - - if (segment_info[i].scnhdr.s_name[0]) - { - filehdr.f_nscns++; - } - segment_info[i].scnhdr.s_paddr = addr; - if (i == SEG_E2) { - /* THis is a special case, we leave the size alone, which will have */ - /* been made up from all and any lcomms seen */ - } - else { - addr += size_section(abfd, i); - } - } - - - - /* Turn the gas native symbol table shape into a coff symbol table */ - crawl_symbols(&filehdr, abfd); - - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - fixup_segment(segment_info[i].fix_root, i); - } - - file_cursor = FILHSZ + SCNHSZ * filehdr.f_nscns ; - - bfd_seek(abfd, file_cursor, 0); - - - do_relocs_for(abfd, &file_cursor); - - do_linenos_for(abfd, &file_cursor); - - - /* Plant the data */ - - fill_section(abfd,&filehdr, &file_cursor); - - filehdr.f_magic = COFF_MAGIC; - filehdr.f_timdat = 0; - filehdr.f_flags = 0; - - - - { - - unsigned int symtable_size = filehdr.f_nsyms * SYMESZ; - char *buffer1 = malloc(symtable_size + string_byte_count + 4); - char *ptr = buffer1; - filehdr.f_symptr = bfd_tell(abfd); - w_symbols(abfd, buffer1, symbol_rootP); - w_strings(buffer1 + symtable_size); - bfd_write(buffer1, 1,symtable_size + string_byte_count + 4, abfd); - free(buffer1); - - } - coff_header_append(abfd, &filehdr, &aouthdr); - - bfd_close_all_done(abfd); -} - - -static void DEFUN(change_to_section,(name, len, exp), - char *name AND - unsigned int len AND - unsigned int exp) -{ - unsigned int i; - /* Find out if we've already got a section of this name etc */ - for(i = SEG_E0; i < SEG_E9 && segment_info[i].scnhdr.s_name[0] ; i++) - { - if (strncmp(segment_info[i].scnhdr.s_name, name, len) == 0) - { - subseg_new(i, exp); - return; - - } - } - /* No section, add one */ - strncpy(segment_info[i].scnhdr.s_name, name, 8); - subseg_new(i, exp); -} - -static void -DEFUN_VOID(obj_coff_section) -{ - /* Strip out the section name */ - char *section_name ; - char *section_name_end; - char c; - - unsigned int len; - unsigned int exp; - - section_name = input_line_pointer; - c = get_symbol_end(); - section_name_end = input_line_pointer; - - len = section_name_end - section_name ; - input_line_pointer++; - SKIP_WHITESPACE(); - if (c == ',') - { - exp = get_absolute_expression(); - } - else if ( *input_line_pointer == ',') - { - - input_line_pointer++; - exp = get_absolute_expression(); - } - else - { - exp = 0; - } - - change_to_section(section_name, len,exp); - -} - - -static void obj_coff_text() -{ - change_to_section(".text",5, get_absolute_expression()); -} - - -static void obj_coff_data() -{ - change_to_section(".data",5, get_absolute_expression()); -} - -void c_symbol_merge(debug, normal) -symbolS *debug; -symbolS *normal; -{ - S_SET_DATA_TYPE(normal, S_GET_DATA_TYPE(debug)); - S_SET_STORAGE_CLASS(normal, S_GET_STORAGE_CLASS(debug)); - - if (S_GET_NUMBER_AUXILIARY(debug) > S_GET_NUMBER_AUXILIARY(normal)) { - S_SET_NUMBER_AUXILIARY(normal, S_GET_NUMBER_AUXILIARY(debug)); - } /* take the most we have */ - - if (S_GET_NUMBER_AUXILIARY(debug) > 0) { - memcpy((char*)&normal->sy_symbol.ost_auxent[0], (char*)&debug->sy_symbol.ost_auxent[0], S_GET_NUMBER_AUXILIARY(debug) * AUXESZ); - } /* Move all the auxiliary information */ - - /* Move the debug flags. */ - SF_SET_DEBUG_FIELD(normal, SF_GET_DEBUG_FIELD(debug)); -} /* c_symbol_merge() */ - -static int -DEFUN(c_line_new,(symbol, paddr, line_number, frag), - symbolS *symbol AND - long paddr AND - unsigned short line_number AND - fragS* frag) -{ - struct lineno_list* new_line = - (struct lineno_list *)xmalloc(sizeof(struct lineno_list)); - - segment_info_type *s = segment_info + now_seg; - new_line->line.l_lnno = line_number; - if (line_number == 0) - { - new_line->line.l_addr.l_symndx = (long)symbol; - } - else - { - new_line->line.l_addr.l_paddr = paddr; - } - - new_line->frag = (char*)frag; - new_line->next = (struct lineno_list*)NULL; - - - if (s->lineno_list_head == (struct lineno_list *)NULL) - { - s->lineno_list_head = new_line; - } - else - { - s->lineno_list_tail->next = new_line; - } - s->lineno_list_tail = new_line; - return LINESZ * s->scnhdr.s_nlnno ++; -} - -void c_dot_file_symbol(filename) -char *filename; -{ - symbolS* symbolP; - - symbolP = symbol_new(".file", - SEG_DEBUG, - 0, - &zero_address_frag); - - S_SET_STORAGE_CLASS(symbolP, C_FILE); - S_SET_NUMBER_AUXILIARY(symbolP, 1); - SA_SET_FILE_FNAME(symbolP, filename); - SF_SET_DEBUG(symbolP); - S_SET_VALUE(symbolP, (long) previous_file_symbol); - - previous_file_symbol = symbolP; - - /* 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() */ - -/* - * Build a 'section static' symbol. - */ - -symbolS *c_section_symbol(name,idx) -char *name; -int idx; -{ - symbolS *symbolP; - - symbolP = symbol_new(name,idx, - 0, - &zero_address_frag); - - S_SET_STORAGE_CLASS(symbolP, C_STAT); - S_SET_NUMBER_AUXILIARY(symbolP, 1); - - SF_SET_STATICS(symbolP); - - return symbolP; -} /* c_section_symbol() */ - -static void -DEFUN(w_symbols,(abfd, where, symbol_rootP), -bfd *abfd AND -char *where AND -symbolS *symbol_rootP) -{ - symbolS *symbolP; - unsigned int i; - - /* First fill in those values we have only just worked out */ - for (i = SEG_E0; i < SEG_E9; i++) - { - symbolP = segment_info[i].dot; - if (symbolP) - { - - SA_SET_SCN_SCNLEN(symbolP, segment_info[i].scnhdr.s_size); - SA_SET_SCN_NRELOC(symbolP, segment_info[i].scnhdr.s_nreloc); - SA_SET_SCN_NLINNO(symbolP, segment_info[i].scnhdr.s_nlnno); - - } - } - - /* - * Emit all symbols left in the symbol chain. - */ - for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) { - /* Used to save the offset of the name. It is used to point - to the string in memory but must be a file offset. */ - register char * temp; - - tc_coff_symbol_emit_hook(symbolP); - - temp = S_GET_NAME(symbolP); - if (SF_GET_STRING(symbolP)) { - S_SET_OFFSET(symbolP, symbolP->sy_name_offset); - S_SET_ZEROES(symbolP, 0); - } else { - bzero(symbolP->sy_symbol.ost_entry.n_name, SYMNMLEN); - strncpy(symbolP->sy_symbol.ost_entry.n_name, temp, SYMNMLEN); - } - where = symbol_to_chars(abfd, where, symbolP); - S_SET_NAME(symbolP,temp); - } - -} /* w_symbols() */ - -static void DEFUN_VOID(obj_coff_lcomm) -{ - char *name; - char c; - int temp; - char *p; - symbolS *symbolP; - name = input_line_pointer; - - - - c = get_symbol_end(); - p = input_line_pointer; - *p = c; - SKIP_WHITESPACE(); - if (*input_line_pointer != ',') { - as_bad("Expected comma after name"); - ignore_rest_of_line(); - return; - } - if (*input_line_pointer == '\n') { - as_bad("Missing size expression"); - return; - } - input_line_pointer++; - if ((temp = get_absolute_expression ()) < 0) { - as_warn("lcomm length (%d.) <0! Ignored.", temp); - ignore_rest_of_line(); - return; - } - *p = 0; - symbolP = symbol_find_or_make(name); - S_SET_VALUE(symbolP, segment_info[SEG_E2].scnhdr.s_size); - S_SET_SEGMENT(symbolP, SEG_E2); - segment_info[SEG_E2].scnhdr.s_size += temp; - S_SET_STORAGE_CLASS(symbolP, C_STAT); - demand_empty_rest_of_line(); -} - - -#if 1 -static void DEFUN(fixup_segment,(fixP, this_segment_type), -register fixS * fixP AND -segT this_segment_type) -{ - register symbolS *add_symbolP; - register symbolS *sub_symbolP; - register long add_number; - register int size; - register char *place; - register long where; - register char pcrel; - register fragS *fragP; - register segT add_symbol_segment = SEG_ABSOLUTE; - - - for ( ; fixP; fixP = fixP->fx_next) - { - fragP = fixP->fx_frag; - know(fragP); - where = fixP->fx_where; - place = fragP->fr_literal + where; - size = fixP->fx_size; - add_symbolP = fixP->fx_addsy; -#ifdef TC_I960 - if (fixP->fx_callj && TC_S_IS_CALLNAME(add_symbolP)) { - /* Relocation should be done via the - associated 'bal' entry point - symbol. */ - - if (!TC_S_IS_BALNAME(tc_get_bal_of_call(add_symbolP))) { - as_bad("No 'bal' entry point for leafproc %s", - S_GET_NAME(add_symbolP)); - continue; - } - fixP->fx_addsy = add_symbolP = tc_get_bal_of_call(add_symbolP); - } /* callj relocation */ -#endif - sub_symbolP = fixP->fx_subsy; - add_number = fixP->fx_offset; - pcrel = fixP->fx_pcrel; - - if (add_symbolP) { - add_symbol_segment = S_GET_SEGMENT(add_symbolP); - } /* if there is an addend */ - - if (sub_symbolP) { - if (!add_symbolP) { - /* Its just -sym */ - if (S_GET_SEGMENT(sub_symbolP) != SEG_ABSOLUTE) { - as_bad("Negative of non-absolute symbol %s", S_GET_NAME(sub_symbolP)); - } /* not absolute */ - - add_number -= S_GET_VALUE(sub_symbolP); - - /* if sub_symbol is in the same segment that add_symbol - and add_symbol is either in DATA, TEXT, BSS or ABSOLUTE */ - } else if ((S_GET_SEGMENT(sub_symbolP) == add_symbol_segment) - && (SEG_NORMAL(add_symbol_segment) - || (add_symbol_segment == SEG_ABSOLUTE))) { - /* Difference of 2 symbols from same segment. */ - /* Can't make difference of 2 undefineds: 'value' means */ - /* something different for N_UNDF. */ -#ifdef TC_I960 - /* Makes no sense to use the difference of 2 arbitrary symbols - * as the target of a call instruction. - */ - if (fixP->fx_callj) { - as_bad("callj to difference of 2 symbols"); - } -#endif /* TC_I960 */ - add_number += S_GET_VALUE(add_symbolP) - - S_GET_VALUE(sub_symbolP); - - add_symbolP = NULL; - fixP->fx_addsy = NULL; - } else { - /* Different segments in subtraction. */ - know(!(S_IS_EXTERNAL(sub_symbolP) && (S_GET_SEGMENT(sub_symbolP) == SEG_ABSOLUTE))); - - if ((S_GET_SEGMENT(sub_symbolP) == SEG_ABSOLUTE)) { - add_number -= S_GET_VALUE(sub_symbolP); - } else { - as_bad("Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %d.", - segment_name(S_GET_SEGMENT(sub_symbolP)), - S_GET_NAME(sub_symbolP), fragP->fr_address + where); - } /* if absolute */ - } - } /* if sub_symbolP */ - - if (add_symbolP) { - if (add_symbol_segment == this_segment_type && pcrel) { - /* - * This fixup was made when the symbol's segment was - * SEG_UNKNOWN, but it is now in the local segment. - * So we know how to do the address without relocation. - */ -#ifdef TC_I960 - /* reloc_callj() may replace a 'call' with a 'calls' or a 'bal', - * in which cases it modifies *fixP as appropriate. In the case - * of a 'calls', no further work is required, and *fixP has been - * set up to make the rest of the code below a no-op. - */ - reloc_callj(fixP); -#endif /* TC_I960 */ - - add_number += S_GET_VALUE(add_symbolP); - add_number -= md_pcrel_from (fixP); - pcrel = 0; /* Lie. Don't want further pcrel processing. */ - fixP->fx_addsy = NULL; /* No relocations please. */ - } else - { - switch (add_symbol_segment) - { - case SEG_ABSOLUTE: -#ifdef TC_I960 - reloc_callj(fixP); /* See comment about reloc_callj() above*/ -#endif /* TC_I960 */ - add_number += S_GET_VALUE(add_symbolP); - fixP->fx_addsy = NULL; - add_symbolP = NULL; - break; - default: - - add_number += S_GET_VALUE(add_symbolP) + - segment_info[S_GET_SEGMENT(add_symbolP)].scnhdr.s_paddr ; - break; - - case SEG_UNKNOWN: -#ifdef TC_I960 - if ((int)fixP->fx_bit_fixP == 13) { - /* This is a COBR instruction. They have only a - * 13-bit displacement and are only to be used - * for local branches: flag as error, don't generate - * relocation. - */ - as_bad("can't use COBR format with external label"); - fixP->fx_addsy = NULL; /* No relocations please. */ - continue; - } /* COBR */ -#endif /* TC_I960 */ - - - - break; - - - } /* switch on symbol seg */ - } /* if not in local seg */ - } /* if there was a + symbol */ - - if (pcrel) { - add_number -= md_pcrel_from(fixP); - if (add_symbolP == 0) { - fixP->fx_addsy = & abs_symbol; - } /* if there's an add_symbol */ - } /* if pcrel */ - - if (!fixP->fx_bit_fixP) { - if ((size==1 && - (add_number& ~0xFF) && (add_number&~0xFF!=(-1&~0xFF))) || - (size==2 && - (add_number& ~0xFFFF) && (add_number&~0xFFFF!=(-1&~0xFFFF)))) { - as_bad("Value of %d too large for field of %d bytes at 0x%x", - add_number, size, fragP->fr_address + where); - } /* generic error checking */ - } /* not a bit fix */ - /* once this fix has been applied, we don't have to output anything - nothing more need be done -*/ - md_apply_fix(fixP, add_number); - - } /* For each fixS in this segment. */ - - -} /* fixup_segment() */ -#endif - - - - diff --git a/gas/config/obj-coff-bfd.h b/gas/config/obj-coff-bfd.h deleted file mode 100755 index 16393cd..0000000 --- a/gas/config/obj-coff-bfd.h +++ /dev/null @@ -1,512 +0,0 @@ -/* coff object file format - Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc. - -This file is part of GAS. - -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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* $Id$ */ - -#define OBJ_COFF 1 - -#include "targ-cpu.h" - -#include "bfd.h" - -/*extern bfd *stdoutput;*/ -/* This internal_lineno crap is to stop namespace pollution from the - bfd internal coff headerfile. */ - -#define internal_lineno bfd_internal_lineno -#include "coff/internal.h" -#undef internal_lineno - -#if defined(TC_H8300) -#include "coff/h8300.h" -#define TARGET_FORMAT "coff-h8300" -#elif defined(TC_A29K) -#include "coff/a29k.h" -#define TARGET_FORMAT "coff-a29k-big" -#else -help me -#endif - -#if 0 -/* Define some processor dependent values according to the processor we are - on. */ -#if defined(TC_H8300) -#define BYTE_ORDERING 0 -#define FILE_HEADER_MAGIC H8300MAGIC -#elif defined(TC_M68K) - -#define BYTE_ORDERING F_AR32W /* See filehdr.h for more info. */ -#ifndef FILE_HEADER_MAGIC -#define FILE_HEADER_MAGIC MC68MAGIC /* ... */ -#endif /* FILE_HEADER_MAGIC */ - -#elif defined(TC_I386) - -#define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */ -#ifndef FILE_HEADER_MAGIC -#define FILE_HEADER_MAGIC I386MAGIC /* ... */ -#endif /* FILE_HEADER_MAGIC */ - -#elif defined(TC_I960) - -#define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */ -#ifndef FILE_HEADER_MAGIC -#define FILE_HEADER_MAGIC I960ROMAGIC /* ... */ -#endif /* FILE_HEADER_MAGIC */ - -#elif defined(TC_A29K) - -#define BYTE_ORDERING F_AR32W /* big endian. */ -#ifndef FILE_HEADER_MAGIC -#define FILE_HEADER_MAGIC SIPFBOMAGIC -#endif /* FILE_HEADER_MAGIC */ - -#else -you lose -#endif - -#endif - -#ifndef OBJ_COFF_MAX_AUXENTRIES -#define OBJ_COFF_MAX_AUXENTRIES 1 -#endif /* OBJ_COFF_MAX_AUXENTRIES */ - - -extern const segT N_TYPE_seg[]; - -/* Magic number of paged executable. */ -#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE 0x8300 - - -/* SYMBOL TABLE */ - - /* targets may also set this */ -#ifndef SYMBOLS_NEED_BACKPOINTERS -#define SYMBOLS_NEED_BACKPOINTERS 1 -#endif /* SYMBOLS_NEED_BACKPOINTERS */ - -/* Symbol table entry data type */ - -typedef struct -{ - struct internal_syment ost_entry; /* Basic symbol */ - union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; /* Auxiliary entry. */ - - unsigned int ost_flags; /* obj_coff internal use only flags */ -} obj_symbol_type; - -#define DO_NOT_STRIP 0 -#define DO_STRIP 1 - -/* Symbol table macros and constants */ - -/* Possible and usefull section number in symbol table - * The values of TEXT, DATA and BSS may not be portable. - */ - -#define C_ABS_SECTION N_ABS -#define C_UNDEF_SECTION N_UNDEF -#define C_DEBUG_SECTION N_DEBUG -#define C_NTV_SECTION N_TV -#define C_PTV_SECTION P_TV -#define C_REGISTER_SECTION 20 - -/* - * Macros to extract information from a symbol table entry. - * This syntaxic indirection allows independence regarding a.out or coff. - * The argument (s) of all these macros is a pointer to a symbol table entry. - */ - -/* Predicates */ -/* True if the symbol is external */ -#define S_IS_EXTERNAL(s) ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION) -/* True if symbol has been defined, ie : - section > 0 (DATA, TEXT or BSS) - section == 0 and value > 0 (external bss symbol) */ -#define S_IS_DEFINED(s) ((s)->sy_symbol.ost_entry.n_scnum > C_UNDEF_SECTION || \ - ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION && \ - (s)->sy_symbol.ost_entry.n_value > 0)) -/* True if a debug special symbol entry */ -#define S_IS_DEBUG(s) ((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION) -/* True if a symbol is local symbol name */ -/* A symbol name whose name begin with ^A is a gas internal pseudo symbol */ -#define S_IS_LOCAL(s) (S_GET_NAME(s)[0] == '\001' || \ - (s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION || \ - (S_LOCAL_NAME(s) && !flagseen['L'])) -/* True if a symbol is not defined in this file */ -#define S_IS_EXTERN(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 && (s)->sy_symbol.ost_entry.n_value == 0) -/* - * True if a symbol can be multiply defined (bss symbols have this def - * though it is bad practice) - */ -#define S_IS_COMMON(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 && (s)->sy_symbol.ost_entry.n_value != 0) -/* True if a symbol name is in the string table, i.e. its length is > 8. */ -#define S_IS_STRING(s) (strlen(S_GET_NAME(s)) > 8 ? 1 : 0) - -/* Accessors */ -/* The name of the symbol */ -#define S_GET_NAME(s) ((char*)(s)->sy_symbol.ost_entry.n_offset) -/* The pointer to the string table */ -#define S_GET_OFFSET(s) ((s)->sy_symbol.ost_entry.n_offset) -/* The zeroes if symbol name is longer than 8 chars */ -#define S_GET_ZEROES(s) ((s)->sy_symbol.ost_entry.n_zeroes) -/* The value of the symbol */ -#define S_GET_VALUE(s) ((unsigned) ((s)->sy_symbol.ost_entry.n_value)) -/* The numeric value of the segment */ -#define S_GET_SEGMENT(s) s_get_segment(s) -/* The data type */ -#define S_GET_DATA_TYPE(s) ((s)->sy_symbol.ost_entry.n_type) -/* The storage class */ -#define S_GET_STORAGE_CLASS(s) ((s)->sy_symbol.ost_entry.n_sclass) -/* The number of auxiliary entries */ -#define S_GET_NUMBER_AUXILIARY(s) ((s)->sy_symbol.ost_entry.n_numaux) - -/* Modifiers */ -/* Set the name of the symbol */ -#define S_SET_NAME(s,v) ((s)->sy_symbol.ost_entry.n_offset = (unsigned long)(v)) -/* Set the offset of the symbol */ -#define S_SET_OFFSET(s,v) ((s)->sy_symbol.ost_entry.n_offset = (v)) -/* The zeroes if symbol name is longer than 8 chars */ -#define S_SET_ZEROES(s,v) ((s)->sy_symbol.ost_entry.n_zeroes = (v)) -/* Set the value of the symbol */ -#define S_SET_VALUE(s,v) ((s)->sy_symbol.ost_entry.n_value = (v)) -/* The numeric value of the segment */ -#define S_SET_SEGMENT(s,v) ((s)->sy_symbol.ost_entry.n_scnum = SEGMENT_TO_SYMBOL_TYPE(v)) -/* The data type */ -#define S_SET_DATA_TYPE(s,v) ((s)->sy_symbol.ost_entry.n_type = (v)) -/* The storage class */ -#define S_SET_STORAGE_CLASS(s,v) ((s)->sy_symbol.ost_entry.n_sclass = (v)) -/* The number of auxiliary entries */ -#define S_SET_NUMBER_AUXILIARY(s,v) ((s)->sy_symbol.ost_entry.n_numaux = (v)) - -/* Additional modifiers */ -/* The symbol is external (does not mean undefined) */ -#define S_SET_EXTERNAL(s) { S_SET_STORAGE_CLASS(s, C_EXT) ; SF_CLEAR_LOCAL(s); } - -/* Auxiliary entry macros. SA_ stands for symbol auxiliary */ -/* Omit the tv related fields */ -/* Accessors */ -#ifdef BFD_HEADERS -#define SA_GET_SYM_TAGNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx.l) -#else -#define SA_GET_SYM_TAGNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx) -#endif -#define SA_GET_SYM_LNNO(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_lnno) -#define SA_GET_SYM_SIZE(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_size) -#define SA_GET_SYM_FSIZE(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_fsize) -#define SA_GET_SYM_LNNOPTR(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_lnnoptr) -#ifdef BFD_HEADERS -#define SA_GET_SYM_ENDNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx.l) -#else -#define SA_GET_SYM_ENDNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx) -#endif -#define SA_GET_SYM_DIMEN(s,i) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen[(i)]) -#define SA_GET_FILE_FNAME(s) ((s)->sy_symbol.ost_auxent[0].x_file.x_fname) -#define SA_GET_SCN_SCNLEN(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_scnlen) -#define SA_GET_SCN_NRELOC(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nreloc) -#define SA_GET_SCN_NLINNO(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nlinno) - -/* Modifiers */ -#ifdef BFD_HEADERS -#define SA_SET_SYM_TAGNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx.l=(v)) -#else -#define SA_SET_SYM_TAGNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx=(v)) -#endif -#define SA_SET_SYM_LNNO(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_lnno=(v)) -#define SA_SET_SYM_SIZE(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_size=(v)) -#define SA_SET_SYM_FSIZE(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_fsize=(v)) -#define SA_SET_SYM_LNNOPTR(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_lnnoptr=(v)) -#ifdef BFD_HEADERS -#define SA_SET_SYM_ENDNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx.l=(v)) -#else -#define SA_SET_SYM_ENDNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx=(v)) -#endif -#define SA_SET_SYM_DIMEN(s,i,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v)) -#define SA_SET_FILE_FNAME(s,v) strncpy((s)->sy_symbol.ost_auxent[0].x_file.x_fname,(v),FILNMLEN) -#define SA_SET_SCN_SCNLEN(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_scnlen=(v)) -#define SA_SET_SCN_NRELOC(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nreloc=(v)) -#define SA_SET_SCN_NLINNO(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nlinno=(v)) - -/* - * Internal use only definitions. SF_ stands for symbol flags. - * - * These values can be assigned to sy_symbol.ost_flags field of a symbolS. - * - * You'll break i960 if you shift the SYSPROC bits anywhere else. for - * more on the balname/callname hack, see tc-i960.h. b.out is done - * differently. - */ - -#define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */ -#define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */ -#define SF_IS_SYSPROC (0x00000040) /* bit 6 marks symbols that are sysprocs */ -#define SF_BALNAME (0x00000080) /* bit 7 marks BALNAME symbols */ -#define SF_CALLNAME (0x00000100) /* bit 8 marks CALLNAME symbols */ - -#define SF_NORMAL_MASK (0x0000ffff) /* bits 12-15 are general purpose. */ - -#define SF_STATICS (0x00001000) /* Mark the .text & all symbols */ -#define SF_DEFINED (0x00002000) /* Symbol is defined in this file */ -#define SF_STRING (0x00004000) /* Symbol name length > 8 */ -#define SF_LOCAL (0x00008000) /* Symbol must not be emitted */ - -#define SF_DEBUG_MASK (0xffff0000) /* bits 16-31 are debug info */ - -#define SF_FUNCTION (0x00010000) /* The symbol is a function */ -#define SF_PROCESS (0x00020000) /* Process symbol before write */ -#define SF_TAGGED (0x00040000) /* Is associated with a tag */ -#define SF_TAG (0x00080000) /* Is a tag */ -#define SF_DEBUG (0x00100000) /* Is in debug or abs section */ -#define SF_GET_SEGMENT (0x00200000) /* Get the section of the forward symbol. */ - /* All other bits are unused. */ - -/* Accessors */ -#define SF_GET(s) ((s)->sy_symbol.ost_flags) -#define SF_GET_NORMAL_FIELD(s) ((s)->sy_symbol.ost_flags & SF_NORMAL_MASK) -#define SF_GET_DEBUG_FIELD(s) ((s)->sy_symbol.ost_flags & SF_DEBUG_MASK) -#define SF_GET_FILE(s) ((s)->sy_symbol.ost_flags & SF_FILE) -#define SF_GET_STATICS(s) ((s)->sy_symbol.ost_flags & SF_STATICS) -#define SF_GET_DEFINED(s) ((s)->sy_symbol.ost_flags & SF_DEFINED) -#define SF_GET_STRING(s) ((s)->sy_symbol.ost_flags & SF_STRING) -#define SF_GET_LOCAL(s) ((s)->sy_symbol.ost_flags & SF_LOCAL) -#define SF_GET_FUNCTION(s) ((s)->sy_symbol.ost_flags & SF_FUNCTION) -#define SF_GET_PROCESS(s) ((s)->sy_symbol.ost_flags & SF_PROCESS) -#define SF_GET_DEBUG(s) ((s)->sy_symbol.ost_flags & SF_DEBUG) -#define SF_GET_TAGGED(s) ((s)->sy_symbol.ost_flags & SF_TAGGED) -#define SF_GET_TAG(s) ((s)->sy_symbol.ost_flags & SF_TAG) -#define SF_GET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags & SF_GET_SEGMENT) -#define SF_GET_I960(s) ((s)->sy_symbol.ost_flags & SF_I960_MASK) /* used by i960 */ -#define SF_GET_BALNAME(s) ((s)->sy_symbol.ost_flags & SF_BALNAME) /* used by i960 */ -#define SF_GET_CALLNAME(s) ((s)->sy_symbol.ost_flags & SF_CALLNAME) /* used by i960 */ -#define SF_GET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_IS_SYSPROC) /* used by i960 */ -#define SF_GET_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_SYSPROC) /* used by i960 */ - -/* Modifiers */ -#define SF_SET(s,v) ((s)->sy_symbol.ost_flags = (v)) -#define SF_SET_NORMAL_FIELD(s,v)((s)->sy_symbol.ost_flags |= ((v) & SF_NORMAL_MASK)) -#define SF_SET_DEBUG_FIELD(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_DEBUG_MASK)) -#define SF_SET_FILE(s) ((s)->sy_symbol.ost_flags |= SF_FILE) -#define SF_SET_STATICS(s) ((s)->sy_symbol.ost_flags |= SF_STATICS) -#define SF_SET_DEFINED(s) ((s)->sy_symbol.ost_flags |= SF_DEFINED) -#define SF_SET_STRING(s) ((s)->sy_symbol.ost_flags |= SF_STRING) -#define SF_SET_LOCAL(s) ((s)->sy_symbol.ost_flags |= SF_LOCAL) -#define SF_CLEAR_LOCAL(s) ((s)->sy_symbol.ost_flags &= ~SF_LOCAL) -#define SF_SET_FUNCTION(s) ((s)->sy_symbol.ost_flags |= SF_FUNCTION) -#define SF_SET_PROCESS(s) ((s)->sy_symbol.ost_flags |= SF_PROCESS) -#define SF_SET_DEBUG(s) ((s)->sy_symbol.ost_flags |= SF_DEBUG) -#define SF_SET_TAGGED(s) ((s)->sy_symbol.ost_flags |= SF_TAGGED) -#define SF_SET_TAG(s) ((s)->sy_symbol.ost_flags |= SF_TAG) -#define SF_SET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags |= SF_GET_SEGMENT) -#define SF_SET_I960(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_I960_MASK)) /* used by i960 */ -#define SF_SET_BALNAME(s) ((s)->sy_symbol.ost_flags |= SF_BALNAME) /* used by i960 */ -#define SF_SET_CALLNAME(s) ((s)->sy_symbol.ost_flags |= SF_CALLNAME) /* used by i960 */ -#define SF_SET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags |= SF_IS_SYSPROC) /* used by i960 */ -#define SF_SET_SYSPROC(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_SYSPROC)) /* used by i960 */ - -/* File header macro and type definition */ - -/* - * File position calculators. Beware to use them when all the - * appropriate fields are set in the header. - */ - -#ifdef OBJ_COFF_OMIT_OPTIONAL_HEADER -#define OBJ_COFF_AOUTHDRSZ (0) -#else -#define OBJ_COFF_AOUTHDRSZ (AOUTHDRSZ) -#endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */ - -#define H_GET_FILE_SIZE(h) \ - (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \ - H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \ - H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h) + \ - H_GET_SYMBOL_TABLE_SIZE(h) + \ - (h)->string_table_size) -#define H_GET_TEXT_FILE_OFFSET(h) \ - (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ) -#define H_GET_DATA_FILE_OFFSET(h) \ - (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \ - H_GET_TEXT_SIZE(h)) -#define H_GET_BSS_FILE_OFFSET(h) 0 -#define H_GET_RELOCATION_FILE_OFFSET(h) \ - (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \ - H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h)) -#define H_GET_LINENO_FILE_OFFSET(h) \ - (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \ - H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \ - H_GET_RELOCATION_SIZE(h)) -#define H_GET_SYMBOL_TABLE_FILE_OFFSET(h) \ - (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \ - H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \ - H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h)) - -/* Accessors */ -/* aouthdr */ -#define H_GET_MAGIC_NUMBER(h) ((h)->aouthdr.magic) -#define H_GET_VERSION_STAMP(h) ((h)->aouthdr.vstamp) -#define H_GET_TEXT_SIZE(h) ((h)->aouthdr.tsize) -#define H_GET_DATA_SIZE(h) ((h)->aouthdr.dsize) -#define H_GET_BSS_SIZE(h) ((h)->aouthdr.bsize) -#define H_GET_ENTRY_POINT(h) ((h)->aouthdr.entry) -#define H_GET_TEXT_START(h) ((h)->aouthdr.text_start) -#define H_GET_DATA_START(h) ((h)->aouthdr.data_start) -/* filehdr */ -#define H_GET_FILE_MAGIC_NUMBER(h) ((h)->filehdr.f_magic) -#define H_GET_NUMBER_OF_SECTIONS(h) ((h)->filehdr.f_nscns) -#define H_GET_TIME_STAMP(h) ((h)->filehdr.f_timdat) -#define H_GET_SYMBOL_TABLE_POINTER(h) ((h)->filehdr.f_symptr) -#define H_GET_SYMBOL_COUNT(h) ((h)->filehdr.f_nsyms) -#define H_GET_SYMBOL_TABLE_SIZE(h) (H_GET_SYMBOL_COUNT(h) * SYMESZ) -#define H_GET_SIZEOF_OPTIONAL_HEADER(h) ((h)->filehdr.f_opthdr) -#define H_GET_FLAGS(h) ((h)->filehdr.f_flags) -/* Extra fields to achieve bsd a.out compatibility and for convenience */ -#define H_GET_RELOCATION_SIZE(h) ((h)->relocation_size) -#define H_GET_STRING_SIZE(h) ((h)->string_table_size) -#define H_GET_LINENO_SIZE(h) ((h)->lineno_size) - -#ifndef OBJ_COFF_OMIT_OPTIONAL_HEADER -#define H_GET_HEADER_SIZE(h) (sizeof(FILHDR) \ - + sizeof(AOUTHDR)\ - + (H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ)) -#else /* OBJ_COFF_OMIT_OPTIONAL_HEADER */ -#define H_GET_HEADER_SIZE(h) (sizeof(FILHDR) \ - + (H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ)) -#endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */ - -#define H_GET_TEXT_RELOCATION_SIZE(h) (text_section_header.s_nreloc * RELSZ) -#define H_GET_DATA_RELOCATION_SIZE(h) (data_section_header.s_nreloc * RELSZ) - -/* Modifiers */ -/* aouthdr */ -#define H_SET_MAGIC_NUMBER(h,v) ((h)->aouthdr.magic = (v)) -#define H_SET_VERSION_STAMP(h,v) ((h)->aouthdr.vstamp = (v)) -#define H_SET_TEXT_SIZE(h,v) ((h)->aouthdr.tsize = (v)) -#define H_SET_DATA_SIZE(h,v) ((h)->aouthdr.dsize = (v)) -#define H_SET_BSS_SIZE(h,v) ((h)->aouthdr.bsize = (v)) -#define H_SET_ENTRY_POINT(h,v) ((h)->aouthdr.entry = (v)) -#define H_SET_TEXT_START(h,v) ((h)->aouthdr.text_start = (v)) -#define H_SET_DATA_START(h,v) ((h)->aouthdr.data_start = (v)) -/* filehdr */ -#define H_SET_FILE_MAGIC_NUMBER(h,v) ((h)->filehdr.f_magic = (v)) -#define H_SET_NUMBER_OF_SECTIONS(h,v) ((h)->filehdr.f_nscns = (v)) -#define H_SET_TIME_STAMP(h,v) ((h)->filehdr.f_timdat = (v)) -#define H_SET_SYMBOL_TABLE_POINTER(h,v) ((h)->filehdr.f_symptr = (v)) -#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->filehdr.f_nsyms = (v)) -#define H_SET_SIZEOF_OPTIONAL_HEADER(h,v) ((h)->filehdr.f_opthdr = (v)) -#define H_SET_FLAGS(h,v) ((h)->filehdr.f_flags = (v)) -/* Extra fields to achieve bsd a.out compatibility and for convinience */ -#define H_SET_RELOCATION_SIZE(h,t,d) ((h)->relocation_size = (t)+(d)) -#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v)) -#define H_SET_LINENO_SIZE(h,v) ((h)->lineno_size = (v)) - - /* Segment flipping */ -#define segment_name(v) (seg_name[(int) (v)]) - -typedef struct { -#ifdef BFD_HEADERS - struct internal_aouthdr aouthdr; /* a.out header */ - struct internal_filehdr filehdr; /* File header, not machine dep. */ -#else - AOUTHDR aouthdr; /* a.out header */ - FILHDR filehdr; /* File header, not machine dep. */ -#endif - long string_table_size; /* names + '\0' + sizeof(int) */ - long relocation_size; /* Cumulated size of relocation - information for all sections in - bytes. */ - long lineno_size; /* Size of the line number information - table in bytes */ -} object_headers; - - - -struct lineno_list -{ - - struct bfd_internal_lineno line; - char* frag; /* Frag to which the line number is related */ - struct lineno_list* next; /* Forward chain pointer */ -} ; - - - - - /* stack stuff */ -typedef struct { - unsigned long chunk_size; - unsigned long element_size; - unsigned long size; - char* data; - unsigned long pointer; -} stack; - - - -char *EXFUN(stack_pop,(stack *st)); -char *EXFUN(stack_push,(stack *st, char *element)); -char *EXFUN(stack_top,(stack *st)); -stack *EXFUN(stack_init,(unsigned long chunk_size, unsigned long element_size)); -void EXFUN(c_dot_file_symbol,(char *filename)); -void EXFUN(obj_extra_stuff,(object_headers *headers)); -void EXFUN(stack_delete,(stack *st)); - - - -void EXFUN(c_section_header,( - - struct internal_scnhdr *header, - char *name, - long core_address, - long size, - long data_ptr, - long reloc_ptr, - long lineno_ptr, - long reloc_number, - long lineno_number, - long alignment)); - - - /* sanity check */ - -#ifdef TC_I960 -#ifndef C_LEAFSTAT -hey! Where is the C_LEAFSTAT definition? i960-coff support is depending on it. -#endif /* no C_LEAFSTAT */ -#endif /* TC_I960 */ -#ifdef BFD_HEADERS -extern struct internal_scnhdr data_section_header; -extern struct internal_scnhdr text_section_header; -#else -extern SCNHDR data_section_header; -extern SCNHDR text_section_header; -#endif -/* - * Local Variables: - * comment-column: 0 - * fill-column: 131 - * End: - */ - -/* end of obj-coff.h */ diff --git a/gas/config/ranlib.h b/gas/config/ranlib.h deleted file mode 100755 index d7fda45..0000000 --- a/gas/config/ranlib.h +++ /dev/null @@ -1,36 +0,0 @@ -/* This file is ranlib.h - Copyright (C) 1987-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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* - * Structure of the __.SYMDEF table of contents for an archive. - * __.SYMDEF begins with a word giving the number of ranlib structures - * which immediately follow, and then continues with a string - * table consisting of a word giving the number of bytes of strings - * which follow and then the strings themselves. - * The ran_strx fields index the string table whose first byte is numbered 0. - */ -struct ranlib { - union { - off_t ran_strx; /* string table index of */ - char *ran_name; /* symbol defined by */ - } ran_un; - off_t ran_off; /* library member at this offset */ -}; - -/* end of ranlib.h */ diff --git a/gas/config/signame.h b/gas/config/signame.h deleted file mode 100755 index 8eb0889..0000000 --- a/gas/config/signame.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Convert between signal names and numbers. - Copyright (C) 1990, 1992 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; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Names for signals from 0 to NSIG-1. */ -extern char *sys_siglist[]; - -#if __STDC__ == 1 -/* Return the abbreviation (e.g. ABRT, FPE, etc.) for signal NUMBER. - Do not return this as a const char *. The caller might want to - assign it to a char *. */ -char *sig_abbrev (int number); - -/* Return the signal number for an ABBREV, or -1 if there is no - signal by that name. */ -int sig_number (const char *abbrev); - -/* Print to standard error the name of SIGNAL, preceded by MESSAGE and - a colon, and followed by a newline. */ -void psignal (int signal, const char *message); - -#else /* not __STDC__ */ - -char *sig_abbrev (); -int sig_number (); -void psignal (); - -#endif /* not __STDC__ */ - -/* end of signame.h */ diff --git a/gas/config/stab.h b/gas/config/stab.h deleted file mode 100755 index efeee1e..0000000 --- a/gas/config/stab.h +++ /dev/null @@ -1,37 +0,0 @@ -/* This file is stab.h - Copyright (C) 1987-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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef __GNU_STAB__ - -/* Indicate the GNU stab.h is in use. */ - -#define __GNU_STAB__ - -#define __define_stab(NAME, CODE, STRING) NAME=CODE, - - enum __stab_debug_code -{ -#include "stab.def" -}; - -#undef __define_stab - -#endif /* __GNU_STAB_ */ - -/* end of stab.h */ diff --git a/gas/config/tc-m68kmote.c b/gas/config/tc-m68kmote.c deleted file mode 100644 index d8e93b0..0000000 --- a/gas/config/tc-m68kmote.c +++ /dev/null @@ -1,4519 +0,0 @@ -/* tc-m68kmote.c All the m68020 specific stuff in one convenient, huge, - slow to compile, easy to find file. - Copyright (C) 1987, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#define MRI -#include <ctype.h> - -#include "as.h" -#include "bfd.h" -#include "obstack.h" - -/* note that this file includes real declarations and thus can only be included by one source file per executable. */ -#include "opcode/m68k.h" -#ifdef TE_SUN -/* This variable contains the value to write out at the beginning of - the a.out file. The 2<<16 means that this is a 68020 file instead - of an old-style 68000 file */ - -long omagic = 2<<16|OMAGIC; /* Magic byte for header file */ -#else -long omagic = OMAGIC; -#endif - -/* 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[] = "|"; - -/* This array holds the chars that only start a comment at the beginning of - a line. If the line seems to have the form '# 123 filename' - .line and .file directives will appear in the pre-processed output */ -/* Note that input_file.c hand checks for '#' at the beginning of the - first line of the input file. This is because the compiler outputs - #NO_APP at the beginning of its output. */ -/* Also note that comments like this one will always work. */ -#ifdef MRI -const char line_comment_chars[] = "*"; -#else -const char line_comment_chars[] = "#"; -#endif - -#define NO_RELOC 0 - -/* Chars that can be used to separate mant from exp in floating point nums */ -const char EXP_CHARS[] = "eE"; - -/* Chars that mean this number is a floating point constant */ -/* As in 0f12.456 */ -/* or 0d1.2345e12 */ - -const char FLT_CHARS[] = "rRsSfFdDxXeEpP"; - -/* Also be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be - changed in read.c . Ideally it shouldn't have to know about it at all, - but nothing is ideal around here. - */ - -int md_reloc_size = 8; /* Size of relocation record */ - -/* Its an arbitrary name: This means I don't approve of it */ -/* See flames below */ -static struct obstack robyn; - -#define TAB(x,y) (((x)<<2)+(y)) -#define TABTYPE(xy) ((xy) >> 2) -#define BYTE 0 -#define SHORT 1 -#define LONG 2 -#define SZ_UNDEF 3 - -#define BRANCH 1 -#define FBRANCH 2 -#define PCREL 3 -#define BCC68000 4 -#define DBCC 5 -#define PCLEA 6 - -/* Operands we can parse: (And associated modes) - - numb: 8 bit num - numw: 16 bit num - numl: 32 bit num - dreg: data reg 0-7 - reg: address or data register - areg: address register - apc: address register, PC, ZPC or empty string - num: 16 or 32 bit num - num2: like num - sz: w or l if omitted, l assumed - scale: 1 2 4 or 8 if omitted, 1 assumed - - 7.4 IMMED #num --> NUM - 0.? DREG dreg --> dreg - 1.? AREG areg --> areg - 2.? AINDR areg@ --> *(areg) - 3.? AINC areg@+ --> *(areg++) - 4.? ADEC areg@- --> *(--areg) - 5.? AOFF apc@(numw) --> *(apc+numw) -- empty string and ZPC not allowed here - 6.? AINDX apc@(num,reg:sz:scale) --> *(apc+num+reg*scale) - 6.? AINDX apc@(reg:sz:scale) --> same, with num=0 - 6.? APODX apc@(num)@(num2,reg:sz:scale) --> *(*(apc+num)+num2+reg*scale) - 6.? APODX apc@(num)@(reg:sz:scale) --> same, with num2=0 - 6.? AMIND apc@(num)@(num2) --> *(*(apc+num)+num2) (previous mode without an index reg) - 6.? APRDX apc@(num,reg:sz:scale)@(num2) --> *(*(apc+num+reg*scale)+num2) - 6.? APRDX apc@(reg:sz:scale)@(num2) --> same, with num=0 - 7.0 ABSL num:sz --> *(num) - num --> *(num) (sz L assumed) - *** MSCR otherreg --> Magic - With -l option - 5.? AOFF apc@(num) --> *(apc+num) -- empty string and ZPC not allowed here still - ?.? DINDR dreg@ --> (dreg) -- cas2 only - - examples: - #foo #0x35 #12 - d2 - a4 - a3@ - a5@+ - a6@- - a2@(12) pc@(14) - a1@(5,d2:w:1) @(45,d6:l:4) - pc@(a2) @(d4) - etc . . . - - - #name@(numw) -->turn into PC rel mode - apc@(num8,reg:sz:scale) --> *(apc+num8+reg*scale) - - */ - -enum operand_type { - IMMED = 1, - DREG, - AREG, - AINDR, - ADEC, - AINC, - AOFF, - AINDX, - APODX, - AMIND, - APRDX, - ABSL, - MSCR, - REGLST, - DINDR -}; - - -struct m68k_exp { - char *e_beg; - char *e_end; - expressionS e_exp; - short e_siz; /* 0== default 1==short/byte 2==word 3==long */ -}; - -/* DATA and ADDR have to be contiguous, so that reg-DATA gives 0-7==data reg, - 8-15==addr reg for operands that take both types */ - -enum _register { - DATA = 1, /* 1- 8 == data registers 0-7 */ - DATA0 = DATA, - DATA1, - DATA2, - DATA3, - DATA4, - DATA5, - DATA6, - DATA7, - - ADDR, - ADDR0 = ADDR, - ADDR1, - ADDR2, - ADDR3, - ADDR4, - ADDR5, - ADDR6, - ADDR7, - - /* Note that COPNUM==processor #1 -- COPNUM+7==#8, which stores as 000 */ - /* I think. . . */ - - SP = ADDR7, - - FPREG, /* Eight FP registers */ - FP0 = FPREG, - FP1, - FP2, - FP3, - FP4, - FP5, - FP6, - FP7, - COPNUM = (FPREG+8), /* Co-processor #1-#8 */ - COP0 = COPNUM, - COP1, - COP2, - COP3, - COP4, - COP5, - COP6, - COP7, - PC, /* Program counter */ - ZPC, /* Hack for Program space, but 0 addressing */ - SR, /* Status Reg */ - CCR, /* Condition code Reg */ - - /* These have to be in order for the movec instruction to work. */ - USP, /* User Stack Pointer */ - ISP, /* Interrupt stack pointer */ - SFC, - DFC, - CACR, - VBR, - CAAR, - MSP, - ITT0, - ITT1, - DTT0, - DTT1, - MMUSR, - TC, - SRP, - URP, - /* end of movec ordering constraints */ - - FPI, - FPS, - FPC, - - DRP, - CRP, - CAL, - VAL, - SCC, - AC, - BAD, - BAD0 = BAD, - BAD1, - BAD2, - BAD3, - BAD4, - BAD5, - BAD6, - BAD7, - BAC, - BAC0 = BAC, - BAC1, - BAC2, - BAC3, - BAC4, - BAC5, - BAC6, - BAC7, - PSR, - PCSR, - - IC, /* instruction cache token */ - DC, /* data cache token */ - NC, /* no cache token */ - BC, /* both caches token */ - -}; - -/* Internal form of an operand. */ -struct m68k_op { - char *error; /* Couldn't parse it */ - enum operand_type mode; /* What mode this instruction is in. */ - enum _register reg; /* Base register */ - struct m68k_exp *con1; - int ireg; /* Index register */ - int isiz; /* 0==unspec 1==byte(?) 2==short 3==long */ - int imul; /* Multipy ireg by this (1,2,4,or 8) */ - struct m68k_exp *con2; -}; - -/* internal form of a 68020 instruction */ -struct m68k_it { - char *error; - char *args; /* list of opcode info */ - int numargs; - - int numo; /* Number of shorts in opcode */ - short opcode[11]; - - struct m68k_op operands[6]; - - int nexp; /* number of exprs in use */ - struct m68k_exp exprs[4]; - - int nfrag; /* Number of frags we have to produce */ - struct { - int fragoff; /* Where in the current opcode[] the frag ends */ - symbolS *fadd; - long foff; - int fragty; - } fragb[4]; - - int nrel; /* Num of reloc strucs in use */ - struct { - int n; - symbolS *add, - *sub; - long off; - char wid; - char pcrel; - } reloc[5]; /* Five is enough??? */ -}; - -#define cpu_of_arch(x) ((x) & m68000up) -#define float_of_arch(x) ((x) & mfloat) -#define mmu_of_arch(x) ((x) & mmmu) - -static struct m68k_it the_ins; /* the instruction being assembled */ - -/* Macros for adding things to the m68k_it struct */ - -#define addword(w) the_ins.opcode[the_ins.numo++]=(w) - -/* Like addword, but goes BEFORE general operands */ -#define insop(w) {int z;\ - for(z=the_ins.numo;z>opcode->m_codenum;--z)\ - the_ins.opcode[z]=the_ins.opcode[z-1];\ - for(z=0;z<the_ins.nrel;z++)\ - the_ins.reloc[z].n+=2;\ - the_ins.opcode[opcode->m_codenum]=w;\ - the_ins.numo++;\ - } - - -#define add_exp(beg,end) (\ - the_ins.exprs[the_ins.nexp].e_beg=beg,\ - the_ins.exprs[the_ins.nexp].e_end=end,\ - &the_ins.exprs[the_ins.nexp++]\ - ) - - -/* The numo+1 kludge is so we can hit the low order byte of the prev word. Blecch*/ -#define add_fix(width,exp,pc_rel) {\ - the_ins.reloc[the_ins.nrel].n= ((width)=='B') ? (the_ins.numo*2-1) : \ - (((width)=='b') ? ((the_ins.numo-1)*2) : (the_ins.numo*2));\ - the_ins.reloc[the_ins.nrel].add=adds((exp));\ - the_ins.reloc[the_ins.nrel].sub=subs((exp));\ - the_ins.reloc[the_ins.nrel].off=offs((exp));\ - the_ins.reloc[the_ins.nrel].wid=width;\ - the_ins.reloc[the_ins.nrel++].pcrel=pc_rel;\ - } - -#define add_frag(add,off,type) {\ - the_ins.fragb[the_ins.nfrag].fragoff=the_ins.numo;\ - the_ins.fragb[the_ins.nfrag].fadd=add;\ - the_ins.fragb[the_ins.nfrag].foff=off;\ - the_ins.fragb[the_ins.nfrag++].fragty=type;\ - } - -#define isvar(exp) ((exp) && (adds(exp) || subs(exp))) - -#define seg(exp) ((exp)->e_exp.X_seg) -#define adds(exp) ((exp)->e_exp.X_add_symbol) -#define subs(exp) ((exp)->e_exp.X_subtract_symbol) -#define offs(exp) ((exp)->e_exp.X_add_number) - - -struct m68k_incant { - char *m_operands; - unsigned long m_opcode; - short m_opnum; - short m_codenum; - enum m68k_architecture m_arch; - struct m68k_incant *m_next; -}; - -#define getone(x) ((((x)->m_opcode)>>16)&0xffff) -#define gettwo(x) (((x)->m_opcode)&0xffff) - - -#if __STDC__ == 1 - -static char *crack_operand(char *str, struct m68k_op *opP); -static int get_num(struct m68k_exp *exp, int ok); -static int get_regs(int i, char *str, struct m68k_op *opP); -static int reverse_16_bits(int in); -static int reverse_8_bits(int in); -static int try_index(char **s, struct m68k_op *opP); -static void install_gen_operand(int mode, int val); -static void install_operand(int mode, int val); -static void s_bss(void); -static void s_data1(void); -static void s_data2(void); -static void s_even(void); -static void s_proc(void); - -#else /* not __STDC__ */ - -static char *crack_operand(); -static int get_num(); -static int get_regs(); -static int reverse_16_bits(); -static int reverse_8_bits(); -static int try_index(); -static void install_gen_operand(); -static void install_operand(); -static void s_bss(); -static void s_data1(); -static void s_data2(); -static void s_even(); -static void s_proc(); - -#endif /* not __STDC__ */ - -static enum m68k_architecture current_architecture = _m68k_undef; - -/* BCC68000 is for patching in an extra jmp instruction for long offsets - on the 68000. The 68000 doesn't support long branches with branchs */ - -/* This table desribes how you change sizes for the various types of variable - size expressions. This version only supports two kinds. */ - -/* Note that calls to frag_var need to specify the maximum expansion needed */ -/* This is currently 10 bytes for DBCC */ - -/* The fields are: - How far Forward this mode will reach: - How far Backward this mode will reach: - How many bytes this mode will add to the size of the frag - Which mode to go to if the offset won't fit in this one - */ -const relax_typeS - md_relax_table[] = { - { 1, 1, 0, 0 }, /* First entries aren't used */ - { 1, 1, 0, 0 }, /* For no good reason except */ - { 1, 1, 0, 0 }, /* that the VAX doesn't either */ - { 1, 1, 0, 0 }, - - { (127), (-128), 0, TAB(BRANCH,SHORT)}, - { (32767), (-32768), 2, TAB(BRANCH,LONG) }, - { 0, 0, 4, 0 }, - { 1, 1, 0, 0 }, - - { 1, 1, 0, 0 }, /* FBRANCH doesn't come BYTE */ - { (32767), (-32768), 2, TAB(FBRANCH,LONG)}, - { 0, 0, 4, 0 }, - { 1, 1, 0, 0 }, - - { 1, 1, 0, 0 }, /* PCREL doesn't come BYTE */ - { (32767), (-32768), 2, TAB(PCREL,LONG)}, - { 0, 0, 4, 0 }, - { 1, 1, 0, 0 }, - - { (127), (-128), 0, TAB(BCC68000,SHORT)}, - { (32767), (-32768), 2, TAB(BCC68000,LONG) }, - { 0, 0, 6, 0 }, /* jmp long space */ - { 1, 1, 0, 0 }, - - { 1, 1, 0, 0 }, /* DBCC doesn't come BYTE */ - { (32767), (-32768), 2, TAB(DBCC,LONG) }, - { 0, 0, 10, 0 }, /* bra/jmp long space */ - { 1, 1, 0, 0 }, - - { 1, 1, 0, 0 }, /* PCLEA doesn't come BYTE */ - { 32767, -32768, 2, TAB(PCLEA,LONG) }, - { 0, 0, 6, 0 }, - { 1, 1, 0, 0 }, - - }; - -/* These are the machine dependent pseudo-ops. These are included so - the assembler can work on the output from the SUN C compiler, which - generates these. - */ - -/* This table describes all the machine specific pseudo-ops the assembler - has to support. The fields are: - pseudo-op name without dot - function to call to execute this pseudo-op - Integer arg to pass to the function - */ -#ifdef MRI - -void cons(); -void s_sect(); -void float_cons(); -void s_align_bytes(); -void s_chip(); -void s_ds(); -void s_dcb(); -void s_dc(); -const pseudo_typeS md_pseudo_table[] = { - { "xdef", s_globl, 0 }, - { "sect", s_sect, 0 }, - { "dc", s_dc, 2 }, - { "dc.d", float_cons, 'd' }, - { "dc.s", float_cons, 'f' }, - { "dc.l", s_dc, 4 }, - { "dc.w", s_dc, 2 }, - { "dc.b", s_dc, 1 }, - { "comline", s_ds, 1 }, - { "ds.b", s_ds, 1 }, - { "ds.w", s_ds, 2 }, - { "ds", s_ds, 2 }, - { "ds.l", s_ds, 4 }, - { "ds.d", s_ds, 8 }, - { "ds.s", s_ds, 4 }, - { "dcb", s_dcb, 2 }, - { "dcb.b", s_dcb, 1 }, - { "dcb.w", s_dcb, 2 }, - { "dcb.l", s_dcb, 4 }, - { "xcom", s_comm, 0 }, - { "align", s_align_bytes, 0 }, - { "chip", s_chip, 0 }, - { 0, 0, 0 } -}; -#else - -const pseudo_typeS md_pseudo_table[] = { - { "data1", s_data1, 0 }, - { "data2", s_data2, 0 }, - { "bss", s_bss, 0 }, - { "even", s_even, 0 }, - { "skip", s_space, 0 }, - { "proc", s_proc, 0 }, - { 0, 0, 0 } -} - - - - -#endif - -/* #define isbyte(x) ((x)>=-128 && (x)<=127) */ -/* #define isword(x) ((x)>=-32768 && (x)<=32767) */ - -#define issbyte(x) ((x)>=-128 && (x)<=127) -#define isubyte(x) ((x)>=0 && (x)<=255) -#define issword(x) ((x)>=-32768 && (x)<=32767) -#define isuword(x) ((x)>=0 && (x)<=65535) - -#define isbyte(x) ((x)>=-128 && (x)<=255) -#define isword(x) ((x)>=-32768 && (x)<=65535) -#define islong(x) (1) - -extern char *input_line_pointer; - -enum { - FAIL = 0, - OK = 1, -}; - -/* JF these tables here are for speed at the expense of size */ -/* You can replace them with the #if 0 versions if you really - need space and don't mind it running a bit slower */ - -static char mklower_table[256]; -#define mklower(c) (mklower_table[(unsigned char)(c)]) -static char notend_table[256]; -static char alt_notend_table[256]; -#define notend(s) ( !(notend_table[(unsigned char)(*s)] || (*s==':' &&\ - alt_notend_table[(unsigned char)(s[1])]))) - -#if 0 -#define mklower(c) (isupper(c) ? tolower(c) : c) -#endif - -#define ISSPACE(x) ((x) == ' ' || (x) == '\t') -#ifdef MRI -#define MULTIPLIER '*' -#define SIZER '.' -#else -#define MULTIPLIER ':' -#define SIZER ':' -#endif - - -/* JF modified this to handle cases where the first part of a symbol name - looks like a register */ - -/* - * m68k_reg_parse() := if it looks like a register, return it's token & - * advance the pointer. - */ - -enum _register m68k_reg_parse(ccp) -register char **ccp; -{ -#ifndef MAX_REG_NAME_LEN -#define MAX_REG_NAME_LEN (6) -#endif /* MAX_REG_NAME_LEN */ - register char c[MAX_REG_NAME_LEN]; - char *p, *q; - register int n = 0, - ret = FAIL; - - c[0] = mklower(ccp[0][0]); -#ifdef REGISTER_PREFIX - if (c[0] != REGISTER_PREFIX) { - return(FAIL); - } /* need prefix */ -#endif - - for (p = c, q = ccp[0]; p < c + MAX_REG_NAME_LEN; ++p, ++q) - { - if (*q == 0) - { - *p = 0; - break; - } - else - *p = mklower(*q); - } /* downcase */ - - switch(c[0]) { - case 'a': - if(c[1]>='0' && c[1]<='7') { - n=2; - ret=ADDR+c[1]-'0'; - } -#ifndef NO_68851 - else if (c[1] == 'c') { - n = 2; - ret = AC; - } -#endif - break; -#ifndef NO_68851 - case 'b': - if (c[1] == 'a') { - if (c[2] == 'd') { - if (c[3] >= '0' && c[3] <= '7') { - n = 4; - ret = BAD + c[3] - '0'; - } - } /* BAD */ - if (c[2] == 'c') { - if (c[3] >= '0' && c[3] <= '7') { - n = 4; - ret = BAC + c[3] - '0'; - } - } /* BAC */ - } else if (c[1] == 'c') { - n = 2; - ret = BC; - } /* BC */ - break; -#endif - case 'c': -#ifndef NO_68851 - if (c[1] == 'a' && c[2] == 'l') { - n = 3; - ret = CAL; - } else -#endif - /* This supports both CCR and CC as the ccr reg. */ - if(c[1]=='c' && c[2]=='r') { - n=3; - ret = CCR; - } else if(c[1]=='c') { - n=2; - ret = CCR; - } else if(c[1]=='a' && (c[2]=='a' || c[2]=='c') && c[3]=='r') { - n=4; - ret = c[2]=='a' ? CAAR : CACR; - } -#ifndef NO_68851 - else if (c[1] == 'r' && c[2] == 'p') { - n = 3; - ret = (CRP); - } -#endif - break; - case 'd': - if (c[1] >= '0' && c[1] <= '7') { - n = 2; - ret = DATA + c[1] - '0'; - } else if (c[1] == 'f' && c[2] == 'c') { - n = 3; - ret = DFC; - } else if (c[1] == 'c') { - n = 2; - ret = DC; - } else if (c[1] == 't' && c[2] == 't') { - if ('0' <= c[3] && c[3] <= '1') { - n = 4; - ret = DTT0 + (c[3] - '0'); - } /* DTT[01] */ - } -#ifndef NO_68851 - else if (c[1] == 'r' && c[2] == 'p') { - n = 3; - ret = (DRP); - } -#endif - break; - case 'f': - if(c[1]=='p') { - if(c[2]>='0' && c[2]<='7') { - n=3; - ret = FPREG+c[2]-'0'; - if(c[3]==':') - ccp[0][3]=','; - } else if(c[2]=='i') { - n=3; - ret = FPI; - } else if(c[2]=='s') { - n= (c[3] == 'r' ? 4 : 3); - ret = FPS; - } else if(c[2]=='c') { - n= (c[3] == 'r' ? 4 : 3); - ret = FPC; - } else if (!isalpha(c[2]) && !isdigit(c[2])) { - n = 2; - ret = ADDR + 6; - } - - - } - break; - case 'i': - if (c[1] == 's' && c[2] == 'p') { - n = 3; - ret = ISP; - } else if (c[1] == 'c') { - n = 2; - ret = IC; - } else if (c[1] == 't' && c[2] == 't') { - if ('0' <= c[3] && c[3] <= '1') { - n = 4; - ret = ITT0 + (c[3] - '0'); - } /* ITT[01] */ - } - break; - case 'm': - if (c[1] == 's' && c[2] == 'p') { - n = 3; - ret = MSP; - } else if (c[1] == 'm' && c[2] == 'u' && c[3] == 's' && c[4] == 'r') { - n = 5; - ret = MMUSR; - } - break; - case 'n': - if (c[1] == 'c') { - n = 2; - ret = NC; - } - break; - case 'p': - if(c[1]=='c') { -#ifndef NO_68851 - if(c[2] == 's' && c[3]=='r') { - n=4; - ret = (PCSR); - } else -#endif - { - n=2; - ret = PC; - } - } -#ifndef NO_68851 - else if (c[1] == 's' && c[2] == 'r') { - n = 3; - ret = (PSR); - } -#endif - break; - case 's': -#ifndef NO_68851 - if (c[1] == 'c' && c[2] == 'c') { - n = 3; - ret = (SCC); - } else -#endif - if (c[1] == 'r') { - if (c[2] == 'p') { - n = 3; - ret = SRP; - } else { - n = 2; - ret = SR; - } /* srp else sr */ - } else if (c[1] == 'p') { - n = 2; - ret = SP; - } else if (c[1] == 'f' && c[2] == 'c') { - n = 3; - ret = SFC; - } - break; - case 't': - if (c[1] == 'c') { - n = 2; - ret = TC; - } - break; - case 'u': - if (c[1] == 's' && c[2] == 'p') { - n=3; - ret = USP; - } else if (c[1] == 'r' && c[2] == 'p') { - n = 3; - ret = URP; - } - break; - case 'v': -#ifndef NO_68851 - if (c[1] == 'a' && c[2] == 'l') { - n = 3; - ret = (VAL); - } else -#endif - if(c[1]=='b' && c[2]=='r') { - n=3; - ret = VBR; - } - break; - case 'z': - if(c[1]=='p' && c[2]=='c') { - n=3; - ret = ZPC; - } - break; - default: - break; - } - if(n) { -#ifdef REGISTER_PREFIX - n++; -#endif - if(isalnum(ccp[0][n]) || ccp[0][n]=='_') - ret=FAIL; - else - ccp[0]+=n; - } else - ret = FAIL; - return ret; -} - -#define SKIP_WHITE() { str++; if(ISSPACE(*str)) str++;} - -#ifdef MRI - - -/* Parse an operand from the text *str into the operand struct *opP. */ -int - m68k_ip_op(str,opP) -char *str; -register struct m68k_op *opP; -{ - char *strend; - long i; - char *parse_index(); - - /* Skip leading blank */ - if(ISSPACE(*str)) - str++; - if(!*str) { - opP->error="Missing operand"; - return FAIL; - } - /* *strend = last character of string */ - for(strend=str;*strend;strend++) - ; - --strend; - - /* Logic of the parsing switch(*str): - case opP->mode = - ---- ----------- - #anything IMMED 1 - REG AREG or DREG or MSCR 3 or 2 or 13 - REG- or REG/ REGLST 14 - (REG) AINDR 4 - (REG)+ AINC 6 - (REG,INDX) AINDX 8 - (EXPR,REG) AOFF 7 - (EXPR,REG,INDX) AINDX 8 - -(REG) ADEC 5 - EXP2(REG) AOFF 7 - EXP2(REG,INDX) AINDX 8 - EXP2 ABSL 12 - - REG means truth(m68k_reg_parse(&str)) - INDX means truth(try_index(&str,opP)) - EXPR means not REG - EXP2 means not REG and not '(' and not '-(' - */ - - if(*str=='#') { - /* "#<expression>" Immediate mode */ - str++; - opP->con1=add_exp(str,strend); - opP->mode=IMMED; - return OK; - } - - i=m68k_reg_parse(&str); - if (i!=FAIL) { - if(*str=='\0') { - /* "Rn" Register Direct mode */ - opP->reg=i; - if(i>=DATA+0 && i<=DATA+7) - opP->mode=DREG; - else if(i>=ADDR+0 && i<=ADDR+7) - opP->mode=AREG; - else - opP->mode=MSCR; - return OK; - } - else if(*str=='/' || *str=='-') { - /* "Rm-Rn/Ro-Rp" Register list for MOVEM instruction */ - opP->mode=REGLST; - return get_regs(i,str,opP); - } - else { - opP->error="Junk after register name"; - return FAIL; - } - } - - if(*str=='(') { - str++; - i=m68k_reg_parse(&str); - if((i<ADDR+0 || i>ADDR+7) && i!=PC && i!=ZPC && i!=FAIL - && (*str != ')' || str[1] != '\0' || i<DATA+0 || i>DATA+7)) { - /* Can't indirect off non address regs, - but (dx) is OK for cas2. */ - opP->error="Invalid indirect register"; - return FAIL; - } - if(i!=FAIL) { - opP->reg=i; - if(*str==')') { - str++; - if(*str=='\0') { - /* "(An)" Address Register Indirect mode - or "(Dn)" for cas2 instruction. */ - if (i < DATA + 0 || i > DATA + 7) - opP->mode=AINDR; - else - opP->mode=DINDR; - return OK; - } - if(*str=='+') { - if(str[1]=='\0') { - /* "(An)+" Register Indirect w Postincrement */ - opP->mode=AINC; - return OK; - } - } - opP->error="Junk after indirect"; - return FAIL; - } - if(*str==',') { - str++; - i=try_index(&str,opP); - if(i==FAIL) return FAIL; - /* "(An,Rn)" Register Indirect with Index mode*/ - opP->mode=AINDX; - return OK; - } - else { - opP->error="Bad indirect syntax"; - return FAIL; - } - } - else { - /* "(EXPR,..." , a displacement */ - char *stmp; - char *index(); - - if(stmp=index(str,',')) { - opP->con1=add_exp(str,stmp-1); - str=stmp; - SKIP_WHITE(); - i=m68k_reg_parse(&str); - if((i<ADDR+0 || i>ADDR+7) && i!=PC && i!=ZPC) { - /* Can't indirect off non address regs */ - opP->error="Invalid indirect register"; - return FAIL; - } - if(i!=FAIL) { - opP->reg=i; - if(*str==')') { - /* "(d,An)" Register Indirect w Displacement */ - opP->mode=AOFF; - return OK; - } - if(*str==',') { - str++; - i=try_index(&str,opP); - if(i==FAIL) return FAIL; - /* "(d,An,Rn)" Register Indirect with Index */ - opP->mode=AINDX; - return OK; - } - else { - opP->error="Bad indirect syntax"; - return FAIL; - } - } - else { - opP->error="Invalid register"; - return FAIL; - } - } - else { - opP->error="Missing register for indirect"; - return FAIL; - } - } - } - - if(*str=='-') { - if(str[1]=='(') { - str = str+2; - i=m68k_reg_parse(&str); - if((i<ADDR+0 || i>ADDR+7) && i!=PC && i!=ZPC && i!=FAIL) { - /* Can't indirect off non address regs */ - opP->error="Invalid indirect register"; - return FAIL; - } - if(i!=FAIL) { - opP->reg=i; - if(*str==')') { - str++; - if(*str=='\0') { - /* "-(An)" Register Indirect with Predecrement */ - opP->mode=ADEC; - return OK; - } - opP->error="Junk after indirect"; - return FAIL; - } - opP->error="Bad indirect syntax"; - return FAIL; - } - opP->error="Invalid register"; - return FAIL; - } - /* if '-' but not "-(', do nothing */ - } - - /* whether *str=='-' or not */ - { - /* "EXP2" or "EXP2(REG..." */ - char *stmp; - char *index(); - if(stmp=index(str,'(')) { - opP->con1=add_exp(str,stmp-1); - str=stmp+1; - i=m68k_reg_parse(&str); - if((i<ADDR+0 || i>ADDR+7) && i!=PC && i!=ZPC) { - /* Can't indirect off non address regs */ - opP->error="Invalid indirect register"; - return FAIL; - } - if(i!=FAIL) { - opP->reg=i; - if(*str==')') { - /* "d(An)" Register Indirect w Displacement */ - opP->mode=AOFF; - return OK; - } - if(*str==',') { - str++; - i=try_index(&str,opP); - if(i==FAIL) return FAIL; - /* "d(An,Rn)" Register Indirect with Index */ - opP->mode=AINDX; - return OK; - } - else { - opP->error="Bad indirect syntax"; - return FAIL; - } - } - else { - opP->error="Invalid register"; - return FAIL; - } - } - else { - /* "EXP2" Absolute */ - opP->mode=ABSL; - if(strend[-1]=='.') { /* mode ==foo.[wl] */ - switch(*strend) { - case 'w': - case 'W': - opP->isiz=2; - break; - case 'l': - case 'L': - opP->isiz=3; - break; - default: - opP->error="Size spec not .W or .L"; - return FAIL; - } - strend-=2; - } - else opP->isiz=0; - - - opP->con1=add_exp(str,strend); - return OK; - } - } -} -/* end of m68k_ip_op () */ -#else -/* - * m68k_ip_op := '#' + <anything> - * | <register> + range_sep + get_regs - * ; - * - * range_sep := '/' | '-' ; - * - * SKIP_WHITE := <empty> | ' ' ; - * - */ - -int - m68k_ip_op(str,opP) -char *str; -register struct m68k_op *opP; -{ - char *strend; - long i; - char *parse_index(); - - if (ISSPACE(*str)) { - str++; - } /* Find the beginning of the string */ - - if(!*str) { - opP->error="Missing operand"; - return FAIL; - } /* Out of gas */ - - for(strend = str; *strend; strend++) ;; - - --strend; - - if(*str=='#') { - str++; - opP->con1=add_exp(str,strend); - opP->mode=IMMED; - return OK; - } /* Guess what: A constant. Shar and enjoy */ - - i = m68k_reg_parse(&str); - - /* is a register, is exactly a register, and is followed by '@' */ - - if((i==FAIL || *str!='\0') && *str!='@') { - char *stmp; - - if(i!=FAIL && (*str=='/' || *str=='-')) { - opP->mode=REGLST; - return(get_regs(i,str,opP)); - } - if ((stmp=strchr(str,'@')) != '\0') { - opP->con1=add_exp(str,stmp-1); - if(stmp==strend) { - opP->mode=AINDX; - return(OK); - } - - if ((current_architecture & m68020up) == 0) { - return(FAIL); - } /* if target is not a '20 or better */ - - stmp++; - if(*stmp++!='(' || *strend--!=')') { - opP->error="Malformed operand"; - return(FAIL); - } - i=try_index(&stmp,opP); - opP->con2=add_exp(stmp,strend); - - if (i == FAIL) { - opP->mode=AMIND; - } else { - opP->mode=APODX; - } - return(OK); - } /* if there's an '@' */ - opP->mode = ABSL; - opP->con1 = add_exp(str,strend); - return(OK); - } /* not a register, not exactly a register, or no '@' */ - - opP->reg=i; - - if (*str=='\0') { - if(i>=DATA+0 && i<=DATA+7) - opP->mode=DREG; - else if(i>=ADDR+0 && i<=ADDR+7) - opP->mode=AREG; - else - opP->mode=MSCR; - return OK; - } - - /* Can't indirect off non address regs, but Dx@ is OK for cas2 */ - if((i<ADDR+0 || i>ADDR+7) && i!=PC && i!=ZPC && i!=FAIL - && (str[1] != '\0' || i<DATA+0 || i>DATA+7)) { - opP->error="Invalid indirect register"; - return FAIL; - } - know(*str == '@'); - - str++; - switch(*str) { - case '\0': - if (i < DATA + 0 || i > DATA + 7) - opP->mode=AINDR; - else - opP->mode=DINDR; - return OK; - case '-': - opP->mode=ADEC; - return OK; - case '+': - opP->mode=AINC; - return OK; - case '(': - str++; - break; - default: - opP->error="Junk after indirect"; - return FAIL; - } - /* Some kind of indexing involved. Lets find out how bad it is */ - i=try_index(&str,opP); - /* Didn't start with an index reg, maybe its offset or offset,reg */ - if(i==FAIL) { - char *beg_str; - - beg_str=str; - for(i=1;i;) { - switch(*str++) { - case '\0': - opP->error="Missing )"; - return FAIL; - case ',': i=0; break; - case '(': i++; break; - case ')': --i; break; - } - } - /* if(str[-3]==':') { - int siz; - - switch(str[-2]) { - case 'b': - case 'B': - siz=1; - break; - case 'w': - case 'W': - siz=2; - break; - case 'l': - case 'L': - siz=3; - break; - default: - opP->error="Specified size isn't :w or :l"; - return FAIL; - } - opP->con1=add_exp(beg_str,str-4); - opP->con1->e_siz=siz; - } else */ - opP->con1=add_exp(beg_str,str-2); - /* Should be offset,reg */ - if(str[-1]==',') { - i=try_index(&str,opP); - if(i==FAIL) { - opP->error="Malformed index reg"; - return FAIL; - } - } - } - /* We've now got offset) offset,reg) or reg) */ - - if (*str == '\0') { - /* Th-the-thats all folks */ - if (opP->reg == FAIL) opP->mode = AINDX; /* Other form of indirect */ - else if(opP->ireg == FAIL) opP->mode = AOFF; - else opP->mode = AINDX; - return(OK); - } - /* Next thing had better be another @ */ - if(*str!='@' || str[1]!='(') { - opP->error = "junk after indirect"; - return(FAIL); - } - - if ((current_architecture & m68020up) == 0) { - return(FAIL); - } /* if target is not a '20 or better */ - - str+=2; - - if(opP->ireg != FAIL) { - opP->mode = APRDX; - - i = try_index(&str, opP); - if (i != FAIL) { - opP->error = "Two index registers! not allowed!"; - return(FAIL); - } - } else { - i = try_index(&str, opP); - } - - if (i == FAIL) { - char *beg_str; - - beg_str = str; - - for (i = 1; i; ) { - switch(*str++) { - case '\0': - opP->error="Missing )"; - return(FAIL); - case ',': i=0; break; - case '(': i++; break; - case ')': --i; break; - } - } - - opP->con2=add_exp(beg_str,str-2); - - if (str[-1] == ',') { - if (opP->ireg != FAIL) { - opP->error = "Can't have two index regs"; - return(FAIL); - } - - i = try_index(&str, opP); - - if (i == FAIL) { - opP->error = "malformed index reg"; - return(FAIL); - } - - opP->mode = APODX; - } else if (opP->ireg != FAIL) { - opP->mode = APRDX; - } else { - opP->mode = AMIND; - } - } else { - opP->mode = APODX; - } - - if(*str!='\0') { - opP->error="Junk after indirect"; - return FAIL; - } - return(OK); -} /* m68k_ip_op() */ -#endif -/* - * - * try_index := data_or_address_register + ')' + SKIP_W - * | data_or_address_register + ':' + SKIP_W + size_spec + SKIP_W + multiplier + ')' + SKIP_W - * - * multiplier := <empty> - * | ':' + multiplier_number - * ; - * - * multiplier_number := '1' | '2' | '4' | '8' ; - * - * size_spec := 'l' | 'L' | 'w' | 'W' ; - * - * SKIP_W := <empty> | ' ' ; - * - */ - -static int try_index(s,opP) -char **s; -struct m68k_op *opP; -{ - register int i; - char *ss; -#define SKIP_W() { ss++; if (ISSPACE(*ss)) ss++;} - - ss= *s; - /* SKIP_W(); */ - i=m68k_reg_parse(&ss); - if(!(i>=DATA+0 && i<=ADDR+7)) { /* if i is not DATA or ADDR reg */ - *s=ss; - return FAIL; - } - opP->ireg=i; - /* SKIP_W(); */ - if(*ss==')') { - opP->isiz=0; - opP->imul=1; - SKIP_W(); - *s=ss; - return OK; - } - if(*ss!=SIZER) - { - opP->error="Missing : in index register"; - *s=ss; - return FAIL; - } - SKIP_W(); - switch(*ss) { - case 'w': - case 'W': - opP->isiz=2; - break; - case 'l': - case 'L': - opP->isiz=3; - break; - default: - opP->error="Index register size spec not :w or :l"; - *s=ss; - return FAIL; - } - SKIP_W(); - if(*ss==MULTIPLIER) - { - SKIP_W(); - switch(*ss) { - case '1': - case '2': - case '4': - case '8': - opP->imul= *ss-'0'; - break; - default: - opP->error="index multiplier not 1, 2, 4 or 8"; - *s=ss; - return FAIL; - } - SKIP_W(); - } else opP->imul=1; - if(*ss!=')') { - opP->error="Missing )"; - *s=ss; - return FAIL; - } - SKIP_W(); - *s=ss; - return OK; -} /* try_index() */ - -#ifdef TEST1 /* TEST1 tests m68k_ip_op(), which parses operands */ -main() -{ - char buf[128]; - struct m68k_op thark; - - for(;;) { - if(!gets(buf)) - break; - memset(&thark, '\0', sizeof(thark)); - if(!m68k_ip_op(buf,&thark)) printf("FAIL:"); - if(thark.error) - printf("op1 error %s in %s\n",thark.error,buf); - printf("mode %d, reg %d, ",thark.mode,thark.reg); - if(thark.b_const) - printf("Constant: '%.*s',",1+thark.e_const-thark.b_const,thark.b_const); - printf("ireg %d, isiz %d, imul %d ",thark.ireg,thark.isiz,thark.imul); - if(thark.b_iadd) - printf("Iadd: '%.*s'",1+thark.e_iadd-thark.b_iadd,thark.b_iadd); - printf("\n"); - } - exit(0); -} - -#endif - - -static struct hash_control* op_hash = NULL; /* handle of the OPCODE hash table - NULL means any use before m68k_ip_begin() - will crash */ - - -/* - * m 6 8 k _ i p ( ) - * - * This converts a string into a 68k instruction. - * The string must be a bare single instruction in sun format - * with RMS-style 68020 indirects - * (example: ) - * - * It provides some error messages: at most one fatal error message (which - * stops the scan) and at most one warning message for each operand. - * The 68k instruction is returned in exploded form, since we have no - * knowledge of how you parse (or evaluate) your expressions. - * We do however strip off and decode addressing modes and operation - * mnemonic. - * - * This function's value is a string. If it is not "" then an internal - * logic error was found: read this code to assign meaning to the string. - * No argument string should generate such an error string: - * it means a bug in our code, not in the user's text. - * - * You MUST have called m68k_ip_begin() once and m86_ip_end() never before using - * this function. - */ - -/* JF this function no longer returns a useful value. Sorry */ -void m68k_ip (instring) -char *instring; -{ - register char *p; - register struct m68k_op *opP; - register struct m68k_incant *opcode, prev_opcode; - register char *s; - register int tmpreg = 0, - baseo = 0, - outro = 0, - nextword; - int siz1, - siz2; - char c; - int losing; - int opsfound; - char *crack_operand(); - - LITTLENUM_TYPE words[6]; - LITTLENUM_TYPE *wordp; - - if (ISSPACE(*instring)) - instring++; /* skip leading whitespace */ - - /* Scan up to end of operation-code, which MUST end in end-of-string - or exactly 1 space. */ - for (p = instring; *p != '\0'; p++) - if (ISSPACE(*p)) - break; - - - if (p == instring) { - the_ins.error = "No operator"; - the_ins.opcode[0] = NULL; - /* the_ins.numo=1; */ - return; - } - - /* p now points to the end of the opcode name, probably whitespace. - make sure the name is null terminated by clobbering the whitespace, - look it up in the hash table, then fix it back. */ - c = *p; - *p = '\0'; -#ifdef MRI - /* Copy from input line to our private buffer, and drop any dots */ - { - char our_copy[100]; - char *dst = our_copy; - char *src = instring; - while (*src) - { - if (*src != '.') - *dst++ = *src; - src++; - } - *dst = 0; - - - opcode = (struct m68k_incant *)hash_find (op_hash, our_copy); - - /* If no match, try again with a w suffix */ - if (!opcode) - { - *dst++ = 'w'; - *dst = 0; - opcode = (struct m68k_incant *)hash_find (op_hash, our_copy); - } - - - - } - -#else - opcode = (struct m68k_incant *)hash_find (op_hash, instring); -#endif - *p = c; - - if (opcode == NULL) { - the_ins.error = "Unknown opcode"; - the_ins.opcode[0] = NULL; - /* the_ins.numo=1; */ - return; - } - - /* found a legitimate opcode, start matching operands */ - while (ISSPACE(*p)) ++p; - - for(opP = &the_ins.operands[0]; *p; opP++) { - - p = crack_operand(p, opP); - - if (opP->error) { - the_ins.error=opP->error; - return; - } - } - - opsfound = opP - &the_ins.operands[0]; - - /* This ugly hack is to support the floating pt opcodes in their standard form */ - /* Essentially, we fake a first enty of type COP#1 */ - if (opcode->m_operands[0]=='I') { - int n; - - for(n=opsfound;n>0;--n) - the_ins.operands[n]=the_ins.operands[n-1]; - - /* memcpy((char *)(&the_ins.operands[1]), (char *)(&the_ins.operands[0]), opsfound*sizeof(the_ins.operands[0])); */ - memset((char *)(&the_ins.operands[0]), '\0', sizeof(the_ins.operands[0])); - the_ins.operands[0].mode=MSCR; - the_ins.operands[0].reg=COPNUM; /* COP #1 */ - opsfound++; - } - - /* We've got the operands. Find an opcode that'll accept them */ - for (losing = 0; ; ) { - /* if we didn't get the right number of ops, - or we have no common model with this pattern - then reject this pattern. */ - - if (opsfound != opcode->m_opnum - || ((opcode->m_arch & current_architecture) == 0)) { - - ++losing; - - } else { - for (s=opcode->m_operands, opP = &the_ins.operands[0]; *s && !losing; s += 2, opP++) { - /* Warning: this switch is huge! */ - /* I've tried to organize the cases into this order: - non-alpha first, then alpha by letter. lower-case goes directly - before uppercase counterpart. */ - /* Code with multiple case ...: gets sorted by the lowest case ... - it belongs to. I hope this makes sense. */ - switch(*s) { - case '!': - if (opP->mode == MSCR || opP->mode == IMMED - || opP->mode == DREG || opP->mode == AREG - || opP->mode == AINC || opP->mode == ADEC - || opP->mode == REGLST) - losing++; - break; - - case '#': - if(opP->mode!=IMMED) - losing++; - else { - long t; - - t=get_num(opP->con1,80); - if(s[1]=='b' && !isbyte(t)) - losing++; - else if(s[1]=='w' && !isword(t)) - losing++; - } - break; - - case '^': - case 'T': - if(opP->mode!=IMMED) - losing++; - break; - - case '$': - if(opP->mode==MSCR || opP->mode==AREG || - opP->mode==IMMED || opP->reg==PC || opP->reg==ZPC || opP->mode==REGLST) - losing++; - break; - - case '%': - if(opP->mode==MSCR || opP->reg==PC || - opP->reg==ZPC || opP->mode==REGLST) - losing++; - break; - - - case '&': - if(opP->mode==MSCR || opP->mode==DREG || - opP->mode==AREG || opP->mode==IMMED || opP->reg==PC || opP->reg==ZPC || - opP->mode==AINC || opP->mode==ADEC || opP->mode==REGLST) - losing++; - break; - - case '*': - if(opP->mode==MSCR || opP->mode==REGLST) - losing++; - break; - - case '+': - if(opP->mode!=AINC) - losing++; - break; - - case '-': - if(opP->mode!=ADEC) - losing++; - break; - - case '/': - if(opP->mode==MSCR || opP->mode==AREG || - opP->mode==AINC || opP->mode==ADEC || opP->mode==IMMED || opP->mode==REGLST) - losing++; - break; - - case ';': - if(opP->mode==MSCR || opP->mode==AREG || opP->mode==REGLST) - losing++; - break; - - case '?': - if(opP->mode==MSCR || opP->mode==AREG || - opP->mode==AINC || opP->mode==ADEC || opP->mode==IMMED || opP->reg==PC || - opP->reg==ZPC || opP->mode==REGLST) - losing++; - break; - - case '@': - if(opP->mode==MSCR || opP->mode==AREG || - opP->mode==IMMED || opP->mode==REGLST) - losing++; - break; - - case '~': /* For now! (JF FOO is this right?) */ - if(opP->mode==MSCR || opP->mode==DREG || - opP->mode==AREG || opP->mode==IMMED || opP->reg==PC || opP->reg==ZPC || opP->mode==REGLST) - losing++; - break; - - case 'A': - if(opP->mode!=AREG) - losing++; - break; - case 'a': - if (opP->mode != AINDR) { - ++losing; - } /* if not address register indirect */ - break; - case 'B': /* FOO */ - if(opP->mode!=ABSL || (flagseen['S'] && instring[0] == 'j' - && instring[1] == 'b' - && instring[2] == 's' - && instring[3] == 'r')) - losing++; - break; - - case 'C': - if(opP->mode!=MSCR || opP->reg!=CCR) - losing++; - break; - - case 'd': /* FOO This mode is a KLUDGE!! */ - if(opP->mode!=AOFF && (opP->mode!=ABSL || - opP->con1->e_beg[0]!='(' || opP->con1->e_end[0]!=')')) - losing++; - break; - - case 'D': - if(opP->mode!=DREG) - losing++; - break; - - case 'F': - if(opP->mode!=MSCR || opP->reg<(FPREG+0) || opP->reg>(FPREG+7)) - losing++; - break; - - case 'I': - if(opP->mode!=MSCR || opP->reg<COPNUM || - opP->reg>=COPNUM+7) - losing++; - break; - - case 'J': - if (opP->mode != MSCR - || opP->reg < USP - || opP->reg > URP - || cpu_of_arch(current_architecture) < m68010 /* before 68010 had none */ - || (cpu_of_arch(current_architecture) < m68020 - && opP->reg != SFC - && opP->reg != DFC - && opP->reg != USP - && opP->reg != VBR) /* 68010's had only these */ - || (cpu_of_arch(current_architecture) < m68040 - && opP->reg != SFC - && opP->reg != DFC - && opP->reg != USP - && opP->reg != VBR - && opP->reg != CACR - && opP->reg != CAAR - && opP->reg != MSP - && opP->reg != ISP) /* 680[23]0's have only these */ - || (cpu_of_arch(current_architecture) == m68040 /* 68040 has all but this */ - && opP->reg == CAAR)) { - losing++; - } /* doesn't cut it */ - break; - - case 'k': - if(opP->mode!=IMMED) - losing++; - break; - - case 'l': - case 'L': - if(opP->mode==DREG || opP->mode==AREG || opP->mode==FPREG) { - if(s[1]=='8') - losing++; - else { - opP->mode=REGLST; - opP->reg=1<<(opP->reg-DATA); - } - } else if(opP->mode!=REGLST) { - losing++; - } else if(s[1]=='8' && opP->reg&0x0FFffFF) - losing++; - else if(s[1]=='3' && opP->reg&0x7000000) - losing++; - break; - - case 'M': - if(opP->mode!=IMMED) - losing++; - else { - long t; - - t=get_num(opP->con1,80); - if(!issbyte(t) || isvar(opP->con1)) - losing++; - } - break; - - case 'O': - if(opP->mode!=DREG && opP->mode!=IMMED) - losing++; - break; - - case 'Q': - if(opP->mode!=IMMED) - losing++; - else { - long t; - - t=get_num(opP->con1,80); - if(t<1 || t>8 || isvar(opP->con1)) - losing++; - } - break; - - case 'R': - if(opP->mode!=DREG && opP->mode!=AREG) - losing++; - break; - - case 'r': - if(opP->mode!=AINDR && opP->mode!=DINDR) - losing++; - break; - - case 's': - if(opP->mode!=MSCR || !(opP->reg==FPI || opP->reg==FPS || opP->reg==FPC)) - losing++; - break; - - case 'S': - if(opP->mode!=MSCR || opP->reg!=SR) - losing++; - break; - - case 'U': - if(opP->mode!=MSCR || opP->reg!=USP) - losing++; - break; - - /* JF these are out of order. We could put them - in order if we were willing to put up with - bunches of #ifdef m68851s in the code */ -#ifndef NO_68851 - /* Memory addressing mode used by pflushr */ - case '|': - if(opP->mode==MSCR || opP->mode==DREG || - opP->mode==AREG || opP->mode==REGLST) - losing++; - break; - - case 'f': - if (opP->mode != MSCR || (opP->reg != SFC && opP->reg != DFC)) - losing++; - break; - - case 'P': - if (opP->mode != MSCR || (opP->reg != TC && opP->reg != CAL && - opP->reg != VAL && opP->reg != SCC && opP->reg != AC)) - losing++; - break; - - case 'V': - if (opP->reg != VAL) - losing++; - break; - - case 'W': - if (opP->mode != MSCR || (opP->reg != DRP && opP->reg != SRP && - opP->reg != CRP)) - losing++; - break; - - case 'X': - if (opP->mode != MSCR || - (!(opP->reg >= BAD && opP->reg <= BAD+7) && - !(opP->reg >= BAC && opP->reg <= BAC+7))) - losing++; - break; - - case 'Y': - if (opP->reg != PSR) - losing++; - break; - - case 'Z': - if (opP->reg != PCSR) - losing++; - break; -#endif - case 'c': - if (opP->reg != NC - && opP->reg != IC - && opP->reg != DC - && opP->reg != BC) { - losing++; - } /* not a cache specifier. */ - break; - - case '_': - if (opP->mode != ABSL) { - ++losing; - } /* not absolute */ - break; - - default: - as_fatal("Internal error: Operand mode %c unknown in line %s of file \"%s\"", - *s, __LINE__, __FILE__); - } /* switch on type of operand */ - - if (losing) break; - } /* for each operand */ - } /* if immediately wrong */ - - if (!losing) { - break; - } /* got it. */ - - - if (!opcode->m_next) - { - if ((opcode->m_arch & current_architecture) == 0) - { - the_ins.error = "Opcode not available on architecture specified"; - addword(0); - - } - else - { - the_ins.error = "instruction/operands mismatch"; - } - - return; - } /* Fell off the end */ - opcode = opcode->m_next; - losing = 0; - } - - /* now assemble it */ - - the_ins.args=opcode->m_operands; - the_ins.numargs=opcode->m_opnum; - the_ins.numo=opcode->m_codenum; - the_ins.opcode[0]=getone(opcode); - the_ins.opcode[1]=gettwo(opcode); - - for (s = the_ins.args, opP = &the_ins.operands[0]; *s; s += 2, opP++) { - /* This switch is a doozy. - Watch the first step; its a big one! */ - switch(s[0]) { - - case '*': - case '~': - case '%': - case ';': - case '@': - case '!': - case '&': - case '$': - case '?': - case '/': -#ifndef NO_68851 - case '|': -#endif - switch(opP->mode) { - case IMMED: - tmpreg=0x3c; /* 7.4 */ - if (strchr("bwl",s[1])) nextword=get_num(opP->con1,80); - else nextword=nextword=get_num(opP->con1,0); - if(isvar(opP->con1)) - add_fix(s[1],opP->con1,0); - switch(s[1]) { - case 'b': - if(!isbyte(nextword)) - opP->error="operand out of range"; - addword(nextword); - baseo=0; - break; - case 'w': - if(!isword(nextword)) - opP->error="operand out of range"; - addword(nextword); - baseo=0; - break; - case 'l': - addword(nextword>>16); - addword(nextword); - baseo=0; - break; - - case 'f': - baseo=2; - outro=8; - break; - case 'F': - baseo=4; - outro=11; - break; - case 'x': - baseo=6; - outro=15; - break; - case 'p': - baseo=6; - outro= -1; - break; - default: - as_fatal("Internal error: Can't decode %c%c in line %s of file \"%s\"", - *s, s[1], __LINE__, __FILE__); - } - if(!baseo) - break; - - /* We gotta put out some float */ - if(seg(opP->con1)!=SEG_BIG) { - int_to_gen(nextword); - gen_to_words(words,baseo,(long int)outro); - for(wordp=words;baseo--;wordp++) - addword(*wordp); - break; - } /* Its BIG */ - if(offs(opP->con1)>0) { - as_warn("Bignum assumed to be binary bit-pattern"); - if(offs(opP->con1)>baseo) { - as_warn("Bignum too big for %c format; truncated",s[1]); - offs(opP->con1)=baseo; - } - baseo-=offs(opP->con1); - for(wordp=generic_bignum+offs(opP->con1)-1;offs(opP->con1)--;--wordp) - addword(*wordp); - while(baseo--) - addword(0); - break; - } - gen_to_words(words,baseo,(long)outro); - for (wordp=words;baseo--;wordp++) - addword(*wordp); - break; - case DREG: - tmpreg=opP->reg-DATA; /* 0.dreg */ - break; - case AREG: - tmpreg=0x08+opP->reg-ADDR; /* 1.areg */ - break; - case AINDR: - tmpreg=0x10+opP->reg-ADDR; /* 2.areg */ - break; - case ADEC: - tmpreg=0x20+opP->reg-ADDR; /* 4.areg */ - break; - case AINC: - tmpreg=0x18+opP->reg-ADDR; /* 3.areg */ - break; - case AOFF: - - nextword=get_num(opP->con1,80); - /* Force into index mode. Hope this works */ - - /* We do the first bit for 32-bit displacements, - and the second bit for 16 bit ones. It is - possible that we should make the default be - WORD instead of LONG, but I think that'd - break GCC, so we put up with a little - inefficiency for the sake of working output. - */ - - if( !issword(nextword) - || ( isvar(opP->con1) - && ( ( opP->con1->e_siz==0 - && flagseen['l']==0) - || opP->con1->e_siz==3))) { - - if(opP->reg==PC) - tmpreg=0x3B; /* 7.3 */ - else - tmpreg=0x30+opP->reg-ADDR; /* 6.areg */ - if(isvar(opP->con1)) { - if(opP->reg==PC) { - add_frag(adds(opP->con1), - offs(opP->con1), - TAB(PCLEA,SZ_UNDEF)); - break; - } else { - addword(0x0170); - add_fix('l',opP->con1,1); - } - } else - addword(0x0170); - addword(nextword>>16); - } else { - if(opP->reg==PC) - tmpreg=0x3A; /* 7.2 */ - else - tmpreg=0x28+opP->reg-ADDR; /* 5.areg */ - - if(isvar(opP->con1)) { - if(opP->reg==PC) { - add_fix('w',opP->con1,1); - } else - add_fix('w',opP->con1,0); - } - } - addword(nextword); - break; - - case APODX: - case AMIND: - case APRDX: - know(current_architecture & m68020up); - /* intentional fall-through */ - case AINDX: - nextword=0; - baseo=get_num(opP->con1,80); - outro=get_num(opP->con2,80); - /* Figure out the 'addressing mode' */ - /* Also turn on the BASE_DISABLE bit, if needed */ - if(opP->reg==PC || opP->reg==ZPC) { - tmpreg=0x3b; /* 7.3 */ - if(opP->reg==ZPC) - nextword|=0x80; - } else if(opP->reg==FAIL) { - nextword|=0x80; - tmpreg=0x30; /* 6.garbage */ - } else tmpreg=0x30+opP->reg-ADDR; /* 6.areg */ - - siz1= (opP->con1) ? opP->con1->e_siz : 0; - siz2= (opP->con2) ? opP->con2->e_siz : 0; - - /* Index register stuff */ - if(opP->ireg>=DATA+0 && opP->ireg<=ADDR+7) { - nextword|=(opP->ireg-DATA)<<12; - - if(opP->isiz==0 || opP->isiz==3) - nextword|=0x800; - switch(opP->imul) { - case 1: break; - case 2: nextword|=0x200; break; - case 4: nextword|=0x400; break; - case 8: nextword|=0x600; break; - default: as_fatal("failed sanity check."); - } - /* IF its simple, - GET US OUT OF HERE! */ - - /* Must be INDEX, with an index - register. Address register - cannot be ZERO-PC, and either - :b was forced, or we know - it will fit */ - if( opP->mode==AINDX - && opP->reg!=FAIL - && opP->reg!=ZPC - && ( siz1==1 - || ( issbyte(baseo) - && !isvar(opP->con1)))) { - nextword +=baseo&0xff; - addword(nextword); - if(isvar(opP->con1)) - add_fix('B',opP->con1,0); - break; - } - } else - nextword|=0x40; /* No index reg */ - - /* It aint simple */ - nextword|=0x100; - /* If the guy specified a width, we assume that - it is wide enough. Maybe it isn't. If so, we lose - */ - switch(siz1) { - case 0: - if(isvar(opP->con1) || !issword(baseo)) { - siz1=3; - nextword|=0x30; - } else if(baseo==0) - nextword|=0x10; - else { - nextword|=0x20; - siz1=2; - } - break; - case 1: - as_warn("Byte dispacement won't work. Defaulting to :w"); - case 2: - nextword|=0x20; - break; - case 3: - nextword|=0x30; - break; - } - - /* Figure out innner displacement stuff */ - if(opP->mode!=AINDX) { - switch(siz2) { - case 0: - if(isvar(opP->con2) || !issword(outro)) { - siz2=3; - nextword|=0x3; - } else if(outro==0) - nextword|=0x1; - else { - nextword|=0x2; - siz2=2; - } - break; - case 1: - as_warn("Byte dispacement won't work. Defaulting to :w"); - case 2: - nextword|=0x2; - break; - case 3: - nextword|=0x3; - break; - } - if(opP->mode==APODX) nextword|=0x04; - else if(opP->mode==AMIND) nextword|=0x40; - } - addword(nextword); - - if(isvar(opP->con1)) { - if(opP->reg==PC || opP->reg==ZPC) { - add_fix(siz1==3 ? 'l' : 'w',opP->con1,1); - opP->con1->e_exp.X_add_number+=6; - } else - add_fix(siz1==3 ? 'l' : 'w',opP->con1,0); - } - if(siz1==3) - addword(baseo>>16); - if(siz1) - addword(baseo); - - if(isvar(opP->con2)) { - if(opP->reg==PC || opP->reg==ZPC) { - add_fix(siz2==3 ? 'l' : 'w',opP->con2,1); - opP->con1->e_exp.X_add_number+=6; - } else - add_fix(siz2==3 ? 'l' : 'w',opP->con2,0); - } - if(siz2==3) - addword(outro>>16); - if(siz2) - addword(outro); - - break; - - case ABSL: - nextword=get_num(opP->con1,80); - switch(opP->con1->e_siz) { - default: - as_warn("Unknown size for absolute reference"); - case 0: - if(!isvar(opP->con1) && issword(offs(opP->con1))) { - tmpreg=0x38; /* 7.0 */ - addword(nextword); - break; - } - /* Don't generate pc relative code - on 68010 and 68000 */ - if(isvar(opP->con1) - && !subs(opP->con1) - && seg(opP->con1) == SEG_TEXT - && now_seg == SEG_TEXT - && cpu_of_arch(current_architecture) < m68020 - && !flagseen['S'] - && !strchr("~%&$?", s[0])) { - tmpreg=0x3A; /* 7.2 */ - add_frag(adds(opP->con1), - offs(opP->con1), - TAB(PCREL,SZ_UNDEF)); - break; - } - case 3: /* Fall through into long */ - if(isvar(opP->con1)) - add_fix('l',opP->con1,0); - - tmpreg=0x39; /* 7.1 mode */ - addword(nextword>>16); - addword(nextword); - break; - - case 2: /* Word */ - if(isvar(opP->con1)) - add_fix('w',opP->con1,0); - - tmpreg=0x38; /* 7.0 mode */ - addword(nextword); - break; - } - break; - case DINDR: - as_bad("invalid indirect register"); - break; - case MSCR: - default: - as_bad("unknown/incorrect operand"); - /* abort(); */ - } - install_gen_operand(s[1],tmpreg); - break; - - case '#': - case '^': - switch(s[1]) { /* JF: I hate floating point! */ - case 'j': - tmpreg=70; - break; - case '8': - tmpreg=20; - break; - case 'C': - tmpreg=50; - break; - case '3': - default: - tmpreg=80; - break; - } - tmpreg=get_num(opP->con1,tmpreg); - if(isvar(opP->con1)) - add_fix(s[1],opP->con1,0); - switch(s[1]) { - case 'b': /* Danger: These do no check for - certain types of overflow. - user beware! */ - if(!isbyte(tmpreg)) - opP->error="out of range"; - insop(tmpreg); - if(isvar(opP->con1)) - the_ins.reloc[the_ins.nrel-1].n=(opcode->m_codenum)*2; - break; - case 'w': - if(!isword(tmpreg)) - opP->error="out of range"; - insop(tmpreg); - if(isvar(opP->con1)) - the_ins.reloc[the_ins.nrel-1].n=(opcode->m_codenum)*2; - break; - case 'l': - insop(tmpreg); /* Because of the way insop works, we put these two out backwards */ - insop(tmpreg>>16); - if(isvar(opP->con1)) - the_ins.reloc[the_ins.nrel-1].n=(opcode->m_codenum)*2; - break; - case '3': - tmpreg&=0xFF; - case '8': - case 'C': - install_operand(s[1],tmpreg); - break; - default: - as_fatal("Internal error: Unknown mode #%c in line %s of file \"%s\"", s[1], __LINE__, __FILE__); - } - break; - - case '+': - case '-': - case 'A': - case 'a': - install_operand(s[1],opP->reg-ADDR); - break; - - case 'B': - tmpreg=get_num(opP->con1,80); - switch(s[1]) { - case 'B': - /* Needs no offsetting */ - add_fix('B',opP->con1,1); - break; - case 'W': - /* Offset the displacement to be relative to byte disp location */ - opP->con1->e_exp.X_add_number+=2; - add_fix('w',opP->con1,1); - addword(0); - break; - case 'L': - long_branch: - if (cpu_of_arch(current_architecture) < m68020) /* 68000 or 010 */ - as_warn("Can't use long branches on 68000/68010"); - the_ins.opcode[the_ins.numo-1]|=0xff; - /* Offset the displacement to be relative to byte disp location */ - opP->con1->e_exp.X_add_number+=4; - add_fix('l',opP->con1,1); - addword(0); - addword(0); - break; - case 'g': - if(subs(opP->con1)) /* We can't relax it */ - goto long_branch; - - /* This could either be a symbol, or an - absolute address. No matter, the - frag hacking will finger it out. - Not quite: it can't switch from - BRANCH to 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) || (0==adds(opP->con1))) - && (the_ins.opcode[0] >= 0x6200) - && (the_ins.opcode[0] <= 0x6f00)) { - add_frag(adds(opP->con1),offs(opP->con1),TAB(BCC68000,SZ_UNDEF)); - } else { - add_frag(adds(opP->con1),offs(opP->con1),TAB(BRANCH,SZ_UNDEF)); - } - break; - case 'w': - if(isvar(opP->con1)) { - /* check for DBcc instruction */ - if ((the_ins.opcode[0] & 0xf0f8) ==0x50c8) { - /* size varies if patch */ - /* needed for long form */ - add_frag(adds(opP->con1),offs(opP->con1),TAB(DBCC,SZ_UNDEF)); - break; - } - - /* Don't ask! */ - opP->con1->e_exp.X_add_number+=2; - add_fix('w',opP->con1,1); - } - addword(0); - break; - case 'C': /* Fixed size LONG coproc branches */ - the_ins.opcode[the_ins.numo-1]|=0x40; - /* Offset the displacement to be relative to byte disp location */ - /* Coproc branches don't have a byte disp option, but they are - compatible with the ordinary branches, which do... */ - opP->con1->e_exp.X_add_number+=4; - add_fix('l',opP->con1,1); - addword(0); - addword(0); - break; - case 'c': /* Var size Coprocesssor branches */ - if(subs(opP->con1)) { - add_fix('l',opP->con1,1); - add_frag((symbolS *)0,(long)0,TAB(FBRANCH,LONG)); - } else if(adds(opP->con1)) { - add_frag(adds(opP->con1),offs(opP->con1),TAB(FBRANCH,SZ_UNDEF)); - } else { - /* add_frag((symbolS *)0,offs(opP->con1),TAB(FBRANCH,SHORT)); */ - the_ins.opcode[the_ins.numo-1]|=0x40; - add_fix('l',opP->con1,1); - addword(0); - addword(4); - } - break; - default: - as_fatal("Internal error: operand type B%c unknown in line %s of file \"%s\"", - s[1], __LINE__, __FILE__); - } - break; - - case 'C': /* Ignore it */ - break; - - case 'd': /* JF this is a kludge */ - if(opP->mode==AOFF) { - install_operand('s',opP->reg-ADDR); - } else { - char *tmpP; - - tmpP=opP->con1->e_end-2; - opP->con1->e_beg++; - opP->con1->e_end-=4; /* point to the , */ - baseo=m68k_reg_parse(&tmpP); - if(baseo<ADDR+0 || baseo>ADDR+7) { - as_bad("Unknown address reg, using A0"); - baseo=0; - } else baseo-=ADDR; - install_operand('s',baseo); - } - tmpreg=get_num(opP->con1,80); - if(!issword(tmpreg)) { - as_warn("Expression out of range, using 0"); - tmpreg=0; - } - addword(tmpreg); - break; - - case 'D': - install_operand(s[1],opP->reg-DATA); - break; - - case 'F': - install_operand(s[1],opP->reg-FPREG); - break; - - case 'I': - tmpreg=1+opP->reg-COPNUM; - if(tmpreg==8) - tmpreg=0; - install_operand(s[1],tmpreg); - break; - - case 'J': /* JF foo */ - switch(opP->reg) { - case SFC: tmpreg=0x000; break; - case DFC: tmpreg=0x001; break; - case CACR: tmpreg=0x002; break; - case TC: tmpreg=0x003; break; - case ITT0: tmpreg=0x004; break; - case ITT1: tmpreg=0x005; break; - case DTT0: tmpreg=0x006; break; - case DTT1: tmpreg=0x007; break; - - case USP: tmpreg=0x800; break; - case VBR: tmpreg=0x801; break; - case CAAR: tmpreg=0x802; break; - case MSP: tmpreg=0x803; break; - case ISP: tmpreg=0x804; break; - case MMUSR: tmpreg=0x805; break; - case URP: tmpreg=0x806; break; - case SRP: tmpreg=0x807; break; - default: - as_fatal("failed sanity check."); - } - install_operand(s[1],tmpreg); - break; - - case 'k': - tmpreg=get_num(opP->con1,55); - install_operand(s[1],tmpreg&0x7f); - break; - - case 'l': - tmpreg=opP->reg; - if(s[1]=='w') { - if(tmpreg&0x7FF0000) - as_bad("Floating point register in register list"); - insop(reverse_16_bits(tmpreg)); - } else { - if(tmpreg&0x700FFFF) - as_bad("Wrong register in floating-point reglist"); - install_operand(s[1],reverse_8_bits(tmpreg>>16)); - } - break; - - case 'L': - tmpreg=opP->reg; - if(s[1]=='w') { - if(tmpreg&0x7FF0000) - as_bad("Floating point register in register list"); - insop(tmpreg); - } else if(s[1]=='8') { - if(tmpreg&0x0FFFFFF) - as_bad("incorrect register in reglist"); - install_operand(s[1],tmpreg>>24); - } else { - if(tmpreg&0x700FFFF) - as_bad("wrong register in floating-point reglist"); - else - install_operand(s[1],tmpreg>>16); - } - break; - - case 'M': - install_operand(s[1],get_num(opP->con1,60)); - break; - - case 'O': - tmpreg= (opP->mode==DREG) - ? 0x20+opP->reg-DATA - : (get_num(opP->con1,40)&0x1F); - install_operand(s[1],tmpreg); - break; - - case 'Q': - tmpreg=get_num(opP->con1,10); - if(tmpreg==8) - tmpreg=0; - install_operand(s[1],tmpreg); - break; - - case 'R': - case 'r': - /* This depends on the fact that ADDR registers are - eight more than their corresponding DATA regs, so - the result will have the ADDR_REG bit set */ - install_operand(s[1],opP->reg-DATA); - break; - - case 's': - if(opP->reg==FPI) tmpreg=0x1; - else if(opP->reg==FPS) tmpreg=0x2; - else if(opP->reg==FPC) tmpreg=0x4; - else as_fatal("failed sanity check."); - install_operand(s[1],tmpreg); - break; - - case 'S': /* Ignore it */ - break; - - case 'T': - install_operand(s[1],get_num(opP->con1,30)); - break; - - case 'U': /* Ignore it */ - break; - - case 'c': - switch (opP->reg) { - case NC: tmpreg = 0; break; - case DC: tmpreg = 1; break; - case IC: tmpreg = 2; break; - case BC: tmpreg = 3; break; - default: - as_fatal("failed sanity check"); - } /* switch on cache token */ - install_operand(s[1], tmpreg); - break; -#ifndef NO_68851 - /* JF: These are out of order, I fear. */ - case 'f': - switch (opP->reg) { - case SFC: - tmpreg=0; - break; - case DFC: - tmpreg=1; - break; - default: - as_fatal("failed sanity check."); - } - install_operand(s[1],tmpreg); - break; - - case 'P': - switch(opP->reg) { - case TC: - tmpreg=0; - break; - case CAL: - tmpreg=4; - break; - case VAL: - tmpreg=5; - break; - case SCC: - tmpreg=6; - break; - case AC: - tmpreg=7; - break; - default: - as_fatal("failed sanity check."); - } - install_operand(s[1],tmpreg); - break; - - case 'V': - if (opP->reg == VAL) - break; - as_fatal("failed sanity check."); - - case 'W': - switch(opP->reg) { - - case DRP: - tmpreg=1; - break; - case SRP: - tmpreg=2; - break; - case CRP: - tmpreg=3; - break; - default: - as_fatal("failed sanity check."); - } - install_operand(s[1],tmpreg); - break; - - case 'X': - switch (opP->reg) { - case BAD: case BAD+1: case BAD+2: case BAD+3: - case BAD+4: case BAD+5: case BAD+6: case BAD+7: - tmpreg = (4 << 10) | ((opP->reg - BAD) << 2); - break; - - case BAC: case BAC+1: case BAC+2: case BAC+3: - case BAC+4: case BAC+5: case BAC+6: case BAC+7: - tmpreg = (5 << 10) | ((opP->reg - BAC) << 2); - break; - - default: - as_fatal("failed sanity check."); - } - install_operand(s[1], tmpreg); - break; - case 'Y': - know(opP->reg == PSR); - break; - case 'Z': - know(opP->reg == PCSR); - break; -#endif /* m68851 */ - case '_': - tmpreg=get_num(opP->con1,80); - install_operand(s[1], tmpreg); - break; - default: - as_fatal("Internal error: Operand type %c unknown in line %s of file \"%s\"", s[0], __LINE__, __FILE__); - } - } - /* By the time whe get here (FINALLY) the_ins contains the complete - instruction, ready to be emitted. . . */ -} /* m68k_ip() */ - -/* - * get_regs := '/' + ? - * | '-' + <register> - * | '-' + <register> + ? - * | <empty> - * ; - * - - * The idea here must be to scan in a set of registers but I don't - * understand it. Looks awfully sloppy to me but I don't have any doc on - * this format so... - - * - * - */ - -static int get_regs(i,str,opP) -int i; -struct m68k_op *opP; -char *str; -{ - /* 26, 25, 24, 23-16, 15-8, 0-7 */ - /* Low order 24 bits encoded fpc,fps,fpi,fp7-fp0,a7-a0,d7-d0 */ - unsigned long cur_regs = 0; - int reg1, - reg2; - -#define ADD_REG(x) { if(x==FPI) cur_regs|=(1<<24);\ -else if(x==FPS) cur_regs|=(1<<25);\ -else if(x==FPC) cur_regs|=(1<<26);\ -else cur_regs|=(1<<(x-1)); } - - reg1=i; - for(;;) { - if(*str=='/') { - ADD_REG(reg1); - str++; - } else if(*str=='-') { - str++; - reg2=m68k_reg_parse(&str); - if(reg2<DATA || reg2>=FPREG+8 || reg1==FPI || reg1==FPS || reg1==FPC) { - opP->error="unknown register in register list"; - return FAIL; - } - while(reg1<=reg2) { - ADD_REG(reg1); - reg1++; - } - if(*str=='\0') - break; - } else if(*str=='\0') { - ADD_REG(reg1); - break; - } else { - opP->error="unknow character in register list"; - return FAIL; - } - /* DJA -- Bug Fix. Did't handle d1-d2/a1 until the following instruction was added */ - if (*str=='/') - str ++; - reg1=m68k_reg_parse(&str); - if((reg1<DATA || reg1>=FPREG+8) && !(reg1==FPI || reg1==FPS || reg1==FPC)) { - opP->error="unknown register in register list"; - return FAIL; - } - } - opP->reg=cur_regs; - return OK; -} /* get_regs() */ - -static int reverse_16_bits(in) -int in; -{ - int out=0; - int n; - - static int mask[16] = { - 0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080, - 0x0100,0x0200,0x0400,0x0800,0x1000,0x2000,0x4000,0x8000 - }; - for(n=0;n<16;n++) { - if(in&mask[n]) - out|=mask[15-n]; - } - return out; -} /* reverse_16_bits() */ - -static int reverse_8_bits(in) -int in; -{ - int out=0; - int n; - - static int mask[8] = { - 0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080, - }; - - for(n=0;n<8;n++) { - if(in&mask[n]) - out|=mask[7-n]; - } - return out; -} /* reverse_8_bits() */ - -static void install_operand(mode,val) -int mode; -int val; -{ - switch(mode) { - case 's': - the_ins.opcode[0]|=val & 0xFF; /* JF FF is for M kludge */ - break; - case 'd': - the_ins.opcode[0]|=val<<9; - break; - case '1': - the_ins.opcode[1]|=val<<12; - break; - case '2': - the_ins.opcode[1]|=val<<6; - break; - case '3': - the_ins.opcode[1]|=val; - break; - case '4': - the_ins.opcode[2]|=val<<12; - break; - case '5': - the_ins.opcode[2]|=val<<6; - break; - case '6': - /* DANGER! This is a hack to force cas2l and cas2w cmds - to be three words long! */ - the_ins.numo++; - the_ins.opcode[2]|=val; - break; - case '7': - the_ins.opcode[1]|=val<<7; - break; - case '8': - the_ins.opcode[1]|=val<<10; - break; -#ifndef NO_68851 - case '9': - the_ins.opcode[1]|=val<<5; - break; -#endif - - case 't': - the_ins.opcode[1]|=(val<<10)|(val<<7); - break; - case 'D': - the_ins.opcode[1]|=(val<<12)|val; - break; - case 'g': - the_ins.opcode[0]|=val=0xff; - break; - case 'i': - the_ins.opcode[0]|=val<<9; - break; - case 'C': - the_ins.opcode[1]|=val; - break; - case 'j': - the_ins.opcode[1]|=val; - the_ins.numo++; /* What a hack */ - break; - case 'k': - the_ins.opcode[1]|=val<<4; - break; - case 'b': - case 'w': - case 'l': - break; - case 'e': - the_ins.opcode[0] |= (val << 6); - break; - case 'L': - the_ins.opcode[1] = (val >> 16); - the_ins.opcode[2] = val & 0xffff; - break; - case 'c': - default: - as_fatal("failed sanity check."); - } -} /* install_operand() */ - -static void install_gen_operand(mode,val) -int mode; -int val; -{ - switch(mode) { - case 's': - the_ins.opcode[0]|=val; - break; - case 'd': - /* This is a kludge!!! */ - the_ins.opcode[0]|=(val&0x07)<<9|(val&0x38)<<3; - break; - case 'b': - case 'w': - case 'l': - case 'f': - case 'F': - case 'x': - case 'p': - the_ins.opcode[0]|=val; - break; - /* more stuff goes here */ - default: - as_fatal("failed sanity check."); - } -} /* install_gen_operand() */ - -/* - * verify that we have some number of paren pairs, do m68k_ip_op(), and - * then deal with the bitfield hack. - */ - -static char *crack_operand(str,opP) -register char *str; -register struct m68k_op *opP; -{ - register int parens; - register int c; - register char *beg_str; - - if(!str) { - return str; - } - beg_str=str; - for(parens=0;*str && (parens>0 || notend(str));str++) { - if(*str=='(') parens++; - else if(*str==')') { - if(!parens) { /* ERROR */ - opP->error="Extra )"; - return str; - } - --parens; - } - } - if(!*str && parens) { /* ERROR */ - opP->error="Missing )"; - return str; - } - c= *str; - *str='\0'; - if(m68k_ip_op(beg_str,opP)==FAIL) { - *str=c; - return str; - } - *str=c; - - if(c=='}') - c= *++str; /* JF bitfield hack */ - - if(c) { - c= *++str; - if(!c) - as_bad("Missing operand"); - } - return str; -} - -/* See the comment up above where the #define notend(... is */ -#if 0 -notend(s) -char *s; -{ - if(*s==',') return 0; - if(*s=='{' || *s=='}') - return 0; - if(*s!=':') return 1; - /* This kludge here is for the division cmd, which is a kludge */ - if(index("aAdD#(",s[1])) return 0; - return 1; -} -#endif - - -int done_pseudo(str) -char *str; -{ - extern struct hash_control * po_hash; - char *ptr = str; - char *null_ptr; - pseudo_typeS * pop; - - char c; - - is_end_of_line[0] = 1; - /* Skip over name of pseudo, change to lower case */ - while (isalpha(*ptr) || *ptr == '.') - { - if (isupper(*ptr)) { - *ptr = tolower(*ptr); - } - ptr++; - } - null_ptr = ptr; - c = *null_ptr; - *null_ptr = 0; - - - pop = (pseudo_typeS *)hash_find(po_hash, str); - - *null_ptr = c; - if (pop != (pseudo_typeS *)NULL) - { - input_line_pointer = null_ptr+1; - SKIP_WHITESPACE(); - /* Now we point to first non-blank char after pseudo op */ - (*pop->poc_handler)(pop->poc_val); - input_line_pointer--; - - return 1; - - } - /* Just put back the char where the null was put and return as if nothing had happened */ - - *null_ptr = c; - return 0; - -} - - -/* This is the guts of the machine-dependent assembler. STR points to a - machine dependent instruction. This function is supposed to emit - the frags/bytes it assembles to. - */ -void - md_assemble(str) -char *str; -{ - char *er; - short *fromP; - char *toP = NULL; - int m,n = 0; - char *to_beg_P; - int shorts_this_frag; - - /* if (done_pseudo(str)) return ;*/ - - - - if (current_architecture == 0) { - current_architecture = (m68020 -#ifndef NO_68881 - | m68881 -#endif -#ifndef NO_68851 - | m68851 -#endif - ); - } /* default current_architecture */ - - memset((char *)(&the_ins), '\0', sizeof(the_ins)); /* JF for paranoia sake */ - - m68k_ip(str); - er=the_ins.error; - if(!er) { - for(n=the_ins.numargs;n;--n) - if(the_ins.operands[n].error) { - er=the_ins.operands[n].error; - break; - } - } - if(er) { - as_bad("\"%s\" -- Statement '%s' ignored",er,str); - return; - } - - if(the_ins.nfrag==0) { /* No frag hacking involved; just put it out */ - toP=frag_more(2*the_ins.numo); - fromP= &the_ins.opcode[0]; - for(m=the_ins.numo;m;--m) { - md_number_to_chars(toP,(long)(*fromP),2); - toP+=2; - fromP++; - } - /* put out symbol-dependent info */ - for(m=0;m<the_ins.nrel;m++) { - switch(the_ins.reloc[m].wid) { - case 'B': - n=1; - break; - case 'b': - n=1; - break; - case '3': - n=2; - break; - case 'w': - n=2; - break; - case 'l': - n=4; - break; - default: - as_fatal("Don't know how to figure width of %c in md_assemble()",the_ins.reloc[m].wid); - } - - fix_new(frag_now, - (toP-frag_now->fr_literal)-the_ins.numo*2+the_ins.reloc[m].n, - n, - the_ins.reloc[m].add, - the_ins.reloc[m].sub, - the_ins.reloc[m].off, - the_ins.reloc[m].pcrel, - NO_RELOC); - } - return; - } - - /* There's some frag hacking */ - for(n=0,fromP= &the_ins.opcode[0];n<the_ins.nfrag;n++) { - int wid; - - if(n==0) wid=2*the_ins.fragb[n].fragoff; - else wid=2*(the_ins.numo-the_ins.fragb[n-1].fragoff); - toP=frag_more(wid); - to_beg_P=toP; - shorts_this_frag=0; - for(m=wid/2;m;--m) { - md_number_to_chars(toP,(long)(*fromP),2); - toP+=2; - fromP++; - shorts_this_frag++; - } - for(m=0;m<the_ins.nrel;m++) { - if((the_ins.reloc[m].n)>= 2*shorts_this_frag /* 2*the_ins.fragb[n].fragoff */) { - the_ins.reloc[m].n-= 2*shorts_this_frag /* 2*the_ins.fragb[n].fragoff */; - break; - } - wid=the_ins.reloc[m].wid; - if(wid==0) - continue; - the_ins.reloc[m].wid=0; - wid = (wid=='b') ? 1 : (wid=='w') ? 2 : (wid=='l') ? 4 : 4000; - - fix_new(frag_now, - (toP-frag_now->fr_literal)-the_ins.numo*2+the_ins.reloc[m].n, - wid, - the_ins.reloc[m].add, - the_ins.reloc[m].sub, - the_ins.reloc[m].off, - the_ins.reloc[m].pcrel, - NO_RELOC); - } - /* know(the_ins.fragb[n].fadd); */ - (void)frag_var(rs_machine_dependent,10,0,(relax_substateT)(the_ins.fragb[n].fragty), - the_ins.fragb[n].fadd,the_ins.fragb[n].foff,to_beg_P); - } - n=(the_ins.numo-the_ins.fragb[n-1].fragoff); - shorts_this_frag=0; - if(n) { - toP=frag_more(n*sizeof(short)); - while(n--) { - md_number_to_chars(toP,(long)(*fromP),2); - toP+=2; - fromP++; - shorts_this_frag++; - } - } - for(m=0;m<the_ins.nrel;m++) { - int wid; - - wid=the_ins.reloc[m].wid; - if(wid==0) - continue; - the_ins.reloc[m].wid=0; - wid = (wid=='b') ? 1 : (wid=='w') ? 2 : (wid=='l') ? 4 : 4000; - - fix_new(frag_now, - (the_ins.reloc[m].n + toP-frag_now->fr_literal)- /* the_ins.numo */ shorts_this_frag*2, - wid, - the_ins.reloc[m].add, - the_ins.reloc[m].sub, - the_ins.reloc[m].off, - the_ins.reloc[m].pcrel, - NO_RELOC); - } -} - -/* This function is called once, at assembler startup time. This should - set up all the tables, etc that the MD part of the assembler needs - */ -void - md_begin() -{ - /* - * md_begin -- set up hash tables with 68000 instructions. - * similar to what the vax assembler does. ---phr - */ - /* RMS claims the thing to do is take the m68k-opcode.h table, and make - a copy of it at runtime, adding in the information we want but isn't - there. I think it'd be better to have an awk script hack the table - at compile time. Or even just xstr the table and use it as-is. But - my lord ghod hath spoken, so we do it this way. Excuse the ugly var - names. */ - - register const struct m68k_opcode *ins; - register struct m68k_incant *hack, - *slak; - register char *retval = 0; /* empty string, or error msg text */ - register unsigned int i; - register char c; - - if ((op_hash = hash_new()) == NULL) - as_fatal("Virtual memory exhausted"); - - obstack_begin(&robyn,4000); - for (ins = m68k_opcodes; ins < endop; ins++) { - hack=slak=(struct m68k_incant *)obstack_alloc(&robyn,sizeof(struct m68k_incant)); - do { - /* we *could* ignore insns that don't match our - arch here but just leaving them out of the - hash. */ - slak->m_operands=ins->args; - slak->m_opnum=strlen(slak->m_operands)/2; - slak->m_arch = ins->arch; - slak->m_opcode=ins->opcode; - /* This is kludgey */ - slak->m_codenum=((ins->match)&0xffffL) ? 2 : 1; - if((ins+1)!=endop && !strcmp(ins->name,(ins+1)->name)) { - slak->m_next=(struct m68k_incant *) obstack_alloc(&robyn,sizeof(struct m68k_incant)); - ins++; - } else - slak->m_next=0; - slak=slak->m_next; - } while(slak); - - retval = hash_insert (op_hash, ins->name,(char *)hack); - /* Didn't his mommy tell him about null pointers? */ - if(retval && *retval) - as_fatal("Internal Error: Can't hash %s: %s",ins->name,retval); - } - - for (i = 0; i < sizeof(mklower_table) ; i++) - mklower_table[i] = (isupper(c = (char) i)) ? tolower(c) : c; - - for (i = 0 ; i < sizeof(notend_table) ; i++) { - notend_table[i] = 0; - alt_notend_table[i] = 0; - } - notend_table[','] = 1; - notend_table['{'] = 1; - notend_table['}'] = 1; - alt_notend_table['a'] = 1; - alt_notend_table['A'] = 1; - alt_notend_table['d'] = 1; - alt_notend_table['D'] = 1; - alt_notend_table['#'] = 1; - alt_notend_table['f'] = 1; - alt_notend_table['F'] = 1; - alt_notend_table['('] = 1; - -#ifdef REGISTER_PREFIX - alt_notend_table[REGISTER_PREFIX] = 1; -#endif - - -} - -#if 0 -#define notend(s) ((*s == ',' || *s == '}' || *s == '{' \ - || (*s == ':' && strchr("aAdD#(", s[1]))) \ - ? 0 : 1) -#endif - -/* This funciton is called once, before the assembler exits. It is - supposed to do any final cleanup for this part of the assembler. - */ -void - md_end() -{ -} - -/* Equal to MAX_PRECISION in atof-ieee.c */ -#define MAX_LITTLENUMS 6 - -/* Turn a string in str 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) -char type; -char *litP; -int *sizeP; -{ - int 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; - - case 'x': - case 'X': - prec = 6; - break; - - case 'p': - case 'P': - prec = 6; - break; - - default: - *sizeP=0; - return "Bad call to MD_ATOF()"; - } - t=atof_ieee(input_line_pointer,type,words); - if(t) - input_line_pointer=t; - - *sizeP=prec * sizeof(LITTLENUM_TYPE); - for(wordP=words;prec--;) { - md_number_to_chars(litP,(long)(*wordP++),sizeof(LITTLENUM_TYPE)); - litP+=sizeof(LITTLENUM_TYPE); - } - return ""; /* Someone should teach Dean about null pointers */ -} - -/* Turn an integer of n bytes (in val) into a stream of bytes appropriate - for use in the a.out file, and stores them in the array pointed to by buf. - This knows about the endian-ness of the target machine and does - THE RIGHT THING, whatever it is. Possible values for n are 1 (byte) - 2 (short) and 4 (long) Floating numbers are put out as a series of - LITTLENUMS (shorts, here at least) - */ -void - md_number_to_chars(buf,val,n) -char *buf; -long val; -int n; -{ - switch(n) { - case 1: - *buf++=val; - break; - case 2: - *buf++=(val>>8); - *buf++=val; - break; - case 4: - *buf++=(val>>24); - *buf++=(val>>16); - *buf++=(val>>8); - *buf++=val; - break; - default: - as_fatal("failed sanity check."); - } -} - -void - md_apply_fix(fixP, val) -fixS *fixP; -long val; -{ - char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; - - switch(fixP->fx_size) { - case 1: - *buf++=val; - break; - case 2: - *buf++=(val>>8); - *buf++=val; - break; - case 4: - *buf++=(val>>24); - *buf++=(val>>16); - *buf++=(val>>8); - *buf++=val; - break; - default: - BAD_CASE (fixP->fx_size); - } -} - - -/* *fragP has been relaxed to its final size, and now needs to have - the bytes inside it modified to conform to the new size There is UGLY - MAGIC here. .. - */ -void - md_convert_frag(headers, fragP) -object_headers *headers; -register fragS *fragP; -{ - long disp; - long ext = 0; - - /* Address in object code of the displacement. */ - register int object_address = fragP -> fr_fix + fragP -> fr_address; - -#ifdef IBM_COMPILER_SUX - /* This is wrong but it convinces the native rs6000 compiler to - generate the code we want. */ - register char *buffer_address = fragP -> fr_literal; - buffer_address += fragP -> fr_fix; -#else /* IBM_COMPILER_SUX */ - /* Address in gas core of the place to store the displacement. */ - register char *buffer_address = fragP->fr_fix + fragP->fr_literal; -#endif /* IBM_COMPILER_SUX */ - - /* No longer true: know(fragP->fr_symbol); */ - - /* The displacement of the address, from current location. */ - disp = fragP->fr_symbol ? S_GET_VALUE(fragP->fr_symbol) : 0; - disp = (disp + fragP->fr_offset) - object_address; - - switch(fragP->fr_subtype) { - case TAB(BCC68000,BYTE): - case TAB(BRANCH,BYTE): - know(issbyte(disp)); - if(disp==0) - as_bad("short branch with zero offset: use :w"); - fragP->fr_opcode[1]=disp; - ext=0; - break; - case TAB(DBCC,SHORT): - know(issword(disp)); - ext=2; - break; - case TAB(BCC68000,SHORT): - case TAB(BRANCH,SHORT): - know(issword(disp)); - fragP->fr_opcode[1]=0x00; - ext=2; - break; - case TAB(BRANCH,LONG): - if (cpu_of_arch(current_architecture) < m68020) { - if (fragP->fr_opcode[0]==0x61) { - fragP->fr_opcode[0]= 0x4E; - fragP->fr_opcode[1]= 0xB9; /* JBSR with ABSL LONG offset */ - subseg_change(SEG_TEXT, 0); - - fix_new(fragP, - fragP->fr_fix, - 4, - fragP->fr_symbol, - 0, - fragP->fr_offset, - 0, - NO_RELOC); - - fragP->fr_fix+=4; - ext=0; - } else if (fragP->fr_opcode[0]==0x60) { - fragP->fr_opcode[0]= 0x4E; - fragP->fr_opcode[1]= 0xF9; /* JMP with ABSL LONG offset */ - subseg_change(SEG_TEXT, 0); - fix_new(fragP, fragP->fr_fix, 4, fragP->fr_symbol, 0, fragP->fr_offset,0, - NO_RELOC); - fragP->fr_fix+=4; - ext=0; - } else { - as_bad("Long branch offset not supported."); - } - } else { - fragP->fr_opcode[1]=0xff; - ext=4; - } - break; - case TAB(BCC68000,LONG): - /* only Bcc 68000 instructions can come here */ - /* change bcc into b!cc/jmp absl long */ - fragP->fr_opcode[0] ^= 0x01; /* invert bcc */ - fragP->fr_opcode[1] = 0x6; /* branch offset = 6 */ - - /* JF: these used to be fr_opcode[2,3], but they may be in a - different frag, in which case refering to them is a no-no. - Only fr_opcode[0,1] are guaranteed to work. */ - *buffer_address++ = 0x4e; /* put in jmp long (0x4ef9) */ - *buffer_address++ = 0xf9; - fragP->fr_fix += 2; /* account for jmp instruction */ - subseg_change(SEG_TEXT,0); - fix_new(fragP, fragP->fr_fix, 4, fragP->fr_symbol, 0, - fragP->fr_offset,0, - NO_RELOC); - fragP->fr_fix += 4; - ext=0; - break; - case TAB(DBCC,LONG): - /* only DBcc 68000 instructions can come here */ - /* change dbcc into dbcc/jmp absl long */ - /* JF: these used to be fr_opcode[2-7], but that's wrong */ - *buffer_address++ = 0x00; /* branch offset = 4 */ - *buffer_address++ = 0x04; - *buffer_address++ = 0x60; /* put in bra pc+6 */ - *buffer_address++ = 0x06; - *buffer_address++ = 0x4e; /* put in jmp long (0x4ef9) */ - *buffer_address++ = 0xf9; - - fragP->fr_fix += 6; /* account for bra/jmp instructions */ - subseg_change(SEG_TEXT,0); - fix_new(fragP, fragP->fr_fix, 4, fragP->fr_symbol, 0, - fragP->fr_offset,0, - NO_RELOC); - fragP->fr_fix += 4; - ext=0; - break; - case TAB(FBRANCH,SHORT): - know((fragP->fr_opcode[1]&0x40)==0); - ext=2; - break; - case TAB(FBRANCH,LONG): - fragP->fr_opcode[1]|=0x40; /* Turn on LONG bit */ - ext=4; - break; - case TAB(PCREL,SHORT): - ext=2; - break; - case TAB(PCREL,LONG): - /* The thing to do here is force it to ABSOLUTE LONG, since - PCREL is really trying to shorten an ABSOLUTE address anyway */ - /* JF FOO This code has not been tested */ - subseg_change(SEG_TEXT,0); - fix_new(fragP, fragP->fr_fix, 4, fragP->fr_symbol, 0, fragP->fr_offset, 0, NO_RELOC); - if((fragP->fr_opcode[1] & 0x3F) != 0x3A) - as_bad("Internal error (long PC-relative operand) for insn 0x%04lx at 0x%lx", - fragP->fr_opcode[0],fragP->fr_address); - fragP->fr_opcode[1]&= ~0x3F; - fragP->fr_opcode[1]|=0x39; /* Mode 7.1 */ - fragP->fr_fix+=4; - /* md_number_to_chars(buffer_address, - (long)(fragP->fr_symbol->sy_value + fragP->fr_offset), - 4); */ - ext=0; - break; - case TAB(PCLEA,SHORT): - subseg_change(SEG_TEXT,0); - fix_new(fragP,(int)(fragP->fr_fix),2,fragP->fr_symbol,(symbolS *)0,fragP->fr_offset,1, - NO_RELOC); - fragP->fr_opcode[1] &= ~0x3F; - fragP->fr_opcode[1] |= 0x3A; - ext=2; - break; - case TAB(PCLEA,LONG): - subseg_change(SEG_TEXT,0); - fix_new(fragP,(int)(fragP->fr_fix)+2,4,fragP->fr_symbol,(symbolS *)0,fragP->fr_offset+2,1, - NO_RELOC); - *buffer_address++ = 0x01; - *buffer_address++ = 0x70; - fragP->fr_fix+=2; - /* buffer_address+=2; */ - ext=4; - break; - -} /* switch on subtype */ - - if (ext) { - md_number_to_chars(buffer_address, (long) disp, (int) ext); - fragP->fr_fix += ext; - /* H_SET_TEXT_SIZE(headers, H_GET_TEXT_SIZE(headers) + ext); */ - } /* if extending */ - - return; -} /* md_convert_frag() */ - -/* Force truly undefined symbols to their maximum size, and generally set up - the frag list to be relaxed - */ -int md_estimate_size_before_relax(fragP, segment) -register fragS *fragP; -segT segment; -{ - int old_fix; - register char *buffer_address = fragP->fr_fix + fragP->fr_literal; - - old_fix = fragP->fr_fix; - - /* handle SZ_UNDEF first, it can be changed to BYTE or SHORT */ - switch(fragP->fr_subtype) { - - case TAB(BRANCH,SZ_UNDEF): { - if((fragP->fr_symbol != NULL) /* Not absolute */ - && S_GET_SEGMENT(fragP->fr_symbol) == segment) { - fragP->fr_subtype=TAB(TABTYPE(fragP->fr_subtype),BYTE); - break; - } else if((fragP->fr_symbol == 0) || (cpu_of_arch(current_architecture) < m68020)) { - /* On 68000, or for absolute value, switch to abs long */ - /* FIXME, we should check abs val, pick short or long */ - if(fragP->fr_opcode[0]==0x61) { - fragP->fr_opcode[0]= 0x4E; - fragP->fr_opcode[1]= 0xB9; /* JBSR with ABSL LONG offset */ - subseg_change(SEG_TEXT, 0); - fix_new(fragP, fragP->fr_fix, 4, - fragP->fr_symbol, 0, fragP->fr_offset, 0, NO_RELOC); - fragP->fr_fix+=4; - frag_wane(fragP); - } else if(fragP->fr_opcode[0]==0x60) { - fragP->fr_opcode[0]= 0x4E; - fragP->fr_opcode[1]= 0xF9; /* JMP with ABSL LONG offset */ - subseg_change(SEG_TEXT, 0); - fix_new(fragP, fragP->fr_fix, 4, - fragP->fr_symbol, 0, fragP->fr_offset, 0, NO_RELOC); - fragP->fr_fix+=4; - frag_wane(fragP); - } else { - as_warn("Long branch offset to extern symbol not supported."); - } - } else { /* Symbol is still undefined. Make it simple */ - fix_new(fragP, (int)(fragP->fr_fix), 4, fragP->fr_symbol, - (symbolS *)0, fragP->fr_offset+4, 1, NO_RELOC); - fragP->fr_fix+=4; - fragP->fr_opcode[1]=0xff; - frag_wane(fragP); - break; - } - - break; - } /* case TAB(BRANCH,SZ_UNDEF) */ - - case TAB(FBRANCH,SZ_UNDEF): { - if(S_GET_SEGMENT(fragP->fr_symbol) == segment || flagseen['l']) { - fragP->fr_subtype = TAB(FBRANCH,SHORT); - fragP->fr_var += 2; - } else { - fragP->fr_subtype = TAB(FBRANCH,LONG); - fragP->fr_var += 4; - } - break; - } /* TAB(FBRANCH,SZ_UNDEF) */ - - case TAB(PCREL,SZ_UNDEF): { - if(S_GET_SEGMENT(fragP->fr_symbol) == segment || flagseen['l']) { - fragP->fr_subtype = TAB(PCREL,SHORT); - fragP->fr_var += 2; - } else { - fragP->fr_subtype = TAB(PCREL,LONG); - fragP->fr_var += 4; - } - break; - } /* TAB(PCREL,SZ_UNDEF) */ - - case TAB(BCC68000,SZ_UNDEF): { - if((fragP->fr_symbol != NULL) - && S_GET_SEGMENT(fragP->fr_symbol) == segment) { - fragP->fr_subtype=TAB(BCC68000,BYTE); - break; - } - /* only Bcc 68000 instructions can come here */ - /* change bcc into b!cc/jmp absl long */ - fragP->fr_opcode[0] ^= 0x01; /* invert bcc */ - if(flagseen['l']) { - fragP->fr_opcode[1] = 0x04; /* branch offset = 6 */ - /* JF: these were fr_opcode[2,3] */ - buffer_address[0] = 0x4e; /* put in jmp long (0x4ef9) */ - buffer_address[1] = 0xf8; - fragP->fr_fix += 2; /* account for jmp instruction */ - subseg_change(SEG_TEXT,0); - fix_new(fragP, fragP->fr_fix, 2, fragP->fr_symbol, 0, - fragP->fr_offset, 0, NO_RELOC); - fragP->fr_fix += 2; - } else { - fragP->fr_opcode[1] = 0x06; /* branch offset = 6 */ - /* JF: these were fr_opcode[2,3] */ - buffer_address[2] = 0x4e; /* put in jmp long (0x4ef9) */ - buffer_address[3] = 0xf9; - fragP->fr_fix += 2; /* account for jmp instruction */ - subseg_change(SEG_TEXT,0); - fix_new(fragP, fragP->fr_fix, 4, fragP->fr_symbol, 0, - fragP->fr_offset, 0, NO_RELOC); - fragP->fr_fix += 4; - } - frag_wane(fragP); - break; - } /* case TAB(BCC68000,SZ_UNDEF) */ - - case TAB(DBCC,SZ_UNDEF): { - if (fragP->fr_symbol != NULL && S_GET_SEGMENT(fragP->fr_symbol) == segment) { - fragP->fr_subtype=TAB(DBCC,SHORT); - fragP->fr_var+=2; - break; - } - /* only DBcc 68000 instructions can come here */ - /* change dbcc into dbcc/jmp absl long */ - /* JF: these used to be fr_opcode[2-4], which is wrong. */ - buffer_address[0] = 0x00; /* branch offset = 4 */ - buffer_address[1] = 0x04; - buffer_address[2] = 0x60; /* put in bra pc + ... */ - - if(flagseen['l']) { - /* JF: these were fr_opcode[5-7] */ - buffer_address[3] = 0x04; /* plus 4 */ - buffer_address[4] = 0x4e;/* Put in Jump Word */ - buffer_address[5] = 0xf8; - fragP->fr_fix += 6; /* account for bra/jmp instruction */ - subseg_change(SEG_TEXT,0); - fix_new(fragP, fragP->fr_fix, 2, fragP->fr_symbol, 0, - fragP->fr_offset, 0, NO_RELOC); - fragP->fr_fix += 2; - } else { - /* JF: these were fr_opcode[5-7] */ - buffer_address[3] = 0x06; /* Plus 6 */ - buffer_address[4] = 0x4e; /* put in jmp long (0x4ef9) */ - buffer_address[5] = 0xf9; - fragP->fr_fix += 6; /* account for bra/jmp instruction */ - subseg_change(SEG_TEXT,0); - fix_new(fragP, fragP->fr_fix, 4, fragP->fr_symbol, 0, - fragP->fr_offset, 0, NO_RELOC); - fragP->fr_fix += 4; - } - - frag_wane(fragP); - break; - } /* case TAB(DBCC,SZ_UNDEF) */ - - case TAB(PCLEA,SZ_UNDEF): { - if ((S_GET_SEGMENT(fragP->fr_symbol))==segment || flagseen['l']) { - fragP->fr_subtype=TAB(PCLEA,SHORT); - fragP->fr_var+=2; - } else { - fragP->fr_subtype=TAB(PCLEA,LONG); - fragP->fr_var+=6; - } - break; - } /* TAB(PCLEA,SZ_UNDEF) */ - - default: - break; - - } /* switch on subtype looking for SZ_UNDEF's. */ - - /* now that SZ_UNDEF are taken care of, check others */ - switch(fragP->fr_subtype) { - case TAB(BCC68000,BYTE): - case TAB(BRANCH,BYTE): - /* We can't do a short jump to the next instruction, - so we force word mode. */ - if (fragP->fr_symbol && S_GET_VALUE(fragP->fr_symbol)==0 && - fragP->fr_symbol->sy_frag==fragP->fr_next) { - fragP->fr_subtype=TAB(TABTYPE(fragP->fr_subtype),SHORT); - fragP->fr_var+=2; - } - break; - default: - break; -} - return fragP->fr_var + fragP->fr_fix - old_fix; -} - -#if defined(OBJ_AOUT) | defined(OBJ_BOUT) -/* the bit-field entries in the relocation_info struct plays hell - with the byte-order problems of cross-assembly. So as a hack, - I added this mach. dependent ri twiddler. Ugly, but it gets - you there. -KWK */ -/* on m68k: first 4 bytes are normal unsigned long, next three bytes - are symbolnum, most sig. byte first. Last byte is broken up with - bit 7 as pcrel, bits 6 & 5 as length, bit 4 as pcrel, and the lower - nibble as nuthin. (on Sun 3 at least) */ -/* Translate the internal relocation information into target-specific - format. */ -#ifdef comment -void - md_ri_to_chars(the_bytes, ri) -char *the_bytes; -struct reloc_info_generic *ri; -{ - /* this is easy */ - md_number_to_chars(the_bytes, ri->r_address, 4); - /* now the fun stuff */ - the_bytes[4] = (ri->r_symbolnum >> 16) & 0x0ff; - the_bytes[5] = (ri->r_symbolnum >> 8) & 0x0ff; - the_bytes[6] = ri->r_symbolnum & 0x0ff; - the_bytes[7] = (((ri->r_pcrel << 7) & 0x80) | ((ri->r_length << 5) & 0x60) | - ((ri->r_extern << 4) & 0x10)); -} -#endif /* comment */ - -void tc_aout_fix_to_chars(where, fixP, segment_address_in_file) -char *where; -fixS *fixP; -relax_addressT segment_address_in_file; -{ - /* - * In: length of relocation (or of address) in chars: 1, 2 or 4. - * Out: GNU LD relocation length code: 0, 1, or 2. - */ - - static unsigned char nbytes_r_length [] = { 42, 0, 1, 42, 2 }; - - long r_extern; - long r_symbolnum; - - /* this is easy */ - md_number_to_chars(where, - fixP->fx_frag->fr_address + fixP->fx_where - segment_address_in_file, - 4); - - /* now the fun stuff */ - if (S_GET_TYPE(fixP->fx_addsy) == N_UNDF) { - r_extern = 1; - r_symbolnum = fixP->fx_addsy->sy_number; - } else { - r_extern = 0; - r_symbolnum = S_GET_TYPE(fixP->fx_addsy); - } - - where[4] = (r_symbolnum >> 16) & 0x0ff; - where[5] = (r_symbolnum >> 8) & 0x0ff; - where[6] = r_symbolnum & 0x0ff; - where[7] = (((fixP->fx_pcrel << 7) & 0x80) | ((nbytes_r_length[fixP->fx_size] << 5) & 0x60) | - ((r_extern << 4) & 0x10)); - - return; -} /* tc_aout_fix_to_chars() */ - -#endif /* OBJ_AOUT or OBJ_BOUT */ - -#ifndef WORKING_DOT_WORD -const int md_short_jump_size = 4; -const int md_long_jump_size = 6; - -void - md_create_short_jump(ptr,from_addr,to_addr,frag,to_symbol) -char *ptr; -long from_addr, - to_addr; -fragS *frag; -symbolS *to_symbol; -{ - long offset; - - offset = to_addr - (from_addr+2); - - md_number_to_chars(ptr ,(long)0x6000,2); - md_number_to_chars(ptr+2,(long)offset,2); -} - -void - md_create_long_jump(ptr,from_addr,to_addr,frag,to_symbol) -char *ptr; -long from_addr, - to_addr; -fragS *frag; -symbolS *to_symbol; -{ - long offset; - - if (cpu_of_arch(current_architecture) < m68020) { - offset=to_addr-S_GET_VALUE(to_symbol); - md_number_to_chars(ptr ,(long)0x4EF9,2); - md_number_to_chars(ptr+2,(long)offset,4); - fix_new(frag,(ptr+2)-frag->fr_literal,4,to_symbol,(symbolS *)0,(long)0,0, - NO_RELOC); - } else { - offset=to_addr - (from_addr+2); - md_number_to_chars(ptr ,(long)0x60ff,2); - md_number_to_chars(ptr+2,(long)offset,4); - } -} - -#endif -/* Different values of OK tell what its OK to return. Things that aren't OK are an error (what a shock, no?) - - 0: Everything is OK - 10: Absolute 1:8 only - 20: Absolute 0:7 only - 30: absolute 0:15 only - 40: Absolute 0:31 only - 50: absolute 0:127 only - 55: absolute -64:63 only - 60: absolute -128:127 only - 70: absolute 0:4095 only - 80: No bignums - - */ - -static int get_num(exp,ok) -struct m68k_exp *exp; -int ok; -{ -#ifdef TEST2 - long l = 0; - - if(!exp->e_beg) - return 0; - if(*exp->e_beg=='0') { - if(exp->e_beg[1]=='x') - sscanf(exp->e_beg+2,"%x",&l); - else - sscanf(exp->e_beg+1,"%O",&l); - return l; - } - return atol(exp->e_beg); -#else - char *save_in; - char c_save; - - if(!exp) { - /* Can't do anything */ - return 0; - } - if(!exp->e_beg || !exp->e_end) { - seg(exp)=SEG_ABSOLUTE; - adds(exp)=0; - subs(exp)=0; - offs(exp)= (ok==10) ? 1 : 0; - as_warn("Null expression defaults to %ld",offs(exp)); - return 0; - } - - exp->e_siz=0; - if(/* ok!=80 && */exp->e_end[-1]==SIZER && (exp->e_end-exp->e_beg)>=2) { - switch(exp->e_end[0]) { - case 's': - case 'S': - case 'b': - case 'B': - exp->e_siz=1; - break; - case 'w': - case 'W': - exp->e_siz=2; - break; - case 'l': - case 'L': - exp->e_siz=3; - break; - default: - as_bad("Unknown size for expression \"%c\"",exp->e_end[0]); - } - exp->e_end-=2; - } - c_save=exp->e_end[1]; - exp->e_end[1]='\0'; - save_in=input_line_pointer; - input_line_pointer=exp->e_beg; - switch(expression(&(exp->e_exp))) { - case SEG_PASS1: - seg(exp)=SEG_ABSOLUTE; - adds(exp)=0; - subs(exp)=0; - offs(exp)= (ok==10) ? 1 : 0; - as_warn("Unknown expression: '%s' defaulting to %d",exp->e_beg,offs(exp)); - break; - - case SEG_ABSENT: - /* Do the same thing the VAX asm does */ - seg(exp)=SEG_ABSOLUTE; - adds(exp)=0; - subs(exp)=0; - offs(exp)=0; - if(ok==10) { - as_warn("expression out of range: defaulting to 1"); - offs(exp)=1; - } - break; - case SEG_ABSOLUTE: - switch(ok) { - case 10: - if(offs(exp)<1 || offs(exp)>8) { - as_warn("expression out of range: defaulting to 1"); - offs(exp)=1; - } - break; - case 20: - if(offs(exp)<0 || offs(exp)>7) - goto outrange; - break; - case 30: - if(offs(exp)<0 || offs(exp)>15) - goto outrange; - break; - case 40: - if(offs(exp)<0 || offs(exp)>32) - goto outrange; - break; - case 50: - if(offs(exp)<0 || offs(exp)>127) - goto outrange; - break; - case 55: - if(offs(exp)<-64 || offs(exp)>63) - goto outrange; - break; - case 60: - if(offs(exp)<-128 || offs(exp)>127) - goto outrange; - break; - case 70: - if(offs(exp)<0 || offs(exp)>4095) { - outrange: - as_warn("expression out of range: defaulting to 0"); - offs(exp)=0; - } - break; - default: - break; - } - break; - case SEG_TEXT: - case SEG_DATA: - case SEG_BSS: - case SEG_UNKNOWN: - case SEG_DIFFERENCE: - if(ok>=10 && ok<=70) { - seg(exp)=SEG_ABSOLUTE; - adds(exp)=0; - subs(exp)=0; - offs(exp)= (ok==10) ? 1 : 0; - as_warn("Can't deal with expression \"%s\": defaulting to %ld",exp->e_beg,offs(exp)); - } - break; - case SEG_BIG: - if(ok==80 && offs(exp)<0) { /* HACK! Turn it into a long */ - LITTLENUM_TYPE words[6]; - - gen_to_words(words,2,8L);/* These numbers are magic! */ - seg(exp)=SEG_ABSOLUTE; - adds(exp)=0; - subs(exp)=0; - offs(exp)=words[1]|(words[0]<<16); - } else if(ok!=0) { - seg(exp)=SEG_ABSOLUTE; - adds(exp)=0; - subs(exp)=0; - offs(exp)= (ok==10) ? 1 : 0; - as_warn("Can't deal with expression \"%s\": defaulting to %ld",exp->e_beg,offs(exp)); - } - break; - default: - as_fatal("failed sanity check."); - } - if(input_line_pointer!=exp->e_end+1) - as_bad("Ignoring junk after expression"); - exp->e_end[1]=c_save; - input_line_pointer=save_in; - if(exp->e_siz) { - switch(exp->e_siz) { - case 1: - if(!isbyte(offs(exp))) - as_warn("expression doesn't fit in BYTE"); - break; - case 2: - if(!isword(offs(exp))) - as_warn("expression doesn't fit in WORD"); - break; - } - } - return offs(exp); -#endif -} /* get_num() */ - -/* 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() { - subseg_new(SEG_DATA,1); - demand_empty_rest_of_line(); -} /* s_data1() */ - -static void s_data2() { - subseg_new(SEG_DATA,2); - demand_empty_rest_of_line(); -} /* s_data2() */ - -static void s_bss() { - /* We don't support putting frags in the BSS segment, but we - can put them into initialized data for now... */ - subseg_new(SEG_DATA,255); /* FIXME-SOON */ - demand_empty_rest_of_line(); -} /* s_bss() */ - -static void s_even() { - register int temp; - register long temp_fill; - - 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); - demand_empty_rest_of_line(); -} /* s_even() */ - -static void s_proc() { - demand_empty_rest_of_line(); -} /* s_proc() */ - -/* s_space is defined in read.c .skip is simply an alias to it. */ - -/* - * md_parse_option - * Invocation line includes a switch not recognized by the base assembler. - * See if it's a processor-specific option. These are: - * - * -[A]m[c]68000, -[A]m[c]68008, -[A]m[c]68010, -[A]m[c]68020, -[A]m[c]68030, -[A]m[c]68040 - * -[A]m[c]68881, -[A]m[c]68882, -[A]m[c]68851 - * Select the architecture. Instructions or features not - * supported by the selected architecture cause fatal - * errors. More than one may be specified. The default is - * -m68020 -m68851 -m68881. Note that -m68008 is a synonym - * for -m68000, and -m68882 is a synonym for -m68881. - * - * MAYBE_FLOAT_TOO is defined below so that specifying a processor type - * (e.g. m68020) also requests that float instructions be included. This - * is the default setup, mostly to avoid hassling users. A better - * rearrangement of this structure would be to add an option to DENY - * floating point opcodes, for people who want to really know there's none - * of that funny floaty stuff going on. FIXME-later. - */ -#ifndef MAYBE_FLOAT_TOO -#define MAYBE_FLOAT_TOO m68881 -#endif - -int md_parse_option(argP,cntP,vecP) -char **argP; -int *cntP; -char ***vecP; -{ - switch(**argP) { - case 'l': /* -l means keep external to 2 bit offset - rather than 16 bit one */ - break; - - case 'S': /* -S means that jbsr's always turn into jsr's. */ - break; - - case 'A': - (*argP)++; - /* intentional fall-through */ - case 'm': - (*argP)++; - - if (**argP=='c') { - (*argP)++; - } /* allow an optional "c" */ - - if (!strcmp(*argP, "68000") - || !strcmp(*argP, "68008")) { - current_architecture |= m68000; - } else if (!strcmp(*argP, "68010")) { -#ifdef TE_SUN - omagic= 1<<16|OMAGIC; -#endif - current_architecture |= m68010; - - } else if (!strcmp(*argP, "68020")) { - current_architecture |= m68020 | MAYBE_FLOAT_TOO; - - } else if (!strcmp(*argP, "68030")) { - current_architecture |= m68030 | MAYBE_FLOAT_TOO; - - } else if (!strcmp(*argP, "68040")) { - current_architecture |= m68040 | MAYBE_FLOAT_TOO; - -#ifndef NO_68881 - } else if (!strcmp(*argP, "68881")) { - current_architecture |= m68881; - - } else if (!strcmp(*argP, "68882")) { - current_architecture |= m68882; - -#endif /* NO_68881 */ -#ifndef NO_68851 - } else if (!strcmp(*argP,"68851")) { - current_architecture |= m68851; - -#endif /* NO_68851 */ - } else { - as_warn("Unknown architecture, \"%s\". option ignored", *argP); - } /* switch on architecture */ - - while(**argP) (*argP)++; - - break; - - case 'p': - if (!strcmp(*argP,"pic")) { - (*argP) += 3; - break; /* -pic, Position Independent Code */ - } else { - return(0); - } /* pic or not */ - - default: - return 0; - } - return 1; -} - - -#ifdef TEST2 - -/* TEST2: Test md_assemble() */ -/* Warning, this routine probably doesn't work anymore */ - -main() -{ - struct m68k_it the_ins; - char buf[120]; - char *cp; - int n; - - m68k_ip_begin(); - for(;;) { - if(!gets(buf) || !*buf) - break; - if(buf[0]=='|' || buf[1]=='.') - continue; - for(cp=buf;*cp;cp++) - if(*cp=='\t') - *cp=' '; - if(is_label(buf)) - continue; - memset(&the_ins, '\0', sizeof(the_ins)); - m68k_ip(&the_ins,buf); - if(the_ins.error) { - printf("Error %s in %s\n",the_ins.error,buf); - } else { - printf("Opcode(%d.%s): ",the_ins.numo,the_ins.args); - for(n=0;n<the_ins.numo;n++) - printf(" 0x%x",the_ins.opcode[n]&0xffff); - printf(" "); - print_the_insn(&the_ins.opcode[0],stdout); - (void)putchar('\n'); - } - for(n=0;n<strlen(the_ins.args)/2;n++) { - if(the_ins.operands[n].error) { - printf("op%d Error %s in %s\n",n,the_ins.operands[n].error,buf); - continue; - } - printf("mode %d, reg %d, ",the_ins.operands[n].mode,the_ins.operands[n].reg); - if(the_ins.operands[n].b_const) - printf("Constant: '%.*s', ",1+the_ins.operands[n].e_const-the_ins.operands[n].b_const,the_ins.operands[n].b_const); - printf("ireg %d, isiz %d, imul %d, ",the_ins.operands[n].ireg,the_ins.operands[n].isiz,the_ins.operands[n].imul); - if(the_ins.operands[n].b_iadd) - printf("Iadd: '%.*s',",1+the_ins.operands[n].e_iadd-the_ins.operands[n].b_iadd,the_ins.operands[n].b_iadd); - (void)putchar('\n'); - } - } - m68k_ip_end(); - return 0; -} - -is_label(str) -char *str; -{ - while(ISSPACE(*str)) - str++; - while(*str && !ISSPACE(*str)) - str++; - if(str[-1]==':' || str[1]=='=') - return 1; - return 0; -} - -#endif - -/* Possible states for relaxation: - - 0 0 branch offset byte (bra, etc) - 0 1 word - 0 2 long - - 1 0 indexed offsets byte a0@(32,d4:w:1) etc - 1 1 word - 1 2 long - - 2 0 two-offset index word-word a0@(32,d4)@(45) etc - 2 1 word-long - 2 2 long-word - 2 3 long-long - - */ - - - -#ifdef DONTDEF -abort() -{ - printf("ABORT!\n"); - exit(12); -} - -print_frags() -{ - fragS *fragP; - extern fragS *text_frag_root; - - for(fragP=text_frag_root;fragP;fragP=fragP->fr_next) { - printf("addr %lu next 0x%x fix %ld var %ld symbol 0x%x offset %ld\n", - fragP->fr_address,fragP->fr_next,fragP->fr_fix,fragP->fr_var,fragP->fr_symbol,fragP->fr_offset); - printf("opcode 0x%x type %d subtype %d\n\n",fragP->fr_opcode,fragP->fr_type,fragP->fr_subtype); - } - fflush(stdout); - return 0; -} -#endif - -#ifdef DONTDEF -/*VARARGS1*/ -panic(format,args) -char *format; -{ - fputs("Internal error:",stderr); - _doprnt(format,&args,stderr); - (void)putc('\n',stderr); - as_where(); - abort(); -} -#endif - -/* We have no need to default values of symbols. */ - -/* ARGSUSED */ -symbolS * - md_undefined_symbol (name) -char *name; -{ - return 0; -} - -/* Parse an operand that is machine-specific. - We just return without modifying the expression if we have nothing - to do. */ - -/* ARGSUSED */ -void - md_operand (expressionP) -expressionS *expressionP; -{ -} - -/* Round up a section size to the appropriate boundary. */ -long - md_section_align (segment, size) -segT segment; -long size; -{ - return size; /* Byte alignment is fine */ -} - -/* Exactly what point is a PC-relative offset relative TO? - On the 68k, they're relative to the address of the offset, plus - its size. (??? Is this right? FIXME-SOON!) */ -long - md_pcrel_from (fixP) -fixS *fixP; -{ - return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address; -} - -#ifdef MRI -void s_ds(size) -{ - unsigned int fill = get_absolute_expression() * size; - char *p = frag_var (rs_fill, fill, fill, (relax_substateT)0, (symbolS *)0, - 1, (char *)0); - * p = 0; - demand_empty_rest_of_line(); -} - -void s_dc(size) -{ - - cons(size); - - -} - -void s_dcb(size) -{ - int repeat = get_absolute_expression(); - int fill; - - if (*input_line_pointer == ',') - { - char *p; - input_line_pointer++; - - fill = get_absolute_expression(); - p = frag_var(rs_fill, - size, - size, - (relax_substateT)0, - (symbolS *)0, - repeat, - 0); - md_number_to_chars(p, fill, size); - } - demand_empty_rest_of_line(); - - -} - -void s_chip() -{ - unsigned int target = get_absolute_expression(); -#define MACHINE_MASK (m68000 | m68008 | m68010 | m68020 | m68040) - switch (target) - { - case 68000: - case 68008: - current_architecture = (current_architecture & ~ MACHINE_MASK) | m68000; - break; - case 68010: - current_architecture = (current_architecture & ~ MACHINE_MASK) | m68010; - break; - case 68020: - current_architecture = (current_architecture & ~ MACHINE_MASK) | m68020; - break; - case 68030: - current_architecture = (current_architecture & ~ MACHINE_MASK) | m68030; - break; - case 68040: - current_architecture = (current_architecture & ~ MACHINE_MASK) | m68040; - break; - case 68881: - current_architecture |= m68881; - break; - case 68882: - current_architecture |= m68882; - break; - case 68851: - current_architecture |= m68851; - break; - - default: - as_bad("Unrecognised CHIP %d\n", target); - - } - demand_empty_rest_of_line(); -} - -#endif - -/* - * Local Variables: - * comment-column: 0 - * fill-column: 131 - * End: - */ - -/* end of tc-m68kmote.c */ diff --git a/gas/config/tc-m68kmote.h b/gas/config/tc-m68kmote.h deleted file mode 100644 index 95e0c15..0000000 --- a/gas/config/tc-m68kmote.h +++ /dev/null @@ -1,64 +0,0 @@ -/* This file is tc-m68kmote.h - - Copyright (C) 1987-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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* - * This file is tp-generic.h and is intended to be a template for - * target processor specific header files. - */ - -#define TC_M68K 1 - -#ifdef TE_SUN3 -/* This variable contains the value to write out at the beginning of - the a.out file. The 2<<16 means that this is a 68020 file instead - of an old-style 68000 file */ - -#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (2<<16|OMAGIC); /* Magic byte for file header */ -#endif /* TE_SUN3 */ - -#define AOUT_MACHTYPE 0x2 -#define REVERSE_SORT_RELOCS /* FIXME-NOW: this line can be removed. */ -#define LOCAL_LABELS_FB - -#define tc_crawl_symbol_chain(a) {;} /* not used */ -#define tc_headers_hook(a) {;} /* not used */ -#define tc_aout_pre_write_hook(x) {;} /* not used */ - -#define LISTING_WORD_SIZE 2 /* A word is 2 bytes */ -#define LISTING_LHS_WIDTH 3 /* 3 word on the first line */ -#define LISTING_LHS_WIDTH_SECOND 3 /* One word on the second line */ -#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 */ \ - } -#define MRI - -/* - * Local Variables: - * comment-column: 0 - * fill-column: 131 - * End: - */ - -/* end of tc-m68kmote.h */ diff --git a/gas/config/te-motor.h b/gas/config/te-motor.h deleted file mode 100755 index 2254841..0000000 --- a/gas/config/te-motor.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Machine specific defines for the unisoft 680x0 V.3.2 version 1.3 */ - -/* Remove leading underscore from the gcc generated symbol names */ -#define STRIP_UNDERSCORE 1 diff --git a/gas/config/te-sparc.h b/gas/config/te-sparc.h deleted file mode 100755 index c1a3743..0000000 --- a/gas/config/te-sparc.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sparc.h -- Header file for the SPARC - Copyright (C) 1989 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* - * The following enum and struct were borrowed from - * sunOS /usr/include/sun4/a.out.h - * - */ - -enum reloc_type -{ - RELOC_8, RELOC_16, RELOC_32, RELOC_DISP8, - RELOC_DISP16, RELOC_DISP32, RELOC_WDISP30, RELOC_WDISP22, - RELOC_HI22, RELOC_22, RELOC_13, RELOC_LO10, - RELOC_SFA_BASE, RELOC_SFA_OFF13, RELOC_BASE10, RELOC_BASE13, - RELOC_BASE22, RELOC_PC10, RELOC_PC22, RELOC_JMP_TBL, - RELOC_SEGOFF16, RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE, - - NO_RELOC -}; - -struct reloc_info_sparc -{ - unsigned long r_address; -/* - * Using bit fields here is a bad idea because the order is not portable. :-( - */ - unsigned int r_index : 24; - unsigned int r_extern : 1; - unsigned int unused : 2; - enum reloc_type r_type : 5; - long r_addend; -}; - -#define relocation_info reloc_info_sparc - diff --git a/gas/config/te-unisoft.h b/gas/config/te-unisoft.h deleted file mode 100755 index 2254841..0000000 --- a/gas/config/te-unisoft.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Machine specific defines for the unisoft 680x0 V.3.2 version 1.3 */ - -/* Remove leading underscore from the gcc generated symbol names */ -#define STRIP_UNDERSCORE 1 diff --git a/gas/config/tmake-sun3 b/gas/config/tmake-sun3 deleted file mode 100755 index 9681e6d..0000000 --- a/gas/config/tmake-sun3 +++ /dev/null @@ -1 +0,0 @@ -# This line from make-sun3. diff --git a/gas/configdos.bat b/gas/configdos.bat deleted file mode 100755 index 18331cd..0000000 --- a/gas/configdos.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off -echo Configuring GAS for H8/300 - -copy config\ho-go32.h host.h -copy config\tc-h8300.c targ-cpu.c -copy config\tc-h8300.h targ-cpu.h -copy config\te-generic.h targ-env.h -copy config\objcoff-bfd.h obj-format.h -copy config\objcoff-bfd.c obj-format.c -copy config\atof-ieee.c atof-targ.c - -copy Makefile.dos Makefile - - diff --git a/gas/configure b/gas/configure deleted file mode 100755 index 3cdccfe..0000000 --- a/gas/configure +++ /dev/null @@ -1,687 +0,0 @@ -#!/bin/sh - -# Configuration script -# Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc. - -#This file is part of GNU. - -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -# $Id$ - -# -# Shell script to create proper links to machine-dependent files in -# preparation for compilation. -# -# If configure succeeds, it leaves its status in config.status. -# If configure fails after disturbing the status quo, -# config.status is removed. -# - -remove=rm -hard_link=ln -symbolic_link='ln -s' - -#for Test -#remove="echo rm" -#hard_link="echo ln" -#symbolic_link="echo ln -s" - -progname=$0 - -# clear some things potentially inherited from environment. -ansi= -arguments=$* -defaulttargets= -destdir= -fatal= -hostsubdir= -Makefile=Makefile -Makefile_in=Makefile.in -norecursion= -recurring= -removing= -srcdir= -srctrigger= -target= -targets= -commontargets= -configdirs= -targetsubdir= -template= -verbose= - -for arg in $*; -do - case ${arg} in - -ansi | +a*) - ansi=true - clib=clib - ;; - -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*) - destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'` - ;; - -languages=* | +languages=* | +language=* | +languag=* \ - | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \ - | +l=*) - languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`" - ;; - -gas | +g*) - gas=yes - ;; - -help | +h*) - fatal=true - ;; - -nfp | +nf*) - nfp=yes - ;; - -norecursion | +no*) - norecursion=true - ;; - -recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re) - recurring=true - ;; - -rm | +rm) - removing=${arg} - ;; -# -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*) -# srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'` -# ;; - -subdirs | +f* | +su*) - subdirs=${arg} - ;; - -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*) - if [ -n "${targets}" ] ; then - subdirs="+subdirs" - fi - - newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`" - targets="${newtargets}" - ;; - -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*) - template=`echo ${arg} | sed 's/[+-]template=//'` - ;; - -v | -verbose | +v*) - verbose=${arg} - ;; - -* | +*) - (echo ; - echo "Unrecognized option: \"${arg}\"". ; - echo) 1>&2 - fatal=true - ;; - *) - if [ -n "${hosts}" ] ; then - subdirs="+subdirs" - fi - - newhosts="${hosts} ${arg}" - hosts=${newhosts} - ;; - esac -done - -if [ -n "${verbose}" ] ; then - echo `pwd`/configure $* -fi - -# process host and target only if not rebuilding configure itself or removing. -if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then - # Complain if an arg is missing - if [ -z "${hosts}" ] ; then - (echo ; - echo "configure: No HOST specified." ; - echo) 1>&2 - fatal=true - fi -fi - -if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then - (echo "Usage: configure HOST" ; - echo ; - echo "Options: [defaults in brackets]" ; - echo " +ansi configure w/ANSI library. [no ansi lib]" ; - echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ; - echo " +subdirs configure in subdirectories. [in source directories]" ; - echo " +lang=LANG configure to build LANG. [gcc]" ; - echo " +help print this message. [normal config]" ; - echo " +gas configure the compilers for use with gas. [native as]" ; - echo " +nfp configure the compilers default to soft floating point. [hard float]" ; - echo " +norecursion configure this directory only. [recurse]" ; - echo " +rm remove this configuration. [build a configuration]" ; - echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ; - echo " +template=TEM rebuild configure using TEM. [normal config]" ; - echo ; - echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ; - echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ; - echo "options given will apply to all targets.") 1>&2 - - if [ -r config.status ] ; then - cat config.status - fi - - exit 1 -fi - -#### configure.in common parts come in here. -# This file is a shell script 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. - -srctrigger=as.c -srcname="gas" -targetdependent=true - -## end of common part. - -# are we rebuilding config itself? -if [ -n "${template}" ] ; then - if [ ! -r ${template} ] ; then - echo '***' "Can't find template ${template}." 1>&2 - exit 1 - fi - -# prep the template - sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\ -#### configure.in common parts come in here.\ -## end of common part.' \ - -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\ -#### configure.in per-host parts come in here.\ -## end of per-host part.' \ - -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\ -#### configure.in per-target parts come in here.\ -## end of per-target part.' \ - -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\ -#### configure.in post-target parts come in here.\ -## end of post-target part.' \ - < ${template} > template.new - - if [ -r configure.in ] ; then - if [ -z "`grep '^# per\-host:' configure.in`" ] ; then - echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2 - exit 1 - fi - - if [ -z "`grep '^# per\-target:' configure.in`" ] ; then - echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2 - exit 1 - fi - - # split configure.in into common, per-host, per-target, - # and post-target parts. Post-target is optional. - sed -e '/^# per\-host:/,$d' configure.in > configure.com - sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst - if grep -s '^# post-target:' configure.in ; then - sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt - sed -e '1,/^# post\-target:/d' configure.in > configure.pos - else - sed -e '1,/^# per\-target:/d' configure.in > configure.tgt - echo >configure.pos - fi - - # and insert them - sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \ - -e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \ - -e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \ - -e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \ - template.new > configure.new - - rm -f configure.com configure.tgt configure.hst configure.pos - else - echo Warning: no configure.in in `pwd` - cat ${template} >> configure - fi - - chmod a+x configure.new - rm template.new -# mv configure configure.old - mv configure.new configure - - if [ -n "${verbose}" ] ; then - echo Rebuilt configure in `pwd` - fi - - # Now update config.sub from the template directory. - if echo "$template" | grep -s 'configure$' ; then - cp `echo "$template" | sed s/configure$/config.sub/` ./config.sub.new - # mv config.sub config.sub.old - mv config.sub.new config.sub - - if [ -n "${verbose}" ] ; then - echo Rebuilt config.sub in `pwd` - fi - fi - - if [ -z "${norecursion}" ] ; then - # If template is relative path, make it absolute for recurring. - if echo "${template}" | grep -s '^/' ; then - true - else - template=`pwd`/${template} - fi - - while [ -n "${configdirs}" ] ; do - # set configdir to car of configdirs, configdirs to cdr of configdirs - set ${configdirs}; configdir=$1; shift; configdirs=$* - - if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then - targetspecificdirs=${configdir}.* - else - targetspecificdirs= - fi - - for i in ${configdir} ${targetspecificdirs} ; do - if [ -d $i ] ; then - if [ -r $i/configure ] ; then - (cd $i ; - ./configure +template=${template} ${verbose}) - else - echo Warning: No configure script in `pwd`/$i - fi - else - if [ -n "${verbose}" ] ; then - echo Warning: directory $i is missing. - fi - fi - done - done - fi - - exit 0 -fi - -# some sanity checks on configure.in -if [ -z "${srctrigger}" ] ; then - echo Warning: srctrigger not set in configure.in. `pwd` not configured. - exit 1 -fi - -for host in ${hosts} ; do - # Default other arg - if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then - targets=${host} - defaulttargets=true - fi - - host_alias=${host} - - result=`/bin/sh ./config.sub ${host}` - 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} - host_makefile_frag=config/hmake-${host} - -#### configure.in per-host parts come in here. - -gas_host=generic - -case "${host_cpu}" in -a29k | rs6000 | vax) gas_host=${host_cpu} ;; -mips) - case "${host_os}" in - ultrix) gas_host=decstation ;; - esac - ;; -*) - case "${host_os}" in - ansi | ultrix | hpux | sysv*) gas_host=${host_os} ;; - *) - case "${host_vendor}" in - sun) - case "${host_cpu}" in - m68k) gas_host=sun3 ;; - i386) gas_host=sun386 ;; - sparc) gas_host=sun4 ;; - esac - ;; - esac - ;; - esac - ;; -esac - -## end of per-host part. - - for target in ${targets} ; do - - target_alias=${target} - result=`/bin/sh ./config.sub ${target}` - 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} - target_makefile_frag=config/tmake-${target} - -#### configure.in per-target parts come in here. - -# assign cpu type -emulation=generic - -cpu_type=${target_cpu} - -# assign object format -case ${target_os} in -sysv* | -coff*) - obj_format=coff - ;; -bout*) - obj_format=bout - ;; -bsd* | sunos* | *) - obj_format=aout - ;; -generic) - obj_format=generic - ;; -esac - -# assign floating point type -case ${target_cpu} in -vax) - atof=vax - ;; -*) - atof=ieee - ;; -esac - -# and target makefile frag - -target_makefile_frag=config/tmake-${target_cpu} - -files="config/ho-${gas_host}.h config/tc-${cpu_type}.c \ - config/tc-${cpu_type}.h config/te-${emulation}.h \ - config/obj-${obj_format}.h config/obj-${obj_format}.c \ - config/atof-${atof}.c" - -links="host.h targ-cpu.c targ-cpu.h targ-env.h obj-format.h obj-format.c atof-targ.c" -## end of per-target part. - - # Temporarily, we support only direct subdir builds. - hostsubdir=H-${host_alias} - targetsubdir=T-${target_alias} - - if [ -n "${removing}" ] ; then - if [ -n "${subdirs}" ] ; then - if [ -d "${hostsubdir}" ] ; then - rm -rf ${hostsubdir}/${targetsubdir} - - if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target- | grep -v Target-independent`" ] ; then - rm -rf ${hostsubdir} - fi - else - echo Warning: no `pwd`/${hostsubdir} to remove. - fi - else - rm -f ${Makefile} config.status ${links} - fi - else - if [ -n "${subdirs}" ] ; then - # check for existing status before allowing forced subdirs. - if [ -f ${Makefile} ] ; then - echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2 - exit 1 - fi - - if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi - cd ${hostsubdir} - - if [ ! -d ${targetsubdir} ] ; then - if [ -z "${commontargets}" ] ; then - mkdir ${targetsubdir} - else - if [ ! -d Target-independent ] ; then - mkdir Target-independent - fi - - ${symbolic_link} Target-independent ${targetsubdir} - fi # if target independent - fi # if no target dir yet - - cd ${targetsubdir} - - srcdir=../.. - else - # if not subdir builds, then make sure none exist. - if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then - echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2 - exit 1 - fi - fi - - # Find the source files, if location was not specified. - if [ -z "${srcdir}" ] ; then - srcdirdefaulted=1 - srcdir=. - if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then - srcdir=.. - fi - fi - - if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then - if [ -z "${srcdirdefaulted}" ] ; then - echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2 - else - echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2 - fi - - echo '***' \(At least ${srctrigger} is missing.\) 1>&2 - exit 1 - fi - - # Set up the list of links to be made. - # ${links} is the list of link names, and ${files} is the list of names to link to. - - # Make the links. - while [ -n "${files}" ] ; do - # set file to car of files, files to cdr of files - set ${files}; file=$1; shift; files=$* - set ${links}; link=$1; shift; links=$* - - if [ ! -r ${srcdir}/${file} ] ; then - echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2 - echo '***' "since the file \"${file}\" does not exist." 1>&2 - exit 1 - fi - - ${remove} -f ${link} - rm -f config.status - # Make a symlink if possible, otherwise try a hard link - ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link} - - if [ ! -r ${link} ] ; then - echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2 - exit 1 - fi - - if [ -n "${verbose}" ] ; then - echo "Linked \"${link}\" to \"${srcdir}/${file}\"." - fi - done - - # Create a .gdbinit file which runs the one in srcdir - # and tells GDB to look there for source files. - - case ${srcdir} in - .) - ;; - *) - echo "dir ." > .gdbinit - echo "dir ${srcdir}" >> .gdbinit - echo "source ${srcdir}/.gdbinit" >> .gdbinit - ;; - esac - - # Install a makefile, and make it set VPATH - # if necessary so that the sources are found. - # Also change its value of srcdir. - - # FIXME-someday: This business of always writing to .tem and mv back - # is so that I don't screw things up while developing. Once this - # template is stable, these should be optimized. xoxorich. - - # Define macro CROSS_COMPILE in compilation if this is a cross-compiler. - if [ "${host}" != "${target}" ] ; then - echo "CROSS=-DCROSS_COMPILE" > ${Makefile} - echo "ALL=start.encap" >> ${Makefile} - else - echo "ALL=all.internal" > ${Makefile} - fi - - # set target, host, VPATH - echo "host_alias = ${host_alias}" >> ${Makefile} - echo "host_cpu = ${host_cpu}" >> ${Makefile} - echo "host_vendor = ${host_vendor}" >> ${Makefile} - echo "host_os = ${host_os}" >> ${Makefile} - - echo "target_alias = ${target_alias}" >> ${Makefile} - echo "target_cpu = ${target_cpu}" >> ${Makefile} - echo "target_vendor = ${target_vendor}" >> ${Makefile} - echo "target_os = ${target_os}" >> ${Makefile} - - if [ -n "${subdirs}" ] ; then - echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile} - else - echo "subdir =" >> ${Makefile} - fi - - # echo "workdir = `pwd`" >> ${Makefile} - echo "VPATH = ${srcdir}" >> ${Makefile} - - # add "Makefile.in" (or whatever it's called) - cat ${srcdir}/${Makefile_in} >> ${Makefile} - - # Conditionalize the makefile for this host. - if [ -f ${srcdir}/${host_makefile_frag} ] ; then - (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ; - sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem - mv Makefile.tem ${Makefile} - fi - - # Conditionalize the makefile for this target. - if [ -f ${srcdir}/${target_makefile_frag} ] ; then - (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ; - sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem - mv Makefile.tem ${Makefile} - fi - - # set srcdir - sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem - mv Makefile.tem ${Makefile} - - # set destdir - if [ -n "${destdir}" ] ; then - sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem - mv Makefile.tem ${Makefile} - fi - - # reset SUBDIRS - sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem - mv Makefile.tem ${Makefile} - - # reset NONSUBDIRS - sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem - mv Makefile.tem ${Makefile} - - using= - if [ -f ${srcdir}/${host_makefile_frag} ] ; then - using=" using \"${host_makefile_frag}\"" - fi - - # remove any form feeds. - sed -e "s///" ${Makefile} > Makefile.tem - mv Makefile.tem ${Makefile} - - if [ -f ${srcdir}/${target_makefile_frag} ] ; then - if [ -z "${using}" ] ; then - andusing=" using \"${target_makefile_frag}\"" - else - andusing="${using} and \"${target_makefile_frag}\"" - fi - else - andusing=${using} - fi - - if [ -n "${verbose}" -o -z "${recurring}" ] ; then - echo "Created \"${Makefile}\"" in `pwd`${andusing}. - fi - -#### configure.in post-target parts come in here. - -## end of post-target part. - - # describe the chosen configuration in config.status. - # Make that file a shellscript which will reestablish - # the same configuration. Used in Makefiles to rebuild - # Makefiles. - - echo "#!/bin/sh -# ${srcname} was configured as follows: -${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` > config.status - chmod a+x config.status - - originaldir=`pwd` - cd ${srcdir} - fi - - # If there are subdirectories, then recurse. - if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then - for configdir in ${configdirs} ; do - if [ -n "${verbose}" ] ; then - echo Configuring ${configdir}... - fi - - if [ -d ${configdir} ] ; then - (cd ${configdir} ; - ./configure +recurring ${host_alias} +target=${target_alias} \ - ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \ - | sed 's/^/ /' - else - if [ -n "${verbose}" ] ; then - echo Warning: directory \"${configdir}\" is missing. - fi - fi - done - fi - done # for each target - - # Now build a Makefile for this host. - if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then - cd ${hostsubdir} - cat > GNUmakefile << E!O!F -# Makefile generated by configure for host ${host_alias}. - -ALL := $(shell ls -d Target-*) - -%: - $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true - -all: -E!O!F - cd .. - fi -done # for each host - -exit 0 - -# -# Local Variables: -# fill-column: 131 -# End: -# - -# end of configure diff --git a/gas/configure.was b/gas/configure.was deleted file mode 100755 index 2485927..0000000 --- a/gas/configure.was +++ /dev/null @@ -1,340 +0,0 @@ -#!/bin/sh -# Configuration script for GNU GAS -# Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc. - -#This file is not yet part of GNU GAS. - -#GNU GAS is free software; you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation; either version 1, or (at your option) -#any later version. - -#GNU 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 GNU GAS; see the file COPYING. If not, write to -#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - -# $Id$ - -# -# Shell script to create proper links to machine-dependent files in -# preparation for compiling gas. -# -# Usage: configure [-srcdir=DIR] [-host=HOST] TARGET -# -# If configure succeeds, it leaves its status in config.status. -# If configure fails after disturbing the status quo, -# config.status is removed. -# - -progname=$0 - -remove=rm -hard_link=ln -symbolic_link='ln -s' - -host= -target= - -#for Test -#remove="echo rm" -#hard_link="echo ln" -#symbolic_link="echo ln -s" - -for arg in $*; -do - case $arg in - -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*) - srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'` - ;; - -host=* | +host=* | +hos=* | +ho=* | +h=*) - host=`echo $arg | sed 's/[+-]h[a-z]*=//'` - ;; - *) -# Allow configure HOST TARGET - if [ x$host = x ] - then - host=$target - fi - target=$arg - ;; - esac -done - -# Complain if an arg is missing -if [ x$target = x ] -then - echo "Usage: $progname [+srcdir=DIR] [+host=HOST] TARGET" - echo -n "Where HOST and TARGET are something like " - echo "\`vax', \`sun3', \`encore', etc." - if [ -r config.status ] - then - cat config.status - fi - exit 1 -fi - -# Default other arg -if [ x$host = x ] -then - host=$target -fi - -# Find the source files, if location was not specified. -if [ x$srcdir = x ] -then - srcdirdefaulted=1 - srcdir=. - if [ ! -r as.c ] - then - srcdir=.. - fi -fi - -if [ ! -r ${srcdir}/as.c ] -then - if [ x$srcdirdefaulted = x ] - then - echo "$progname: Can't find assembler sources in \`${srcdir}'." 1>&2 - else - echo "$progname: Can't find assembler sources in \`.' or \`..'." 1>&2 - fi - exit 1 -fi - -# Decode the host machine, then the target machine. -# For the host machine, we save the ho variable as host_ho; -# then we decode the target machine and forget everything else -# that came from the host machine. -for machine in $host $target; do - tc= - obj= - - host_header= - obj_header= - obj_source= - te_header= - tc_header= - tc_source= - - make_var_file= - - case $machine in - generic) - ;; - i860) - tc=i860 - obj=aout - ;; - pmax | dec3100) - ho=pmax - ;; - sun386) - ho=sun386 - ;; - sun4 | sun4-aout | sun-4 | sun4-os4 | sun-4-os4) - ho=sun4 - tc=sparc - obj=aout - ;; - sun4-bout) - tc=sparc - obj=bout - ;; - sun4-bfd-sunos) - tc=sparc - obj=bfd-sunos - ;; - i960 | i960-coff) - tc=i960 - obj=coff - te=ic960 - ;; - i960-bout) - tc=i960 - obj=bout - ;; - i960-aout) - tc=i960 - obj=aout - ;; - sun3 | sun3-aout) - ho=sun3 - tc=m68k - obj=aout - te=sun3 - ;; - a29k | a29k-aout) - tc=a29k - obj=aout - ;; - a29k-coff) - tc=a29k - obj=coff - ;; - i386) - tc=i386 - obj=aout - ;; - ns32k) - tc=ns32k - obj=aout - ;; - vax) - tc=vax - obj=aout - ;; - rs6000) - ;; - esac - if [ x$pass1done = x ] - then - if [ x$ho = x ]; then ho=$host; fi - if [ x$ho_header = x ]; then ho_ho_header=ho-$ho.h - else ho_ho_header=$ho_header - fi - if [ x$make_var_file = x ] - then make_var_file=make-$ho; fi - ho_make_var_file=$make_var_file - pass1done=yes - else - host_make_var_file=$ho_make_var_file - ho_header=$ho_ho_header - fi -done - - -# Default the machine-specific variables that were not explicitly set. -if [ x$te = x ] -then te=generic; fi - -if [ x$te_header = x ] -then te_header=te-$te.h; fi - - -if [ x$tc = x ] -then tc=generic; fi - -if [ x$tc_header = x ] -then tc_header=tc-$tc.h; fi - -if [ x$tc_source = x ] -then tc_source=tc-$tc.c; fi - - -if [ x$obj = x ] -then obj=generic; fi - -if [ x$obj_header = x ] -then obj_header=obj-$obj.h; fi - -if [ x$obj_source = x ] -then obj_source=obj-$obj.c; fi - - -if [ x$atof_source = x ] -then atof_source=atof-ieee.c; fi - -# Set up the list of links to be made. -# $links is the list of link names, and $files is the list of names to link to. -files="$ho_header $te_header $tc_header $tc_source $obj_header $obj_source $atof_source" -links="host.h targ-env.h targ-cpu.h targ-cpu.c obj-format.h obj-format.c atof-targ.c" - -# Make the links. -while [ -n "$files" ] -do - # set file to car of files, files to cdr of files - set $files; file=$1; shift; files=$* - set $links; link=$1; shift; links=$* - - if [ ! -r ${srcdir}/config/$file ] - then - echo "$progname: cannot create a link \`$link'," 1>&2 - echo "since the file \`config/$file' does not exist." 1>&2 - exit 1 - fi - - $remove -f $link - rm -f config.status - # Make a symlink if possible, otherwise try a hard link - $symbolic_link ${srcdir}/config/$file $link 2>/dev/null || $hard_link ${srcdir}/config/$file $link - - if [ ! -r $link ] - then - echo "$progname: unable to link \`$link' to \`${srcdir}/config/$file'." 1>&2 - exit 1 - fi - echo "Linked \`$link' to \`${srcdir}/config/$file'." -done - -# Build a Makefile - -# Install a makefile, and make it set srcdir -# if necessary so that the sources are found. -# Also change its value of srcdir. -# Also create a .gdbinit file which runs the one in srcdir -# and tells GDB to look there for source files. -case $srcdir in -.) - ;; -*) - echo "VPATH = ${srcdir}" > x - cat x ${srcdir}/Makefile.in | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.in - rm x - echo "dir ." > .gdbinit - echo "dir ${srcdir}" >> .gdbinit - echo "source ${srcdir}/.gdbinit" >> .gdbinit - ;; -esac - -# Conditionalize the makefile for this machine. -if [ -f ${srcdir}/config/${host_make_var_file} ] -then - sed -e "/####/ r ${srcdir}/config/${host_make_var_file}" Makefile.in > Makefile.tem -else - cp Makefile.in Makefile.tem -fi - -# Remove all formfeeds, since some Makes get confused by them. -sed "s///" Makefile.tem > Makefile.tem1 - -# Delete the intermediate files -rm Makefile.tem -if [ x$srcdir != x. ] -then - rm Makefile.in -fi - - -# actual Makefile starts here. - -echo "host = $host" > Makefile -echo "target = $target" >> Makefile - -# Define macro CROSS_ASSEMBLE in compilation if this is a cross-assembler. -if [ x$host = x$target ] -then - sed "/^ALL=gas/s//ALL=bootstrap/" < Makefile.tem1 >> Makefile -else - echo "CROSS=-DCROSS_ASSEMBLE" >> Makefile - cat Makefile.tem1 >> Makefile -fi - -rm Makefile.tem1 - -echo "Edited the makefile" - -if [ x$host = x$target ] -then - echo "Links are now set up for use with a $target." \ - | tee config.status -else - echo "Links are now set up for host $host and target $target." \ - | tee config.status -fi - -exit 0 diff --git a/gas/doc/Makefile b/gas/doc/Makefile deleted file mode 100755 index 521f473..0000000 --- a/gas/doc/Makefile +++ /dev/null @@ -1,94 +0,0 @@ -# Makefile for as.texinfo preprocessing and TeXing -# $Id$ -# see pretex.m4 for discussion of preprocessor definitions - -# What version of the manual you want (see *.m4); "all" includes everything -CONFIG=all - -# Sun/Berkeley m4 doesn't have all the things we need; use GNU or sV -M4=gm4 -#M4=/usr/5bin/m4 - -# Directory for gas source -srcdir=.. - -# Where to find texinfo.tex to format docn with TeX -TEXIDIR = $(srcdir)/../texinfo/fsf - -as.info: as-${CONFIG}.texinfo - makeinfo -o as.info as-${CONFIG}.texinfo - -as.dvi: as-${CONFIG}.texinfo - TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex as-${CONFIG}.texinfo - texindex as-${CONFIG}.?? - TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex as-${CONFIG}.texinfo - mv as-${CONFIG}.dvi as.dvi - rm as-${CONFIG}.?? as-${CONFIG}.??? - -# ROFF doc targets as.ms, as.mm, as.me -# (we don't use a variable because we don't trust all makes to handle -# a var in the target name right). -# roff output (-ms) -as.ms: as-${CONFIG}.texinfo - sed -e '/\\input texinfo/d' \ - -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \ - -e 's/{.*,,/{/' \ - as-${CONFIG}.texinfo | \ - texi2roff -ms >as.ms - -# roff output (-mm) -as.mm: as-${CONFIG}.texinfo - sed -e '/\\input texinfo/d' \ - -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \ - -e 's/{.*,,/{/' \ - -e '/@noindent/d' \ - as-${CONFIG}.texinfo | \ - texi2roff -mm | \ - sed -e 's/---/\\(em/g' \ - >as.mm - -# roff output (-me) -as.me: as-${CONFIG}.texinfo - sed -e '/\\input texinfo/d' \ - -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \ - -e 's/{.*,,/{/' \ - as-${CONFIG}.texinfo | \ - texi2roff -me >as.me - - - -as-all.texinfo: as.texinfo pretex.m4 none.m4 all.m4 - ${M4} pretex.m4 none.m4 all.m4 as.texinfo >as-all.texinfo - -as-a29k.texinfo: as.texinfo pretex.m4 none.m4 a29k.m4 - ${M4} pretex.m4 none.m4 a29k.m4 as.texinfo >as-a29k.texinfo - -as-a29k-coff.texinfo: as.texinfo pretex.m4 none.m4 a29k-coff.m4 - ${M4} pretex.m4 none.m4 a29k-coff.m4 as.texinfo >as-a29k-coff.texinfo - -as-gen.texinfo: as.texinfo pretex.m4 none.m4 gen.m4 - ${M4} pretex.m4 none.m4 gen.m4 as.texinfo >as-gen.texinfo - -as-h8.texinfo: as.texinfo pretex.m4 none.m4 h8.m4 - ${M4} pretex.m4 none.m4 h8.m4 as.texinfo >as-h8.texinfo - -as-i80386.texinfo: as.texinfo pretex.m4 none.m4 i80386.m4 - ${M4} pretex.m4 none.m4 i80386.m4 as.texinfo >as-i80386.texinfo - -as-i960.texinfo: as.texinfo pretex.m4 none.m4 i960.m4 - ${M4} pretex.m4 none.m4 i960.m4 as.texinfo >as-i960.texinfo - -as-m680x0.texinfo: as.texinfo pretex.m4 none.m4 m680x0.m4 - ${M4} pretex.m4 none.m4 m680x0.m4 as.texinfo >as-m680x0.texinfo - -as-sparc.texinfo: as.texinfo pretex.m4 none.m4 sparc.m4 - ${M4} pretex.m4 none.m4 sparc.m4 as.texinfo >as-sparc.texinfo - -as-vax.texinfo: as.texinfo pretex.m4 none.m4 vax.m4 - ${M4} pretex.m4 none.m4 vax.m4 as.texinfo >as-vax.texinfo - -as-vintage.texinfo: as.texinfo pretex.m4 none.m4 vintage.m4 - ${M4} pretex.m4 none.m4 vintage.m4 as.texinfo >as-vintage.texinfo - -clean: - rm -f as-${CONFIG}.* as.dvi diff --git a/gas/flonum-const.c b/gas/flonum-const.c deleted file mode 100755 index 6be9fde..0000000 --- a/gas/flonum-const.c +++ /dev/null @@ -1,157 +0,0 @@ -/* flonum_const.c - Useful Flonum constants - 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "flonum.h" -/* JF: I added the last entry to this table, and I'm not - sure if its right or not. Could go either way. I wish - I really understood this stuff. */ - - -const int table_size_of_flonum_powers_of_ten = 11; - -static const LITTLENUM_TYPE zero[] = { 1 }; - -/***********************************************************************\ - * * - * Warning: the low order bits may be WRONG here. * - * I took this from a suspect bc(1) script. * - * "minus_X"[] is supposed to be 10^(2^-X) expressed in base 2^16. * - * The radix point is just AFTER the highest element of the [] * - * * - * Because bc rounds DOWN for printing (I think), the lowest * - * significance littlenums should probably have 1 added to them. * - * * - \***********************************************************************/ - -/* JF: If this equals 6553/(2^16)+39321/(2^32)+... it approaches .1 */ -static const LITTLENUM_TYPE minus_1 [] = { - 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, - 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 6553 }; -static const LITTLENUM_TYPE plus_1 [] = { 10 }; - -/* JF: If this equals 655/(2^16) + 23592/(2^32) + ... it approaches .01 */ -static const LITTLENUM_TYPE minus_2 [] = { - 10485, 36700, 62914, 23592, 49807, 10485, 36700, 62914, 23592, 49807, - 10485, 36700, 62914, 23592, 49807, 10485, 36700, 62914, 23592, 655 }; -static const LITTLENUM_TYPE plus_2 [] = { 100 }; - -/* This approaches .0001 */ -static const LITTLENUM_TYPE minus_3 [] = { - 52533, 20027, 37329, 65116, 64067, 60397, 14784, 18979, 33659, 19503, - 2726, 9542, 629, 2202, 40475, 10590, 4299, 47815, 36280, 6 }; -static const LITTLENUM_TYPE plus_3 [] = { 10000 }; - -/* JF: this approaches 1e-8 */ -static const LITTLENUM_TYPE minus_4 [] = { - 22516, 49501, 54293, 19424, 60699, 6716, 24348, 22618, 23904, 21327, - 3919, 44703, 19149, 28803, 48959, 6259, 50273, 62237, 42 }; -/* This equals 1525 * 2^16 + 57600 */ -static const LITTLENUM_TYPE plus_4 [] = { 57600, 1525 }; - -/* This approaches 1e-16 */ -static const LITTLENUM_TYPE minus_5 [] = { - 22199, 45957, 17005, 26266, 10526, 16260, 55017, 35680, 40443, 19789, - 17356, 30195, 55905, 28426, 63010, 44197, 1844 }; -static const LITTLENUM_TYPE plus_5 [] = { 28609, 34546, 35 }; - -static const LITTLENUM_TYPE minus_6 [] = { - 30926, 26518, 13110, 43018, 54982, 48258, 24658, 15209, 63366, 11929, - 20069, 43857, 60487, 51 }; -static const LITTLENUM_TYPE plus_6 [] = { 61313, 34220, 16731, 11629, 1262 }; - -static const LITTLENUM_TYPE minus_7 [] = { - 29819, 14733, 21490, 40602, 31315, 65186, 2695 }; -static const LITTLENUM_TYPE plus_7 [] = { - 7937, 49002, 60772, 28216, 38893, 55975, 63988, 59711, 20227, 24 }; - -static const LITTLENUM_TYPE minus_8 [] = { - 45849, 19069, 18068, 36324, 37948, 48745, 10873, 64360, 15961, 20566, - 24178, 15922, 59427, 110 }; -static const LITTLENUM_TYPE plus_8 [] = { - 15873, 11925, 39177, 991, 14589, 19735, 25347, 65086, 53853, 938, - 37209, 47086, 33626, 23253, 32586, 42547, 9731, 59679, 590 }; - -static const LITTLENUM_TYPE minus_9 [] = { - 63601, 55221, 43562, 33661, 29067, 28203, 65417, 64352, 22462, 41110, - 12570, 28635, 23199, 50572, 28471, 27074, 46375, 64028, 13106, 63700, - 32698, 17493, 32420, 34382, 22750, 20681, 12300 }; -static const LITTLENUM_TYPE plus_9 [] = { - 63564, 61556, 29377, 54467, 18621, 28141, 36415, 61241, 47119, 30026, - 19740, 46002, 13541, 61413, 30480, 38664, 32205, 50593, 51112, 48904, - 48263, 43814, 286, 30826, 52813, 62575, 61390, 24540, 21495, 5 }; - -static const LITTLENUM_TYPE minus_10 [] = { - 50313, 34681, 1464, 25889, 19575, 41125, 17635, 4598, 49708, 13427, - 17287, 56115, 53783, 38255, 32415, 17778, 31596, 7557, 20951, 18477, - 40353, 1178, 44405, 11837, 11571, 50963, 15649, 11698, 40675, 2308, }; -static const LITTLENUM_TYPE plus_10[] = { - 18520, 53764, 54535, 61910, 61962, 59843, 46270, 58053, 12473, 63785, - 2449, 43230, 50044, 47595, 10403, 35766, 32607, 1124, 24966, 35044, - 25524, 23631, 18826, 14518, 58448, 14562, 49618, 5588, 25396, 28 }; - -static const LITTLENUM_TYPE minus_11 [] = { - 6223, 59909, 62437, 59960, 14652, 45336, 48800, 7647, 51962, 37982, - 60436, 58176, 26767, 8440, 9831, 48556, 20994, 14148, 6757, 17221, - 60624, 46129, 53210, 44085, 54016, 24259, 11232, 21229, 21313, 81, }; -static const LITTLENUM_TYPE plus_11 [] = { - 36159, 2055, 33615, 61362, 23581, 62454, 9748, 15275, 39284, 58636, - 16269, 42793, 47240, 45774, 50861, 48400, 9413, 40281, 4030, 9572, - 7984, 33038, 59522, 19450, 40593, 24486, 54320, 6661, 55766, 805, }; - -/* Shut up complaints about differing pointer types. They only differ - in the const attribute, but there isn't any easy way to do this - */ -#define X (LITTLENUM_TYPE *) - -const FLONUM_TYPE flonum_negative_powers_of_ten [] = { - {X zero, X zero, X zero, 0, '+'}, - {X minus_1, X minus_1 +19, X minus_1 + 19, -20, '+'}, - {X minus_2, X minus_2 +19, X minus_2 + 19, -20, '+'}, - {X minus_3, X minus_3 +19, X minus_3 + 19, -20, '+'}, - {X minus_4, X minus_4 +18, X minus_4 + 18, -20, '+'}, - {X minus_5, X minus_5 +16, X minus_5 + 16, -20, '+'}, - {X minus_6, X minus_6 +13, X minus_6 + 13, -20, '+'}, - {X minus_7, X minus_7 + 6, X minus_7 + 6, -20, '+'}, - {X minus_8, X minus_8 +13, X minus_8 + 13, -40, '+'}, - {X minus_9, X minus_9 +26, X minus_9 + 26, -80, '+'}, - {X minus_10, X minus_10+29, X minus_10 + 29,-136, '+'}, - {X minus_11, X minus_11+29, X minus_11 + 29,-242, '+'}, -}; - -const FLONUM_TYPE flonum_positive_powers_of_ten [] = { - {X zero, X zero, X zero, 0, '+'}, - {X plus_1, X plus_1 + 0, X plus_1 + 0, 0, '+'}, - {X plus_2, X plus_2 + 0, X plus_2 + 0, 0, '+'}, - {X plus_3, X plus_3 + 0, X plus_3 + 0, 0, '+'}, - {X plus_4, X plus_4 + 1, X plus_4 + 1, 0, '+'}, - {X plus_5, X plus_5 + 2, X plus_5 + 2, 1, '+'}, - {X plus_6, X plus_6 + 4, X plus_6 + 4, 2, '+'}, - {X plus_7, X plus_7 + 9, X plus_7 + 9, 4, '+'}, - {X plus_8, X plus_8 + 18, X plus_8 + 18, 8, '+'}, - {X plus_9, X plus_9 + 29, X plus_9 + 29, 24, '+'}, - {X plus_10, X plus_10 + 29, X plus_10 + 29, 77, '+'}, - {X plus_11, X plus_11 + 29, X plus_11 + 29, 183, '+'}, -}; - -#ifdef VMS -dummy1() -{ -} -#endif -/* end of flonum_const.c */ diff --git a/gas/gas-format.el b/gas/gas-format.el deleted file mode 100644 index 32c6426..0000000 --- a/gas/gas-format.el +++ /dev/null @@ -1,79 +0,0 @@ -;; -*- lisp-interaction -*- -;; -*- emacs-lisp -*- -;; -;; -;; originally from... -;; Rich's personal .emacs file. feel free to copy. -;; -;; this file sets emacs up for the type of C source code formatting used within -;; gas. I don't use gnu indent. If you do, and find a setup that approximates -;; these settings, please send it to me. -;; -;; Last Mod Thu Feb 13 00:59:16 PST 1992, by rich@sendai -;; - -;; -;; -;; This section sets constants used by c-mode for formating -;; -;; - - -;; If `c-auto-newline' is non-`nil', newlines are inserted both -;;before and after braces that you insert, and after colons and semicolons. -;;Correct C indentation is done on all the lines that are made this way. - -(setq c-auto-newline nil) - - -;; If `c-tab-always-indent' is non-`nil', the TAB command -;;in C mode does indentation only if point is at the left margin or within -;;the line's indentation. If there is non-whitespace to the left of point, -;;then TAB just inserts a tab character in the buffer. Normally, -;;this variable is `nil', and TAB always reindents the current line. - -(setq c-tab-always-indent nil) - -;; C does not have anything analogous to particular function names for which -;;special forms of indentation are desirable. However, it has a different -;;need for customization facilities: many different styles of C indentation -;;are in common use. -;; -;; There are six variables you can set to control the style that Emacs C -;;mode will use. -;; -;;`c-indent-level' -;; Indentation of C statements within surrounding block. The surrounding -;; block's indentation is the indentation of the line on which the -;; open-brace appears. - -(setq c-indent-level 8) - -;;`c-continued-statement-offset' -;; Extra indentation given to a substatement, such as the then-clause of -;; an if or body of a while. - -(setq c-continued-statement-offset 4) - -;;`c-brace-offset' -;; Extra indentation for line if it starts with an open brace. - -(setq c-brace-offset 0) - -;;`c-brace-imaginary-offset' -;; An open brace following other text is treated as if it were this far -;; to the right of the start of its line. - -(setq c-brace-imaginary-offset 0) - -;;`c-argdecl-indent' -;; Indentation level of declarations of C function arguments. - -(setq c-argdecl-indent 0) - -;;`c-label-offset' -;; Extra indentation for line that is a label, or case or default. - -(setq c-label-offset -8) - -;; end of gas-format.el diff --git a/gas/makefile.dos b/gas/makefile.dos deleted file mode 100755 index c146e19..0000000 --- a/gas/makefile.dos +++ /dev/null @@ -1,593 +0,0 @@ -# Makefile for GNU Assembler -# Copyright (C) 1987, 1988, 1990, 1991 Free Software Foundation, Inc. - -#This file is part of GNU GAS. - -#GNU GAS is free software; you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation; either version 1, or (at your option) -#any later version. - -#GNU 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 GNU GAS; see the file COPYING. If not, write to -#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - -# $Id$ - -# The targets for external use include: -# all, doc, proto, install, uninstall, includes, TAGS, -# clean, cleanconfig, realclean, stage1, stage2, stage3, stage4. - -# Variables that exist for you to override. -# See below for how to change them for certain systems. - -LIBDEPS= -CROSS= -HDEFINES= -CPPFLAGS= - -ALLOCA = -CFLAGS = -g -D__MSDOS__ -D__GO32__ -I../include -INTERNAL_CFLAGS = $(CROSS) -OLDCC = cc -BISON = bison -BISONFLAGS = -v -AR = ar -OLDAR_FLAGS = qc -AR_FLAGS = rc -SHELL = /bin/sh -# on sysV, define this as cp. -INSTALL = install -c -# These permit overriding just for certain files. -INSTALL_PROGRAM = $(INSTALL) -INSTALL_FILE = $(INSTALL) - -# Define this as & to perform parallel make on a Sequent. -# Note that this has some bugs, and it seems currently necessary -# to compile all the gen* files first by hand to avoid erroneous results. -P = - -# How to invoke ranlib. -RANLIB = ranlib -# Test to use to see whether ranlib exists on the system. -RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ] - -# CFLAGS for use with OLDCC, for compiling gnulib. -# NOTE: -O does not work on some Unix systems! -CCLIBFLAGS = -O - -# Version of ar to use when compiling gnulib. -OLDAR = ar - -version=`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion` - -# Directory where sources are, from where we are. -srcdir = . -# Common prefix for installation directories. -# NOTE: This directory must exist when you start installation. -ddestdir = /usr/local -# Directory in which to put the executable for the command `gcc' -bindir = $(ddestdir)/bin -# Directory in which to put the directories used by the compiler. -libdir = $(ddestdir)/lib -# Directory in which the compiler finds executables, libraries, etc. -libsubdir = $(libdir)/gcc/$(target_alias)/$(version) -# Number to put in man-page filename. -manext = 1 -# Directory in which to put man pages. -mandir = $(destdir)/H-independent/man/man$(manext) - -# Additional system libraries to link with. -CLIB= - -# Specify the rule for actually making gnulib. -GNULIB = gnulib.portable - -# Specify the rule for actually making gnulib2. -GNULIB2 = gnulib2.portable - -# List of extra C and assembler files to add to gnulib. -# Assembler files should have names ending in `.asm'. -LIBFUNCS_EXTRA = - -# Program to convert libraries. -LIBCONVERT = - -# Control whether header files are installed. -INSTALL_HEADERS=install-headers - -# Change this to empty to prevent installing limits.h -LIMITS_H = limits.h - -# Directory to link to, when using the target `maketest'. -DIR = ../gcc - -# For better debugging under COFF, define SEPARATE_AUX_OUTPUT in config.h -# and define the following variable as `aux-output2.c' in make-... -AUX_OUTPUT2 = - -# Flags to use when cross-building GCC. -# Prefix to apply to names of object files when using them -# to run on the machine we are compiling on. -HOST_PREFIX= -# Prefix to apply to names of object files when compiling them -# to run on the machine we are compiling on. -# The default for this variable is chosen to keep these rules -# out of the way of the other rules for compiling the same source files. -HOST_PREFIX_1=loser- -HOST_CC=$(CC) -HOST_CFLAGS=$(ALL_CFLAGS) -HOST_LDFLAGS=$(LDFLAGS) -HOST_CPPFLAGS=$(CPPFLAGS) - -# Choose the real default target. -ALL=as.new - -# End of variables for you to override. - -# Lists of files for various purposes. - -REAL_SOURCES = \ - app.c \ - as.c \ - atof-generic.c \ - bignum-copy.c \ - cond.c \ - expr.c \ - fn-const.c \ - fn-copy.c \ - flonum-mult.c \ - frags.c \ - hash.c \ - hex-value.c \ - input-file.c \ - input-scrub.c \ - messages.c \ - output-file.c \ - read.c \ - strstr.c \ - subsegs.c \ - symbols.c \ - version.c \ - write.c \ - xmalloc.c \ - xrealloc.c - -# in an expedient order -LINKED_SOURCES = \ - targ-cpu.c \ - obj-format.c \ - atof-targ.c - -SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES) - -REAL_HEADERS = \ - as.h \ - bignum.h \ - expr.h \ - flonum.h \ - frags.h \ - hash.h \ - input-file.h \ - tc.h \ - obj.h \ - read.h \ - struc-symbol.h \ - subsegs.h \ - symbols.h \ - syscalls.h \ - write.h - -LINKED_HEADERS = \ - a.out.gnu.h \ - a.out.h \ - host.h \ - targ-env.h \ - targ-cpu.h \ - obj-format.h \ - atof-targ.h - -HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS) - -OBJS = \ - targ-cpu.o \ - obj-format.o \ - atof-targ.o \ - app.o \ - as.o \ - atof-generic.o \ - bignum-copy.o \ - cond.o \ - expr.o \ - fn-const.o \ - fn-copy.o \ - flonum-mult.o \ - frags.o \ - hash.o \ - hex-value.o \ - input-file.o \ - input-scrub.o \ - messages.o \ - output-file.o \ - read.o \ - strstr.o \ - subsegs.o \ - symbols.o \ - version.o \ - write.o \ - xmalloc.o \ - xrealloc.o - -#### host, target, and site specific Makefile frags come in here. -TARG_CPU_DEPENDENTS=../include/h8300-opcode.h -LOCAL_LOADLIBES=../bfd/libbfd.a -TDEFINES=-DBFD -DBFD_HEADERS -DMANY_SEGMENTS - - -# Definition of `all' is here so that new rules inserted by sed -# do not specify the default target. -# The real definition is under `all.internal'. - -all: $(ALL) -all-info: -install-info: - -fake-as: force - - rm -f ./as.new - cp /bin/as ./fake-as - -# Now figure out from those variables how to compile and link. - -# This is the variable actually used when we compile. -ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CFLAGS) $(HDEFINES) $(TDEFINES) - -# Even if ALLOCA is set, don't use it if compiling with GCC. -USE_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${ALLOCA}; else true; fi` -USE_HOST_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${HOST_PREFIX}${ALLOCA}; else true; fi` - -# Likewise, for use in the tools that must run on this machine -# even if we are cross-building GCC. -# We don't use USE_ALLOCA because backquote expansion doesn't work in deps. -HOST_LIBDEPS= $(HOST_PREFIX)$(OBSTACK) $(HOST_PREFIX)$(ALLOCA) $(HOST_PREFIX)$(MALLOC) - -# How to link with both our special library facilities -# and the system's installed libraries. - -LIBS = $(LOCAL_LOADLIBES) $(CLIB) $(unsubdir)/../libiberty$(subdir)/libiberty.a - -# Likewise, for use in the tools that must run on this machine -# even if we are cross-building GCC. -HOST_LIBS = $(HOST_PREFIX)$(OBSTACK) $(USE_HOST_ALLOCA) $(HOST_PREFIX)$(MALLOC) $(CLIB) - -# 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) -Iconfig -SUBDIR_INCLUDES = -I.. -I../$(srcdir) -I../config - -# Always use -Iconfig when compiling. -.c.o: - $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $< - -# This tells GNU make version 3 not to export all the variables -# defined in this file into the environment. -.NOEXPORT: - -# Files to be copied away after each stage in building. -STAGE_GCC=gcc -STAGESTUFF = *.o as.new - -# The files that "belong" in CONFIG_H are deliberately omitted -# because having them there would not be useful in actual practice. -# All they would do is cause complete recompilation every time -# one of the machine description files is edited. -# That may or may not be what one wants to do. -# If it is, rm *.o is an easy way to do it. -# CONFIG_H = config.h tm.h -CONFIG_H = - -as.new: $(OBJS) $(LIBDEPS) - -mv -f as.new as.old - >as.rf $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES) - $(CC) @as.rf - -objdump: - -all.internal: native -# This is what is made with the host's compiler if making a cross assembler. -native: config.status as - -config.status: - @echo You must configure gas. Look at the INSTALL file for details. - @false - -compilations: ${OBJS} - -# Compiling object files from source files. - -app.o : app.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -as.o : as.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -atof-generic.o : atof-generic.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -bignum-copy.o : bignum-copy.c as.h host.h \ - targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -cond.o : cond.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - -debug.o : debug.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - subsegs.h -expr.o : expr.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - -fn-const.o : fn-const.c flonum.h bignum.h -fn-copy.o : fn-copy.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -flonum-mult.o : flonum-mult.c flonum.h bignum.h -frags.o : frags.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - subsegs.h -hash.o : hash.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -hex-value.o : hex-value.c -input-file.o : input-file.c as.h host.h \ - targ-env.h obj-format.h targ-cpu.h \ - struc-symbol.h write.h flonum.h bignum.h expr.h \ - frags.h hash.h read.h symbols.h tc.h obj.h input-file.h -input-scrub.o : input-scrub.c \ - as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - input-file.h -messages.o : messages.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -obstack.o : obstack.c -output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - output-file.h -read.o : read.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - -strstr.o : strstr.c -subsegs.o : subsegs.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - subsegs.h -symbols.o : symbols.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - subsegs.h -version.o : version.c -write.o : write.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ - subsegs.h output-file.h -xmalloc.o : xmalloc.c -xrealloc.o : xrealloc.c -atof-targ.o : atof-targ.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h \ - symbols.h tc.h obj.h -obj-format.o : obj-format.c as.h host.h targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h \ - symbols.h tc.h obj.h -targ-cpu.o : targ-cpu.c targ-env.h obj-format.h \ - targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h \ - symbols.h tc.h obj.h $(TARG_CPU_DEPENDENTS) - - -# Compile the libraries to be used by gen*. -# If we are not cross-building, gen* use the same .o's that cc1 will use, -# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict -# with the rules for rtl.o, alloca.o, etc. -$(HOST_PREFIX_1)alloca.o: alloca.c - rm -f $(HOST_PREFIX)alloca.c - cp alloca.c $(HOST_PREFIX)alloca.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c - -$(HOST_PREFIX_1)obstack.o: obstack.c - rm -f $(HOST_PREFIX)obstack.c - cp obstack.c $(HOST_PREFIX)obstack.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c - -$(HOST_PREFIX_1)malloc.o: malloc.c - rm -f $(HOST_PREFIX)malloc.c - cp malloc.c $(HOST_PREFIX)malloc.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c - -# Remake the info files. - -doc: as.info - -as.info: doc/as.texinfo - (cd doc; make as.info; mv as.info $srcdir) - - -# Deletion of files made during compilation. -# There are three levels of this: `clean', `cleanconfig' and `realclean'. -# `clean' deletes what you want to delete ordinarily to save space. -# This is most, but not all, of the files made by compilation. -# `cleanconfig' also deletes everything depending -# on the choice of config files. -# `realclean' also deletes everything that could be regenerated automatically. - -clean: - -rm -f $(STAGESTUFF) -# Delete the temporary source copies for cross compilation. - -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c - -rm -f $(HOST_PREFIX_1)obstack.c -# Delete the stamp files except stamp-gnulib2. - -rm -f core - -# Like clean but also delete the links made to configure gas. -cleanconfig: clean - -rm -f config.status Makefile host.h targ-env.h - -rm -f targ-cpu.h targ-cpu.c - -rm -f obj-format.h obj-format.c - -rm -f atof-targ.c - -# Get rid of every file that's generated from some other file (except INSTALL). -realclean: cleanconfig - -rm -f gas.aux gas.cps gas.fns gas.info gas.kys gas.pgs gas.tps gas.vrs - -rm -f TAGS - -rm -f gas.info* gas.?? gas.??s gas.log gas.toc gas.*aux - -rm -f *.dvi - -# Entry points `install', `includes' and `uninstall'. - -# Copy the files into directories where they will be run. -install: $(ALL) - $(INSTALL_PROGRAM) $(ALL) $(libsubdir)/as -# cp $(ALL) $(bindir)/as.new -# mv -f $(bindir)/as.new $(bindir)/as - -# Create the installation directory. -install-dir: - -mkdir $(libdir) - -mkdir $(libdir)/gcc - -mkdir $(libdir)/gcc/$(target) - -mkdir $(libdir)/gcc/$(target)/$(version) - -# Install the compiler executables built during cross compilation. -install-cross: native install-dir - -if [ -f cc1 ] ; then $(INSTALL_PROGRAM) cc1 $(libsubdir)/cc1; else true; fi - -if [ -f cc1plus ] ; then $(INSTALL_PROGRAM) cc1plus $(libsubdir)/cc1plus; else true; fi - $(INSTALL_PROGRAM) cpp $(libsubdir)/cpp - ./gcc -dumpspecs > $(libsubdir)/specs - $(INSTALL_PROGRAM) gcc $(bindir)/gcc - -# Install the man pages. -install-man: install-dir gcc.1 protoize.1 unprotoize.1 - $(INSTALL_FILE) gcc.1 $(mandir)/gcc.$(manext) - chmod a-x $(mandir)/gcc.$(manext) - $(INSTALL_FILE) protoize.1 $(mandir)/protoize.$(manext) - chmod a-x $(mandir)/protoize.$(manext) - $(INSTALL_FILE) unprotoize.1 $(mandir)/unprotoize.$(manext) - chmod a-x $(mandir)/unprotoize.$(manext) - -# Cancel installation by deleting the installed files. -uninstall: - -rm -rf $(libsubdir) - -rm -rf $(bindir)/as - -rm -rf $(mandir)/gas.$(manext) - - -# These exist for maintenance purposes. - -tags TAGS: force - etags $(REAL_SOURCES) $(REAL_HEADERS) README Makefile config/*.[hc] - -bootstrap: $(ALL) force - $(MAKE) stage1 - $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL) - $(MAKE) stage2 - $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL) - $(MAKE) comparison against=stage2 - -bootstrap2: force - $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL) - $(MAKE) stage2 - $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL) - $(MAKE) comparison against=stage2 - -bootstrap3: force - $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL) - $(MAKE) comparison against=stage2 - -# Copy the object files from a particular stage into a subdirectory. -stage1: force - -mkdir stage1 - -mv $(STAGESTUFF) stage1 - if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi - -stage2: force - -mkdir stage2 - -mv $(STAGESTUFF) stage2 - if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi - -stage3: force - -mkdir stage3 - -mv $(STAGESTUFF) stage3 - if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi - -against=stage2 - -comparison: force - for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done - -de-stage1: force - - (cd stage1 ; rm as ; mv -f * ..) - - rmdir stage1 - -de-stage2: force - - (cd stage2 ; rm as ; mv -f * ..) - - rmdir stage2 - -de-stage3: force - - (cd stage3 ; rm as ; mv -f * ..) - - rmdir stage3 - -# Copy just the executable files from a particular stage into a subdirectory, -# and delete the object files. Use this if you're just verifying a version -# that is pretty sure to work, and you are short of disk space. -risky-stage1: force - -mkdir stage1 - -mv cc1 cpp cccp gcc stage1 - -rm -f stage1/gnulib - -cp gnulib stage1 && $(RANLIB) stage1/gnulib - -make clean - -risky-stage2: force - -mkdir stage2 - -mv cc1 cpp cccp gcc stage2 - -rm -f stage2/gnulib - -cp gnulib stage2 && $(RANLIB) stage2/gnulib - -make clean - -risky-stage3: force - -mkdir stage3 - -mv cc1 cpp cccp gcc stage3 - -rm -f stage3/gnulib - -cp gnulib stage3 && $(RANLIB) stage3/gnulib - -make clean - -risky-stage4: force - -mkdir stage4 - -mv cc1 cpp cccp gcc stage4 - -rm -f stage4/gnulib - -cp gnulib stage4 && $(RANLIB) stage4/gnulib - -make clean - -#In GNU Make, ignore whether `stage*' exists. -.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap -.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4 - -force: - -Makefile: Makefile.in $(host_makefile_frag) $(target_makefile_frag) - $(SHELL) ./config.status - diff --git a/gas/objdump.c b/gas/objdump.c deleted file mode 100755 index 20ad39e..0000000 --- a/gas/objdump.c +++ /dev/null @@ -1,2232 +0,0 @@ -/* objdump -- dump information about an object file. - Copyright (C) 1988, 1991 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 1, 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. */ - -/* $Id$ */ - -/* - * objdump - * - * dump information about an object file. Until there is other documentation, - * refer to the manual page dump(1) in the system 5 program's reference manual - */ -#include <stdio.h> -#include <assert.h> - -#include "getopt.h" - -#include "as.h" - -/* #define COFF_ENCAPSULATE 1 */ - -typedef FILHDR fileheader; -typedef struct exec fileheader; - -#ifdef __STDC__ -static char *sym_pname(SYMENT *s); -static char *xmalloc(unsigned size); -static char *xrealloc(char *p, unsigned size); -static void doit(char *filename); -static void dump_data(fileheader *execp, FILE *f){}; -static void dump_header(fileheader *execp, FILE *f); -static void dump_lnno(fileheader *execp, FILE *f); -static void dump_nstuff(fileheader *execp){}; -static void dump_reloc(fileheader *execp, FILE *f); -static void dump_section_contents(fileheader *execp, FILE *f); -static void dump_section_headers(fileheader *execp, FILE *f); -static void dump_sym(fileheader *execp, FILE *f); -static void dump_text(fileheader *execp, FILE *f){}; -static void hex_dump(void *buffer, int size); -#endif /* __STDC__ */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -static void read_symbols (execp, f) -#else -read_symbols (execp, f) -#endif /* OBJ_BOUT */ -struct exec *execp; -#else -static void read_section_headers(execp, f) -fileheader *execp; -#endif /* OBJ_COFF */ -FILE *f; -{ -#ifndef OBJ_COFF - int i; - struct nlist *sp; - if (symtbl) - return; - nsyms = execp->a_syms / sizeof (struct nlist); - if (nsyms == 0) -#else - if (section_headers || execp->f_nscns == 0) { -#endif /* OBJ_COFF */ - return; -#ifdef OBJ_COFF - } /* already read them, or don't need to */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF - symtbl = (struct nlist *)xmalloc (nsyms * sizeof (struct nlist)); -#else - fseek(f, sizeof(*execp) + execp->f_opthdr, 0); - section_headers = (struct scnhdr *) xmalloc(execp->f_nscns * sizeof(*section_headers)); -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT - fseek(f, N_STROFF(*execp), 0); - if (fread((char *)&strsize, sizeof strsize, 1, f) != 1) { - fprintf(stderr, "%s: can not read string table size\n", -#else - fseek (f, N_STROFF(*execp), 0); - if (fread ((char *)&strsize, sizeof strsize, 1, f) != 1) { - fprintf (stderr, "%s: can not read string table size\n", -#endif /* OBJ_BOUT */ - program_name); - exit (1); - } - strtbl = xmalloc (strsize); -#ifndef OBJ_BOUT - fseek(f, N_STROFF (*execp), 0); - if (fread(strtbl, 1, strsize, f) != strsize) { - fprintf(stderr, "%s: error reading string table\n", -#else - fseek (f, N_STROFF (*execp), 0); - if (fread (strtbl, 1, strsize, f) != strsize) { - fprintf (stderr, "%s: error reading string table\n", -#endif /* OBJ_BOUT */ - program_name); - exit (1); - } -#else - if (fread(section_headers, execp->f_nscns * sizeof(*section_headers), 1, f) != 1) { - perror("error reading section headers"); - abort(); - } /* on error */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT - fseek(f, N_SYMOFF (*execp), 0); - if (fread((char *)symtbl, sizeof (struct nlist), nsyms, f) != nsyms) { - fprintf(stderr, "%s: error reading symbol table\n", -#else - fseek (f, N_SYMOFF (*execp), 0); - if (fread ((char *)symtbl, sizeof (struct nlist), nsyms, f) != nsyms) { - fprintf (stderr, "%s: error reading symbol table\n", -#endif /* OBJ_BOUT */ - program_name); - exit (1); - } -#else - return; -} /* read_section_headers() */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF - for (i = 0, sp = symtbl; i < nsyms; i++, sp++) { - if (sp->n_un.n_strx == 0) - sp->n_un.n_name = ""; - else if (sp->n_un.n_strx < 0 || sp->n_un.n_strx > strsize) - sp->n_un.n_name = "<bad string table index>"; - else - sp->n_un.n_name = strtbl + sp->n_un.n_strx; - } -#ifndef OBJ_BOUT -} /* read_symbols() */ -#else -} -#endif /* OBJ_BOUT */ -#else -static SYMENT *symbols = NULL; -static int longest_symbol_name = SYMNMLEN; -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -static void free_symbols () -#else -free_symbols () -#endif /* OBJ_BOUT */ -#else -static void read_symbols(execp, f) -fileheader *execp; -FILE *f; -#endif /* OBJ_COFF */ -{ -#ifdef OBJ_COFF - long here; - int bufsiz = execp->f_nsyms * sizeof(struct syment); - SYMENT *s; - - if (symbols || bufsiz == 0) { - return; - } /* already read, or don't need to */ - - symbols = (SYMENT *) xmalloc(bufsiz); - - /* read symbols */ - fseek(f, execp->f_symptr, 0); - if (fread(symbols, bufsiz, 1, f) != 1) { - fprintf(stderr, "error reading symbol table.\n"); - abort(); - } /* on error */ - - here = ftell(f); - fseek(f, 0, 2); /* find end of file */ - - if (here != ftell(f)) { - /* find string table size */ - fseek(f, here, 0); - if (fread(&strsize, sizeof(strsize), 1, f) != 1) { - perror("error reading string table size"); - abort(); - } /* on error */ - - /* read string table if there is one */ - if (strsize > 0) { - strtbl = xmalloc(strsize); - fseek(f, -sizeof(strsize), 1); /* backup over size count */ - - if (fread(strtbl, strsize, 1, f) != 1) { - perror("error reading string table"); - abort(); - } /* on error */ - - /* then connect the dots. */ - for (s = symbols; s < symbols + execp->f_nsyms; ++s) { - if (!s->n_zeroes) { - int l; - - s->n_offset = (long) strtbl + s->n_offset; - l = strlen((char *) s->n_offset); - if (l > longest_symbol_name) { - longest_symbol_name = l; - } /* keep max */ - } /* "long" name */ - - s += s->n_numaux; /* skip aux entries */ - } /* walk the symbol table */ - } else { - fprintf(stderr, "Well, now that's weird. I have a string table whose size is zero?\n"); - } /* if there is a string table */ - } /* if there is a string table */ - return; -} /* read_symbols() */ - -#ifdef comment -static void free_symbols() { -#endif /* OBJ_COFF */ - if (symtbl) - free (symtbl); - symtbl = NULL; - if (strtbl) - free (strtbl); - strtbl = NULL; -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ -} /* free_symbols() */ -#ifndef OBJ_COFF -#else -} -#endif /* OBJ_BOUT */ -#else -#endif /* comment */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF - -#ifndef OBJ_BOUT -static void usage () -#else -usage () -#endif /* OBJ_BOUT */ -{ -#ifndef OBJ_BOUT -#else -static void usage() { -#endif /* OBJ_COFF */ - (void) fprintf(stderr, "Usage: %s\n", program_name); - (void) fprintf(stderr, "\t[-ahnrt] [+all] [+header] [+nstuff]\n"); - (void) fprintf(stderr, "\t[+reloc] [+symbols] [+text] [+data]\n"); - (void) fprintf(stderr, "\t[+omit-symbol-numbers] [+omit-reloc-numbers]\n"); - (void) fprintf(stderr, "\tfile...\n"); -#ifndef OBJ_COFF -#else - fprintf (stderr, "\ -Usage: %s [-hnrt] [+header] [+nstuff] [+reloc] [+symbols] file...\n", - program_name); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - exit (1); -#ifndef OBJ_COFF -} -#else -} /* usage() */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ -static int aflag = 0; -static int hflag = 0; -#ifdef OBJ_COFF -static int lflag = 0; -#endif /* OBJ_COFF */ -static int nflag = 0; -static int rflag = 0; -#ifdef OBJ_COFF -static int sflag = 0; -#endif /* OBJ_COFF */ -static int tflag = 0; -static int Dflag = 0; -static int Tflag = 0; -static int omit_reloc_numbers_flag = 0; -static int omit_sym_numbers_flag = 0; -#ifndef OBJ_COFF -#else -int hflag; -int nflag; -int rflag; -int tflag; -#endif /* OBJ_BOUT */ -#else -static int section_headers_flag = 0; -static int section_contents_flag = 0; -#endif /* OBJ_COFF */ - -/* Size of a page. Required by N_DATADDR in a.out.gnu.h [VAX]. */ -int page_size; - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -int main (argc, argv) -#else -int main(argc, argv) -#endif /* OBJ_COFF */ -int argc; -#ifndef OBJ_COFF -#else -main (argc, argv) -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ -char **argv; -{ - int c; -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ -/* extern char *optarg; */ -#ifndef OBJ_COFF -#else - extern char *optarg; -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - extern int optind; - int seenflag = 0; - int ind = 0; -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - static struct option long_options[] = { -#ifdef OBJ_COFF - {"line-numbers", 0, &lflag, 1}, - {"section-contents", 0, §ion_contents_flag, 1}, - {"section-headers", 0, §ion_headers_flag, 1}, -#endif /* OBJ_COFF */ - {"symbols", 0, &tflag, 1}, - {"reloc", 0, &rflag, 1}, - {"nstuff", 0, &nflag, 1}, - {"header", 0, &hflag, 1}, - {"data", 0, &Dflag, 1}, - {"text", 0, &Tflag, 1}, - {"omit-relocation-numbers", 0, &omit_reloc_numbers_flag, 1}, - {"omit-symbol-numbers", 0, &omit_sym_numbers_flag, 1}, - {"all", 0, &aflag, 1}, - {NULL, 0, NULL, 0}, - }; -#ifndef OBJ_COFF -#else - static struct option long_options[] = - { - {"symbols", 0, &tflag, 1}, - {"reloc", 0, &rflag, 1}, - {"nstuff", 0, &nflag, 1}, - {"header", 0, &hflag, 1}, - {NULL, 0, NULL, 0} - }; -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF - page_size = getpagesize (); - -#endif /* OBJ_COFF */ - program_name = argv[0]; - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT - while ((c = getopt_long (argc, argv, "ahnrt", long_options, &ind)) != EOF) { -#else - while ((c = getopt_long (argc, argv, "hnrt", long_options, &ind)) - != EOF) { -#endif /* OBJ_BOUT */ -#else - while ((c = getopt_long (argc, argv, "ahlonrt", long_options, &ind)) != EOF) { -#endif /* OBJ_COFF */ - seenflag = 1; -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - switch (c) { - case 0 : break; /* we've been given a long option */ -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - case 'a': aflag = 1; break; - case 'h': hflag = 1; break; -#ifdef OBJ_COFF - case 'o': hflag = 1; break; - case 'l': lflag = 1; break; -#endif /* OBJ_COFF */ - case 'n': nflag = 1; break; - case 'r': rflag = 1; break; -#ifndef OBJ_COFF -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - case 't': tflag = 1; break; -#ifndef OBJ_COFF -#ifdef OBJ_BOUT - case 'r': rflag = 1; break; - case 'n': nflag = 1; break; - case 'h': hflag = 1; break; -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - default: - usage (); -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - } /* switch on option */ - } /* while there are options */ -#ifndef OBJ_COFF -#else - } - } -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - - if (seenflag == 0 || optind == argc) - usage (); - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - if (aflag) { - hflag = 1; -#ifdef OBJ_COFF - lflag = 1; -#endif /* OBJ_COFF */ - nflag = 1; - rflag = 1; - tflag = 1; - Dflag = 1; - Tflag = 1; -#ifdef OBJ_COFF - section_headers_flag = 1; - section_contents_flag = 1; -#endif /* OBJ_COFF */ - } /* if all */ - -#ifndef OBJ_COFF -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - while (optind < argc) -#ifndef OBJ_COFF - doit (argv[optind++]); -#ifndef OBJ_BOUT -#else - doit(argv[optind++]); -#endif /* OBJ_COFF */ - - return(0); -} /* main() */ -#ifndef OBJ_COFF -#else -} -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -static void doit (name) -#else -doit (name) -#endif /* OBJ_BOUT */ -#else -static void doit(name) -#endif /* OBJ_COFF */ -char *name; -{ - FILE *f; -#ifndef OBJ_COFF - struct exec exec; -#ifndef OBJ_BOUT -#else - fileheader exec; - - if (section_headers) { - free(section_headers); - section_headers = NULL; - } /* free section headers */ - - if (symbols) { - free(symbols); - symbols = NULL; - } /* free symbols */ - -#endif /* OBJ_COFF */ - printf("%s:\n", name); -#ifndef OBJ_COFF -#else - printf ("%s:\n", name); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - f = fopen (name, "r"); - if (f == NULL) { -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - fprintf(stderr, "%s: can not open ", program_name); -#ifndef OBJ_COFF -#else - fprintf (stderr, "%s: can not open ", program_name); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - perror (name); - return; - } -#ifdef HEADER_SEEK - HEADER_SEEK (f); -#endif -#ifndef OBJ_COFF -#ifndef OBJ_BOUT - if (fread((char *)&exec, sizeof exec, 1, f) != 1) { -#else - if (fread((char *)&exec, sizeof(exec), 1, f) != 1) { -#endif /* OBJ_COFF */ - fprintf(stderr, "%s: can not read header for %s\n", -#ifndef OBJ_COFF -#else - if (fread ((char *)&exec, sizeof exec, 1, f) != 1) { - fprintf (stderr, "%s: can not read header for %s\n", -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - program_name, name); - return; - } - -#ifdef OBJ_COFF -#ifdef I960ROMAGIC -#define N_BADMAG I960BADMAG -#endif /* I960ROMAGIC */ - -#endif /* OBJ_COFF */ - if (N_BADMAG (exec)) { -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - fprintf(stderr, "%s: %s is not a%s object file\n", - program_name, name, -#ifdef B_OUT - " b.out" -#else - "n a.out" -#endif /* B_OUT */ - ); -#ifndef OBJ_COFF -#else - fprintf (stderr, "%s: %s is not an object file\n", - program_name, name); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - return; - } - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - if (hflag) dump_header(&exec, f); -#ifdef OBJ_COFF - if (lflag) dump_lnno(&exec, f); -#endif /* OBJ_COFF */ - if (nflag) dump_nstuff(&exec); -#ifdef OBJ_COFF - if (section_headers_flag) dump_section_headers(&exec, f); - if (section_contents_flag) dump_section_contents(&exec, f); - if (sflag) dump_section_contents(&exec, f); -#endif /* OBJ_COFF */ - if (Tflag) dump_text(&exec, f); - if (Dflag) dump_data(&exec, f); - if (tflag) dump_sym(&exec, f); - if (rflag) dump_reloc(&exec, f); -#ifndef OBJ_COFF -#else - if (hflag) - dump_header (&exec); -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF - if (nflag) - dump_nstuff (&exec); -#endif /* OBJ_BOUT */ -#else - printf("\n"); - fclose(f); - return; -} /* doit() */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT - free_symbols(); -#else - if (tflag) - dump_sym (&exec, f); -#endif /* OBJ_BOUT */ -#else -static void dump_lnno(execp, f) -fileheader *execp; -FILE *f; -{ - int i = execp->f_nscns; - struct scnhdr *section; - char *buffer; - int bufsiz = 0; - - if (i) { - printf("Line numbers:\n"); - read_section_headers(execp, f); - read_symbols(execp, f); - - for (section = section_headers; i; ++section, --i) { - int size = section->s_nlnno * LINESZ; - LINENO *r; - - if (size > bufsiz) { - if (bufsiz) { - buffer = xrealloc(buffer, bufsiz = size); - } else { - buffer = xmalloc(bufsiz = size); - } /* if we had allocated anything before */ - } /* if bigger than our old buffer */ - - printf("%8.8s:", section->s_name); - fseek(f, section->s_lnnoptr, 0); - - if (size) { - int j; - - if (fread(buffer, size, 1, f) != 1) { - printf(" (error reading lnno)\n"); - continue; - } /* on read error */ - - printf("\n"); - - for (r = (LINENO *) buffer, j = 0; j < section->s_nlnno; ++j, ++r) { - printf("lnno = %d,", r->l_lnno); - - if (r->l_lnno) { - printf(" paddr = 0x%lx", (unsigned long) r->l_addr.l_paddr); - } else { - printf(" symndx = %ld, \"%s\"", - r->l_addr.l_symndx, - sym_pname(symbols + r->l_addr.l_symndx)); - } /* if not symbol'd */ - - if (r->padding[0] || r->padding[1]) { - printf(" (padding = %2x %2x)", - (unsigned) r->padding[0], - (unsigned) r->padding[1]); - } /* if padding not zero'd */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#else - printf("\n"); - } /* for each lnno record */ - } else { - printf(" (section has no line numbers.)\n"); - } /* if there really is something in the section */ - } /* for each section */ - } else { - printf("No Sections.\n"); - } /* if there are sections */ - - free(buffer); - printf("\n"); -#endif /* OBJ_COFF */ - return; -#ifndef OBJ_COFF -} /* doit() */ -#else - if (rflag) - dump_reloc (&exec, f); -#endif /* OBJ_BOUT */ -#else -} /* dump_lnno() */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -static void dump_header(execp, f) -#else - free_symbols (); -#else -static void dump_reloc(execp, f) -fileheader *execp; -FILE *f; -{ - int i = execp->f_nscns; - struct scnhdr *section; - char *buffer; - int bufsiz = 0; - - if (i) { - read_section_headers(execp, f); - - printf("Relocations:\n"); - for (section = section_headers; i; ++section, --i) { - int size = section->s_nreloc * RELSZ; - RELOC *r; - - if (size > bufsiz) { - if (bufsiz) { - buffer = xrealloc(buffer, bufsiz = size); - } else { - buffer = xmalloc(bufsiz = size); - } /* if we had allocated anything before */ - } /* if bigger than our old buffer */ - - printf("%8.8s:", section->s_name); - fseek(f, section->s_relptr, 0); - - if (size) { - int j; - - if (fread(buffer, size, 1, f) != 1) { - printf(" (error reading reloc)\n"); - continue; - } /* on read error */ - - printf("\n"); - - for (r = (RELOC *) buffer, j = 0; j < section->s_nreloc; ++j, ++r) { - printf("vaddr = 0x%lx, symndx = %ld, r_type = ", - (unsigned long) r->r_vaddr, - r->r_symndx); - - switch (r->r_type) { - case R_RELLONG: printf(" RELLONG"); break; - case R_IPRSHORT: printf("IPRSHORT"); break; - case R_IPRMED: printf(" IPRMED"); break; - case R_IPRLONG: printf(" IPRLONG"); break; - case R_OPTCALL: printf(" OPTCALL"); break; - case R_OPTCALLX: printf("OPTCALLX"); break; - case R_GETSEG: printf(" GETSEG"); break; - case R_GETPA: printf(" GETPA"); break; - case R_TAGWORD: printf(" TAGWORD"); break; - default: printf("unrecognized"); break; - } /* switch on reloc type */ - - printf("."); - - if (r->pad[0] || r->pad[1]) { - printf(" (padding = %2x %2x)", - (unsigned) r->pad[0], - (unsigned) r->pad[1]); - } /* if padding isn't zero */ - - printf("\n"); - } /* for each reloc record */ - } else { - printf(" (section has no relocations.)\n"); - } /* if there really is something in the section */ - } /* for each section */ - } else { - printf("No Sections.\n"); - } /* if there are sections */ - - /* free(buffer); */ - printf("\n"); - return; -} /* dump_reloc() */ - -static void dump_section_contents(execp, f) -fileheader *execp; -FILE *f; -{ - int i = execp->f_nscns; - struct scnhdr *section; - char *buffer; - int bufsiz = 0; - - if (i) { - read_section_headers(execp, f); - printf("Section Contents:\n"); - - for (section = section_headers; i; ++section, --i) { - if (section->s_size > bufsiz) { - if (bufsiz) { - buffer = xrealloc(buffer, bufsiz = section->s_size); - } else { - buffer = xmalloc(bufsiz = section->s_size); - } /* if we had allocated anything before */ - } /* if bigger than our old buffer */ - - printf("%8.8s:", section->s_name); - - if (section->s_flags & STYP_BSS) { - printf(" bss sections have no contents.\n"); - } else { - fseek(f, section->s_scnptr, 0); - - if (section->s_size) { - if (fread(buffer, section->s_size, 1, f) != 1) { - printf(" (error reading section contents)\n"); - } /* on read error */ - - printf("\n"); - hex_dump(buffer, section->s_size); - printf("\n"); - } else { - printf(" (section has a size of zero.)\n"); - } /* if there really is a section */ - } /* if bss else dump */ - } /* for each section */ - } else { - printf("No Sections.\n"); - } /* if there are sections */ - - free(buffer); - printf("\n"); - return; -} /* dump_section_contents() */ - -static void dump_section_headers(execp, f) -fileheader *execp; -FILE *f; -{ - int i = execp->f_nscns; - struct scnhdr *section; - - if (i > 0) { - read_section_headers(execp, f); - printf("Section Headers:\n"); - - for (section = section_headers; i; ++section, --i) { - long flags = section->s_flags; - - printf("\"%8.8s\"", section->s_name); - - printf(" physical address: 0x%x vma: 0x%x size: 0x%x (%ld)", - (unsigned) section->s_paddr, - (unsigned) section->s_vaddr, - (unsigned) section->s_size, - section->s_size); - - printf(" relocs: %d linenos: %d alignment: 0x%lx (%ld)", - section->s_nreloc, - section->s_nlnno, - section->s_align, - (long) section->s_align); - - printf(" flags: 0x%x = ", (unsigned) section->s_flags); - - if (flags & STYP_REG) { - printf(" REG"); - flags &= ~STYP_REG; - } /* STYP_REG */ - - if (flags & STYP_DSECT) { - printf(" DSECT"); - flags &= ~STYP_DSECT; - } /* STYP_DSECT */ - - if (flags & STYP_NOLOAD) { - printf(" NOLOAD"); - flags &= ~STYP_NOLOAD; - } /* STYP_NOLOAD */ - - if (flags & STYP_GROUP) { - printf(" GROUP"); - flags &= ~STYP_GROUP; - } /* STYP_GROUP */ - - if (flags & STYP_PAD) { - printf(" PAD"); - flags &= ~STYP_PAD; - } /* STYP_PAD */ - - if (flags & STYP_COPY) { - printf(" COPY"); - flags &= ~STYP_COPY; - } /* STYP_COPY */ - - if (flags & STYP_TEXT) { - printf(" TEXT"); - flags &= ~STYP_TEXT; - } /* STYP_TEXT */ - - if (flags & S_SHRSEG) { - printf(" SHRSEG"); - flags &= ~S_SHRSEG; - } /* S_SHRSEG */ - - if (flags & STYP_DATA) { - printf(" DATA"); - flags &= ~STYP_DATA; - } /* STYP_DATA */ - - if (flags & STYP_BSS) { - printf(" BSS"); - flags &= ~STYP_BSS; - } /* STYP_BSS */ - - if (flags & S_NEWFCN) { - printf(" NEWFCN"); - flags &= ~S_NEWFCN; - } /* S_NEWFCN */ - - if (flags & STYP_INFO) { - printf(" INFO"); - flags &= ~STYP_INFO; - } /* STYP_INFO */ - - if (flags & STYP_OVER) { - printf(" OVER"); - flags &= ~STYP_OVER; - } /* STYP_OVER */ - - if (flags & STYP_LIB) { - printf(" LIB"); - flags &= ~STYP_LIB; - } /* STYP_LIB */ - - if (flags & STYP_MERGE) { - printf(" MERGE"); - flags &= ~STYP_MERGE; - } /* STYP_MERGE */ - - if (flags & STYP_REVERSE_PAD) { - printf(" REVERSE_PAD"); - flags &= ~STYP_REVERSE_PAD; - } /* STYP_REVERSE_PAD */ - - if (flags) { - printf(" +unknown"); - } /* foo */ - - printf("\n"); - } /* for each section header */ - } else { - printf("No section headers.\n"); - } /* if there are any sections */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -} -#else - printf("\n"); - return; -} /* dump_section_headers() */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -dump_header (execp) -#endif /* OBJ_BOUT */ -struct exec *execp; -#ifndef OBJ_BOUT -#else -static void dump_header(execp, f) -fileheader *execp; -#endif /* OBJ_COFF */ -FILE *f; -#ifndef OBJ_COFF -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ -{ -#ifdef OBJ_COFF -#ifdef COFF - printf("magic: 0x%x (%o) ", (unsigned) execp->f_magic, (unsigned) execp->f_magic); - printf("number of sections: %d number of syms: %ld ", execp->f_nscns, execp->f_nsyms); - printf("time stamp: %s", ctime(&(execp->f_timdat))); - printf("flags:"); - - if (execp->f_flags & F_RELFLG) { - printf(" RELFLG"); - } /* relflg */ - - if (execp->f_flags & F_EXEC) { - printf(" EXEC"); - } /* exec */ - - if (execp->f_flags & F_LNNO) { - printf(" LNNO"); - } /* lnno */ - - if (execp->f_flags & F_LSYMS) { - printf(" LSYMS"); - } /* lsyms */ - - if (execp->f_flags & F_AR32WR) { - printf(" AR32WR"); - } /* ar32wr */ - - assert(F_I960KB == F_I960SB); - assert(F_I960KA == F_I960SA); - - switch (execp->f_flags & F_I960TYPE) { - case F_I960CORE: printf(" I960CORE"); break; - case F_I960KB: printf(" I960KB (== I960SB)"); break; - case F_I960MC: printf(" I960MC"); break; - case F_I960XA: printf(" I960XA"); break; - case F_I960CA: printf(" I960CA"); break; - case F_I960KA: printf(" I960KA (== I960SA)"); break; - default: printf(" I960Unknown"); break; - } /* switch on i960 type */ - - if (execp->f_flags & ~(F_RELFLG | F_EXEC | F_LNNO | F_LSYMS | F_AR32WR | F_I960TYPE)) { - printf(" +unrecognized"); - } /* unrecognized */ - - printf("\n\n"); - - if (execp->f_opthdr) { - if (execp->f_opthdr == sizeof(AOUTHDR)) { - AOUTHDR hdr; - - fseek(f, sizeof(*execp), 0); - if (fread(&hdr, sizeof(AOUTHDR), 1, f) == 1) { - printf("aouthdr:\n"); - printf("magic: 0x%x (%o)", (unsigned) hdr.magic, (unsigned) hdr.magic); - printf(" vstamp: 0x%ld\n", (long) hdr.vstamp); - - printf("sizes: text 0x%lx (%ld), data 0x%lx (%ld), bss 0x%lx (%ld)\n", - hdr.tsize, - (long) hdr.tsize, - hdr.dsize, - (long) hdr.dsize, - hdr.bsize, - (long) hdr.bsize); - - printf("entry point: 0x%lx, starts: text 0x%lx (%ld), data 0x%lx (%ld)\n", - hdr.entry, - hdr.text_start, - (long) hdr.text_start, - hdr.data_start, - (long) hdr.data_start); - - printf("tag entries: %ld\n", - (long) hdr.tagentries); - } else { - fprintf(stderr, "%s: error reading optional header", program_name); - perror(NULL); - } /* on error */ - - } else { - printf("opthder != sizeof aouthdr?"); - } /* size mismatch */ - - } else { - printf("No optional header."); - } /* print optional header */ - - -#else /* COFF */ -#endif /* OBJ_COFF */ - int x; - -#if defined (__GNU_EXEC_MACROS__) && !defined (__STRUCT_EXEC_OVERRIDE__) -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - printf("magic: 0x%x (%o)", N_MAGIC(*execp), N_MAGIC(*execp)); - printf("machine type: %d", N_MACHTYPE(*execp)); - printf("flags: 0x%x", N_FLAGS(*execp)); -#ifndef OBJ_COFF -#else - printf ("magic: 0x%x (%o)", N_MAGIC(*execp), N_MAGIC(*execp)); - printf ("machine type: %d", N_MACHTYPE(*execp)); - printf ("flags: 0x%x", N_FLAGS(*execp)); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ -#else /* non-gnu struct exec. */ -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - printf("magic: 0x%x (%o) ", (unsigned) execp->a_magic, (unsigned) execp->a_magic); -#ifndef OBJ_COFF -#else - printf ("magic: 0x%x (%o) ", execp->a_magic, execp->a_magic); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ -#endif /* non-gnu struct exec. */ -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - printf("text 0x%x ", (unsigned) execp->a_text); - printf("data 0x%x ", (unsigned) execp->a_data); - printf("bss 0x%x\n", (unsigned) execp->a_bss); - printf("nsyms %ld", (long) (execp->a_syms / sizeof(struct nlist))); - x = execp->a_syms % sizeof(struct nlist); -#ifndef OBJ_COFF -#else - printf ("text 0x%x ", execp->a_text); - printf ("data 0x%x ", execp->a_data); - printf ("bss 0x%x\n", execp->a_bss); - printf ("nsyms %d", execp->a_syms / sizeof (struct nlist)); - x = execp->a_syms % sizeof (struct nlist); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - if (x) -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - printf(" (+ %d bytes)", x); - printf(" entry 0x%lx ", execp->a_entry); - -#ifdef B_OUT - printf(" talign 0x%x", (unsigned) execp->a_talign); - printf(" dalign 0x%x", (unsigned) execp->a_dalign); - printf(" balign 0x%x", (unsigned) execp->a_balign); - printf(" unused 0x%x", (unsigned) execp->unused); -#endif /* B_OUT */ - - printf(" trsize 0x%lx", execp->a_trsize); - printf(" drsize 0x%lx", execp->a_drsize); - - if (N_TXTOFF(*execp) != 0 && N_TXTOFF(*execp) != sizeof(*execp)) { - char *buffer; - char *i; - int size = N_TXTOFF(*execp) - sizeof(*execp); - - buffer = xmalloc(size); - - fseek(f, sizeof(*execp), 0); - if (fread(buffer, size, 1, f) != 1) { - fprintf(stderr, "%s: error reading between header and text", program_name); - perror(NULL); - } /* on error */ - - for (i = buffer; i < (buffer + size); ++i) { - if (*i != '\0') { - printf(" (garbage follows header)"); - break; - } /* non null */ - } /* walk the buffer looking for garbage */ - } /* check for garbage following header */ -#ifdef OBJ_COFF -#endif /* COFF */ -#endif /* OBJ_COFF */ - - printf("\n"); - return; -} /* dump_header() */ - -#ifdef OBJ_COFF -#ifdef comment -#endif /* OBJ_COFF */ -static void dump_nstuff(execp) -#ifndef OBJ_COFF -struct exec *execp; -#else -fileheader *execp; -#endif /* OBJ_COFF */ -{ - printf("N_BADMAG %d\n", N_BADMAG(*execp)); - printf("N_TXTOFF 0x%x\n", N_TXTOFF(*execp)); - printf("N_SYMOFF 0x%lx\n", N_SYMOFF(*execp)); - printf("N_STROFF 0x%lx\n", N_STROFF(*execp)); - printf("N_TXTADDR 0x%x\n", (unsigned) N_TXTADDR(*execp)); - printf("N_DATADDR 0x%lx\n", N_DATADDR(*execp)); - - return; -} /* dump_nstuff() */ -#ifndef OBJ_COFF -#else - printf (" (+ %d bytes)", x); - printf (" entry 0x%x ", execp->a_entry); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ -static void dump_text(execp, f) -#ifndef OBJ_COFF -struct exec *execp; -#else -fileheader *execp; -#endif /* OBJ_COFF */ -FILE *f; -{ - void *buffer; - - if (execp->a_text) { - buffer = xmalloc(execp->a_text); - fseek(f, N_TXTOFF(*execp), 0); - - if (fread(buffer, execp->a_text, 1, f) != 1) { - fprintf(stderr, "%s: error reading text section.\n", program_name); - return; - } /* on error */ -#ifndef OBJ_COFF -#else - printf (" talign 0x%x ", execp->a_talign); - printf (" dalign 0x%x ", execp->a_dalign); - printf (" balign 0x%x ", execp->a_balign); - printf (" unused 0x%x ", execp->unused); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - hex_dump(buffer, execp->a_text); - free(buffer); - } else { - printf("No text section.\n"); - } /* if there is text */ - - return; -} /* dump_text() */ -#ifndef OBJ_COFF -#else - printf ("trsize 0x%x ", execp->a_trsize); - printf ("drsize 0x%x\n", execp->a_drsize); -} -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ -static void dump_data(execp, f) -#ifndef OBJ_COFF -#else -dump_nstuff (execp) -#endif /* OBJ_BOUT */ -struct exec *execp; -#ifndef OBJ_BOUT -#else -fileheader *execp; -#endif /* OBJ_COFF */ -FILE *f; -{ - void *buffer; - - if (execp->a_data) { - buffer = xmalloc(execp->a_data); - fseek(f, N_TXTOFF(*execp), 0); - - if (fread(buffer, execp->a_data, 1, f) != 1) { - fprintf(stderr, "%s: error reading data section.\n", program_name); - return; - } /* on error */ - - hex_dump(buffer, execp->a_data); - free(buffer); - } else { - printf("No data section.\n"); - } /* if there is data */ - - return; -} /* dump_data() */ -#ifdef OBJ_COFF -#endif /* comment */ -#endif /* OBJ_COFF */ - -static void hex_dump(buffer, size) -void *buffer; -int size; -#ifndef OBJ_COFF -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ -{ -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - FILE *f; - -#ifndef OBJ_COFF - if ((f = popen("od -x +0x0", "w")) != NULL) { -#else - fflush(stdout); - - if ((f = popen("hexl", "w")) != NULL) { -#endif /* OBJ_COFF */ - if (fwrite(buffer, size, 1, f) != 1) { - (void) fprintf(stderr, "%s: error writing to od(1) pipe:", program_name); - perror(NULL); - } /* on error */ - } else { - (void) fprintf(stderr, "%s: error opening pipe to od(1):", program_name); - perror(NULL); - } /* on successful popen */ - - (void) pclose(f); -#ifdef OBJ_COFF - fflush(stdout); -#endif /* OBJ_COFF */ - return; -} /* hex_dump() */ -#ifndef OBJ_COFF -#else - printf ("N_BADMAG %d\n", N_BADMAG (*execp)); - printf ("N_TXTOFF 0x%x\n", N_TXTOFF (*execp)); - printf ("N_SYMOFF 0x%x\n", N_SYMOFF (*execp)); - printf ("N_STROFF 0x%x\n", N_STROFF (*execp)); - printf ("N_TXTADDR 0x%x\n", N_TXTADDR (*execp)); - printf ("N_DATADDR 0x%x\n", N_DATADDR (*execp)); -} -#endif /* OBJ_BOUT */ -#else - -char *sym_class_pname(class) -char class; -{ - switch (class) { - case C_EFCN: return("EFCN"); - case C_NULL: return("NULL"); - case C_AUTO: return("AUTO"); - case C_EXT: return("EXT"); - case C_STAT: return("STAT"); - case C_REG: return("REG"); - case C_EXTDEF: return("EXTDEF"); - case C_LABEL: return("LABEL"); - case C_ULABEL: return("ULABEL"); - case C_MOS: return("MOS"); - case C_ARG: return("ARG"); - case C_STRTAG: return("STRTAG"); - case C_MOU: return("MOU"); - case C_UNTAG: return("UNTAG"); - case C_TPDEF: return("TPDEF"); - case C_USTATIC: return("USTATIC"); - case C_ENTAG: return("ENTAG"); - case C_MOE: return("MOE"); - case C_REGPARM: return("REGPARM"); - case C_FIELD: return("FIELD"); - case C_BLOCK: return("BLOCK"); - case C_FCN: return("FCN"); - case C_EOS: return("EOS"); - case C_FILE: return("FILE"); - case C_LINE: return("LINE"); - case C_ALIAS: return("ALIAS"); - case C_HIDDEN: return("HIDDEN"); - - case C_SCALL: return("SCALL"); - case C_LEAFEXT: return("LEAFEXT"); - case C_OPTVAR: return("OPTVAR"); - case C_DEFINE: return("DEFINE"); - case C_PRAGMA: return("PRAGMA"); - case C_SEGMENT: return("SEGMENT"); - case C_LEAFSTAT:return("LEAFSTAT"); - case C_AUTOARG: return("AUTOARG"); - - default: return("(???)"); - } /* switch on class */ -} /* sym_class_pname() */ - -char *sym_type_pname(type) -unsigned long type; -{ - switch (type) { - case T_NULL: return("NULL"); - case T_VOID: return("VOID"); - case T_CHAR: return("CHAR"); - case T_SHORT: return("SHORT"); - case T_INT: return("INT"); - case T_LONG: return("LONG"); - case T_FLOAT: return("FLOAT"); - case T_DOUBLE: return("DOUBLE"); - case T_STRUCT: return("STRUCT"); - case T_UNION: return("UNION"); - case T_ENUM: return("ENUM"); - case T_MOE: return("MOE"); - case T_UCHAR: return("UCHAR"); - case T_USHORT: return("USHORT"); - case T_UINT: return("UINT"); - case T_ULONG: return("ULONG"); - case T_LNGDBL: return("LNGDBL"); - - default: return("(???)"); - } /* switch on type */ -} /* sym_type_pname() */ - -char *sym_section_pname(scnum, execp) -short scnum; -fileheader *execp; -{ - switch (scnum) { - case N_UNDEF: return("UNDEF"); - case N_ABS: return("ABS"); - case N_DEBUG: return("DEBUG"); - case N_TV: return("NTV"); - case P_TV: return("PTV"); - - default: - assert(0 <= (scnum-1)); - assert((scnum-1) < execp->f_nscns); - return(section_headers[scnum-1].s_name); - } /* switch on scnum */ -} /* sym_section_pname() */ - -static char *sym_pname(s) -SYMENT *s; -{ - static char buffer[SYMNMLEN + 1]; - if (s->n_zeroes) { - bzero(buffer, SYMNMLEN + 1); - bcopy(s->n_name, buffer, SYMNMLEN); - return(buffer); - } else { - return((char *) s->n_offset); - } /* if "short" name */ -} /* sym_pname() */ - -/* - * Notes: .file must be first, .text, .data, .bss must be last. - */ - -static void dump_aux_fcn(aux) -AUXENT *aux; -{ - /* function symbol */ - printf(" tagndx %ld,", aux->x_sym.x_tagndx); - printf(" size %ld,", aux->x_sym.x_misc.x_fsize); - printf(" lnnoptr 0x%lx,", (unsigned long) aux->x_sym.x_fcnary.x_fcn.x_lnnoptr); - printf(" endndx %ld", aux->x_sym.x_fcnary.x_fcn.x_endndx); - printf(" tvndx 0x%x,", (unsigned) aux->x_sym.x_tvndx); - return; -} /* dump_aux_fcn() */ - -static void dump_aux_tagmember(aux) -AUXENT *aux; -{ - printf(" tagndx %ld,", aux->x_sym.x_tagndx); - printf(" size %d,", aux->x_sym.x_misc.x_lnsz.x_size); - return; -} /* dump_aux_tagmember() */ - -static void dump_aux_array(aux) -AUXENT *aux; -{ - int i; -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#else - printf(" size %d, ", aux->x_sym.x_misc.x_lnsz.x_size); - - for (i = 0; i < 4; ++i) { - printf("[%d]", aux->x_sym.x_fcnary.x_ary.x_dimen[i]); - } /* four dimensions */ - - return; -} /* dump_aux_array() */ - -#endif /* OBJ_COFF */ -static void dump_sym(execp, f) -#ifndef OBJ_COFF -#else -dump_sym (execp, f) -#endif /* OBJ_BOUT */ -struct exec *execp; -#else -fileheader *execp; -#endif /* OBJ_COFF */ -FILE *f; -{ - int i; -#ifndef OBJ_COFF - struct nlist *sp; -#else - SYMENT *sp; -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT - read_symbols(execp, f); -#else - read_symbols (execp, f); -#endif /* OBJ_BOUT */ - if (nsyms == 0) { -#ifndef OBJ_BOUT -#else - read_section_headers(execp, f); - - if (execp->f_nsyms == 0) { -#endif /* OBJ_COFF */ - printf("no symbols\n"); -#ifndef OBJ_COFF -#else - printf ("no symbols\n"); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - return; -#ifndef OBJ_COFF - } -#else - } /* if there are any */ - - read_symbols(execp, f); - printf("Symbols:\n"); -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - if (!omit_sym_numbers_flag) { -#ifndef OBJ_COFF - printf("%3s: ", "#"); -#else - printf("%3s:", "#"); -#endif /* OBJ_COFF */ - } /* printing symbol numbers */ - -#ifndef OBJ_COFF - printf("%4s %5s %4s %8s\n", - "type", "other", "desc", "val"); -#else - printf(" %*.*s %8.8s %3.3s %8.8s %7.7s %3.3s %s\n", - SYMNMLEN, SYMNMLEN, "name", - "value", "num", "sec-name", "class", "aux", "type"); -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#else - printf ("%3s: %4s %5s %4s %8s\n", - "#", "type", "other", "desc", "val"); -#endif /* OBJ_BOUT */ - for (i = 0, sp = symtbl; i < nsyms; i++, sp++) { -#ifndef OBJ_BOUT -#else - for (i = 0, sp = symbols; sp < symbols + execp->f_nsyms; ++sp, ++i) { -#endif /* OBJ_COFF */ - if (!omit_sym_numbers_flag) { -#ifndef OBJ_COFF - printf("%3d: ", i); -#else - printf("%3d:", i); -#endif /* OBJ_COFF */ - } /* printing symbol numbers */ - -#ifndef OBJ_COFF - printf("%4x %5x %4x %8lx %s", - (unsigned) (sp->n_type & 0xff), - (unsigned) (sp->n_other & 0xff), - (unsigned) (sp->n_desc & 0xffff), -#else - printf ("%3d: %4x %5x %4x %8x %s", - i, - sp->n_type & 0xff, - sp->n_other & 0xff, - sp->n_desc & 0xffff, -#endif /* OBJ_BOUT */ - sp->n_value, - sp->n_un.n_name); -#ifndef OBJ_BOUT -#else - printf(" %*.*s", SYMNMLEN, SYMNMLEN, (sp->n_zeroes) ? sp->n_name : ""); -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#else - -#endif /* OBJ_BOUT */ - if (sp->n_type & N_EXT) printf(" N_EXT"); - if (sp->n_type & N_STAB) printf(" N_STAB"); -#ifndef OBJ_BOUT -#else - printf(" %8lx", (unsigned long) sp->n_value); - printf(" %3d", sp->n_scnum); - printf(" %8.8s", sym_section_pname(sp->n_scnum, execp)); - printf(" %7.7s", sym_class_pname(sp->n_sclass)); - printf(" %1d", sp->n_numaux); -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#else - -#endif /* OBJ_BOUT */ - if ((sp->n_type & N_TYPE) == N_UNDF) { - printf(" N_UNDF"); - } else { - if (sp->n_type & N_ABS) printf(" N_ABS"); - if (sp->n_type & N_TEXT) printf(" N_TEXT"); - if (sp->n_type & N_DATA) printf(" N_DATA"); - if (sp->n_type & N_BSS) printf(" N_BSS"); - if (sp->n_type & N_FN) printf(" N_FN"); - } /* if not undefined */ -#ifndef OBJ_BOUT -#else - printf(" %s", sym_type_pname(BTYPE(sp->n_type))); -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifdef B_OUT -#else - -#endif /* OBJ_BOUT */ - if (sp->n_other) { - printf(" ["); -#ifndef OBJ_BOUT -#else - /* derived type */ - printf("%s", (ISPTR(sp->n_type) - ? "(PTR)" - : (ISFCN(sp->n_type) - ? "(FCN)" - : (ISARY(sp->n_type) - ? "(ARY)" - : "")))); - - if (sp->n_type & ~(N_BTMASK | N_TMASK)) { - printf("+"); - } /* if type isn't all */ - - if (!sp->n_zeroes) { - printf(" \"%s\"", sym_pname(sp)); - } /* if "long" name */ - - /* FIXME do something with the flags field */ -#ifdef comment - if (sp->pad1[0] != 0 || sp->pad1[1] != 0) { - printf(" (pad1 %2.2x%2.2x)", (unsigned) sp->pad1[0], (unsigned) sp->pad1[1]); - } /* if padding not zeroed */ -#endif /* comment */ - - if (sp->pad2[0] != 0 || sp->pad2[1] != 0) { - printf(" (pad2 %2.2x%2.2x)", (unsigned) sp->pad2[0], (unsigned) sp->pad2[1]); - } /* if padding not zeroed */ - -#define DTYPE(x) (((x) & N_TMASK) >> N_BTSHFT) - - if (sp->n_numaux > 0) { - int auxcountshouldbe = 1; - AUXENT *aux = (AUXENT *) (sp + 1); - AUXENT *aux2 = (AUXENT *) (sp + 2); -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#else -#else - switch (sp->n_sclass) { - - case C_FILE: /* file symbol */ - printf(" filename \"%s\"", aux->x_file.x_fname); - break; - - case C_UNTAG: - case C_ENTAG: - case C_STRTAG: { - if (DTYPE(sp->n_type) == DT_NON - && (BTYPE(sp->n_type) == T_NULL - || BTYPE(sp->n_type) == T_STRUCT - || BTYPE(sp->n_type) == T_UNION - || BTYPE(sp->n_type) == T_ENUM)) { - printf(" size %d,", aux->x_sym.x_misc.x_lnsz.x_size); - printf(" endndx %ld", aux->x_sym.x_fcnary.x_fcn.x_endndx); - } else { - printf(" (don't know why this tag has an auxent)"); - abort(); - } /* if I understand */ - - break; - } /* tags */ - - case C_EOS: { - if (BTYPE(sp->n_type) == DT_NON && BTYPE(sp->n_type) == T_NULL) { - printf(" tagndx %ld,", aux->x_sym.x_tagndx); - printf(" size %d,", aux->x_sym.x_misc.x_lnsz.x_size); - } else { - printf(" (don't know why this eos has an auxent)"); - abort(); - } /* if I understand */ - break; - } /* eos */ - - case C_FCN: - case C_BLOCK: { - if (BTYPE(sp->n_type) == DT_NON && BTYPE(sp->n_type) == T_NULL) { - if (!strcmp(sp->n_name, ".bb") || !strcmp(sp->n_name, ".bf")) { - printf(" lnno %d", aux->x_sym.x_misc.x_lnsz.x_lnno); - printf(" endndx %ld", aux->x_sym.x_fcnary.x_fcn.x_endndx); - break; - - } else if (!strcmp(sp->n_name, ".eb") || !strcmp(sp->n_name, ".ef")) { - printf(" lnno %d", aux->x_sym.x_misc.x_lnsz.x_lnno); - break; - - } /* beginning or ending */ - } /* if I understand */ - - printf(" (don't know why this fcn or block has an auxent)"); - abort(); - break; - } /* begin/end blocks */ - - case C_LEAFEXT: - case C_LEAFSTAT: - case C_SCALL: - case C_EXT: { - assert(BTYPE(sp->n_type) != T_MOE); - - if (ISFCN(sp->n_type) - || BTYPE(sp->n_type) == T_NULL) { - dump_aux_fcn(aux); - - if (sp->n_sclass == C_SCALL) { - printf(" stindx %ld", aux2->x_sc.x_stindx); - auxcountshouldbe = 2; - } else if (sp->n_sclass == C_LEAFEXT - || sp->n_sclass == C_LEAFSTAT) { - printf(" balentry 0x%lx", aux2->x_bal.x_balntry); - auxcountshouldbe = 2; - } /* special functions */ - } else if (ISARY(sp->n_type)) { - dump_aux_array(aux); - } else if (BTYPE(sp->n_type) == T_STRUCT) { - printf(" tagndx %ld,", aux->x_sym.x_tagndx); - printf(" size %d,", aux->x_sym.x_misc.x_lnsz.x_size); - } else { - assert(0); - } /* on type */ - - break; - } /* function */ - - case C_STAT: { - switch (DTYPE(sp->n_type)) { - case DT_NON: - switch (BTYPE(sp->n_type)) { - case T_NULL: /* section symbol */ - printf(" length 0x%lx, relocs %d, lnnos %d", - (unsigned long) aux->x_scn.x_scnlen, - aux->x_scn.x_nreloc, - aux->x_scn.x_nlinno); - break; - case T_STRUCT: - case T_UNION: - case T_ENUM: - dump_aux_tagmember(aux); - break; - default: - printf(" (confused)."); - abort(); - } /* switch on btype */ - break; - - case DT_FCN: /* function */ - if (BTYPE(sp->n_type) == T_MOE) { - printf(" (confused)."); - abort(); - } else { - dump_aux_fcn(aux); - } /* if I understand */ - break; - - case DT_ARY: - assert(BTYPE(sp->n_type) != T_MOE); - dump_aux_array(aux); - /* intentional fall through */ - case DT_PTR: - assert(BTYPE(sp->n_type) == T_STRUCT - || BTYPE(sp->n_type) == T_UNION - || BTYPE(sp->n_type) == T_ENUM); - dump_aux_tagmember(aux); - break; - - default: - printf(" (confused.)"); - abort(); - } /* switch on derived type */ - - break; - } /* STAT */ - - case C_AUTO: - case C_MOS: - case C_MOU: - case C_TPDEF: - if (DTYPE(sp->n_type) == DT_ARY) { - assert(BTYPE(sp->n_type) != T_MOE); - dump_aux_array(aux); - } else { - dump_aux_tagmember(aux); - } /* if an array */ - break; -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#endif /* OBJ_BOUT */ - if (sp->n_other == N_CALLNAME) { - printf(" N_CALLNAME"); - } else if (sp->n_other == N_BALNAME) { - printf(" N_BALNAME"); - } else if (1 <= sp->n_other && sp->n_other <= 32) { - printf(" \"trap\""); - } else { - printf(" !!!invalid \"other\" field"); - } /* what is it */ -#ifndef OBJ_BOUT -#else - case C_FIELD: - printf(" tagndx %ld,", aux->x_sym.x_tagndx); - printf(" size %d,", aux->x_sym.x_misc.x_lnsz.x_size); - break; - - default: - printf(" (don't know why this symbol has aux entries.)"); - abort(); - break; - } /* switch on class */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#else - -#endif /* OBJ_BOUT */ - printf(" ]"); - } /* is defined */ -#ifndef OBJ_BOUT -#endif /* B_OUT */ -#else - if (sp->n_numaux != auxcountshouldbe) { - printf(" (expecting %d auxents here)", auxcountshouldbe); - abort(); - } /* on miscount */ - } /* do aux entries */ - - i += sp->n_numaux; - sp += sp->n_numaux; -#endif /* OBJ_COFF */ - - printf("\n"); - } /* for each symbol */ -#ifndef OBJ_COFF -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#else - printf("\n"); -#endif /* OBJ_COFF */ - return; -} /* dump_sym() */ -#ifndef OBJ_COFF -#else - printf("\n"); - } -} -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#else -#ifdef comment -#endif /* OBJ_COFF */ -static void dump_reloc (execp, f) -#ifndef OBJ_COFF -#else -dump_reloc (execp, f) -#endif /* OBJ_BOUT */ -struct exec *execp; -#else -fileheader *execp; -#endif /* OBJ_COFF */ -FILE *f; -{ -#ifndef OBJ_COFF - read_symbols (execp, f); -#else - read_symbols(execp, f); -#endif /* OBJ_COFF */ - if (execp->a_trsize) { -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - printf("text reloc\n"); -#ifndef OBJ_COFF -#else - printf ("text reloc\n"); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - dump_reloc1 (execp, f, N_TRELOFF (*execp), execp->a_trsize); - } - if (execp->a_drsize) { -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - printf("data reloc\n"); -#ifndef OBJ_COFF -#else - printf ("data reloc\n"); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - dump_reloc1 (execp, f, N_DRELOFF (*execp), execp->a_drsize); - } -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - - return; -} /* dump_reloc() */ -#ifndef OBJ_COFF -#else -} -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ -static void dump_reloc1 (execp, f, off, size) -#ifndef OBJ_COFF -#else -dump_reloc1 (execp, f, off, size) -#endif /* OBJ_BOUT */ -struct exec *execp; -#else -fileheader *execp; -#endif /* OBJ_COFF */ -FILE *f; -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ -int off; -int size; -#ifndef OBJ_COFF -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ -{ - int nreloc; - struct relocation_info reloc; - int i; - - nreloc = size / sizeof (struct relocation_info); - -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - if (!omit_reloc_numbers_flag) { - printf("%3s: ", "#"); - } /* if printing numbers */ - -#ifndef sparc - printf("%3s ", "len"); -#endif /* sparc */ - - printf("%8s %4s\n", "adr", "sym"); - - - fseek(f, off, 0); -#ifndef OBJ_COFF -#else - printf ("%3s: %3s %8s %4s\n", "#", "len", "adr", "sym"); - fseek (f, off, 0); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - for (i = 0; i < nreloc; i++) { -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - if (fread((char *)&reloc, sizeof reloc, 1, f) != 1) { - fprintf(stderr, "%s: error reading reloc\n", -#ifndef OBJ_COFF -#else - if (fread ((char *)&reloc, sizeof reloc, 1, f) != 1) { - fprintf (stderr, "%s: error reading reloc\n", -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - program_name); - return; - } -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - - if (!omit_reloc_numbers_flag) { - printf("%3d: ", i); - } /* if printing numbers */ - -#ifndef sparc - printf("%3d ", 1 << reloc.r_length); -#endif /* sparc */ - - printf("%8lx ", (long unsigned) reloc.r_address); - -#ifndef B_OUT -#ifndef OBJ_COFF -#else - printf ("%3d: %3d %8x ", i, 1 << reloc.r_length, - reloc.r_address); - -#ifdef NOT -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - if (reloc.r_extern) { -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - if (!omit_sym_numbers_flag) { - (void) printf("%4d ", reloc.r_symbolnum); - } else { - (void) printf(" "); - } /* if printing sym numbers */ - -#ifndef OBJ_COFF -#else - printf ("%4d ", reloc.r_symbolnum); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - if (reloc.r_symbolnum < nsyms) -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - printf("%s ", symtbl[reloc.r_symbolnum].n_un.n_name); -#ifndef OBJ_COFF -#else - printf ("%s ", - symtbl[reloc.r_symbolnum].n_un.n_name); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - } else { -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - printf(" "); -#ifndef OBJ_COFF -#else - printf (" "); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - switch (reloc.r_symbolnum & ~N_EXT) { -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - case N_TEXT: printf(".text "); break; - case N_DATA: printf(".data "); break; - case N_BSS: printf(".bss "); break; - case N_ABS: printf(".abs "); break; - default: printf("base %x ", (unsigned) reloc.r_symbolnum); break; -#ifndef OBJ_COFF -#else - case N_TEXT: printf (".text "); break; - case N_DATA: printf (".data "); break; - case N_BSS: printf (".bss "); break; - case N_ABS: printf (".abs "); break; - default: printf ("base %x ", reloc.r_symbolnum); break; -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ - } - } -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ -#endif /* not B_OUT */ - -#ifdef SPARC - if (reloc.r_addend) printf("+0x%x ", (unsigned) reloc.r_addend); - - switch (reloc.r_type) { - case RELOC_8: printf("R8 "); break; - case RELOC_16: printf("R16 "); break; - case RELOC_32: printf("R32 "); break; - case RELOC_DISP8: printf("DISP8 "); break; - case RELOC_DISP16: printf("DISP16 "); break; - case RELOC_DISP32: printf("DISP32 "); break; - case RELOC_WDISP30: printf("WDISP30 "); break; - case RELOC_WDISP22: printf("WDISP22 "); break; - case RELOC_HI22: printf("HI22 "); break; - case RELOC_22: printf("R22 "); break; - case RELOC_13: printf("R13 "); break; - case RELOC_LO10: printf("LO10 "); break; - case RELOC_SFA_BASE: printf("SFA_BASE "); break; - case RELOC_SFA_OFF13: printf("SFA_OFF13 "); break; - case RELOC_BASE10: printf("BASE10 "); break; - case RELOC_BASE13: printf("BASE13 "); break; - case RELOC_BASE22: printf("BASE22 "); break; - case RELOC_PC10: printf("PC10 "); break; - case RELOC_PC22: printf("PC22 "); break; - case RELOC_JMP_TBL: printf("JMP_TBL "); break; - case RELOC_SEGOFF16: printf("SEGOFF16 "); break; - case RELOC_GLOB_DAT: printf("GLOB_DAT "); break; - case RELOC_JMP_SLOT: printf("JMP_SLOT "); break; - case RELOC_RELATIVE: printf("RELATIVE "); break; - } /* switch on reloc type */ -#else /* SPARC */ - if (reloc.r_pcrel) printf("PCREL "); -#endif /* SPARC */ - -#ifdef B_OUT - if (reloc.r_bsr) printf("BSR "); - if (reloc.r_disp) printf("DISP "); - if (reloc.r_callj) printf("CALLJ "); - if (reloc.nuthin) printf("NUTHIN "); -#endif /* B_OUT */ - -#ifdef SPARC - { - struct reloc_info_sparc spare; - - bzero(&spare, sizeof(spare)); - - reloc.r_address = 0; - reloc.r_index = 0; - reloc.r_extern = 0; - reloc.r_type = 0; - reloc.r_addend = 0; - - if (bcmp(&reloc, &spare, sizeof(spare))) { - printf("(garbage in spare bits) "); - } /* if garbage in spare bits */ - } /* sparc */ -#endif /* SPARC */ - -#ifndef OBJ_COFF -#else -#endif /* NOT */ - if (reloc.r_pcrel) printf ("PCREL "); - if (reloc.r_bsr) printf ("BSR "); - if (reloc.r_disp) printf ("DISP "); - if (reloc.r_callj) printf ("CALLJ "); - if (reloc.nuthin) printf ("NUTHIN "); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ -#if 0 -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - if (reloc.r_pad) printf("PAD %x ", reloc.r_pad); -#ifndef OBJ_COFF -#else - if (reloc.r_pad) printf ("PAD %x ", reloc.r_pad); -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ -#endif -#ifndef OBJ_COFF -#ifndef OBJ_BOUT -#endif /* OBJ_COFF */ - printf("\n"); - } /* for each reloc record */ - - return; -} /* dump_reloc1() */ -#ifndef OBJ_COFF -#else - printf ("\n"); - } -} -#endif /* OBJ_BOUT */ -#else -#endif /* comment */ -#endif /* OBJ_COFF */ - -/* Allocate `n' bytes of memory dynamically, with error checking. */ - -#ifndef OBJ_COFF -char * -xmalloc (n) - unsigned n; -{ - char *p; - - p = malloc (n); - if (p == 0) - { -#ifndef OBJ_BOUT - fprintf(stderr, "%s: virtual memory exhausted\n", program_name); -#else - fprintf (stderr, "%s: virtual memory exhausted\n", program_name); -#endif /* OBJ_BOUT */ - exit (1); - } -#ifndef OBJ_BOUT - bzero(p, n); -#endif /* OBJ_BOUT */ - return p; -#ifndef OBJ_BOUT -#else -static char *xmalloc (n) -unsigned n; -{ - char *p; - - p = malloc (n); - if (p == NULL) - { - fprintf(stderr, "%s: virtual memory exhausted\n", program_name); - exit (1); - } - bzero(p, n); - return p; -#endif /* OBJ_COFF */ -} /* xmalloc() */ - -#ifdef OBJ_COFF -static char *xrealloc(p, size) -char *p; -unsigned size; -{ - p = realloc(p, size); - - if (p == NULL) { - fprintf(stderr, "%s: virtual memory exhausted\n", program_name); - exit (1); - } /* on malloc failure */ - - bzero(p, size); - return(p); -} /* xrealloc() */ - -#endif /* OBJ_COFF */ -/* - * Local Variables: - * comment-column: 0 - * fill-column: 131 - * End: - */ - -/* end of objdump.c */ -#ifndef OBJ_COFF -#else -} -#endif /* OBJ_BOUT */ -#endif /* OBJ_COFF */ diff --git a/gas/obstack.c b/gas/obstack.c deleted file mode 100644 index 9837b1e..0000000 --- a/gas/obstack.c +++ /dev/null @@ -1,380 +0,0 @@ -/* obstack.c - subroutines used implicitly by object stack macros - Copyright (C) 1988 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "obstack.h" - -#ifdef __STDC__ -#define POINTER void * -#else -#define POINTER char * -#endif - -/* Determine default alignment. */ -struct fooalign - { - char x; - double d; - }; - -#define DEFAULT_ALIGNMENT ((char *)&((struct fooalign *) 0)->d - (char *)0) -/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. - But in fact it might be less smart and round addresses to as much as - DEFAULT_ROUNDING. So we prepare for it to do that. */ -union fooround - { - long x; - double d; - }; - -#define DEFAULT_ROUNDING (sizeof (union fooround)) - -/* When we copy a long block of data, this is the unit to do it with. - On some machines, copying successive ints does not work; - in such a case, redefine COPYING_UNIT to `long' (if that works) - or `char' as a last resort. */ -#ifndef COPYING_UNIT -#define COPYING_UNIT int -#endif - -/* The non-GNU-C macros copy the obstack into this global variable - to avoid multiple evaluation. */ - -struct obstack *_obstack; - -/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). - Objects start on multiples of ALIGNMENT (0 means use default). - CHUNKFUN is the function to use to allocate chunks, - and FREEFUN the function to free them. */ - -void -_obstack_begin (h, size, alignment, chunkfun, freefun) - struct obstack *h; - int size; - int alignment; -POINTER (*chunkfun) (); - void (*freefun) (); -{ - register struct _obstack_chunk *chunk; /* points to new chunk */ - - if (alignment == 0) - alignment = DEFAULT_ALIGNMENT; - if (size == 0) - /* Default size is what GNU malloc can fit in a 4096-byte block. */ - { - /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. - Use the values for range checking, because if range checking is off, - the extra bytes won't be missed terribly, but if range checking is on - and we used a larger request, a whole extra 4096 bytes would be - allocated. - - These number are irrelevant to the new GNU malloc. I suspect it is - less sensitive to the size of the request. */ - int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) - + 4 + DEFAULT_ROUNDING - 1) - & ~(DEFAULT_ROUNDING - 1)); - size = 4096 - extra; - } - - h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun; - h->freefun = freefun; - h->chunk_size = size; - h->alignment_mask = alignment - 1; - - chunk = h->chunk = (*h->chunkfun) (h->chunk_size); - h->next_free = h->object_base = chunk->contents; - h->chunk_limit = chunk->limit - = (char *) chunk + h->chunk_size; - chunk->prev = 0; - /* The initial chunk now contains no empty object. */ - h->maybe_empty_object = 0; -} - -/* Allocate a new current chunk for the obstack *H - on the assumption that LENGTH bytes need to be added - to the current object, or a new object of length LENGTH allocated. - Copies any partial object from the end of the old chunk - to the beginning of the new one. */ - -void -_obstack_newchunk (h, length) - struct obstack *h; - int length; -{ - register struct _obstack_chunk *old_chunk = h->chunk; - register struct _obstack_chunk *new_chunk; - register long new_size; - register int obj_size = h->next_free - h->object_base; - register int i; - int already; - - /* Compute size for new chunk. */ - new_size = (obj_size + length) + (obj_size >> 3) + 100; - if (new_size < h->chunk_size) - new_size = h->chunk_size; - - /* Allocate and initialize the new chunk. */ - new_chunk = h->chunk = (*h->chunkfun) (new_size); - new_chunk->prev = old_chunk; - new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; - - /* Move the existing object to the new chunk. - Word at a time is fast and is safe if the object - is sufficiently aligned. */ - if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) - { - for (i = obj_size / sizeof (COPYING_UNIT) - 1; - i >= 0; i--) - ((COPYING_UNIT *) new_chunk->contents)[i] - = ((COPYING_UNIT *) h->object_base)[i]; - /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT, - but that can cross a page boundary on a machine - which does not do strict alignment for COPYING_UNITS. */ - already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); - } - else - already = 0; - /* Copy remaining bytes one by one. */ - for (i = already; i < obj_size; i++) - new_chunk->contents[i] = h->object_base[i]; - - /* If the object just copied was the only data in OLD_CHUNK, - free that chunk and remove it from the chain. - But not if that chunk might contain an empty object. */ - if (h->object_base == old_chunk->contents && !h->maybe_empty_object) - { - new_chunk->prev = old_chunk->prev; - (*h->freefun) (old_chunk); - } - - h->object_base = new_chunk->contents; - h->next_free = h->object_base + obj_size; - /* The new chunk certainly contains no empty object yet. */ - h->maybe_empty_object = 0; -} - -/* Return nonzero if object OBJ has been allocated from obstack H. - This is here for debugging. - If you use it in a program, you are probably losing. */ - -int -_obstack_allocated_p (h, obj) - struct obstack *h; - POINTER obj; -{ - register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk *plp; /* point to previous chunk if any */ - - lp = (h)->chunk; - /* We use >= rather than > since the object cannot be exactly at - the beginning of the chunk but might be an empty object exactly - at the end of an adjacent chunk. */ - while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) - { - plp = lp->prev; - lp = plp; - } - return lp != 0; -} - -/* Free objects in obstack H, including OBJ and everything allocate - more recently than OBJ. If OBJ is zero, free everything in H. */ - -#undef obstack_free - -/* This function has two names with identical definitions. - This is the first one, called from non-ANSI code. */ - -void -_obstack_free (h, obj) - struct obstack *h; - POINTER obj; -{ - register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk *plp; /* point to previous chunk if any */ - - lp = h->chunk; - /* We use >= because there cannot be an object at the beginning of a chunk. - But there can be an empty object at that address - at the end of another chunk. */ - while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) - { - plp = lp->prev; - (*h->freefun) (lp); - lp = plp; - /* If we switch chunks, we can't tell whether the new current - chunk contains an empty object, so assume that it may. */ - h->maybe_empty_object = 1; - } - if (lp) - { - h->object_base = h->next_free = (char *) (obj); - h->chunk_limit = lp->limit; - h->chunk = lp; - } - else if (obj != 0) - /* obj is not in any of the chunks! */ - abort (); -} - -/* This function is used from ANSI code. */ - -void -obstack_free (h, obj) - struct obstack *h; - POINTER obj; -{ - register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk *plp; /* point to previous chunk if any */ - - lp = h->chunk; - /* We use >= because there cannot be an object at the beginning of a chunk. - But there can be an empty object at that address - at the end of another chunk. */ - while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) - { - plp = lp->prev; - (*h->freefun) (lp); - lp = plp; - /* If we switch chunks, we can't tell whether the new current - chunk contains an empty object, so assume that it may. */ - h->maybe_empty_object = 1; - } - if (lp) - { - h->object_base = h->next_free = (char *) (obj); - h->chunk_limit = lp->limit; - h->chunk = lp; - } - else if (obj != 0) - /* obj is not in any of the chunks! */ - abort (); -} - -#if 0 -/* These are now turned off because the applications do not use it - and it uses bcopy via obstack_grow, which causes trouble on sysV. */ - -/* Now define the functional versions of the obstack macros. - Define them to simply use the corresponding macros to do the job. */ - -#ifdef __STDC__ -/* These function definitions do not work with non-ANSI preprocessors; - they won't pass through the macro names in parentheses. */ - -/* The function names appear in parentheses in order to prevent - the macro-definitions of the names from being expanded there. */ - -POINTER (obstack_base) (obstack) - struct obstack *obstack; -{ - return obstack_base (obstack); -} - -POINTER (obstack_next_free) (obstack) - struct obstack *obstack; -{ - return obstack_next_free (obstack); -} - -int (obstack_object_size) (obstack) - struct obstack *obstack; -{ - return obstack_object_size (obstack); -} - -int (obstack_room) (obstack) - struct obstack *obstack; -{ - return obstack_room (obstack); -} - -void (obstack_grow) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - obstack_grow (obstack, pointer, length); -} - -void (obstack_grow0) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - obstack_grow0 (obstack, pointer, length); -} - -void (obstack_1grow) (obstack, character) - struct obstack *obstack; - int character; -{ - obstack_1grow (obstack, character); -} - -void (obstack_blank) (obstack, length) - struct obstack *obstack; - int length; -{ - obstack_blank (obstack, length); -} - -void (obstack_1grow_fast) (obstack, character) - struct obstack *obstack; - int character; -{ - obstack_1grow_fast (obstack, character); -} - -void (obstack_blank_fast) (obstack, length) - struct obstack *obstack; - int length; -{ - obstack_blank_fast (obstack, length); -} - -POINTER (obstack_finish) (obstack) - struct obstack *obstack; -{ - return obstack_finish (obstack); -} - -POINTER (obstack_alloc) (obstack, length) - struct obstack *obstack; - int length; -{ - return obstack_alloc (obstack, length); -} - -POINTER (obstack_copy) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - return obstack_copy (obstack, pointer, length); -} - -POINTER (obstack_copy0) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - return obstack_copy0 (obstack, pointer, length); -} - -#endif /* __STDC__ */ - -#endif /* 0 */ diff --git a/gas/obstack.h b/gas/obstack.h deleted file mode 100644 index c6a8e0a..0000000 --- a/gas/obstack.h +++ /dev/null @@ -1,444 +0,0 @@ -/* obstack.h - object stack macros - Copyright (C) 1988 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Summary: - -All the apparent functions defined here are macros. The idea -is that you would use these pre-tested macros to solve a -very specific set of problems, and they would run fast. -Caution: no side-effects in arguments please!! They may be -evaluated MANY times!! - -These macros operate a stack of objects. Each object starts life -small, and may grow to maturity. (Consider building a word syllable -by syllable.) An object can move while it is growing. Once it has -been "finished" it never changes address again. So the "top of the -stack" is typically an immature growing object, while the rest of the -stack is of mature, fixed size and fixed address objects. - -These routines grab large chunks of memory, using a function you -supply, called `obstack_chunk_alloc'. On occasion, they free chunks, -by calling `obstack_chunk_free'. You must define them and declare -them before using any obstack macros. - -Each independent stack is represented by a `struct obstack'. -Each of the obstack macros expects a pointer to such a structure -as the first argument. - -One motivation for this package is the problem of growing char strings -in symbol tables. Unless you are "fascist pig with a read-only mind" -[Gosper's immortal quote from HAKMEM item 154, out of context] you -would not like to put any arbitrary upper limit on the length of your -symbols. - -In practice this often means you will build many short symbols and a -few long symbols. At the time you are reading a symbol you don't know -how long it is. One traditional method is to read a symbol into a -buffer, realloc()ating the buffer every time you try to read a symbol -that is longer than the buffer. This is beaut, but you still will -want to copy the symbol from the buffer to a more permanent -symbol-table entry say about half the time. - -With obstacks, you can work differently. Use one obstack for all symbol -names. As you read a symbol, grow the name in the obstack gradually. -When the name is complete, finalize it. Then, if the symbol exists already, -free the newly read name. - -The way we do this is to take a large chunk, allocating memory from -low addresses. When you want to build a symbol in the chunk you just -add chars above the current "high water mark" in the chunk. When you -have finished adding chars, because you got to the end of the symbol, -you know how long the chars are, and you can create a new object. -Mostly the chars will not burst over the highest address of the chunk, -because you would typically expect a chunk to be (say) 100 times as -long as an average object. - -In case that isn't clear, when we have enough chars to make up -the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) -so we just point to it where it lies. No moving of chars is -needed and this is the second win: potentially long strings need -never be explicitly shuffled. Once an object is formed, it does not -change its address during its lifetime. - -When the chars burst over a chunk boundary, we allocate a larger -chunk, and then copy the partly formed object from the end of the old -chunk to the beginning of the new larger chunk. We then carry on -accreting characters to the end of the object as we normally would. - -A special macro is provided to add a single char at a time to a -growing object. This allows the use of register variables, which -break the ordinary 'growth' macro. - -Summary: - We allocate large chunks. - We carve out one object at a time from the current chunk. - Once carved, an object never moves. - We are free to append data of any size to the currently - growing object. - Exactly one object is growing in an obstack at any one time. - You can run one obstack per control block. - You may have as many control blocks as you dare. - Because of the way we do it, you can `unwind' a obstack - back to a previous state. (You may remove objects much - as you would with a stack.) -*/ - - -/* Don't do the contents of this file more than once. */ - -#ifndef __OBSTACKS__ -#define __OBSTACKS__ - -/* 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) -#endif - -#ifndef __INT_TO_PTR -#define __INT_TO_PTR(P) ((P) + (char *)0) -#endif - -struct _obstack_chunk /* Lives at front of each chunk. */ -{ - char *limit; /* 1 past end of this chunk */ - struct _obstack_chunk *prev; /* address of prior chunk or NULL */ - char contents[4]; /* objects begin here */ -}; - -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 */ - 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 */ - int temp; /* Temporary for some macros. */ - int alignment_mask; /* Mask of alignment for each object. */ - struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */ - void (*freefun) (); /* User's function to free a chunk. */ - /* Nonzero means there is a possibility the current chunk contains - a zero-length object. This prevents freeing the chunk - if we allocate a bigger chunk to replace it. */ - char maybe_empty_object; -}; - -/* Declare the external functions we use; they are in obstack.c. */ - -#ifdef __STDC__ -extern void _obstack_newchunk (struct obstack *, int); -extern void _obstack_free (struct obstack *, void *); -extern void _obstack_begin (struct obstack *, int, int, - void *(*)(), void (*)()); -#else -extern void _obstack_newchunk (); -extern void _obstack_free (); -extern void _obstack_begin (); -#endif - -#ifdef __STDC__ - -/* Do the function-declarations after the structs - but before defining the macros. */ - -void obstack_init (struct obstack *obstack); - -void *obstack_alloc (struct obstack *obstack, int size); - -void *obstack_copy (struct obstack *obstack, void *address, int size); -void *obstack_copy0 (struct obstack *obstack, void *address, int size); - -void obstack_free (struct obstack *obstack, void *block); - -void obstack_blank (struct obstack *obstack, int size); - -void obstack_grow (struct obstack *obstack, void *data, int size); -void obstack_grow0 (struct obstack *obstack, void *data, int size); - -void obstack_1grow (struct obstack *obstack, int data_char); -void obstack_ptr_grow (struct obstack *obstack, void *data); -void obstack_int_grow (struct obstack *obstack, int data); - -void *obstack_finish (struct obstack *obstack); - -int obstack_object_size (struct obstack *obstack); - -int obstack_room (struct obstack *obstack); -void obstack_1grow_fast (struct obstack *obstack, int data_char); -void obstack_ptr_grow_fast (struct obstack *obstack, void *data); -void obstack_int_grow_fast (struct obstack *obstack, int data); -void obstack_blank_fast (struct obstack *obstack, int size); - -void *obstack_base (struct obstack *obstack); -void *obstack_next_free (struct obstack *obstack); -int obstack_alignment_mask (struct obstack *obstack); -int obstack_chunk_size (struct obstack *obstack); - -#endif /* __STDC__ */ - -/* Non-ANSI C cannot really support alternative functions for these macros, - so we do not declare them. */ - -/* Pointer to beginning of object being allocated or to be allocated next. - Note that this might not be the final address of the object - because a new chunk might be needed to hold the final size. */ - -#define obstack_base(h) ((h)->object_base) - -/* Size for allocating ordinary chunks. */ - -#define obstack_chunk_size(h) ((h)->chunk_size) - -/* Pointer to next byte not yet allocated in current chunk. */ - -#define obstack_next_free(h) ((h)->next_free) - -/* Mask specifying low bits that should be clear in address of an object. */ - -#define obstack_alignment_mask(h) ((h)->alignment_mask) - -#define obstack_init(h) \ - _obstack_begin ((h), 0, 0, \ - (void *(*) ()) obstack_chunk_alloc, (void (*) ())obstack_chunk_free) - -#define obstack_begin(h, size) \ - _obstack_begin ((h), (size), 0, \ - (void *(*) ()) obstack_chunk_alloc, (void (*) ())obstack_chunk_free) - -#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar) - -#define obstack_blank_fast(h,n) ((h)->next_free += (n)) - -#if defined (__GNUC__) && defined (__STDC__) -#if __GNUC__ < 2 -#define __extension__ -#endif - -/* For GNU C, if not -traditional, - we can define these macros to compute all args only once - without using a global variable. - Also, we can avoid using the `temp' slot, to make faster code. */ - -#define obstack_object_size(OBSTACK) \ - __extension__ \ - ({ struct obstack *__o = (OBSTACK); \ - (unsigned) (__o->next_free - __o->object_base); }) - -#define obstack_room(OBSTACK) \ - __extension__ \ - ({ struct obstack *__o = (OBSTACK); \ - (unsigned) (__o->chunk_limit - __o->next_free); }) - -/* Note that the call to _obstack_newchunk is enclosed in (..., 0) - so that we can avoid having void expressions - in the arms of the conditional expression. - Casting the third operand to void was tried before, - but some compilers won't accept it. */ -#define obstack_grow(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - ((__o->next_free + __len > __o->chunk_limit) \ - ? (_obstack_newchunk (__o, __len), 0) : 0); \ - memcpy (__o->next_free, where, __len); \ - __o->next_free += __len; \ - (void) 0; }) - -#define obstack_grow0(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - ((__o->next_free + __len + 1 > __o->chunk_limit) \ - ? (_obstack_newchunk (__o, __len + 1), 0) : 0), \ - memcpy (__o->next_free, where, __len), \ - __o->next_free += __len, \ - *(__o->next_free)++ = 0; \ - (void) 0; }) - -#define obstack_1grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - ((__o->next_free + 1 > __o->chunk_limit) \ - ? (_obstack_newchunk (__o, 1), 0) : 0), \ - *(__o->next_free)++ = (datum); \ - (void) 0; }) - -/* 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); \ - ((__o->next_free + sizeof (void *) > __o->chunk_limit) \ - ? (_obstack_newchunk (__o, sizeof (void *)), 0) : 0), \ - *(*(void ***)&__o->next_free)++ = ((void *)datum); \ - (void) 0; }) - -#define obstack_int_grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - ((__o->next_free + sizeof (int) > __o->chunk_limit) \ - ? (_obstack_newchunk (__o, sizeof (int)), 0) : 0), \ - *(*(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_blank(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - ((__o->chunk_limit - __o->next_free < __len) \ - ? (_obstack_newchunk (__o, __len), 0) : 0); \ - __o->next_free += __len; \ - (void) 0; }) - -#define obstack_alloc(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_blank (__h, (length)); \ - obstack_finish (__h); }) - -#define obstack_copy(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow (__h, (where), (length)); \ - obstack_finish (__h); }) - -#define obstack_copy0(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow0 (__h, (where), (length)); \ - obstack_finish (__h); }) - -/* The local variable is named __o1 to avoid a name conflict - when obstack_blank is called. */ -#define obstack_finish(OBSTACK) \ -__extension__ \ -({ struct obstack *__o1 = (OBSTACK); \ - void *value = (void *) __o1->object_base; \ - if (__o1->next_free == value) \ - __o1->maybe_empty_object = 1; \ - __o1->next_free \ - = __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\ - & ~ (__o1->alignment_mask)); \ - ((__o1->next_free - (char *)__o1->chunk \ - > __o1->chunk_limit - (char *)__o1->chunk) \ - ? (__o1->next_free = __o1->chunk_limit) : 0); \ - __o1->object_base = __o1->next_free; \ - value; }) - -#define obstack_free(OBSTACK, OBJ) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - void *__obj = (OBJ); \ - if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ - __o->next_free = __o->object_base = __obj; \ - else (obstack_free) (__o, __obj); }) - -#else /* not __GNUC__ or not __STDC__ */ - -#define obstack_object_size(h) \ - (unsigned) ((h)->next_free - (h)->object_base) - -#define obstack_room(h) \ - (unsigned) ((h)->chunk_limit - (h)->next_free) - -#define obstack_grow(h,where,length) \ -( (h)->temp = (length), \ - (((h)->next_free + (h)->temp > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ - memcpy ((h)->next_free, where, (h)->temp), \ - (h)->next_free += (h)->temp) - -#define obstack_grow0(h,where,length) \ -( (h)->temp = (length), \ - (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \ - memcpy ((h)->next_free, where, (h)->temp), \ - (h)->next_free += (h)->temp, \ - *((h)->next_free)++ = 0) - -#define obstack_1grow(h,datum) \ -( (((h)->next_free + 1 > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), 1), 0) : 0), \ - *((h)->next_free)++ = (datum)) - -#define obstack_ptr_grow(h,datum) \ -( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ - *(*(char ***)&(h)->next_free)++ = ((char *)datum)) - -#define obstack_int_grow(h,datum) \ -( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ - *(*(int **)&(h)->next_free)++ = ((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_blank(h,length) \ -( (h)->temp = (length), \ - (((h)->chunk_limit - (h)->next_free < (h)->temp) \ - ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ - (h)->next_free += (h)->temp) - -#define obstack_alloc(h,length) \ - (obstack_blank ((h), (length)), obstack_finish ((h))) - -#define obstack_copy(h,where,length) \ - (obstack_grow ((h), (where), (length)), obstack_finish ((h))) - -#define obstack_copy0(h,where,length) \ - (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) - -#define obstack_finish(h) \ -( ((h)->next_free == (h)->object_base \ - ? (((h)->maybe_empty_object = 1), 0) \ - : 0), \ - (h)->temp = __PTR_TO_INT ((h)->object_base), \ - (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 = (h)->chunk_limit) : 0), \ - (h)->object_base = (h)->next_free, \ - __INT_TO_PTR ((h)->temp)) - -#ifdef __STDC__ -#define obstack_free(h,obj) \ -( (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 > 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))) -#endif - -#endif /* not __GNUC__ or not __STDC__ */ - -#endif /* not __OBSTACKS__ */ diff --git a/gas/strerror.c b/gas/strerror.c deleted file mode 100644 index 0e3d7f9..0000000 --- a/gas/strerror.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Version of strerror() for systems that need it. - Copyright (C) 1991, 1992 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ - - -/* - -NAME - - strerror -- map an error number to an error message string - -SYNOPSIS - - #include <string.h> - - char *strerror (int errnum) - -DESCRIPTION - - Returns a pointer to a string containing an error message, the - contents of which are implementation defined. The implementation - shall behave as if no library function calls strerror. The string - pointed to shall not be modified by the caller and is only guaranteed - to be valid until a subsequent call to strerror. - -BUGS - - Requires that the system have sys_errlist and sys_nerr. - -*/ - -#ifndef HAVE_STRERROR - -extern int sys_nerr; -extern char *sys_errlist[]; - -char * -strerror (code) - int code; -{ - return (((code < 0) || (code >= sys_nerr)) - ? "(unknown error)" - : sys_errlist[code]); -} - -#endif /* HAVE_STRERROR */ - -/* end of strerror.c */ diff --git a/gas/strstr.c b/gas/strstr.c deleted file mode 100644 index 2bb8890..0000000 --- a/gas/strstr.c +++ /dev/null @@ -1,55 +0,0 @@ -/* strstr - find first occurrence of wanted in s - - Copyright (C) 1989, 1990, 1991, 1992 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* If your compiler is really ansi, then you don't need this. */ - -#if __STDC__ != 1 - -#define SIZET int - -#define NULL 0 - -#include <string.h> - -char * /* found string, or NULL if none */ -strstr (s, wanted) - char *s; - char *wanted; -{ - register char *scan; - register SIZET len; - register char firstc; - - /* - * The odd placement of the two tests is so "" is findable. - * Also, we inline the first char for speed. - * The ++ on scan has been moved down for optimization. - */ - firstc = *wanted; - len = strlen (wanted); - for (scan = s; *scan != firstc || strncmp (scan, wanted, len) != 0;) - if (*scan++ == '\0') - return (NULL); - return (scan); -} /* strstr() */ - -#endif /* not __STDC__ */ - -/* end of strstr.c */ diff --git a/gas/xrealloc.c b/gas/xrealloc.c deleted file mode 100644 index a7da9f2..0000000 --- a/gas/xrealloc.c +++ /dev/null @@ -1,69 +0,0 @@ -/* xrealloc.c - new 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - - -/* - - NAME - xrealloc () - get more memory or bust - INDEX - xrealloc () uses realloc () - SYNOPSIS - char *my_memory; - - my_memory = xrealloc (my_memory, 42); - / * my_memory gets (perhaps new) address of 42 chars * / - - DESCRIPTION - - Use xrealloc () as an "error-free" realloc ().It does almost the same - job. When it cannot honour your request for memory it BOMBS your - program with a "virtual memory exceeded" message. Realloc() returns - NULL and does not bomb your program. - - SEE ALSO - realloc () - */ - -#if __STDC__ == 1 -#include <stdlib.h> -#else -#ifdef USG -#include <malloc.h> -#else -char *realloc (); -#endif /* USG */ -#endif /* not __STDC__ */ - -#define error as_fatal - -char * -xrealloc (ptr, n) - register char *ptr; - long n; -{ - void error (); - - if ((ptr = realloc (ptr, (unsigned) n)) == 0) - error ("virtual memory exceeded"); - return (ptr); -} - -/* end of xrealloc.c */ |