public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add explicit shared check to eh-frame-hdr test.
@ 2018-01-09  3:32 Jim Wilson
  2018-01-09  8:30 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Wilson @ 2018-01-09  3:32 UTC (permalink / raw)
  To: binutils; +Cc: Jim Wilson

This is an attempt to fix the ld-elf/eh-frame-hdr test which requires both
cfi and shared support.  Currently it has an explicit list of targets that
have cfi support but not shared support, which is inconvenient.  Adding a
shared target similar to the cfi target could solve this.  However, #target
provides an OR function, and I need an AND function, so I added a new
option #alltargets to get the right result.

This was tested with riscv{32,64}-{elf,linux}.  The test is no longer run
for the elf targets, but is still run for the linux targets.  I also checked
the other affected targets (avr, or1k, pru, visium) and got the expected result
which is that the test was not run for them.  I also tested x86_64-linux.  The
test is still run there.

OK?

Jim

	ld/
	* testsuite/ld-elf/eh-frame-hdr.d (#xfail): Delete
	(#alltargets): Renamed from #target.  Add shared.
	* testsuite/lib/ld-lib.exp (run_dump_test): Document shared target.
	Document alltargets option.  Add support for alltargets option.
	(istarget): Add support for shared target.
---
 ld/testsuite/ld-elf/eh-frame-hdr.d |  4 +---
 ld/testsuite/lib/ld-lib.exp        | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/ld/testsuite/ld-elf/eh-frame-hdr.d b/ld/testsuite/ld-elf/eh-frame-hdr.d
index 08b12d865f..12e79f4915 100644
--- a/ld/testsuite/ld-elf/eh-frame-hdr.d
+++ b/ld/testsuite/ld-elf/eh-frame-hdr.d
@@ -1,9 +1,7 @@
 #source: eh-frame-hdr.s
 #ld: -e _start --eh-frame-hdr
 #objdump: -hw
-#target: cfi
-#xfail: avr*-*-* or1k*-*-elf or1k*-*-rtems* pru-*-* visium-*-*
-# These targets support CFI generation but not shared libraries.
+#alltargets: cfi shared
 #...
   [0-9] .eh_frame_hdr +0*[12][048c] .*
 #pass
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index bfbc30d600..52baf0b04c 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -519,7 +519,13 @@ proc ld_link_defsyms {} {
 #   target: TARGET
 #       Only run the test for TARGET.  This may occur more than once; the
 #       target being tested must match at least one.  You may provide target
-#       name "cfi" for any target supporting the CFI statements.
+#       name "cfi" for any target supporting the CFI statements.  You may
+#       provide target name "shared" for any target supporting shared
+#       libraries.
+#
+#   alltargets: TARGET
+#       Only run the test for TARGET.  This may occur more than once; the
+#       target being tested must match all of them.
 #
 #   notarget: TARGET
 #       Do not run the test for TARGET.  This may occur more than once;
@@ -599,6 +605,7 @@ proc run_dump_test { name {extra_options {}} } {
     set opts(ld_after_inputfiles) {}
     set opts(xfail) {}
     set opts(target) {}
+    set opts(alltargets) {}
     set opts(notarget) {}
     set opts(objdump) {}
     set opts(nm) {}
@@ -628,6 +635,7 @@ proc run_dump_test { name {extra_options {}} } {
 	switch -- $opt_name {
 	    xfail {}
 	    target {}
+	    alltargets {}
 	    notarget {}
 	    warning {}
 	    error {}
@@ -726,6 +734,11 @@ proc run_dump_test { name {extra_options {}} } {
 	    return
 	}
     }
+    foreach targ $opts(alltargets) {
+	if ![istarget $targ] {
+	    return
+	}
+    }
     foreach targ $opts(notarget) {
 	if [istarget $targ] {
 	    return
@@ -2152,6 +2165,9 @@ proc istarget { target } {
     if {$target == "cfi"} {
 	return [check_as_cfi]
     }
+    if {$target == "shared"} {
+	return [check_shared_lib_support]
+    }
     return [istarget_ld $target]
 }
 
-- 
2.14.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add explicit shared check to eh-frame-hdr test.
  2018-01-09  3:32 [PATCH] Add explicit shared check to eh-frame-hdr test Jim Wilson
@ 2018-01-09  8:30 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2018-01-09  8:30 UTC (permalink / raw)
  To: Jim Wilson; +Cc: binutils

On Mon, Jan 08, 2018 at 07:32:28PM -0800, Jim Wilson wrote:
> 	ld/
> 	* testsuite/ld-elf/eh-frame-hdr.d (#xfail): Delete
> 	(#alltargets): Renamed from #target.  Add shared.
> 	* testsuite/lib/ld-lib.exp (run_dump_test): Document shared target.
> 	Document alltargets option.  Add support for alltargets option.
> 	(istarget): Add support for shared target.

Thumbs up from me.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-09  8:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-09  3:32 [PATCH] Add explicit shared check to eh-frame-hdr test Jim Wilson
2018-01-09  8:30 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).