< prev index next >

make/lib/LibCommon.gmk

Print this page

        

@@ -34,12 +34,35 @@
 
 # Absolute paths to lib files on windows for use in LIBS. Should figure out a more
 # elegant solution to this.
 WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
 
-ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx windows), )
-  DISABLE_MAPFILES := true
+# Tell the compiler not to export any functions unless declared so in
+# the source code. On Windows, this is the default and cannot be changed.
+# On Mac, we have always exported all symbols, probably due to oversight
+# and/or misunderstanding. To emulate this, don't hide any symbols
+# by default.
+# Also provide an override for non-conformant libraries.
+ifeq ($(TOOLCHAIN_TYPE), gcc)
+  CFLAGS_JDKLIB += -fvisibility=hidden
+  CXXFLAGS_JDKLIB += -fvisibility=hidden
+  LDFLAGS_JDKLIB += -Wl,--exclude-libs,ALL
+  EXPORT_ALL_SYMBOLS := -fvisibility=default
+else ifeq ($(TOOLCHAIN_TYPE), clang)
+  ifneq ($(OPENJDK_TARGET_OS), macosx)
+    CFLAGS_JDKLIB += -fvisibility=hidden
+    CXXFLAGS_JDKLIB += -fvisibility=hidden
+    EXPORT_ALL_SYMBOLS := -fvisibility=default
+  endif
+else ifeq ($(TOOLCHAIN_TYPE), solstudio)
+  CFLAGS_JDKLIB += -xldscope=hidden
+  CXXFLAGS_JDKLIB += -xldscope=hidden
+  EXPORT_ALL_SYMBOLS := -xldscope=global
+else ifeq ($(TOOLCHAIN_TYPE), xlc)
+  CFLAGS_JDKLIB += -qvisibility=hidden
+  CXXFLAGS_JDKLIB += -qvisibility=hidden
+  EXPORT_ALL_SYMBOLS := -qvisibility=default
 endif
 
 ################################################################################
 # Find the default set of src dirs for a native library.
 # Param 1 - module name
< prev index next >