Dear Daniel,

Thank you. I have tried to:
x86_64-w64-mingw32-gcc -s -Os hello.c

Interestingly, the generated exe is now 18 KB. Still, that is larger than 2
KB. :-)

Warm regards,
Xianwen


On Wed, Oct 12, 2016 at 12:49 AM, Daniel Glöckner <daniel...@gmx.net> wrote:

> Hi Xianwen,
>
> On Tue, Oct 11, 2016 at 11:43:40PM +0200, Chen, Xianwen wrote:
> > I have been very impressed by the size of exe's that TCC produces in
> > Windows. For the simple hello_world.c, TCC produces an exe of 2 KB, while
> > mingw-w64 produces an exe of 164 KB. Therefore, I would like to continue
> to
> > learn to use TCC.
>
> I'm pretty sure I've used MinGW to generate executables that small,
> although that was probably 16 years ago.
>
> Try to pass -s to GCC and don't use -g to get rid of symbol tables and
> debugging information. Most of the time TCC generates more code than GCC,
> especially when GCC is called with -Os.
>
> The linker of MinGW might enforce different section alignments than TCC.
> But that should add less than 10 kB of padding, regardless of the code
> size.
>
> Best regards,
>
>   Daniel
>
> _______________________________________________
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to