]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: tools: avoid calling dlsym() in static builds (try 2)
authorWilly Tarreau <w@1wt.eu>
Mon, 18 Jul 2022 11:58:17 +0000 (13:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 Jul 2022 12:03:54 +0000 (14:03 +0200)
commit5b3cd9561bdbf7bac7db04bafead76125f1458ae
tree24b8a7a2dc6d123092b8d821a40e264f095cb9d6
parentbc50e0d0fb2c86d67529553686ea4e3384952184
BUG/MEDIUM: tools: avoid calling dlsym() in static builds (try 2)

The first approach in commit 288dc1d8e ("BUG/MEDIUM: tools: avoid calling
dlsym() in static builds") relied on dlopen() but on certain configs (at
least gcc-4.8+ld-2.27+glibc-2.17) it used to catch situations where it
ought not fail.

Let's have a second try on this using dladdr() instead. The variable was
renamed "build_is_static" as it's exactly what's being detected there.
We could even take it for reporting in -vv though that doesn't seem very
useful. At least the variable was made global to ease inspection via the
debugger, or in case it's useful later.

Now it properly detects a static build even with gcc-4.4+glibc-2.11.1 and
doesn't crash anymore.
include/haproxy/tools.h
src/tools.c