From 9ea223df2dc4fb30821334d3265c484efcc0dd57 Mon Sep 17 00:00:00 2001 From: "Field G. Van Zee" Date: Fri, 15 Mar 2019 13:57:49 -0500 Subject: [PATCH] Use -fvisibility=[...] with clang on Linux/BSD/OSX. Details: - Modified common.mk to use the -fvisibility=[hidden|default] option when compiling with clang on non-Windows platforms (Linux, BSD, OS X, etc.). Thanks to Isuru Fernando for pointing out this option works with clang on these OSes. --- common.mk | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/common.mk b/common.mk index 3326d2acd..9a63bd0aa 100644 --- a/common.mk +++ b/common.mk @@ -643,6 +643,8 @@ endif endif # Determine default export behavior / visibility of symbols for icc. +# NOTE: The Windows branches have been omitted since we currently make no +# effort to support Windows builds via icc (only gcc/clang via AppVeyor). ifeq ($(CC_VENDOR),icc) ifeq ($(ENABLE_EXPORT_ALL),yes) # Export all symbols by default. @@ -669,13 +671,12 @@ CMISCFLAGS := endif else # ifeq ($(IS_WIN),no) ifeq ($(ENABLE_EXPORT_ALL),yes) -# NOTE: Not sure if clang on Linux/BSD/OSX supports exporting all symbols by -# default. -CMISCFLAGS := +# Export all symbols by default. +CMISCFLAGS := -fvisibility=default else -# NOTE: Not sure if clang on Linux/BSD/OSX supports hiding all symbols by -# default. -CMISCFLAGS := +# Hide all symbols by default and export only those that have been annotated +# as needing to be exported. +CMISCFLAGS := -fvisibility=hidden endif endif endif