[v2,6/6] ld: Add -z nosectionheader test to bootstrap.exp

Message ID 20210703201402.1136267-7-hjl.tools@gmail.com
State New
Headers show
Series
  • ELF: Strip section header in ELF objects
Related show

Commit Message

Luis Machado via Binutils July 3, 2021, 8:14 p.m.
PR ld/25617
	* testsuite/ld-bootstrap/bootstrap.exp: Add -z nosectionheader
	test.
---
 ld/testsuite/ld-bootstrap/bootstrap.exp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

-- 
2.31.1

Patch

diff --git a/ld/testsuite/ld-bootstrap/bootstrap.exp b/ld/testsuite/ld-bootstrap/bootstrap.exp
index 2e4a09704ab..ebbcefb1962 100644
--- a/ld/testsuite/ld-bootstrap/bootstrap.exp
+++ b/ld/testsuite/ld-bootstrap/bootstrap.exp
@@ -59,6 +59,9 @@  set test_flags {"" "strip" "--static" "-Wl,--traditional-format"
 if { [istarget "powerpc-*-*"] } {
     lappend test_flags "-Wl,--ppc476-workaround"
 }
+if { [is_elf_format] && ![is_bad_symtab] } {
+    lappend test_flags "-Wl,-z,nosectionheader"
+}
 
 set gcc_B_opt_save $gcc_B_opt
 
@@ -85,9 +88,12 @@  foreach flags $test_flags {
 	set testname "bootstrap"
     }}
 
-    # --static is meaningless and --relax is incompatible with -r.
+    # --static is meaningless.  --relax and -z nosectionheader are
+    # incompatible with -r.
     regsub -- "-Wl," $flags "" partial_flags
-    if { "$partial_flags" == "--static" || "$partial_flags" == "--relax" } {
+    if { "$partial_flags" == "--static" \
+         || "$partial_flags" == "--relax" \
+	 || [string match "*nosectionheader*" "$partial_flags"] } {
 	set partial_flags ""
     }