From 7e1906bad51d004d2065ddfee3c358c10c085640 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Thu, 2 Jun 2016 13:21:28 -0700 Subject: [PATCH] dll: 32-bit builds now include the MSVCRT default libraries (for __allmul symbol) --- build/VStudio/launcher/launchctl.vcxproj | 4 ++++ build/VStudio/launcher/launcher.vcxproj | 4 ++++ build/VStudio/testing/memfs.vcxproj | 8 ++++---- build/VStudio/testing/winfsp-tests.vcxproj | 8 ++++---- build/VStudio/winfsp_dll.vcxproj | 12 ++++++------ src/shared/minimal.h | 17 +++++++++++++++++ 6 files changed, 39 insertions(+), 14 deletions(-) diff --git a/build/VStudio/launcher/launchctl.vcxproj b/build/VStudio/launcher/launchctl.vcxproj index cfc460ca..f8912642 100644 --- a/build/VStudio/launcher/launchctl.vcxproj +++ b/build/VStudio/launcher/launchctl.vcxproj @@ -104,6 +104,7 @@ ..\..\..\src;..\..\..\inc false Default + MultiThreaded Console @@ -121,6 +122,7 @@ ..\..\..\src;..\..\..\inc false Default + MultiThreaded Console @@ -139,6 +141,7 @@ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\src;..\..\..\inc false + MultiThreaded Console @@ -159,6 +162,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\src;..\..\..\inc false + MultiThreaded Console diff --git a/build/VStudio/launcher/launcher.vcxproj b/build/VStudio/launcher/launcher.vcxproj index b0b06e81..4f0c6a86 100644 --- a/build/VStudio/launcher/launcher.vcxproj +++ b/build/VStudio/launcher/launcher.vcxproj @@ -104,6 +104,7 @@ ..\..\..\src;..\..\..\inc Default false + MultiThreaded Console @@ -121,6 +122,7 @@ ..\..\..\src;..\..\..\inc Default false + MultiThreaded Console @@ -139,6 +141,7 @@ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\src;..\..\..\inc false + MultiThreaded Console @@ -159,6 +162,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\src;..\..\..\inc false + MultiThreaded Console diff --git a/build/VStudio/testing/memfs.vcxproj b/build/VStudio/testing/memfs.vcxproj index b650cc20..c1d268c1 100644 --- a/build/VStudio/testing/memfs.vcxproj +++ b/build/VStudio/testing/memfs.vcxproj @@ -103,7 +103,7 @@ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true ..\..\..\src;..\..\..\inc - MultiThreadedDLL + MultiThreaded Console @@ -119,7 +119,7 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true ..\..\..\src;..\..\..\inc - MultiThreadedDLL + MultiThreaded Console @@ -137,7 +137,7 @@ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true ..\..\..\src;..\..\..\inc - MultiThreadedDLL + MultiThreaded Console @@ -157,7 +157,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true ..\..\..\src;..\..\..\inc - MultiThreadedDLL + MultiThreaded Console diff --git a/build/VStudio/testing/winfsp-tests.vcxproj b/build/VStudio/testing/winfsp-tests.vcxproj index 0aca06df..8cd4bdd6 100644 --- a/build/VStudio/testing/winfsp-tests.vcxproj +++ b/build/VStudio/testing/winfsp-tests.vcxproj @@ -102,7 +102,7 @@ __func__=__FUNCTION__;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true ..\..\..\tst\memfs;..\..\..\src;..\..\..\inc;..\..\..\ext - MultiThreadedDLL + MultiThreaded Console @@ -119,7 +119,7 @@ __func__=__FUNCTION__;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true ..\..\..\tst\memfs;..\..\..\src;..\..\..\inc;..\..\..\ext - MultiThreadedDLL + MultiThreaded Console @@ -138,7 +138,7 @@ __func__=__FUNCTION__;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true ..\..\..\tst\memfs;..\..\..\src;..\..\..\inc;..\..\..\ext - MultiThreadedDLL + MultiThreaded Console @@ -159,7 +159,7 @@ __func__=__FUNCTION__;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true ..\..\..\tst\memfs;..\..\..\src;..\..\..\inc;..\..\..\ext - MultiThreadedDLL + MultiThreaded Console diff --git a/build/VStudio/winfsp_dll.vcxproj b/build/VStudio/winfsp_dll.vcxproj index d6999a41..29f4208c 100644 --- a/build/VStudio/winfsp_dll.vcxproj +++ b/build/VStudio/winfsp_dll.vcxproj @@ -170,7 +170,7 @@ copy /b $(OutDir)fuse-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse-$(Platfor ..\..\src;..\..\inc - MultiThreadedDLL + MultiThreaded Default false @@ -180,7 +180,7 @@ copy /b $(OutDir)fuse-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse-$(Platfor $(OutDir)$(TargetFileName).pdb true $(OutDir)$(TargetFileName).map - true + false ..\..\src\dll\library.def %(AdditionalDependencies);version.lib @@ -195,7 +195,7 @@ copy /b $(OutDir)fuse-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse-$(Platfor ..\..\src;..\..\inc - MultiThreadedDLL + MultiThreaded Default false @@ -222,7 +222,7 @@ copy /b $(OutDir)fuse-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse-$(Platfor ..\..\src;..\..\inc - MultiThreadedDLL + MultiThreaded false @@ -233,7 +233,7 @@ copy /b $(OutDir)fuse-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse-$(Platfor $(OutDir)$(TargetFileName).pdb true $(OutDir)$(TargetFileName).map - true + false ..\..\src\dll\library.def %(AdditionalDependencies);version.lib @@ -250,7 +250,7 @@ copy /b $(OutDir)fuse-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse-$(Platfor ..\..\src;..\..\inc - MultiThreadedDLL + MultiThreaded false diff --git a/src/shared/minimal.h b/src/shared/minimal.h index 7728f312..537aac54 100644 --- a/src/shared/minimal.h +++ b/src/shared/minimal.h @@ -24,8 +24,25 @@ * For this to work the following project settings must be set: * - "C/C++ > General > SDL checks" must be empty (not "Yes" or "No"). * - "C/C++ > Code Generation > Basic Runtime Checks" must be set to "Default" + * - "C/C++ > Code Generation > Runtime Library" must be set to "Multi-threaded (/MT)". * - "C/C++ > Code Generation > Security Check" must be disabled (/GS-). * - "Linker > Input > Ignore All Default Libraries" must be "Yes". + * + * + * Update: + * + * It is possible to have the "Linker > Input > Ignore All Default Libraries" + * setting to "No" and still eliminate most dependencies on the MSVCRT libraries. + * For example, the WinFsp DLL does this on 32-bit builds (only) to include the + * __allmul symbol that is used when doing int64_t multiplications. + * + * The following project setting must be changed: + * - "Linker > Input > Ignore All Default Libraries" must be "No". + * + * Extreme care must be taken to ensure that the linker does not pull in symbols + * that are not required (or worse create a half-baked CRT). For example, the WinFsp + * DLL ensures this by setting the "Linker > Input > Ignore All Default Libraries" + * to "Yes" on 64-bit builds and "No" on 32-bit builds. */ #undef RtlFillMemory