make/launcher/Launcher-jdk.pack.gmk
branchihse-cflags-rewrite-branch
changeset 56726 3a9b7a1f9197
parent 56312 a52bcf4118eb
parent 50126 98f57dff16f3
child 56900 d5d542d50e3c
equal deleted inserted replaced
56313:d287dfac1304 56726:3a9b7a1f9197
    32 
    32 
    33 ################################################################################
    33 ################################################################################
    34 # The order of the object files on the link command line affects the size of the resulting
    34 # The order of the object files on the link command line affects the size of the resulting
    35 # binary (at least on linux) which causes the size to differ between old and new build.
    35 # binary (at least on linux) which causes the size to differ between old and new build.
    36 
    36 
       
    37 # Tell the compiler not to export any functions unless declared so in
       
    38 # the source code. On Windows, this is the default and cannot be changed.
       
    39 # On Mac, we have always exported all symbols, probably due to oversight
       
    40 # and/or misunderstanding. To emulate this, don't hide any symbols
       
    41 # by default.
       
    42 # On AIX/xlc we need at least xlc 13.1 for the symbol hiding
       
    43 # Also provide an override for non-conformant libraries.
       
    44 ifeq ($(TOOLCHAIN_TYPE), gcc)
       
    45   CXXFLAGS_JDKEXE += -fvisibility=hidden
       
    46   LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL
       
    47 else ifeq ($(TOOLCHAIN_TYPE), clang)
       
    48   ifneq ($(OPENJDK_TARGET_OS), macosx)
       
    49     CXXFLAGS_JDKEXE += -fvisibility=hidden
       
    50   endif
       
    51 else ifeq ($(TOOLCHAIN_TYPE), solstudio)
       
    52   CXXFLAGS_JDKEXE += -xldscope=hidden
       
    53 else ifeq ($(TOOLCHAIN_TYPE), xlc)
       
    54   ifneq ($(CC_VERSION_NUMBER), 12.1)
       
    55     CXXFLAGS_JDKEXE += -qvisibility=hidden
       
    56   endif
       
    57 endif
       
    58 
    37 UNPACKEXE_SRC := $(TOPDIR)/src/jdk.pack/share/native/common-unpack \
    59 UNPACKEXE_SRC := $(TOPDIR)/src/jdk.pack/share/native/common-unpack \
    38     $(TOPDIR)/src/jdk.pack/share/native/unpack200
    60     $(TOPDIR)/src/jdk.pack/share/native/unpack200
    39 UNPACKEXE_CFLAGS := -I$(TOPDIR)/src/jdk.pack/share/native/common-unpack \
    61 UNPACKEXE_CFLAGS := -I$(TOPDIR)/src/jdk.pack/share/native/common-unpack \
    40     -I$(TOPDIR)/src/java.base/share/native/libjava \
    62     -I$(TOPDIR)/src/java.base/share/native/libjava \
    41     -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava
    63     -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava
    56       $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inftrees$(OBJ_SUFFIX) \
    78       $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inftrees$(OBJ_SUFFIX) \
    57       $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inffast$(OBJ_SUFFIX)
    79       $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inffast$(OBJ_SUFFIX)
    58 
    80 
    59 endif
    81 endif
    60 
    82 
    61 UNPACK_MAPFILE_DIR := $(TOPDIR)/make/mapfiles/libunpack
       
    62 UNPACK_MAPFILE_PLATFORM_FILE := \
       
    63     $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH)
       
    64 
       
    65 # The linker on older SuSE distros (e.g. on SLES 10) complains with:
       
    66 # "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
       
    67 # if feeded with a version script which contains named tags.
       
    68 ifeq ($(USING_BROKEN_SUSE_LD), yes)
       
    69   UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200.anonymous
       
    70 else ifneq ($(wildcard $(UNPACK_MAPFILE_PLATFORM_FILE)), )
       
    71   UNPACK_MAPFILE := $(UNPACK_MAPFILE_PLATFORM_FILE)
       
    72 else
       
    73   UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200
       
    74 endif
       
    75 
       
    76 $(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \
    83 $(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \
    77     NAME := unpack200, \
    84     NAME := unpack200, \
    78     SRC := $(UNPACKEXE_SRC), \
    85     SRC := $(UNPACKEXE_SRC), \
    79     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
    86     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
    80     OPTIMIZATION := LOW, \
    87     OPTIMIZATION := LOW, \
    83     CFLAGS_linux := -fPIC, \
    90     CFLAGS_linux := -fPIC, \
    84     CFLAGS_solaris := -KPIC, \
    91     CFLAGS_solaris := -KPIC, \
    85     CFLAGS_macosx := -fPIC, \
    92     CFLAGS_macosx := -fPIC, \
    86     DISABLED_WARNINGS_gcc := unused-result implicit-fallthrough, \
    93     DISABLED_WARNINGS_gcc := unused-result implicit-fallthrough, \
    87     DISABLED_WARNINGS_solstudio := wunreachable, \
    94     DISABLED_WARNINGS_solstudio := wunreachable, \
    88     MAPFILE := $(UNPACK_MAPFILE),\
       
    89     LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
    95     LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
    90         $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
    96         $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
    91         $(call SET_SHARED_LIBRARY_ORIGIN), \
    97         $(call SET_SHARED_LIBRARY_ORIGIN), \
    92     LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
    98     LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
    93     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \
    99     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \