[VCRUNTIME][VCSTARTUP] Add separate vcruntime and vcstartup lib

vcruntime contains the code that is linked into ucrtbase (in VS it is also provided as vcruntime140.dll)
vcstartup contains the code that is statically linked into executables that link to ucrtbase.dll. In Visual Studio this is part of msvcrt.lib (the import library for msvcrt), similar to our current msvcrtex, and it gets linked when you link to ucrtbase as well. The name is based on the folder name in the library.
Both libraries share some code, but each file is only compiled once.
This commit is contained in:
Timo Kreuzer 2025-01-17 11:45:05 +02:00
parent 2b2bdabe72
commit 9186b861a6
21 changed files with 79 additions and 26 deletions

View file

@ -0,0 +1,22 @@
//
// section_markers.c
//
// Copyright (c) 2024 Timo Kreuzer
//
// Markers for CRT initializer sections.
//
// SPDX-License-Identifier: MIT
//
#include <internal_shared.h>
_CRTALLOC(".CRT$XIA") _PIFV __xi_a[] = { 0 };
_CRTALLOC(".CRT$XIZ") _PIFV __xi_z[] = { 0 };
_CRTALLOC(".CRT$XCA") _PVFV __xc_a[] = { 0 };
_CRTALLOC(".CRT$XCZ") _PVFV __xc_z[] = { 0 };
_CRTALLOC(".CRT$XPA") _PVFV __xp_a[] = { 0 };
_CRTALLOC(".CRT$XPZ") _PVFV __xp_z[] = { 0 };
_CRTALLOC(".CRT$XTA") _PVFV __xt_a[] = { 0 };
_CRTALLOC(".CRT$XTZ") _PVFV __xt_z[] = { 0 };
#pragma comment(linker, "/merge:.CRT=.rdata")