From 7f213aaae8f1ccb23f43852d7c22baf766685763 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 10 Oct 2013 15:25:07 +0300 Subject: Use -fvisibility=hidden also for 3rd-party libs for iOS Change-Id: Ib2806d71f9c2dc18c64f2c92012eaa1c77ddd9d2 --- configure.ac | 7 +++++-- solenv/gbuild/platform/com_GCC_defs.mk | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index a917cfbb0bfd..8670deccc89a 100644 --- a/configure.ac +++ b/configure.ac @@ -2942,8 +2942,11 @@ if test $_os = iOS; then if test "$ENABLE_LTO" = TRUE; then lto=-flto fi - CC="`xcrun -find clang` -arch $arch -isysroot $sysroot $lto $versionmin" - CXX="`xcrun -find clang++` -arch $arch -isysroot $sysroot $lto $versionmin" + # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also + # get compiled with it, to avoid ld warnings when linking all that together into one + # executable. + CC="`xcrun -find clang` -arch $arch -fvisibility=hidden -isysroot $sysroot $lto $versionmin" + CXX="`xcrun -find clang++` -arch $arch -fvisibility=hidden -isysroot $sysroot $lto $versionmin" INSTALL_NAME_TOOL=`xcrun -find install_name_tool` AR=`xcrun -find ar` NM=`xcrun -find nm` diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk index 7cb29836a8a3..c74785402025 100644 --- a/solenv/gbuild/platform/com_GCC_defs.mk +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -82,7 +82,11 @@ endif ifeq ($(HAVE_GCC_VISIBILITY_FEATURE),TRUE) -gb_VISIBILITY_FLAGS := -DHAVE_GCC_VISIBILITY_FEATURE -fvisibility=hidden +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_FLAGS += -fvisibility=hidden +endif ifneq ($(HAVE_GCC_VISIBILITY_BROKEN),TRUE) gb_CXXFLAGS_COMMON += -fvisibility-inlines-hidden endif -- cgit