GCC/MINGW中'startup files'来源

Source for 'startup files' in gcc/mingw

本文关键字:files 来源 startup GCC MINGW      更新时间:2023-10-16

我使用 mingw32

在 gcc 中有一个选项

" -nostartfiles  Do not use the standard system startup files when linking. The standard system libraries are used normally, unless -nostdlib or -nodefaultlibs is used. "

如果我不在我的自己几乎空的 c 源中使用它,我在我的 exe 1000 行包含此类函数的冗长代码存根中得到了

00401000 <___mingw_CRTStartup>:
00401110 <__gnu_exception_handler@4>:
00401280 <_mainCRTStartup>:
004012a0 <_WinMainCRTStartup>:
004012c0 <_atexit>:
004012d0 <__onexit>:
004012e0 <___gcc_register_frame>:
0040132c <___gcc_deregister_frame>:
00401334 <_WinMain@16>:
00401340 <___dyn_tls_dtor@12>:
00401390 <___dyn_tls_init@12>:
00401420 <___tlregdtor>:
00401430 <___cpu_features_init>:
00401510 <__fpreset>:
00401520 <___report_error>:
00401580 <___write_memory.part.0>:
00401690 <__pei386_runtime_relocator>:
00401870 <___do_global_dtors>:
004018a0 <___do_global_ctors>:
004018f0 <___main>:
00401910 <___mingwthr_run_key_dtors.part.0>:
00401970 <____w64_mingwthr_add_key_dtor>:
00401a00 <____w64_mingwthr_remove_key_dtor>:
00401a90 <___mingw_TLScallback>:
00401b30 <___getmainargs>:
00401b38 <__setmode>:
00401b40 <___p__fmode>:
00401b48 <___p__environ>:
00401b50 <__cexit>:
00401b58 <_signal>:
00401b60 <_fwrite>:
00401b68 <_vfprintf>:
00401b70 <_abort>:
00401b78 <_memcpy>:
00401b80 <_calloc>:
00401b88 <_free>:
00401b90 <_SetUnhandledExceptionFilter@4>:
00401b98 <_ExitProcess@4>:
00401ba0 <_GetModuleHandleA@4>:
00401ba8 <_GetProcAddress@8>:
00401bb0 <_VirtualQuery@12>:
00401bb8 <_VirtualProtect@16>:
00401bc0 <_GetCommandLineA@0>:
00401bc8 <_GetStartupInfoA@4>:
00401bd0 <_EnterCriticalSection@4>:
00401bd8 <_TlsGetValue@4>:
00401be0 <_GetLastError@0>:
00401be8 <_LeaveCriticalSection@4>:
00401bf0 <_DeleteCriticalSection@4>:
00401bf8 <_InitializeCriticalSection@4>:
00401c00 <_main>:
00401ce0 <_register_frame_ctor>:
00401cfc <__CTOR_LIST__>:
00401d00 <.ctors.65535>:
00401d08 <__DTOR_LIST__>:

也许有人可以说我在哪里可以找到来源吗?(或者至少一些详细的解释是什么 - 但来源会更好)

我想你可以下载GCC源代码或MinGW源代码。

由于 sourceforge.net 上的 mingw-w64 项目正在转移到 mingw-w64.org 我建议还检查 mingw-w64.org 然后运行grep或类似的文本搜索实用程序并查找定义这些功能的特定文件。

另请注意,一些函数如exit()atexit()memcpy()等来自 C 运行时库,它们不会在 GCC 源代码中定义。