]> granicus.if.org Git - php/commitdiff
Add IL compat flag to Windows builds
authorDavid Gebler <davidgebler@gmail.com>
Tue, 2 Feb 2021 15:44:21 +0000 (16:44 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Wed, 3 Feb 2021 10:43:38 +0000 (11:43 +0100)
Enabled by default; use `--disable-vs-link-compat` to disable.

Closes GH-6658.

win32/build/confutils.js

index 19fbd52aa999cc60a19f710a2bf9912b71a3053c..38a5fb75aa330ce3ea876879915aad944cb96c5e 100644 (file)
@@ -3404,6 +3404,12 @@ function toolset_setup_common_ldlags()
                                ADD_FLAG('LDFLAGS', "/GUARD:CF");
                        }
                }
+               if (PHP_VS_LINK_COMPAT != "no") {
+                       // Allow compatible IL versions, do not require an exact match.
+                       // Prevents build failures where different libs were built with different (but compatible) IL versions.
+                       // See fatal error C1047.
+                       ADD_FLAG("LDFLAGS", "/d2:-AllowCompatibleILVersions ");
+               }
        }
 }
 
@@ -3753,3 +3759,9 @@ function setup_verbosity()
                CMD_MOD2 = "@";
        }
 }
+
+try {
+       ARG_ENABLE('vs-link-compat', 'Allow linking of libraries built with compatible versions of VS toolset', 'yes');
+} catch (e) {
+       STDOUT.WriteLine("problem: " + e);
+}