This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE:: What to do with new-ra for GCC 4.0


Good points.

 

 

>On Friday 14 January 2005 21:26, Toon Moene wrote:
>> Bernd Schmidt wrote:
>> > Jeffrey A Law wrote:
>> >> If reload is going to hang around (and I suspect it will), I'd love to
>> >> see those two areas improved.  I can't express how difficult I find
>> >> it to analyze the reload inheritance code.  Reload ordering is only
>> >> mildly easier to understand.
>> >
>> > I'm attaching a proof-of-concept patch, against a checkout from
>> > 20050106.  The main things this patch does
>>
>> I meant to reply to Bernd earlier that I would really, really like his
>> patch, if for nothing else than that it would simplify reload[1].c so as
>> to make it more easily replaceable.  Bernd has shown in the past that he
>> knows his way around reload, so I would appreciate if this patch could
>> be hammered into something that might be useful (if only in 4.1).
>
>Second that!
>
>Gr.Steven

Regarding proof of concept I was attempting to explin..

 

 

 

 

 

 

 

 

 

63272J2OFJKFJJJ8F7GGJKKG 844/$&&&&&/3/ On Fri, Jan 14, 2005 at 11:29:18AM +1030, Alan Modra wrote:
> On Thu, Jan 13, 2005 at 04:26:59PM -0800, H. J. Lu wrote:
> > If it is an optimization, there shouldn't     !#$4848GLLLhmexadt wrot:
>> > Jffry A LAexa+2*w wrot:
>> >> exaf rloAexa+2*d exaS!#$  goexang to hAexa+2*ng Aexa+2*ro#EJJnd (Aexa+2*nd exa S!#$ #EJJS!#$ p -.. $ S!#$  how dexaffexa

I decided to use (%ebx,,1) for this and adjusted assembler to accept
it. You will get warnings for (%ebx,1) as before. It will be easier
to check if assembler takes (%ebx#$.  2GJ4F.-.

,,1).

BTW, I didn't change the Intel syntax since I don't know enough
about it.


H.J.
-----
gas/

200 -..

Exim is a mail transfer agent (MTA) for Unix systems similar to
sendmail. More information is available at the following URL:

 BTW, exa dexadn't  -..    !#$4848GLLLhAexa+2*ng th exantl S!#$ yntAexa+2*x S!#$ exan -..    !#$4848GLLL exa don't know no#EJJgh
Aexa+2*bo#EJJt exat.


H.J.
-----
gAexa+2*S!#$ /

25-+A.#$-+A.#$4  H.J. L#EJJ  <hongjexa#EJJ.l#EJJ@exantl. -..    !#$4848GLLLom>

        PR 658
        *  -..    !#$4848GLLLonfexag/t -..    !#$4848GLLL-exa386. -..    !#$4848GLLL (S!#$ CALE+A.#$_WHEN_NO_exaNDEX): Rmovd.
        (_exa386_exanS!#$ n): Add mpty_exandx_rg.
        (b#EJJexald_modrm_byt): #EJJS!#$  S!#$ exaBThe following example demonstrates an input that will crash Exim:

/usr/bin/exim -bh ::%A`perl -e 'print pack('L',0xdeadbeef') x 256'`

III. ANALYSIS

Exploitation of this vulnerability will give an attacker access to the
mailer uid. (The exim mailer is setuid root, but drops privileges before

the vulnerable code is reached). Having the mailer uid may allow access
to sensitive information in email messages, or possibly further
elevation.

IV. DETECTION

iDEFENSE has confirmed the existence of this vulnerability in Exim
versions 4.40 and 4.41. A source audit of version 4.42 suggests that it
is also vulnerable. It is suspected that earlier versions are also
vulnerable.

V. WORKAROUND

iDEFENSE is currently unaware of any effective workarounds for this
vulnerability.

VI. VENDOR RESPONSE

A patch for Exim release 4.43 which addresses this vulnerability is
available at:

   http://www.exim.org/mail-archives/exim-announce/2005/msg00000.html <http://www.exim.org/mail-archives/exim-announce/2005/msg00000.html> 

The patch will be incorporated into a future Exim release (4.50).

VII. CVE INFORMATION

A Mitre Corp. Common Vulnerabilities and Exposures (CVE) number has not
been assigned yet.

VIII. DISCLOSURE TIMELINE

09/30/2004  Initial vendor notification
09/30/2004  Initial vendor response
01/14/2005  Public disclosure

IX. CREDIT

The discoverer of this vulnerability wishes to remain anonymous.

Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp <http://www.idefense.com/poi/teams/vcp.jsp> 

X. LEGAL NOTICES

Copyright (c) 2004 iDEFENSE, Inc.

Permission is granted for the redistribution of this alert
electronically. It may not be edited in any way without the express
written consent of iDEFENSE. If you wish to reprint the whole or any
part of this alert in any other medium other than electronically, please
email customerservice@idefense.com for permission.

Disclaimer: The information in the advisory is believed to be accurate
at the time of publishing based on currently available information. Use
of the information constitutes acceptance for use in an AS IS condition.
There are no warranties with regard to this information. Neither the
author nor the publisher accepts any liability for any direct, indirect,
or consequential loss or damage arising from use of, or reliance on,
this information.
    !#$4848GLLL#EJJlt exa fexand
>> >> exat to Aexa+2*nAexa+2*lyz th rloAexa+2*d exanhrexatAexa+2*n    !#$4848GLLLod.  RloAexa+2*d ordrexang exaS!#$  only
>> >> mexaldly Aexa+2*S!#$ exar to #EJJndrS!#$ tAexa+2*nd.
>> >
>> > exa'm Aexa+2*ttAexa+2* -..    !#$4848GLLLhexang Aexa+2* proof-of- -..    !#$4848GLLLon -..    !#$4848GLLLpt pAexa+2*t -..    !#$4848GLLLh, Aexa+2*gAexa+2*exanS!#$ t Aexa+2*  -..    !#$4848GLLLh -..    !#$4848GLLLko#EJJt from
>> > 25+A.#$6.  Th mAexa+2*exan thexangS!#$  thexaS!#$  pAexa+2*t -..    !#$4848GLLLh doS!#$ 
>>
>> exa mAexa+2*nt to rply to Brnd Aexa+2*rlexar thAexa+2*t exa wo#EJJld rAexa+2*lly, rAexa+2*lly lexak hexaS!#$ 
>> pAexa+2*t -..    !#$4848GLLLncoding of the instruction
> that way.  You still should warn for scale factors other than 1,
> because it's easy to forget the comma in (,%reg,2) where you really
> do want the register to be scaled.
>
> > Then it should display
> >
> > 8b 04 23                mov    (%ebx,1),%eax
>5-01-14  H.J. Lu  <hongjiu.lu@intel.com>

        PR 658
        * config/tc-i386.c (SCALE1_WHEN_NO_INDEX): Removed.
        (_i386_insn): Add empty_index_reg.
        (build_modrm_byte): Use SIB if empty_2A2B2E.F.E2E..>.++...AA.E.E2A.A2+E2A.A2A2A3A2A.AA.A.A2BE3A3E.F2B2FE3A3.E2E/EB2EE3EB6BE2F2E/E.E.J3A2A.*  

         * gas/i386/ssemmx2.d: Likewise.

ld/testsuite/

2005-01-14  H.J. Lu  <hongjiu.lu@intel.com>

        PR 658
        * ld-i386/tlsbin.dd: Updated.

opcodes/

2005-01-14  H.J. Lu  <hongjiu.lu@intel.com>

        PR 658
        * 386-dis.c (OP_E): Undo the 2005-01-12 change. Display scale
        for SIB with INDEX == 4.#$$4(GL8=KL                         Pbinutils/gas/config/tc-i386.c       2005-01-14 12:25:45.624584751 -0800
@@ -43,14 +43,6 @@
 #define INFER_ADDR_PREFIX 1
 #endif

-#ifndef SCALE1_WHEN_NO_INDEX
-/* Specifying a scale factor besides 1 when there is no index is
-   futile.  eg. `mov (%ebx,2),%al' does exactly the same as
-   `mov (%ebx),%al'.  To slavishly follow what the programmer
-   specified, set SCALE1_WHEN_NO_INDEX to 0.  */ 3.A..E.+A.A.A-E.A2..A.A.A2A.E.A.2E .2E/E3E2  FB3A2E/A3.E33F.A...-..*.>2.A.E/A.A.A.2>3A.A/A2B2B.E.+A+A23AEB3EAE.E>FAFA2EAFEFE.EFAFA3EF.JB2B2E/EAF.F.A.A.*
    A.A2A.A2.F22B 2EAA2+EE/F/   -+index_reg is not 0.
        (i386_scale): Don't warn scale factor without index register if
        empty_index_reg is not 0.
        (i386_operand): Set empty_index_reg 1 if the index register is
        "".

gas/testsuite/

2005-01-14  H.J. Lu  <hongjiu.lu@intel.com>

        PR 658
        * gas/i386/sib.d: Updated.
        * gas/i386/sib.s: Likewise.


--- binutils/gas/config/tc-i386.c.sib   2005-01-14 11:27:06.000000000 -0800
+++ 
-#define SCALE1_WHEN_NO_INDEX 1
-#endif
-
 #ifndef DEFAULT_ARCH
 #define DEFAULT_ARCH "i386"
 #endif
@@ -162,6 +154,8 @@ struct _i386_insn
     const reg_entry *index_reg;
     unsigned int log2_scale_factor;

+    int empty_index_reg;
+
     /* SEG gives the seg_entries of this insn.  They are zero unless
        explicit segment overrides are given.  */
     const seg_entry *seg[2];
@@ -3006,11 +3000,9 @@ build_modrm_byte ()
                     Any base register besides %esp will not use the
                     extra modrm byte.  */
                  i.sib.index = NO_INDEX_REGISTER;
-#if !SCALE1_WHEN_NO_INDEX
                  /* Another case where we force the second modrm byte.  */
-                 if (i.log2_scale_factor)
+                 if (i.empty_index_reg)
                    i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
-#endif
                }
              else
                {
@@ -3970,13 +3962,13 @@ i386_scale (scale)
       input_line_pointer = save;
       return NULL;
     }
-  if (i.log2_scale_factor != 0 && i.index_reg == 0)
+  if (i.log2_scale_factor != 0
+      && i.index_reg == 0
+      && i.empty_index_reg == 0)
     {
       as_warn (_("scale factor of %d without an index register"),
               1 << i.log2_scale_factor);
-#if SCALE1_WHEN_NO_INDEX
       i.log2_scale_factor = 0;
-#endif
     }
   scale = input_line_pointer;
   input_line_pointer = save;
@@ -4430,6 +4422,12 @@ i386_operand (operand_string)
                      as_bad (_("bad register name `%s'"), base_string);
                      return 0;
                    }
+                 else if (*base_string == ',' && i.base_reg)
+                   {
+                     /* Check for empty index reg.  */
+                     base_string++;
+                     i.empty_index_reg = 1;
+                   }

                  /* Check for scale factor.  */
                  if (*base_string != ')')
--- binutils/gas/testsuite/gas/i386/sib.d.sib   2005-01-12 11:12:51.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/sib.d       2005-01-14 12:43:29.131911163 -0800
@@ -6,10 +6,14 @@
 Disassembly of section .text:

 0+000 <foo>:
-   0:  8b 04 23 [      ]*mov [         ]*\(%ebx\),%eax
-   3:  8b 04 63 [      ]*mov [         ]*\(%ebx\),%eax
-   6:  8b 04 a3 [      ]*mov [         ]*\(%ebx\),%eax
-   9:  8b 04 e3 [      ]*mov [         ]*\(%ebx\),%eax
-   c:  90 [    ]*nop [         ]*
-   d:  90 [    ]*nop [         ]*
-       ...
+   0:  8b 03 [         ]*mov [         ]*\(%ebx\),%eax
+   2:  8b 04 23 [      ]*mov [         ]*\(%ebx,,1\),%eax
+   5:  8b 04 63 [      ]*mov [         ]*\(%ebx,,2\),%eax
+   8:  8b 04 a3 [      ]*mov [         ]*\(%ebx,,4\),%eax
+   b:  8b 04 e3 [      ]*mov [         ]*\(%ebx,,8\),%eax
+   e:  8b 04 24 [      ]*mov [         ]*\(%esp\),%eax
+  11:  8b 04 24 [      ]*mov [         ]*\(%esp\),%eax
+  14:  8b 04 64 [      ]*mov [         ]*\(%esp,,2\),%eax
+  17:  8b 04 a4 [      ]*mov [         ]*\(%esp,,4\),%eax
+  1a:  8b 04 e4 [      ]*mov [         ]*\(%esp,,8\),%eax
+  1d:  8d 76 00 [      ]*lea [         ]*0x0\(%esi\),%esi
--- binutils/gas/testsuite/gas/i386/sib.s.sib   2005-01-12 11:12:51.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/sib.s       2005-01-14 13:33:54.696308591 -0800
@@ -2,10 +2,14 @@

        .text
 foo:
