changeset 2824:4aafb042a399

PR1374: Provide option to strip and link debugging info after build 2015-07-15 Andrew John Hughes <gnu_andrew@member.fsf.org> PR1374: Provide option to strip and link debugging info after build * INSTALL: Document --enable-split-debuginfo. * Makefile.am: (BUILD_DEBUGINFO_DIR): Specify location of split binaries and libraries for main build. (BUILD_DEBUG_DEBUGINFO_DIR): Likewise for debug build. (BUILD_BOOT_DEBUGINFO_DIR): Likewise for bootstrap build. (DEBUG_PREFIX): Prefix for debuginfo installation directory. (.PHONY): Add clean-split-debuginfo, clean-split-debuginfo-debug and clean-split-debuginfo-boot. (split-debuginfo): Split ELF binaries into debuginfo and non-debuginfo files if --enable-split-debuginfo is enabled. (clean-split-debuginfo): Remove split debuginfo files. (split-debuginfo-debug): Equivalent of split-debuginfo for debug builds. (clean-split-debuginfo-debug): Remove split debuginfo files for debug build. (icedtea-stage2): Depend on stamps/split-debuginfo.stamp (clean-icedtea-stage2): Depend on clean-split-debuginfo. (icedtea-debug-stage2): Depend on stamps/split-debuginfo-debug.stamp (clean-icedtea-debug-stage2): Depend on clean-split-debuginfo-debug. (split-debuginfo-boot): Equivalent of split-debuginfo for bootstrap builds. (clean-split-debuginfo-boot): Remove split debuginfo files for bootstrap build. (icedtea-stage1): Depend on stamps/split-debuginfo-boot.stamp (clean-icedtea-stage1): Depend on clean-split-debuginfo-boot. (install-exec-local): Create debuginfo directories and install stripped file and debug file instead of original file if --enable-split-debuginfo is enabled and the file is not a symbolic link or the java-rmi.cgi script. * NEWS: Updated. * acinclude.m4: (IT_ENABLE_SPLIT_DEBUGINFO): New macro to introduce the --enable-split-debuginfo option. The option is automatically disabled if native debuginfo is disabled. Turning the option on introduces a requirement for objcopy. * configure.ac: Invoke IT_ENABLE_SPLIT_DEBUGINFO.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Wed, 15 Jul 2015 14:34:19 +0100
parents a3c123889979
children eadd40d69bc3
files ChangeLog INSTALL Makefile.am NEWS acinclude.m4 configure.ac
diffstat 6 files changed, 236 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jul 14 22:35:05 2015 +0100
+++ b/ChangeLog	Wed Jul 15 14:34:19 2015 +0100
@@ -1,3 +1,51 @@
+2015-07-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>
+
+	PR1374: Provide option to strip and link debugging
+	info after build
+	* INSTALL: Document --enable-split-debuginfo.
+	* Makefile.am:
+	(BUILD_DEBUGINFO_DIR): Specify location of split
+	binaries and libraries for main build.
+	(BUILD_DEBUG_DEBUGINFO_DIR): Likewise for debug build.
+	(BUILD_BOOT_DEBUGINFO_DIR): Likewise for bootstrap build.
+	(DEBUG_PREFIX): Prefix for debuginfo installation directory.
+	(.PHONY): Add clean-split-debuginfo, clean-split-debuginfo-debug
+	and clean-split-debuginfo-boot.
+	(split-debuginfo): Split ELF binaries into debuginfo and
+	non-debuginfo files if --enable-split-debuginfo is enabled.
+	(clean-split-debuginfo): Remove split debuginfo files.
+	(split-debuginfo-debug): Equivalent of split-debuginfo
+	for debug builds.
+	(clean-split-debuginfo-debug): Remove split debuginfo
+	files for debug build.
+	(icedtea-stage2): Depend on stamps/split-debuginfo.stamp
+	(clean-icedtea-stage2): Depend on clean-split-debuginfo.
+	(icedtea-debug-stage2): Depend on
+	stamps/split-debuginfo-debug.stamp
+	(clean-icedtea-debug-stage2): Depend on
+	clean-split-debuginfo-debug.
+	(split-debuginfo-boot): Equivalent of split-debuginfo
+	for bootstrap builds.
+	(clean-split-debuginfo-boot): Remove split debuginfo
+	files for bootstrap build.
+	(icedtea-stage1): Depend on
+	stamps/split-debuginfo-boot.stamp
+	(clean-icedtea-stage1): Depend on
+	clean-split-debuginfo-boot.
+	(install-exec-local): Create debuginfo directories
+	and install stripped file and debug file instead of
+	original file if --enable-split-debuginfo is enabled
+	and the file is not a symbolic link or the java-rmi.cgi
+	script.
+	* NEWS: Updated.
+	* acinclude.m4:
+	(IT_ENABLE_SPLIT_DEBUGINFO): New macro to introduce
+	the --enable-split-debuginfo option. The option is
+	automatically disabled if native debuginfo is
+	disabled. Turning the option on introduces a
+	requirement for objcopy.
+	* configure.ac: Invoke IT_ENABLE_SPLIT_DEBUGINFO.
+
 2015-06-17  Andrew John Hughes  <gnu_andrew@member.fsf.org>
 
 	PR2535: install-data-local needs to check that
--- a/INSTALL	Tue Jul 14 22:35:05 2015 +0100
+++ b/INSTALL	Wed Jul 15 14:34:19 2015 +0100
@@ -37,6 +37,7 @@
 libffi (for --enable-zero or on archs other than x86/x86_64/sparc/ppc64)
 LLVM 2.5 or later (for --enable-shark)
 systemtap-sdl-devel >= 0.9.5 (Java method tracing requires systemtap >= 0.9.9)
+objcopy (for --enable-split-debuginfo)
 
 See ./configure --help if you need to override the defaults.
 
@@ -201,7 +202,11 @@
 * --enable-native-debuginfo: Include debuginfo in native binaries.
 * --enable-java-debuginfo: Include debuginfo in Java class files.
 * --enable-infinality: Use fontconfig for better font rendering
-* --enable-non-nss-curves: Define curves beyond the three specified by NSS (NIST P-{256,384,521})
+* --enable-non-nss-curves: Define curves beyond the three specified
+  by NSS (NIST P-{256,384,521})
+* --enable-split-debuginfo: Strip debuginfo from binaries and libraries
+  and install in .debug files under ${libdir}/debug instead.  objcopy
+  from binutils must be available to perform the stripping.
 
 Testing
 =======
--- a/Makefile.am	Tue Jul 14 22:35:05 2015 +0100
+++ b/Makefile.am	Wed Jul 15 14:34:19 2015 +0100
@@ -54,12 +54,15 @@
 SERVER_DIR = hotspot/import/jre/lib/$(INSTALL_ARCH_DIR)/server
 BUILD_SDK_DIR = $(BUILD_OUTPUT_DIR)/j2sdk-image
 BUILD_JRE_DIR = $(BUILD_OUTPUT_DIR)/j2re-image
+BUILD_DEBUGINFO_DIR = $(BUILD_OUTPUT_DIR)/j2sdk-image.stripped
 BUILD_JRE_ARCH_DIR = $(BUILD_SDK_DIR)/jre/lib/$(INSTALL_ARCH_DIR)
 BUILD_DEBUG_SDK_DIR = $(DEBUG_BUILD_OUTPUT_DIR)/j2sdk-image
 BUILD_DEBUG_JRE_DIR = $(DEBUG_BUILD_OUTPUT_DIR)/j2re-image
+BUILD_DEBUG_DEBUGINFO_DIR = $(DEBUG_BUILD_OUTPUT_DIR)/j2sdk-image.stripped
 BUILD_DEBUG_JRE_ARCH_DIR = $(BUILD_DEBUG_SDK_DIR)/jre/lib/$(INSTALL_ARCH_DIR)
 BUILD_BOOT_SDK_DIR = $(BOOT_BUILD_OUTPUT_DIR)/j2sdk-image
 BUILD_BOOT_JRE_DIR = $(BOOT_BUILD_OUTPUT_DIR)/j2re-image
+BUILD_BOOT_DEBUGINFO_DIR = $(BOOT_BUILD_OUTPUT_DIR)/j2sdk-image.stripped
 BUILD_BOOT_JRE_ARCH_DIR = $(BUILD_BOOT_SDK_DIR)/jre/lib/$(INSTALL_ARCH_DIR)
 REWRITER_BUILD_DIR = $(abs_top_builddir)/rewriter.build
 STAGE1_BOOT_DIR = $(abs_top_builddir)/bootstrap/boot
