--- include/mbedtls/bn_mul.h	2019-09-06 16:33:55.000000000 +0200
+++ include/mbedtls/bn_mul.h	2019-11-04 16:42:16.682670628 +0100
@@ -64,7 +64,7 @@
  * This is done as the number of registers used in the assembly code doesn't
  * work with the -O0 option.
  */
-#if defined(__i386__) && defined(__OPTIMIZE__)
+#if defined(__i386__) && defined(__OPTIMIZE__) && !defined(__PIC__)
 
 #define MULADDC_INIT                        \
     asm(                                    \
--- include/mbedtls/x509_crt.h	2019-09-06 16:33:55.000000000 +0200
+++ include/mbedtls/x509_crt.h	2019-11-04 16:42:16.681670623 +0100
@@ -203,22 +203,34 @@
 #endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */
 
 #if defined(MBEDTLS_X509_CRT_PARSE_C)
+#ifdef _MSC_VER
+    #if defined(X509_USE_SHARED)
+        #define X509_EXPORT __declspec(dllimport)
+    #elif defined(X509_BUILD_SHARED)
+        #define X509_EXPORT __declspec(dllexport)
+    #else
+        #define X509_EXPORT extern
+    #endif
+#else
+    #define X509_EXPORT extern
+#endif
+
 /**
  * Default security profile. Should provide a good balance between security
  * and compatibility with current deployments.
  */
-extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default;
+X509_EXPORT const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default;
 
 /**
  * Expected next default profile. Recommended for new deployments.
  * Currently targets a 128-bit security level, except for RSA-2048.
  */
-extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next;
+X509_EXPORT const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next;
 
 /**
  * NSA Suite B profile.
  */
-extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb;
+X509_EXPORT const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb;
 
 /**
  * \brief          Parse a single DER formatted certificate and add it
--- library/CMakeLists.txt	2019-09-06 14:35:30.000000000 +0200
+++ library/CMakeLists.txt	2019-11-04 16:42:16.681670623 +0100
@@ -159,7 +159,7 @@
     target_link_libraries(${mbedtls_static_target} ${libs} ${mbedx509_static_target})
 
     install(TARGETS ${mbedtls_static_target} ${mbedx509_static_target} ${mbedcrypto_static_target}
-            DESTINATION ${LIB_INSTALL_DIR}
+            ARCHIVE DESTINATION ${LIB_INSTALL_DIR} LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin
             PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 endif(USE_STATIC_MBEDTLS_LIBRARY)
 
@@ -177,7 +177,7 @@
     target_link_libraries(mbedtls ${libs} mbedx509)
 
     install(TARGETS mbedtls mbedx509 mbedcrypto
-            DESTINATION ${LIB_INSTALL_DIR}
+            ARCHIVE DESTINATION ${LIB_INSTALL_DIR} LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin
             PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 endif(USE_SHARED_MBEDTLS_LIBRARY)
 
