1
1

Add visibility feature for Sun Studio compilers.

This commit was SVN r20833.
Этот коммит содержится в:
Terry Dontje 2009-03-20 10:13:01 +00:00
родитель 804eb94f5f
Коммит d521a7bb71
3 изменённых файлов: 35 добавлений и 5 удалений

Просмотреть файл

@ -11,6 +11,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -24,7 +25,7 @@
AC_DEFUN([OMPI_CHECK_VISIBILITY],[ AC_DEFUN([OMPI_CHECK_VISIBILITY],[
AC_REQUIRE([AC_PROG_GREP]) AC_REQUIRE([AC_PROG_GREP])
# Check if the compiler has support for visibility, like some versions of gcc, icc. # Check if the compiler has support for visibility, like some versions of gcc, icc Sun Studio cc.
AC_ARG_ENABLE(visibility, AC_ARG_ENABLE(visibility,
AC_HELP_STRING([--enable-visibility], AC_HELP_STRING([--enable-visibility],
[enable visibility feature of certain compilers/linkers (default: enabled)])) [enable visibility feature of certain compilers/linkers (default: enabled)]))
@ -34,14 +35,16 @@ AC_DEFUN([OMPI_CHECK_VISIBILITY],[
have_visibility=0 have_visibility=0
else else
CFLAGS_orig="$CFLAGS" CFLAGS_orig="$CFLAGS"
CFLAGS="$CFLAGS_orig -fvisibility=hidden"
add= add=
# check using gcc -fvisibility=hidden flag
CFLAGS="$CFLAGS_orig -fvisibility=hidden"
AC_CACHE_CHECK([if $CC supports -fvisibility], AC_CACHE_CHECK([if $CC supports -fvisibility],
[ompi_cv_cc_fvisibility], [ompi_cv_cc_fvisibility],
[AC_TRY_LINK([ [AC_TRY_LINK([
#include <stdio.h> #include <stdio.h>
__attribute__((visibility("default"))) int foo; __attribute__((visibility("default"))) int foo;
void bar(void) { fprintf(stderr, "bar\n"); }; void bar(void) { fprintf(stderr, "bar\n"); }
],[], ],[],
[if test -s conftest.err ; then [if test -s conftest.err ; then
$GREP -iq "visibility" conftest.err $GREP -iq "visibility" conftest.err
@ -55,6 +58,27 @@ AC_DEFUN([OMPI_CHECK_VISIBILITY],[
fi], fi],
[ompi_cv_cc_fvisibility="no"]) [ompi_cv_cc_fvisibility="no"])
]) ])
# Check using Sun Studio -xldscope=hidden flag
CFLAGS="$CFLAGS_orig -xldscope=hidden"
AC_CACHE_CHECK([if $CC supports -xldscope],
[ompi_cv_cc_xldscope],
[AC_TRY_LINK([
#include <stdio.h>
__attribute__((visibility("default"))) int foo;
void bar(void) { fprintf(stderr, "bar\n"); }
],[],
[if test -s conftest.err ; then
$GREP -iq "visibility" conftest.err
if test "$?" = "0" ; then
ompi_cv_cc_xldscope="no"
else
ompi_cv_cc_xldscope="yes"
fi
else
ompi_cv_cc_xldscope="yes"
fi],
[ompi_cv_cc_xldscope="no"])
])
if test "$ompi_cv_cc_fvisibility" = "yes" ; then if test "$ompi_cv_cc_fvisibility" = "yes" ; then
add=" -fvisibility=hidden" add=" -fvisibility=hidden"
@ -62,6 +86,12 @@ AC_DEFUN([OMPI_CHECK_VISIBILITY],[
AC_MSG_CHECKING([enable symbol visibility]) AC_MSG_CHECKING([enable symbol visibility])
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
AC_MSG_WARN([$add has been added to CFLAGS]) AC_MSG_WARN([$add has been added to CFLAGS])
elif test "$ompi_cv_cc_xldscope" = "yes" ; then
add=" -xldscope=hidden"
have_visibility=1
AC_MSG_CHECKING([enable symbol visibility])
AC_MSG_RESULT([yes])
AC_MSG_WARN([$add has been added to CFLAGS])
elif test "$enable_visibility" = "yes"; then elif test "$enable_visibility" = "yes"; then
AC_MSG_ERROR([Symbol visibility support requested but compiler does not seem to support it. Aborting]) AC_MSG_ERROR([Symbol visibility support requested but compiler does not seem to support it. Aborting])
else else

Просмотреть файл

@ -242,7 +242,7 @@ OPAL_DECLSPEC int opal_paffinity_base_slot_list_set(long rank);
/** /**
* Debugging output stream * Debugging output stream
*/ */
extern int opal_paffinity_base_output; OPAL_DECLSPEC extern int opal_paffinity_base_output;
END_C_DECLS END_C_DECLS

Просмотреть файл

@ -40,7 +40,7 @@
/* /*
* Globals * Globals
*/ */
int opal_paffinity_base_output = -1; OPAL_DECLSPEC int opal_paffinity_base_output = -1;
bool opal_paffinity_base_components_opened_valid = false; bool opal_paffinity_base_components_opened_valid = false;
opal_list_t opal_paffinity_base_components_opened; opal_list_t opal_paffinity_base_components_opened;