aboutsummaryrefslogtreecommitdiffstats
path: root/main/python3/gnu-fallback-soabi.patch
blob: cc366c5ca27a5f648f8fdfcfb5bd867a05fcc47c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
index 23828898d3..6ad95e757e 100644
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -39,6 +39,9 @@ const char *_PyImport_DynLoadFiletab[] = {
     ".dll",
 #else  /* !__CYGWIN__ */
     "." SOABI ".so",
+#ifdef GNU_FALLBACK_SOABI
+    "." GNU_FALLBACK_SOABI ".so",
+#endif
 #ifdef ALT_SOABI
     "." ALT_SOABI ".so",
 #endif
diff --git a/configure.ac b/configure.ac
index 0e6b617080..72700cba84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4781,6 +4781,14 @@ AC_MSG_CHECKING(SOABI)
 SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}
 AC_MSG_RESULT($SOABI)
 
+# musl libc fallback to read -gnu SOABI for backwards compat
+if test "$SOABI" != "${SOABI%-musl}"; then
+  AC_SUBST(GNU_FALLBACK_SOABI)
+  GNU_FALLBACK_SOABI="${SOABI%-musl}-gnu"
+  AC_DEFINE_UNQUOTED(GNU_FALLBACK_SOABI, "${GNU_FALLBACK_SOABI}",
+            [Compatibility to read C extentions with -gnu suffix on musl libc])
+fi
+
 # Release and debug (Py_DEBUG) ABI are compatible, but not Py_TRACE_REFS ABI
 if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" != "yes"; then
   # Similar to SOABI but remove "d" flag from ABIFLAGS