make/launcher/Launcher-jdk.pack.gmk
branchihse-cflags-rewrite-branch
changeset 56726 3a9b7a1f9197
parent 56312 a52bcf4118eb
parent 50126 98f57dff16f3
child 56900 d5d542d50e3c
--- a/make/launcher/Launcher-jdk.pack.gmk	Thu Mar 15 10:01:56 2018 +0100
+++ b/make/launcher/Launcher-jdk.pack.gmk	Mon Jun 11 12:10:55 2018 +0200
@@ -34,6 +34,28 @@
 # The order of the object files on the link command line affects the size of the resulting
 # binary (at least on linux) which causes the size to differ between old and new build.
 
+# 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.
+# On AIX/xlc we need at least xlc 13.1 for the symbol hiding
+# Also provide an override for non-conformant libraries.
+ifeq ($(TOOLCHAIN_TYPE), gcc)
+  CXXFLAGS_JDKEXE += -fvisibility=hidden
+  LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL
+else ifeq ($(TOOLCHAIN_TYPE), clang)
+  ifneq ($(OPENJDK_TARGET_OS), macosx)
+    CXXFLAGS_JDKEXE += -fvisibility=hidden
+  endif
+else ifeq ($(TOOLCHAIN_TYPE), solstudio)
+  CXXFLAGS_JDKEXE += -xldscope=hidden
+else ifeq ($(TOOLCHAIN_TYPE), xlc)
+  ifneq ($(CC_VERSION_NUMBER), 12.1)
+    CXXFLAGS_JDKEXE += -qvisibility=hidden
+  endif
+endif
+
 UNPACKEXE_SRC := $(TOPDIR)/src/jdk.pack/share/native/common-unpack \
     $(TOPDIR)/src/jdk.pack/share/native/unpack200
 UNPACKEXE_CFLAGS := -I$(TOPDIR)/src/jdk.pack/share/native/common-unpack \
@@ -58,21 +80,6 @@
 
 endif
 
-UNPACK_MAPFILE_DIR := $(TOPDIR)/make/mapfiles/libunpack
-UNPACK_MAPFILE_PLATFORM_FILE := \
-    $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH)
-
-# The linker on older SuSE distros (e.g. on SLES 10) complains with:
-# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
-# if feeded with a version script which contains named tags.
-ifeq ($(USING_BROKEN_SUSE_LD), yes)
-  UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200.anonymous
-else ifneq ($(wildcard $(UNPACK_MAPFILE_PLATFORM_FILE)), )
-  UNPACK_MAPFILE := $(UNPACK_MAPFILE_PLATFORM_FILE)
-else
-  UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200
-endif
-
 $(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \
     NAME := unpack200, \
     SRC := $(UNPACKEXE_SRC), \
@@ -85,7 +92,6 @@
     CFLAGS_macosx := -fPIC, \
     DISABLED_WARNINGS_gcc := unused-result implicit-fallthrough, \
     DISABLED_WARNINGS_solstudio := wunreachable, \
-    MAPFILE := $(UNPACK_MAPFILE),\
     LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
         $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \