How to config GAS to generate 'clean' objects?

Nick Clifton nickc@redhat.com
Sat Jan 21 09:38:00 GMT 2006


Hi Clainst,

>   1 .data         00000000  00000000  00000000  00000038  2**2
>   2 .bss          00000000  00000000  00000000  00000038  2**2

> Although the 'unwanted' sections have the zero size, they do occupy a lot
> of room. I just wonder if there is a way to change this default
> behavior.

Not without modifying the sources of the assembler no.  But of course 
you do have access to these sources so you can always do this.

> My next question is:
> How to make GAS generate plain binary file like other assemblers such as
> nasm or fasm. 

They do ?  This seems odd to me.  What use is a plain binary file ?  You 
cannot link it with other files, it has lost too much information.  I 
can understand your wanting the linker to generate a plain binary file 
rather than say an ELF or PE format executable, but I do not understand 
why you want the assembler to produce plain binary object files.

> Currently I have to generate object file first, and then
> use objcopy to fetch the code binary out, which is not that convenient.

Sorry - this is the way that these tools are designed to work.  You can 
always automate the process of assembling and then converting into the 
binary format though - a simple script or makefile will do this for you.

Cheers
   Nick



More information about the Binutils mailing list