Issue #21122: Fix LTO builds on OS X.
Patch by Brett Cannon.
diff --git a/configure.ac b/configure.ac
index b4c7016..1e77c66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1299,13 +1299,20 @@
 if test "$Py_LTO" = 'true' ; then
   case $CC in
     *clang*)
-      # Any changes made here should be reflected in the GCC+Darwin case below
-      LTOFLAGS="-flto"
+      case $ac_sys_system in
+        Darwin*)
+          # Any changes made here should be reflected in the GCC+Darwin case below
+          LTOFLAGS="-flto -Wl,-export_dynamic"
+          ;;
+        *)
+          LTOFLAGS="-flto"
+          ;;
+      esac
       ;;
     *gcc*)
       case $ac_sys_system in
         Darwin*)
-          LTOFLAGS="-flto"
+          LTOFLAGS="-flto -Wl,-export_dynamic"
           ;;
         *)
           LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"