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

391f42
diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c
391f42
--- binutils.orig/gas/config/obj-elf.c	2018-09-24 17:50:06.974172867 +0100
391f42
+++ binutils-2.30/gas/config/obj-elf.c	2018-09-25 15:19:33.559830794 +0100
391f42
@@ -82,9 +82,11 @@ static void obj_elf_gnu_attribute (int);
391f42
 static void obj_elf_tls_common (int);
391f42
 static void obj_elf_lcomm (int);
391f42
 static void obj_elf_struct (int);
391f42
+static void obj_elf_attach_to_group (int);
391f42
 
391f42
 static const pseudo_typeS elf_pseudo_table[] =
391f42
 {
391f42
+  {"attach_to_group", obj_elf_attach_to_group, 0},
391f42
   {"comm", obj_elf_common, 0},
391f42
   {"common", obj_elf_common, 1},
391f42
   {"ident", obj_elf_ident, 0},
391f42
@@ -1007,6 +1009,27 @@ obj_elf_section_name (void)
391f42
   return name;
391f42
 }
391f42
 
391f42
+static void
391f42
+obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED)
391f42
+{
391f42
+  const char * gname = obj_elf_section_name ();
391f42
+
391f42
+  if (gname == NULL)
391f42
+    {
391f42
+      as_warn ("group name not parseable");
391f42
+      return;
391f42
+    }
391f42
+
391f42
+  if (elf_group_name (now_seg))
391f42
+    {
391f42
+      as_warn ("already has a group");
391f42
+      return;
391f42
+    }
391f42
+
391f42
+  elf_group_name (now_seg) = xstrdup (gname);
391f42
+  elf_section_flags (now_seg) |= SHF_GROUP;
391f42
+}
391f42
+
391f42
 void
391f42
 obj_elf_section (int push)
391f42
 {
391f42
--- binutils.orig/gas/doc/as.texi	2020-07-24 15:12:46.452951381 +0100
391f42
+++ binutils-2.35/gas/doc/as.texi	2020-07-24 15:15:41.742825163 +0100
391f42
@@ -4373,6 +4373,7 @@ Some machine configurations provide addi
391f42
 * Altmacro::                    @code{.altmacro}
391f42
 * Ascii::                       @code{.ascii "@var{string}"}@dots{}
391f42
 * Asciz::                       @code{.asciz "@var{string}"}@dots{}
391f42
+* Attach_to_group::             @code{.attach_to_group @var{name}}
391f42
 * Balign::                      @code{.balign [@var{abs-expr}[, @var{abs-expr}]]}
391f42
 * Bundle directives::           @code{.bundle_align_mode @var{abs-expr}}, etc
391f42
 * Byte::                        @code{.byte @var{expressions}}
391f42
@@ -4670,6 +4671,12 @@ trailing zero byte) into consecutive add
391f42
 @code{.asciz} is just like @code{.ascii}, but each string is followed by
391f42
 a zero byte.  The ``z'' in @samp{.asciz} stands for ``zero''.
391f42
 
391f42
+@node Attach_to_group
391f42
+@section @code{.attach_to_group @var{name}}
391f42
+Attaches the current section to the named group.  This is like declaring
391f42
+the section with the @code{G} attribute, but can be done after the section
391f42
+has been created.
391f42
+
391f42
 @node Balign
391f42
 @section @code{.balign[wl] [@var{abs-expr}[, @var{abs-expr}[, @var{abs-expr}]]]}
391f42