@@ -69,6 +72,10 @@
 STAGE1_BOOT_RUNTIME = $(STAGE1_BOOT_DIR)/jre/lib/rt.jar
 STAGE2_BOOT_RUNTIME = $(STAGE2_BOOT_DIR)/jre/lib/rt.jar
 
+# Installation directories
+
+DEBUG_PREFIX = $(libdir)/debug
+
 # Source directories
 
 SHARE = openjdk-boot/jdk/src/share/classes
@@ -849,7 +856,8 @@
 	clean-download-hotspot clean-download-corba clean-download-jaxp \
 	clean-download-jaxws clean-download-langtools clean-download-jdk clean-download-openjdk \
 	clean-extract-corba clean-extract-jaxp clean-extract-jaxws clean-extract-jdk \
-	clean-extract-langtools
+	clean-extract-langtools clean-split-debuginfo clean-split-debuginfo-debug \
+	clean-split-debuginfo-boot
 
 env:
 	@echo 'unset JAVA_HOME'
@@ -1977,6 +1985,26 @@
 	rm -vf $(BUILD_JRE_ARCH_DIR)/*/*.jsa
 	rm -f stamps/add-archive.stamp
 
+stamps/split-debuginfo.stamp: stamps/icedtea.stamp
+if SPLIT_DEBUGINFO
+	( cd $(BUILD_SDK_DIR) ; \
+	  for files in $$($(FIND) . -type f) ; do \
+	    if $(FILE) $${files} | $(GREP) 'ELF' > /dev/null ; then \
+	      mkdir -p $(BUILD_DEBUGINFO_DIR)/$$(dirname $${files}) ; \
+	      $(OBJCOPY) --only-keep-debug $${files} $(BUILD_DEBUGINFO_DIR)/$${files}.debug ; \
+	      $(OBJCOPY) --strip-debug $${files} $(BUILD_DEBUGINFO_DIR)/$${files}.stripped ; \
+	      $(OBJCOPY) --add-gnu-debuglink=$(BUILD_DEBUGINFO_DIR)/$${files}.debug \
+	        $(BUILD_DEBUGINFO_DIR)/$${files}.stripped ; \
+	    fi ; \
+	  done ; \
+	)
+endif
+	touch $@
+
+clean-split-debuginfo:
+	rm -rvf $(BUILD_DEBUGINFO_DIR)
+	rm -f stamps/split-debuginfo.stamp
+
 stamps/icedtea-debug.stamp: stamps/bootstrap-directory-symlink-stage2.stamp \
  stamps/download.stamp stamps/extract.stamp $(OPENJDK_TREE) \
  stamps/cacao.stamp stamps/rewrite-rhino.stamp stamps/jamvm.stamp
@@ -2083,24 +2111,45 @@
 	rm -vf $(BUILD_DEBUG_JRE_ARCH_DIR)/*/*.jsa
 	rm -f stamps/add-archive-debug.stamp
 
+stamps/split-debuginfo-debug.stamp: stamps/icedtea-debug.stamp
+if SPLIT_DEBUGINFO
+	( cd $(BUILD_DEBUG_SDK_DIR) ; \
+	  for files in $$($(FIND) . -type f) ; do \
+	    if $(FILE) $${files} | $(GREP) 'ELF' > /dev/null ; then \
+	      mkdir -p $(BUILD_DEBUG_DEBUGINFO_DIR)/$$(dirname $${files}) ; \
+	      $(OBJCOPY) --only-keep-debug $${files} $(BUILD_DEBUG_DEBUGINFO_DIR)/$${files}.debug ; \
+	      $(OBJCOPY) --strip-debug $${files} $(BUILD_DEBUG_DEBUGINFO_DIR)/$${files}.stripped ; \
+	      $(OBJCOPY) --add-gnu-debuglink=$(BUILD_DEBUG_DEBUGINFO_DIR)/$${files}.debug \
+	        $(BUILD_DEBUG_DEBUGINFO_DIR)/$${files}.stripped ; \
+	    fi ; \
+	  done ; \
+	)
+endif
+	touch $@
+
+clean-split-debuginfo-debug:
+	rm -rvf $(BUILD_DEBUG_DEBUGINFO_DIR)
+	rm -f stamps/split-debuginfo-debug.stamp
+
 stamps/icedtea-stage2.stamp: stamps/icedtea.stamp stamps/add-cacao.stamp \
  stamps/add-zero.stamp stamps/add-jamvm.stamp stamps/add-systemtap.stamp \
