diff options
author | Bernard Normier <bernard@zeroc.com> | 2019-07-25 08:47:11 -0500 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2019-07-25 08:47:11 -0500 |
commit | 2b78296a9aa5dc507777a674479faf3cf35f8742 (patch) | |
tree | d2e75ee01791a1cf1a11ddd99fa68b2b0945e45c | |
parent | White space cleanup (diff) | |
download | ice-2b78296a9aa5dc507777a674479faf3cf35f8742.tar.bz2 ice-2b78296a9aa5dc507777a674479faf3cf35f8742.tar.xz ice-2b78296a9aa5dc507777a674479faf3cf35f8742.zip |
Add support for hidden visibility on AIX/xlC.
Link libIceXML with libexpat-static on AIX/xlC.
-rw-r--r-- | config/Make.rules.AIX | 9 | ||||
-rw-r--r-- | cpp/include/Ice/FactoryTableInit.h | 2 | ||||
-rw-r--r-- | cpp/include/Ice/OutgoingAsync.h | 2 | ||||
-rw-r--r-- | cpp/include/IceUtil/Config.h | 10 | ||||
-rw-r--r-- | cpp/include/IceUtil/ConsoleUtil.h | 8 | ||||
-rw-r--r-- | cpp/include/IceUtil/OutputUtil.h | 22 | ||||
-rw-r--r-- | cpp/test/Ice/plugin/Plugin.cpp | 22 |
7 files changed, 39 insertions, 36 deletions
diff --git a/config/Make.rules.AIX b/config/Make.rules.AIX index 76c9100e59f..9e8684ed5fd 100644 --- a/config/Make.rules.AIX +++ b/config/Make.rules.AIX @@ -106,7 +106,7 @@ ppc_ldflags = $(ppc_cppflags) ppc64_cppflags = -q64 ppc64_ldflags = $(ppc64_cppflags) -shared_cppflags = $(if $(filter-out program,$($1_target)),-qpic,) +shared_cppflags = $(if $(filter-out program,$($1_target)),-qpic,) -qvisibility=hidden ifeq ($(COMPILER),xlC_r) # Used to suppress warnings in generated code @@ -135,9 +135,8 @@ ifeq ($(iconv_home),) iconv_libpath = /usr/lib endif -ifeq ($(expat_home),) -# Add /opt/freeware/lib/pthread to libpath for libgcc_s -expat_libpath = /opt/freeware/lib/pthread -endif +# Link with libexpat-static (from ZeroC's expat-static-devel RPM) since the IBM AIX +# Toolbox libexpat.a shared object depends on the GCC runtime. +expat_ldflags = -lexpat-static endif diff --git a/cpp/include/Ice/FactoryTableInit.h b/cpp/include/Ice/FactoryTableInit.h index 5c50d71b66f..9aca1831eb8 100644 --- a/cpp/include/Ice/FactoryTableInit.h +++ b/cpp/include/Ice/FactoryTableInit.h @@ -21,7 +21,7 @@ public: static FactoryTableInit factoryTableInitializer; // Dummy variable to force initialization of factoryTable -extern ICE_API FactoryTable* factoryTable; +extern ICE_API FactoryTable* factoryTable ICE_GLOBAL_VAR_SUFFIX; class ICE_API CompactIdInit { diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h index b9bf898a3c9..d426b372eea 100644 --- a/cpp/include/Ice/OutgoingAsync.h +++ b/cpp/include/Ice/OutgoingAsync.h @@ -664,7 +664,7 @@ public: // // See comments in OutgoingAsync.cpp // -extern ICE_API CallbackBasePtr dummyCallback; +extern ICE_API CallbackBasePtr dummyCallback ICE_GLOBAL_VAR_SUFFIX; // // Generic callback template that requires the caller to down-cast the diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index f4eab4cb4fb..b33029c0159 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -173,7 +173,7 @@ // With Visual Studio, we can import/export member functions without importing/ // exporting the whole class # define ICE_MEMBER_IMPORT_EXPORT -#elif (defined(__GNUC__) || defined(__clang__)) && !defined(__ibmxl__) +#elif (defined(__GNUC__) || defined(__clang__) || defined(__IBMCPP__)) && !defined(__ibmxl__) # define ICE_DECLSPEC_EXPORT __attribute__((visibility ("default"))) # define ICE_DECLSPEC_IMPORT __attribute__((visibility ("default"))) #elif defined(__SUNPRO_CC) @@ -192,6 +192,14 @@ # define ICE_MEMBER(API) /**/ #endif +// With IBM xlC, the visibility attribute must be at the end of the +// declaration of global variables. +#if defined(__IBMCPP__) && !defined(ICE_STATIC_LIBS) +# define ICE_GLOBAL_VAR_SUFFIX __attribute__((visibility ("default"))) +#else +# define ICE_GLOBAL_VAR_SUFFIX /**/ +#endif + // // Let's use these extensions with Ice: // diff --git a/cpp/include/IceUtil/ConsoleUtil.h b/cpp/include/IceUtil/ConsoleUtil.h index 0083c7a9075..6956ef2dbea 100644 --- a/cpp/include/IceUtil/ConsoleUtil.h +++ b/cpp/include/IceUtil/ConsoleUtil.h @@ -77,13 +77,13 @@ operator<<(ConsoleErr& err, const T& val) ICE_API ConsoleErr& endl(ConsoleErr&); ICE_API ConsoleErr& flush(ConsoleErr&); -extern ICE_API ConsoleOut consoleOut; -extern ICE_API ConsoleErr consoleErr; +extern ICE_API ConsoleOut consoleOut ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API ConsoleErr consoleErr ICE_GLOBAL_VAR_SUFFIX; #else -extern ICE_API std::ostream& consoleOut; -extern ICE_API std::ostream& consoleErr; +extern ICE_API std::ostream& consoleOut ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API std::ostream& consoleErr ICE_GLOBAL_VAR_SUFFIX; #endif diff --git a/cpp/include/IceUtil/OutputUtil.h b/cpp/include/IceUtil/OutputUtil.h index c9786071b8c..00f714662f3 100644 --- a/cpp/include/IceUtil/OutputUtil.h +++ b/cpp/include/IceUtil/OutputUtil.h @@ -72,12 +72,12 @@ protected: class ICE_API NextLine { }; -extern ICE_API NextLine nl; +extern ICE_API NextLine nl ICE_GLOBAL_VAR_SUFFIX; class ICE_API Separator { }; -extern ICE_API Separator sp; +extern ICE_API Separator sp ICE_GLOBAL_VAR_SUFFIX; // ---------------------------------------------------------------------- // Output @@ -149,7 +149,7 @@ operator<<(Output& o, const Separator&) class ICE_API StartBlock { }; -extern ICE_API StartBlock sb; +extern ICE_API StartBlock sb ICE_GLOBAL_VAR_SUFFIX; template<> inline Output& @@ -162,7 +162,7 @@ operator<<(Output& o, const StartBlock&) class ICE_API EndBlock { }; -extern ICE_API EndBlock eb; +extern ICE_API EndBlock eb ICE_GLOBAL_VAR_SUFFIX; template<> inline Output& @@ -175,7 +175,7 @@ operator<<(Output& o, const EndBlock&) class ICE_API StartPar { }; -extern ICE_API StartPar spar; +extern ICE_API StartPar spar ICE_GLOBAL_VAR_SUFFIX; template<> inline Output& @@ -188,7 +188,7 @@ operator<<(Output& o, const StartPar&) class ICE_API EndPar { }; -extern ICE_API EndPar epar; +extern ICE_API EndPar epar ICE_GLOBAL_VAR_SUFFIX; template<> inline Output& @@ -201,7 +201,7 @@ operator<<(Output& o, const EndPar&) class ICE_API StartAbrk { }; -extern ICE_API StartAbrk sabrk; +extern ICE_API StartAbrk sabrk ICE_GLOBAL_VAR_SUFFIX; template<> inline Output& @@ -214,7 +214,7 @@ operator<<(Output& o, const StartAbrk&) class ICE_API EndAbrk { }; -extern ICE_API EndAbrk eabrk; +extern ICE_API EndAbrk eabrk ICE_GLOBAL_VAR_SUFFIX; template<> inline Output& @@ -292,7 +292,7 @@ operator<<(XMLOutput& o, const Separator&) class ICE_API EndElement { }; -extern ICE_API EndElement ee; +extern ICE_API EndElement ee ICE_GLOBAL_VAR_SUFFIX; template<> inline XMLOutput& @@ -353,12 +353,12 @@ operator<<(XMLOutput& o, const Attribute& e) class ICE_API StartEscapes { }; -extern ICE_API StartEscapes startEscapes; +extern ICE_API StartEscapes startEscapes ICE_GLOBAL_VAR_SUFFIX; class ICE_API EndEscapes { }; -extern ICE_API EndEscapes endEscapes; +extern ICE_API EndEscapes endEscapes ICE_GLOBAL_VAR_SUFFIX; template<> inline XMLOutput& diff --git a/cpp/test/Ice/plugin/Plugin.cpp b/cpp/test/Ice/plugin/Plugin.cpp index d18dea3d7d0..9fce188b23a 100644 --- a/cpp/test/Ice/plugin/Plugin.cpp +++ b/cpp/test/Ice/plugin/Plugin.cpp @@ -347,16 +347,14 @@ public: } -extern "C" -{ -ICE_DECLSPEC_EXPORT ::Ice::Plugin* +extern "C" ICE_DECLSPEC_EXPORT ::Ice::Plugin* createPlugin(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&) { return new Plugin(communicator); } -ICE_DECLSPEC_EXPORT ::Ice::Plugin* +extern "C" ICE_DECLSPEC_EXPORT ::Ice::Plugin* createPluginWithArgs(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq& args) { test(args.size() == 3); @@ -366,46 +364,44 @@ createPluginWithArgs(const Ice::CommunicatorPtr& communicator, const string&, co return new Plugin(communicator); } -ICE_DECLSPEC_EXPORT ::Ice::Plugin* +extern "C" ICE_DECLSPEC_EXPORT ::Ice::Plugin* createPluginInitializeFail(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&) { return new PluginInitializeFail(communicator); } -ICE_DECLSPEC_EXPORT ::Ice::Plugin* +extern "C" ICE_DECLSPEC_EXPORT ::Ice::Plugin* createPluginOne(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&) { return new PluginOne(communicator); } -ICE_DECLSPEC_EXPORT ::Ice::Plugin* +extern "C" ICE_DECLSPEC_EXPORT ::Ice::Plugin* createPluginTwo(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&) { return new PluginTwo(communicator); } -ICE_DECLSPEC_EXPORT ::Ice::Plugin* +extern "C" ICE_DECLSPEC_EXPORT ::Ice::Plugin* createPluginThree(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&) { return new PluginThree(communicator); } -ICE_DECLSPEC_EXPORT ::Ice::Plugin* +extern "C" ICE_DECLSPEC_EXPORT ::Ice::Plugin* createPluginOneFail(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&) { return new PluginOneFail(communicator); } -ICE_DECLSPEC_EXPORT ::Ice::Plugin* +extern "C" ICE_DECLSPEC_EXPORT ::Ice::Plugin* createPluginTwoFail(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&) { return new PluginTwoFail(communicator); } -ICE_DECLSPEC_EXPORT ::Ice::Plugin* +extern "C" ICE_DECLSPEC_EXPORT ::Ice::Plugin* createPluginThreeFail(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&) { return new PluginThreeFail(communicator); } - -} |