Skip jit tests for targets that don't support -lgccjit
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 14 May 2020 23:34:52 +0000 (16:34 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 14 May 2020 23:35:03 +0000 (16:35 -0700)
Since libgccjit.so is linked into jit tests, skip jit tests for targets
that don't support -lgccjit.

gcc/

PR jit/94778
* doc/sourcebuild.texi: Document effective target lgccjit.

gcc/testsuite/

PR jit/94778
* jit.dg/jit.exp: Skip jit tests for targets that don't support
-lgccjit.
* lib/target-supports.exp (check_effective_target_lgccjit): New.

gcc/ChangeLog
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/jit.dg/jit.exp
gcc/testsuite/lib/target-supports.exp

index 27b4b04f9b0df7a0422403144f5d98c7bb134a78..d855ee6d86cf5bffa9228668a8ea2ac9ec726483 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR jit/94778
+       * doc/sourcebuild.texi: Document effective target lgccjit.
+
 2020-05-14  Andrew Stubbs  <ams@codesourcery.com>
 
        * config/gcn/gcn-valu.md (add<mode>3_zext_dup): Change to a
index 240d6e4b08e2ed1a3742c4e82b98d284b9774216..0f70e4baca963e1c14adbbd8ec0d01f20ab88362 100644 (file)
@@ -2494,6 +2494,9 @@ Target uses comdat groups.
 @item indirect_calls
 Target supports indirect calls, i.e. calls where the target is not
 constant.
+
+@item lgccjit
+Target supports -lgccjit, i.e. libgccjit.so can be linked into jit tests.
 @end table
 
 @subsubsection Local to tests in @code{gcc.target/i386}
index 7319b2026cda4d5cae92d8060a7bda9b1651c46f..8dfdfc6c3c0f21895b96080dd97fa413072e8988 100644 (file)
@@ -1,3 +1,10 @@
+2020-05-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR jit/94778
+       * jit.dg/jit.exp: Skip jit tests for targets that don't support
+       -lgccjit.
+       * lib/target-supports.exp (check_effective_target_lgccjit): New.
+
 2020-05-14  Andrew Stubbs  <ams@codesourcery.com>
 
        * testsuite/gcc.target/gcn/gcn.exp: New file.
index 13e8ab4dbfe7f657f5bf90c1c8c36ea5c006a365..2f54681713b86c44069da88efd769e01f7c7bae4 100644 (file)
@@ -38,6 +38,11 @@ load_lib gcc.exp
 load_lib g++.exp
 load_lib dejagnu.exp
 
+# Skip these tests for targets that don't support -lgccjit
+if { ![check_effective_target_lgccjit] } {
+    return
+}
+
 # Look for lines of the form:
 #   definitely lost: 11,316 bytes in 235 blocks
 #   indirectly lost: 352 bytes in 4 blocks
index 88f4a9cd812c4e6a20a04186c4b1b259afebbaad..3e91a81dd5a15ca7b5baad8c0fb46cf794bbe3b8 100644 (file)
@@ -10234,3 +10234,18 @@ proc check_effective_target_indirect_calls { } {
   }
   return 1
 }
+
+# Return 1 if we can use the -lgccjit option, 0 otherwise.
+
+proc check_effective_target_lgccjit { } {
+  if { [info procs jit_target_compile] == "" } then {
+    global GCC_UNDER_TEST
+    if ![info exists GCC_UNDER_TEST] {
+      set GCC_UNDER_TEST "[find_gcc]"
+    }
+    proc jit_target_compile { source dest type options } [info body gcc_target_compile]
+  }
+  return [check_no_compiler_messages lgccjit executable {
+     int main() { return 0; }
+  } "-lgccjit"]
+}