7165611: implement Full Debug Symbols on MacOS X hotspot
Summary: Add MacOS X FDS support to hotspot; add minimal MacOS X FDS import support to jdk; add MacOS X FDS support to install; add MacOS X FDS support to root.
Reviewed-by: erikj, sla, dholmes, rdurbin, tbell, ihse
--- a/jdk/make/common/Defs-macosx.gmk Thu Oct 10 10:09:19 2013 -0700
+++ b/jdk/make/common/Defs-macosx.gmk Tue Oct 15 08:26:38 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -85,6 +85,100 @@
CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
+# The Full Debug Symbols (FDS) default for VARIANT == OPT builds is
+# enabled with debug info files ZIP'ed to save space. For VARIANT !=
+# OPT builds, FDS is always enabled, after all a debug build without
+# debug info isn't very useful. The ZIP_DEBUGINFO_FILES option only has
+# meaning when FDS is enabled.
+#
+# If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be
+# disabled for a VARIANT == OPT build.
+#
+# Note: Use of a different variable name for the FDS override option
+# versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS
+# versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass
+# in options via environment variables, use of distinct variables
+# prevents strange behaviours. For example, in a VARIANT != OPT build,
+# the FULL_DEBUG_SYMBOLS environment variable will be 0, but the
+# ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If the same
+# variable name is used, then different values can be picked up by
+# different parts of the build. Just to be clear, we only need two
+# variable names because the incoming option value can be overridden
+# in some situations, e.g., a VARIANT != OPT build.
+
+ifeq ($(VARIANT), OPT)
+ FULL_DEBUG_SYMBOLS ?= 1
+ ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
+else
+ # debug variants always get Full Debug Symbols (if available)
+ ENABLE_FULL_DEBUG_SYMBOLS = 1
+endif
+_JUNK_ := $(shell \
+ echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
+# since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
+
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(OS_NAME),darwin)
+ # MacOS X doesn't use OBJCOPY or STRIP_POLICY
+ OBJCOPY=
+ STRIP_POLICY=
+ ZIP_DEBUGINFO_FILES ?= 1
+ else
+ ifndef CROSS_COMPILE_ARCH
+ # Default OBJCOPY comes from GNU Binutils on Linux:
+ DEF_OBJCOPY=/usr/bin/objcopy
+ else
+ # Assume objcopy is part of the cross-compilation toolkit
+ DEF_OBJCOPY=$(COMPILER_PATH)/objcopy
+ endif
+ OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
+ ifneq ($(ALT_OBJCOPY),)
+ _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
+ # disable .debuginfo support by setting ALT_OBJCOPY to a non-existent path
+ OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
+ endif
+
+ # Setting ENABLE_FULL_DEBUG_SYMBOLS=1 (and OBJCOPY) above enables the
+ # JDK build to import .debuginfo or .diz files from the HotSpot build.
+ # However, adding FDS support to the JDK build will occur in phases
+ # so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS
+ # and PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS) is used to indicate that a
+ # particular library or program supports FDS.
+
+ ifeq ($(OBJCOPY),)
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo" \
+ "files. You may need to set ALT_OBJCOPY.")
+ ENABLE_FULL_DEBUG_SYMBOLS=0
+ else
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.")
+
+ # Library stripping policies for .debuginfo configs:
+ # all_strip - strips everything from the library
+ # min_strip - strips most stuff from the library; leaves
+ # minimum symbols
+ # no_strip - does not strip the library at all
+ #
+ # Oracle security policy requires "all_strip". A waiver was granted
+ # on 2011.09.01 that permits using "min_strip" in the Java JDK and
+ # Java JRE.
+ #
+ # Currently, STRIP_POLICY is only used when Full Debug Symbols
+ # is enabled.
+ STRIP_POLICY ?= min_strip
+
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
+
+ ZIP_DEBUGINFO_FILES ?= 1
+ endif
+ endif
+
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
+endif
+
#
# Default optimization
#
--- a/jdk/make/common/Defs.gmk Thu Oct 10 10:09:19 2013 -0700
+++ b/jdk/make/common/Defs.gmk Tue Oct 15 08:26:38 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -508,12 +508,18 @@
# Convenient macros
#
-# Prepare $@ target, remove old one and making sure directory exists
+# Prepare $@ target, remove old one and making sure containing dir exists
define prep-target
$(MKDIR) -p $(@D)
$(RM) $@
endef
+# Prepare $@ target dir, remove old one and making sure containing dir exists
+define prep-target-dir
+$(MKDIR) -p $(@D)
+$(RM) -r $@
+endef
+
# Simple install of $< file to $@
define install-file
$(prep-target)
@@ -616,6 +622,26 @@
fi
endef
+# MacOS X strongly discourages 'cp -r' and provides 'cp -R' instead.
+# May need to have a MacOS X specific definition of install-import-dir
+# sometime in the future.
+define install-import-dir
+@$(ECHO) "ASSEMBLY_IMPORT: $@"
+$(prep-target-dir)
+$(CP) -r $< $@
+endef
+
+ifeq ($(PLATFORM), macosx)
+# On MacOS X, debug info is in .dSYM directories
+define install-import-debuginfo
+$(install-import-dir)
+endef
+else
+define install-import-debuginfo
+$(install-import-file)
+endef
+endif
+
define install-import-file
$(install-importonly-file)
endef
--- a/jdk/make/java/redist/Makefile Thu Oct 10 10:09:19 2013 -0700
+++ b/jdk/make/java/redist/Makefile Tue Oct 15 08:26:38 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -60,15 +60,24 @@
JVMDB_NAME = $(LIB_PREFIX)jvm$(DB_SUFFIX).$(LIBRARY_SUFFIX)
JVMDTRACE_NAME = $(LIB_PREFIX)jvm$(DTRACE_SUFFIX).$(LIBRARY_SUFFIX)
-JVM_DEBUGINFO_NAME = $(LIB_PREFIX)jvm.debuginfo
JVM_DIZ_NAME = $(LIB_PREFIX)jvm.diz
-LIBJSIG_DEBUGINFO_NAME = $(LIB_PREFIX)jsig.debuginfo
LIBJSIG_DIZ_NAME = $(LIB_PREFIX)jsig.diz
-JVMDB_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DB_SUFFIX).debuginfo
JVMDB_DIZ_NAME = $(LIB_PREFIX)jvm$(DB_SUFFIX).diz
-JVMDTRACE_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DTRACE_SUFFIX).debuginfo
JVMDTRACE_DIZ_NAME = $(LIB_PREFIX)jvm$(DTRACE_SUFFIX).diz
+ifeq ($(PLATFORM), macosx)
+ # Note: *.dSYM is a directory
+ JVM_DEBUGINFO_NAME = $(LIB_PREFIX)jvm.dSYM
+ LIBJSIG_DEBUGINFO_NAME = $(LIB_PREFIX)jsig.dSYM
+ JVMDB_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DB_SUFFIX).dSYM
+ JVMDTRACE_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DTRACE_SUFFIX).dSYM
+else
+ JVM_DEBUGINFO_NAME = $(LIB_PREFIX)jvm.debuginfo
+ LIBJSIG_DEBUGINFO_NAME = $(LIB_PREFIX)jsig.debuginfo
+ JVMDB_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DB_SUFFIX).debuginfo
+ JVMDTRACE_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DTRACE_SUFFIX).debuginfo
+endif
+
CLASSSHARINGDATA_DIR = $(BUILDDIR)/tools/sharing
# Needed to do file copy
@@ -441,7 +450,7 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_DEBUGINFO_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVM_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
@@ -459,7 +468,7 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME): $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJSIG_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
@@ -471,8 +480,8 @@
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
# We don't create a symlink to a libjsig.diz file, but we do put
-# the libjsig.debuginfo symlink into a libjsig.diz file. The aurora
-# system does not like dangling symlinks.
+# the $(LIBJSIG_DEBUGINFO_NAME) symlink into a libjsig.diz file.
+# The aurora system does not like dangling symlinks.
ifeq ($(ZIP_DEBUGINFO_FILES),1)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DIZ_NAME) \
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_DIZ_NAME):
@@ -496,8 +505,8 @@
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
# We don't create a symlink to a libjsig.diz file, but we do put
-# the libjsig.debuginfo symlink into a libjsig.diz file. The aurora
-# system does not like dangling symlinks.
+# the $(LIBJSIG_DEBUGINFO_NAME) symlink into a libjsig.diz file.
+# The aurora system does not like dangling symlinks.
ifeq ($(ZIP_DEBUGINFO_FILES),1)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DIZ_NAME):
@$(prep-target)
@@ -531,10 +540,10 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDB_DEBUGINFO_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDB_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDB_DEBUGINFO_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDB_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
@@ -556,10 +565,10 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDB_DEBUGINFO_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDB_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
$(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDB_DEBUGINFO_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDB_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
endif
@@ -581,10 +590,10 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDTRACE_DEBUGINFO_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDTRACE_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDTRACE_DEBUGINFO_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDTRACE_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
@@ -613,13 +622,13 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDTRACE_DEBUGINFO_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDTRACE_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
$(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDTRACE_DEBUGINFO_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDTRACE_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVM_DEBUGINFO_NAME): $(HOTSPOT_SERVER_PATH)/$(JVM_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
--- a/jdk/makefiles/Import.gmk Thu Oct 10 10:09:19 2013 -0700
+++ b/jdk/makefiles/Import.gmk Tue Oct 15 08:26:38 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -119,8 +119,13 @@
$(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE), $(HOTSPOT_IMPORT_FILES)))
$(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib, $(HOTSPOT_IMPORT_FILES)))
-JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
- $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.dSYM) \
+ $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
+else
+ JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
+ $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
+endif
ifneq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(JVM_VARIANT_SERVER), true)
@@ -135,10 +140,12 @@
IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
- ifeq ($(JVM_VARIANT_MINIMAL1), true)
- IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
- ifneq (,$(JSIG_DEBUGINFO))
- IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+ ifneq ($(OPENJDK_TARGET_OS), macosx)
+ ifeq ($(JVM_VARIANT_MINIMAL1), true)
+ IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
+ ifneq (,$(JSIG_DEBUGINFO))
+ IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+ endif
endif
endif
endif
@@ -148,6 +155,21 @@
$(RM) $@
$(LN) -s ../$(@F) $@
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+$(INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(LN) -s ../$(@F) $@
+
+$(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(RM) $@.tmp $(basename $@).dSYM
+ $(LN) -s ../$(basename $(@F)).dSYM $(basename $@).dSYM
+ $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).dSYM
+ $(RM) $(basename $@).dSYM
+ $(MV) $@.tmp $@
+else
$(INSTALL_LIBRARIES_HERE)/server/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
@@ -161,12 +183,28 @@
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
$(RM) $(basename $@).debuginfo
$(MV) $@.tmp $@
+endif
$(INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+$(INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(LN) -s ../$(@F) $@
+
+$(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(RM) $@.tmp $(basename $@).dSYM
+ $(LN) -s ../$(basename $(@F)).dSYM $(basename $@).dSYM
+ $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).dSYM
+ $(RM) $(basename $@).dSYM
+ $(MV) $@.tmp $@
+else
$(INSTALL_LIBRARIES_HERE)/client/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
@@ -180,12 +218,14 @@
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
$(RM) $(basename $@).debuginfo
$(MV) $@.tmp $@
+endif
$(INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
+ifneq ($(OPENJDK_TARGET_OS), macosx)
$(INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
@@ -199,6 +239,7 @@
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
$(RM) $(basename $@).debuginfo
$(MV) $@.tmp $@
+endif
##########################################################################################
# Unpack the binary distributions of the crypto classes if they exist.
--- a/jdk/makefiles/Tools.gmk Thu Oct 10 10:09:19 2013 -0700
+++ b/jdk/makefiles/Tools.gmk Tue Oct 15 08:26:38 2013 -0700
@@ -154,6 +154,7 @@
# Tools needed on solaris because OBJCOPY is broken.
+ifeq ($(OPENJDK_TARGET_OS), solaris)
$(eval $(call SetupNativeCompilation,ADD_GNU_DEBUGLINK,\
SRC:=$(JDK_TOPDIR)/make/tools/add_gnu_debuglink,\
LANG:=C,\
@@ -173,3 +174,4 @@
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags,\
OUTPUT_DIR:=$(JDK_OUTPUTDIR)/btbin,\
PROGRAM:=fix_empty_sec_hdr_flags))
+endif