- stamps/add-tzdata-support.stamp stamps/check-crypto.stamp stamps/add-archive.stamp
+ stamps/add-tzdata-support.stamp stamps/check-crypto.stamp stamps/add-archive.stamp \
+ stamps/split-debuginfo.stamp
 	mkdir -p stamps
 	touch $@
 
-clean-icedtea-stage2: clean-add-jamvm clean-check-crypto clean-add-archive
+clean-icedtea-stage2: clean-add-jamvm clean-check-crypto clean-add-archive clean-split-debuginfo
 	rm -f stamps/icedtea-stage2.stamp
 
 stamps/icedtea-debug-stage2.stamp: stamps/icedtea-debug.stamp \
  stamps/add-cacao-debug.stamp stamps/add-zero-debug.stamp stamps/add-jamvm-debug.stamp \
  stamps/add-systemtap-debug.stamp stamps/add/tzdata-support-debug.stamp \
- stamps/check-crypto-debug.stamp stamps/add-archive-debug.stamp
+ stamps/check-crypto-debug.stamp stamps/add-archive-debug.stamp stamps/split-debuginfo-debug.stamp
 	mkdir -p stamps
 	touch $@
 
 clean-icedtea-debug-stage2: clean-add-jamvm-debug clean-check-crypto-debug \
- clean-add-archive-debug
+ clean-add-archive-debug clean-split-debuginfo-debug
 	rm -f stamps/icedtea-debug-stage2.stamp
 
 # OpenJDK boot Targets
