bug-gnu-utils
[Top][All Lists]
Advanced

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

Bug in gas-2.12/i386 with -a


From: Urs Thuermann
Subject: Bug in gas-2.12/i386 with -a
Date: 26 May 2002 17:34:00 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

GAS from binutils-2.12 assembles differently depending on wether the
-a option is given or not.

See the following example:

    isnogud:tmp$ as -V </dev/null
    GNU assembler version 2.12 (i686-pc-linux-gnu) using BFD version 2.12
    isnogud:tmp$ as -a -o foo.o foo.s
    GAS LISTING foo.s                       page 1
    
    
       1 0000 90            start:  nop
       2 0001 81EB0100      foo:    subl    $foo-start, %ebx
       2      0000
       3 0007 90            bar:    nop
    
    GAS LISTING foo.s                       page 2
    
    
    DEFINED SYMBOLS
                   foo.s:1      .text:00000000 start
                   foo.s:2      .text:00000001 foo
                   foo.s:3      .text:00000007 bar
    
    NO UNDEFINED SYMBOLS
    isnogud:tmp$ objdump -s foo.o
    
    foo.o:     file format elf32-i386
    
    Contents of section .text:
     0000 9081eb01 00000090                    ........        
    Contents of section .data:
    isnogud:tmp$ 

The assembly listing produced with -a is identical to the code shown
by objdump.  But without -a, the assembler produces different code:

    isnogud:tmp$ as -o foo.o foo.s
    isnogud:tmp$ objdump -s foo.o
    
    foo.o:     file format elf32-i386
    
    Contents of section .text:
     0000 9083eb01 908d7600                    ......v.        
    Contents of section .data:
    isnogud:tmp$ 

Using the -a option, the subw instruction is translated to 

    81EB 01000000

while without -a, GAS produces the shorter code

    83EB 01

i.e. the long value 1 is coded in a byte instead of a long word.  Both
pieces of machine code are correct translations of the assembly code,
but I'd not expect to see a difference when I generate an assembly
listing.  This may be very confusing, especially if I search for a bug
using an assembly listing but running code generated without producing
a listing, where I'd expect them to be identical.


urs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]