[v4,4/7] ld: Add simple tests for -z nosectionheader

Message ID 20230606175846.399377-5-hjl.tools@gmail.com
State Unresolved
Headers
Series ELF: Strip section header in ELF objects |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

H.J. Lu June 6, 2023, 5:58 p.m. UTC
  From: Kaylee Blake <klkblake@gmail.com>

2020-06-06  Kaylee Blake  <klkblake@gmail.com>
	    H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/25617
	* testsuite/ld-elf/nosectionheader-1.d: New file.
	* testsuite/ld-elf/nosectionheader-2.d: Likewise.
---
 ld/testsuite/ld-elf/nosectionheader-1.d | 14 ++++++++++++++
 ld/testsuite/ld-elf/nosectionheader-2.d |  4 ++++
 2 files changed, 18 insertions(+)
 create mode 100644 ld/testsuite/ld-elf/nosectionheader-1.d
 create mode 100644 ld/testsuite/ld-elf/nosectionheader-2.d
  

Patch

diff --git a/ld/testsuite/ld-elf/nosectionheader-1.d b/ld/testsuite/ld-elf/nosectionheader-1.d
new file mode 100644
index 00000000000..cbaea669b9a
--- /dev/null
+++ b/ld/testsuite/ld-elf/nosectionheader-1.d
@@ -0,0 +1,14 @@ 
+#source: start.s
+#ld: -z nosectionheader
+#readelf: -h -S
+#xfail: [uses_genelf]
+# These targets don't support -z.
+
+#...
+  Start of section headers:[ \t]+0 \(bytes into file\)
+#...
+  Size of section headers:[ \t]+0 \(bytes\)
+  Number of section headers:[ \t]+0
+  Section header string table index:[ \t]+0
+
+There are no sections in this file.
diff --git a/ld/testsuite/ld-elf/nosectionheader-2.d b/ld/testsuite/ld-elf/nosectionheader-2.d
new file mode 100644
index 00000000000..38c344ad697
--- /dev/null
+++ b/ld/testsuite/ld-elf/nosectionheader-2.d
@@ -0,0 +1,4 @@ 
+#source: start.s
+#ld: -r -z nosectionheader
+#error:  -r and -z nosectionheader may not be used together
+#xfail: [uses_genelf]