Patches for GAS 1.36 for UNIX ISC 2.2 (Part 1/2)

src at eliabel.sf.ca.us src at eliabel.sf.ca.us
Sat Aug 18 16:54:24 AEST 1990


Those are the patches to make GAS 1.36 work with UNIX ISC 2.2 with
the GNU COFF system. This is part 1. Please, also use part 2 which
contain a uuencode of additional files.

Eric P. Meyer
ELIABEL Corp.
emeyer at eliabel.sf.ca.us


diff -rp gas-1.36/Makefile ../gas-1.36/Makefile
*** gas-1.36/Makefile	Thu Jun  7 11:21:06 1990
--- ../gas-1.36/Makefile	Sat Aug  4 18:18:17 1990
***************
*** 20,38 ****
  # This makefile may be used to make the VAX, 68020, 80386, 
  # SPARC, or ns32k assembler(s).
  
! BINDIR = /usr/local/bin
  
  # If you are on a BSD system, un-comment the next two lines, and comment out
  # the lines for SystemV and HPUX below
! G0 = -g -I.
! LDFLAGS = $(CFLAGS)
  #
  # To compile gas on a System Five machine, comment out the two lines above
  # and un-comment out the next three lines
  # Comment out the -lPW on the LOADLIBES line if you are using GCC.
! # G0 = -g -I. -DUSG
! # LDFLAGS = $(CFLAGS)
! # LOADLIBES = -lmalloc -lPW
  #
  # To compile gas for HPUX, link m-hpux.h to m68k.h , and un-comment the
  # next two lines.  (If you are using GCC, comment out the alloca.o part)
--- 20,40 ----
  # This makefile may be used to make the VAX, 68020, 80386, 
  # SPARC, or ns32k assembler(s).
  
! srcdir = .
! VPATH = .
! BINDIR = /u/bin
  
  # If you are on a BSD system, un-comment the next two lines, and comment out
  # the lines for SystemV and HPUX below
! # G0 = -g -I.
! # LDFLAGS = $(CFLAGS)
  #
  # To compile gas on a System Five machine, comment out the two lines above
  # and un-comment out the next three lines
  # Comment out the -lPW on the LOADLIBES line if you are using GCC.
! G0 = -g -I. -DUSG
! LDFLAGS = # $(CFLAGS)
! LOADLIBES = -lPW -lc_s
  #
  # To compile gas for HPUX, link m-hpux.h to m68k.h , and un-comment the
  # next two lines.  (If you are using GCC, comment out the alloca.o part)
*************** LDFLAGS = $(CFLAGS)
*** 92,117 ****
  # To compile in tne NS32381 opcodes in addition to the NS32081 opcodes
  # (the 32381 is a superset of the 32081), remove the # from the -DNS32381
  # line below.
  
! O1 =  -DNO_VARARGS
! O2 = # -DNON_BROKEN_WORDS
  O3 = # -Dm68851
  O4 = # -DEXEC_VERSION=1
! O5 = # -DSIGTY=void
  O6 = # -DNS32532
  O7 = # -DNS32381
  G4 = # -DUSE_SYSTEM_HDR
  G5 = # -DUSE_HP_HDR
  G6 = # -DSUN_ASM_SYNTAX
  
  OPTIONS = $(O1) $(O2) $(O3) $(O4) $(O5) $(O6) $(O7)
  
! CFLAGS = $(G0) $(G4) $(G5) $(G6)
! 
  #
  # To make the 68020 assembler compile as the default, un-comment the next
  # line, and comment out all the other lines that start with DEFAULT_GAS
! DEFAULT_GAS=a68
  #
  # To make the VAX assembler compile as the default, un-comment the next
  # line and commment out all the other lines that start with DEFAULT_GAS
--- 94,153 ----
  # To compile in tne NS32381 opcodes in addition to the NS32081 opcodes
  # (the 32381 is a superset of the 32081), remove the # from the -DNS32381
  # line below.
+ #
+ # If you are building gas for a system on which local symbols emitted by
+ # the compiler begin with ".L" rather than "L" (some m68k systems, sun386i,
+ # and probably most systems on which underscores are not prepended by 
+ # the compiler), remove the # from the -DDOT_LABEL_PREFIX line below.
+ #
+ # If you want the "-C" flag to tell gas to produce a COFF file rather than
+ # an a.out, remove the # from the -DCOFF_OPTION line below.
+ #
+ # (If there is a  masochist at your site who insists on using coff-encapsulation, 
+ # tell him that he can still do so by not specifying "-C" when invoking gas.)
+ #
+ # If you need special defines that are not anticipated by the provided 
+ # options, define them in SPECIAL_GLOBAL_DEFINES here, and uncomment the 
+ # $(SPECIAL_GLOBAL_DEFINES) in G9 below.
+ SPECIAL_GLOBAL_DEFINES = 
+ #
+ # If you are using a backend for a special object format (such
+ # as COFF, ELF, MACHO, etc) and need special options for compiling 
+ # that backend, define these in BACKEND_CROSS_FLAGS here, 
+ # and uncomment the $(BACKEND_CROSS_FLAGS) in B1 below.
+ BACKEND_CROSS_FLAGS =   # -finline-functions
+ #
+ # if you need any special include paths for building a cross version
+ # with an alternate object format backend, define BACKEND_INCDIR_SPEC 
+ # and uncomment BACKEND_INCDIR_SPEC in B2 below.  You would undoubtably 
+ # use different names than the sample shown here. 
+ #BACKEND_INCDIR_SPEC = -I/usr/include -I/CMS6/CDS/CDS016/pbbs5/include
  
