On 24/02/16 10:29, Gisle Vanem wrote:
> Matt Caswell wrote:
> 
>> The attached seems to avoid the problem - but then for reasons I cannot
>> understand link errors result later on in the build.
> 
> I too can confirm that your patch fixes MSVC-2105 compilation.
> Thanks a million!
> 
> But as you wrote, the link fails. Due to util/mkdef.pl needs
> an update? I looked at this .pl-file, but I'm a n00b when it
> comes to Perl. So I fail to see how it now should define all
> needed .def symbols.
> 
> As it's now, ssleay32.dll export only these:
>   BIO_f_ssl
>   BIO_new_ssl
>   BIO_ssl_copy_session_id
>   BIO_ssl_shutdown
>   BIO_new_buffer_ssl_connect
>   BIO_new_ssl_connect
> 
> But is building with -DOPENSSL_OPT_WINDLL (i.e. __declspec(dllimport)
> while using the OpenSSL .DLLs) still supported? If so, what is the
> .def-files good for then?
> 
The complete patch is attached. This is currently going through review,
and solves the link issue.

Matt
>From b4f4c8dfdb9ab4b88b52ee5708dc4da16c10ee64 Mon Sep 17 00:00:00 2001
From: Matt Caswell <m...@openssl.org>
Date: Tue, 23 Feb 2016 15:27:05 +0000
Subject: [PATCH] Workaround for VisualStudio 2015 bug

VisualStudio 2015 has a bug where an internal compiler error was occurring.
By reordering the DEFINE_STACK_OF declarations for SSL_CIPHER and SSL_COMP
until after the ssl3.h include everything seems ok again.
---
 include/openssl/ssl.h | 11 +++++++++--
 util/mkdef.pl         |  3 ++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index 9709103..4fb4e8a 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -326,8 +326,8 @@ typedef struct tls_sigalgs_st TLS_SIGALGS;
 typedef struct ssl_conf_ctx_st SSL_CONF_CTX;
 typedef struct ssl_comp_st SSL_COMP;
 
-DEFINE_STACK_OF_CONST(SSL_CIPHER)
-DEFINE_STACK_OF(SSL_COMP)
+STACK_OF(SSL_CIPHER);
+STACK_OF(SSL_COMP);
 
 /* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/
 typedef struct srtp_protection_profile_st {
@@ -907,6 +907,13 @@ __owur int SSL_extension_supported(unsigned int ext_type);
 extern "C" {
 #endif
 
+/*
+ * These need to be after the above set of includes due to a compiler bug
+ * in VisualStudio 2015
+ */
+DEFINE_STACK_OF_CONST(SSL_CIPHER)
+DEFINE_STACK_OF(SSL_COMP)
+
 /* compatibility */
 # define SSL_set_app_data(s,arg)         (SSL_set_ex_data(s,0,(char *)arg))
 # define SSL_get_app_data(s)             (SSL_get_ex_data(s,0))
diff --git a/util/mkdef.pl b/util/mkdef.pl
index a2fedc5..e9a3aff 100755
--- a/util/mkdef.pl
+++ b/util/mkdef.pl
@@ -632,7 +632,8 @@ sub do_defs
 				next;
 			}
 			if ($tag{'TRUE'} != -1) {
-				if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) {
+				if (/^\s*DEFINE_STACK_OF\s*\(\s*(\w*)\s*\)/
+						|| /^\s*DEFINE_STACK_OF_CONST\s*\(\s*(\w*)\s*\)/) {
 					next;
 				} elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) {
 					$def .= "int d2i_$3(void);";
-- 
2.5.0

-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

Reply via email to