tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Win32: PE subsystem patch proposal


From: grischka
Subject: Re: [Tinycc-devel] Win32: PE subsystem patch proposal
Date: Thu, 08 Apr 2010 13:02:01 +0200
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Timo VJ Lähde wrote:
>
> -    if (find_elf_sym(symtab_section, PE_STDSYM("WinMain","@16")))
> +    if (find_elf_sym(symtab_section, PE_STDSYM("WinMain","@16"))
> +        || find_elf_sym(symtab_section, "_winstart"))
>         pe_type = PE_GUI;
>     else

This is a hack that nobody (except maybe you) will ever use or even
know that it exists.  I don't like it.

>     else
>         pe_type = PE_EXE;
> +    if (s1->pe_subsystem) {
> +        pe_type = s1->pe_subsystem;
> +    }
>

That is better but as is would not work for dlls.

A little history:  In the original implementation of the PE backend,
"pe->type" was used to for two purposes:
        1) executable type (exe or dll)
and
        2) subsystem (gui or console)

Later someone introduced "pe->subsystem" in this patch:
http://repo.or.cz/w/tinycc.git/commitdiff/2f73e42d
        Frederic Feret <address@hidden>  2009-08-27 10:12:13
        various fixes and new options for PE format

However obviously it was meant for Windows on ARM (WinCE) and did
not connect the new feature to the existing Win32 code.

So I'd suggest to rename "pe->type" to "pe->exetype" and then use
it to handle exe/dll, and use pe->subsystem to handle gui/console.

Note that "-WL,subsystem,xxx" should override the smart logic with
"WinMain".  Also don't forget to check that "tcc -run ..." still
works.

Once you feel reasonably sure enough that you did the right thing,
please push your patch on our "mob" branch.

Thanks,

--- grischka




reply via email to

[Prev in Thread] Current Thread [Next in Thread]