! O1 = # -DNO_VARARGS
! O2 = -DNON_BROKEN_WORDS
  O3 = # -Dm68851
  O4 = # -DEXEC_VERSION=1
! O5 = -DSIGTY=void
  O6 = # -DNS32532
  O7 = # -DNS32381
  G4 = # -DUSE_SYSTEM_HDR
  G5 = # -DUSE_HP_HDR
  G6 = # -DSUN_ASM_SYNTAX
+ G7 = # -DDOT_LABEL_PREFIX
+ G8 = # $(SPECIAL_GLOBAL_DEFINES)
+ B1 =  -DCOFF_OPTION
+ B2 =  $(BACKEND_INCDIR_SPEC)
+ BACKEND_OPTIONS = $(B1) $(B2) 
  
  OPTIONS = $(O1) $(O2) $(O3) $(O4) $(O5) $(O6) $(O7)
  
! CFLAGS = $(G0) $(G4) $(G5) $(G6) $(G7) $(G8) 
  #
  # To make the 68020 assembler compile as the default, un-comment the next
  # line, and comment out all the other lines that start with DEFAULT_GAS
! #DEFAULT_GAS=a68
! #DEFAULT_GAS=asun386
! DEFAULT_GAS=a386
  #
  # To make the VAX assembler compile as the default, un-comment the next
  # line and commment out all the other lines that start with DEFAULT_GAS
*************** DEFAULT_GAS=a68
*** 119,125 ****
  #
  # To make the 80386 assembler compile as the default, un-comment the next
  # line and commment out all the other lines that start with DEFAULT_GAS
! #DEFAULT_GAS=a386
  #
  # To make the ns32k assembler compile as the default, un-comment the next
  # line and commment out all the other lines that start with DEFAULT_GAS
--- 155,161 ----
  #
  # To make the 80386 assembler compile as the default, un-comment the next
  # line and commment out all the other lines that start with DEFAULT_GAS
! DEFAULT_GAS=a386
  #
  # To make the ns32k assembler compile as the default, un-comment the next
  # line and commment out all the other lines that start with DEFAULT_GAS
*************** obstack.o
*** 143,151 ****
  a:	$(DEFAULT_GAS)
  	@rm -f a
  	@ln $(DEFAULT_GAS) a
  
  # SPARC GAS ------------------------------------------------------------------
! v = sparc.o  atof-ieee.o  write-sparc.o  read-sparc.o
  
  V = sparc.c  sparc.h  sparc-opcode.h
  
--- 179,190 ----
  a:	$(DEFAULT_GAS)
  	@rm -f a
  	@ln $(DEFAULT_GAS) a
+ #
+ # The explicit srcdir references below for sources whose objects will be renamed 
+ # are present because sun make's VPATH support is not as smart as that in GNU make.
  
  # SPARC GAS ------------------------------------------------------------------
! v = sparc.o  atof-ieee.o  write-sparc.o  read-sparc.o coff-sparc.o
  
  V = sparc.c  sparc.h  sparc-opcode.h
  
*************** V = sparc.c  sparc.h  sparc-opcode.h
*** 152,186 ****
  atof-ieee.o:	flonum.h
  sparc.o:	sparc.c sparc.h sparc-opcode.h as.h frags.h struc-symbol.h
  sparc.o:	flonum.h expr.h hash.h md.h write.h read.h symbols.h
! 	$(CC) -c $(CFLAGS) -DSPARC sparc.c
  
  write-sparc.o:	write.c
! 	$(CC) -c -DSPARC $(CFLAGS) write.c
  	mv write.o write-sparc.o
  
  read-sparc.o: read.c
! 	$(CC) -c -DSPARC $(CFLAGS) read.c
  	mv read.o read-sparc.o
  
  asparc: $a $v
! 	$(CC) -o asparc $(LDFLAGS) $a $v $(LOADLIBES)
  
  # NS32K GAS ------------------------------------------------------------------
! w = ns32k.o  atof-ieee.o  write-ns32k.o  read-ns32k.o
  
  W = ns32k.c ns32k-opcode.h
  
  atof-ieee.o:	flonum.h
! ns32k.o:	as.h frags.h struc-symbol.h flonum.h expr.h md.h hash.h
! ns32k.o:	write.h symbols.h ns32k-opcode.h ns32k.c
! 	$(CC) $(CFLAGS) $(OPTIONS) -c ns32k.c
  
  write-ns32k.o:	write.c
! 	$(CC) -c -DNS32K $(CFLAGS) write.c
  	mv write.o write-ns32k.o
  
