On 14/07/2026 11:09, Torbjörn SVENSSON wrote:
> Ok for trunk, releases/gcc-16 and releases/gcc-15?
> 

OK.

R.

> --
> 
> Add arm_v8_1m_mve_link to check that the options selected by
> arm_v8_1m_mve_ok can link successfully.
> 
> Without a link test, the board specific ldflags might contain flags that
> are incompatible with the linkage of the test case, for example the
> built testglue.c from dejagnu is known to cause issues.
> 
> gcc/ChangeLog:
> 
>       * doc/sourcebuild.texi (arm_v8_1m_mve_link): Document.
> 
> gcc/testsuite/ChangeLog:
> 
>       * gcc.target/arm/pr110268-1.c: Use arm_v8_1m_mve_link.
>       * gcc.target/arm/pr110268-2.c: Likewise
>       * lib/target-supports.exp (arm_v8_1m_mve_link): New.
> 
> Signed-off-by: Torbjörn SVENSSON <[email protected]>
> ---
>  gcc/doc/sourcebuild.texi                  |  5 +++++
>  gcc/testsuite/gcc.target/arm/pr110268-1.c |  3 +--
>  gcc/testsuite/gcc.target/arm/pr110268-2.c |  3 +--
>  gcc/testsuite/lib/target-supports.exp     | 17 +++++++++++++++++
>  4 files changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
> index c464bede5b2..0e08ef5e645 100644
> --- a/gcc/doc/sourcebuild.texi
> +++ b/gcc/doc/sourcebuild.texi
> @@ -2235,6 +2235,11 @@ ARM target supports options to generate instructions 
> from ARMv8.1-M with
>  the M-Profile Vector Extension (MVE). Some multilibs may be incompatible
>  with these options.
>  
> +@item arm_v8_1m_mve_link
> +ARM target supports linking programs using the options selected by
> +@code{arm_v8_1m_mve_ok}. Some multilibs may be incompatible with these
> +options.
> +
>  @item arm_v8_1m_mve_fp_ok
>  ARM target supports options to generate instructions from ARMv8.1-M with
>  the Half-precision floating-point instructions (HP), Floating-point Extension
> diff --git a/gcc/testsuite/gcc.target/arm/pr110268-1.c 
> b/gcc/testsuite/gcc.target/arm/pr110268-1.c
> index 1243e4b14b6..d8077023c42 100644
> --- a/gcc/testsuite/gcc.target/arm/pr110268-1.c
> +++ b/gcc/testsuite/gcc.target/arm/pr110268-1.c
> @@ -1,6 +1,5 @@
>  /* { dg-do link }  */
> -/* { dg-require-effective-target arm_arch_v8_1m_main_link } */ /* Make sure 
> we have suitable multilibs to link successfully.  */
> -/* { dg-require-effective-target arm_v8_1m_mve_ok } */
> +/* { dg-require-effective-target arm_v8_1m_mve_link } */
>  /* { dg-add-options arm_v8_1m_mve } */
>  /* { dg-additional-options "-O2 -flto" } */
>  
> diff --git a/gcc/testsuite/gcc.target/arm/pr110268-2.c 
> b/gcc/testsuite/gcc.target/arm/pr110268-2.c
> index 823e708f8fd..4093718736d 100644
> --- a/gcc/testsuite/gcc.target/arm/pr110268-2.c
> +++ b/gcc/testsuite/gcc.target/arm/pr110268-2.c
> @@ -1,6 +1,5 @@
>  /* { dg-do link }  */
> -/* { dg-require-effective-target arm_arch_v8_1m_main_link } */ /* Make sure 
> we have suitable multilibs to link successfully.  */
> -/* { dg-require-effective-target arm_v8_1m_mve_ok } */
> +/* { dg-require-effective-target arm_v8_1m_mve_link } */
>  /* { dg-add-options arm_v8_1m_mve } */
>  /* { dg-additional-options "-O2 -flto" } */
>  
> diff --git a/gcc/testsuite/lib/target-supports.exp 
> b/gcc/testsuite/lib/target-supports.exp
> index cab72c8a9e1..edd1290bd9e 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -7150,6 +7150,23 @@ proc check_effective_target_arm_v8_1m_mve_ok { } {
>               check_effective_target_arm_v8_1m_mve_ok_nocache]
>  }
>  
> +# Return 1 if the target can link ARMv8.1-M MVE code using the
> +# options selected by arm_v8_1m_mve_ok, 0 otherwise.
> +
> +proc check_effective_target_arm_v8_1m_mve_link { } {
> +    if { ![check_effective_target_arm_v8_1m_mve_ok] } {
> +     return 0
> +    }
> +
> +    return [check_no_compiler_messages arm_v8_1m_mve_link executable {
> +     int
> +     main (void)
> +     {
> +       return 0;
> +     }
> +    } [add_options_for_arm_v8_1m_mve ""]]
> +}
> +
>  proc add_options_for_arm_v8_1m_mve { flags } {
>      if { ! [check_effective_target_arm_v8_1m_mve_ok] } {
>       return "$flags"

Reply via email to