13ae24
--- binutils.orig/bfd/elflink.c	2018-03-14 10:14:49.729271271 +0000
13ae24
+++ binutils-2.30/bfd/elflink.c	2018-03-14 10:15:15.748967793 +0000
13ae24
@@ -12785,7 +12785,7 @@ _bfd_elf_gc_mark_hook (asection *sec,
13ae24
   return NULL;
13ae24
 }
13ae24
 
13ae24
-/* Return the global debug definition section.  */
13ae24
+/* Return the debug definition section.  */
13ae24
 
13ae24
 static asection *
13ae24
 elf_gc_mark_debug_section (asection *sec ATTRIBUTE_UNUSED,
13ae24
@@ -12794,11 +12794,22 @@ elf_gc_mark_debug_section (asection *sec
13ae24
 			   struct elf_link_hash_entry *h,
13ae24
 			   Elf_Internal_Sym *sym ATTRIBUTE_UNUSED)
13ae24
 {
13ae24
-  if (h != NULL
13ae24
-      && (h->root.type == bfd_link_hash_defined
13ae24
-	  || h->root.type == bfd_link_hash_defweak)
13ae24
-      && (h->root.u.def.section->flags & SEC_DEBUGGING) != 0)
13ae24
-    return h->root.u.def.section;
13ae24
+  if (h != NULL)
13ae24
+    {
13ae24
+      /* Return the global debug definition section.  */
13ae24
+      if ((h->root.type == bfd_link_hash_defined
13ae24
+	   || h->root.type == bfd_link_hash_defweak)
13ae24
+	  && (h->root.u.def.section->flags & SEC_DEBUGGING) != 0)
13ae24
+	return h->root.u.def.section;
13ae24
+    }
13ae24
+  else
13ae24
+    {
13ae24
+      /* Return the local debug definition section.  */
13ae24
+      asection *isec = bfd_section_from_elf_index (sec->owner,
13ae24
+						   sym->st_shndx);
13ae24
+      if ((isec->flags & SEC_DEBUGGING) != 0)
13ae24
+	return isec;
13ae24
+    }
13ae24
 
13ae24
   return NULL;
13ae24
 }