diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 0cc3a4aa5cccd..e906bdd9eac6e 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -18,7 +18,6 @@ include(CheckProblematicConfigurations) include(HandleLLVMStdlib) if (ANDROID OR CYGWIN OR CMAKE_SYSTEM_NAME MATCHES "AIX|DragonFly|FreeBSD|Haiku|Linux|NetBSD|OpenBSD|SunOS") - set(HAVE_DLFCN_H 1) set(HAVE_MACH_MACH_H 0) set(HAVE_MALLOC_MALLOC_H 0) set(HAVE_PTHREAD_H 1) @@ -26,7 +25,6 @@ if (ANDROID OR CYGWIN OR CMAKE_SYSTEM_NAME MATCHES "AIX|DragonFly|FreeBSD|Haiku| set(HAVE_SYSEXITS_H 1) set(HAVE_UNISTD_H 1) elseif (APPLE) - set(HAVE_DLFCN_H 1) set(HAVE_MACH_MACH_H 1) set(HAVE_MALLOC_MALLOC_H 1) set(HAVE_PTHREAD_H 1) @@ -34,7 +32,6 @@ elseif (APPLE) set(HAVE_SYSEXITS_H 1) set(HAVE_UNISTD_H 1) elseif (PURE_WINDOWS) - set(HAVE_DLFCN_H 0) set(HAVE_MACH_MACH_H 0) set(HAVE_MALLOC_MALLOC_H 0) set(HAVE_PTHREAD_H 0) @@ -44,7 +41,6 @@ elseif (PURE_WINDOWS) elseif (ZOS) # Confirmed in # https://github.com/llvm/llvm-project/pull/104706#issuecomment-2297109613 - set(HAVE_DLFCN_H 1) set(HAVE_MACH_MACH_H 0) set(HAVE_MALLOC_MALLOC_H 0) set(HAVE_PTHREAD_H 1) @@ -53,7 +49,6 @@ elseif (ZOS) set(HAVE_UNISTD_H 1) else() # Other platforms that we don't promise support for. - check_include_file(dlfcn.h HAVE_DLFCN_H) check_include_file(mach/mach.h HAVE_MACH_MACH_H) check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H) check_include_file(pthread.h HAVE_PTHREAD_H) @@ -390,15 +385,11 @@ if (NOT PURE_WINDOWS) if (LLVM_PTHREAD_LIB) list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${LLVM_PTHREAD_LIB}) endif() -endif() -# This check requires _GNU_SOURCE. -if( HAVE_DLFCN_H ) if( HAVE_LIBDL ) list(APPEND CMAKE_REQUIRED_LIBRARIES dl) endif() check_symbol_exists(dlopen dlfcn.h HAVE_DLOPEN) - check_symbol_exists(dladdr dlfcn.h HAVE_DLADDR) if( HAVE_LIBDL ) list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES dl) endif() diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake index 1d2d00a3b758b..f6f10ea4f4f83 100644 --- a/llvm/include/llvm/Config/config.h.cmake +++ b/llvm/include/llvm/Config/config.h.cmake @@ -54,15 +54,9 @@ don't. */ #cmakedefine01 HAVE_DECL_STRERROR_S -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H} - /* Define if dlopen() is available on this platform. */ #cmakedefine HAVE_DLOPEN ${HAVE_DLOPEN} -/* Define if dladdr() is available on this platform. */ -#cmakedefine HAVE_DLADDR ${HAVE_DLADDR} - /* Define to 1 if we can register EH frames on this platform. */ #cmakedefine HAVE_REGISTER_FRAME ${HAVE_REGISTER_FRAME} diff --git a/llvm/lib/Support/Unix/DynamicLibrary.inc b/llvm/lib/Support/Unix/DynamicLibrary.inc index 7b77da5e0c6b2..7452913049ebb 100644 --- a/llvm/lib/Support/Unix/DynamicLibrary.inc +++ b/llvm/lib/Support/Unix/DynamicLibrary.inc @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -#if defined(HAVE_DLFCN_H) && defined(HAVE_DLOPEN) +#if defined(HAVE_DLOPEN) #include DynamicLibrary::HandleSet::~HandleSet() { diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index 280f290e906c2..1ad3a549a5a54 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -318,7 +318,7 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) { return std::string(real_path); break; // Found entry, but realpath failed. } -#elif defined(HAVE_DLFCN_H) && defined(HAVE_DLADDR) +#elif defined(HAVE_DLOPEN) // Use dladdr to get executable path if available. Dl_info DLInfo; int err = dladdr(MainAddr, &DLInfo); diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc index b2f68d25221a2..b840ec69c08a7 100644 --- a/llvm/lib/Support/Unix/Signals.inc +++ b/llvm/lib/Support/Unix/Signals.inc @@ -52,9 +52,7 @@ #endif #include #include -#if HAVE_DLFCN_H #include -#endif #if HAVE_MACH_MACH_H #include #endif @@ -814,7 +812,7 @@ void llvm::sys::PrintStackTrace(raw_ostream &OS, int Depth) { OS << "Stack dump without symbol names (ensure you have llvm-symbolizer in " "your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point " "to it):\n"; -#if HAVE_DLFCN_H && HAVE_DLADDR +#if HAVE_DLOPEN int width = 0; for (int i = 0; i < depth; ++i) { Dl_info dlinfo; diff --git a/llvm/lib/Support/Unix/Unix.h b/llvm/lib/Support/Unix/Unix.h index f16c7fcda22c3..a1d44c69ab1ab 100644 --- a/llvm/lib/Support/Unix/Unix.h +++ b/llvm/lib/Support/Unix/Unix.h @@ -39,9 +39,7 @@ #include #include -#ifdef HAVE_DLFCN_H -# include -#endif +#include # include diff --git a/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp b/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp index 3f7eef7bb8098..fb6f636e65b70 100644 --- a/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp +++ b/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp @@ -32,7 +32,7 @@ std::string LibPath(const std::string Name = "PipSqueak") { return std::string(Buf.str()); } -#if defined(_WIN32) || (defined(HAVE_DLFCN_H) && defined(HAVE_DLOPEN)) +#if defined(_WIN32) || defined(HAVE_DLOPEN) typedef void (*SetStrings)(std::string &GStr, std::string &LStr); typedef void (*TestOrder)(std::vector &V); diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn index 9b8990b5a6bcf..cb07575fa206c 100644 --- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn @@ -201,8 +201,6 @@ write_cmake_config("config") { if (current_os == "win") { values += [ "HAVE_DECL_STRERROR_S=1", - "HAVE_DLADDR=", - "HAVE_DLFCN_H=", "HAVE_DLOPEN=", "HAVE_FUTIMES=", "HAVE_GETPAGESIZE=", @@ -230,8 +228,6 @@ write_cmake_config("config") { # POSIX-y system defaults. values += [ "HAVE_DECL_STRERROR_S=", - "HAVE_DLADDR=1", - "HAVE_DLFCN_H=1", "HAVE_DLOPEN=1", "HAVE_FUTIMES=1", "HAVE_GETPAGESIZE=1", diff --git a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h index 7a8e14e06ddc5..9a5261bf2f642 100644 --- a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h +++ b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h @@ -66,15 +66,9 @@ don't. */ #define HAVE_DECL_STRERROR_S 0 -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - /* Define if dlopen() is available on this platform. */ #define HAVE_DLOPEN 1 -/* Define if dladdr() is available on this platform. */ -#define HAVE_DLADDR 1 - /* Define to 1 if we can register EH frames on this platform. */ /* HAVE_REGISTER_FRAME defined in Bazel*/ diff --git a/utils/bazel/llvm_configs/config.h.cmake b/utils/bazel/llvm_configs/config.h.cmake index 1d2d00a3b758b..f6f10ea4f4f83 100644 --- a/utils/bazel/llvm_configs/config.h.cmake +++ b/utils/bazel/llvm_configs/config.h.cmake @@ -54,15 +54,9 @@ don't. */ #cmakedefine01 HAVE_DECL_STRERROR_S -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H} - /* Define if dlopen() is available on this platform. */ #cmakedefine HAVE_DLOPEN ${HAVE_DLOPEN} -/* Define if dladdr() is available on this platform. */ -#cmakedefine HAVE_DLADDR ${HAVE_DLADDR} - /* Define to 1 if we can register EH frames on this platform. */ #cmakedefine HAVE_REGISTER_FRAME ${HAVE_REGISTER_FRAME}