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