8064808: Disable use of broken objcopy on Solaris, remove adhoc helper tools
authorihse
Fri, 11 Sep 2015 10:05:49 +0200
changeset 32462 f236112ab3d0
parent 32461 e1cfbafc4e9c
child 32463 57f442b702f2
8064808: Disable use of broken objcopy on Solaris, remove adhoc helper tools Reviewed-by: erikj
common/autoconf/generated-configure.sh
common/autoconf/toolchain.m4
make/common/NativeCompilation.gmk
make/common/TestFilesCompilation.gmk
--- a/common/autoconf/generated-configure.sh	Wed Sep 09 09:44:57 2015 +0200
+++ b/common/autoconf/generated-configure.sh	Fri Sep 11 10:05:49 2015 +0200
@@ -4364,7 +4364,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1435822080
+DATE_WHEN_GENERATED=1441958217
 
 ###############################################################################
 #
@@ -38307,6 +38307,48 @@
     fi
   fi
 
+      if test "x$OPENJDK_BUILD_OS" = xsolaris; then
+        # objcopy prior to 2.21.1 on solaris is broken and is not usable.
+        # Rewrite objcopy version output to VALID_VERSION or BAD_VERSION.
+        # - version number is last blank separate word on first line
+        # - version number formats that have been seen:
+        #   - <major>.<minor>
+        #   - <major>.<minor>.<micro>
+        OBJCOPY_VERSION=`$OBJCOPY --version | $HEAD -n 1`
+        # The outer [ ] is to prevent m4 from eating the [] in the sed expression.
+         OBJCOPY_VERSION_CHECK=`$ECHO $OBJCOPY_VERSION | $SED -n \
+              -e 's/.* //' \
+              -e '/^[01]\./b bad' \
+              -e '/^2\./{' \
+              -e '  s/^2\.//' \
+              -e '  /^[0-9]$/b bad' \
+              -e '  /^[0-9]\./b bad' \
+              -e '  /^1[0-9]$/b bad' \
+              -e '  /^1[0-9]\./b bad' \
+              -e '  /^20\./b bad' \
+              -e '  /^21\.0$/b bad' \
+              -e '  /^21\.0\./b bad' \
+              -e '}' \
+              -e ':good' \
+              -e 's/.*/VALID_VERSION/p' \
+              -e 'q' \
+              -e ':bad' \
+              -e 's/.*/BAD_VERSION/p' \
+              -e 'q'`
+        if test "x$OBJCOPY_VERSION_CHECK" = xBAD_VERSION; then
+          OBJCOPY=
+          { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated." >&5
+$as_echo "$as_me: WARNING: Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated." >&2;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: objcopy reports version $OBJCOPY_VERSION" >&5
+$as_echo "$as_me: objcopy reports version $OBJCOPY_VERSION" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version" >&5
+$as_echo "$as_me: Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version" >&5
+$as_echo "$as_me: Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Note: Solaris 11 Update 1 contains the correct version" >&5
+$as_echo "$as_me: Note: Solaris 11 Update 1 contains the correct version" >&6;}
+        fi
+      fi
     fi
   fi
 
--- a/common/autoconf/toolchain.m4	Wed Sep 09 09:44:57 2015 +0200
+++ b/common/autoconf/toolchain.m4	Fri Sep 11 10:05:49 2015 +0200
@@ -586,6 +586,43 @@
     # Only call fixup if objcopy was found.
     if test -n "$OBJCOPY"; then
       BASIC_FIXUP_EXECUTABLE(OBJCOPY)
