From 193801b35ea5824eedfb63f8067e17808324d1c5 Mon Sep 17 00:00:00 2001 From: Mike Robinson Date: Tue, 2 Sep 2014 21:12:24 +0100 Subject: [PATCH] Add --enable-preserve_dylib configure option Valgrind requires shared objects to be kept open for meaningful debug information. Add configure option to disable dlclose() in dylib_close() for Valgrind support. --- Makefile | 4 ++++ dynamic.c | 2 ++ qb/config.libs.sh | 5 +++++ qb/config.params.sh | 1 + 4 files changed, 12 insertions(+) diff --git a/Makefile b/Makefile index 0985abec18..1c25816929 100644 --- a/Makefile +++ b/Makefile @@ -490,6 +490,10 @@ ifeq ($(HAVE_7ZIP),1) JOYCONFIG_OBJ += $(7ZOBJ) endif +ifeq ($(HAVE_PRESERVE_DYLIB),1) + DEFINES += -DNO_DLCLOSE +endif + ifneq ($(V),1) Q := @ endif diff --git a/dynamic.c b/dynamic.c index 2ec7c9c031..8ff20e6480 100644 --- a/dynamic.c +++ b/dynamic.c @@ -451,8 +451,10 @@ void dylib_close(dylib_t lib) #ifdef _WIN32 FreeLibrary((HMODULE)lib); #else +#ifndef NO_DLCLOSE dlclose(lib); #endif +#endif } #endif diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 0caae1b9d8..eee93abe82 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -52,6 +52,11 @@ if [ "$HAVE_7ZIP" = "yes" ]; then add_include_dirs ./decompress/7zip/ fi +if [ "$HAVE_PRESERVE_DYLIB" = "yes" ]; then + echo "Disabling dlclose() of shared objects for Valgrind support." + add_define_make HAVE_PRESERVE_DYLIB "1" +fi + if [ "$HAVE_FLOATHARD" = "yes" ]; then CFLAGS="$CFLAGS -mfloat-abi=hard" CXXFLAGS="$CXXFLAGS -mfloat-abi=hard" diff --git a/qb/config.params.sh b/qb/config.params.sh index adda39efc9..d4aeb5f288 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -45,3 +45,4 @@ HAVE_SSE=no # Forcefully enable x86 SSE optimizations (SSE, SSE2) HAVE_FLOATHARD=no # Force hard float ABI (for ARM) HAVE_FLOATSOFTFP=no # Force soft float ABI (for ARM) HAVE_7ZIP=yes # Compile in 7z support +HAVE_PRESERVE_DYLIB=no # Disable dlclose() for Valgrind support