My system is Fedora, Linux and I use  "as" , to assemble assembly programs?

as t.s -o t.o

What is the resulted object file format? a.out or ELF or COFF?

How can i assemble the code for a specific file format? It seems that "as" does not have any command line option to do it!!

Posted on 2010-08-15 09:32:47 by logicman112
What is the resulted object file format? a.out or ELF or COFF?


I assume that your Fedora kernel supports ELF or ELF32, if it is a 32 bit system. For more information check Jonathan Bartlett's book "Programming from the Ground Up". It's available online as PDF file; check it with your search engine. The book is about your topic: writing assembly language programs under Linux with GAS.

Gunther
Posted on 2010-08-15 22:21:38 by Gunther
As I recall, "man as" suggests that you use "objdump -i" to find out what output formats are supported.... Mmmm, no, I guess that's for ld(?). Anyway, I assume ELF, as Gunther says. I think, if you want COFF, you'll need to install a port of binutils that supports it - the MinGW package might fix you up. There's a post over on the Nasm forum...

http://forum.nasm.us/index.php?topic=810.0

I know you're not using Nasm - where you still need different versions of ld for COFF (ms COFF). I think you'll need a different version of "as", as well as "ld"... assuming that's why you're asking about different object file formats...

Agner Fog's "objconv" might interest you, too...

http://www.agner.org/optimize/#objconv

Best,
Frank

Posted on 2010-08-17 06:21:27 by fbkotler
It seems that "as" does not have any command line option to do it!!


Yes, GAS is designed as a back end for the GNU tool chain. It's input comes normally from the compiler and is syntactical right. Some control of GAS can be done with switches inside the listing.

Agner Fog's "objconv" might interest you, too...


Yes, it's a good alternative for changing binary object formats. It supports PE, COFF, ELF, OMF and MACHO. Give it a try.

Gunther

Posted on 2010-08-17 12:06:13 by Gunther
My system is Fedora, Linux and I use  "as" , to assemble assembly programs?


It's a bit hardcore, but it works well, as you can see in the following link: http://www.asmcommunity.net/board/index.php?topic=30179.0

Have fun!

Gunther
Posted on 2010-08-19 18:09:44 by Gunther