--- a/jdk/make/common/Library.gmk Thu May 24 11:11:37 2012 -0400
+++ b/jdk/make/common/Library.gmk Fri May 25 08:20:12 2012 -0700
@@ -245,6 +245,12 @@
ARFLAGS = -r
endif
+ifeq ($(PLATFORM), solaris)
+ ifeq ($(LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS),1)
+$(ACTUAL_LIBRARY):: $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS)
+ endif
+endif
+
$(ACTUAL_LIBRARY):: $(COMPILE_FILES_o) $(FILES_m) $(FILES_reorder)
@$(prep-target)
@$(ECHO) "STATS: LIBRARY=$(LIBRARY), PRODUCT=$(PRODUCT), OPTIMIZATION_LEVEL=$(OPTIMIZATION_LEVEL)"
@@ -260,11 +266,29 @@
ifneq ($(PLATFORM), macosx)
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
ifeq ($(LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(PLATFORM), solaris)
+# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+# Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
+# empty section headers until a fixed $(OBJCOPY) is available.
+# An empty section header has sh_addr == 0 and sh_size == 0.
+# This problem has only been seen on Solaris X64, but we call this tool
+# on all Solaris builds just in case.
+#
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
(set -e ; \
$(CD) $(@D) ; \
- $(OBJCOPY) --only-keep-debug $(@F) $(LIBRARY).debuginfo ; \
- $(OBJCOPY) --add-gnu-debuglink=$(LIBRARY).debuginfo $(@F) ; \
+ $(FIX_EMPTY_SEC_HDR_FLAGS) $(@F) ; \
+ $(OBJCOPY) --only-keep-debug $(@F) $(LIB_PREFIX)$(LIBRARY).debuginfo ; \
+ $(ADD_GNU_DEBUGLINK) $(LIB_PREFIX)$(LIBRARY).debuginfo $(@F) ; \
)
+ else # PLATFORM != solaris
+ (set -e ; \
+ $(CD) $(@D) ; \
+ $(OBJCOPY) --only-keep-debug $(@F) $(LIB_PREFIX)$(LIBRARY).debuginfo ; \
+ $(OBJCOPY) --add-gnu-debuglink=$(LIB_PREFIX)$(LIBRARY).debuginfo $(@F) ; \
+ )
+ endif # PLATFORM == solaris
ifeq ($(STRIP_POLICY),all_strip)
$(STRIP) $@
else
@@ -281,8 +305,8 @@
ifeq ($(ZIP_DEBUGINFO_FILES),1)
(set -e ; \
$(CD) $(@D) ; \
- $(ZIPEXE) -q $(LIBRARY).diz $(LIBRARY).debuginfo ; \
- $(RM) $(LIBRARY).debuginfo ; \
+ $(ZIPEXE) -q $(LIB_PREFIX)$(LIBRARY).diz $(LIB_PREFIX)$(LIBRARY).debuginfo ; \
+ $(RM) $(LIB_PREFIX)$(LIBRARY).debuginfo ; \
)
endif
endif # LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS