summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config_host.mk.in2
-rw-r--r--config_host/config_global.h.in7
-rw-r--r--configure.ac25
-rw-r--r--desktop/Library_crashreport.mk2
-rw-r--r--include/osl/module.h2
-rw-r--r--libreofficekit/Executable_gtktiledviewer.mk2
-rw-r--r--libreofficekit/Executable_tilebench.mk2
-rw-r--r--libreofficekit/Library_libreofficekitgtk.mk2
-rw-r--r--sal/osl/unx/module.cxx50
-rw-r--r--solenv/gbuild/LinkTarget.mk2
-rw-r--r--vcl/Library_desktop_detector.mk2
-rw-r--r--vcl/Library_vcl.mk2
-rw-r--r--vcl/StaticLibrary_glxtest.mk2
-rw-r--r--vcl/headless/CairoCommon.cxx9
-rw-r--r--vcl/unx/generic/glyphs/freetype_glyphcache.cxx8
15 files changed, 75 insertions, 44 deletions
diff --git a/config_host.mk.in b/config_host.mk.in
index c5a945b96522..b16d5674ea54 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -126,7 +126,6 @@ export DICT_SYSTEM_DIR=@DICT_SYSTEM_DIR@
export DISABLE_CVE_TESTS=@DISABLE_CVE_TESTS@
export DISABLE_DYNLOADING=@DISABLE_DYNLOADING@
export DISABLE_PYTHON=@DISABLE_PYTHON@
-export DLOPEN_LIBS=@DLOPEN_LIBS@
export DOCDIR=@DOCDIR@
export DOXYGEN=@DOXYGEN@
export DO_FETCH_TARBALLS=@DO_FETCH_TARBALLS@
@@ -668,6 +667,7 @@ export TOUCH=@TOUCH@
export UCRTSDKDIR=@UCRTSDKDIR@
export UCRTVERSION=@UCRTVERSION@
export UCRT_REDISTDIR=@UCRT_REDISTDIR@
+export UNIX_DLAPI_LIBS=@UNIX_DLAPI_LIBS@
export USE_HEADLESS_CODE=@USE_HEADLESS_CODE@
export USE_LD=@USE_LD@
export USE_LIBRARY_BIN_TAR=@USE_LIBRARY_BIN_TAR@
diff --git a/config_host/config_global.h.in b/config_host/config_global.h.in
index 0df9ac8a47f1..5f24fe8da397 100644
--- a/config_host/config_global.h.in
+++ b/config_host/config_global.h.in
@@ -43,4 +43,11 @@ Any change in this header will cause a rebuild of almost everything.
bogus -Werror=redundant-move (GCC 9)". */
#define HAVE_P1155R3 0
+// Whether the OS provides a usable dynamcic loading API
+#define HAVE_DLAPI 0
+
+// Whether the OS uses the common UNIX dynamcic loading API calls, like dlopen, dlsym, dladdr etc.
+// Use HAVE_DLAPI instead. Should not be used outside of sal/osl/unx/module.cxx!
+#define HAVE_UNIX_DLAPI 0
+
#endif
diff --git a/configure.ac b/configure.ac
index 7f40e61c4645..7dfdb1a18062 100644
--- a/configure.ac
+++ b/configure.ac
@@ -823,6 +823,7 @@ test_gdb_index=no
test_openldap=yes
test_split_debug=no
test_webdav=yes
+usable_dlapi=yes
# There is currently just iOS not using salplug, so this explicitly enables it.
# must: using_freetype_fontconfig
@@ -909,6 +910,7 @@ cygwin*|wsl*)
using_freetype_fontconfig=no
using_x11=no
+ test_unix_dlapi=no
test_openldap=no
test_eot=no
enable_pagein=no
@@ -1069,6 +1071,8 @@ dragonfly*)
;;
linux-android*)
+ # API exists, but seems not really usable since Android 7 AFAIK
+ usable_dlapi=no
using_freetype_fontconfig=yes
using_headless_plugin=no
using_x11=no
@@ -1104,6 +1108,8 @@ haiku*)
;;
emscripten)
+ # API currently just exists in headers, not code
+ usable_dlapi=no
using_freetype_fontconfig=yes
using_x11=no
test_openldap=no
@@ -1190,6 +1196,7 @@ fi
AC_SUBST(ENABLE_HEADLESS)
AC_SUBST(USE_HEADLESS_CODE)
+AC_MSG_NOTICE([VCL platform has a usable dynamic loading API: $usable_dlapi])
AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
@@ -1334,14 +1341,18 @@ else
fi
AC_SUBST(ENDIANNESS)
-if test $_os != "WINNT"; then
- save_LIBS="$LIBS"
- AC_SEARCH_LIBS([dlsym], [dl],
- [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
- [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
- LIBS="$save_LIBS"
+if test "$usable_dlapi" != no; then
+ AC_DEFINE([HAVE_DLAPI])
+ if test "$test_unix_dlapi" != no; then
+ save_LIBS="$LIBS"
+ AC_SEARCH_LIBS([dlsym], [dl],
+ [case "$ac_cv_search_dlsym" in -l*) UNIX_DLAPI_LIBS="$ac_cv_search_dlsym";; esac],
+ [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
+ LIBS="$save_LIBS"
+ AC_DEFINE([HAVE_UNIX_DLAPI])
+ fi
fi
-AC_SUBST(DLOPEN_LIBS)
+AC_SUBST(UNIX_DLAPI_LIBS)
# Check for a (GNU) backtrace implementation
AC_ARG_VAR([BACKTRACE_CFLAGS], [Compiler flags needed to use backtrace(3)])
diff --git a/desktop/Library_crashreport.mk b/desktop/Library_crashreport.mk
index a2cef785f370..ba267e212974 100644
--- a/desktop/Library_crashreport.mk
+++ b/desktop/Library_crashreport.mk
@@ -25,7 +25,7 @@ $(eval $(call gb_Library_add_defs,crashreport,\
$(eval $(call gb_Library_add_libs,crashreport,\
$(if $(filter LINUX %BSD SOLARIS, $(OS)), \
- $(DLOPEN_LIBS) \
+ $(UNIX_DLAPI_LIBS) \
) \
))
diff --git a/include/osl/module.h b/include/osl/module.h
index 9d80d352afaa..e3140f4a67f8 100644
--- a/include/osl/module.h
+++ b/include/osl/module.h
@@ -25,6 +25,8 @@
#define INCLUDED_OSL_MODULE_H
#include "sal/config.h"
+// convenience include for HAVE_DLAPI define
+#include "config_global.h"
#include "rtl/ustring.h"
#include "sal/saldllapi.h"
diff --git a/libreofficekit/Executable_gtktiledviewer.mk b/libreofficekit/Executable_gtktiledviewer.mk
index 99ef51af8975..f5d6ddfc89d8 100644
--- a/libreofficekit/Executable_gtktiledviewer.mk
+++ b/libreofficekit/Executable_gtktiledviewer.mk
@@ -42,7 +42,7 @@ $(eval $(call gb_Executable_use_libraries,gtktiledviewer,\
ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
$(eval $(call gb_Executable_add_libs,gtktiledviewer,\
- -lm $(DLOPEN_LIBS) \
+ -lm $(UNIX_DLAPI_LIBS) \
))
endif
diff --git a/libreofficekit/Executable_tilebench.mk b/libreofficekit/Executable_tilebench.mk
index ae0a3b1f099b..e4a7908dc02b 100644
--- a/libreofficekit/Executable_tilebench.mk
+++ b/libreofficekit/Executable_tilebench.mk
@@ -23,7 +23,7 @@ $(eval $(call gb_Executable_use_libraries,tilebench,\
))
$(eval $(call gb_Executable_add_libs,tilebench,\
- -lm $(DLOPEN_LIBS) \
+ -lm $(UNIX_DLAPI_LIBS) \
))
$(eval $(call gb_Executable_add_exception_objects,tilebench,\
diff --git a/libreofficekit/Library_libreofficekitgtk.mk b/libreofficekit/Library_libreofficekitgtk.mk
index 842bce6ac993..9dedd0e64b23 100644
--- a/libreofficekit/Library_libreofficekitgtk.mk
+++ b/libreofficekit/Library_libreofficekitgtk.mk
@@ -35,7 +35,7 @@ $(eval $(call gb_Library_add_defs,libreofficekitgtk,\
ifeq ($(OS),$(filter LINUX %BSD SOLARIS, $(OS)))
$(eval $(call gb_Library_add_libs,libreofficekitgtk,\
- $(DLOPEN_LIBS) -lm \
+ $(UNIX_DLAPI_LIBS) -lm \
))
endif
diff --git a/sal/osl/unx/module.cxx b/sal/osl/unx/module.cxx
index 72653a997f92..606c8fa475a1 100644
--- a/sal/osl/unx/module.cxx
+++ b/sal/osl/unx/module.cxx
@@ -35,14 +35,9 @@
#include <sys/ldr.h>
#endif
-#ifdef ANDROID
-#include <osl/detail/android-bootstrap.h>
-#endif
-
-static bool getModulePathFromAddress(void * address, rtl_String ** path) {
+static bool getModulePathFromAddress(void * address, rtl_String ** path)
+{
bool result = false;
- // We do want to have this functionality also in the
- // DISABLE_DYNLOADING case, I think?
#if defined(AIX)
int size = 4 * 1024;
char *buf, *filename=NULL;
@@ -87,6 +82,7 @@ static bool getModulePathFromAddress(void * address, rtl_String ** path) {
free(buf);
#else
+#if HAVE_UNIX_DLAPI
Dl_info dl_info;
result = dladdr(address, &dl_info) != 0;
@@ -95,6 +91,10 @@ static bool getModulePathFromAddress(void * address, rtl_String ** path) {
{
rtl_string_newFromStr(path, dl_info.dli_fname);
}
+#else
+ (void) address;
+ (void) path;
+#endif
#endif
return result;
}
@@ -134,16 +134,13 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *ustrModuleName, sal_Int32 nRtldMo
oslModule SAL_CALL osl_loadModuleAscii(const char *pModuleName, sal_Int32 nRtldMode)
{
+#if HAVE_UNIX_DLAPI
SAL_WARN_IF(
((nRtldMode & SAL_LOADMODULE_LAZY) != 0
&& (nRtldMode & SAL_LOADMODULE_NOW) != 0),
"sal.osl", "only either LAZY or NOW");
if (pModuleName)
{
-#ifdef ANDROID
- (void) nRtldMode;
- void *pLib = lo_dlopen(pModuleName);
-#else
int rtld_mode =
((nRtldMode & SAL_LOADMODULE_NOW) ? RTLD_NOW : RTLD_LAZY) |
((nRtldMode & SAL_LOADMODULE_GLOBAL) ? RTLD_GLOBAL : RTLD_LOCAL);
@@ -153,9 +150,12 @@ oslModule SAL_CALL osl_loadModuleAscii(const char *pModuleName, sal_Int32 nRtldM
pLib == nullptr, "sal.osl",
"dlopen(" << pModuleName << ", " << rtld_mode << "): "
<< dlerror());
-#endif
return pLib;
}
+#else
+ (void) pModuleName;
+ (void) nRtldMode;
+#endif
return nullptr;
}
@@ -197,45 +197,49 @@ oslModule osl_loadModuleRelativeAscii(
sal_Bool SAL_CALL
osl_getModuleHandle(rtl_uString *, oslModule *pResult)
{
-#if !defined(DISABLE_DYNLOADING) || defined(IOS)
+#if HAVE_UNIX_DLAPI
*pResult = static_cast<oslModule>(RTLD_DEFAULT);
+ return true;
#else
*pResult = nullptr;
+ return false;
#endif
- return true;
}
-#ifndef DISABLE_DYNLOADING
-
/*****************************************************************************/
/* osl_unloadModule */
/*****************************************************************************/
void SAL_CALL osl_unloadModule(oslModule hModule)
{
+#if !defined(DISABLE_DYNLOADING) && HAVE_UNIX_DLAPI
if (hModule)
{
-#ifdef ANDROID
- int nRet = lo_dlclose(hModule);
-#else
int nRet = dlclose(hModule);
-#endif
SAL_INFO_IF(
nRet != 0, "sal.osl", "dlclose(" << hModule << "): " << dlerror());
}
+#else
+ (void) hModule;
+#endif
}
-#endif // !DISABLE_DYNLOADING
-
namespace {
-void * getSymbol(oslModule module, char const * symbol) {
+void * getSymbol(oslModule module, char const * symbol)
+{
assert(symbol != nullptr);
+#if HAVE_UNIX_DLAPI
// We do want to use dlsym() also in the DISABLE_DYNLOADING case
// just to look up symbols in the static executable, I think:
void * p = dlsym(module, symbol);
SAL_INFO_IF(
p == nullptr, "sal.osl",
"dlsym(" << module << ", " << symbol << "): " << dlerror());
+#else
+ (void) module;
+ (void) symbol;
+ void *p = nullptr;
+#endif
return p;
}
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index a4cbaf65bdd3..3ea562e02b50 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -2204,7 +2204,7 @@ define gb_LinkTarget_use_glxtest
$(call gb_LinkTarget_use_libraries,$(1),vcl,,$(4))
ifeq (,$(DISABLE_DYNLOADING))
-$(call gb_LinkTarget_add_libs,$(1),$(DLOPEN_LIBS))
+$(call gb_LinkTarget_add_libs,$(1),$(UNIX_DLAPI_LIBS))
endif
ifeq (,$(DISABLE_GUI))
diff --git a/vcl/Library_desktop_detector.mk b/vcl/Library_desktop_detector.mk
index b11f1367edab..2a2858fc4eae 100644
--- a/vcl/Library_desktop_detector.mk
+++ b/vcl/Library_desktop_detector.mk
@@ -66,7 +66,7 @@ $(eval $(call gb_Library_add_exception_objects,desktop_detector,\
ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
$(eval $(call gb_Library_add_libs,desktop_detector,\
- -lm $(DLOPEN_LIBS) \
+ -lm $(UNIX_DLAPI_LIBS) \
))
endif
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 42282268b8ce..f201cb273524 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -648,7 +648,7 @@ $(eval $(call gb_Library_use_externals,vcl,\
$(eval $(call gb_Library_add_libs,vcl,\
$(if $(filter LINUX %BSD SOLARIS,$(OS)), \
-lm \
- $(if $(DISABLE_DYNLOADING),,$(DLOPEN_LIBS)) \
+ $(if $(DISABLE_DYNLOADING),,$(UNIX_DLAPI_LIBS)) \
) \
))
diff --git a/vcl/StaticLibrary_glxtest.mk b/vcl/StaticLibrary_glxtest.mk
index 1a285875c828..b082e47e2882 100644
--- a/vcl/StaticLibrary_glxtest.mk
+++ b/vcl/StaticLibrary_glxtest.mk
@@ -30,7 +30,7 @@ $(eval $(call gb_StaticLibrary_use_api,glxtest,\
))
$(eval $(call gb_StaticLibrary_add_libs,glxtest,\
- -lm $(DLOPEN_LIBS) \
+ -lm $(UNIX_DLAPI_LIBS) \
-lX11 \
))
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 94ca2c3158be..f8ab8ce71889 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -27,14 +27,15 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <sal/log.hxx>
+#include <osl/module.h>
void dl_cairo_surface_set_device_scale(cairo_surface_t* surface, double x_scale, double y_scale)
{
-#ifdef ANDROID
+#if !HAVE_DLAPI
cairo_surface_set_device_scale(surface, x_scale, y_scale);
#else
static auto func = reinterpret_cast<void (*)(cairo_surface_t*, double, double)>(
- dlsym(nullptr, "cairo_surface_set_device_scale"));
+ osl_getAsciiFunctionSymbol(nullptr, "cairo_surface_set_device_scale"));
if (func)
func(surface, x_scale, y_scale);
#endif
@@ -42,11 +43,11 @@ void dl_cairo_surface_set_device_scale(cairo_surface_t* surface, double x_scale,
void dl_cairo_surface_get_device_scale(cairo_surface_t* surface, double* x_scale, double* y_scale)
{
-#ifdef ANDROID
+#if !HAVE_DLAPI
cairo_surface_get_device_scale(surface, x_scale, y_scale);
#else
static auto func = reinterpret_cast<void (*)(cairo_surface_t*, double*, double*)>(
- dlsym(nullptr, "cairo_surface_get_device_scale"));
+ osl_getAsciiFunctionSymbol(nullptr, "cairo_surface_get_device_scale"));
if (func)
func(surface, x_scale, y_scale);
else
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index f199074a75c7..34bc8e7f051a 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -34,6 +34,7 @@
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <sal/log.hxx>
+#include <osl/module.h>
#include <langboost.hxx>
#include <font/PhysicalFontCollection.hxx>
@@ -161,11 +162,16 @@ namespace
{
void dlFT_Done_MM_Var(FT_Library library, FT_MM_Var *amaster)
{
- static auto func = reinterpret_cast<void(*)(FT_Library, FT_MM_Var*)>(dlsym(nullptr, "FT_Done_MM_Var"));
+#if !HAVE_DLAPI
+ FT_Done_MM_Var(library, amaster);
+#else
+ static auto func = reinterpret_cast<void(*)(FT_Library, FT_MM_Var*)>(
+ osl_getAsciiFunctionSymbol(nullptr, "FT_Done_MM_Var"));
if (func)
func(library, amaster);
else
free(amaster);
+#endif
}
}