Blob Blame History Raw
Remove unnecessary .gnu_debuglink sections from libjvm

The .gnu_debuglink section indicates which file contains the debuginfo. This
is not needed if we not stripping the shared object.

RPM's debuginfo extraction code will add the right file links automatically. As
it is, RPM copies over the .gnu_debuglink link to the debug info file. Without
this patch, the debug info file also ends up containing the .gnu_debuglink
section pointing to a missing (and not needed) file.

diff --git a/make/linux/makefiles/jsig.make b/make/linux/makefiles/jsig.make
--- openjdk/hotspot/make/linux/makefiles/jsig.make
+++ openjdk/hotspot/make/linux/makefiles/jsig.make
@@ -57,14 +57,15 @@
                          $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) $(EXTRA_CFLAGS) -o $@ $< -ldl
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO)
+  ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
-  ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
     ifeq ($(STRIP_POLICY),min_strip)
+	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
 	$(QUIETLY) $(STRIP) -g $@
+    endif
     # implied else here is no stripping at all
-    endif
   endif
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 	$(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO)
diff --git a/make/linux/makefiles/saproc.make b/make/linux/makefiles/saproc.make
--- openjdk/hotspot/make/linux/makefiles/saproc.make
+++ openjdk/hotspot/make/linux/makefiles/saproc.make
@@ -99,14 +99,15 @@
 	           -lthread_db
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
+  ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
-  ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
     ifeq ($(STRIP_POLICY),min_strip)
+	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
 	$(QUIETLY) $(STRIP) -g $@
+    endif
     # implied else here is no stripping at all
-    endif
   endif
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 	$(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
diff --git a/make/linux/makefiles/vm.make b/make/linux/makefiles/vm.make
--- openjdk/hotspot/make/linux/makefiles/vm.make
+++ openjdk/hotspot/make/linux/makefiles/vm.make
@@ -358,14 +358,15 @@
 
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
+	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
   else
     ifeq ($(STRIP_POLICY),min_strip)
 	$(QUIETLY) $(STRIP) -g $@
+	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
+    endif
     # implied else here is no stripping at all
-    endif
   endif
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 	$(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO)