[v3,5/7] binutils: Add a --strip-section-headers test

Message ID 20230605153222.1728119-6-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 5, 2023, 3:32 p.m. UTC
  PR ld/25617
	* testsuite/binutils-all/objcopy.exp: Run strip-section-headers-1.
	* testsuite/binutils-all/strip-section-headers-1.d: New file.
---
 binutils/testsuite/binutils-all/objcopy.exp               | 5 +++++
 binutils/testsuite/binutils-all/strip-section-headers-1.d | 5 +++++
 2 files changed, 10 insertions(+)
 create mode 100644 binutils/testsuite/binutils-all/strip-section-headers-1.d
  

Patch

diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 361e430f119..41add0fecda 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -1357,6 +1357,11 @@  if [is_elf_format] {
         verbose [file rootname $t]
         run_dump_test [file rootname $t]
     }
+
+    # Test --strip-section-headers
+    run_dump_test "strip-section-headers-1" [list \
+			  [list source strip-15${reloc_format}.s] \
+			  [list as "${elf64} --defsym RELOC=${reloc}"]]
 }
 run_dump_test "localize-hidden-2"
 
diff --git a/binutils/testsuite/binutils-all/strip-section-headers-1.d b/binutils/testsuite/binutils-all/strip-section-headers-1.d
new file mode 100644
index 00000000000..dc249bba779
--- /dev/null
+++ b/binutils/testsuite/binutils-all/strip-section-headers-1.d
@@ -0,0 +1,5 @@ 
+#PROG: strip
+#strip: -g --strip-section-headers
+#readelf: -S
+
+There are no sections in this file.