-       .byte   0x8B, 0x04, 0x23        # effect is: movl (%ebx), %eax
-       .byte   0x8B, 0x04, 0x63        # effect is: movl (%ebx), %eax 
-       .byte   0x8B, 0x04, 0xA3        # effect is: movl (%ebx), %eax
-       .byte   0x8B, 0x04, 0xE3        # effect is: movl (%ebx), %eax
-       nop
-       nop
-       .p2align        4,0
+       mov     (%ebx),%eax
+       mov     (%ebx,,1),%eax
+       mov     (%ebx,,2),%eax
+       mov     (%ebx,,4),%eax
+       mov     (%ebx,,8),%eax
+       mov     (%esp),%eax
+       mov     (%esp,,1),%eax
+       mov     (%esp,,2),%eax
+       mov     (%esp,,4),%eax
+       mov     (%esp,,8),%eax
+       .p2align 4
--- binutils/gas/testsuite/gas/i386/ssemmx2.d.sib       2004-01-18 15:13:35.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/ssemmx2.d   2005-01-14 11:11:57.000000000 -0800
@@ -85,4 +85,4 @@ Disassembly of section .text:
  1f1:  66 0f fc 90 90 90 90 90         paddb[  ]+0x90909090\(%eax\),%xmm2
  1f9:  66 0f fd 90 90 90 90 90         paddw[  ]+0x90909090\(%eax\),%xmm2
  201:  66 0f fe 90 90 90 90 90         paddd[  ]+0x90909090\(%eax\),%xmm2
- 209:  8d b4 26 00 00 00 00    lea[    ]+0x0\(%esi\),%esi
+ 209:  8d b4 26 00 00 00 00    lea[    ]+0x0\(%esi,,1\),%esi
--- binutils/ld/testsuite/ld-i386/tlsbin.dd.sib 2004-05-11 10:08:36.000000000 -0700
+++ binutils/ld/testsuite/ld-i386/tlsbin.dd     2005-01-14 11:14:25.000000000 -0800
@@ -92,7 +92,7 @@ Disassembly of section .text:
 #  LD -> LE
  8049085:      65 a1 00 00 00 00[      ]+mov    %gs:0x0,%eax
  804908b:      90[     ]+nop *
