GNOME Bugzilla – Bug 667289
build: Adds and uses SunPro visibilty attribute for proper function exports.
Last modified: 2012-03-21 11:54:44 UTC
Created attachment 204606 [details] [review] patch .
This patch did a bit more than it said in the commit message, and no reason why this is useful or what this fixes is actually given (why is the symbol not exported by default with sunpro?). In any case, I've removed the bit where it sets the visibility for gcc as well (not that I think it's wrong, but if it's not needed, I don't see a point in changing it either, esp. if the commit message doesn't mention it). commit c8c961ac816ec911f00ec06852779e16d181432d Author: Idar Tollefsen <itollefs@cisco.com> Date: Sun Jan 1 16:46:04 2012 +0100 gstconfig.h: adds and uses SunPro visibility attribute for proper function exports Define GST_EXPORT for SunPro. https://bugzilla.gnome.org/show_bug.cgi?id=667289
The commit messages should indeed have been better. There are two things leading up to this. Firstly, both for SunPro and GCC, the default visibility of functions exported from a library can be set either with command line options or through attributes like the one in the patch. The default for both is global visibility. If this is lowered on the command line (say to "protected"), then this sort of macro is needed to make sure the function gets exported. That said, the use of "extern" should be enough to inform the compiler that even if the visibility has been lowered, this function should still be visible. Which brings me to the second and specific reason why this patch was needed; When compiling with SunPro (on Solaris) with high levels of optimization and link-time optimization turned on ("-xipo" is enough), it decides that this symbol isn't used outside of the library as it finds it internally and therefore doesn't export it. The visibility attribute fixes this and forces it to export it anyway. The SunPro version check there is sort of arbitrary. I'm not sure exactly which version of SunPro attribute handling was introduced, but I know it exists in the version it checks for here.