[TriLUG] GCC and ASM

Scott Chilcote scottchilcote at earthlink.net
Thu Oct 17 22:07:02 EDT 2002


Hi Bryan,

I took a stab at this in Perl a few years ago, but I was going the 
opposite direction (MASM to gas).  Most of it's fairly straightforward, 
but there was a lot of complexity on the Intel side when it came to 
handling some of the more obscure addressing modes and varieties of file 
inclusion, among other things.

Converting the other way should avoid these problems because the gas 
assembly format is simpler.

There are a number of discussions of this topic online, and some of them 
list tools for performing the conversion.  I googled on "gas to MASM 
assembly format conversion" and found:

   http://www.delorie.com/djgpp/v2faq/faq17_2.html

[yes, I know google throws out "to"  ;-]

Also check the Linux Assembly HOWTO under "Assemblers":

   http://linuxassembly.org/howto/assemblers.html

GCC has a lot of compatibility options, but I don't think you can get 
gas to produce any other assembly formats.  If you want to look over the 
options, there's a link for that here:

    http://www.math.utah.edu/docs/info/gcc_6.html#SEC19

Good luck with your project!

              Scott C.

Bryan Burroughs wrote:
> Howdy,
>    I am using GCC to crank out some intel assembler code on some C 
> programs I have written, but the output is foreign to me.  I assume it 
> is in a different "assembler format", as in there is MASM and TASM and 
> others...  Does anyone happen to know what "format" GCC uses, so I can 
> compare it to TASM code?  Or, even better, if there is a way to force 
> GCC to output Intel code, as opposed to AT&T, as it appears to be doing. 
> I'm a little new to this whole assembly thing, and I want to compare 
> what I write with what the compiler generates for a HLL version of the 
> same code.  As best I can tell, Intel code is what I am used to, and I 
> could look past the MASM/TASM difference, but this %eax, which I know to 
> mean the ax register, and all of the l's after each instruction are 
> driving me crazy!  Any help would be greatly appreciated.  Oh, and if 
> anyone knows how to link assembly object or source code(TASM, of course) 
> with a C main program using GCC, I'd be very grateful if you could pass 
> said knowledge along to me.
>    Bryan Burroughs
> 






More information about the TriLUG mailing list