Does g++ really need to compile main, if c++ code is involved?
Ian Lance Taylor
iant@google.com
Mon Mar 24 18:02:00 GMT 2014
On Mon, Mar 24, 2014 at 12:13 AM, Eric Wolf <eric.wolf@abas.de> wrote:
> Am 03/24/2014 08:04 AM, schrieb Kilian, Jens:
>
>>> From: Florian Weimer [mailto:fw@deneb.enyo.de]
>>> * Jens Kilian:
>>>>
>>>> I remember only one compiler (HP aCC) which requires compiling main()
>>>> as C++. As far as I know GCC never needed this.
>>>
>>>
>>> Some systems need collect2 support for initializers:
>>>
>>> <http://gcc.gnu.org/onlinedocs/gccint/Collect2.html>
>>
>>
>> I interpret this page to mean that GCC will always call the required
>> __main()
>> from main(), even if compiling C code. In this case you wouldn't need to
>> compile main() using g++ (not gcc).
>
>
> But that's strange. With this little example:
...
> no __main pops up.
>
> Could be inlined though?
You neglected to say what machine you were running on. __main is only
used on some platforms. In particular it is not used on GNU/Linux.
> But there is a
> __libc_start_main
> symbol, maybe __main got renamed?
No, that is a different symbol.
Ian
More information about the Gcc-help
mailing list