! read-ns32k.o:
! 	$(CC) -c -DNS32K $(CFLAGS) read.c
  	mv read.o read-ns32k.o
  
  a32k: $a $w
--- 191,235 ----
  atof-ieee.o:	flonum.h
  sparc.o:	sparc.c sparc.h sparc-opcode.h as.h frags.h struc-symbol.h
  sparc.o:	flonum.h expr.h hash.h md.h write.h read.h symbols.h
! 	$(CC) -c $(CFLAGS) -DSPARC $(srcdir)/sparc.c
! 
! coff-sparc.o:	coff-convert.c stab.gnu.h stab.def
! 	$(CC) -c -DTARGET=TARGET_SPARC $(CFLAGS) $(BACKEND_OPTIONS) \
! 		$(srcdir)/coff-convert.c
! 	mv coff-convert.o coff-sparc.o
  
  write-sparc.o:	write.c
! 	$(CC) -c -DSPARC $(CFLAGS) $(srcdir)/write.c
  	mv write.o write-sparc.o
  
  read-sparc.o: read.c
! 	$(CC) -c -DSPARC $(CFLAGS) $(srcdir)/read.c
  	mv read.o read-sparc.o
  
  asparc: $a $v
! #	$(CC) -o asparc $(LDFLAGS) $a $v $(LOADLIBES)
  
  # NS32K GAS ------------------------------------------------------------------
! w = ns32k.o  atof-ieee.o  write-ns32k.o  read-ns32k.o coff-ns32k.o
  
  W = ns32k.c ns32k-opcode.h
  
  atof-ieee.o:	flonum.h
! ns32k.o:	ns32k.c as.h frags.h struc-symbol.h flonum.h expr.h md.h hash.h
! ns32k.o:	write.h symbols.h ns32k-opcode.h 
! 	$(CC) $(CFLAGS) $(OPTIONS) -c $(srcdir)/ns32k.c
! 
! coff-ns32k.o:	coff-convert.c stab.gnu.h stab.def
! 	$(CC) -c -DTARGET=TARGET_NS32K $(CFLAGS) $(BACKEND_OPTIONS) \
! 		$(srcdir)/coff-convert.c
! 	mv coff-convert.o coff-ns32k.o
  
  write-ns32k.o:	write.c
! 	$(CC) -c -DNS32K $(CFLAGS) $(srcdir)/write.c
  	mv write.o write-ns32k.o
  
! read-ns32k.o: read.c
! 	$(CC) -c -DNS32K $(CFLAGS) $(srcdir)/read.c
  	mv read.o read-ns32k.o
  
  a32k: $a $w
*************** a32k: $a $w
*** 187,224 ****
  	$(CC) -o a32k $(LDFLAGS) $a $w $(LOADLIBES)
  
  # 80386 GAS ------------------------------------------------------------------
! x = i386.o  atof-ieee.o  write.o  read.o
  
  X = i386.c  i386.h  i386-opcode.h
  
  i386.o:		i386.c as.h read.h flonum.h frags.h struc-symbol.h expr.h
  i386.o:		symbols.h hash.h md.h i386.h i386-opcode.h
! 	$(CC) $(CFLAGS) $(OPTIONS) -c i386.c
  
  atof-ieee.o:	flonum.h
  
  a386: $a $x
! 	$(CC) -o a386 $(LDFLAGS) $a $x $(LOADLIBES)
  
  # 68020 GAS ------------------------------------------------------------------
! y = m68k.o  atof-ieee.o write.o read.o
  
  Y = m68k.c atof-ieee.c m68k-opcode.h m-hpux.h m-sun3.h m-generic.h
  
  atof-ieee.o:	flonum.h
  
  m68k.o:		m68k.c a.out.h as.h expr.h flonum.h frags.h hash.h
  m68k.o:		m68k-opcode.h m68k.h md.h obstack.h struc-symbol.h
! 	$(CC) $(CFLAGS) $(OPTIONS) -c m68k.c
  
  a68: $a $y
  	$(CC) -o a68 $(LDFLAGS) $a $y $(LOADLIBES)
  
  # VAX GAS --------------------------------------------------------------------
! z = vax.o  atof-vax.o  write.o  read.o
  
  Z = vax.c atof-vax.c vax-opcode.h vax-inst.h    make-gas.com objrecdef.h vms.c
  
  vax.o:		vax.c a.out.h as.h expr.h flonum.h frags.h md.h obstack.h
  vax.o:		read.h struc-symbol.h symbols.h vax-inst.h vax-opcode.h
  atof-vax.o:	as.h flonum.h read.h
--- 236,349 ----
  	$(CC) -o a32k $(LDFLAGS) $a $w $(LOADLIBES)
  
  # 80386 GAS ------------------------------------------------------------------
! x = i386.o  atof-ieee.o  write.o  read.o coff-i386.o
  
  X = i386.c  i386.h  i386-opcode.h
  
+ coff-i386.o:	coff-convert.c stab.gnu.h stab.def
+ 	$(CC) -c -DTARGET=TARGET_386 $(CFLAGS) $(BACKEND_OPTIONS) \
+ 		$(srcdir)/coff-convert.c
+ 	mv coff-convert.o coff-i386.o
+ 
  i386.o:		i386.c as.h read.h flonum.h frags.h struc-symbol.h expr.h
  i386.o:		symbols.h hash.h md.h i386.h i386-opcode.h
