python: fix disabling the SSL module
[buildroot-gz.git] / package / lttng-libust / 0003-Validate-the-presence-of-dlmopen-at-configure-time.patch
blob699f1e0327fa85ab69e5261579df1421cda4baf6
1 From 42330adcefcd1830dad89e2a960c93d8dd1da125 Mon Sep 17 00:00:00 2001
2 From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
3 Date: Tue, 21 Feb 2017 16:00:27 -0500
4 Subject: [PATCH] Validate the presence of dlmopen at configure time
6 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
7 Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
8 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 [Backport from upstream commit 42330adcefcd1830dad89e2a960c93d8dd1da125.]
10 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 ---
12 configure.ac | 8 ++++++++
13 liblttng-ust-dl/lttng-ust-dl.c | 8 ++++++++
14 liblttng-ust-dl/ust_dl.h | 2 ++
15 3 files changed, 18 insertions(+)
17 diff --git a/configure.ac b/configure.ac
18 index 450b43b..023cfd4 100644
19 --- a/configure.ac
20 +++ b/configure.ac
21 @@ -125,15 +125,23 @@ AS_IF([test "x${ax_cv_sys_weak_alias}" = "xno"], [
22 # Checks for libraries.
23 AC_CHECK_LIB([dl], [dlopen], [
24 have_libdl=yes
25 + libdl_name=dl
26 ], [
27 #libdl not found, check for dlopen in libc.
28 AC_CHECK_LIB([c], [dlopen], [
29 have_libc_dl=yes
30 + libdl_name=c
31 ], [
32 AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
36 +# Check if libdl has dlmopen support.
37 +AH_TEMPLATE([HAVE_DLMOPEN], ["Define to 1 if dlmopen is available."])
38 +AC_CHECK_LIB([$libdl_name], [dlmopen],
39 + [AC_DEFINE([HAVE_DLMOPEN], [1])]
42 AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBDL], [test "x$have_libdl" = "xyes"])
43 AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"])
45 diff --git a/liblttng-ust-dl/lttng-ust-dl.c b/liblttng-ust-dl/lttng-ust-dl.c
46 index b0737b6..ce2ae0e 100644
47 --- a/liblttng-ust-dl/lttng-ust-dl.c
48 +++ b/liblttng-ust-dl/lttng-ust-dl.c
49 @@ -38,8 +38,10 @@
50 #include "ust_dl.h"
52 static void *(*__lttng_ust_plibc_dlopen)(const char *filename, int flags);
53 +#ifdef HAVE_DLMOPEN
54 static void *(*__lttng_ust_plibc_dlmopen)(Lmid_t nsid, const char *filename,
55 int flags);
56 +#endif
57 static int (*__lttng_ust_plibc_dlclose)(void *handle);
59 static
60 @@ -55,6 +57,7 @@ void *_lttng_ust_dl_libc_dlopen(const char *filename, int flags)
61 return __lttng_ust_plibc_dlopen(filename, flags);
64 +#ifdef HAVE_DLMOPEN
65 static
66 void *_lttng_ust_dl_libc_dlmopen(Lmid_t nsid, const char *filename,
67 int flags)
68 @@ -68,6 +71,7 @@ void *_lttng_ust_dl_libc_dlmopen(Lmid_t nsid, const char *filename,
70 return __lttng_ust_plibc_dlmopen(nsid, filename, flags);
72 +#endif
74 static
75 int _lttng_ust_dl_libc_dlclose(void *handle)
76 @@ -143,6 +147,7 @@ end:
77 return;
80 +#ifdef HAVE_DLMOPEN
81 static
82 void lttng_ust_dl_dlmopen(void *so_base, Lmid_t nsid, const char *so_name,
83 int flags, void *ip)
84 @@ -203,6 +208,7 @@ end:
85 lttng_ust_elf_destroy(elf);
86 return;
88 +#endif
90 void *dlopen(const char *filename, int flags)
92 @@ -223,6 +229,7 @@ void *dlopen(const char *filename, int flags)
93 return handle;
96 +#ifdef HAVE_DLMOPEN
97 void *dlmopen(Lmid_t nsid, const char *filename, int flags)
99 void *handle;
100 @@ -243,6 +250,7 @@ void *dlmopen(Lmid_t nsid, const char *filename, int flags)
101 return handle;
104 +#endif
106 int dlclose(void *handle)
108 diff --git a/liblttng-ust-dl/ust_dl.h b/liblttng-ust-dl/ust_dl.h
109 index b8cfe82..afa8e84 100644
110 --- a/liblttng-ust-dl/ust_dl.h
111 +++ b/liblttng-ust-dl/ust_dl.h
112 @@ -51,6 +51,7 @@ TRACEPOINT_EVENT(lttng_ust_dl, dlopen,
116 +#ifdef HAVE_DLMOPEN
117 TRACEPOINT_EVENT(lttng_ust_dl, dlmopen,
118 TP_ARGS(void *, ip, void *, baddr, Lmid_t, nsid,
119 const char *, path, int, flags,
120 @@ -66,6 +67,7 @@ TRACEPOINT_EVENT(lttng_ust_dl, dlmopen,
121 ctf_integer(uint8_t, has_debug_link, has_debug_link)
124 +#endif
126 TRACEPOINT_EVENT(lttng_ust_dl, build_id,
127 TP_ARGS(
129 2.7.4