43c6b8
diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.27/gas/config/obj-elf.c
43c6b8
--- binutils.orig/gas/config/obj-elf.c	2019-01-08 13:52:32.758716536 +0000
43c6b8
+++ binutils-2.27/gas/config/obj-elf.c	2019-01-08 15:05:34.705763638 +0000
43c6b8
@@ -78,9 +78,11 @@ static void obj_elf_gnu_attribute (int);
43c6b8
 static void obj_elf_tls_common (int);
43c6b8
 static void obj_elf_lcomm (int);
43c6b8
 static void obj_elf_struct (int);
43c6b8
+static void obj_elf_attach_to_group (int);
43c6b8
 
43c6b8
 static const pseudo_typeS elf_pseudo_table[] =
43c6b8
 {
43c6b8
+  {"attach_to_group", obj_elf_attach_to_group, 0},
43c6b8
   {"comm", obj_elf_common, 0},
43c6b8
   {"common", obj_elf_common, 1},
43c6b8
   {"ident", obj_elf_ident, 0},
43c6b8
@@ -980,6 +982,27 @@ obj_elf_section_name (void)
43c6b8
   return name;
43c6b8
 }
43c6b8
 
43c6b8
+static void
43c6b8
+obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED)
43c6b8
+{
43c6b8
+  const char * gname = obj_elf_section_name ();
43c6b8
+
43c6b8
+  if (gname == NULL)
43c6b8
+    {
43c6b8
+      as_warn ("group name not parseable");
43c6b8
+      return;
43c6b8
+    }
43c6b8
+
43c6b8
+  if (elf_group_name (now_seg))
43c6b8
+    {
43c6b8
+      as_warn ("already has a group");
43c6b8
+      return;
43c6b8
+    }
43c6b8
+
43c6b8
+  elf_group_name (now_seg) = xstrdup (gname);
43c6b8
+  elf_section_flags (now_seg) |= SHF_GROUP;
43c6b8
+}
43c6b8
+
43c6b8
 void
43c6b8
 obj_elf_section (int push)
43c6b8
 {
43c6b8
diff -rup binutils.orig/gas/doc/as.texinfo binutils-2.27/gas/doc/as.texinfo
43c6b8
--- binutils.orig/gas/doc/as.texinfo	2019-01-08 13:52:32.766716472 +0000
43c6b8
+++ binutils-2.27/gas/doc/as.texinfo	2019-01-08 15:05:34.707763621 +0000
43c6b8
@@ -4312,6 +4312,7 @@ Some machine configurations provide addi
43c6b8
 * Altmacro::                    @code{.altmacro}
43c6b8
 * Ascii::                       @code{.ascii "@var{string}"}@dots{}
43c6b8
 * Asciz::                       @code{.asciz "@var{string}"}@dots{}
43c6b8
+* Attach_to_group::             @code{.attach_to_group @var{name}}
43c6b8
 * Balign::                      @code{.balign @var{abs-expr} , @var{abs-expr}}
43c6b8
 * Bundle directives::           @code{.bundle_align_mode @var{abs-expr}}, etc
43c6b8
 * Byte::                        @code{.byte @var{expressions}}
43c6b8
@@ -4603,6 +4604,12 @@ trailing zero byte) into consecutive add
43c6b8
 @code{.asciz} is just like @code{.ascii}, but each string is followed by
43c6b8
 a zero byte.  The ``z'' in @samp{.asciz} stands for ``zero''.
43c6b8
 
43c6b8
+@node Attach_to_group
43c6b8
+@section @code{.attach_to_group @var{name}}
43c6b8
+Attaches the current section to the named group.  This is like declaring
43c6b8
+the section with the @code{G} attribute, but can be done after the section
43c6b8
+has been created.
43c6b8
+
43c6b8
 @node Balign
43c6b8
 @section @code{.balign[wl] @var{abs-expr}, @var{abs-expr}, @var{abs-expr}}
43c6b8