Discussion:
Assembly format translator from GCC Gas syntax to Intel for Intel and AMD
(too old to reply)
user923005
2007-03-02 20:31:22 UTC
Permalink
I am doing a Win32 port of CLN using VC++ 2005:
http://www.ginac.de/CLN/

The stumbling block is down to a few small files (for Intel Assembly).
The files are inline assembly C++ files such as:
\base\digitseq\cl_asm_i386_.cc
which contain GAS format inline stuff such as:
movl %edi,%edx // %edi retten
Now, it's only a few thousand lines, but still it would be tedious to
translate it by hand.

Does anyone know of a Gas ==> INTEL format translator for assembly?
Frank Kotler
2007-03-02 23:35:40 UTC
Permalink
user923005 wrote:

...
Post by user923005
Does anyone know of a Gas ==> INTEL format translator for assembly?
http://membres.lycos.fr/placr/a2i.html

http://www.niksula.hut.fi/~mtiihone/intel2gas/

I have no experience with either of these. I doubt if either of them
will do gcc-inline to vc++-inline, but may be some help.

Best,
Frank
Brian Gladman
2007-03-03 07:47:49 UTC
Permalink
Post by Frank Kotler
...
Post by user923005
Does anyone know of a Gas ==> INTEL format translator for assembly?
http://membres.lycos.fr/placr/a2i.html
http://www.niksula.hut.fi/~mtiihone/intel2gas/
I have no experience with either of these. I doubt if either of them will
do gcc-inline to vc++-inline, but may be some help.
I have used these to do some tranlations of asm files but the resulting
files have always required quite a lot of manual editing to be of any value.

As you suggest, it is doubtful that they will cope with inline assembler
since the parsing that they do is not designed to cope with text that is not
legal in gas assembly code.

One possible option is to edit the assembler sections into files, convert
these files and then splice the results back in to the original files. This
will inevitably require some manual editing but the bulk of the 'simple'
changes (removal of %, operand order reversal) will at least be done.

But, as others have said, it may be easier to write a simple conversion
routine to make these sort of changes.

Brian Gladman
rhyde@cs.ucr.edu
2007-03-02 23:20:22 UTC
Permalink
I am doing a Win32 port of CLN using VC++ 2005:http://www.ginac.de/CLN/
The stumbling block is down to a few small files (for Intel Assembly).
\base\digitseq\cl_asm_i386_.cc
movl %edi,%edx // %edi retten
Now, it's only a few thousand lines, but still it would be tedious to
translate it by hand.
Does anyone know of a Gas ==> INTEL format translator for assembly?
Certainly not that works with in-line assembly files. IIRC, there is a
(broken) program called something like gas2intel (or att2Intel)
floating around, but it's for gas source files. And GCC in-line
assembly is *not* Gas syntax, despite what you might think. It's
similar, in the way that FASM and NASM are similar, but certainly not
the same.

You'd have to manually check every one of those few thousand lines
anyway, to correct omissions and missed conversions, so I doubt you'd
save much.

If it were more than a few thousand lines, I'd just recommend using a
PERL script to automate a good part of the work. I recently did
something very similar to convert about 20,000 lines of FASM code to
HLA syntax.
Cheers,
Randy Hyde
JimS
2007-03-29 05:52:18 UTC
Permalink
Post by user923005
http://www.ginac.de/CLN/
The stumbling block is down to a few small files (for Intel Assembly).
\base\digitseq\cl_asm_i386_.cc
movl %edi,%edx // %edi retten
Now, it's only a few thousand lines, but still it would be tedious to
translate it by hand.
Does anyone know of a Gas ==> INTEL format translator for assembly?
Compile/assemble it with gcc, copy the object file to the PC and
disassemble it with an Intel format disassembler.

Jim
KarmaComa
2007-04-04 18:24:01 UTC
Permalink
I am doing a Win32 port of CLN using VC++ 2005:http://www.ginac.de/CLN/
The stumbling block is down to a few small files (for Intel Assembly).
\base\digitseq\cl_asm_i386_.cc
movl %edi,%edx // %edi retten
Now, it's only a few thousand lines, but still it would be tedious to
translate it by hand.
Does anyone know of a Gas ==> INTEL format translator for assembly?
Would you not just be more prudent using a Windows port of gcc such as
mingw?, it contains a port of gcc and all the binutils you need for
porting programs thats sources need gcc to be compiled. GAS is not
required at all! the assembler normaly distrubuted alongside gcc is AS
and you get that in mingw in the binutils. Why build a bridge over a
pond when you can just stroll around the edge to your destination? or
you could use gcc and friends under Cygwin.

I realy do not envy the job of having to convert that many lines of
asm, and unless there are SYSCALL specific things done with the asm
that would need to be changed under win32 due to lack of SYSCALL under
Win, i cannot realy see why your not using mingw

But of course, i've only been programming a short time. I could be
entirely off mark with this post

regards and good luck
yanming
2007-05-25 03:36:11 UTC
Permalink
Post by KarmaComa
I am doing a Win32 port of CLN using VC++ 2005:http://www.ginac.de/CLN/
The stumbling block is down to a few small files (for Intel Assembly).
\base\digitseq\cl_asm_i386_.cc
movl %edi,%edx // %edi retten
Now, it's only a few thousand lines, but still it would be tedious to
translate it by hand.
Does anyone know of a Gas ==> INTEL format translator for assembly?
Would you not just be more prudent using a Windows port of gcc such as
mingw?, it contains a port of gcc and all the binutils you need for
porting programs thats sources need gcc to be compiled. GAS is not
required at all! the assembler normaly distrubuted alongside gcc is AS
and you get that in mingw in the binutils. Why build a bridge over a
pond when you can just stroll around the edge to your destination? or
you could use gcc and friends under Cygwin.
I realy do not envy the job of having to convert that many lines of
asm, and unless there are SYSCALL specific things done with the asm
that would need to be changed under win32 due to lack of SYSCALL under
Win, i cannot realy see why your not using mingw
But of course, i've only been programming a short time. I could be
entirely off mark with this post
regards and good luck
Hello, I use ATT2Intel.exe to convert gcc asm to Intel,but I got some
parse error message when I try to parse some psudo instruction and
declaration, but it's fine for function implementation in the text
section.
Could anybody help me ? Or try to tell me how to convert following
instructions to INTEL syntax by myself.
Thanks.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; .data
; .align 16
; rounding_sse : .fill 8,2,16
; sse_five : .fill 8,2,5
; rounding_512 : .fill 4,4,512
; tmp_buf : .fill 104,2,0
; zero_cmp : .fill 8,2,0
; top_cmp : .fill 8,2,255
; .align 16
; qp_const_array : .word 0,0,0,0,0,0,0,0
; .word 1,1,1,1,1,1,1,1
; .word 2,2,2,2,2,2,2,2
; .word 3,3,3,3,3,3,3,3
; .word 4,4,4,4,4,4,4,4
; .word 5,5,5,5,5,5,5,5
; .word 6,6,6,6,6,6,6,6
; .word 7,7,7,7,7,7,7,7
; .word 8,8,8,8,8,8,8,8
;
; .align 16
; x264_mmx_32 : .fill 4,2,32
; x264_mmx_8 : .fill 4,2,8
; x264_mmx_4 : .fill 4,2,4
;
; .align 16
; A_32 : .fill 8,2,32
;
; .align 16
; filter_four : .fill 8,2,4

Loading...