Use `/ALTERNATENAME` instead of checked-in OBJ files generated by `aliasobj` (#2381)
|
@ -433,11 +433,6 @@ set(SATELLITE_DLL_SOURCES
|
|||
${CMAKE_CURRENT_LIST_DIR}/src/dllmain_satellite.cpp
|
||||
)
|
||||
|
||||
add_library(std_init_once_begin_initialize OBJECT IMPORTED)
|
||||
add_library(std_init_once_complete OBJECT IMPORTED)
|
||||
set_target_properties(std_init_once_begin_initialize PROPERTIES IMPORTED_OBJECTS "${CMAKE_CURRENT_LIST_DIR}/aliases/${VCLIBS_I386_OR_AMD64}/std_init_once_begin_initialize.obj")
|
||||
set_target_properties(std_init_once_complete PROPERTIES IMPORTED_OBJECTS "${CMAKE_CURRENT_LIST_DIR}/aliases/${VCLIBS_I386_OR_AMD64}/std_init_once_complete.obj")
|
||||
|
||||
add_compile_definitions(_CRTBLD _VCRT_ALLOW_INTERNALS _HAS_OLD_IOSTREAMS_MEMBERS=1 _STL_CONCRT_SUPPORT)
|
||||
|
||||
include_directories(BEFORE
|
||||
|
@ -495,7 +490,7 @@ function(add_stl_dlls D_SUFFIX THIS_CONFIG_DEFINITIONS THIS_CONFIG_COMPILE_OPTIO
|
|||
target_link_libraries(msvcp_2${D_SUFFIX}_objects PRIVATE Boost::math)
|
||||
|
||||
add_library(msvcp_2${D_SUFFIX} SHARED)
|
||||
target_link_libraries(msvcp_2${D_SUFFIX} PRIVATE msvcp_2${D_SUFFIX}_objects msvcp${D_SUFFIX}_satellite_objects msvcp${D_SUFFIX}_implib_objects std_init_once_begin_initialize std_init_once_complete "msvcp${D_SUFFIX}" "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib")
|
||||
target_link_libraries(msvcp_2${D_SUFFIX} PRIVATE msvcp_2${D_SUFFIX}_objects msvcp${D_SUFFIX}_satellite_objects msvcp${D_SUFFIX}_implib_objects "msvcp${D_SUFFIX}" "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib")
|
||||
set_target_properties(msvcp_2${D_SUFFIX} PROPERTIES ARCHIVE_OUTPUT_NAME "msvcp140_2${D_SUFFIX}${VCLIBS_SUFFIX}")
|
||||
set_target_properties(msvcp_2${D_SUFFIX} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
set_target_properties(msvcp_2${D_SUFFIX} PROPERTIES OUTPUT_NAME "msvcp140_2${D_SUFFIX}${VCLIBS_SUFFIX}")
|
||||
|
@ -537,7 +532,7 @@ function(add_stl_dlls D_SUFFIX THIS_CONFIG_DEFINITIONS THIS_CONFIG_COMPILE_OPTIO
|
|||
|
||||
# import library
|
||||
add_library(msvcp${D_SUFFIX}_implib STATIC ${HEADERS})
|
||||
target_link_libraries(msvcp${D_SUFFIX}_implib msvcp${D_SUFFIX}_implib_objects std_init_once_begin_initialize std_init_once_complete)
|
||||
target_link_libraries(msvcp${D_SUFFIX}_implib msvcp${D_SUFFIX}_implib_objects)
|
||||
add_dependencies(msvcp${D_SUFFIX}_implib msvcp${D_SUFFIX} msvcp_1${D_SUFFIX} msvcp_2${D_SUFFIX} msvcp${D_SUFFIX}_atomic_wait msvcp${D_SUFFIX}_codecvt_ids)
|
||||
set_target_properties(msvcp${D_SUFFIX}_implib PROPERTIES STATIC_LIBRARY_OPTIONS "/NOLOGO;/NODEFAULTLIB;/IGNORE:4006;$<TARGET_LINKER_FILE:msvcp${D_SUFFIX}>;$<TARGET_LINKER_FILE:msvcp_1${D_SUFFIX}>;$<TARGET_LINKER_FILE:msvcp_2${D_SUFFIX}>;$<TARGET_LINKER_FILE:msvcp${D_SUFFIX}_codecvt_ids>;$<TARGET_LINKER_FILE:msvcp${D_SUFFIX}_atomic_wait>")
|
||||
set_target_properties(msvcp${D_SUFFIX}_implib PROPERTIES ARCHIVE_OUTPUT_NAME "msvcprt${D_SUFFIX}")
|
||||
|
@ -554,7 +549,7 @@ function(add_stl_statics FLAVOR_SUFFIX THIS_CONFIG_DEFINITIONS THIS_CONFIG_COMPI
|
|||
add_library(libcpmt${FLAVOR_SUFFIX} STATIC ${HEADERS} ${IMPLIB_SOURCES} ${SOURCES} ${INITIALIZER_SOURCES} ${STATIC_SOURCES})
|
||||
target_compile_definitions(libcpmt${FLAVOR_SUFFIX} PRIVATE "${THIS_CONFIG_DEFINITIONS};_ANNOTATE_VECTOR")
|
||||
target_compile_options(libcpmt${FLAVOR_SUFFIX} PRIVATE "${THIS_CONFIG_COMPILE_OPTIONS};/EHsc")
|
||||
target_link_libraries(libcpmt${FLAVOR_SUFFIX} PRIVATE Boost::math libcpmt${FLAVOR_SUFFIX}_eha std_init_once_begin_initialize std_init_once_complete)
|
||||
target_link_libraries(libcpmt${FLAVOR_SUFFIX} PRIVATE Boost::math libcpmt${FLAVOR_SUFFIX}_eha)
|
||||
endfunction()
|
||||
|
||||
add_stl_statics("" "_ITERATOR_DEBUG_LEVEL=0" "${VCLIBS_RELEASE_OPTIONS}")
|
||||
|
|
Двоичные данные
stl/aliases/amd64/std_init_once_begin_initialize.obj
До Ширина: | Высота: | Размер: 223 B |
Двоичные данные
stl/aliases/amd64/std_init_once_complete.obj
До Ширина: | Высота: | Размер: 208 B |
Двоичные данные
stl/aliases/arm/std_init_once_begin_initialize.obj
До Ширина: | Высота: | Размер: 223 B |
Двоичные данные
stl/aliases/arm/std_init_once_complete.obj
До Ширина: | Высота: | Размер: 208 B |
Двоичные данные
stl/aliases/arm64/std_init_once_begin_initialize.obj
Двоичные данные
stl/aliases/arm64/std_init_once_complete.obj
Двоичные данные
stl/aliases/arm64ec/std_init_once_begin_initialize.obj
Двоичные данные
stl/aliases/arm64ec/std_init_once_complete.obj
Двоичные данные
stl/aliases/chpe/std_init_once_begin_initialize.obj
До Ширина: | Высота: | Размер: 231 B |
Двоичные данные
stl/aliases/chpe/std_init_once_complete.obj
До Ширина: | Высота: | Размер: 216 B |
|
@ -1,75 +0,0 @@
|
|||
:: Copyright (c) Microsoft Corporation.
|
||||
:: SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
::
|
||||
:: Generates aliases for Windows API functions called by headers.
|
||||
:: TRANSITION, VSO-1116868 "'aliasobj.exe' should be available with Visual Studio"
|
||||
|
||||
cd %~dp0
|
||||
|
||||
rmdir /s /q i386
|
||||
rmdir /s /q amd64
|
||||
rmdir /s /q arm
|
||||
rmdir /s /q arm64
|
||||
rmdir /s /q chpe
|
||||
rmdir /s /q arm64ec
|
||||
|
||||
mkdir i386
|
||||
mkdir amd64
|
||||
mkdir arm
|
||||
mkdir arm64
|
||||
mkdir chpe
|
||||
mkdir arm64ec
|
||||
|
||||
:: __std_init_once_begin_initialize
|
||||
..\..\..\..\..\tools\x86\aliasobj.exe ^
|
||||
__imp____std_init_once_begin_initialize@16 ^
|
||||
__imp__InitOnceBeginInitialize@16 ^
|
||||
i386\std_init_once_begin_initialize.obj
|
||||
..\..\..\..\..\tools\amd64\aliasobj.exe ^
|
||||
__imp___std_init_once_begin_initialize ^
|
||||
__imp_InitOnceBeginInitialize ^
|
||||
amd64\std_init_once_begin_initialize.obj
|
||||
..\..\..\..\..\tools\x86\aliasobj.exe ^
|
||||
__imp___std_init_once_begin_initialize ^
|
||||
__imp_InitOnceBeginInitialize ^
|
||||
arm\std_init_once_begin_initialize.obj
|
||||
..\..\..\..\..\tools\amd64\aliasobj.exe ^
|
||||
/machine:arm64 ^
|
||||
__imp___std_init_once_begin_initialize ^
|
||||
__imp_InitOnceBeginInitialize ^
|
||||
arm64\std_init_once_begin_initialize.obj
|
||||
..\..\..\..\..\tools\x86\aliasobj.exe ^
|
||||
__imp_#__std_init_once_begin_initialize@16 ^
|
||||
__imp_#InitOnceBeginInitialize@16 ^
|
||||
chpe\std_init_once_begin_initialize.obj
|
||||
..\..\..\..\..\tools\amd64\aliasobj.exe ^
|
||||
/machine:arm64ec ^
|
||||
-m std_init_once_begin_initialize-arm64ec.txt ^
|
||||
arm64ec\std_init_once_begin_initialize.obj
|
||||
|
||||
:: __std_init_once_complete
|
||||
..\..\..\..\..\tools\x86\aliasobj.exe ^
|
||||
__imp____std_init_once_complete@12 ^
|
||||
__imp__InitOnceComplete@12 ^
|
||||
i386\std_init_once_complete.obj
|
||||
..\..\..\..\..\tools\amd64\aliasobj.exe ^
|
||||
__imp___std_init_once_complete ^
|
||||
__imp_InitOnceComplete ^
|
||||
amd64\std_init_once_complete.obj
|
||||
..\..\..\..\..\tools\x86\aliasobj.exe ^
|
||||
__imp___std_init_once_complete ^
|
||||
__imp_InitOnceComplete ^
|
||||
arm\std_init_once_complete.obj
|
||||
..\..\..\..\..\tools\amd64\aliasobj.exe ^
|
||||
/machine:arm64 ^
|
||||
__imp___std_init_once_complete ^
|
||||
__imp_InitOnceComplete ^
|
||||
arm64\std_init_once_complete.obj
|
||||
..\..\..\..\..\tools\x86\aliasobj.exe ^
|
||||
__imp_#__std_init_once_complete@12 ^
|
||||
__imp_#InitOnceComplete@12 ^
|
||||
chpe\std_init_once_complete.obj
|
||||
..\..\..\..\..\tools\amd64\aliasobj.exe ^
|
||||
/machine:arm64ec ^
|
||||
-m std_init_once_complete-arm64ec.txt ^
|
||||
arm64ec\std_init_once_complete.obj
|
Двоичные данные
stl/aliases/i386/std_init_once_begin_initialize.obj
До Ширина: | Высота: | Размер: 231 B |
Двоичные данные
stl/aliases/i386/std_init_once_complete.obj
До Ширина: | Высота: | Размер: 216 B |
|
@ -1,2 +0,0 @@
|
|||
#__std_init_once_begin_initialize #InitOnceBeginInitialize
|
||||
__imp___std_init_once_begin_initialize __imp_InitOnceBeginInitialize
|
|
@ -1,2 +0,0 @@
|
|||
#__std_init_once_complete #InitOnceComplete
|
||||
__imp___std_init_once_complete __imp_InitOnceComplete
|
|
@ -495,13 +495,14 @@ public:
|
|||
};
|
||||
#endif // _HAS_CXX17
|
||||
|
||||
#ifdef _M_CEE
|
||||
#if defined(_M_CEE) || defined(_M_ARM64EC) || defined(_M_HYBRID) \
|
||||
|| defined(__clang__) // TRANSITION, Clang doesn't recognize /ALTERNATENAME, not yet reported
|
||||
#define _WINDOWS_API __stdcall
|
||||
#define _RENAME_WINDOWS_API(_Api) _Api##_clr
|
||||
#else // ^^^ _M_CEE // !_M_CEE vvv
|
||||
#else // ^^^ use forwarders / use /ALTERNATENAME vvv
|
||||
#define _WINDOWS_API __declspec(dllimport) __stdcall
|
||||
#define _RENAME_WINDOWS_API(_Api) _Api
|
||||
#endif // _M_CEE
|
||||
#endif // ^^^ use /ALTERNATENAME ^^^
|
||||
|
||||
// WINBASEAPI
|
||||
// BOOL
|
||||
|
@ -526,6 +527,8 @@ extern "C" _NODISCARD int _WINDOWS_API _RENAME_WINDOWS_API(__std_init_once_begin
|
|||
extern "C" _NODISCARD int _WINDOWS_API _RENAME_WINDOWS_API(__std_init_once_complete)(
|
||||
void** _LpInitOnce, unsigned long _DwFlags, void* _LpContext) noexcept;
|
||||
|
||||
extern "C" [[noreturn]] void __stdcall __std_init_once_link_alternate_names_and_abort() noexcept;
|
||||
|
||||
// #define RTL_RUN_ONCE_INIT_FAILED 0x00000004UL
|
||||
// #define INIT_ONCE_INIT_FAILED RTL_RUN_ONCE_INIT_FAILED
|
||||
_INLINE_VAR constexpr unsigned long _Init_once_init_failed = 0x4UL;
|
||||
|
@ -535,7 +538,7 @@ struct _Init_once_completer {
|
|||
unsigned long _DwFlags;
|
||||
~_Init_once_completer() {
|
||||
if (_RENAME_WINDOWS_API(__std_init_once_complete)(&_Once._Opaque, _DwFlags, nullptr) == 0) {
|
||||
_CSTD abort();
|
||||
__std_init_once_link_alternate_names_and_abort();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -186,11 +186,6 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|||
</BuildFiles>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(CrtBuildModelIsDll)' != 'true'">
|
||||
<Lib Include="$(MSBuildThisFileDirectory)\..\..\aliases\$(BuildArchitecture)\std_init_once_begin_initialize.obj" />
|
||||
<Lib Include="$(MSBuildThisFileDirectory)\..\..\aliases\$(BuildArchitecture)\std_init_once_complete.obj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Choose>
|
||||
<When Condition="'$(CrtBuildModel)' != 'md'">
|
||||
<!-- Only check exports of release, DLL, builds -->
|
||||
|
|
|
@ -67,8 +67,6 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|||
<Lib Include="$(CrtLibPath)\msvcprt$(BuildSuffix)_atomic_wait$(ClrLibSuffix).lib">
|
||||
<IncludeInChameleonLib>false</IncludeInChameleonLib>
|
||||
</Lib>
|
||||
<Lib Include="$(MSBuildThisFileDirectory)\..\..\aliases\$(BuildArchitecture)\std_init_once_begin_initialize.obj" />
|
||||
<Lib Include="$(MSBuildThisFileDirectory)\..\..\aliases\$(BuildArchitecture)\std_init_once_complete.obj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$(VCToolsRootPath)\crt\crt_build.targets"/>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <yvals_core.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <synchapi.h>
|
||||
|
||||
// This must be as small as possible, because its contents are
|
||||
|
@ -11,7 +12,8 @@
|
|||
// In particular, basic_string must not be included here.
|
||||
|
||||
// Provides forwarders for InitOnceBeginInitialize and InitOnceComplete for
|
||||
// environments that can't use aliasobj, like /clr.
|
||||
// environments that can't use /ALTERNATENAME.
|
||||
// They were originally specific to /clr but are now used in other scenarios.
|
||||
|
||||
_EXTERN_C
|
||||
|
||||
|
@ -24,4 +26,20 @@ int __stdcall __std_init_once_complete_clr(void** _LpInitOnce, unsigned long _Dw
|
|||
return InitOnceComplete(reinterpret_cast<LPINIT_ONCE>(_LpInitOnce), _DwFlags, _LpContext);
|
||||
}
|
||||
|
||||
[[noreturn]] void __stdcall __std_init_once_link_alternate_names_and_abort() noexcept {
|
||||
_CSTD abort();
|
||||
}
|
||||
|
||||
#if defined(_M_ARM64EC) || defined(_M_HYBRID)
|
||||
// <mutex> uses the forwarder fallbacks for ARM64EC and CHPE.
|
||||
#elif defined(_M_IX86)
|
||||
#pragma comment(linker, "/ALTERNATENAME:__imp____std_init_once_begin_initialize@16=__imp__InitOnceBeginInitialize@16")
|
||||
#pragma comment(linker, "/ALTERNATENAME:__imp____std_init_once_complete@12=__imp__InitOnceComplete@12")
|
||||
#elif defined(_M_X64) || defined(_M_ARM) || defined(_M_ARM64)
|
||||
#pragma comment(linker, "/ALTERNATENAME:__imp___std_init_once_begin_initialize=__imp_InitOnceBeginInitialize")
|
||||
#pragma comment(linker, "/ALTERNATENAME:__imp___std_init_once_complete=__imp_InitOnceComplete")
|
||||
#else // ^^^ known architecture / unknown architecture vvv
|
||||
#error Unknown architecture
|
||||
#endif // ^^^ unknown architecture ^^^
|
||||
|
||||
_END_EXTERN_C
|
||||
|
|