aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
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/testsuite
parent1f22ee1f72385731cc6511de3b6f1b51c163ecb9 (diff)
downloadgdb-642f545a93326f570ef4718e9a26c29285943f27.zip
gdb-642f545a93326f570ef4718e9a26c29285943f27.tar.gz
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/testsuite')
-rw-r--r--gas/testsuite/gas/elf/attach-1.d11
-rw-r--r--gas/testsuite/gas/elf/attach-1.s11
-rw-r--r--gas/testsuite/gas/elf/attach-2.d11
-rw-r--r--gas/testsuite/gas/elf/attach-2.s9
-rw-r--r--gas/testsuite/gas/elf/attach-err.d3
-rw-r--r--gas/testsuite/gas/elf/attach-err.err4
-rw-r--r--gas/testsuite/gas/elf/attach-err.s5
-rw-r--r--gas/testsuite/gas/elf/elf.exp4
8 files changed, 58 insertions, 0 deletions
diff --git a/gas/testsuite/gas/elf/attach-1.d b/gas/testsuite/gas/elf/attach-1.d
new file mode 100644
index 0000000..053783e
--- /dev/null
+++ b/gas/testsuite/gas/elf/attach-1.d
@@ -0,0 +1,11 @@
+#readelf: --section-groups
+#name: Attaching a section to a group
+#source: attach-1.s
+
+#...
+group section \[ 1\] `\.group' \[foo\.group\] contains . sections:
+ \[Index\] Name
+ \[ .\] .*
+ \[ .\] foo
+#pass
+
diff --git a/gas/testsuite/gas/elf/attach-1.s b/gas/testsuite/gas/elf/attach-1.s
new file mode 100644
index 0000000..aa69fff
--- /dev/null
+++ b/gas/testsuite/gas/elf/attach-1.s
@@ -0,0 +1,11 @@
+ .text
+ .nop
+
+ .section foo, "G", %progbits , foo.group
+ .word 0
+
+ .text
+ /* This is the intended use of the .attach_to_group directive.
+ It attaches a previously defined section (.text) to a
+ previously defined group (foo.group). */
+ .attach_to_group foo.group
diff --git a/gas/testsuite/gas/elf/attach-2.d b/gas/testsuite/gas/elf/attach-2.d
new file mode 100644
index 0000000..4aa5211
--- /dev/null
+++ b/gas/testsuite/gas/elf/attach-2.d
@@ -0,0 +1,11 @@
+#readelf: --section-groups
+#name: Attaching a section to a non-existant group
+#source: attach-2.s
+
+#...
+group section \[ 1\] `\.group' \[foo\.group\] contains 2 sections:
+ \[Index\] Name
+ \[ .\] bar
+ \[ .\] foo
+#pass
+
diff --git a/gas/testsuite/gas/elf/attach-2.s b/gas/testsuite/gas/elf/attach-2.s
new file mode 100644
index 0000000..4a5663f
--- /dev/null
+++ b/gas/testsuite/gas/elf/attach-2.s
@@ -0,0 +1,9 @@
+ .section bar
+ .nop
+ .attach_to_group foo.group
+
+ .section foo, "G", %note , foo.group
+ .word 0
+
+ .section bar
+ .nop
diff --git a/gas/testsuite/gas/elf/attach-err.d b/gas/testsuite/gas/elf/attach-err.d
new file mode 100644
index 0000000..3028d72
--- /dev/null
+++ b/gas/testsuite/gas/elf/attach-err.d
@@ -0,0 +1,3 @@
+#name: Errors generated by .attach_to_group
+#source: attach-err.s
+#error_output: attach-err.err
diff --git a/gas/testsuite/gas/elf/attach-err.err b/gas/testsuite/gas/elf/attach-err.err
new file mode 100644
index 0000000..7385467
--- /dev/null
+++ b/gas/testsuite/gas/elf/attach-err.err
@@ -0,0 +1,4 @@
+.*: Assembler messages:
+.*:4: Warning: section .* already has a group \(does\.not\.exist\)
+.*:5: Error: missing name
+.*:5: Warning: group name not parseable
diff --git a/gas/testsuite/gas/elf/attach-err.s b/gas/testsuite/gas/elf/attach-err.s
new file mode 100644
index 0000000..40597e9
--- /dev/null
+++ b/gas/testsuite/gas/elf/attach-err.s
@@ -0,0 +1,5 @@
+
+ /* Test the error messages that should be generated. */
+ .attach_to_group does.not.exist /* This is OK, the group does not have to exist. */
+ .attach_to_group foo.group /* Already attached. */
+ .attach_to_group /* Missing group name. */
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 135ade2..5ce9691 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -139,6 +139,10 @@ if { [is_elf_format] } then {
run_dump_test "group1b"
run_dump_test "group2"
run_dump_test "group3"
+
+ run_dump_test "attach-1"
+ run_dump_test "attach-err"
+
switch -glob $target_triplet {
hppa64*-*-hpux* { }
riscv*-*-* { }