testsuite: Improve signal supporting detection

Message ID 20200721072130.53494-1-kito.cheng@sifive.com
State New
Headers show
Series
  • testsuite: Improve signal supporting detection
Related show

Commit Message

Kito Cheng July 21, 2020, 7:21 a.m.
gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_effective_target_signal): Check
	signal supporting by checking signal.h, signal and raise is available.
---
 gcc/testsuite/lib/target-supports.exp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
2.27.0

Patch

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 57eed3012b94..a97e253129ad 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -575,7 +575,15 @@  proc check_effective_target_signal { } {
     if [target_info exists gcc,signal_suppress] {
       return 0
     }
-    return 1
+    return [check_no_compiler_messages signal_h_available executable {
+#include <signal.h>
+static void signal_handler(int signal) {
+}
+int main() {
+    signal(SIGINT, signal_handler);
+    raise(SIGINT);
+    return 0;
+} } ""]
 }
 
 # Return 1 if according to target_info struct and explicit target list