! 	$(CC) $(CFLAGS) $(OPTIONS) -c $(srcdir)/i386.c
  
  atof-ieee.o:	flonum.h
  
  a386: $a $x
! 	ld -o a386 $(LDFLAGS) /lib/crt1.o $a $x /u/lib/gcc-gnulib $(LOADLIBES) /lib/crtn.o
! #	$(CC) -o a386 $(LDFLAGS) $a $x $(LOADLIBES)
! 
! # SUN 386i GAS ------------------------------------------------------------------
! xs = i386.o  atof-ieee.o  write.o  read.o coff-sun386.o
! 
! Xs = i386.c  i386.h  i386-opcode.h
! 
! coff-sun386.o:	coff-convert.c stab.gnu.h stab.def
! 	$(CC) -c -DTARGET=TARGET_SUN386 $(CFLAGS) $(BACKEND_OPTIONS) \
! 		$(srcdir)/coff-convert.c
! 	mv coff-convert.o coff-sun386.o
! 
! atof-ieee.o:	flonum.h
! 
! asun386: $a ${xs}
! 	$(CC) -o asun386 $(LDFLAGS) $a ${xs} $(LOADLIBES)
  
  # 68020 GAS ------------------------------------------------------------------
! y = m68k.o  atof-ieee.o write.o read.o coff-m68k.o
  
  Y = m68k.c atof-ieee.c m68k-opcode.h m-hpux.h m-sun3.h m-generic.h
  
  atof-ieee.o:	flonum.h
  
+ coff-m68k.o:	coff-convert.c stab.gnu.h stab.def
+ 	$(CC) -c -DTARGET=TARGET_68K $(CFLAGS) $(BACKEND_OPTIONS) \
+ 		$(srcdir)/coff-convert.c
+ 	mv coff-convert.o coff-m68k.o
+ 
  m68k.o:		m68k.c a.out.h as.h expr.h flonum.h frags.h hash.h
  m68k.o:		m68k-opcode.h m68k.h md.h obstack.h struc-symbol.h
! 	$(CC) $(CFLAGS) $(OPTIONS) -c $(srcdir)/m68k.c
  
  a68: $a $y
  	$(CC) -o a68 $(LDFLAGS) $a $y $(LOADLIBES)
  
+ # apollo GAS ------------------------------------------------------------------
+ # Warning:
+ # The only targets in this section that I have tested are "regression_tests"
+ # and the targets it is dependent upon. - mb
+ 
+ ya = m68k.o  atof-ieee.o write.o read.o coff-apollo.o
+ yr = m68k.o  atof-ieee.o write.o read.o coff-regress.o
+ yo = m68k.o  atof-ieee.o write.o read.o coff-orig.o
+ YA = m68k.c atof-ieee.c m68k-opcode.h m-hpux.h m-sun3.h m-generic.h
+ 
+ atof-ieee.o:	flonum.h
+ 
+ coff-apollo.o:	coff-convert.c stab.gnu.h stab.def
+ 	$(CC) -c -DTARGET=TARGET_APOLLO $(CFLAGS) $(BACKEND_OPTIONS) \
+ 		$(srcdir)/coff-convert.c
+ 	mv coff-convert.o coff-apollo.o
+ 
+ coff-regress.o:	coff-convert.c stab.gnu.h stab.def
+ 	$(CC) -c -DTARGET=TARGET_68K -DREGRESSION_TEST $(CFLAGS) \
+ 		$(BACKEND_OPTIONS) $(srcdir)/coff-convert.c
+ 	mv coff-convert.o coff-regress.o
+ 
+ coff-orig.o:	coff-orig.c stab.gnu.h stab.def
+ 	$(CC) -c -DTARGET=TARGET_APOLLO $(CFLAGS) -DREGRESSION_TEST \
+ 		$(BACKEND_OPTIONS) $(srcdir)/coff-orig.c
+ 
+ a68apollo: $a ${ya}
+ 	$(CC) -o a68apollo $(LDFLAGS) $a ${ya} $(LOADLIBES)
+ 
+ a68regress: $a ${yr}
+ 	$(CC) -o a68regress $(LDFLAGS) $a ${yr} $(LOADLIBES)
+ 
+ a68base: $a ${yo}
+ 	$(CC) -o a68base $(LDFLAGS) $a ${yo} $(LOADLIBES)
+ 
+ m68k.s: m68k.c
+ 	$(CC) -I. $(OPTIONS) -S $(srcdir)/m68k.c
+ 
+ # compare results with those from old no stabs version from apollo
+ regression_test: a68regress a68base m68k.s
+ 	a68base -o base.o -C m68k.s
+ 	a68regress -o new.o -C m68k.s
+ 	@-echo expect no differences after byte 10:
+ 	-cmp -l base.o new.o
+ 
  # VAX GAS --------------------------------------------------------------------