@@ -2196,14 +2245,35 @@
 	rm -vf $(BUILD_BOOT_JRE_ARCH_DIR)/*/*.jsa
 	rm -f stamps/add-archive-boot.stamp
 
+stamps/split-debuginfo-boot.stamp: stamps/icedtea-boot.stamp
+if SPLIT_DEBUGINFO
+	( cd $(BUILD_BOOT_SDK_DIR) ; \
+	  for files in $$($(FIND) . -type f) ; do \
+	    if $(FILE) $${files} | $(GREP) 'ELF' > /dev/null ; then \
+	      mkdir -p $(BUILD_BOOT_DEBUGINFO_DIR)/$$(dirname $${files}) ; \
+	      $(OBJCOPY) --only-keep-debug $${files} $(BUILD_BOOT_DEBUGINFO_DIR)/$${files}.debug ; \
+	      $(OBJCOPY) --strip-debug $${files} $(BUILD_BOOT_DEBUGINFO_DIR)/$${files}.stripped ; \
+	      $(OBJCOPY) --add-gnu-debuglink=$(BUILD_BOOT_DEBUGINFO_DIR)/$${files}.debug \
+	        $(BUILD_BOOT_DEBUGINFO_DIR)/$${files}.stripped ; \
+	    fi ; \
+	  done ; \
+	)
+endif
+	touch $@
+
+clean-split-debuginfo-boot:
+	rm -rvf $(BUILD_BOOT_DEBUGINFO_DIR)
+	rm -f stamps/split-debuginfo-boot.stamp
+
 stamps/icedtea-stage1.stamp: stamps/icedtea-boot.stamp \
  stamps/add-systemtap-boot.stamp stamps/add-tzdata-support-boot.stamp \
- stamps/check-crypto-boot.stamp stamps/add-archive-boot.stamp
+ stamps/check-crypto-boot.stamp stamps/add-archive-boot.stamp \
+ stamps/split-debuginfo-boot.stamp
 	mkdir -p stamps
 	touch $@
 
 clean-icedtea-stage1: clean-add-systemtap-boot clean-add-tzdata-support-boot \
- clean-check-crypto-boot clean-add-archive-boot
+ clean-check-crypto-boot clean-add-archive-boot clean-split-debuginfo-boot
 	rm -f stamps/icedtea-stage1.stamp
 
 # Rebuild targets
@@ -2732,8 +2802,23 @@
 	${mkinstalldirs} $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/jli
 	${mkinstalldirs} $(DESTDIR)${prefix}/jre/lib/ext
 	${mkinstalldirs} $(DESTDIR)${prefix}/tapset
+if SPLIT_DEBUGINFO
+	${mkinstalldirs} $(DESTDIR)$(DEBUG_PREFIX)/$(bindir) $(DESTDIR)$(DEBUG_PREFIX)/${exec_prefix}/lib
+	${mkinstalldirs} $(DESTDIR)$(DEBUG_PREFIX)/${exec_prefix}/lib/$(INSTALL_ARCH_DIR)
+	${mkinstalldirs} $(DESTDIR)$(DEBUG_PREFIX)/${exec_prefix}/lib/$(INSTALL_ARCH_DIR)/jli
+	${mkinstalldirs} $(DESTDIR)$(DEBUG_PREFIX)/${prefix}/jre/bin $(DESTDIR)${prefix}/jre/lib
+	${mkinstalldirs} $(DESTDIR)$(DEBUG_PREFIX)/${prefix}/jre/lib/$(INSTALL_ARCH_DIR)
+	${mkinstalldirs} $(DESTDIR)$(DEBUG_PREFIX)/${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/jli
+endif
 	for files in $(BUILD_SDK_DIR)/bin/*; do \
-	  $(INSTALL_PROGRAM) $${files} $(DESTDIR)$(bindir); \
+	  name=$$(basename $${files}) ; \
+	  if test "x$(enable_split_debuginfo)" = "xyes" -a ! -h $${files} -a "x$${name}" != "xjava-rmi.cgi" ; then \
+	    dir=$$(echo $$(dirname $${files}) | $(SED) "s#$(BUILD_SDK_DIR)#$(BUILD_DEBUGINFO_DIR)#") ; \
+	    $(INSTALL_PROGRAM) $${dir}/$${name}.stripped $(DESTDIR)$(bindir)/$${name}; \
+	    $(INSTALL_PROGRAM) $${dir}/$${name}.debug $(DESTDIR)$(DEBUG_PREFIX)/$(bindir); \
+	  else \
+	    $(INSTALL_PROGRAM) $${files} $(DESTDIR)$(bindir); \
+	  fi ; \
 	done
 	for files in $(BUILD_SDK_DIR)/include/*.h; do \
 	  $(INSTALL_DATA) $${files} $(DESTDIR)$(includedir); \
@@ -2747,28 +2832,76 @@
 	for files in $(BUILD_SDK_DIR)/lib/*.idl; do \
 	  $(INSTALL_DATA) $${files} $(DESTDIR)${exec_prefix}/lib; \
 	done
-	$(INSTALL_PROGRAM) $(BUILD_SDK_DIR)/lib/jexec $(DESTDIR)${exec_prefix}/lib
+	if test "x$(enable_split_debuginfo)" = "xyes"; then \
+	  $(INSTALL_PROGRAM) $(BUILD_DEBUGINFO_DIR)/lib/jexec.stripped $(DESTDIR)${exec_prefix}/lib/jexec ; \
+	  $(INSTALL_PROGRAM) $(BUILD_DEBUGINFO_DIR)/lib/jexec.debug $(DESTDIR)$(DEBUG_PREFIX)/${exec_prefix}/lib ; \
+	else \
+	  $(INSTALL_PROGRAM) $(BUILD_SDK_DIR)/lib/jexec $(DESTDIR)${exec_prefix}/lib ; \
+	fi
 	for files in $(BUILD_SDK_DIR)/lib/$(INSTALL_ARCH_DIR)/jli/*.so; do \
-	  $(INSTALL_PROGRAM) $${files} $(DESTDIR)${exec_prefix}/lib/$(INSTALL_ARCH_DIR)/jli; \
+	  if test "x$(enable_split_debuginfo)" = "xyes" -a ! -h $${files}; then \
+	    name=$$(basename $${files}) ; \
+	    dir=$$(echo $$(dirname $${files}) | $(SED) "s#$(BUILD_SDK_DIR)#$(BUILD_DEBUGINFO_DIR)#") ; \
+	    $(INSTALL_PROGRAM) $${dir}/$${name}.stripped $(DESTDIR)${exec_prefix}/lib/$(INSTALL_ARCH_DIR)/jli/$${name}; \
+	    $(INSTALL_PROGRAM) $${dir}/$${name}.debug $(DESTDIR)$(DEBUG_PREFIX)/${exec_prefix}/lib/$(INSTALL_ARCH_DIR)/jli; \
+	  else \
+	    $(INSTALL_PROGRAM) $${files} $(DESTDIR)${exec_prefix}/lib/$(INSTALL_ARCH_DIR)/jli; \
+	  fi ; \
 	done
 	for files in $(BUILD_SDK_DIR)/jre/bin/*; do \
-	  $(INSTALL_PROGRAM) $${files} $(DESTDIR)${prefix}/jre/bin; \
+	  if test "x$(enable_split_debuginfo)" = "xyes" -a ! -h $${files}; then \
+	    name=$$(basename $${files}) ; \
+	    dir=$$(echo $$(dirname $${files}) | $(SED) "s#$(BUILD_SDK_DIR)#$(BUILD_DEBUGINFO_DIR)#") ; \
+	    $(INSTALL_PROGRAM) $${dir}/$${name}.stripped $(DESTDIR)${prefix}/jre/bin/$${name}; \
+	    $(INSTALL_PROGRAM) $${dir}/$${name}.debug $(DESTDIR)$(DEBUG_PREFIX)/${prefix}/jre/bin; \
+	  else \
+	    $(INSTALL_PROGRAM) $${files} $(DESTDIR)${prefix}/jre/bin; \
+	  fi ; \
 	done
 	for files in $(BUILD_SDK_DIR)/jre/lib/*.jar; do \
 	  $(INSTALL_DATA) $${files} $(DESTDIR)${prefix}/jre/lib; \
 	done
-	$(INSTALL_PROGRAM) $(BUILD_SDK_DIR)/lib/jexec $(DESTDIR)${prefix}/jre/lib
+	if test "x$(enable_split_debuginfo)" = "xyes"; then \
+	  $(INSTALL_PROGRAM) $(BUILD_DEBUGINFO_DIR)/jre/lib/jexec.stripped $(DESTDIR)${exec_prefix}/jre/lib/jexec ; \
+	  $(INSTALL_PROGRAM) $(BUILD_DEBUGINFO_DIR)/jre/lib/jexec.debug $(DESTDIR)$(DEBUG_PREFIX)/${exec_prefix}/jre/lib ; \
+	else \
+	  $(INSTALL_PROGRAM) $(BUILD_SDK_DIR)/jre/lib/jexec $(DESTDIR)${exec_prefix}/jre/lib ; \
+	fi
 	for files in $(BUILD_SDK_DIR)/jre/lib/$(INSTALL_ARCH_DIR)/*.so; do \
-	  $(INSTALL_PROGRAM) $${files} $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR); \
+	  if test "x$(enable_split_debuginfo)" = "xyes" -a ! -h $${files}; then \
+	    name=$$(basename $${files}) ; \
+	    dir=$$(echo $$(dirname $${files}) | $(SED) "s#$(BUILD_SDK_DIR)#$(BUILD_DEBUGINFO_DIR)#") ; \
+	    $(INSTALL_PROGRAM) $${dir}/$${name}.stripped $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/$${name}; \
+	    $(INSTALL_PROGRAM) $${dir}/$${name}.debug $(DESTDIR)$(DEBUG_PREFIX)/${prefix}/jre/lib/$(INSTALL_ARCH_DIR); \
+	  else \
+	    $(INSTALL_PROGRAM) $${files} $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR); \
+	  fi ; \
 	done
 	for files in $(BUILD_SDK_DIR)/jre/lib/$(INSTALL_ARCH_DIR)/jli/*.so; do \
-	  $(INSTALL_PROGRAM) $${files} $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/jli; \
+	  if test "x$(enable_split_debuginfo)" = "xyes" -a ! -h $${files} ; then \
+	    name=$$(basename $${files}) ; \
+	    dir=$$(echo $$(dirname $${files}) | $(SED) "s#$(BUILD_SDK_DIR)#$(BUILD_DEBUGINFO_DIR)#") ; \
+	    $(INSTALL_PROGRAM) $${dir}/$${name}.stripped $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/jli/$${name}; \
+	    $(INSTALL_PROGRAM) $${dir}/$${name}.debug $(DESTDIR)$(DEBUG_PREFIX)/${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/jli; \
+	  else \
+	    $(INSTALL_PROGRAM) $${files} $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/jli; \
+	  fi ; \
 	done
 	for vms in client server ; do \
 	  if [ -d $(BUILD_SDK_DIR)/jre/lib/$(INSTALL_ARCH_DIR)/$${vms} ] ; then \
 	    ${mkinstalldirs} $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/$${vms} ; \
+	    ${mkinstalldirs} $(DESTDIR)$(DEBUG_PREFIX)/${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/$${vms} ; \
 	    for files in $(BUILD_SDK_DIR)/jre/lib/$(INSTALL_ARCH_DIR)/$${vms}/*.so; do \
-	      $(INSTALL_PROGRAM) $${files} $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/$${vms}; \
+	      if test "x$(enable_split_debuginfo)" = "xyes" -a ! -h $${files} ; then \
+	        name=$$(basename $${files}) ; \
+	        dir=$$(echo $$(dirname $${files}) | $(SED) "s#$(BUILD_SDK_DIR)#$(BUILD_DEBUGINFO_DIR)#") ; \
+	        $(INSTALL_PROGRAM) $${dir}/$${name}.stripped \
+	          $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/$${vms}/$${name}; \
+	        $(INSTALL_PROGRAM) $${dir}/$${name}.debug \
+	          $(DESTDIR)$(DEBUG_PREFIX)/${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/$${vms}; \
+	      else \
+	        $(INSTALL_PROGRAM) $${files} $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/$${vms}; \
+	      fi ; \
 	    done ; \
 	  fi ; \
 	done
--- a/NEWS	Tue Jul 14 22:35:05 2015 +0100
+++ b/NEWS	Wed Jul 15 14:34:19 2015 +0100
@@ -301,6 +301,7 @@
   - S8081475, PR2494: SystemTap does not work when JDK is compiled with GCC 5
 * Bug fixes
   - PR94: empty install target in Makefile.am
+  - PR1374: Provide option to strip and link debugging info after build
   - PR1661: Cleanup SYSTEM_GCONF option and allow it to be set false
   - PR1786: Allow x86 build to occur on x86_64 using a previously built x86_64 build
   - PR1816: Split download/extraction rules for OpenJDK so they can run in parallel
--- a/acinclude.m4	Tue Jul 14 22:35:05 2015 +0100
+++ b/acinclude.m4	Wed Jul 15 14:34:19 2015 +0100
@@ -3037,3 +3037,35 @@
   AM_CONDITIONAL(USE_NON_NSS_CURVES, test x"${ENABLE_NON_NSS_CURVES}" = "xyes")
   AC_SUBST(ENABLE_NON_NSS_CURVES)
 ])
+
+AC_DEFUN([IT_ENABLE_SPLIT_DEBUGINFO],
+[
+  AC_REQUIRE([IT_ENABLE_NATIVE_DEBUGINFO])
+  AC_MSG_CHECKING([whether to split debuginfo into separate files])
+  AC_ARG_ENABLE([split-debuginfo],
+	      [AS_HELP_STRING(--enable-split-debuginfo,split debuginfo into separate files [[default=no]])],
+  [
+    case "${enableval}" in
+      no)
+	enable_split_debuginfo=no
+        ;;
+      *)
+        enable_split_debuginfo=yes
+        ;;
+    esac
+  ],
+  [
+        enable_split_debuginfo=no
+  ])
+  AC_MSG_RESULT([${enable_split_debuginfo}])
+  if test x"${enable_split_debuginfo}" = "xyes"; then
+    if test x"${enable_native_debuginfo}" = "xno"; then
+      AC_MSG_WARN([disabling split debuginfo as native debuginfo is not enabled])
+      enable_split_debuginfo=no
+    else
+      IT_FIND_TOOL([OBJCOPY], [objcopy])
+    fi
+  fi
+  AM_CONDITIONAL([SPLIT_DEBUGINFO], test x"${enable_split_debuginfo}" = "xyes")
+  AC_SUBST([enable_split_debuginfo])
+])
--- a/configure.ac	Tue Jul 14 22:35:05 2015 +0100
+++ b/configure.ac	Wed Jul 15 14:34:19 2015 +0100
@@ -182,6 +182,7 @@
 IT_CHECK_ADDITIONAL_VMS
 IT_ENABLE_ARM32JIT
 IT_ENABLE_NON_NSS_CURVES
+IT_ENABLE_SPLIT_DEBUGINFO
 
 IT_WITH_VERSION_SUFFIX
 IT_ENABLE_HG