Blame SOURCES/binutils-attach-to-group.patch

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