This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

RE: different results on using intel syntax and at&t syntax


nix noob wrote:
> there appears to be a problem i am not aware how i can
> get rid of that

> .equ NEWT_KEY_UP,0x8001

> cmp eax, NEWT_KEY_UP
> 
> it gets assembled to
> 
> cmp eax,ds:0x8001
> and then segfaults

>         .att_syntax             <--- over rode here
>         cmp $NEWT_KEY_UP,%eax
>         .intel_syntax noprefix   <-- reset back


> 0x804847c <newtInit+120>:       cmp    eax,0x8001

> can some one explain how i can eliminate this problem

  I can't reproduce your problem.  Both syntaxes give me the same result and
neither gives a ds: memory reference.  I even tried using '.set', '.equ' and
'=' to cause the problem but it still doesn't happen.

-------------------------------------------------------------------------
dk@espanola ~> as -ahls -
    .intel_syntax noprefix
    cmp eax, 0x8001
    .att_syntax
    cmp $0x8001, %eax
    .intel_syntax noprefix
.equ foobar, 0x8001
.set barfoo, 0x8001
quux = 0x8001
    cmp eax, 0x8001
    cmp eax, foobar
    cmp eax, barfoo
    cmp eax, quux
    cmp eax, 0x8001
    .end

GAS LISTING                     page 1


   1                    .intel_syntax noprefix
   2 0000 3D018000      cmp eax,0x8001
   2      00
   3                    .att_syntax
   4 0005 3D018000      cmp $0x8001,%eax
   4      00
   5                    .intel_syntax noprefix
   6                    .equ foobar,0x8001
   7                    .set barfoo,0x8001
   8                    quux =0x8001
   9 000a 3D018000      cmp eax,0x8001
   9      00
  10 000f 3D018000      cmp eax,foobar
  10      00
  11 0014 3D018000      cmp eax,barfoo
  11      00
  12 0019 3D018000      cmp eax,quux
  12      00
  13 001e 3D018000      cmp eax,0x8001
  13      00
  14 0023 90909090      .end
  14      90909090
  14      90909090
  14      90
GAS LISTING                    page 2


DEFINED SYMBOLS
                            *ABS*:00000000 fake

NO UNDEFINED SYMBOLS
dk@espanola ~>
-------------------------------------------------------------------------

  What binutils version are you using?  I've got 2.16.91 (i686-pc-cygwin) and
it appears to work just fine.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....



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