views:

117

answers:

2

I have checked the assembler options of GNU assembler as and I didn't find an option to specify the output object file format. If I am using the following command

as -o foobar.o foobar.s

What object file format will I get?

The as manual says that "The GNU as can be configured to produce several alternative object file formats." But how? How can I change it to a ELF format?

Many thanks.

+2  A: 

On linux the output from gas is ELF already, it is unlikely you have a version which is building the old a.out format, or that you are using a cross compiler to say build to MachO or PE.

tyranid
Thanks tyranid. I noticed that I can specify differnt object file formats when using the "NASM" assembler. It seems the GNU "as" is not as good as NASM in this aspect. I have to use the "objcopy" to change the object file format. Is there some more direct approach with the "as"?
smwikipedia
I don't think you can do directly, you would always have to use objcopy.
tyranid
A: 

Use a cross-compiler for specific formats (ARM,MIPS etc.)

Get the entire CODESOURCERY toolchain here for free:

www.codesourcery.com/sgpp/lite_edition.html

GoodLUCK!!

CVS-2600Hertz
Thansk CVS26. I am not making a cross compiling. I386 is my target. I will give it a try, if i am desperate enough...
smwikipedia