Hi,
I am writing some (32bit) ASM code, and compile it with gcc. The output binary is quite big, however. I want to make it as small as possible.
The current gcc options I am using is like:
gcc -nostdlib -fno-builtin -c a.S -o a.bin
And the size of a.bin is around 400 bytes.
I am sure I can reduce the size of a.bin, as the similar code compiled with nasm has the size of only 123 bytes.
Which gcc options should I use now?
Thanks a lot,
J
Make the compiled ASM binary small?
Re: Make the compiled ASM binary small?
I think I found the reason: beside .text section (which is only thing I want), gcc produces some other sections, such as .data, .bss and .shstrtab.
And that makes the final binary bigger.
Now I want gcc not to produce those sections, but only give me .text. Which gcc options should I use?
Thanks,
J
And that makes the final binary bigger.
Now I want gcc not to produce those sections, but only give me .text. Which gcc options should I use?
Thanks,
J
- xenos
- Member
- Posts: 1118
- Joined: Thu Aug 11, 2005 11:00 pm
- Libera.chat IRC: xenos1984
- Location: Tartu, Estonia
- Contact:
Re: Make the compiled ASM binary small?
Try -oformat binary to omit string tables and such, and use a linker script if you really want to remove any other section besides .text.