Skip to content

gh-127604: Optimize -ldl usage on platforms that use dlopen for libFFI. #133081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 112 additions & 101 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 16 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2985,15 +2985,6 @@ AC_CHECK_HEADERS([ \
AC_HEADER_DIRENT
AC_HEADER_MAJOR

# for faulthandler
AC_CHECK_HEADERS([execinfo.h link.h dlfcn.h], [
AC_CHECK_FUNCS([backtrace dladdr1], [
# dladdr1 requires -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
SAVE_CFLAGS=$CFLAGS
Expand Down Expand Up @@ -3715,6 +3706,22 @@ AC_CHECK_LIB([dl], [dlopen]) # Dynamic linking for SunOS/Solaris and SYSV
AC_CHECK_LIB([dld], [shl_load]) # Dynamic linking for HP-UX


dnl for faulthandler
AC_CHECK_HEADERS([execinfo.h link.h dlfcn.h], [
AC_CHECK_FUNCS([backtrace dladdr1], [
# dladdr1 requires -ldl
ac_cv_require_ldl=yes
])
])

dnl only add -ldl to LDFLAGS if it isn't already part of LIBS (GH-133081)
AS_VAR_IF([ac_cv_require_ldl], [yes], [
AS_VAR_IF([ac_cv_lib_dl_dlopen], [yes], [], [
AS_VAR_APPEND([LDFLAGS], [" -ldl"])
])
])


dnl check for uuid dependencies
AH_TEMPLATE([HAVE_UUID_H], [Define to 1 if you have the <uuid.h> header file.])
AH_TEMPLATE([HAVE_UUID_UUID_H], [Define to 1 if you have the <uuid/uuid.h> header file.])
Expand Down
Loading