NetworkManager/nm.mk
Beniamino Galvani b1bf2671b2 build: fix build with address sanitizer
Every program run during the build which loads a NM library must
preload libasan.so if the address sanitizer is enabled.

Add a macro to set the needed environment variables and use it when
performing the shared object link tests.
2016-09-20 13:44:04 +02:00

12 lines
442 B
Makefile

# NetworkManager Makefile helpers
set_sanitizer_env = \
[ -n "$(SANITIZER_ENV)" ] && export $(SANITIZER_ENV) ; \
if [ -n "$(1)" ] && echo $(CFLAGS) | grep -e -fsanitize=address ; then \
export LD_PRELOAD="$${LD_PRELOAD}:$$(ldd $(1) | grep libasan\.so\.. -o | head -n 1)"; \
fi
check_so_symbols = \
$(call set_sanitizer_env,$(1)); \
LD_BIND_NOW=1 LD_PRELOAD=$${LD_PRELOAD}:$(1) $(top_builddir)/src/NetworkManager --version >/dev/null