diff options
author | Darin Broady <dbroady1@yahoo.com> | 2010-01-22 14:12:02 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-01-22 14:12:02 (GMT) |
commit | 1ad847de17cb0e5f53bd5c62933ca887d9cdf7ef (patch) | |
tree | 22dd11174e27a61bc956d7aecb85e8ba4fbd4eff | |
parent | a259511a2b76ddee2e1199802c66295b964c394e (diff) | |
download | Qt-1ad847de17cb0e5f53bd5c62933ca887d9cdf7ef.zip Qt-1ad847de17cb0e5f53bd5c62933ca887d9cdf7ef.tar.gz Qt-1ad847de17cb0e5f53bd5c62933ca887d9cdf7ef.tar.bz2 |
Add the ability for the SunStudio 8+ compilers to do
ELF symbol visibility.
Merge-request: 433
Reviewed-by: Thiago Macieira <thiago.macieira@nokia.com>
-rwxr-xr-x | config.tests/unix/fvisibility.test | 39 | ||||
-rw-r--r-- | mkspecs/solaris-cc-64/qmake.conf | 2 | ||||
-rw-r--r-- | mkspecs/solaris-cc/qmake.conf | 2 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 5 |
4 files changed, 36 insertions, 12 deletions
diff --git a/config.tests/unix/fvisibility.test b/config.tests/unix/fvisibility.test index b2bcc07..d716695 100755 --- a/config.tests/unix/fvisibility.test +++ b/config.tests/unix/fvisibility.test @@ -4,25 +4,41 @@ FVISIBILITY_SUPPORT=no COMPILER=$1 VERBOSE=$2 +CMDLINE= + + RunCompileTest() { cat >>fvisibility.c << EOF -__attribute__((visibility("default"))) void blah(); -#if !defined(__GNUC__) -# error "Visiblility support requires GCC" -#elif __GNUC__ < 4 -# error "GCC3 with backported visibility patch is known to miscompile Qt" +#if defined(__GNUC__) +# if (__GNUC__ < 4) +# error "GCC3 with backported visibility patch is known to miscompile Qt" +# endif +__attribute((visibility("default"))) void blah(); +#elif defined(__SUNPRO_CC) +# if (__SUNPRO_CC < 0x0550) +# error "SunStudio 8 or later is required for ELF visibility" +# endif +__global void blah(); +#else +# error "GCC4+ or SunStudio 8+ are required to support ELF visibility" #endif EOF if [ "$VERBOSE" = "yes" ] ; then - "$COMPILER" -c -fvisibility=hidden fvisibility.c && FVISIBILITY_SUPPORT=yes + "$COMPILER" -c $CMDLINE fvisibility.c && FVISIBILITY_SUPPORT=yes else - "$COMPILER" -c -fvisibility=hidden fvisibility.c >/dev/null 2>&1 && FVISIBILITY_SUPPORT=yes + "$COMPILER" -c $CMDLINE fvisibility.c >/dev/null 2>&1 && FVISIBILITY_SUPPORT=yes fi rm -f fvisibility.c fvisibility.o } + case "$COMPILER" in +g++) + CMDLINE="-fvisibility=hidden" + RunCompileTest + ;; + aCC*) ;; @@ -34,14 +50,17 @@ icpc) ;; *) # the compile test works for the intel compiler because it mimics gcc's behavior + CMDLINE="-fvisibility=hidden" RunCompileTest ;; esac ;; - *) - RunCompileTest - ;; +CC) + # This should be SunStudio. If not, it'll get caught. + CMDLINE="-xldscope=hidden" + RunCompileTest + ;; esac # done diff --git a/mkspecs/solaris-cc-64/qmake.conf b/mkspecs/solaris-cc-64/qmake.conf index eb594d9..d51d77a 100644 --- a/mkspecs/solaris-cc-64/qmake.conf +++ b/mkspecs/solaris-cc-64/qmake.conf @@ -41,6 +41,7 @@ QMAKE_CFLAGS_SHLIB = -KPIC QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_THREAD = -mt +QMAKE_CFLAGS_HIDESYMS = -xldscope=hidden QMAKE_CXX = CC QMAKE_CXXFLAGS = $$QMAKE_CFLAGS @@ -53,6 +54,7 @@ QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB QMAKE_CXXFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_STATIC_LIB QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD +QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS QMAKE_INCDIR = /usr/sfw/include QMAKE_LIBDIR = /usr/sfw/lib/64 diff --git a/mkspecs/solaris-cc/qmake.conf b/mkspecs/solaris-cc/qmake.conf index ad430d1..354b83c 100644 --- a/mkspecs/solaris-cc/qmake.conf +++ b/mkspecs/solaris-cc/qmake.conf @@ -24,6 +24,7 @@ QMAKE_CFLAGS_SHLIB = -KPIC QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_THREAD = -mt +QMAKE_CFLAGS_HIDESYMS = -xldscope=hidden QMAKE_CXX = CC QMAKE_CXXFLAGS = $$QMAKE_CFLAGS @@ -36,6 +37,7 @@ QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB QMAKE_CXXFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_STATIC_LIB QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD +QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS QMAKE_INCDIR = /usr/sfw/include QMAKE_LIBDIR = /usr/sfw/lib diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index c4cf3f0..b237659 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -672,8 +672,9 @@ namespace QT_NAMESPACE {} # define Q_ALIGNOF(type) __alignof__(type) # define Q_TYPEOF(expr) __typeof__(expr) # define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) -// using CC 5.9: Warning: attribute visibility is unsupported and will be skipped.. -//# define Q_DECL_EXPORT __attribute__((__visibility__("default"))) +# endif +# if __SUNPRO_CC >= 0x550 +# define Q_DECL_EXPORT __global # endif # if __SUNPRO_CC < 0x5a0 # define Q_NO_TEMPLATE_FRIENDS |