aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2024-01-05 08:17:34 +0100
committerJan Beulich <jbeulich@suse.com>2024-01-05 08:17:34 +0100
commit1de6e1fdf10e9e1ab387da04c3bbc6e83e5c5226 (patch)
treed1c591288135f5c32da9b130ab48920cf208273f
parente2c9acb943f9af1ceb6690264e5a4f3f531c48b6 (diff)
downloadbinutils-1de6e1fdf10e9e1ab387da04c3bbc6e83e5c5226.zip
binutils-1de6e1fdf10e9e1ab387da04c3bbc6e83e5c5226.tar.gz
binutils-1de6e1fdf10e9e1ab387da04c3bbc6e83e5c5226.tar.bz2
ELF: test certain .text/.data usages
Various targets have / had overrides for .text and/or .data. Make sure that in such cases sub-section specifiers are accepted, as mandated by the doc.
-rw-r--r--gas/testsuite/gas/elf/data-prev.d14
-rw-r--r--gas/testsuite/gas/elf/data-prev.s6
-rw-r--r--gas/testsuite/gas/elf/data-subsect.d11
-rw-r--r--gas/testsuite/gas/elf/data-subsect.s14
-rw-r--r--gas/testsuite/gas/elf/elf.exp4
-rw-r--r--gas/testsuite/gas/elf/text-prev.d14
-rw-r--r--gas/testsuite/gas/elf/text-prev.s6
-rw-r--r--gas/testsuite/gas/elf/text-subsect.d11
-rw-r--r--gas/testsuite/gas/elf/text-subsect.s10
9 files changed, 90 insertions, 0 deletions
diff --git a/gas/testsuite/gas/elf/data-prev.d b/gas/testsuite/gas/elf/data-prev.d
new file mode 100644
index 0000000..8464f1f
--- /dev/null
+++ b/gas/testsuite/gas/elf/data-prev.d
@@ -0,0 +1,14 @@
+#name: .data / .previous interaction
+#as: --no-pad-sections
+#readelf: -S --wide
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr(ess|) +Off +Size .*
+#...
+ *\[ [1-9]\] *\.text +PROGBITS +0*0 +0[0-9a-f]* 0* .*
+ *\[ [1-9]\] *\.data +PROGBITS +0*0 +0[0-9a-f]* 0*1 .*
+#...
+ *\[ [1-9]\] *\.aux +PROGBITS +0*0 +0[0-9a-f]* 0*1 .*
+#pass
diff --git a/gas/testsuite/gas/elf/data-prev.s b/gas/testsuite/gas/elf/data-prev.s
new file mode 100644
index 0000000..291805c
--- /dev/null
+++ b/gas/testsuite/gas/elf/data-prev.s
@@ -0,0 +1,6 @@
+ .text
+ .section .aux, "a", %progbits
+ .data
+ .byte 0
+ .previous
+ .byte 1
diff --git a/gas/testsuite/gas/elf/data-subsect.d b/gas/testsuite/gas/elf/data-subsect.d
new file mode 100644
index 0000000..bfbdd36
--- /dev/null
+++ b/gas/testsuite/gas/elf/data-subsect.d
@@ -0,0 +1,11 @@
+#name: .data <subsection>
+#as: --no-pad-sections
+#readelf: -S --wide
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr(ess|) +Off +Size .*
+#...
+ *\[ [1-9]\] *\.data +PROGBITS +0*0 +0[0-9a-f]* 0*a .*
+#pass
diff --git a/gas/testsuite/gas/elf/data-subsect.s b/gas/testsuite/gas/elf/data-subsect.s
new file mode 100644
index 0000000..5436c46
--- /dev/null
+++ b/gas/testsuite/gas/elf/data-subsect.s
@@ -0,0 +1,14 @@
+ .data
+ .byte 1
+
+ .data 2
+ .balign 2
+ .byte 3
+ .byte 3
+
+ .data 1
+ .balign 4
+ .byte 2
+ .byte 2
+ .byte 2
+ .byte 2
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 88ef09c..e03dc2b 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -194,6 +194,10 @@ if { [is_elf_format] } then {
}
}
run_dump_test "pseudo"
+ run_dump_test "text-prev" $dump_opts
+ run_dump_test "text-subsect" $dump_opts
+ run_dump_test "data-prev" $dump_opts
+ run_dump_test "data-subsect" $dump_opts
run_dump_test "section0"
run_dump_test "section1"
# The h8300 port issues a warning message for
diff --git a/gas/testsuite/gas/elf/text-prev.d b/gas/testsuite/gas/elf/text-prev.d
new file mode 100644
index 0000000..e8a14ee
--- /dev/null
+++ b/gas/testsuite/gas/elf/text-prev.d
@@ -0,0 +1,14 @@
+#name: .text / .previous interaction
+#as: --no-pad-sections
+#readelf: -S --wide
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr(ess|) +Off +Size .*
+#...
+ *\[ [1-9]\] *\.text +PROGBITS +0*0 +0[0-9a-f]* 0*([1248]|10) .*
+ *\[ [1-9]\] *\.data +PROGBITS +0*0 +0[0-9a-f]* 0* .*
+#...
+ *\[ [1-9]\] *\.aux +PROGBITS +0*0 +0[0-9a-f]* 0*1 .*
+#pass
diff --git a/gas/testsuite/gas/elf/text-prev.s b/gas/testsuite/gas/elf/text-prev.s
new file mode 100644
index 0000000..673d5d2
--- /dev/null
+++ b/gas/testsuite/gas/elf/text-prev.s
@@ -0,0 +1,6 @@
+ .data
+ .section .aux, "a", %progbits
+ .text
+ .nop
+ .previous
+ .byte 0
diff --git a/gas/testsuite/gas/elf/text-subsect.d b/gas/testsuite/gas/elf/text-subsect.d
new file mode 100644
index 0000000..7968bc7
--- /dev/null
+++ b/gas/testsuite/gas/elf/text-subsect.d
@@ -0,0 +1,11 @@
+#name: .text <subsection>
+#as: --no-pad-sections
+#readelf: -S --wide
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr(ess|) +Off +Size .*
+#...
+ *\[ [1-9]\] *\.text +PROGBITS +0*0 +0[0-9a-f]* 0*(6[1248]|70) .*
+#pass
diff --git a/gas/testsuite/gas/elf/text-subsect.s b/gas/testsuite/gas/elf/text-subsect.s
new file mode 100644
index 0000000..1f50c58
--- /dev/null
+++ b/gas/testsuite/gas/elf/text-subsect.s
@@ -0,0 +1,10 @@
+ .text
+ .nop
+
+ .text 2
+ .balign 32
+ .nop
+
+ .text 1
+ .balign 64
+ .nop