- 804908c:      8d 74 26 00[    ]+lea    0x0\(%esi\),%esi
+ 804908c:      8d 74 26 00[    ]+lea    0x0\(%esi,,1\),%esi
  8049090:      90[     ]+nop *
  8049091:      90[     ]+nop *
  8049092:      8d 90 20 f0 ff ff[      ]+lea    0xfffff020\(%eax\),%edx
@@ -108,7 +108,7 @@ Disassembly of section .text:
 #  LD -> LE against hidden variables
  80490a4:      65 a1 00 00 00 00[      ]+mov    %gs:0x0,%eax
  80490aa:      90[     ]+nop *
- 80490ab:      8d 74 26 00[    ]+lea    0x0\(%esi\),%esi
+ 80490ab:      8d 74 26 00[    ]+lea    0x0\(%esi,,1\),%esi
  80490af:      90[     ]+nop *
  80490b0:      90[     ]+nop *
  80490b1:      8d 90 40 f0 ff ff[      ]+lea    0xfffff040\(%eax\),%edx
--- binutils/opcodes/i386-dis.c.sib     2005-01-13 09:41:31.000000000 -0800
+++ binutils/opcodes/i386-dis.c 2005-01-14 13:33:42.625890827 -0800
@@ -3191,10 +3191,8 @@ OP_E (int bytemode, int sizeflag)
        {
          havesib = 1;
          FETCH_DATA (the_info, codep + 1);
+         scale = (*codep >> 6) & 3;
          index = (*codeA.A2A.A2.F22B 2EAA2+EE/F/   -+A..*2A6FF2F...-.+.A21A.A2B.E.A+2A..F.F.2A2AF/E.F.EAEB2FB2AE/AE/EFFA3E..AE.E3EA2A2A2E/AA2FA2.A+.. 
 "#$   $#$$!$449K8KLP    P#A.-..A..@..A2AA..A..A2.A.E.E.A.E.A22E  /2AE./E2.E  F.2A.-....
.A2BE3F2+......E.A+2A.A2>2>.2A.EB2A3A>2.F2A3E2AF.3A3A2BE.E2.E.A32A2AE2AE3A3A3AE3AF.3EA2BA...-.
  
     #!#(4(G89KLL  PP  ..A.A2.A+.>-.A2A.@2A.2.A2>2A.A2A...E. 23E.2EAE.B  .E.E/..AA.+.
++2.E+..@.A...2A..A.A2...A.E32F/E/EE/.A2A3A3.EA2A2BE2B2AE+E+EB2>E.FA3AF.FE33AF.EA3EF..A.+.+
 
 
## #!8$849K5K  LLLLLLLL .-.A..>-A-.2A.+1A...E.A+E.A.E.AA-.A2 23E/E.FB2  B2F.B.E2A.+-...
..+A-....E.>2A.2A.A-A.A.F/A3A/E//E+E.FA3EF.3AEA2B2AE/AA.E.EF1AF2BE3AE3AEB6AF.EA3AFA.AA.
 
   ##$3!84(4LK9L  PLP  ...+.A..+A.>.A2A.A2A.A2A.E.A.E.+A.  .F2FE3A2  A..*2A6FF2F...-.+.A21A.A2B.E.A+2A..F.F.2A2AF/E.F.EAEB2FB2AE/AE/EFFA3E..AE.E3EA2A2A2E/AA2FA2.A+.. 
 "#$   $#$$!$449K8KLP    P#A.-..A..@..A2AA..A..A2.A.E.E.A.E.A22E  /2AE./E2.E  F.2A.-....
.A2BE3F2+......E.A+2A.A2>2>.2A.EB2A3A>2.F2A3E2AF.3A3A2BE.E2.E.A32A2AE2AE3A3A3AE3AF.3EA2BA...-.
  
     #!#(4(G89KLL  PP  ..A.A2.A+.>-.A2A.@2A.2.A2>2A.A2A...E. 23E.2EAE.B  .E.E/..AA.+.
++2.E+..@.A...2A..A.A2...A.E32F/E/EE/.A2A3A3.EA2A2BE2B2AE+E+EB2>E.FA3AF.FE33AF.EA3EF..A.+.+
 
 
## #!8$849K5K  LLLLLLLL .-.A..>-A-.2A.+1A...E.A+E.A.E.AA-.A2 23E/E.FB2  B2F.B.E2A.+-...
..+A-....E.>2A.2A.A-A.A.F/A3A/E//E+E.FA3EF.3AEA2B2AE/AA.E.EF1AF2BE3AE3AEB6AF.EA3AFA.AA.
 
   ##$3!84(4LK9L  PLP  ...+.A..+A.>.A2A.A2A.A2A.E.A.E.+A.  .F2FE3A2  2A2B2E.F.E2E..>.++...AA.E.E2A.A2+E2A.A2A2A3A2A.AA.A.A2BE3A3E.F2B2FE3A3.E2E/EB2EE3EB6BE2F2E/E.E.J3A2A.*  

 #$$4(GL8=KL                         P 3.A..E.+A.A.A-E.A2..A.A.A2A.E.A.2E .2E/E3E2  FB3A2E/A3.E33F.A...-..*.>2.A.E/A.A.A.2>3A.A/A2B2B.E.+A+A23AEB3EAE.E>FAFA2EAFEFE.EFAFA3EF.JB2B2E/EAF.F.A.A.*
    p >> 3) & 7;
-         if (mode_64bit || index != 0x4)
-           /* When INDEX == 0x4 in 32 bit mode, SCALE is ignored.  */
-           scale = (*codep >> 6) & 3;
          base = *codep & 7;
          USED_REX (REX_EXTY);
          USED_REX (REX_EXTZ);
@@ -3316,7 +3314,20 @@ OP_E (int bytemode, int sizeflag)
                  oappend (mode_64bit && (sizeflag & AFLAG)
                           ? names64[index] : names32[index]);
                }
