aboutsummaryrefslogtreecommitdiff
path: root/gas/config/obj-elf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-10-01 16:34:05 +0100
committerNick Clifton <nickc@redhat.com>2020-10-01 16:34:05 +0100
commit642f545a93326f570ef4718e9a26c29285943f27 (patch)
treefef880554b171346c1ddb02e7d3be2788c06de97 /gas/config/obj-elf.c
parent1f22ee1f72385731cc6511de3b6f1b51c163ecb9 (diff)
downloadfsf-binutils-gdb-642f545a93326f570ef4718e9a26c29285943f27.zip
fsf-binutils-gdb-642f545a93326f570ef4718e9a26c29285943f27.tar.gz
fsf-binutils-gdb-642f545a93326f570ef4718e9a26c29285943f27.tar.bz2
Add new directive to GAS: .attach_to_group.
* config/obj-elf (elf_pseudo_table): Add attach_to_group. (obj_elf_attach_to_group): New function. * doc/as.texi: Document the new directive. * NEWS: Mention the new feature. * testsuite/gas/elf/attach-1.s: New test. * testsuite/gas/elf/attach-1.d: New test driver. * testsuite/gas/elf/attach-2.s: New test. * testsuite/gas/elf/attach-2.d: New test driver. * testsuite/gas/elf/attach-err.s: New test. * testsuite/gas/elf/attach-err.d: New test driver. * testsuite/gas/elf/attach-err.err: New test error output. * testsuite/gas/elf/elf.exp: Run the new tests.
Diffstat (limited to 'gas/config/obj-elf.c')
-rw-r--r--gas/config/obj-elf.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index cd457ab..45de821 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -78,9 +78,11 @@ static void obj_elf_gnu_attribute (int);
static void obj_elf_tls_common (int);
static void obj_elf_lcomm (int);
static void obj_elf_struct (int);
+static void obj_elf_attach_to_group (int);
static const pseudo_typeS elf_pseudo_table[] =
{
+ {"attach_to_group", obj_elf_attach_to_group, 0},
{"comm", obj_elf_common, 0},
{"common", obj_elf_common, 1},
{"ident", obj_elf_ident, 0},
@@ -1040,6 +1042,28 @@ obj_elf_section_name (void)
return name;
}
+static void
+obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED)
+{
+ const char * gname = obj_elf_section_name ();
+
+ if (gname == NULL)
+ {
+ as_warn (_("group name not parseable"));
+ return;
+ }
+
+ if (elf_group_name (now_seg))
+ {
+ as_warn (_("section %s already has a group (%s)"),
+ bfd_section_name (now_seg), elf_group_name (now_seg));
+ return;
+ }
+
+ elf_group_name (now_seg) = xstrdup (gname);
+ elf_section_flags (now_seg) |= SHF_GROUP;
+}
+
void
obj_elf_section (int push)
{