public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Test for linking for arm/size-optimization-ieee-[123].c
@ 2022-03-31  1:24 Alexandre Oliva
  2022-03-31 11:03 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Oliva @ 2022-03-31  1:24 UTC (permalink / raw)
  To: gcc-patches


These tests require a target that supports arm soft-float.  The
problem is that the test checks for compile-time soft-float support,
but they may hit a problem when the linker complains that it can't
combine the testcase's object file with hard-float init files and
target system libraries.

I don't see that the tests actually require linking, and they could be
simplified to dg-do assemble, but I figured a link test for soft-float
support could be useful, so I added that, and adjusted the tests to
require it instead.

Tested on an affected platform.  Ok to install?


for  gcc/testsuite/ChangeLog

	* lib/target-supports.exp
	(check_effective_target_arm_soft_ok_link): New.
	* gcc.target/arm/size-optimization-ieee-1.c: Use it.
	* gcc.target/arm/size-optimization-ieee-2.c: Likewise.
	* gcc.target/arm/size-optimization-ieee-3.c: Likewise.
---
 .../gcc.target/arm/size-optimization-ieee-1.c      |    2 +-
 .../gcc.target/arm/size-optimization-ieee-2.c      |    2 +-
 .../gcc.target/arm/size-optimization-ieee-3.c      |    2 +-
 gcc/testsuite/lib/target-supports.exp              |   12 ++++++++++++
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
index 61475eb4c679f..9af2c6e102071 100644
--- a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
+++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
@@ -1,4 +1,4 @@
-/* { dg-do link { target arm_soft_ok } } */
+/* { dg-do link { target arm_soft_ok_link } } */
 /* { dg-skip-if "Feature is -mfloat-abi=soft only" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
 /* { dg-options "-mfloat-abi=soft" } */
 
diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
index b4699271ceacc..e78a7ada62eb7 100644
--- a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
+++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
@@ -1,4 +1,4 @@
-/* { dg-do link { target arm_soft_ok } } */
+/* { dg-do link { target arm_soft_ok_link } } */
 /* { dg-skip-if "Feature is -mfloat-abi=soft only" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
 /* { dg-options "-mfloat-abi=soft" } */
 
diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-3.c b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-3.c
index 34b1ebe7afd60..bb9ccefda5e95 100644
--- a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-3.c
+++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-3.c
@@ -1,4 +1,4 @@
-/* { dg-do link { target arm_soft_ok } } */
+/* { dg-do link { target arm_soft_ok_link } } */
 /* { dg-skip-if "Feature is -mfloat-abi=soft only" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
 /* { dg-options "-mfloat-abi=soft" } */
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index a1aef0e0a1622..ff8edbd3e1776 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -3935,6 +3935,18 @@ proc check_effective_target_arm_soft_ok { } {
 	} "-mfloat-abi=soft"]
 }
 
+# Return 1 if this is an ARM target supporting -mfloat-abi=soft even
+# for linking.  Some multilibs may be incompatible with this option,
+# and some linkers may reject incompatible options.
+
+proc check_effective_target_arm_soft_ok_link { } {
+    return [check_no_compiler_messages arm_soft_ok_link executable {
+	#include <stdint.h>
+	int dummy;
+	int main (void) { return 0; }
+	} "-mfloat-abi=soft"]
+}
+
 # Return 1 if this is an ARM target supporting -mfpu=vfp with an
 # appropriate abi.
 


-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

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

* Re: Test for linking for arm/size-optimization-ieee-[123].c
  2022-03-31  1:24 Test for linking for arm/size-optimization-ieee-[123].c Alexandre Oliva
@ 2022-03-31 11:03 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2022-03-31 11:03 UTC (permalink / raw)
  To: Alexandre Oliva via Gcc-patches; +Cc: Alexandre Oliva

Alexandre Oliva via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> These tests require a target that supports arm soft-float.  The
> problem is that the test checks for compile-time soft-float support,
> but they may hit a problem when the linker complains that it can't
> combine the testcase's object file with hard-float init files and
> target system libraries.
>
> I don't see that the tests actually require linking, and they could be
> simplified to dg-do assemble, but I figured a link test for soft-float
> support could be useful, so I added that, and adjusted the tests to
> require it instead.
>
> Tested on an affected platform.  Ok to install?
>
>
> for  gcc/testsuite/ChangeLog
>
> 	* lib/target-supports.exp
> 	(check_effective_target_arm_soft_ok_link): New.
> 	* gcc.target/arm/size-optimization-ieee-1.c: Use it.
> 	* gcc.target/arm/size-optimization-ieee-2.c: Likewise.
> 	* gcc.target/arm/size-optimization-ieee-3.c: Likewise.

OK, thanks.

Richard

> ---
>  .../gcc.target/arm/size-optimization-ieee-1.c      |    2 +-
>  .../gcc.target/arm/size-optimization-ieee-2.c      |    2 +-
>  .../gcc.target/arm/size-optimization-ieee-3.c      |    2 +-
>  gcc/testsuite/lib/target-supports.exp              |   12 ++++++++++++
>  4 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
> index 61475eb4c679f..9af2c6e102071 100644
> --- a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
> +++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
> @@ -1,4 +1,4 @@
> -/* { dg-do link { target arm_soft_ok } } */
> +/* { dg-do link { target arm_soft_ok_link } } */
>  /* { dg-skip-if "Feature is -mfloat-abi=soft only" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
>  /* { dg-options "-mfloat-abi=soft" } */
>  
> diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
> index b4699271ceacc..e78a7ada62eb7 100644
> --- a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
> +++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
> @@ -1,4 +1,4 @@
> -/* { dg-do link { target arm_soft_ok } } */
> +/* { dg-do link { target arm_soft_ok_link } } */
>  /* { dg-skip-if "Feature is -mfloat-abi=soft only" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
>  /* { dg-options "-mfloat-abi=soft" } */
>  
> diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-3.c b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-3.c
> index 34b1ebe7afd60..bb9ccefda5e95 100644
> --- a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-3.c
> +++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-3.c
> @@ -1,4 +1,4 @@
> -/* { dg-do link { target arm_soft_ok } } */
> +/* { dg-do link { target arm_soft_ok_link } } */
>  /* { dg-skip-if "Feature is -mfloat-abi=soft only" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
>  /* { dg-options "-mfloat-abi=soft" } */
>  
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index a1aef0e0a1622..ff8edbd3e1776 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -3935,6 +3935,18 @@ proc check_effective_target_arm_soft_ok { } {
>  	} "-mfloat-abi=soft"]
>  }
>  
> +# Return 1 if this is an ARM target supporting -mfloat-abi=soft even
> +# for linking.  Some multilibs may be incompatible with this option,
> +# and some linkers may reject incompatible options.
> +
> +proc check_effective_target_arm_soft_ok_link { } {
> +    return [check_no_compiler_messages arm_soft_ok_link executable {
> +	#include <stdint.h>
> +	int dummy;
> +	int main (void) { return 0; }
> +	} "-mfloat-abi=soft"]
> +}
> +
>  # Return 1 if this is an ARM target supporting -mfpu=vfp with an
>  # appropriate abi.

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

end of thread, other threads:[~2022-03-31 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31  1:24 Test for linking for arm/size-optimization-ieee-[123].c Alexandre Oliva
2022-03-31 11:03 ` Richard Sandiford

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).