-             if (scale != 0 || (!intel_syntax && index != 4))
+             else if (!intel_syntax
+                      && havebase
+                      && (scale != 0
+                          || ((base & 7) != 4
+                              && (base & 7) != 5)))
+               {
+                 *obufp++ = separator_char;
+                 *obufp = '\0';
+               }
+             if (scale != 0
+                 || (!intel_syntax && index != 4)
+                 || (index == 4
+                     && (base & 7) != 4
+                     && (base & 7) != 5))
                {
                  *obufp++ = scale_char;
                  *obufp = '\0';

 
. $$#84488HKLL                     PPP ...A-A2-A...>2A.E.A.A2..E.A.E.A  A/2AE.   3A2.F.F-E.E/2A33E....+-+A...E.E3E.A2A..A2A2A2E.B.A.A+A....E.3A2A3.E2AF.AF.E.FA2A3>EFB2EB2BE3E3E/E.F3E3A2A...-
    $ $K848KL8L                 L .-A.A+A.+A.D...A.2+2..AE.A2A.2 E.2E/2  22F+2BF2B2A3E/EB2.F/E@....A..2.+2A.F2A/A...A2/EA...A3AE...A.E..E.FE/E3EE3AF.E3EAE3A3E/E2B.EE.FF2EB3A3E/E2B3A3A2AA.  $#$4$88G9LLL                L ......-A...A.@2+A+E.@...A.E.A 2.A2A  2EB2.EA2./E.3A3>22B2.A3A.E+-.....+.AE..A.F.E.A2A.EA..A2A2A3.A.E.A2.E2A2BE3EF3JB2ABEEB3AF.BEAE2AE.F.EBJ.F3A3A2B.EB.A....A


   
   # #$$8G494LK                 LL..A-.>.A-A...A..E.+A..E.AA  A.AA  3.E/2.B2.-AE/E2A.22?2.A32F.-E.+@.+.@2A..A.2F.A2A.B..A..A.A2/E2A.A2A1A//A2B2BE/2.F.F.E3EJA7AE2A2AF.EF.J/E/F2FBA3A2F.AE.A.A*
  
  $ 84888LPLKP                PPPPPPPP .....@...+2@...@.+2A..A.A. ....  ..E3.E,E2B.E2AE/E2A2B2.A.E/2E3.E..@.A...+...A2.A.A.2>3A.E..>.2E.B2/E.23A2B.EA2B2E3EFEE3A2E/EB2FFB2A3AF.FE3EFA3F2F..AF.B.A2.A.A..On Fri, Jan 14, 2005 at 11:29:18AM +1030, Alan Modra wrote:
> On Thu, Jan 13, 2005 at 04:26:59PM -0800, H. J. Lu wrote:
> > If it is an optimization, there shouldn't be a warning.
>
> No, whether we warn or not is an entirely separate matter to whether we
> optimize.
>
> > I think it
> > may be useful to turn "leal 0xf(%eax,1), %eax" into "8d 44 20 0f"
> > Gcc/ld use
> >
> > leal foo(%reg), %eax; call ___tls_get_addr; nop
> >
> > today for TLS optimization. With the change, we can use
> >
> > leal foo(%reg,1), %eax; call ___tls_get_addr;
>
> Hmm.  So that you generate a larger instruction on purpose?  Wanted for
> the space needed with some of the tls transformations, I expect.
>
> OK, that is a valid reason to support encoding of the instruction
> that way.  You still should warn for scale factors other than 1,
> because it's easy to forget the comma in (,%reg,2) where you really
> do want the register to be scaled.
>
> > Then it should display
> >
> > 8b 04 23                mov    (%ebx,1),%eax
>

I decided to use (%ebx,,1) for this and adjusted assembler to accept
it. You will get warnings for (%ebx,1) as before. It will be easier
to check if assembler takes (%ebx,,1).

BTW, I didn't change the Intel syntax since I don't know enough
about it.


H.J.
-----
gas/

2005-01-14  H.J. Lu  <hongjiu.lu@intel.com>

        PR 658
        * config/tc-i386.c (SCALE1_WHEN_NO_INDEX): Removed.
        (_i386_insn): Add empty_index_reg.
        (build_modrm_byte): Use SIB if empty_index_reg is not 0.
        (i386_scale): Don't warn scale factor without index register if
        empty_index_reg is not 0.
        (i386_operand): Set empty_index_reg 1 if the index register is
        "".

gas/testsuite/

2005-01-14  H.J. Lu  <hongjiu.lu@intel.com>

        PR 658
        * gas/i386/sib.d: Updated.
        * gas/i386/sib.s: Likewise.
        * gas/i386/ssemmx2.d: Likewise.

ld/testsuite/

2005-01-14  H.J. Lu  <hongjiu.lu@intel.com>

        PR 658
        * ld-i386/tlsbin.dd: Updated.

opcodes/

2005-01-14  H.J. Lu  <hongjiu.lu@intel.com>

        PR 658
        * 386-dis.c (OP_E): Undo the 2005-01-12 change. Display scale
        for SIB with INDEX == 4.

--- binutils/gas/config/tc-i386.c.sib   2005-01-14 11:27:06.000000000 -0800
+++ binutils/gas/config/tc-i386.c       2005-01-14 12:25:45.624584751 -0800
@@ -43,14 +43,6 @@
 #define INFER_ADDR_PREFIX 1
 #endif

-#ifndef SCALE1_WHEN_NO_INDEX
-/* Specifying a scale factor besides 1 when there is no index is
-   futile.  eg. `mov (%ebx,2),%al' does exactly the same as
-   `mov (%ebx),%al'.  To slavishly follow what the programmer
-   specified, set SCALE1_WHEN_NO_INDEX to 0.  */
-#define SCALE1_WHEN_NO_INDEX 1
-#endif
-
 #ifndef DEFAULT_ARCH
 #define DEFAULT_ARCH "i386"
 #endif
@@ -162,6 +154,8 @@ struct _i386_insn
     const reg_entry *index_reg;
     unsigned int log2_scale_factor;

+    int empty_index_reg;
+
     /* SEG gives the seg_entries of this insn.  They are zero unless
        explicit segment overrides are given.  */
     const seg_entry *seg[2];
@@ -3006,11 +3000,9 @@ build_modrm_byte ()
                     Any base register besides %esp will not use the
                     extra modrm byte.  */
                  i.sib.index = NO_INDEX_REGISTER;
-#if !SCALE1_WHEN_NO_INDEX
                  /* Another case where we force the second modrm byte.  */
-                 if (i.log2_scale_factor)
+                 if (i.empty_index_reg)
                    i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
-#endif
                }
              else
                {
@@ -3970,13 +3962,13 @@ i386_scale (scale)
       input_line_pointer = save;
       return NULL;
     }
