From 9a0b13499f7c1fbf07d2b49dbd57edf132e82f8c Mon Sep 17 00:00:00 2001 From: "ramiro%netscape.com" Date: Wed, 7 Jul 1999 09:02:21 +0000 Subject: [PATCH] Checkin another chunk of Alex Larsson's non-exported symbol reduction patch. All changes protected by MOZ_STRIP_NOT_EXPORTED. These particular changes set the NS_EXPORT declarations as needed by the linker. git-svn-id: svn://10.0.0.236/trunk@38670 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/config/rules.mk | 5 +++++ mozilla/include/libi18n.h | 3 +++ mozilla/include/resdef.h | 2 ++ mozilla/include/xp_core.h | 7 +++++++ mozilla/js/src/jstypes.h | 9 +++++++++ mozilla/modules/libimg/png/pngconf.h | 4 ++++ mozilla/modules/libreg/include/NSReg.h | 2 ++ mozilla/rdf/base/public/rdf.h | 4 ++++ mozilla/xpcom/base/nsCom.h | 7 +++++++ mozilla/xpcom/base/nscore.h | 8 ++++++++ 10 files changed, 51 insertions(+) diff --git a/mozilla/config/rules.mk b/mozilla/config/rules.mk index fb62c3b8996..283e7cd5b05 100644 --- a/mozilla/config/rules.mk +++ b/mozilla/config/rules.mk @@ -595,6 +595,11 @@ ifneq ($(OS_ARCH),OS2) $(SHARED_LIBRARY): $(OBJS) $(LOBJS) rm -f $@ $(MKSHLIB) -o $@ $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) +ifdef MOZ_STRIP_NOT_EXPORTED +ifdef INHIBIT_STRIP_NOT_EXPORTED + objcopy -R ".exports" $@ +endif +endif chmod +x $@ $(MOZ_POST_DSO_LIB_COMMAND) $@ else diff --git a/mozilla/include/libi18n.h b/mozilla/include/libi18n.h index 31cdba7d51f..dd550189b89 100644 --- a/mozilla/include/libi18n.h +++ b/mozilla/include/libi18n.h @@ -36,6 +36,9 @@ #ifdef XP_WIN32 #define UNICVTAPI __declspec(dllexport) +#elif defined(MOZ_STRIP_NOT_EXPORTED) +#define UNICVTAPI __attribute__ ((dllexport)) + #else #define UNICVTAPI #endif diff --git a/mozilla/include/resdef.h b/mozilla/include/resdef.h index 476290bcbc7..e543a4939b6 100644 --- a/mozilla/include/resdef.h +++ b/mozilla/include/resdef.h @@ -64,6 +64,8 @@ * so we can increase the stack size */ #define ResDef(name,id,msg) int __far name = (id); +#elif defined(MOZ_STRIP_NOT_EXPORTED) +#define ResDef(name,id,msg) __attribute__ ((dllexport)) int name = (id); #else #define ResDef(name,id,msg) int name = (id); #endif diff --git a/mozilla/include/xp_core.h b/mozilla/include/xp_core.h index 513ca59fcdf..d1d14af7ead 100644 --- a/mozilla/include/xp_core.h +++ b/mozilla/include/xp_core.h @@ -243,6 +243,13 @@ typedef int (*FARPROC)(); #define PUBLIC #define MODULE_PRIVATE +#if defined(XP_UNIX) && defined(MOZ_STRIP_NOT_EXPORTED) +#undef PUBLIC +#define PUBLIC __attribute__ ((dllexport)) +#undef MODULE_PRIVATE +#define MODULE_PRIVATE __attribute__ ((dllexport)) +#endif + #if defined(XP_UNIX) && defined(PRIVATE) #undef PRIVATE #endif diff --git a/mozilla/js/src/jstypes.h b/mozilla/js/src/jstypes.h index f24a192e536..d21d2a2cff1 100644 --- a/mozilla/js/src/jstypes.h +++ b/mozilla/js/src/jstypes.h @@ -103,10 +103,19 @@ #define JS_STATIC_DLL_CALLBACK(__x) __x _Optlink #else /* Unix */ + +#ifdef MOZ_STRIP_NOT_EXPORTED +#define JS_EXTERN_API(__type) extern __attribute__ ((dllexport)) __type +#define JS_EXPORT_API(__type) __attribute__ ((dllexport))__type +#define JS_EXTERN_DATA(__type) extern __attribute__ ((dllexport)) __type +#define JS_EXPORT_DATA(__type) __attribute__ ((dllexport)) __type +#else #define JS_EXTERN_API(__type) extern __type #define JS_EXPORT_API(__type) __type #define JS_EXTERN_DATA(__type) extern __type #define JS_EXPORT_DATA(__type) __type +#endif + #define JS_DLL_CALLBACK #define JS_STATIC_DLL_CALLBACK(__x) static __x diff --git a/mozilla/modules/libimg/png/pngconf.h b/mozilla/modules/libimg/png/pngconf.h index e18ba191164..85e74f8712b 100644 --- a/mozilla/modules/libimg/png/pngconf.h +++ b/mozilla/modules/libimg/png/pngconf.h @@ -643,6 +643,10 @@ typedef z_stream FAR * png_zstreamp; # define PNG_EXPORT(type,symbol) type _export symbol #endif +#if defined(MOZ_STRIP_NOT_EXPORTED) +# define PNG_EXPORT(type,symbol) type __attribute__ ((dllexport)) symbol +#endif + /* allow for compilation as shared lib under BeOS */ #ifdef __BEOSDLL__ #define PNG_EXPORT(type,symbol) __declspec(export) type symbol diff --git a/mozilla/modules/libreg/include/NSReg.h b/mozilla/modules/libreg/include/NSReg.h index 5d71652a9e6..df207b55b4c 100644 --- a/mozilla/modules/libreg/include/NSReg.h +++ b/mozilla/modules/libreg/include/NSReg.h @@ -116,6 +116,8 @@ typedef struct _reginfo #endif #elif defined XP_MAC #define VR_INTERFACE(__x) __declspec(export) __x +#elif defined(MOZ_STRIP_NOT_EXPORTED) + #define VR_INTERFACE(type) __attribute__ ((dllexport)) type #else #define VR_INTERFACE(type) type #endif diff --git a/mozilla/rdf/base/public/rdf.h b/mozilla/rdf/base/public/rdf.h index 5a3846e5818..702bbab1ba4 100644 --- a/mozilla/rdf/base/public/rdf.h +++ b/mozilla/rdf/base/public/rdf.h @@ -92,7 +92,11 @@ static const char* kURI##prefix##_##name = ns #name #ifdef XP_PC #define NS_RDF _declspec(dllexport) #else /* !XP_PC */ +#ifdef MOZ_STRIP_NOT_EXPORTED +#define NS_RDF __attribute__ ((dllexport)) +#else #define NS_RDF +#endif /* !MOZ_STRIP_NOT_EXPORTED */ #endif /* !XP_PC */ #else /* !_IMPL_NS_RDF */ #ifdef XP_PC diff --git a/mozilla/xpcom/base/nsCom.h b/mozilla/xpcom/base/nsCom.h index ebcb68b17a9..16d54a1045c 100644 --- a/mozilla/xpcom/base/nsCom.h +++ b/mozilla/xpcom/base/nsCom.h @@ -28,6 +28,8 @@ #define NS_COM _declspec(dllexport) #elif defined(XP_MAC) #define NS_COM __declspec(export) +#elif defined(MOZ_STRIP_NOT_EXPORTED) +#define NS_COM __attribute__ ((dllexport)) #else /* !XP_PC */ #define NS_COM #endif /* !XP_PC */ @@ -77,8 +79,13 @@ #else /* !XP_PC && !XP_MAC */ +#if defined(MOZ_STRIP_NOT_EXPORTED) +#define NS_EXPORT __attribute__ ((dllexport)) +#define NS_EXPORT_(type) __attribute__ ((dllexport)) type +#else #define NS_EXPORT #define NS_EXPORT_(type) type +#endif #define NS_IMETHOD_(type) virtual type #define NS_IMETHOD virtual nsresult diff --git a/mozilla/xpcom/base/nscore.h b/mozilla/xpcom/base/nscore.h index 2ed5ac0f596..345c133cfce 100644 --- a/mozilla/xpcom/base/nscore.h +++ b/mozilla/xpcom/base/nscore.h @@ -72,6 +72,14 @@ typedef PRUint16 PRUnichar; #define NS_EXPORT __declspec(export) #define NS_EXPORT_(type) __declspec(export) type +#elif defined(MOZ_STRIP_NOT_EXPORTED) + +#define NS_IMPORT +#define NS_IMPORT_(type) type + +#define NS_EXPORT __attribute__ ((dllexport)) +#define NS_EXPORT_(type) __attribute__ ((dllexport)) type + #else /* XXX do something useful? */ #define NS_IMPORT