crt: Fix building of libmsvcrtd.a import library

libmsvcrtd.a is import library for msvcrtd.dll and therefore it cannot
include libmsvcrt_extra.a library which object files are compiled with
-D__LIBMSVCRT_OS__ which instruct code to access msvcrt.dll library.

Add a new static library libmsvcrtd_extra.a which is compiled source
file names required for msvcrt 6.0 version and compile them without
the -D__LIBMSVCRT_OS__ option. Then use this new static library
libmsvcrtd_extra.a for building the final libmsvcrtd.a import library.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Pali Rohár 2024-10-24 18:07:27 +02:00 committed by Martin Storsjö
parent a91373e69f
commit a0f055e64e
2 changed files with 11 additions and 3 deletions

View File

@ -802,6 +802,12 @@ src_msvcrt40=\
$(src_pre_msvcr100) \
$(src_pre_msvcr120)
src_msvcrtd=\
$(src_pre_msvcr70) \
$(src_pre_msvcr80) \
$(src_pre_msvcr100) \
$(src_pre_msvcr120)
src_msvcr70=\
$(src_pre_msvcr80) \
$(src_pre_msvcr100) \
@ -1311,7 +1317,7 @@ lib32/libmsvcr40d.a: lib32/msvcr40d.mri lib32/libmsvcr40d_def.a lib32/libmsvcrt_
cd $(dir $@) && $(AR) -M < $(abspath $<)
lib32_DATA += lib32/libmsvcrtd.a
lib32/libmsvcrtd.a: lib32/msvcrtd.mri lib32/libmsvcrtd_def.a lib32/libmsvcrt_common.a lib32/libmsvcrt_extra.a
lib32/libmsvcrtd.a: lib32/msvcrtd.mri lib32/libmsvcrtd_def.a lib32/libmsvcrt_common.a lib32/libmsvcrtd_extra.a
cd $(dir $@) && $(AR) -M < $(abspath $<)
lib32_DATA += lib32/libmsvcr70.a
@ -1383,7 +1389,7 @@ lib32/libucrtbased.a: lib-common/ucrtbased.mri lib32/libucrtbased_def.a lib32/li
cd $(dir $@) && $(AR) -M < $(abspath $<)
lib32_DATA += lib32/libucrt.a lib32/libucrtapp.a
noinst_LIBRARIES += lib32/libcrtdll_extra.a lib32/libmsvcrt10_extra.a lib32/libmsvcrt20_extra.a lib32/libmsvcrt40_extra.a lib32/libmsvcrt_common.a lib32/libmsvcrt_extra.a lib32/libmsvcr70_extra.a lib32/libmsvcr71_extra.a lib32/libmsvcr80_extra.a lib32/libmsvcr90_extra.a lib32/libmsvcr100_extra.a lib32/libmsvcr110_extra.a lib32/libmsvcr120_extra.a lib32/libmsvcr120_app_extra.a lib32/libucrt_extra.a lib32/libucrtapp_extra.a
noinst_LIBRARIES += lib32/libcrtdll_extra.a lib32/libmsvcrt10_extra.a lib32/libmsvcrt20_extra.a lib32/libmsvcrt40_extra.a lib32/libmsvcrt_common.a lib32/libmsvcrt_extra.a lib32/libmsvcrtd_extra.a lib32/libmsvcr70_extra.a lib32/libmsvcr71_extra.a lib32/libmsvcr80_extra.a lib32/libmsvcr90_extra.a lib32/libmsvcr100_extra.a lib32/libmsvcr110_extra.a lib32/libmsvcr120_extra.a lib32/libmsvcr120_app_extra.a lib32/libucrt_extra.a lib32/libucrtapp_extra.a
lib32_libcrtdll_extra_a_SOURCES = $(src_crtdll)
lib32_libcrtdll_extra_a_CPPFLAGS = $(CPPFLAGS32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
lib32_libmsvcrt10_extra_a_SOURCES = $(src_msvcrt10)
@ -1396,6 +1402,8 @@ lib32_libmsvcrt_common_a_SOURCES = $(src_msvcrt_common32)
lib32_libmsvcrt_common_a_CPPFLAGS=$(CPPFLAGS32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
lib32_libmsvcrt_extra_a_SOURCES = $(src_msvcrt32)
lib32_libmsvcrt_extra_a_CPPFLAGS=$(CPPFLAGS32) -D__LIBMSVCRT__ -D__LIBMSVCRT_OS__ $(extra_include) $(sysincludes)
lib32_libmsvcrtd_extra_a_SOURCES = $(src_msvcrtd)
lib32_libmsvcrtd_extra_a_CPPFLAGS = $(CPPFLAGS32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
lib32_libmsvcr70_extra_a_SOURCES = $(src_msvcr70)
lib32_libmsvcr70_extra_a_CPPFLAGS = $(CPPFLAGS32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
lib32_libmsvcr71_extra_a_SOURCES = $(src_msvcr71)

View File

@ -1,6 +1,6 @@
CREATE libmsvcrtd.a
ADDLIB libmsvcrtd_def.a
ADDLIB libmsvcrt_common.a
ADDLIB libmsvcrt_extra.a
ADDLIB libmsvcrtd_extra.a
SAVE
END