]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: compat: detect support for dl_iterate_phdr()
authorWilly Tarreau <w@1wt.eu>
Tue, 28 Dec 2021 14:13:12 +0000 (15:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 28 Dec 2021 15:59:00 +0000 (16:59 +0100)
We'll use this glibc function to dump loaded libs. It's been
available since glibc-2.2.4, and as it requires dlpi headers defined
in link.h, it implicitly relies on dlfcn, thus we condition it to
USE_DL. Other operating systems or libc might have different
dependencies so let's stick to the bare minimum for now.

include/haproxy/compat.h

index f8afe1b5c32972c9db15aec77d8f040f9f8451a7..4e6cb7271fdcfe6546161e27490418e416af69f2 100644 (file)
@@ -247,6 +247,11 @@ typedef struct { } empty_t;
 #endif
 #endif
 
+/* dl_iterate_phdr() is available in GLIBC 2.2.4 and up. Let's round up to 2.3.x */
+#if defined(USE_DL) && defined(__GNU_LIBRARY__) && (__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
+#define HA_HAVE_DL_ITERATE_PHDR
+#endif
+
 /* malloc_trim() can be very convenient to reclaim unused memory especially
  * from huge pattern files. It's available (and really usable) in glibc 2.8 and
  * above.