1

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.

smwikipedia
  • 61,609
  • 92
  • 309
  • 482

2 Answers2

2

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
  • 13,028
  • 1
  • 32
  • 34
  • 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 Apr 19 '10 at 01:37
  • I don't think you can do directly, you would always have to use objcopy. – tyranid Apr 19 '10 at 05:01
0

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!!

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
TheCodeArtist
  • 21,479
  • 4
  • 69
  • 130
  • 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 Apr 19 '10 at 01:39