* section.c (bfd_get_linker_section): New function.
[deliverable/binutils-gdb.git] / bfd / section.c
index 0a7908e1f6ceddb38b4dc898b3f485075a75c3e9..a3b7c56db562e19981c9dbe9e169239b43d42fce 100644 (file)
@@ -896,6 +896,28 @@ bfd_get_next_section_by_name (asection *sec)
   return NULL;
 }
 
+/*
+FUNCTION
+       bfd_get_linker_section
+
+SYNOPSIS
+       asection *bfd_get_linker_section (bfd *abfd, const char *name);
+
+DESCRIPTION
+       Return the linker created section attached to @var{abfd}
+       named @var{name}.  Return NULL if no such section exists.
+*/
+
+asection *
+bfd_get_linker_section (bfd *abfd, const char *name)
+{
+  asection *sec = bfd_get_section_by_name (abfd, name);
+
+  while (sec != NULL && (sec->flags & SEC_LINKER_CREATED) == 0)
+    sec = bfd_get_next_section_by_name (sec);
+  return sec;
+}
+
 /*
 FUNCTION
        bfd_get_section_by_name_if
This page took 0.025303 seconds and 4 git commands to generate.