Skip to content

Commit 7c06786

Browse files
authored
[CMake] Remove HAVE_LINK_H
We can remove the variable from https://reviews.llvm.org/D5610 since link.h is available on Linux (glibc/musl/Bionic), FreeBSD, and NetBSD. Use `__has_include(<link.h>)` before including it. Pull Request: #104893
1 parent c106e8d commit 7c06786

File tree

8 files changed

+3
-16
lines changed

8 files changed

+3
-16
lines changed

llvm/cmake/config-ix.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ endif()
4444
check_include_file(dlfcn.h HAVE_DLFCN_H)
4545
check_include_file(errno.h HAVE_ERRNO_H)
4646
check_include_file(fcntl.h HAVE_FCNTL_H)
47-
check_include_file(link.h HAVE_LINK_H)
4847
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
4948
if( NOT PURE_WINDOWS )
5049
check_include_file(pthread.h HAVE_PTHREAD_H)

llvm/include/llvm/Config/config.h.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@
125125
/* Define to 1 if you have the `pthread_setname_np' function. */
126126
#cmakedefine HAVE_PTHREAD_SETNAME_NP ${HAVE_PTHREAD_SETNAME_NP}
127127

128-
/* Define to 1 if you have the <link.h> header file. */
129-
#cmakedefine HAVE_LINK_H ${HAVE_LINK_H}
130-
131128
/* Define to 1 if you have the <mach/mach.h> header file. */
132129
#cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H}
133130

llvm/lib/Support/Unix/Signals.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
#ifdef __APPLE__
6666
#include <mach-o/dyld.h>
6767
#endif
68-
#if HAVE_LINK_H
68+
#if __has_include(<link.h>)
6969
#include <link.h>
7070
#endif
7171
#ifdef HAVE__UNWIND_BACKTRACE
@@ -464,7 +464,7 @@ void llvm::sys::AddSignalHandler(sys::SignalHandlerCallback FnPtr,
464464
RegisterHandlers();
465465
}
466466

467-
#if ENABLE_BACKTRACES && defined(HAVE_BACKTRACE) && HAVE_LINK_H && \
467+
#if ENABLE_BACKTRACES && defined(HAVE_BACKTRACE) && \
468468
(defined(__linux__) || defined(__FreeBSD__) || \
469469
defined(__FreeBSD_kernel__) || defined(__NetBSD__))
470470
struct DlIteratePhdrData {

llvm/unittests/Support/SignalsTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ using testing::Not;
2929
// %i in the Symbolizer Markup Format spec
3030
#define I_REGEX "(0x[0-9a-fA-F]+|0[0-7]+|[0-9]+)"
3131

32-
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES && HAVE_LINK_H && \
32+
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES && \
3333
(defined(__linux__) || defined(__FreeBSD__) || \
3434
defined(__FreeBSD_kernel__) || defined(__NetBSD__))
3535
TEST(SignalsTest, PrintsSymbolizerMarkup) {

llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,12 @@ write_cmake_config("config") {
140140
if (current_os == "linux" || current_os == "android") {
141141
values += [
142142
"HAVE_FUTIMENS=1",
143-
"HAVE_LINK_H=1",
144143
"HAVE_MALLINFO=1",
145144
"HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1",
146145
]
147146
} else {
148147
values += [
149148
"HAVE_FUTIMENS=",
150-
"HAVE_LINK_H=",
151149
"HAVE_MALLINFO=",
152150
"HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=",
153151
]

utils/bazel/llvm-project-overlay/llvm/config.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ posix_defines = [
4747

4848
linux_defines = posix_defines + [
4949
"_GNU_SOURCE",
50-
"HAVE_LINK_H=1",
5150
"HAVE_MALLINFO=1",
5251
"HAVE_SBRK=1",
5352
"HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1",

utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@
141141
/* Define to 1 if you have the `pthread_setname_np' function. */
142142
#define HAVE_PTHREAD_SETNAME_NP 1
143143

144-
/* Define to 1 if you have the <link.h> header file. */
145-
/* HAVE_LINK_H defined in Bazel */
146-
147144
/* Define to 1 if you have the <mach/mach.h> header file. */
148145
/* HAVE_MACH_MACH_H defined in Bazel */
149146

utils/bazel/llvm_configs/config.h.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@
125125
/* Define to 1 if you have the `pthread_setname_np' function. */
126126
#cmakedefine HAVE_PTHREAD_SETNAME_NP ${HAVE_PTHREAD_SETNAME_NP}
127127

128-
/* Define to 1 if you have the <link.h> header file. */
129-
#cmakedefine HAVE_LINK_H ${HAVE_LINK_H}
130-
131128
/* Define to 1 if you have the <mach/mach.h> header file. */
132129
#cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H}
133130

0 commit comments

Comments
 (0)