aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-08-30 08:01:36 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-08-30 08:03:34 -0700
commit385e5b9039d12d3c2ab25023e827ee9a681c1aad (patch)
treed2ef56f5fae62535cf9ffaa5642bb44bdb56c9f6 /gas
parentfdad7678b74a170ead1ef967007be087435715f7 (diff)
downloadgdb-385e5b9039d12d3c2ab25023e827ee9a681c1aad.zip
gdb-385e5b9039d12d3c2ab25023e827ee9a681c1aad.tar.gz
gdb-385e5b9039d12d3c2ab25023e827ee9a681c1aad.tar.bz2
Treat SHT_FINI_ARRAY and SHT_PREINIT_ARRAY as relocatable sections
Since SHT_FINI_ARRAY and SHT_PREINIT_ARRAY sections are relocatable, this patch fixes readelf and adds a testcase. binutils/ * readelf.c (process_section_headers): Treat SHT_FINI_ARRAY and SHT_PREINIT_ARRAY as relocatable sections. gas/ * testsuite/gas/elf/elf.exp: Run section14. * testsuite/gas/elf/section14.d: New file. * testsuite/gas/elf/section14.s: Likewise.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/testsuite/gas/elf/elf.exp1
-rw-r--r--gas/testsuite/gas/elf/section14.d10
-rw-r--r--gas/testsuite/gas/elf/section14.s18
4 files changed, 35 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 37b3560..aa8633a 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2018-08-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/gas/elf/elf.exp: Run section14.
+ * testsuite/gas/elf/section14.d: New file.
+ * testsuite/gas/elf/section14.s: Likewise.
+
2018-08-29 Daniel Cederman <cederman@gaisler.com>
* testsuite/gas/sparc/leon.d: New test.
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index a7c793b..ee4aa57 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -219,6 +219,7 @@ if { [is_elf_format] } then {
run_dump_test "section12a"
run_dump_test "section12b"
run_dump_test "section13"
+ run_dump_test "section14"
run_dump_test "dwarf2-1"
run_dump_test "dwarf2-2"
run_dump_test "dwarf2-3"
diff --git a/gas/testsuite/gas/elf/section14.d b/gas/testsuite/gas/elf/section14.d
new file mode 100644
index 0000000..82b8a77
--- /dev/null
+++ b/gas/testsuite/gas/elf/section14.d
@@ -0,0 +1,10 @@
+#name: array sections
+#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 +ES +Flg +Lk +Inf +Al
+ +\[ 0\] +NULL +0+ +0+ +0+ +0+ +0 +0 +0
+#pass
diff --git a/gas/testsuite/gas/elf/section14.s b/gas/testsuite/gas/elf/section14.s
new file mode 100644
index 0000000..992bbe6
--- /dev/null
+++ b/gas/testsuite/gas/elf/section14.s
@@ -0,0 +1,18 @@
+ .section .init_array
+ .align 4
+ .type init_array, %object
+ .size init_array, 4
+init_array:
+ .dc.a foo
+ .section .preinit_array
+ .align 4
+ .type preinit_array, %object
+ .size preinit_array, 4
+preinit_array:
+ .dc.a foo
+ .section .fini_array
+ .align 4
+ .type fini_array, %object
+ .size fini_array, 4
+fini_array:
+ .dc.a foo