How to force GAS/x86 to use short offsets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When using indirect addressing with an offset, there are several
opcodes for byte and dword offsets.  When I specify the offset
directly GAS uses the short opcode with a one byte offset if possible
but not when the offset is the result of a calculation.  Here is an
example:

$ as -adnl foo.s
   1                    OFFSET  =       end - string
   2              
   3                            .text
   4 0000 8D4604                lea     4(%esi), %eax
   5 0003 8D860400              lea     OFFSET(%esi), %eax
   5      0000
   6              
   7                            .data
   8 0000 61626300      string: .string "abc"
   9                    end:

When changing the order so that the two labels are known earlier, GAS
uses the short form:

$ as -adnl foo.s
   1                            .data
   2 0000 61626300      string: .string "abc"
   3                    end:
   4              
   5                    OFFSET  =       end - string
   6              
   7                            .text
   8 0000 8D4604                lea     4(%esi), %eax
   9 0003 8D4604                lea     OFFSET(%esi), %eax

My question is, is there a way to force GAS to use the short opcode
even when the offset is calculated and not yet known to be small
enough?


urs
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies]     [Security]     [Linux C Programming]     [Linux for Hams]     [DCCP]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux