mirror of
https://github.com/openssl/openssl.git
synced 2026-05-07 20:12:39 +00:00
Windows: Use /Z7 compiler flag to enable parallel builds
MSVC compilation on Windows cannot be reliably parallelized with tools like jom (an nmake replacement) due to contention on shared .pdb files used for debug info. Writes to a shared .pdb must be serialized. The /FS compiler flag serializes concurrent compiler writes, but does not resolve contention when the compiler and linker access the same .pdb file. With shared .pdb files (e.g. app.pdb), the makefile does not prevent races between the linker and compilation of multiple targets. This can be resolved either by restructuring the makefile to introduce sentinel dependencies that serialize the conflicting steps, or by eliminating the shared .pdb entirely. This patch takes the latter approach: it replaces /Zi with /Z7, which embeds debug info directly into each .obj file and avoids any shared-file contention. /Z7 is supported by all MSVC versions. The linker-generated .pdb is unaffected. Side effects: object files are slightly larger, and all .pdb files are now named after their target — the shared app.pdb, ossl_static.pdb, and dso.pdb no longer exist. With this change, jom can be used to parallelize the build. Fixes: #9931 Signed-off-by: Milan Broz <gmazyland@gmail.com> Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Norbert Pocs <norbertp@openssl.org> MergeDate: Mon Apr 13 08:46:20 2026 (Merged from https://github.com/openssl/openssl/pull/30703)
This commit is contained in:
committed by
Nikola Pajkovsky
parent
0463cbf185
commit
be67880c1e
@@ -1541,10 +1541,10 @@ my %targets = (
|
||||
"UNICODE", "_UNICODE",
|
||||
"_CRT_SECURE_NO_DEPRECATE",
|
||||
"_WINSOCK_DEPRECATED_NO_WARNINGS"),
|
||||
lib_cflags => add("/Zi /Fdossl_static.pdb"),
|
||||
lib_cflags => add("/Z7"),
|
||||
lib_defines => add("L_ENDIAN"),
|
||||
dso_cflags => "/Zi /Fddso.pdb",
|
||||
bin_cflags => "/Zi /Fdapp.pdb",
|
||||
dso_cflags => "/Z7",
|
||||
bin_cflags => "/Z7",
|
||||
# def_flag made to empty string so a .def file gets generated
|
||||
shared_defflag => '',
|
||||
shared_ldflag => "/dll",
|
||||
|
||||
@@ -450,7 +450,7 @@ uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled
|
||||
|
||||
libclean:
|
||||
"$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """{.,apps,test,fuzz}/$$1.*"""; } @ARGV" $(SHLIBS)
|
||||
-del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb
|
||||
-del /Q /F $(LIBS) libcrypto.* libssl.*
|
||||
|
||||
clean: libclean
|
||||
{- join("\n\t", map { "-if exist $_ del /Q /F $_" } @HTMLDOCS1) || "\@rem" -}
|
||||
@@ -545,8 +545,6 @@ install_dev: install_runtime_libs
|
||||
"$(INSTALLTOP)\include\openssl"
|
||||
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(libdir)"
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)"
|
||||
@if "$(SHLIBS)"=="" \
|
||||
"$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)"
|
||||
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(CMAKECONFIGDIR)"
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_EXPORTERS_CMAKE) "$(CMAKECONFIGDIR)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user