[API CHANGE] Remove HAVE_GCC_VISIBILITY_FEATURE, always true

* GCC documents -fvisibility at least as far back as the GCC 4.0 online
  documentation at
  <https://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/Code-Gen-Options.html>.

* For external code, odk/settings/settings.mk unconditionally set
  HAVE_GCC_VISIBILITY_FEATURE for all platforms other than Windows.

Make this a fatal configure error for now.  The check should be removed
completely after LO 5.3 branch-off.

Change-Id: I1de415b6ed1591e0a7b6640ece861b6f0ef74112
Reviewed-on: https://gerrit.libreoffice.org/29073
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2016-09-20 08:11:58 +02:00
parent 60b6b1eae5
commit f255c3e96e
13 changed files with 68 additions and 84 deletions

View File

@@ -251,7 +251,6 @@ export HAVE_GCC_FNO_SIZED_DEALLOCATION=@HAVE_GCC_FNO_SIZED_DEALLOCATION@
export HAVE_GCC_GGDB2=@HAVE_GCC_GGDB2@
export HAVE_GCC_PRAGMA_OPERATOR=@HAVE_GCC_PRAGMA_OPERATOR@
export HAVE_GCC_VISIBILITY_BROKEN=@HAVE_GCC_VISIBILITY_BROKEN@
export HAVE_GCC_VISIBILITY_FEATURE=@HAVE_GCC_VISIBILITY_FEATURE@
export HAVE_GNUMAKE_FILE_FUNC=@HAVE_GNUMAKE_FILE_FUNC@
export HAVE_LD_BSYMBOLIC_FUNCTIONS=@HAVE_LD_BSYMBOLIC_FUNCTIONS@
export HAVE_LD_HASH_STYLE=@HAVE_LD_HASH_STYLE@

View File

@@ -5946,7 +5946,7 @@ if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([no This is no longer supported.])
fi
AC_MSG_CHECKING([whether $CC supports -mno-avx])
@@ -6488,7 +6488,7 @@ if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
# Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
# only.
if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
if test "$CPP_LIBRARY" = GLIBCXX; then
dnl gcc#19664, gcc#22482, rhbz#162935
AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
@@ -6498,38 +6498,36 @@ if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
fi
fi
if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
sharedlink_ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
sharedlink_ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sstream>
using namespace std;
]], [[
]], [[
istringstream strm( "test" ); return 0;
]])],
# Ugh, surely bad to assume an error message will contain
# the word "unresolvable", a problem with
# -fvisibility-inlines-hidden and STL headers might cause
# some more obscure message on some platform, and anway,
# the error message could be localised.
[$EGREP -q unresolvable conftest.err;
if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
])
AC_MSG_RESULT([$gccvisok])
if test "$gccvisok" = "no"; then
AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
HAVE_GCC_VISIBILITY_BROKEN="TRUE"
fi
LDFLAGS=$sharedlink_ldflags_save
]])],
# Ugh, surely bad to assume an error message will contain
# the word "unresolvable", a problem with
# -fvisibility-inlines-hidden and STL headers might cause
# some more obscure message on some platform, and anway,
# the error message could be localised.
[$EGREP -q unresolvable conftest.err;
if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
])
AC_MSG_RESULT([$gccvisok])
if test "$gccvisok" = "no"; then
AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
HAVE_GCC_VISIBILITY_BROKEN="TRUE"
fi
LDFLAGS=$sharedlink_ldflags_save
# As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
# when we don't make any dynamic libraries?
if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
cat > conftestlib1.cc <<_ACEOF
template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
@@ -6573,9 +6571,8 @@ _ACEOF
fi
fi
if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
cat >visibility.cxx <<_ACEOF
AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
cat >visibility.cxx <<_ACEOF
#pragma GCC visibility push(hidden)
struct __attribute__ ((visibility ("default"))) TestStruct {
static void Init();
@@ -6584,32 +6581,31 @@ __attribute__ ((visibility ("default"))) void TestFunc() {
TestStruct::Init();
}
_ACEOF
if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
gccvisbroken=yes
else
case "$host_cpu" in
i?86|x86_64)
if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
gccvisbroken=yes
else
case "$host_cpu" in
i?86|x86_64)
if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
gccvisbroken=no
else
if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
gccvisbroken=no
else
if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
gccvisbroken=no
else
gccvisbroken=yes
fi
gccvisbroken=yes
fi
;;
*)
gccvisbroken=no
;;
esac
fi
rm -f visibility.s visibility.cxx
fi
;;
*)
gccvisbroken=no
;;
esac
fi
rm -f visibility.s visibility.cxx
AC_MSG_RESULT([$gccvisbroken])
if test "$gccvisbroken" = "yes"; then
AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
fi
AC_MSG_RESULT([$gccvisbroken])
if test "$gccvisbroken" = "yes"; then
AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
fi
CPPFLAGS="$save_CPPFLAGS"
@@ -6617,7 +6613,6 @@ _ACEOF
AC_LANG_POP([C++])
fi
AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
dnl ===================================================================