-  if (i.log2_scale_factor != 0 && i.index_reg == 0)
+  if (i.log2_scale_factor != 0
+      && i.index_reg == 0
+      && i.empty_index_reg == 0)
     {
       as_warn (_("scale factor of %d without an index register"),
               1 << i.log2_scale_factor);
-#if SCALE1_WHEN_NO_INDEX
       i.log2_scale_factor = 0;
-#endif
     }
   scale = input_line_pointer;
   input_line_pointer = save;
@@ -4430,6 +4422,12 @@ i386_operand (operand_string)
                      as_bad (_("bad register name `%s'"), base_string);
                      return 0;
                    }
+                 else if (*base_string == ',' && i.base_reg)
+                   {
+                     /* Check for empty index reg.  */
+                     base_string++;
+                     i.empty_index_reg = 1;
+                   }

                  /* Check for scale factor.  */
                  if (*base_string != ')')
--- binutils/gas/testsuite/gas/i386/sib.d.sib   2005-01-12 11:12:51.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/sib.d       2005-01-14 12:43:29.131911163 -0800
@@ -6,10 +6,14 @@
 Disassembly of section .text:

 0+000 <foo>:
-   0:  8b 04 23 [      ]*mov [         ]*\(%ebx\),%eax
-   3:  8b 04 63 [      ]*mov [         ]*\(%ebx\),%eax
-   6:  8b 04 a3 [      ]*mov [         ]*\(%ebx\),%eax
-   9:  8b 04 e3 [      ]*mov [         ]*\(%ebx\),%eax
-   c:  90 [    ]*nop [         ]*
-   d:  90 [    ]*nop [         ]*
-       ...
+   0:  8b 03 [         ]*mov [         ]*\(%ebx\),%eax
+   2:  8b 04 23 [      ]*mov [         ]*\(%ebx,,1\),%eax
+   5:  8b 04 63 [      ]*mov [         ]*\(%ebx,,2\),%eax
+   8:  8b 04 a3 [      ]*mov [         ]*\(%ebx,,4\),%eaxxebx,,xxxxxx  JI           FIOIJIJJIIJIJIFN      FIOIJIJJIIJIJIFN 
2JEOJJIJI3 2JJIJJIJIJIJIJIJFIOIJIJJIIJIJIFN  ##3$84889KLLL                               
EIJIJEJIE3E JIJIJEJIJEIJ2#EJIJEJJIJNJIJI2 /IJIJJIIJ2JIIIJIJFJIJIJIJIJ#JJIJIJIJ"FJIJIIJNJIFNFNJI"  IJIJIJNIJOIJIJIJ"    # 3$$484HKL8L            


 



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