🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1187

gas-1.38.1 (sparc) incorrectly translating unimp

#1187
From: krussell
Date: Wed, 30 Dec 1992 07:05
77 lines
2901 bytes
gas-1.38.1
SparcStation 2
SunOS 4.1.1

I believe I have found a bug in gas-1.38.1 (and perhaps older
versions of gas as well).  If you run into an "Invalid Instruction"
error when executing a program assembled with gas, try patching gas
with the appended patch.  This bug bit me when I attempted to
build "perl-4.035" (I got an error when testing the "dbm" routines).

BUG SYNOPSIS
------------

  The "unimp const22" instruction is incorrectly translated in
  some cases.  The Sun-4 Assembly Language Reference Manual states:

      UNIMP         unimp   const22       Unimplemented instruction

  where gas-1.38.1 implies

      UNIMP         unimp   label         Unimplemented instruction

  The gas-1.38.1 implementation results in "22 bit PC relative
  immediate" addressing when "unimp n" is translated.  In some
  cases this can cause an "Invalid Instruction" error when the
  assembled program is run.

  The appended patch creates a new addressing mode (new for gas)
  called "22 bit Immediate" and instructs gas to use this mode
  when translating "unimp n".

BUG FIX
-------

diff -Nrc2 gas-1.38.1/sparc-opcode.h gas/sparc-opcode.h
*** gas-1.38.1/sparc-opcode.h	Thu Jun  7 14:22:10 1990
--- gas/sparc-opcode.h	Tue Dec 29 11:14:10 1992
***************
*** 59,62 ****
--- 59,63 ----
     h    22 high bits.
     i    13 bit Immediate.
+    I    22 bit Immediate.
     l    22 bit PC relative immediate.
     L    30 bit PC relative immediate.
***************
*** 498,502 ****
  { "tsubcctv",   0x80582000, 0x40a00000, "1,i,d", 0 },
  
! { "unimp",      0x00000000, 0x00000000, "l", 0 },
  
  { "iflush",     0x81d80000, 0x40202000, "1+2", 0 },
--- 499,503 ----
  { "tsubcctv",   0x80582000, 0x40a00000, "1,i,d", 0 },
  
! { "unimp",      0x00000000, 0x00000000, "I", 0 },
  
  { "iflush",     0x81d80000, 0x40202000, "1+2", 0 },
diff -Nrc2 gas-1.38.1/sparc.c gas/sparc.c
*** gas-1.38.1/sparc.c	Mon Oct 22 12:04:04 1990
--- gas/sparc.c	Tue Dec 29 11:20:11 1992
***************
*** 678,681 ****
--- 678,685 ----
  	    case 'i':   /* 13 bit immediate */
  	        the_insn.reloc = RELOC_BASE13;
+ 	        goto immediate;
+ 
+ 	    case 'I':   /* 22 bit immediate */
+ 	        the_insn.reloc = RELOC_BASE22;
  
  		/*FALLTHROUGH*/

--

Kevin Russell (DND/DRES/DTD/MSS/TDG)                    krussell@dres.dnd.ca
(403) 544-4736     DRE Suffield, Box 4000, Medicine Hat, AB, Canada, T1A 8K6
Technical Details
Message-ID: <199212302105.AA20075@frodo.dres.dnd.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!dres.dnd.ca!krussell

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!dres.dnd.ca!krussell
From: krussell@dres.dnd.ca
Subject: gas-1.38.1 (sparc) incorrectly translating unimp
Message-ID: <199212302105.AA20075@frodo.dres.dnd.ca>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 30 Dec 1992 07:05:31 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 78