diff make/linux/makefiles/defs.make @ 3954:da0999c4b733

7071904: 4/4 HotSpot: Full Debug Symbols Summary: Add support for .debuginfo files for HSX libraries. Reviewed-by: poonam, dholmes, never
author dcubed
date Fri, 16 Sep 2011 16:21:20 -0700
parents 4aa5974a06dd
children 5d871c1ff17c
line wrap: on
line diff
--- a/make/linux/makefiles/defs.make	Thu Sep 15 20:56:24 2011 -0700
+++ b/make/linux/makefiles/defs.make	Fri Sep 16 16:21:20 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2011, 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
@@ -114,6 +114,67 @@
   HS_ARCH          = ppc
 endif
 
+# determine if HotSpot is being built in JDK6 or earlier version
+JDK6_OR_EARLIER=0
+ifeq "$(shell expr \( '$(JDK_MAJOR_VERSION)' != '' \& '$(JDK_MINOR_VERSION)' != '' \& '$(JDK_MICRO_VERSION)' != '' \))" "1"
+  # if the longer variable names (newer build style) are set, then check those
+  ifeq "$(shell expr \( $(JDK_MAJOR_VERSION) = 1 \& $(JDK_MINOR_VERSION) \< 7 \))" "1"
+    JDK6_OR_EARLIER=1
+  endif
+else
+  # the longer variables aren't set so check the shorter variable names
+  ifeq "$(shell expr \( '$(JDK_MAJOR_VER)' = 1 \& '$(JDK_MINOR_VER)' \< 7 \))" "1"
+    JDK6_OR_EARLIER=1
+  endif
+endif
+
+ifeq ($(JDK6_OR_EARLIER),0)
+  # Full Debug Symbols is supported on JDK7 or newer
+
+  # Default OBJCOPY comes from GNU Binutils on Linux:
+  DEF_OBJCOPY=/usr/bin/objcopy
+  ifdef CROSS_COMPILE_ARCH
+    # don't try to generate .debuginfo files when cross compiling
+    _JUNK_ := $(shell \
+      echo >&2 "INFO: cross compiling for ARCH $(CROSS_COMPILE_ARCH)," \
+        "skipping .debuginfo generation.")
+    OBJCOPY=
+  else
+    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
+  endif
+  
+  ifeq ($(OBJCOPY),)
+    _JUNK_ := $(shell \
+      echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.")
+  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.
+    #
+    DEF_STRIP_POLICY="min_strip"
+    ifeq ($(ALT_STRIP_POLICY),)
+      STRIP_POLICY=$(DEF_STRIP_POLICY)
+    else
+      STRIP_POLICY=$(ALT_STRIP_POLICY)
+    endif
+  
+    _JUNK_ := $(shell \
+      echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
+  endif
+endif
+
 JDK_INCLUDE_SUBDIR=linux
 
 # FIXUP: The subdirectory for a debug build is NOT the same on all platforms
@@ -123,18 +184,28 @@
 
 # client and server subdirectories have symbolic links to ../libjsig.so
 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.so
+ifneq ($(OBJCOPY),)
+  EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo
+endif
+
 EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
 EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
 
 ifndef BUILD_CLIENT_ONLY
 EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so
+  ifneq ($(OBJCOPY),)
+    EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo
+  endif
 endif
 
 ifneq ($(ZERO_BUILD), true)
   ifeq ($(ARCH_DATA_MODEL), 32)
     EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
     EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so 
+    ifneq ($(OBJCOPY),)
+      EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo
+    endif
   endif
 endif
 
@@ -144,6 +215,10 @@
                         $(EXPORT_LIB_DIR)/sa-jdi.jar 
 ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
                         $(EXPORT_LIB_DIR)/sa-jdi.jar 
+ifneq ($(OBJCOPY),)
+  ADD_SA_BINARIES/x86   += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
+  ADD_SA_BINARIES/sparc += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
+endif
 ADD_SA_BINARIES/ppc   = 
 ADD_SA_BINARIES/ia64  = 
 ADD_SA_BINARIES/arm   =