! z = vax.o  atof-vax.o  write.o  read.o coff-vax.o
  
  Z = vax.c atof-vax.c vax-opcode.h vax-inst.h    make-gas.com objrecdef.h vms.c
  
+ coff-vax.o:	coff-convert.c stab.gnu.h stab.def
+ 	$(CC) -c -DTARGET=TARGET_VAX $(CFLAGS) $(BACKEND_OPTIONS) \
+ 		$(srcdir)/coff-convert.c
+ 	mv coff-convert.o coff-vax.o
+ 
  vax.o:		vax.c a.out.h as.h expr.h flonum.h frags.h md.h obstack.h
  vax.o:		read.h struc-symbol.h symbols.h vax-inst.h vax-opcode.h
  atof-vax.o:	as.h flonum.h read.h
*************** avax:	$a $z
*** 229,247 ****
  # global files ---------------------------------------------------------------
  
  as.o: as.c
! 	$(CC) $(CFLAGS) $(OPTIONS) -c as.c
  
  messages.o: messages.c
! 	$(CC) $(CFLAGS) $(OPTIONS) -c messages.c
  
  hash.o:	hash.c
! 	$(CC) $(CFLAGS) -Derror=as_fatal -c hash.c
  
  xmalloc.o:	xmalloc.c
! 	$(CC) $(CFLAGS) -Derror=as_fatal -c xmalloc.c
  
  xrealloc.o:	xrealloc.c
! 	$(CC) $(CFLAGS) -Derror=as_fatal -c xrealloc.c
  
  A =\
  as.c		xrealloc.c	xmalloc.c	hash.c		hex-value.c \
--- 354,373 ----
  # global files ---------------------------------------------------------------
  
  as.o: as.c
! 	$(CC) $(CFLAGS) $(OPTIONS) -c $(srcdir)/as.c
  
  messages.o: messages.c
! 	$(CC) $(CFLAGS) $(OPTIONS) -c $(srcdir)/messages.c
  
  hash.o:	hash.c
! 	$(CC) $(CFLAGS) -Derror=as_fatal -c $(srcdir)/hash.c
  
  xmalloc.o:	xmalloc.c
! 	$(CC) $(CFLAGS) -Derror=as_fatal -c $(srcdir)/xmalloc.c
  
  xrealloc.o:	xrealloc.c
! 	$(CC) $(CFLAGS) -Derror=as_fatal -c $(srcdir)/xrealloc.c
! 
  
  A =\
  as.c		xrealloc.c	xmalloc.c	hash.c		hex-value.c \
