This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: windows showstopper re: cannot find entry symbol _WinMainCRTStartup


Ben Wing wrote:
> 
> I do see the crt0 is the very first thing linked, and
> 
> /lib 540$ nm crt0.o
> 00000000 b .bss
> 00000000 d .data
> 00000000 t .text
> 00000000 D ___cygwin_crt0_bp
> 00000000 t ___gnu_compiled_c
>          U _cygwin_crt0
>          U _main
> 00000000 T _mainCRTStartup
> 00000000 t gcc2_compiled.
> 
> so this *may* be harmless, but I think it needs to be fixed, perhaps just with a
> flag that sets the entry point.
> 
> BUT ....  then again, maybe not.  There's also a crt1.0, like this:
> 
> /lib 542$ nm crt1.o
> 00000000 b .bss
> 00000000 d .data
> 00000000 t .text
>          U _ExitProcess@4
>          U _SetUnhandledExceptionFilter@4
> 00000230 T _WinMainCRTStartup
>          U __CRT_fmode
>          U __CRT_glob
>          U ___GetMainArgs
> 00000000 t ___gnu_compiled_c
> 000001b0 t ___mingw_CRTStartup
> 00000000 D __argc
> 00000004 D __argv
>          U __cexit
>          U __fileno
>          U __fpreset
> 000000d0 t __gnu_exception_handler@4
>          U __imp___environ_dll
>          U __imp___fmode_dll
>          U __imp___iob
> 00000030 t __mingw32_init_fmode
> 00000000 t __mingw32_init_mainargs
>          U __setmode
>          U _main
> 00000210 T _mainCRTStartup
>          U _signal
> 00000000 t gcc2_compiled.
> 
> Notice that this also has mainCRTStartup in it, as well as WinMainCRTStartup.
> My strong suspicion is that crt1.o is the correct CRT to be using for a
> windowed-subsystem XEmacs; crt0.o, with no references to WinMain, has to be for
> a console-subsystem XEmacs.  So, by using the wrong CRT initialization, we could
> easily be fucking ourselves in all sorts of ways.

Hmmm...I think that crt0.o is for cygwin builds, crt1.o is for builds
which use "cygwin-gcc -mno-cygwin" with a crt.dll runtime target, and
crt2.o is for builds which use "cygwin-gcc -mno-cygwin" with an
msvcrt.dll runtime target.

> 
> So once again, what changed to produce this?

If I'm right, cygwin's gcc recently changed so that the msvcrt runtime
was the default target for -mno-cygwin builds; but that would just mean
that crt1.o was replaced by crt2.o.  Since cygwin builds (-mwindows
notwithstanding) use crt0.o, this change would have no effect on cygwin
builds.  Hmm...

I've copied this message to the cygwin list, in case the gurus there
have any comment, or can confirm/deny my statement abouve about crtX.o.

--Chuck

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]