]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-127604: ensure `-ldl` is passed only once to the linker (#133071)
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>
Mon, 28 Apr 2025 09:55:02 +0000 (11:55 +0200)
committerGitHub <noreply@github.com>
Mon, 28 Apr 2025 09:55:02 +0000 (11:55 +0200)
Python/traceback.c
configure
configure.ac

index ff8d29fa5207be649c6a95d1875958539b9f3848..0ac0b28201c483702a7c8dfa8258f9d511a857fc 100644 (file)
@@ -33,9 +33,9 @@
 #ifdef HAVE_LINK_H
 #    include <link.h>               // struct DL_info
 #endif
-#  if defined(__APPLE__) && defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS) && defined(HAVE_DLADDR)
+#  if defined(__APPLE__) && defined(HAVE_BACKTRACE) && defined(HAVE_DLADDR)
 #    define CAN_C_BACKTRACE
-#  elif defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS) && defined(HAVE_DLADDR1)
+#  elif defined(HAVE_BACKTRACE) && defined(HAVE_DLADDR1)
 #    define CAN_C_BACKTRACE
 #  endif
 #endif
index 26e6fb1e6b679c394c10d1a7668b48468ec90afa..205f196a25af2d57f6f9f3cf2869e0ae564769ae 100755 (executable)
--- a/configure
+++ b/configure
@@ -11900,7 +11900,7 @@ then :
 _ACEOF
 
     # dladdr1 requires -ldl
-    as_fn_append LDFLAGS " -ldl"
+    ac_cv_require_ldl=yes
 
 fi
 
@@ -11909,6 +11909,10 @@ done
 fi
 
 done
+if test "x$ac_cv_require_ldl" = xyes
+then :
+  as_fn_append LDFLAGS " -ldl"
+fi
 
 # bluetooth/bluetooth.h has been known to not compile with -std=c99.
 # http://permalink.gmane.org/gmane.linux.bluez.kernel/22294
index 04ce606845daca841af9e74bab718b82a1a394e1..f0ae7fbec1cbfe33ba9cc4dac6ee1f2da898a3a1 100644 (file)
@@ -2989,9 +2989,10 @@ AC_HEADER_MAJOR
 AC_CHECK_HEADERS([execinfo.h link.h dlfcn.h], [
   AC_CHECK_FUNCS([backtrace dladdr1], [
     # dladdr1 requires -ldl
-    AS_VAR_APPEND([LDFLAGS], [" -ldl"])
+    ac_cv_require_ldl=yes
   ])
 ])
+AS_VAR_IF([ac_cv_require_ldl], [yes], [AS_VAR_APPEND([LDFLAGS], [" -ldl"])])
 
 # bluetooth/bluetooth.h has been known to not compile with -std=c99.
 # http://permalink.gmane.org/gmane.linux.bluez.kernel/22294