diff -rp gas-1.36/as.c ../gas-1.36/as.c
*** gas-1.36/as.c	Tue Mar 20 10:33:57 1990
--- ../gas-1.36/as.c	Wed Aug  1 15:11:17 1990
*************** char	**argv;
*** 124,129 ****
--- 124,137 ----
  			switch (a) {
  			case 'f':
  				break;	/* -f means fast - no need for "app" preprocessor. */
+ 			case 'C': {
+ 				  extern int need_delayed_byteswap;
+ 
+ 				  if (need_delayed_byteswap)
+ 				    delayed_byteswap = 1;
+ 				}
+ 				/* write coff file instead of a.out this run */
+ 				break;
  
  			case 'D':
  				/* DEBUG is implemented: it debugs different */
diff -rp gas-1.36/as.h ../gas-1.36/as.h
*** gas-1.36/as.h	Wed Mar  1 14:49:37 1989
--- ../gas-1.36/as.h	Wed Aug  1 15:11:17 1990
*************** out_file_name;			/* name of emitted obje
*** 282,287 ****
--- 282,291 ----
  
  COMMON int	need_pass_2;	/* TRUE if we need a second pass. */
  
+ /* delayed_byteswap is TRUE if structure byteswaps are being delayed for the
+  * benefit of an alternate object file type back end.
+  */
+ COMMON int 	delayed_byteswap;
  
  #endif				/* #ifdef asH */
  
diff -rp gas-1.36/i386.c ../gas-1.36/i386.c
*** gas-1.36/i386.c	Wed May 16 08:29:04 1990
--- ../gas-1.36/i386.c	Wed Aug  1 15:11:19 1990
*************** pseudo_typeS md_pseudo_table[] = {
*** 169,174 ****
--- 169,175 ----
  	{ "value",      cons,           2 },
  	{ "ident",      dummy,          0   }, /* ignore these directives */
  	{ "def",        dummy,          0   },
+ 	{ "optim",	dummy,          0   }, /* generated by sun 386i cc */
  	{ "version",    dummy,          0   },
  	{ "ln",    dummy,          0   },
  	{ 0, 0, 0 }
*************** void md_assemble (line)
*** 1132,1143 ****
        /* Now the modrm byte and base index byte (if present). */
        if (t->opcode_modifier & Modrm) {
  	p =  frag_more (1);
! 	md_number_to_chars (p, i.rm, 1);
  	/* If i.rm.regmem == ESP (4) && i.rm.mode != Mode 3 (Register mode)
  	   ==> need second modrm byte. */
  	if (i.rm.regmem == ESCAPE_TO_TWO_BYTE_ADDRESSING && i.rm.mode != 3) {
  	  p =  frag_more (1);
! 	  md_number_to_chars (p, i.bi, 1);
  	}
        }
        
--- 1133,1144 ----
        /* Now the modrm byte and base index byte (if present). */
        if (t->opcode_modifier & Modrm) {
  	p =  frag_more (1);
! 	md_number_to_chars (p, (i.rm.regmem<<0 | i.rm.reg<<3 | i.rm.mode<<6), 1);
  	/* If i.rm.regmem == ESP (4) && i.rm.mode != Mode 3 (Register mode)
  	   ==> need second modrm byte. */
  	if (i.rm.regmem == ESCAPE_TO_TWO_BYTE_ADDRESSING && i.rm.mode != 3) {
  	  p =  frag_more (1);
! 	  md_number_to_chars (p,(i.bi.base<<0 | i.bi.index<<3 | i.bi.scale<<6), 1);
  	}
        }
        
Only in ../gas-1.36: m-prefix.h
diff -rp gas-1.36/m68k.c ../gas-1.36/m68k.c
*** gas-1.36/m68k.c	Wed May 16 08:47:44 1990
--- ../gas-1.36/m68k.c	Wed Aug  1 15:11:22 1990
*************** register char **ccp;
*** 444,454 ****
  	register int n = 0,
  		ret;
  
  	c1=mklower(ccp[0][0]);
  	c2=mklower(ccp[0][1]);
  	c3=mklower(ccp[0][2]);
  	c4=mklower(ccp[0][3]);
! 
  	switch(c1) {
  	case 'a':
  		if(c2>='0' && c2<='7') {
--- 444,463 ----
  	register int n = 0,
  		ret;
  
+ #ifdef REGISTER_PREFIX
  	c1=mklower(ccp[0][0]);
+ 	if (c1 != REGISTER_PREFIX)
+ 		return FAIL;
+ 	c1=mklower(ccp[0][1]);
+ 	c2=mklower(ccp[0][2]);
+ 	c3=mklower(ccp[0][3]);
+ 	c4=mklower(ccp[0][4]);
+ #else
+ 	c1=mklower(ccp[0][0]);
  	c2=mklower(ccp[0][1]);
  	c3=mklower(ccp[0][2]);
  	c4=mklower(ccp[0][3]);
! #endif
  	switch(c1) {
  	case 'a':
  		if(c2>='0' && c2<='7') {
*************** register char **ccp;
*** 628,633 ****
--- 637,645 ----
  		break;
  	}
  	if(n) {
+ #ifdef REGISTER_PREFIX
+ 		n++;			/* account for REGISTER_PRIFIX ('%') */
+ #endif
  		if(isalnum(ccp[0][n]) || ccp[0][n]=='_')
  			ret=FAIL;
  		else
*************** obstack_alloc(&robyn,sizeof(struct m68_i
*** 2498,2503 ****
--- 2510,2518 ----
  	alt_notend_table['#'] = 1;
  	alt_notend_table['f'] = 1;
  	alt_notend_table['F'] = 1;
+ #ifdef REGISTER_PREFIX
+ 	alt_notend_table[REGISTER_PREFIX] = 1;
+ #endif
  }
  
  #if 0
diff -rp gas-1.36/write.c ../gas-1.36/write.c
*** gas-1.36/write.c	Thu Apr 12 09:23:42 1990
--- ../gas-1.36/write.c	Wed Aug  1 15:11:23 1990
*************** the Free Software Foundation, 675 Mass A
*** 42,47 ****
--- 42,54 ----
  #include "sparc.h"
  #endif
  
+ #ifdef DOT_LABEL_PREFIX
+ #define LOCAL_LABEL(name) (name[0] =='.' \
+ 			   && ( name [1] == 'L' || name [1] == '.' ))
+ #else  /* not defined DOT_LABEL_PREFIX */
+ #define LOCAL_LABEL(name) (name [0] == 'L' )
+ #endif /* not defined DOT_LABEL_PREFIX */
+ 
  void	append();
  
  #ifdef hpux
*************** write_object_file()
*** 266,272 ****
    text_siz= (text_siz+7)&(~7);
    text_last_frag->fr_address=text_siz;
  #endif
!   md_number_to_chars((char *)&the_exec.a_text,text_siz, sizeof(the_exec.a_text));
    /* the_exec . a_text = text_last_frag -> fr_address; */
  
    /*
--- 273,282 ----
    text_siz= (text_siz+7)&(~7);
    text_last_frag->fr_address=text_siz;
  #endif
!   if (delayed_byteswap)
!     the_exec.a_text = text_siz;
!   else
!     md_number_to_chars((char *)&the_exec.a_text,text_siz, sizeof(the_exec.a_text));
    /* the_exec . a_text = text_last_frag -> fr_address; */
  
    /*
*************** write_object_file()
*** 286,292 ****
        data_siz += (8 - (data_siz % 8)) % 8;
        data_last_frag->fr_address = data_siz;
  #endif
!       md_number_to_chars((char *)&the_exec.a_data,data_siz,sizeof(the_exec.a_data));
        /* the_exec . a_data = data_last_frag -> fr_address; */
        slide = text_siz; /* Address in file of the data segment. */
        for (fragP = data_frag_root;
--- 296,305 ----
        data_siz += (8 - (data_siz % 8)) % 8;
        data_last_frag->fr_address = data_siz;
  #endif
!       if (delayed_byteswap)
!         the_exec.a_data = data_siz;
!       else
!         md_number_to_chars((char *)&the_exec.a_data,data_siz,sizeof(the_exec.a_data));
        /* the_exec . a_data = data_last_frag -> fr_address; */
        slide = text_siz; /* Address in file of the data segment. */
        for (fragP = data_frag_root;
*************** write_object_file()
*** 299,305 ****
        text_last_frag -> fr_next = data_frag_root;
      }
    else {
!       md_number_to_chars((char *)&the_exec.a_data,0,sizeof(the_exec.a_data));
        data_siz = 0;
    }
  
--- 312,321 ----
        text_last_frag -> fr_next = data_frag_root;
      }
    else {
!       if (delayed_byteswap)
!         the_exec.a_text = 0;
!       else
!          md_number_to_chars((char *)&the_exec.a_data,0,sizeof(the_exec.a_data));
        data_siz = 0;
    }
  
*************** write_object_file()
*** 307,312 ****
--- 323,331 ----
  #ifdef SPARC
    local_bss_counter=(local_bss_counter+7)&(~7);
  #endif
+   if (delayed_byteswap)
+     the_exec.a_bss = local_bss_counter;
+   else
    md_number_to_chars((char *)&the_exec.a_bss,local_bss_counter,sizeof(the_exec.a_bss));
  
  	      
*************** write_object_file()
*** 364,372 ****
  	   used instead of 128. */
  		/* JF the \001 bit is to make sure that local labels
  		   ( 1: - 9: don't make it into the symtable either */
  #ifndef	VMS	/* Under VMS we need to keep local symbols */
  	if ( !name || (symbolP->sy_nlist.n_type&N_STAB)
! 	    || (name[0]!='\001' && (flagseen ['L'] || name [0] != 'L' )))
  #endif	/* not VMS */
  	  {
  	    symbolP -> sy_number = symbol_number ++;
--- 383,392 ----
  	   used instead of 128. */
  		/* JF the \001 bit is to make sure that local labels
  		   ( 1: - 9: don't make it into the symtable either */
+ 	/* mb at ttidca.tti.com: the 001 bit is in the 3rd byte, not the 1st! */
  #ifndef	VMS	/* Under VMS we need to keep local symbols */
  	if ( !name || (symbolP->sy_nlist.n_type&N_STAB)
! 	    || (name[2]!='\001' && (flagseen ['L'] || ! LOCAL_LABEL(name) )))
  #endif	/* not VMS */
  	  {
  	    symbolP -> sy_number = symbol_number ++;
*************** write_object_file()
*** 388,393 ****
--- 408,416 ----
        }				/* for each symbol */
  
      syms_siz = sizeof( struct nlist) * symbol_number;
+   if (delayed_byteswap)
+     the_exec.a_syms = syms_siz;
+   else
      md_number_to_chars((char *)&the_exec.a_syms,syms_siz,sizeof(the_exec.a_syms));
      /* the_exec . a_syms = sizeof( struct nlist) * symbol_number; */
    }
*************** write_object_file()
*** 559,570 ****
      = sizeof(struct relocation_info) * fixup_segment (data_fix_root, N_DATA); */
  
    tr_siz=sizeof(struct relocation_info) * fixup_segment (text_fix_root, N_TEXT);
-   md_number_to_chars((char *)&the_exec.a_trsize, tr_siz ,sizeof(the_exec.a_trsize));
    dr_siz=sizeof(struct relocation_info) * fixup_segment (data_fix_root, N_DATA);
-   md_number_to_chars((char *)&the_exec.a_drsize, dr_siz, sizeof(the_exec.a_drsize));
-   md_number_to_chars((char *)&the_exec.a_magic,omagic,sizeof(the_exec.a_magic));
-   md_number_to_chars((char *)&the_exec.a_entry,0,sizeof(the_exec.a_entry));
  
  #ifdef EXEC_MACHINE_TYPE
    md_number_to_chars((char *)&the_exec.a_machtype, EXEC_MACHINE_TYPE, sizeof(the_exec.a_machtype));
  #endif
--- 582,603 ----
      = sizeof(struct relocation_info) * fixup_segment (data_fix_root, N_DATA); */
  
    tr_siz=sizeof(struct relocation_info) * fixup_segment (text_fix_root, N_TEXT);
    dr_siz=sizeof(struct relocation_info) * fixup_segment (data_fix_root, N_DATA);
  
+   if (delayed_byteswap)
+   {
+     the_exec.a_trsize = tr_siz;
+     the_exec.a_drsize = dr_siz;
+     the_exec.a_magic = omagic;
+     the_exec.a_entry = 0;
+   }
+   else
+     {
+       md_number_to_chars((char *)&the_exec.a_trsize, tr_siz ,sizeof(the_exec.a_trsize));
+       md_number_to_chars((char *)&the_exec.a_drsize, dr_siz, sizeof(the_exec.a_drsize));
+       md_number_to_chars((char *)&the_exec.a_magic,omagic,sizeof(the_exec.a_magic));
+       md_number_to_chars((char *)&the_exec.a_entry,0,sizeof(the_exec.a_entry));
+     }
  #ifdef EXEC_MACHINE_TYPE
    md_number_to_chars((char *)&the_exec.a_machtype, EXEC_MACHINE_TYPE, sizeof(the_exec.a_machtype));
  #endif
*************** write_object_file()
*** 624,632 ****
  
        temp = symbolP -> sy_nlist . n_un . n_name;
        /* JF fix the numbers up. Call by value RULES! */
!       md_number_to_chars((char *)&(symbolP -> sy_nlist  . n_un . n_strx ),symbolP -> sy_name_offset,sizeof(symbolP -> sy_nlist  . n_un . n_strx ));
!       md_number_to_chars((char *)&(symbolP->sy_nlist.n_desc),symbolP->sy_nlist.n_desc,sizeof(symbolP -> sy_nlist  . n_desc));
!       md_number_to_chars((char *)&(symbolP->sy_nlist.n_value),symbolP->sy_nlist.n_value,sizeof(symbolP->sy_nlist.n_value));
        /* symbolP -> sy_nlist  . n_un . n_strx = symbolP -> sy_name_offset; JF replaced by md above */
        if (symbolP -> sy_type == N_UNDF)
  	  symbolP -> sy_type |= N_EXT; /* Any undefined symbols become N_EXT. */
--- 657,675 ----
  
        temp = symbolP -> sy_nlist . n_un . n_name;
        /* JF fix the numbers up. Call by value RULES! */
!       if (delayed_byteswap)
!       {
!         symbolP -> sy_nlist  . n_un . n_strx = symbolP -> sy_name_offset;
! 	symbolP->sy_nlist.n_desc = symbolP->sy_nlist.n_desc;
! 	symbolP->sy_nlist.n_value = symbolP->sy_nlist.n_value;
!       }
!       else
!       {
!         md_number_to_chars((char *)&(symbolP -> sy_nlist  . n_un . n_strx ),symbolP -> sy_name_offset,sizeof(symbolP -> sy_nlist  . n_un . n_strx ));
! 	md_number_to_chars((char *)&(symbolP->sy_nlist.n_desc),symbolP->sy_nlist.n_desc,sizeof(symbolP -> sy_nlist  . n_desc));
! 	md_number_to_chars((char *)&(symbolP->sy_nlist.n_value),symbolP->sy_nlist.n_value,sizeof(symbolP->sy_nlist.n_value));
!       }
! 
        /* symbolP -> sy_nlist  . n_un . n_strx = symbolP -> sy_name_offset; JF replaced by md above */
        if (symbolP -> sy_type == N_UNDF)
  	  symbolP -> sy_type |= N_EXT; /* Any undefined symbols become N_EXT. */
*************** write_object_file()
*** 641,647 ****
     * Find strings by crawling along symbol table chain.
     */
  /* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
!   md_number_to_chars((char *)&string_byte_count, string_byte_count, sizeof(string_byte_count));
  
    append (& next_object_file_charP, (char *)&string_byte_count, (unsigned long)sizeof(string_byte_count));
    for (   symbolP = symbol_rootP;   symbolP;   symbolP = symbolP -> sy_next   )
--- 684,691 ----
     * Find strings by crawling along symbol table chain.
     */
  /* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
!   if ( ! delayed_byteswap )
!     md_number_to_chars((char *)&string_byte_count, string_byte_count, sizeof(string_byte_count));
  
    append (& next_object_file_charP, (char *)&string_byte_count, (unsigned long)sizeof(string_byte_count));
    for (   symbolP = symbol_rootP;   symbolP;   symbolP = symbolP -> sy_next   )
*************** write_object_file()
*** 655,660 ****
--- 699,707 ----
  
    know( next_object_file_charP == the_object_file + size_of_the_object_file );
  
+   if (flagseen['C'])		/* write a.out in COFF format */
+     convert_to_coff (&the_object_file, &size_of_the_object_file);
+ 
    output_file_append (the_object_file, size_of_the_object_file, out_file_name);
  
  #ifdef DONTDEF
*************** emit_relocations (fixP, segment_address_
*** 1203,1209 ****
  	    Thus we need a machine dependent routine to make
  	    sure the structure is written out correctly.  FUN!
  	   */
! 	  md_ri_to_chars((char *) &ri, ri); 
  	  append (&next_object_file_charP, (char *)& ri, (unsigned long)sizeof(ri));
  	}
      }
--- 1250,1257 ----
  	    Thus we need a machine dependent routine to make
  	    sure the structure is written out correctly.  FUN!
  	   */
! 	  if ( ! delayed_byteswap)
!   	    md_ri_to_chars((char *) &ri, ri); 
  	  append (&next_object_file_charP, (char *)& ri, (unsigned long)sizeof(ri));
  	}
      }



More information about the Comp.unix.i386 mailing list