https://gcc.gnu.org/g:d74edc4c7929be882daf9cd960ad875d820773b1
commit r17-2396-gd74edc4c7929be882daf9cd960ad875d820773b1 Author: Torbjörn SVENSSON <[email protected]> Date: Tue Jul 14 11:59:45 2026 +0200 testsuite: arm: Add MVE link effective target 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]> Diff: --- 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 c464bede5b24..0e08ef5e6454 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 1243e4b14b6d..d8077023c42f 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 823e708f8fd3..4093718736da 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 cab72c8a9e10..edd1290bd9e3 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"
