--- a/make/launcher/Launcher-jdk.pack.gmk Tue Feb 13 15:28:07 2018 +0100
+++ b/make/launcher/Launcher-jdk.pack.gmk Mon Jun 11 11:23:20 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,7 +80,8 @@
endif
-$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
+$(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \
+ NAME := unpack200, \
SRC := $(UNPACKEXE_SRC), \
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
OPTIMIZATION := LOW, \
@@ -72,15 +95,7 @@
$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
- LIBS_solaris := -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \
- OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
- PROGRAM := unpack200, \
- VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=unpack200.exe" \
- -D "JDK_INTERNAL_NAME=unpack200" \
- -D "JDK_FTYPE=0x1L", \
MANIFEST := $(TOPDIR)/src/jdk.pack/windows/native/unpack200/unpack200_proto.exe.manifest, \
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
))