View File

@@ -29,7 +29,7 @@
#elif defined(CPPUHELPER_TEST_COMPONENT_LIB)
# define CPPUHELPER_TEST_COMPONENT_EXPORT extern
#elif defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE)
#elif defined(__GNUC__)
# define CPPUHELPER_TEST_COMPONENT_EXPORT extern __attribute__ ((weak))
#else

View File

@@ -2721,7 +2721,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// libreofficekit_hook must be exported for dlsym() to find it,
// though, at least on iOS.
#if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE) && defined(DISABLE_DYNLOADING)
#if defined(__GNUC__) && defined(DISABLE_DYNLOADING)
__attribute__ ((visibility("default")))
#else
SAL_DLLPUBLIC_EXPORT
@@ -2741,7 +2741,7 @@ LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* user
return static_cast<LibreOfficeKit*>(gImpl);
}
#if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE) && defined(DISABLE_DYNLOADING)
#if defined(__GNUC__) && defined(DISABLE_DYNLOADING)
__attribute__ ((visibility("default")))
#else
SAL_DLLPUBLIC_EXPORT

View File

@@ -1015,10 +1015,8 @@ typedef CL_API_ENTRY void * (CL_API_CALL * PFNCLGETEXTENSIONFUNCTIONADDRESS)(con
# ifdef CLEW_BUILD
# if defined(_WIN32)
# define CLEWAPI extern __declspec(dllexport)
# elif defined(HAVE_GCC_VISIBILITY_FEATURE)
# define CLEWAPI extern __attribute__ ((visibility("default")))
# else
# define CLEWAPI extern
# define CLEWAPI extern __attribute__ ((visibility("default")))
# endif
# else
# if defined(_WIN32)

View File

@@ -86,9 +86,8 @@ $(call gb_ExternalProject_get_state_target,openssl,build):
$(if $(SYSBASE),-I$(SYSBASE)/usr/include -L$(SYSBASE)/usr/lib)) \
$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
&& $(MAKE) build_libs \
CC="$(CC) -fPIC $(if $(filter-out WNT MACOSX,$(OS)),\
$(if $(filter TRUE,$(HAVE_GCC_VISIBILITY_FEATURE)),\
-fvisibility=hidden))" \
CC="$(CC) -fPIC \
$(if $(filter-out WNT MACOSX,$(OS)),-fvisibility=hidden)" \
)
endif

View File

@@ -15,14 +15,14 @@
#pragma warning(disable : 4068 4263 4264 4266)
#endif
#if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE)
#if defined(__GNUC__)
# pragma GCC visibility push (default)
#endif
#include <CLucene.h>
#include <CLucene/analysis/LanguageBasedAnalyzer.h>
#if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE)
#if defined(__GNUC__)
# pragma GCC visibility pop
#endif

View File

@@ -255,7 +255,7 @@ typedef void * sal_Handle;
# define SAL_CALL __cdecl
# define SAL_CALL_ELLIPSE __cdecl
#elif defined SAL_UNX
# if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE)
# if defined(__GNUC__)
# if defined(DISABLE_DYNLOADING)
# define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("hidden")))
# define SAL_JNI_EXPORT __attribute__ ((visibility("default")))

View File

@@ -221,7 +221,7 @@ SDK_JAVA_INCLUDES = -I"$(OO_SDK_JAVA_HOME)/include" -I"$(OO_SDK_JAVA_HOME)/inclu
# define for used compiler necessary for UNO
CC_DEFINES_JNI=-DUNX -DSOLARIS -DCPPU_ENV=$(CPPU_ENV) -DGCC
CC_DEFINES=-DUNX -DSOLARIS -DSPARC -DCPPU_ENV=$(CPPU_ENV) -DHAVE_GCC_VISIBILITY_FEATURE -DGCC
CC_DEFINES=-DUNX -DSOLARIS -DSPARC -DCPPU_ENV=$(CPPU_ENV) -DGCC
CC_OUTPUT_SWITCH=-o
LIBO_SDK_LDFLAGS_STDLIBS =
@@ -339,7 +339,7 @@ endif
SDK_JAVA_INCLUDES = -I"$(OO_SDK_JAVA_HOME)/include" -I"$(OO_SDK_JAVA_HOME)/include/linux"
CC_INCLUDES=-I. -I$(OUT)/inc -I$(OUT)/inc/examples -I$(PRJ)/include
CC_DEFINES_JNI=-DUNX -DGCC -DLINUX -DCPPU_ENV=$(CPPU_ENV)
CC_DEFINES=-DUNX -DGCC -DLINUX -DCPPU_ENV=$(CPPU_ENV) -DHAVE_GCC_VISIBILITY_FEATURE
CC_DEFINES=-DUNX -DGCC -DLINUX -DCPPU_ENV=$(CPPU_ENV)
CC_OUTPUT_SWITCH=-o
@@ -425,7 +425,7 @@ CC_FLAGS=-c -fPIC -fno-common $(GCC_ARCH_OPTION) -fvisibility=hidden $(OPT_FLAGS
SDK_JAVA_INCLUDES = -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers -I/System/Library/Frameworks/JavaVM.framework/Headers
CC_INCLUDES=-I. -I$(OUT)/inc -I$(OUT)/inc/examples -I$(PRJ)/include
CC_DEFINES_JNI=-DUNX -DGCC -DMACOSX -DCPPU_ENV=$(CPPU_ENV)
CC_DEFINES=-DUNX -DGCC -DMACOSX -DCPPU_ENV=$(CPPU_ENV) -DHAVE_GCC_VISIBILITY_FEATURE
CC_DEFINES=-DUNX -DGCC -DMACOSX -DCPPU_ENV=$(CPPU_ENV)
CC_OUTPUT_SWITCH=-o
@@ -531,7 +531,7 @@ CC_FLAGS=-c -g -fPIC -DPIC $(PTHREAD_CFLAGS) -fvisibility=hidden $(OPT_FLAGS)
SDK_JAVA_INCLUDES = -I"$(OO_SDK_JAVA_HOME)/include" -I"$(OO_SDK_JAVA_HOME)/include/freebsd"
CC_INCLUDES=-I. -I$(OUT)/inc -I$(OUT)/inc/examples -I$(PRJ)/include
CC_DEFINES_JNI=-DUNX -DGCC -DFREEBSD -DCPPU_ENV=$(CPPU_ENV)
CC_DEFINES=-DUNX -DGCC -DFREEBSD -DCPPU_ENV=$(CPPU_ENV) -DHAVE_GCC_VISIBILITY_FEATURE
CC_DEFINES=-DUNX -DGCC -DFREEBSD -DCPPU_ENV=$(CPPU_ENV)
CC_OUTPUT_SWITCH=-o

View File

@@ -147,7 +147,7 @@ static bool sUseHardLinks = true;
// This variable lives in libbz2. It's declared in bzlib_private.h, so we just
// declare it here to avoid including that entire header file.
#if defined(HAVE_GCC_VISIBILITY_FEATURE)
#if defined __GNUC__
extern "C" __attribute__((visibility("default"))) unsigned int BZ2_crc32Table[256];
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
extern "C" __global unsigned int BZ2_crc32Table[256];

View File

@@ -101,22 +101,18 @@ gb_CXXFLAGS_COMMON += -Wimplicit-fallthrough
endif
ifeq ($(HAVE_GCC_VISIBILITY_FEATURE),TRUE)
gb_VISIBILITY_FLAGS := -DHAVE_GCC_VISIBILITY_FEATURE
# If CC or CXX already include -fvisibility=hidden, don't duplicate it
ifeq (,$(filter -fvisibility=hidden,$(CC)))
gb__visibility_hidden := -fvisibility=hidden
gb_VISIBILITY_FLAGS := -fvisibility=hidden
ifeq ($(COM_IS_CLANG),TRUE)
ifneq ($(filter -fsanitize=%,$(CC)),)
gb__visibility_hidden := -fvisibility-ms-compat
gb_VISIBILITY_FLAGS := -fvisibility-ms-compat
endif
endif
gb_VISIBILITY_FLAGS += $(gb__visibility_hidden)
endif
ifneq ($(HAVE_GCC_VISIBILITY_BROKEN),TRUE)
gb_VISIBILITY_FLAGS_CXX := -fvisibility-inlines-hidden
endif
endif
gb_CXXFLAGS_COMMON += $(gb_VISIBILITY_FLAGS_CXX)
ifeq ($(HAVE_GCC_STACK_PROTECTOR_STRONG),TRUE)

View File

@@ -88,8 +88,7 @@ out.pln/cppmain.o: cppmain.cc out.pln/cpputypes.cppumaker.flag \
out.pln/types.cppumaker.flag | out.pln
g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \
-I $(SDK_HOME)/include -I out.pln/include/cpputypes \
-I out.pln/include/types -DCPPU_ENV=gcc3 \
-DHAVE_GCC_VISIBILITY_FEATURE -DLINUX -DUNX $<
-I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $<
out.pln/cpptest.uno.so: out.pln/cpptest.o | out.pln out.pln/lib/libuno_cppu.so \
@@ -101,8 +100,7 @@ out.pln/cpptest.o: cpptest.cc out.pln/cpputypes.cppumaker.flag \
out.pln/types.cppumaker.flag | out.pln
g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \
-I $(SDK_HOME)/include -I out.pln/include/cpputypes \
-I out.pln/include/types -DCPPU_ENV=gcc3 \
-DHAVE_GCC_VISIBILITY_FEATURE -DLINUX -DUNX $<
-I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $<
out.pln/cppserver.uno.so: out.pln/cppserver.o | out.pln \
@@ -115,8 +113,7 @@ out.pln/cppserver.o: cppserver.cc out.pln/cpputypes.cppumaker.flag \
out.pln/types.cppumaker.flag | out.pln
g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \
-I $(SDK_HOME)/include -I out.pln/include/cpputypes \
-I out.pln/include/types -DCPPU_ENV=gcc3 \
-DHAVE_GCC_VISIBILITY_FEATURE -DLINUX -DUNX $<
-I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $<
out.pln/cpputypes.cppumaker.flag: | out.pln

View File

@@ -34,11 +34,11 @@
#pragma warning(disable : 4068 4263 4264 4266)
#endif
#if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE)
#if defined(__GNUC__)
# pragma GCC visibility push (default)
#endif
#include <CLucene.h>
#if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE)
#if defined(__GNUC__)
# pragma GCC visibility pop
#endif