public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite, i386: Only check for cfi directives if supported [PR112729]
@ 2023-11-28 12:26 Rainer Orth
  2023-11-29 13:55 ` Rainer Orth
  0 siblings, 1 reply; 2+ messages in thread
From: Rainer Orth @ 2023-11-28 12:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: Hongyu Wang, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 1280 bytes --]

gcc.target/i386/apx-interrupt-1.c and two more tests FAIL on Solaris/x86
with the native assembler.  Like Darwin as, it doesn't support cfi
directives.  Instead of adding more and more targets in every affected
test, this patch introduces a cfi effective-target keyword to check for
the prerequisite.

Tested on i386-pc-solaris2.11 (as and gas), x86_64-pc-linux-gnu, and
x86_64-apple-darwin23.1.0.

Any comments on the CFI detection in target-supports.exp?  Otherwise,
I'll commit the patch as is.

The tests still FAIL on Solaris/x86 and FreeBSD/x86_64 with gas due to
their -fno-omit-frame-pointer default; this will be addressed
separately.

Thanks.
	Raine

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-11-24  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc/testsuite:
	PR testsuite/112729
	* lib/target-supports.exp (check_effective_target_cfi): New proc.
	* gcc.target/i386/apx-interrupt-1.c: Require cfi instead of
	skipping on *-*-darwin*.
	* gcc.target/i386/apx-push2pop2_force_drap-1.c: Likewise.
	* gcc.target/i386/apx-push2pop2-1.c: Likewise.

	gcc:
	PR testsuite/112729
	* doc/sourcebuild.texi (Effective-Target Keywords, Environment
	attributes): Document cfi.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: testsuite-i386-cfi-support.patch --]
[-- Type: text/x-patch, Size: 2839 bytes --]

# HG changeset patch
# Parent  4c217a4922ab8f91e45518fef88ad562f71fc0a5
testsuite, i386: Only check for cfi directives if supported

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2671,6 +2671,9 @@ The language for the compiler under test
 @item c99_runtime
 Target provides a full C99 runtime.
 
+@item cfi
+Target supports DWARF CFI directives.
+
 @item correct_iso_cpp_string_wchar_protos
 Target @code{string.h} and @code{wchar.h} headers provide C++ required
 overloads for @code{strchr} etc. functions.
diff --git a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-mapx-features=egpr -m64 -O2 -mgeneral-regs-only -mno-cld -mno-push-args -maccumulate-outgoing-args" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 extern void foo (void *) __attribute__ ((interrupt));
 extern int bar (int);
diff --git a/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c b/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-O2 -mapx-features=push2pop2" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 extern int bar (int);
 
diff --git a/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c b/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-O2 -mapx-features=push2pop2 -mforce-drap" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 #include "apx-push2pop2-1.c"
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -10082,6 +10082,18 @@ proc check_effective_target_c99_runtime 
     }]
 }
 
+# Return 1 if the target supports DWARF CFI directives.
+
+proc check_effective_target_cfi { } {
+    return [check_no_compiler_messages cfi assembly {
+	#ifdef __GCC_HAVE_DWARF2_CFI_ASM
+        /* ok */
+	#else
+	#error unsupported
+	#endif
+    } ""]
+}
+
 # Return 1 if the target provides the D runtime.
 
 proc check_effective_target_d_runtime { } {

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

* Re: [PATCH] testsuite, i386: Only check for cfi directives if supported [PR112729]
  2023-11-28 12:26 [PATCH] testsuite, i386: Only check for cfi directives if supported [PR112729] Rainer Orth
@ 2023-11-29 13:55 ` Rainer Orth
  0 siblings, 0 replies; 2+ messages in thread
From: Rainer Orth @ 2023-11-29 13:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: Hongyu Wang, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> gcc.target/i386/apx-interrupt-1.c and two more tests FAIL on Solaris/x86
> with the native assembler.  Like Darwin as, it doesn't support cfi
> directives.  Instead of adding more and more targets in every affected
> test, this patch introduces a cfi effective-target keyword to check for
> the prerequisite.
>
> Tested on i386-pc-solaris2.11 (as and gas), x86_64-pc-linux-gnu, and
> x86_64-apple-darwin23.1.0.
>
> Any comments on the CFI detection in target-supports.exp?  Otherwise,
> I'll commit the patch as is.

Given that nobody found fault with the CFI detection, I've rebased the
patch to account for the -fomit-frame-pointer changes, retested and
committed it to trunk.

> The tests still FAIL on Solaris/x86 and FreeBSD/x86_64 with gas due to
> their -fno-omit-frame-pointer default; this will be addressed
> separately.

This has been handled now.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: testsuite-i386-cfi-support.patch --]
[-- Type: text/x-patch, Size: 2902 bytes --]

# HG changeset patch
# Parent  0314b8e4604293f389540a558f0c9580f957aaa1
testsuite, i386: Only check for cfi directives if supported

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2671,6 +2671,9 @@ The language for the compiler under test
 @item c99_runtime
 Target provides a full C99 runtime.
 
+@item cfi
+Target supports DWARF CFI directives.
+
 @item correct_iso_cpp_string_wchar_protos
 Target @code{string.h} and @code{wchar.h} headers provide C++ required
 overloads for @code{strchr} etc. functions.
diff --git a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-mapx-features=egpr -m64 -O2 -mgeneral-regs-only -mno-cld -mno-push-args -maccumulate-outgoing-args -fomit-frame-pointer" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 extern void foo (void *) __attribute__ ((interrupt));
 extern int bar (int);
diff --git a/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c b/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-O2 -mapx-features=push2pop2 -fomit-frame-pointer" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 extern int bar (int);
 
diff --git a/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c b/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
--- a/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-do compile { target { { ! ia32 } && cfi } } } */
 /* { dg-options "-O2 -mapx-features=push2pop2 -fomit-frame-pointer -mforce-drap" } */
-/* { dg-skip-if "does not emit .cfi_xxx" "*-*-darwin*" } */
 
 #include "apx-push2pop2-1.c"
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -10082,6 +10082,18 @@ proc check_effective_target_c99_runtime 
     }]
 }
 
+# Return 1 if the target supports DWARF CFI directives.
+
+proc check_effective_target_cfi { } {
+    return [check_no_compiler_messages cfi assembly {
+	#ifdef __GCC_HAVE_DWARF2_CFI_ASM
+        /* ok */
+	#else
+	#error unsupported
+	#endif
+    } ""]
+}
+
 # Return 1 if the target provides the D runtime.
 
 proc check_effective_target_d_runtime { } {

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

end of thread, other threads:[~2023-11-29 13:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 12:26 [PATCH] testsuite, i386: Only check for cfi directives if supported [PR112729] Rainer Orth
2023-11-29 13:55 ` Rainer Orth

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