ld/testsuite: skip ld-size when -shared is not supported

Message ID 20221109162611.760465-1-chigot@adacore.com
State Accepted
Headers
Series ld/testsuite: skip ld-size when -shared is not supported |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Clément Chigot Nov. 9, 2022, 4:26 p.m. UTC
  ld/ChangeLog:

        * testsuite/ld-size/size.exp: Skip when -shared is not
	supported.
---
 ld/testsuite/ld-size/size.exp | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Alan Modra Nov. 9, 2022, 9:37 p.m. UTC | #1
On Wed, Nov 09, 2022 at 05:26:11PM +0100, Clément Chigot via Binutils wrote:
>         * testsuite/ld-size/size.exp: Skip when -shared is not
> 	supported.

What does this catch that isn't already covered by the target test?
  
Clément Chigot Nov. 10, 2022, 7:54 a.m. UTC | #2
On Wed, Nov 9, 2022 at 10:37 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Wed, Nov 09, 2022 at 05:26:11PM +0100, Clément Chigot via Binutils wrote:
> >         * testsuite/ld-size/size.exp: Skip when -shared is not
> >       supported.
>
> What does this catch that isn't already covered by the target test?

It does in a wide approach. But it doesn't allow custom targets (as I
do) where shared support is explicitly disabled.
It might not have a big impact but it looks logical to me to check for
-shared (both linker and compiler by the way) before running any tests
related to that.
I've pushed other similar patches recently (see ld-arm or ld-shared).

Thanks,
Clément
  
Alan Modra Nov. 10, 2022, 9 a.m. UTC | #3
On Thu, Nov 10, 2022 at 08:54:04AM +0100, Clément Chigot wrote:
> On Wed, Nov 9, 2022 at 10:37 PM Alan Modra <amodra@gmail.com> wrote:
> >
> > On Wed, Nov 09, 2022 at 05:26:11PM +0100, Clément Chigot via Binutils wrote:
> > >         * testsuite/ld-size/size.exp: Skip when -shared is not
> > >       supported.
> >
> > What does this catch that isn't already covered by the target test?
> 
> It does in a wide approach. But it doesn't allow custom targets (as I
> do) where shared support is explicitly disabled.
> It might not have a big impact but it looks logical to me to check for
> -shared (both linker and compiler by the way) before running any tests
> related to that.
> I've pushed other similar patches recently (see ld-arm or ld-shared).

OK, the patch is fine.
  

Patch

diff --git a/ld/testsuite/ld-size/size.exp b/ld/testsuite/ld-size/size.exp
index e15962886cd..64793c00948 100644
--- a/ld/testsuite/ld-size/size.exp
+++ b/ld/testsuite/ld-size/size.exp
@@ -33,6 +33,12 @@  if {!(([istarget "i?86-*-*"]
     return
 }
 
+# Skip when -shared is not supported
+if { ![check_shared_lib_support] } {
+    verbose "Size relocation tests not run - shared support disabled"
+    return
+}
+
 # So as to avoid rewriting every last test case here in a nacl variant,
 # we use black magic to massage the generic cases into nacl-variant cases.
 if [istarget "*-*-nacl*"] {