+      if test "x$OPENJDK_BUILD_OS" = xsolaris; then
+        # objcopy prior to 2.21.1 on solaris is broken and is not usable.
+        # Rewrite objcopy version output to VALID_VERSION or BAD_VERSION.
+        # - version number is last blank separate word on first line
+        # - version number formats that have been seen:
+        #   - <major>.<minor>
+        #   - <major>.<minor>.<micro>
+        OBJCOPY_VERSION=`$OBJCOPY --version | $HEAD -n 1`
+        # The outer [ ] is to prevent m4 from eating the [] in the sed expression.
+        [ OBJCOPY_VERSION_CHECK=`$ECHO $OBJCOPY_VERSION | $SED -n \
+              -e 's/.* //' \
+              -e '/^[01]\./b bad' \
+              -e '/^2\./{' \
+              -e '  s/^2\.//' \
+              -e '  /^[0-9]$/b bad' \
+              -e '  /^[0-9]\./b bad' \
+              -e '  /^1[0-9]$/b bad' \
+              -e '  /^1[0-9]\./b bad' \
+              -e '  /^20\./b bad' \
+              -e '  /^21\.0$/b bad' \
+              -e '  /^21\.0\./b bad' \
+              -e '}' \
+              -e ':good' \
+              -e 's/.*/VALID_VERSION/p' \
+              -e 'q' \
+              -e ':bad' \
+              -e 's/.*/BAD_VERSION/p' \
+              -e 'q'` ]
+        if test "x$OBJCOPY_VERSION_CHECK" = xBAD_VERSION; then
+          OBJCOPY=
+          AC_MSG_WARN([Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated.])
+          AC_MSG_NOTICE([objcopy reports version $OBJCOPY_VERSION])
+          AC_MSG_NOTICE([Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version])
+          AC_MSG_NOTICE([Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version])
+          AC_MSG_NOTICE([Note: Solaris 11 Update 1 contains the correct version])
+        fi
+      fi
     fi
   fi
 
--- a/make/common/NativeCompilation.gmk	Wed Sep 09 09:44:57 2015 +0200
+++ b/make/common/NativeCompilation.gmk	Fri Sep 11 10:05:49 2015 +0200
@@ -624,28 +624,7 @@
             $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
                 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
 
-          else ifeq ($(OPENJDK_TARGET_OS), solaris)
-            $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
-            # Setup the command line creating debuginfo files, to be run after linking.
-            # It cannot be run separately since it updates the original target file
-            #
-            # 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.
-            $1_CREATE_DEBUGINFO_CMDS := \
-                $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$($1_TARGET) $$(NEWLINE) \
-                $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
-                $(CD) $$($1_OUTPUT_DIR) && \
-                    $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$($1_DEBUGINFO_FILES) $$($1_TARGET)
-            $1_DEBUGINFO_EXTRA_DEPS := $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
-
-          else ifeq ($(OPENJDK_TARGET_OS), linux)
+          else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
             $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
             # Setup the command line creating debuginfo files, to be run after linking.
             # It cannot be run separately since it updates the original target file
@@ -653,7 +632,6 @@
                 $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
                 $(CD) $$($1_OUTPUT_DIR) && \
                     $(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
-
           endif # No MacOS X support
 
           # This dependency dance ensures that debug info files get rebuilt
@@ -694,7 +672,7 @@
         $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
 
     $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \
-        $$($1_DEBUGINFO_EXTRA_DEPS) $$($1_VARDEPS_FILE)
+        $$($1_VARDEPS_FILE)
 		$(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)"
 		$(call LogFailures, $$($1_OBJECT_DIR)/$1_link.log, $1_link, \
 		    $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
@@ -735,7 +713,7 @@
         $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
 
     $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_MANIFEST) \
-        $$($1_DEBUGINFO_EXTRA_DEPS) $$($1_VARDEPS_FILE)
+        $$($1_VARDEPS_FILE)
 		$(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)"
 		$(call LogFailures, $$($1_OBJECT_DIR)/$1_link.log, $1_link, \
 		    $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
--- a/make/common/TestFilesCompilation.gmk	Wed Sep 09 09:44:57 2015 +0200
+++ b/make/common/TestFilesCompilation.gmk	Fri Sep 11 10:05:49 2015 +0200
@@ -32,8 +32,6 @@
 
 
 include NativeCompilation.gmk
-# FIXME: This is a bad fix currently needed due to JDK-8064808 not being resolved.
-include $(JDK_TOPDIR)/make/Tools.gmk
 
 # Setup make rules for creating a set of native test files (libraries or
 # executables). This will locate native files matching a certain pattern,