mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
dllmain: exclude from Cygwin builds
On Cygwin, it is unsafe to call POSIX functions from DllMain, which OPENSSL_thread_stop does. Additionally, it should be unnecessary as OpenSSL uses pthread_key_create to register a thread destructor to do thread cleanup in a POSIX way. Reported-by: Yuyi Wang Ref: https://cygwin.com/pipermail/cygwin/2025-June/258235.html Fixes #17262 Closes https://github.com/curl/curl/pull/17528
This commit is contained in:
parent
f1e1c8b98a
commit
7a30481760
4 changed files with 3 additions and 29 deletions
|
|
@ -637,7 +637,6 @@ curl_cv_cygwin='no'
|
||||||
case $host_os in
|
case $host_os in
|
||||||
cygwin*|msys*) curl_cv_cygwin='yes';;
|
cygwin*|msys*) curl_cv_cygwin='yes';;
|
||||||
esac
|
esac
|
||||||
AM_CONDITIONAL(DOING_CYGWIN, test "x$curl_cv_cygwin" = xyes)
|
|
||||||
|
|
||||||
AM_CONDITIONAL([HAVE_WINDRES],
|
AM_CONDITIONAL([HAVE_WINDRES],
|
||||||
[test "$curl_cv_native_windows" = "yes" && test -n "${RC}"])
|
[test "$curl_cv_native_windows" = "yes" && test -n "${RC}"])
|
||||||
|
|
|
||||||
|
|
@ -179,15 +179,8 @@ if(BUILD_SHARED_LIBS)
|
||||||
list(APPEND libcurl_export ${LIB_SHARED})
|
list(APPEND libcurl_export ${LIB_SHARED})
|
||||||
add_library(${LIB_SHARED} SHARED ${LIB_SOURCE})
|
add_library(${LIB_SHARED} SHARED ${LIB_SOURCE})
|
||||||
add_library(${PROJECT_NAME}::${LIB_SHARED} ALIAS ${LIB_SHARED})
|
add_library(${PROJECT_NAME}::${LIB_SHARED} ALIAS ${LIB_SHARED})
|
||||||
if(WIN32 OR CYGWIN)
|
|
||||||
if(CYGWIN)
|
|
||||||
# For Cygwin always compile dllmain.c as a separate unit since it
|
|
||||||
# includes windows.h, which should not be included in other units.
|
|
||||||
set_source_files_properties("dllmain.c" PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
|
||||||
endif()
|
|
||||||
set_property(TARGET ${LIB_SHARED} APPEND PROPERTY SOURCES "dllmain.c")
|
|
||||||
endif()
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
set_property(TARGET ${LIB_SHARED} APPEND PROPERTY SOURCES "dllmain.c")
|
||||||
set_property(TARGET ${LIB_SHARED} APPEND PROPERTY SOURCES "libcurl.rc")
|
set_property(TARGET ${LIB_SHARED} APPEND PROPERTY SOURCES "libcurl.rc")
|
||||||
if(CURL_HIDES_PRIVATE_SYMBOLS)
|
if(CURL_HIDES_PRIVATE_SYMBOLS)
|
||||||
set_property(TARGET ${LIB_SHARED} APPEND PROPERTY SOURCES "${PROJECT_SOURCE_DIR}/lib/libcurl.def")
|
set_property(TARGET ${LIB_SHARED} APPEND PROPERTY SOURCES "${PROJECT_SOURCE_DIR}/lib/libcurl.def")
|
||||||
|
|
|
||||||
|
|
@ -74,10 +74,6 @@ include Makefile.inc
|
||||||
|
|
||||||
if DOING_NATIVE_WINDOWS
|
if DOING_NATIVE_WINDOWS
|
||||||
CSOURCES += dllmain.c
|
CSOURCES += dllmain.c
|
||||||
else
|
|
||||||
if DOING_CYGWIN
|
|
||||||
CSOURCES += dllmain.c
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if USE_UNITY
|
if USE_UNITY
|
||||||
|
|
@ -89,11 +85,6 @@ if CURLDEBUG
|
||||||
# applying to it.
|
# applying to it.
|
||||||
curl_EXCLUDE += memdebug.c
|
curl_EXCLUDE += memdebug.c
|
||||||
endif
|
endif
|
||||||
# For Cygwin always compile dllmain.c as a separate unit since it
|
|
||||||
# includes windows.h, which should not be included in other units.
|
|
||||||
if DOING_CYGWIN
|
|
||||||
curl_EXCLUDE += dllmain.c
|
|
||||||
endif
|
|
||||||
libcurl_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CSOURCES)
|
libcurl_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CSOURCES)
|
||||||
@PERL@ $(top_srcdir)/scripts/mk-unity.pl $(srcdir) $(CSOURCES) --exclude $(curl_EXCLUDE) > libcurl_unity.c
|
@PERL@ $(top_srcdir)/scripts/mk-unity.pl $(srcdir) $(CSOURCES) --exclude $(curl_EXCLUDE) > libcurl_unity.c
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,22 +28,13 @@
|
||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The fourth-to-last include */
|
|
||||||
#ifdef __CYGWIN__
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
#ifdef _WIN32
|
|
||||||
#undef _WIN32
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The last 3 #include files should be in this order */
|
/* The last 3 #include files should be in this order */
|
||||||
#include "curl_printf.h"
|
#include "curl_printf.h"
|
||||||
#include "curl_memory.h"
|
#include "curl_memory.h"
|
||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
|
|
||||||
/* DllMain() must only be defined for Windows and Cygwin DLL builds. */
|
/* DllMain() must only be defined for Windows DLL builds. */
|
||||||
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(CURL_STATICLIB)
|
#if defined(_WIN32) && !defined(CURL_STATICLIB)
|
||||||
|
|
||||||
#if defined(USE_OPENSSL) && \
|
#if defined(USE_OPENSSL) && \
|
||||||
!defined(OPENSSL_IS_AWSLC) && \
|
!defined(OPENSSL_IS_AWSLC) && \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue