Mon, 05 Nov 2012 19:33:44 -0500
8002034: Allow Full Debug Symbols when cross-compiling
8001756: Hotspot makefiles report missing OBJCOPY command in the wrong circumstances
Reviewed-by: dcubed, dsamersoff, erikj, collins
1.1 --- a/make/linux/makefiles/defs.make Fri Nov 02 07:44:11 2012 -0700 1.2 +++ b/make/linux/makefiles/defs.make Mon Nov 05 19:33:44 2012 -0500 1.3 @@ -170,68 +170,70 @@ 1.4 # overridden in some situations, e.g., a BUILD_FLAVOR != product 1.5 # build. 1.6 1.7 - ifeq ($(BUILD_FLAVOR), product) 1.8 - FULL_DEBUG_SYMBOLS ?= 1 1.9 - ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) 1.10 - else 1.11 - # debug variants always get Full Debug Symbols (if available) 1.12 - ENABLE_FULL_DEBUG_SYMBOLS = 1 1.13 - endif 1.14 - _JUNK_ := $(shell \ 1.15 - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") 1.16 - # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later 1.17 + # Due to the multiple sub-make processes that occur this logic gets 1.18 + # executed multiple times. We reduce the noise by at least checking that 1.19 + # BUILD_FLAVOR has been set. 1.20 + ifneq ($(BUILD_FLAVOR),) 1.21 + ifeq ($(BUILD_FLAVOR), product) 1.22 + FULL_DEBUG_SYMBOLS ?= 1 1.23 + ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) 1.24 + else 1.25 + # debug variants always get Full Debug Symbols (if available) 1.26 + ENABLE_FULL_DEBUG_SYMBOLS = 1 1.27 + endif 1.28 + _JUNK_ := $(shell \ 1.29 + echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") 1.30 + # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later 1.31 1.32 - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 1.33 - # Default OBJCOPY comes from GNU Binutils on Linux: 1.34 - DEF_OBJCOPY=/usr/bin/objcopy 1.35 - ifdef CROSS_COMPILE_ARCH 1.36 - # don't try to generate .debuginfo files when cross compiling 1.37 - _JUNK_ := $(shell \ 1.38 - echo >&2 "INFO: cross compiling for ARCH $(CROSS_COMPILE_ARCH)," \ 1.39 - "skipping .debuginfo generation.") 1.40 - OBJCOPY= 1.41 - else 1.42 + ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 1.43 + # Default OBJCOPY comes from GNU Binutils on Linux 1.44 + ifeq ($(CROSS_COMPILE_ARCH),) 1.45 + DEF_OBJCOPY=/usr/bin/objcopy 1.46 + else 1.47 + # Assume objcopy is part of the cross-compilation toolset 1.48 + ifneq ($(ALT_COMPILER_PATH),) 1.49 + DEF_OBJCOPY=$(ALT_COMPILER_PATH)/objcopy 1.50 + endif 1.51 + endif 1.52 OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) 1.53 ifneq ($(ALT_OBJCOPY),) 1.54 _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") 1.55 OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) 1.56 endif 1.57 - endif 1.58 - else 1.59 - OBJCOPY= 1.60 - endif 1.61 1.62 - ifeq ($(OBJCOPY),) 1.63 - _JUNK_ := $(shell \ 1.64 - echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.") 1.65 - ENABLE_FULL_DEBUG_SYMBOLS=0 1.66 - _JUNK_ := $(shell \ 1.67 - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") 1.68 - else 1.69 - _JUNK_ := $(shell \ 1.70 - echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") 1.71 + ifeq ($(OBJCOPY),) 1.72 + _JUNK_ := $(shell \ 1.73 + echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.") 1.74 + ENABLE_FULL_DEBUG_SYMBOLS=0 1.75 + _JUNK_ := $(shell \ 1.76 + echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") 1.77 + else 1.78 + _JUNK_ := $(shell \ 1.79 + echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") 1.80 1.81 - # Library stripping policies for .debuginfo configs: 1.82 - # all_strip - strips everything from the library 1.83 - # min_strip - strips most stuff from the library; leaves minimum symbols 1.84 - # no_strip - does not strip the library at all 1.85 - # 1.86 - # Oracle security policy requires "all_strip". A waiver was granted on 1.87 - # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. 1.88 - # 1.89 - # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. 1.90 - # 1.91 - STRIP_POLICY ?= min_strip 1.92 + # Library stripping policies for .debuginfo configs: 1.93 + # all_strip - strips everything from the library 1.94 + # min_strip - strips most stuff from the library; leaves minimum symbols 1.95 + # no_strip - does not strip the library at all 1.96 + # 1.97 + # Oracle security policy requires "all_strip". A waiver was granted on 1.98 + # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. 1.99 + # 1.100 + # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. 1.101 + # 1.102 + STRIP_POLICY ?= min_strip 1.103 1.104 - _JUNK_ := $(shell \ 1.105 - echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") 1.106 + _JUNK_ := $(shell \ 1.107 + echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") 1.108 1.109 - ZIP_DEBUGINFO_FILES ?= 1 1.110 + ZIP_DEBUGINFO_FILES ?= 1 1.111 1.112 - _JUNK_ := $(shell \ 1.113 - echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") 1.114 - endif 1.115 -endif 1.116 + _JUNK_ := $(shell \ 1.117 + echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") 1.118 + endif 1.119 + endif # ENABLE_FULL_DEBUG_SYMBOLS=1 1.120 + endif # BUILD_FLAVOR 1.121 +endif # JDK_6_OR_EARLIER 1.122 1.123 JDK_INCLUDE_SUBDIR=linux 1.124
2.1 --- a/make/linux/makefiles/vm.make Fri Nov 02 07:44:11 2012 -0700 2.2 +++ b/make/linux/makefiles/vm.make Mon Nov 05 19:33:44 2012 -0500 2.3 @@ -336,24 +336,23 @@ 2.4 fi \ 2.5 fi \ 2.6 } 2.7 -ifeq ($(CROSS_COMPILE_ARCH),) 2.8 - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 2.9 + 2.10 +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 2.11 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) 2.12 $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ 2.13 - ifeq ($(STRIP_POLICY),all_strip) 2.14 + ifeq ($(STRIP_POLICY),all_strip) 2.15 $(QUIETLY) $(STRIP) $@ 2.16 - else 2.17 - ifeq ($(STRIP_POLICY),min_strip) 2.18 + else 2.19 + ifeq ($(STRIP_POLICY),min_strip) 2.20 $(QUIETLY) $(STRIP) -g $@ 2.21 - # implied else here is no stripping at all 2.22 - endif 2.23 + # implied else here is no stripping at all 2.24 endif 2.25 + endif 2.26 $(QUIETLY) [ -f $(LIBJVM_G_DEBUGINFO) ] || ln -s $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO) 2.27 - ifeq ($(ZIP_DEBUGINFO_FILES),1) 2.28 + ifeq ($(ZIP_DEBUGINFO_FILES),1) 2.29 $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO) 2.30 $(RM) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO) 2.31 [ -f $(LIBJVM_G_DIZ) ] || { ln -s $(LIBJVM_DIZ) $(LIBJVM_G_DIZ); } 2.32 - endif 2.33 endif 2.34 endif 2.35
3.1 --- a/make/solaris/makefiles/defs.make Fri Nov 02 07:44:11 2012 -0700 3.2 +++ b/make/solaris/makefiles/defs.make Mon Nov 05 19:33:44 2012 -0500 3.3 @@ -109,60 +109,63 @@ 3.4 # overridden in some situations, e.g., a BUILD_FLAVOR != product 3.5 # build. 3.6 3.7 - ifeq ($(BUILD_FLAVOR), product) 3.8 - FULL_DEBUG_SYMBOLS ?= 1 3.9 - ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) 3.10 - else 3.11 - # debug variants always get Full Debug Symbols (if available) 3.12 - ENABLE_FULL_DEBUG_SYMBOLS = 1 3.13 - endif 3.14 - _JUNK_ := $(shell \ 3.15 - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") 3.16 - # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later 3.17 - 3.18 - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 3.19 - # Default OBJCOPY comes from the SUNWbinutils package: 3.20 - DEF_OBJCOPY=/usr/sfw/bin/gobjcopy 3.21 - OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) 3.22 - ifneq ($(ALT_OBJCOPY),) 3.23 - _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") 3.24 - OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) 3.25 + # Due to the multiple sub-make processes that occur this logic gets 3.26 + # executed multiple times. We reduce the noise by at least checking that 3.27 + # BUILD_FLAVOR has been set. 3.28 + ifneq ($(BUILD_FLAVOR),) 3.29 + ifeq ($(BUILD_FLAVOR), product) 3.30 + FULL_DEBUG_SYMBOLS ?= 1 3.31 + ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) 3.32 + else 3.33 + # debug variants always get Full Debug Symbols (if available) 3.34 + ENABLE_FULL_DEBUG_SYMBOLS = 1 3.35 endif 3.36 - else 3.37 - OBJCOPY= 3.38 - endif 3.39 - 3.40 - ifeq ($(OBJCOPY),) 3.41 - _JUNK_ := $(shell \ 3.42 - echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.") 3.43 - ENABLE_FULL_DEBUG_SYMBOLS=0 3.44 _JUNK_ := $(shell \ 3.45 echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") 3.46 - else 3.47 - _JUNK_ := $(shell \ 3.48 - echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") 3.49 + # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later 3.50 3.51 - # Library stripping policies for .debuginfo configs: 3.52 - # all_strip - strips everything from the library 3.53 - # min_strip - strips most stuff from the library; leaves minimum symbols 3.54 - # no_strip - does not strip the library at all 3.55 - # 3.56 - # Oracle security policy requires "all_strip". A waiver was granted on 3.57 - # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. 3.58 - # 3.59 - # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. 3.60 - # 3.61 - STRIP_POLICY ?= min_strip 3.62 + ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 3.63 + # Default OBJCOPY comes from the SUNWbinutils package: 3.64 + DEF_OBJCOPY=/usr/sfw/bin/gobjcopy 3.65 + OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) 3.66 + ifneq ($(ALT_OBJCOPY),) 3.67 + _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") 3.68 + OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) 3.69 + endif 3.70 3.71 - _JUNK_ := $(shell \ 3.72 - echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") 3.73 + ifeq ($(OBJCOPY),) 3.74 + _JUNK_ := $(shell \ 3.75 + echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.") 3.76 + ENABLE_FULL_DEBUG_SYMBOLS=0 3.77 + _JUNK_ := $(shell \ 3.78 + echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") 3.79 + else 3.80 + _JUNK_ := $(shell \ 3.81 + echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") 3.82 3.83 - ZIP_DEBUGINFO_FILES ?= 1 3.84 + # Library stripping policies for .debuginfo configs: 3.85 + # all_strip - strips everything from the library 3.86 + # min_strip - strips most stuff from the library; leaves minimum symbols 3.87 + # no_strip - does not strip the library at all 3.88 + # 3.89 + # Oracle security policy requires "all_strip". A waiver was granted on 3.90 + # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. 3.91 + # 3.92 + # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. 3.93 + # 3.94 + STRIP_POLICY ?= min_strip 3.95 3.96 - _JUNK_ := $(shell \ 3.97 - echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") 3.98 - endif 3.99 -endif 3.100 + _JUNK_ := $(shell \ 3.101 + echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") 3.102 + 3.103 + ZIP_DEBUGINFO_FILES ?= 1 3.104 + 3.105 + _JUNK_ := $(shell \ 3.106 + echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") 3.107 + endif 3.108 + endif # ENABLE_FULL_DEBUG_SYMBOLS=1 3.109 + endif # BUILD_FLAVOR 3.110 +endif # JDK_6_OR_EARLIER 3.111 3.112 JDK_INCLUDE_SUBDIR=solaris 3.113
4.1 --- a/make/windows/makefiles/defs.make Fri Nov 02 07:44:11 2012 -0700 4.2 +++ b/make/windows/makefiles/defs.make Mon Nov 05 19:33:44 2012 -0500 4.3 @@ -131,23 +131,29 @@ 4.4 # overridden in some situations, e.g., a BUILD_FLAVOR != product 4.5 # build. 4.6 4.7 -ifeq ($(BUILD_FLAVOR), product) 4.8 - FULL_DEBUG_SYMBOLS ?= 1 4.9 - ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) 4.10 -else 4.11 - # debug variants always get Full Debug Symbols (if available) 4.12 - ENABLE_FULL_DEBUG_SYMBOLS = 1 4.13 +# Due to the multiple sub-make processes that occur this logic gets 4.14 +# executed multiple times. We reduce the noise by at least checking that 4.15 +# BUILD_FLAVOR has been set. 4.16 +ifneq ($(BUILD_FLAVOR),) 4.17 + ifeq ($(BUILD_FLAVOR), product) 4.18 + FULL_DEBUG_SYMBOLS ?= 1 4.19 + ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) 4.20 + else 4.21 + # debug variants always get Full Debug Symbols (if available) 4.22 + ENABLE_FULL_DEBUG_SYMBOLS = 1 4.23 + endif 4.24 + _JUNK_ := $(shell \ 4.25 + echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") 4.26 + MAKE_ARGS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) 4.27 + 4.28 + ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 4.29 + ZIP_DEBUGINFO_FILES ?= 1 4.30 + else 4.31 + ZIP_DEBUGINFO_FILES=0 4.32 + endif 4.33 + MAKE_ARGS += ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) 4.34 endif 4.35 -_JUNK_ := $(shell \ 4.36 - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") 4.37 -MAKE_ARGS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) 4.38 4.39 -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 4.40 - ZIP_DEBUGINFO_FILES ?= 1 4.41 -else 4.42 - ZIP_DEBUGINFO_FILES=0 4.43 -endif 4.44 -MAKE_ARGS += ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) 4.45 MAKE_ARGS += RM="$(RM)" 4.46 MAKE_ARGS += ZIPEXE=$(ZIPEXE) 4.47