make/launcher/Launcher-jdk.pack.gmk
branchihse-nativecompilation-branch
changeset 56723 d927981eeb64
parent 50126 98f57dff16f3
child 56724 e979823eba01
--- a/make/launcher/Launcher-jdk.pack.gmk	Tue Feb 27 11:50:16 2018 +0100
+++ b/make/launcher/Launcher-jdk.pack.gmk	Mon Jun 11 11:38:26 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,22 +80,7 @@
 
 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 SetupNativeCompilation, BUILD_UNPACKEXE, \
+$(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \
     NAME := unpack200, \
     TYPE := EXECUTABLE, \
     SRC := $(UNPACKEXE_SRC), \
@@ -85,19 +92,11 @@
     CFLAGS_solaris := -KPIC, \
     CFLAGS_macosx := -fPIC, \
     DISABLED_WARNINGS_gcc := unused-result implicit-fallthrough, \
-    MAPFILE := $(UNPACK_MAPFILE),\
     LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
         $(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), \
-    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), \
 ))