[gnu.utils.bug] gas 1.32 bugs on National 32532

taylor@THINK.COM (04/10/89)

The diffs below fix some minor problems when using gas to cross assemble
for the Nat'l Semi '532.

To wit,

(1) It uses the wrong op-code for the deiw instruction.  It should be
0x2dce rather than 0x2bce.

(2) It doesn't assemble the dotf, dotl, logbf, logbl, polyf, polyl,
scalbf, and scalbl instructions of the NS32381.

(3) It assumes you're assembling for the '032 and requires source
modifications to compile it for the '532.

(4) It uses '*' for location counter inside ns32k.c, but the rest of the
assembler uses '.'.  With the result that the use of '*' results in a
syntax error.

(5) obstack.h and obstack.c contain syntax errors.

(6) The C compiler complains (fatal error) about a redeclaration of
`equals' in file read.c on a Sun4.

However, there are some more serious problems that these diffs don't
fix, namely:

(7) Instructions that use pc-relative addressing, (e.g. the branch
instructions) are incorrectly assembled.

(8) When using external addressing mode, disp2 must be specified.
That is, an address of `ext(8)+80' will be correctly assembled, but
`ext(8)' will not be.

If anyone has fixes for either of the above, I'd appreciate hearing
about them.

Here are the diffs for 1-6.

RCS file: RCS/ns32k-opcode.h,v
retrieving revision 1.1
diff -c2 -r1.1 ns32k-opcode.h
*** /tmp/,RCSt1a16978	Mon Apr 10 00:35:35 1989
--- ns32k-opcode.h	Mon Apr 10 00:35:27 1989
***************
*** 176,180 ****
    { "cxpd",	11,16,	0x07f,	"1D",		4,	"",	20,21	},
    { "deib",	14,24,	0x2cce,	"1B2W",		1,	"",	20,21	},
!   { "deiw",	14,24,	0x2bce,	"1W2D",		2,	"",	20,21	},
    { "deid",	14,24,	0x2fce,	"1D2Q",		4,	"",	20,21	},
    { "dia",	 8,8,	0xc2,	"",		1,	"",	20,21	},
--- 176,180 ----
    { "cxpd",	11,16,	0x07f,	"1D",		4,	"",	20,21	},
    { "deib",	14,24,	0x2cce,	"1B2W",		1,	"",	20,21	},
!   { "deiw",	14,24,	0x2dce,	"1W2D",		2,	"",	20,21	},
    { "deid",	14,24,	0x2fce,	"1D2Q",		4,	"",	20,21	},
    { "dia",	 8,8,	0xc2,	"",		1,	"",	20,21	},
***************
*** 397,401 ****
    { "xorb",	 6,16,	0x38,	"1B2B",		1,	"",	20,21	},
    { "xorw",	 6,16,	0x39,	"1W2W",		2,	"",	20,21	},
!   { "xord",	 6,16,	0x3b,	"1D2D",		4,	"",	20,21	}
  };
  
--- 397,412 ----
    { "xorb",	 6,16,	0x38,	"1B2B",		1,	"",	20,21	},
    { "xorw",	 6,16,	0x39,	"1W2W",		2,	"",	20,21	},
!   { "xord",	 6,16,	0x3b,	"1D2D",		4,	"",	20,21	},
! 
! #if defined(NS32381)	/* I'm not too sure of these */
!   { "dotf",	14,24,  0x0dfe, "1F2F",		4,	"",	20,21	},
!   { "dotl",	14,24,  0x0cfe, "1L2L",		8,	"",	20,21	},
!   { "logbf",	14,24,  0x15fe, "1F2F",		4,	"",	20,21	},
!   { "logbl",	14,24,  0x14fe, "1L2L",		8,	"",	20,21	},
!   { "polyf",	14,24,  0x09fe, "1F2F",		4,	"",	20,21	},
!   { "polyl",	14,24,  0x08fe, "1L2L",		8,	"",	20,21	},
!   { "scalbf",	14,24,  0x11fe, "1F2F",		4,	"",	20,21	},
!   { "scalbl",	14,24,  0x10fe, "1L2L",		8,	"",	20,21	},
! #endif
  };
  
===================================================================
RCS file: RCS/ns32k.c,v
retrieving revision 1.1
diff -c2 -r1.1 ns32k.c
*** /tmp/,RCSt1a16978	Mon Apr 10 00:35:36 1989
--- ns32k.c	Sun Apr  9 01:22:45 1989
***************
*** 227,230 ****
--- 227,234 ----
  };
  
+ #if !defined(NS32032) && !defined(NS32532)
+ #define NS32032
+ #endif
+ 
  #ifdef NS32532
  struct option cpureg[]= /* lpr spr */
***************
*** 257,261 ****
  };
  #endif
! #define NS32032
  #ifdef NS32032
  struct option cpureg[]= /* lpr spr */
--- 261,265 ----
  };
  #endif
! 
  #ifdef NS32032
  struct option cpureg[]= /* lpr spr */
***************
*** 386,390 ****
      addr_modeP->disp[0]=str+1;
      return (-1);
!   case '*':
      if (str[strl-1]!=']') {
        switch (str[1]) {
--- 390,394 ----
      addr_modeP->disp[0]=str+1;
      return (-1);
!   case '.':
      if (str[strl-1]!=']') {
        switch (str[1]) {
***************
*** 1035,1039 ****
  		/* this may only happens in a long suffixed instruction */
  		bzero(memP,size); /* size normally is 8 */
! 		if (k*2>size) as_warn("Bignum to big for long");
  		if (k==3) memP+=2;
  		for (l=0;k>0;k--,l+=2) {
--- 1039,1043 ----
  		/* this may only happens in a long suffixed instruction */
  		bzero(memP,size); /* size normally is 8 */
! 		if (k*2>size) as_warn("Bignum too big for long");
  		if (k==3) memP+=2;
  		for (l=0;k>0;k--,l+=2) {
===================================================================
RCS file: RCS/obstack.c,v
retrieving revision 1.1
diff -c2 -r1.1 obstack.c
*** /tmp/,RCSt1a16978	Mon Apr 10 00:35:38 1989
--- obstack.c	Fri Apr  7 01:02:22 1989
***************
*** 1,3 ****
! /* obstack.c - subroutines used implicitly by object stack macros */
     Copyright (C) 1988 Free Software Foundation, Inc.
  
--- 1,3 ----
! /* obstack.c - subroutines used implicitly by object stack macros
     Copyright (C) 1988 Free Software Foundation, Inc.
  
===================================================================
RCS file: RCS/obstack.h,v
retrieving revision 1.1
diff -c2 -r1.1 obstack.h
*** /tmp/,RCSt1a16978	Mon Apr 10 00:35:40 1989
--- obstack.h	Fri Apr  7 01:00:55 1989
***************
*** 1,3 ****
! /* obstack.h - object stack macros */
     Copyright (C) 1988 Free Software Foundation, Inc.
  
--- 1,3 ----
! /* obstack.h - object stack macros
     Copyright (C) 1988 Free Software Foundation, Inc.
  
===================================================================
RCS file: RCS/read.c,v
retrieving revision 1.1
diff -c2 -r1.1 read.c
*** /tmp/,RCSt1a16978	Mon Apr 10 00:35:41 1989
--- read.c	Fri Apr  7 01:00:00 1989
***************
*** 247,250 ****
--- 247,251 ----
    void gdb_block_end();
    void gdb_symbols_fixup();
+   void equals();
  
    subseg_new (SEG_TEXT, 0);
===================================================================
David
--
David Taylor
taylor@think.com, ...!think!taylor