bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/10740] New: amd64+i386 as: i8086 Intel syntax far jumps broken


From: tg at mirbsd dot de
Subject: [Bug gas/10740] New: amd64+i386 as: i8086 Intel syntax far jumps broken (both variants of them)
Date: 6 Oct 2009 13:59:28 -0000

Forwarding http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=541535

First, I show that this can be reproduced with binutils-current checked
out from AnonCVS on 2009-10-06 on approximately 13:30 UTC, then I will
copy and paste the original problem report I submitted to Debian after
this issue (with an assembly file of mine) was reported to me by Mika
“grml.org” Prokop. My thoughts on this: congratulations on trying to
make the Intel syntax more Intel style (ljmp → JMP FAR), but you’re 
a
decade (at the least) too late and are breaking a large existing codebase.
Maybe 「.intel_syntax noprefix,v=2」 style versioning should be 
used?


address@hidden:~ $ ~/stuff/binutils-current/bin/as -V
GNU assembler version 2.20.51 (i686-pc-linux-gnu) using BFD version (GNU 
Binutils) 2.20.51.20091006

address@hidden:~ $ ~/stuff/binutils-current/bin/as -o x.o testmin.s
testmin.s: Assembler messages:
testmin.s:5: Error: too many memory references for `ljmp'
1|address@hidden:~ $ ~/stuff/binutils-current/bin/as -o x.o testmin2.s
testmin2.s: Assembler messages:
testmin2.s:5: Error: junk `0xF000:0xFFF0' after expression


Package: binutils                                                               
                            
Version: 2.19.51.20090805-1                                                     
                            
Severity: normal                                                                
                            
                                                                                
                            
First of, a totally reduced minimal testcase. Let's try it on MirBSD:           
                            
                                                                                
                            
address@hidden:~ $ cat >testmin.s                                               
                                   
        .intel_syntax noprefix                                                  
                            
        .text                                                                   
                            
        .code16                                                                 
                            
        .globl  _start                                                          
                            
_start: ljmp    0xF000,0xFFF0                                                   
                            
address@hidden:~ $ cc -nostdlib -Wl,--oformat,binary -Wl,-Ttext,0 testmin.s     
                                   
address@hidden:~ $ hd a.out                                                     
                                   
00000000  EA F0 FF 00 F0          -                          |.....|            
                            
address@hidden:~ $ as -V                                                        
                                   
GNU assembler version 050707 () using BFD version 050707 20050707               
                            
                                                                                
                            
This is an i386 native GNU as, targetting (here) i8086 (due to the .code16      
                            
pseudo-op) and using Intel syntax, as opposed to that cruel AT&T syntax,        
                            
which thankfully has been supported by about every i386 gas from 1999 and       
                            
later.                                                                          
                            

It fails on Debian sid though (both amd64 and i386, I only have an i386         
                            
sid schroot though):                                                            
                            
                                                                                
                            
address@hidden:~ $ as testmin.s                                                 
                             
testmin.s: Assembler messages:                                                  
                            
testmin.s:5: Error: too many memory references for jmp'                         
                            
1|address@hidden:~ $ as -V                                                      
                             
GNU assembler version 2.19.51 (i486-linux-gnu) using BFD version (GNU Binutils 
for Debian) 2.19.51.20090805 
                                                                                
                            
Oh how great. Let's try the i386 lenny schroot.                                 
                            
                                                                                
                            
address@hidden:~ $ as testmin.s                                                 
                             
address@hidden:~ $ file a.out                                                   
                             
a.out: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped  
                            
address@hidden:~ $ objdump -d -Mintel,i8086 a.out                               
                             
                                                                                
                            
a.out:     file format elf32-i386                                               
                            
                                                                                
                            
Disassembly of section .text:                                                   
                            
                                                                                
                            
00000000 <_start>:                                                              
                            
   0:   ea f0 ff 00 f0          jmp    0xf000:0xfff0                            
                            
address@hidden:~ $ as -V                                                        
                             
GNU assembler version 2.18.0 (i486-linux-gnu) using BFD version (GNU Binutils 
for Debian) 2.18.0.20080103   
                                                                                
                            
Cool, it works there... (objdump on BSD shows s/:/,/ otherwise the same)        
                            

Now I install binutils-doc and "info as", then I read that the syntax for       
                            
far jumps has changed. Ye gods, how am I supposed to distinguish between        
                            
these when I target gas' intel syntax? But other than that issue, which         
                            
is VERY annoying and should be reverted upstream (i.e. the "older" syntax       
                            
should still be accepted), it simply doesn't work!                              
                            
                                                                                
                            
   * Immediate form long jumps and calls are call/ljmp $SECTION,                
                            
     $OFFSET' in AT&T syntax; the Intel syntax is all/jmp far                   
                            
     SECTION:OFFSET'.  Also, the far return instruction is ret                  
                            
     $STACK-ADJUST' in AT&T syntax; Intel syntax is et far                      
                            
     STACK-ADJUST'.                                                             
                            
                                                                                
                            
(Intersting side note, the older syntax matched AT&T more closely; this         
                            
seems to be a try to get it more close to other Intel syntax assemblers,        
                            
which per se isn't a bad thing - or would have been in 1999. Now it's too       
                            
late... especially since more recent binutils are GPLv3.)                       
                            
                                                                                
                            
address@hidden:~ $ cat testmin2.s                                               
                             
        .intel_syntax noprefix                                                  
                            
        .text                                                                   
                            
        .code16                                                                 
                            
        .globl  _start                                                          
                            
_start: jmp far 0xF000:0xFFF0                                                   
                            
address@hidden:~ $ as testmin2.s                                                
                             
testmin2.s: Assembler messages:                                                 
                            
testmin2.s:5: Error: junk F000:0xFFF0' after expression                         
                            

So there isn't even a way to do a JMP FAR here. (Apologies if my editor         
                            
stripped U+0060 while pasting, it's a command character and shouldn't           
                            
be used in any strings ever. Ask Markus Kuhn...)                                
                            
                                                                                
                            
I invoke the "I didn't do anything! (I didn't even do anything before!)"        
                            
because the aforementioned assembly source compiles fine using other ver-       
                            
sions of gas. I would like to get this fixed, as grml depends on it; it         
                            
may or may not be a bug you'd want to forward upstream.

-- 
           Summary: amd64+i386 as: i8086 Intel syntax far jumps broken (both
                    variants of them)
           Product: binutils
           Version: 2.21 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: tg at mirbsd dot de
                CC: bug-binutils at gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=10740

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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