summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2013-12-16 17:26:34 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2013-12-18 07:15:49 +0100
commitd8bbae2fd6786c2647b7b59e54d9dabdd47603d7 (patch)
treed51d9683d59c320fe8ec6fe64b804927d674b70f
parente20f27f0a04a3c0c0ba38a2b78f5c2591e27bbc0 (diff)
Get more --disable-dynamic-loading code out of shlib.cxx.
It's not terribly nice, but, hopefully, better. The hope is that one day, lo_get_library_map will be no more. In lo_get_implementation_map we can specify more precisely what to link into the binary. Change-Id: I99a1854fbae05be2f70302cc56bea88e522ec129
-rw-r--r--android/experimental/DocumentLoader/native-code.cxx16
-rw-r--r--android/experimental/LibreOffice4Android/native-code.cxx16
-rw-r--r--android/experimental/desktop/native-code.cxx16
-rw-r--r--cppuhelper/source/shlib.cxx67
-rw-r--r--include/osl/detail/component-mapping.h41
-rw-r--r--ios/experimental/LibreOffice/LibreOffice/lo.mm15
-rw-r--r--ios/shared/ios_sharedlo/cxx/mlo.mm18
7 files changed, 122 insertions, 67 deletions
diff --git a/android/experimental/DocumentLoader/native-code.cxx b/android/experimental/DocumentLoader/native-code.cxx
index a444eb55a952..43949ef26dce 100644
--- a/android/experimental/DocumentLoader/native-code.cxx
+++ b/android/experimental/DocumentLoader/native-code.cxx
@@ -12,9 +12,10 @@
extern "C"
__attribute__ ((visibility("default")))
const lib_to_component_mapping *
-lo_get_libmap(void)
+lo_get_library_map(void)
{
static lib_to_component_mapping map[] = {
+ NON_APP_SPECIFIC_COMPONENT_MAP
{ "libanimcorelo.a", animcore_component_getFactory },
{ "libavmedialo.a", avmedia_component_getFactory },
{ "libdbalo.a", dba_component_getFactory },
@@ -59,4 +60,17 @@ lo_get_libmap(void)
return map;
}
+extern "C"
+__attribute__ ((visibility("default")))
+const lib_to_component_mapping *
+lo_get_implementation_map(void)
+{
+ static lib_to_component_mapping map[] = {
+ NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+ { NULL, NULL }
+ };
+
+ return map;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/experimental/LibreOffice4Android/native-code.cxx b/android/experimental/LibreOffice4Android/native-code.cxx
index af0f5b7c81dd..2ec81496af3d 100644
--- a/android/experimental/LibreOffice4Android/native-code.cxx
+++ b/android/experimental/LibreOffice4Android/native-code.cxx
@@ -12,9 +12,10 @@
extern "C"
__attribute__ ((visibility("default")))
const lib_to_component_mapping *
-lo_get_libmap(void)
+lo_get_library_map(void)
{
static lib_to_component_mapping map[] = {
+ NON_APP_SPECIFIC_COMPONENT_MAP
{ "libanimcorelo.a", animcore_component_getFactory },
{ "libavmedialo.a", avmedia_component_getFactory },
{ "libbasprov.uno.a", basprov_component_getFactory },
@@ -77,4 +78,17 @@ lo_get_libmap(void)
return map;
}
+extern "C"
+__attribute__ ((visibility("default")))
+const lib_to_component_mapping *
+lo_get_implementation_map(void)
+{
+ static lib_to_component_mapping map[] = {
+ NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+ { NULL, NULL }
+ };
+
+ return map;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/experimental/desktop/native-code.cxx b/android/experimental/desktop/native-code.cxx
index 8d961fb3dcba..b4f15aacae4f 100644
--- a/android/experimental/desktop/native-code.cxx
+++ b/android/experimental/desktop/native-code.cxx
@@ -12,9 +12,10 @@
extern "C"
__attribute__ ((visibility("default")))
const lib_to_component_mapping *
-lo_get_libmap(void)
+lo_get_library_map(void)
{
static lib_to_component_mapping map[] = {
+ NON_APP_SPECIFIC_COMPONENT_MAP
{ "libanimcorelo.a", animcore_component_getFactory },
{ "libavmedialo.a", avmedia_component_getFactory },
{ "libbasprovlo.a", basprov_component_getFactory },
@@ -89,4 +90,17 @@ lo_get_libmap(void)
return map;
}
+extern "C"
+__attribute__ ((visibility("default")))
+const lib_to_component_mapping *
+lo_get_implementation_map(void)
+{
+ static lib_to_component_mapping map[] = {
+ NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+ { NULL, NULL }
+ };
+
+ return map;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
index 44d647bc263c..81e02d3eb1ac 100644
--- a/cppuhelper/source/shlib.cxx
+++ b/cppuhelper/source/shlib.cxx
@@ -283,76 +283,27 @@ css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory(
#ifdef DISABLE_DYNLOADING
- // First test library names that aren't app-specific.
- static lib_to_component_mapping components_mapping[] = {
- { "libintrospectionlo.a", introspection_component_getFactory },
- { "libreflectionlo.a", reflection_component_getFactory },
- { "libstocserviceslo.a", stocservices_component_getFactory },
- { "libcomphelper.a", comphelp_component_getFactory },
- { "libconfigmgrlo.a", configmgr_component_getFactory },
- { "libdeployment.a", deployment_component_getFactory },
- { "libfilterconfiglo.a", filterconfig1_component_getFactory },
- { "libfwklo.a", fwk_component_getFactory },
- { "libi18npoollo.a", i18npool_component_getFactory },
- { "liblocalebe1lo.a", localebe1_component_getFactory },
- { "libpackage2.a", package2_component_getFactory },
- { "libsfxlo.a", sfx_component_getFactory },
- { "libsvllo.a", svl_component_getFactory },
- { "libtklo.a", tk_component_getFactory },
- { "libucb1.a", ucb_component_getFactory },
- { "libucpexpand1lo.a", ucpexpand1_component_getFactory },
- { "libucpfile1.a", ucpfile_component_getFactory },
- { "libutllo.a", utl_component_getFactory },
- { "libvcllo.a", vcl_component_getFactory },
- { "libxstor.a", xstor_component_getFactory },
- { NULL, NULL }
- };
- static lib_to_component_mapping direct_components_mapping[] = {
- { "com.sun.star.comp.extensions.xml.sax.ParserExpat", com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory },
- { "com.sun.star.comp.extensions.xml.sax.FastParser", com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory },
- { "com.sun.star.comp.stoc.DLLComponentLoader.component.getFactory", com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory },
- { "com.sun.star.comp.stoc.ImplementationRegistration.component.getFactory", com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory },
- { "com.sun.star.comp.stoc.NestedRegistry.component.getFactory", com_sun_star_comp_stoc_NestedRegistry_component_getFactory },
- { "com.sun.star.comp.stoc.ORegistryServiceManager.component.getFactory", com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory },
- { "com.sun.star.comp.stoc.OServiceManager.component.getFactory", com_sun_star_comp_stoc_OServiceManager_component_getFactory },
- { "com.sun.star.comp.stoc.OServiceManagerWrapper.component.getFactory", com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory },
- { "com.sun.star.comp.stoc.SimpleRegistry.component.getFactory", com_sun_star_comp_stoc_SimpleRegistry_component_getFactory },
- { "com.sun.star.extensions.xml.sax.Writer", com_sun_star_extensions_xml_sax_Writer_component_getFactory },
- { "com.sun.star.security.comp.stoc.AccessController.component.getFactory", com_sun_star_security_comp_stoc_AccessController_component_getFactory },
- { "com.sun.star.security.comp.stoc.FilePolicy.component.getFactory", com_sun_star_security_comp_stoc_FilePolicy_component_getFactory },
- { NULL, NULL }
- };
- lib_to_component_mapping *non_app_specific_map = components_mapping;
OString sName;
+ const lib_to_component_mapping *map = NULL;
if (rPrefix == "direct")
{
sName = OUStringToOString(rImplName, RTL_TEXTENCODING_ASCII_US);
- non_app_specific_map = direct_components_mapping;
+ map = lo_get_implementation_map();
}
else
{
sName = OUStringToOString(uri, RTL_TEXTENCODING_ASCII_US);
+ map = lo_get_library_map();
}
- for (int i = 0; pSym == NULL && non_app_specific_map[i].lib != NULL; ++i)
+ for (int i = 0; pSym == NULL && map[i].name != NULL; ++i)
{
- if ( sName == non_app_specific_map[i].lib )
- pSym = (oslGenericFunction) non_app_specific_map[i].component_getFactory_function;
+ if ( sName == map[i].name )
+ pSym = (oslGenericFunction) map[i].component_getFactory_function;
}
-
- if ( pSym == NULL)
+ if ( pSym == NULL )
{
- // The call the app-specific lo_get_libmap() to get a mapping for the rest
- const lib_to_component_mapping *map = lo_get_libmap();
- for (int i = 0; pSym == NULL && map[i].lib != NULL; ++i)
- {
- if ( uri.equalsAscii( map[i].lib ) )
- pSym = (oslGenericFunction) map[i].component_getFactory_function;
- }
- if ( pSym == NULL )
- {
- fprintf( stderr, "attempting to load unknown library %s\n", OUStringToOString( uri, RTL_TEXTENCODING_ASCII_US ).getStr() );
- assert( !"Attempt to load unknown library" );
- }
+ fprintf( stderr, "attempting to load unknown library %s\n", OUStringToOString( uri, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ assert( !"Attempt to load unknown library" );
}
#else
diff --git a/include/osl/detail/component-mapping.h b/include/osl/detail/component-mapping.h
index 0ee0b512327b..9feae7000160 100644
--- a/include/osl/detail/component-mapping.h
+++ b/include/osl/detail/component-mapping.h
@@ -27,16 +27,53 @@ extern "C" {
*/
typedef struct {
- const char *lib;
+ const char *name;
void * (*component_getFactory_function)(const char *, void *, void *);
} lib_to_component_mapping;
-const lib_to_component_mapping *lo_get_libmap(void);
+const lib_to_component_mapping *lo_get_library_map(void);
+const lib_to_component_mapping *lo_get_implementation_map(void);
#ifdef __cplusplus
}
#endif
+#define NON_APP_SPECIFIC_COMPONENT_MAP \
+ { "libintrospectionlo.a", introspection_component_getFactory }, \
+ { "libreflectionlo.a", reflection_component_getFactory }, \
+ { "libstocserviceslo.a", stocservices_component_getFactory }, \
+ { "libcomphelper.a", comphelp_component_getFactory }, \
+ { "libconfigmgrlo.a", configmgr_component_getFactory }, \
+ { "libdeployment.a", deployment_component_getFactory }, \
+ { "libfilterconfiglo.a", filterconfig1_component_getFactory }, \
+ { "libfwklo.a", fwk_component_getFactory }, \
+ { "libi18npoollo.a", i18npool_component_getFactory }, \
+ { "liblocalebe1lo.a", localebe1_component_getFactory }, \
+ { "libpackage2.a", package2_component_getFactory }, \
+ { "libsfxlo.a", sfx_component_getFactory }, \
+ { "libsvllo.a", svl_component_getFactory }, \
+ { "libtklo.a", tk_component_getFactory }, \
+ { "libucb1.a", ucb_component_getFactory }, \
+ { "libucpexpand1lo.a", ucpexpand1_component_getFactory }, \
+ { "libucpfile1.a", ucpfile_component_getFactory }, \
+ { "libutllo.a", utl_component_getFactory }, \
+ { "libvcllo.a", vcl_component_getFactory }, \
+ { "libxstor.a", xstor_component_getFactory }, \
+
+#define NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP \
+ { "com.sun.star.comp.extensions.xml.sax.ParserExpat", com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory }, \
+ { "com.sun.star.comp.extensions.xml.sax.FastParser", com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory }, \
+ { "com.sun.star.comp.stoc.DLLComponentLoader.component.getFactory", com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory }, \
+ { "com.sun.star.comp.stoc.ImplementationRegistration.component.getFactory", com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory }, \
+ { "com.sun.star.comp.stoc.NestedRegistry.component.getFactory", com_sun_star_comp_stoc_NestedRegistry_component_getFactory }, \
+ { "com.sun.star.comp.stoc.ORegistryServiceManager.component.getFactory", com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory }, \
+ { "com.sun.star.comp.stoc.OServiceManager.component.getFactory", com_sun_star_comp_stoc_OServiceManager_component_getFactory }, \
+ { "com.sun.star.comp.stoc.OServiceManagerWrapper.component.getFactory", com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory }, \
+ { "com.sun.star.comp.stoc.SimpleRegistry.component.getFactory", com_sun_star_comp_stoc_SimpleRegistry_component_getFactory }, \
+ { "com.sun.star.extensions.xml.sax.Writer", com_sun_star_extensions_xml_sax_Writer_component_getFactory }, \
+ { "com.sun.star.security.comp.stoc.AccessController.component.getFactory", com_sun_star_security_comp_stoc_AccessController_component_getFactory }, \
+ { "com.sun.star.security.comp.stoc.FilePolicy.component.getFactory", com_sun_star_security_comp_stoc_FilePolicy_component_getFactory }, \
+
#endif /* DISABLE_DYNLOADING */
#endif // INCLUDED_OSL_DETAIL_COMPONENT_MAPPING_H
diff --git a/ios/experimental/LibreOffice/LibreOffice/lo.mm b/ios/experimental/LibreOffice/LibreOffice/lo.mm
index 18cf09f04587..5da9455f96a0 100644
--- a/ios/experimental/LibreOffice/LibreOffice/lo.mm
+++ b/ios/experimental/LibreOffice/LibreOffice/lo.mm
@@ -18,9 +18,10 @@
extern "C"
const lib_to_component_mapping *
-lo_get_libmap(void)
+lo_get_library_map(void)
{
static lib_to_component_mapping map[] = {
+ NON_APP_SPECIFIC_COMPONENT_MAP
{ "libanalysislo.a", analysis_component_getFactory },
{ "libanimcorelo.a", animcore_component_getFactory },
{ "libavmedialo.a", avmedia_component_getFactory },
@@ -81,6 +82,18 @@ lo_get_libmap(void)
}
extern "C"
+const lib_to_component_mapping *
+lo_get_implementation_map(void)
+{
+ static lib_to_component_mapping map[] = {
+ NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+ { NULL, NULL }
+ };
+
+ return map;
+}
+
+extern "C"
void
lo_initialize(void)
{
diff --git a/ios/shared/ios_sharedlo/cxx/mlo.mm b/ios/shared/ios_sharedlo/cxx/mlo.mm
index 61f56b2f8481..6dc4ad1a7bc6 100644
--- a/ios/shared/ios_sharedlo/cxx/mlo.mm
+++ b/ios/shared/ios_sharedlo/cxx/mlo.mm
@@ -24,10 +24,11 @@
extern "C"
const lib_to_component_mapping *
-lo_get_libmap(void)
+lo_get_library_map(void)
{
static lib_to_component_mapping map[] = {
-
+ NON_APP_SPECIFIC_COMPONENT_MAP
+
//from IOS
//MAP_LIB_LO(analysis), //MAP_LIB_LO(animcore), //MAP_LIB_LO(sm),
@@ -68,10 +69,21 @@ lo_get_libmap(void)
{ NULL, NULL }
};
-
+
return map;
}
+extern "C"
+const lib_to_component_mapping *
+lo_get_implementation_map(void)
+{
+ static lib_to_component_mapping map[] = {
+ NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+ { NULL, NULL }
+ };
+
+ return map;
+}
NSString * createPaths(NSString * base,NSString * appRootEscaped,NSArray * fileNames){
NSString * prefix = @"file://";