From 02bdbd8b5d07c4747b46e0f35698f431eca83abd Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor <ian@airs.com>
Date: Tue, 26 Aug 1997 16:25:03 +0000
Subject: 	* config/tc-i386.c (md_assemble): In JumpByte case, when
 looking 	for a WORD_PREFIX_OPCODE, change it to ADDR_PREFIX_OPCODE if
 this 	is jcxz.

---
 gas/ChangeLog        |  8 +++++++-
 gas/config/tc-i386.c | 20 ++++++++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index b36bdde..7c0c9de 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,11 +1,17 @@
+Tue Aug 26 12:23:25 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+	* config/tc-i386.c (md_assemble): In JumpByte case, when looking
+	for a WORD_PREFIX_OPCODE, change it to ADDR_PREFIX_OPCODE if this
+	is jcxz.
+
 start-sanitize-v850
 Mon Aug 25 16:04:14 1997  Nick Clifton  <nickc@cygnus.com>
 
 	* config/tc-v850.c (pre_defined_registers): Add 'hp' as alias for
 	r2.
 	(md_begin): Set up machine architecture and type.
-end-sanitize-v850
 
+end-sanitize-v850
 Mon Aug 25 14:25:48 1997  Ian Lance Taylor  <ian@cygnus.com>
 
 	* symbols.c (resolve_symbol_value): Store the value back into the
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index db88f6c..20a4f4e 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -433,7 +433,7 @@ const pseudo_typeS md_pseudo_table[] =
 #ifndef I386COFF
   {"bss", s_bss, 0},
 #endif
-#ifndef OBJ_AOUT
+#if !defined(OBJ_AOUT) && !defined(USE_ALIGN_PTWO)
   {"align", s_align_bytes, 0},
 #else
   {"align", s_align_ptwo, 0},
@@ -1728,7 +1728,23 @@ md_assemble (line)
 	  {
 	    if (*q == WORD_PREFIX_OPCODE)
 	      {
-	        FRAG_APPEND_1_CHAR (WORD_PREFIX_OPCODE);
+		/* The jcxz/jecxz instructions are marked with Data16
+		   and Data32, which means that they may get
+		   WORD_PREFIX_OPCODE added to the list of prefixes.
+		   However, the are correctly distinguished using
+		   ADDR_PREFIX_OPCODE.  Here we look for
+		   WORD_PREFIX_OPCODE, and actually emit
+		   ADDR_PREFIX_OPCODE.  This is a hack, but, then, so
+		   is the instruction itself.
+
+		   I don't know if there is any valid case in which we
+		   want to emit WORD_PREFIX_OPCODE, but I am keeping
+		   the old behaviour for safety.  */
+
+		if (IS_JUMP_ON_CX_ZERO (t->base_opcode))
+		  FRAG_APPEND_1_CHAR (ADDR_PREFIX_OPCODE);
+		else
+		  FRAG_APPEND_1_CHAR (WORD_PREFIX_OPCODE);
 	        insn_size += 1;
 		break;
 	      }
-- 
cgit v1.1