Skip to content

[CMake] Remove HAVE_DLFCN_H and HAVE_DLADDR #123879

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

Merged
merged 1 commit into from
Jan 22, 2025
Merged
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
9 changes: 0 additions & 9 deletions llvm/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,20 @@ 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)
set(HAVE_SYS_MMAN_H 1)
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)
set(HAVE_SYS_MMAN_H 1)
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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 0 additions & 6 deletions llvm/include/llvm/Config/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,9 @@
don't. */
#cmakedefine01 HAVE_DECL_STRERROR_S

/* Define to 1 if you have the <dlfcn.h> 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}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Support/Unix/DynamicLibrary.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

#if defined(HAVE_DLFCN_H) && defined(HAVE_DLOPEN)
#if defined(HAVE_DLOPEN)
#include <dlfcn.h>

DynamicLibrary::HandleSet::~HandleSet() {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Support/Unix/Path.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Support/Unix/Signals.inc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@
#endif
#include <signal.h>
#include <sys/stat.h>
#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#if HAVE_MACH_MACH_H
#include <mach/mach.h>
#endif
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Support/Unix/Unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@
#include <sys/time.h>
#include <time.h>

#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
#include <dlfcn.h>

# include <fcntl.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> &V);
Expand Down
4 changes: 0 additions & 4 deletions llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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=",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,9 @@
don't. */
#define HAVE_DECL_STRERROR_S 0

/* Define to 1 if you have the <dlfcn.h> 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*/

Expand Down
6 changes: 0 additions & 6 deletions utils/bazel/llvm_configs/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,9 @@
don't. */
#cmakedefine01 HAVE_DECL_STRERROR_S

/* Define to 1 if you have the <dlfcn.h> 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}

Expand Down
Loading