This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[short@ucw.cz: GAS i386 jmp generator .arch compliance [PATCH]]


----- Forwarded message from Jan Kratochvil <short@ucw.cz> -----

Delivered-To: alias-freesoft-hubicka@freesoft.cz
Date: Sun, 11 Feb 2001 17:10:09 +0100
From: Jan Kratochvil <short@ucw.cz>
To: hubicka@freesoft.cz
Subject: GAS i386 jmp generator .arch compliance  [PATCH]
X-Mailer: Mutt 1.0pre2i

Hi

You have advised me the use of nice GAS '.arch i8086' keyword which works nice
for the standard instruction set.

Unfortunately GAS still silently produces 32-bit conditional jumps which are
available only on 386 and higher - the attached simple patch fixes this
behaviour and gives proper warnings in such case.

suggested commit msg:
		32-bit conditional jumps availability checked by .arch mode



						Regards,
							Lace


P.S.: I wanted to post it to some developer which is most involved with
development 'gas/config/tc-i386.c' in the recent days but it was ... ehm...
You.  :-)

Index: gas/config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.83
diff -u -r1.83 tc-i386.c
--- tc-i386.c	2001/01/17 23:41:35	1.83
+++ tc-i386.c	2001/02/11 15:58:43
@@ -3856,6 +3856,17 @@
   return 1;			/* Normal return.  */
 }
 
+static void
+warn_long_jump (fragP)
+     register fragS *fragP;
+{
+  if (cpu_arch_flags & Cpu386)
+    return;
+  as_warn_where (fragP->fr_file, fragP->fr_line,
+		 _("long jump is not supported on `%s'"),
+		 cpu_arch_name);
+}
+
 /* md_estimate_size_before_relax()
 
    Called just before relax() for rs_machine_dependent frags.  The x86
@@ -3921,6 +3932,7 @@
 	default:
 	  /* This changes the byte-displacement jump 0x7N
 	     to the dword-displacement jump 0x0f,0x8N.  */
+	  warn_long_jump (fragP);
 	  opcode[1] = opcode[0] + 0x10;
 	  opcode[0] = TWO_BYTE_OPCODE_ESCAPE;
 	  /* We've added an opcode byte.  */
@@ -3995,6 +4007,7 @@
       break;
 
     case ENCODE_RELAX_STATE (COND_JUMP, BIG):
+      warn_long_jump (fragP);
       extension = 5;		/* 2 opcode + 4 displacement  */
       opcode[1] = opcode[0] + 0x10;
       opcode[0] = TWO_BYTE_OPCODE_ESCAPE;
@@ -4008,6 +4021,7 @@
       break;
 
     case ENCODE_RELAX_STATE (COND_JUMP, BIG16):
+      warn_long_jump (fragP);
       extension = 3;		/* 2 opcode + 2 displacement  */
       opcode[1] = opcode[0] + 0x10;
       opcode[0] = TWO_BYTE_OPCODE_ESCAPE;




----- End forwarded message -----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]